-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.html
More file actions
204 lines (200 loc) · 8.85 KB
/
page.html
File metadata and controls
204 lines (200 loc) · 8.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, target-densitydpi=device-dpi" />
<title>TVS DClone Tool</title>
<link rel="stylesheet" href="css/jquery.mobile-1.1.0.min.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.1.0.min.js"></script>
<script type="text/javascript" src="js/jquery.maskedinput-1.3.min.js"></script>
<script type="text/javascript" src="js/jquery.form.js"></script>
<script type="text/javascript">
var orgdisk = "none",destdisk = "none";
var lastdata = 0, totaldata = 0, currentdata = 0, rate = 0, time = "NaN";
var timepredikter;
var worktime = 0;
$(document).bind("mobileinit", function(){
$.mobile.ajaxFormsEnabled = false;
$.mobile.selectmenu.prototype.options.nativeMenu = false;
});
jQuery.fn.center = function () {
this.css("position","absolute");
this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px");
this.css("left", (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px");
return this;
}
jQuery.fn.vcenter = function () {
this.css("position","absolute");
this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px");
return this;
}
jQuery.fn.hcenter = function () {
this.css("position","absolute");
this.css("left", (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px");
return this;
}
$(document).ready(function(){
$('#content').css('backgroundImage', 'url(\'imgs/bg32_light.png\'), -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 250, from(#EEEEEE), to(#333333))' );
$('.collapsible .head').click(function() {
$(this).next().toggle('slow');
return false;
}).next().hide();
$('#diskorgdata').hide();
$('#diskdestdata').hide();
$('#origem').change(function() {
diskCallBack($(this).attr('value'),true);
});
$('#destino').change(function() {
diskCallBack($(this).attr('value'),false);
});
window.blinker = setInterval(function(){
$(".blink").animate({opacity:0.3},400,"linear",function(){
$(this).animate({opacity:1},400);
});
},900);
$('#warndiv').hide();
location.href='callback://loaddisks:none';
$('#origem').append('<option value="none">Nenhum disco</option>').selectmenu('refresh', true);
$('#destino').append('<option value="none">Nenhum disco</option>').selectmenu('refresh', true);
$('#progressdiv').hide();
$('#finishdiv').hide();
//setInterval(function() { $('#progress').val($('#progress').val()+1); }, 1000);
});
function diskCallBack(disk,pos) {
if(disk != "none" && disk != "RAW")
location.href='callback://loaddiskdata:'+(pos?"origem":"destino")+":"+disk;
else if (disk == "RAW") {
if(pos) {
location.href='callback://selectfilesource:none';
$('#diskorgdata').hide('slow');
}else{
location.href='callback://selectfiledestiny:none';
$('#diskdestdata').hide('slow');
}
}else
if(pos)
$('#diskorgdata').hide('slow');
else
$('#diskdestdata').hide('slow');
if(pos)
orgdisk = disk;
else
destdisk = disk;
if( (orgdisk != destdisk) && (orgdisk != "none") && (destdisk != "none") ) {
$('#startclone').button('enable');
$('#warndiv').show();
}else{
$('#startclone').button('disable');
$('#warndiv').hide();
}
}
function addDiskOrg(disk,model) {
console.log("Adicionando disco a lista: "+disk);
$('#origem').append('<option value="'+disk+'">'+disk+' - '+model+'</option>').selectmenu('refresh', true);
}
function addDiskDest(disk,model) {
console.log("Adicionando disco a lista: "+disk);
$('#destino').append('<option value="'+disk+'">'+disk+' - '+model+'</option>').selectmenu('refresh', true);
}
function addDisk(disk,model) {
console.log("Adicionando disco a lista: "+disk);
$('#origem').append('<option value="'+disk+'">'+disk+' - '+model+'</option>').selectmenu('refresh', true);
$('#destino').append('<option value="'+disk+'">'+disk+' - '+model+'</option>').selectmenu('refresh', true);
}
function setDisk(diskdata,pos) {
if(pos) {
$("#orgdiskcont").html(diskdata);
$('#diskorgdata').show('slow');
}else{
$("#destdiskcont").html(diskdata);
$('#diskdestdata').show('slow');
}
}
function isEmpty( inputStr ) { if ( null == inputStr || "" == inputStr ) { return true; } return false; }
function startClone() {
$('#selectdiv').fadeOut(300, function() {$('#progressdiv').fadeIn(300);});
location.href='callback://startclone:none:'+orgdisk+':'+destdisk;
timepredikter = setInterval(estimartempo, 500);
}
function estimartempo() {
rate = (currentdata - lastdata)*2;
var tmptime = (totaldata-currentdata) / rate;
var minutos = Math.floor(tmptime / 60);
var segundos = Math.floor(tmptime - (minutos * 60));
var horas = Math.floor(minutos / 60);
minutos = minutos - (horas * 60);
time = horas+'h'+minutos+'m'+segundos+'s';
lastdata = currentdata;
worktime += 2;
var percent = Math.round((currentdata/totaldata)*100);
if(percent == 100)
finishCopy();
}
function updateProgress(datacopied,datatotal, time2) {
currentdata = datacopied;
totaldata = datatotal;
$('#message').html("<h3>Aguarde a copia de <B>"+orgdisk+"</B> para <B>"+destdisk+"</B></h3>Dados copiados: <B>"+datacopied+" MB</B> Total: <B>"+datatotal+" MB</B><BR>Taxa de Transferência: <B>"+rate+" MB/s</B><BR>Tempo estimado: <B>"+time+"</B><BR>");
var percent = Math.round((datacopied / datatotal) * 100);
$('#progress').val(percent);
$('#progresslabel').html(percent+"%");
}
function doExit() {
location.href='callback://exit'
}
function finishCopy() {
clearInterval(timepredikter);
var tmptime = worktime;
var minutos = Math.floor(tmptime / 60);
var segundos = Math.floor(tmptime - (minutos * 60));
var horas = Math.floor(minutos / 60);
minutos = minutos - (horas * 60);
worktime = horas+'h'+minutos+'m'+segundos+'s';
$('#finishdiv').html("<h3>Clonagem realizada com sucesso!</h3><BR>Tempo de trabalho: <b>"+worktime+"</b><BR><BR><input type=\"button\" onClick=\"doExit()\" value=\"Sair\">");
$('#progressdiv').fadeOut(300, function() { $('#finishdiv').fadeIn(300); });
}
</script>
<style type="text/css">
body {
width:640px;
height: 640px;
}
#content {
width: 640px;
height: 640px;
}
</style>
</head>
<body ALLOWTRANSPARENCY="true" style="background: url('imgs/bg32.jpg');">
<div id="content" data-role="page" class="content" >
<div id="selectdiv" class=" ui-content ui-body-a" style="padding: 5 10 5 10; text-align: center; opacity: 0.85; height: 630px;">
<img src="imgs/logo.png" width="240"><BR>
<div id="explanation">
Este aplicativo permite fazer a cópia bloco a bloco de um disco para outro.
Os discos podem ter tamanhos diferentes porém caso o disco de destino seja menor do que o de origem dados poderão ser perdidos.
</div>
Disco de Origem <select id="origem" data-native-menu="false" ></select><BR>
<div id="diskorgdata" data-role="collapsible">
<h3 >Conteúdo do disco de origem</h3>
<div id="orgdiskcont"></div>
</div>
Disco de Destino <select id="destino" data-native-menu="false" ></select><BR>
<div id="diskdestdata" data-role="collapsible">
<h3>Conteúdo do disco de destino</h3>
<div id="destdiskcont"></div>
</div>
<div id="warndiv" class="blink"><font color=red><B>Aviso! TODOS os dados no disco de destino serão perdidos!</B></font></div>
<input type="button" value="Clonar Disco" id="startclone" onClick="startClone()" disabled>
</div>
<div id="progressdiv" class="ui-content ui-body-a" style="padding: 5 10 5 10; text-align: center; vertical-align: middle; opacity: 0.85; height: 630px">
<div id="message">Aguarde enquanto é feito a cópia de /dev/XXX para /dev/YYY</div><BR>
<div style="width:430px;" align="center">
<fieldset class="ui-grid-a">
<div class="ui-block-a" style="width: 380px;"><progress id="progress" value="0" max="100" style="width: 380px; height:20px;"></progress></div>
<div class="ui-block-b" style="width: 50px; text-align: center;"><div align="center" id="progresslabel">XXX%</div></div>
</fieldset>
</div>
</div>
<div id="finishdiv" class="ui-content ui-body-a" style="padding: 5 10 5 10; text-align: center; vertical-align: middle; opacity: 0.85; height: 630px">
<div>
</div>
</body>
</html>