[Script Legal] Calculadora de Backs

  • Autor de hilo DeletedUser14506
  • Fecha de inicio

DeletedUser14506

Guest
El siguiente script lo encontré en el .fr. Lo estuve usando en francés pero lo dejo traducido al español.

Es una calculadora de Backs. Agiliza el cálculo de los ataques y funciona en una ventana emergente donde completamos 4 campos (los mismos que se utilizan para calcular cualquier back) y nos arroja el horario de lanzamiento del ataque.

Hora de llegada del ataque

Duración del ataque enemigo

Hora de regreso al pueblo enemigo (aquí es pegar el horario que nos arroja el primer cálculo)

Duración de nuestro ataque

Corregido:

[SPOIL]javascript:
(function () {
var popup=window.open ('about:blank','twfg','width=640,height=480,scroll bars=1');
popup.document.open ('text/html','replace');
var S = "<br />
<h2 style = 'text-align:center'>Virza\'s calculator</h2><hr />
<table align=\'center\' id = \'table\'>
<tr>
<td>Zona Horaria : <select id ='liste' name = \'liste\' size = \'1\' onChange = \'javascript: changeList(this);void(0)\'>
<option value = \'0\'>Elija su zona horaria</option>
<option value = \'-12\'>UTC -12</option>
<option value = \'-11\'>UTC -11</option>
<option value = \'-10\'>UTC -10</option>
<option value = \'-9\'>UTC -9</option>
<option value = \'-8\'>UTC -8</option>
<option value = \'-7\'>UTC -7</option>
<option value = \'-6\'>UTC -6</option>
<option value = \'-5\'>UTC -5</option>
<option value = \'-4\'>UTC -4</option>
<option value = \'-3\'>UTC -3</option>
<option value = \'-2\'>UTC -2</option>
<option value = \'-1\'>UTC -1</option>
<option value = \'0\'>UTC </option>
<option value = \'1\'>UTC +1</option>
<option value = \'2\'>UTC +2</option>
<option value = \'3\'>UTC +3</option>
<option value = \'4\'>UTC +4</option>
<option value = \'5\'>UTC +5</option>
<option value = \'6\'>UTC +6</option>
<option value = \'7\'>UTC +7</option>
<option value = \'8\'>UTC +8</option>
<option value = \'9\'>UTC +9</option>
<option value = \'10\'>UTC +10</option>
<option value = \'11\'>UTC +11</option>
<option value = \'12\'>UTC +12</option>
</select>
</td>
<td>
<div id=\"horlogeDiv\">CALCULADORA DE BACKS</div></td></tr></table>
<link rel=\"stylesheet\" type=\"text/css\" href=\"http://" + window.location.hostname + "/merged/game.css\"/>
</td>
</tr>

<hr />
<script type = \'text/javascript\'>

function updateHorloge () {
var dt=new Date();
var jours = Array('Dom', 'Lun', 'Mar', 'Mier', 'Juev', 'Vier', 'Sab');
var mois= Array('Ene.', 'Feb.', 'Mar', 'Abr.', 'Mayo', 'Jun', 'Jul.', 'Ago', 'Sept.', 'Oct.', 'Nov.', 'Dic.');
var Y=dt.getFullYear();
var M=mois[dt.getMonth()];
var D=dt.getDate();
if(D==1) {D='1er';}
var J =jours[dt.getDay()];
var h=dt.getHours();
h = h+ t - 1;
if(h<10) {h = '0' + h;}
var m = dt.getMinutes();
if(m<10) {m = '0' + m; }
var s=dt.getSeconds();
if(s<10) {s='0' + s;}
if(h>=24) {h -= 24; D += 1; J = jours[dt.getDay() + 1]; if(h<10) {h = '0' + h;}}
if(h<0) { h +=24; D-= 1; J = jours[dt.getDay() - 1]; if(h<10) {h = '0' + h;}}
document.getElementById('horlogeDiv').innerHTML=J+ ' '+D+' '+M+ ' ' +h+':' + m + ':' + s;
setTimeout(function () {
updateHorloge();
}, 1000);

}</script>";

S += "<script type = 'text/javascript'>
function focusT(champ) {
if(champ.value == \"Ingrese la hora del ataque\") {
champ.value = '';
}
else {
champ.select();
}
}

function blurT(champ) {
if(champ.value == '') {
champ.value = \"Ingrese la hora del ataque\";
}
}
function focusTi(champ) {
if(champ.value == \"Ingrese la duración\") {
champ.value = '';
}
else {
champ.select();
}
}

function blurTi(champ) {
if(champ.value == '') {
champ.value = \"Ingrese la duración\";
}
}
</script>

<h3 style = 'text-align:center'>Cálculo Horario</h3>
<table align = 'center' id = 'show'>
<tr>
<td>Back-Time</td><td>Snipe</td>
</tr>
<tr>
<td><input type = 'text' id = 'back' tabindex = '10' value = \"Ingrese la hora del ataque\" name = 'back' onfocus = 'javascript: focusT(this);void(0)' onblur = 'javascript: blurT(this);' /></td>
<td><input type = 'text' id = 'snipe' tabindex = '16' value = \"Ingrese la hora del ataque\" name = 'snipe' onfocus = 'javascript: focusT(this);void(0)' onblur = 'javascript: blurT(this);' /></td>
</tr>
<tr>
<td><input type = 'text' id = 'backT' tabindex = '13' value = \"Ingrese la duración\" name = 'backT' onfocus = 'javascript: focusTi(this);void(0)' onblur = 'javascript: blurTi(this);' /></td>
<td><input type = 'text' id = 'snipeT' tabindex = '19' value = \"Ingrese la duración\" name = 'snipeT' onfocus = 'javascript: focusTi(this);void(0)' onblur = 'javascript: blurTi(this);' /></td>
</tr>
<tr>
<td><input type = 'button' tabindex = '14' value = 'OK' onclick = 'javascript: backTime();void(0)'/></td>
<td><input type = 'button' tabindex = '20' value = 'OK' onclick = 'javascript: snipeO();void(0)'/></td>
</tr>
</table>
<table align = 'center'>
<br /><br />
<tr>
<td>
<textarea style = 'width:400px;height:100px;' tabindex = '22' name = 'texte' id = 'texte' value = '' onfocus = 'select();'></textarea>
</td>
<input type = 'button' tabindex = '24' name = 'reset' value = 'vaciar el campo' onclick = 'javascript: toReset();void(0)'/>
</tr>
</table>
<script type = 'text/javascript'>
function backTime() {
var timeArray = document.getElementById('back').value.split(':');
var travArray = document.getElementById('backT').value.split(':');
var H = parseInt(timeArray[0], 10) + parseInt(travArray[0], 10);
var M = parseInt(timeArray[1], 10) + parseInt(travArray[1], 10);
var S = parseInt(timeArray[2], 10) + parseInt(travArray[2], 10);
if(S > 60) {M += 1;S -= 60;}
if(M > 60) {H += 1;M -= 60;}
if(H >= 24) {H -= 24;}
if(S<10) {S = '0' + S;}
if(M<10) {M = '0' + M;}
if(H<10) {H = '0' + H;}
var resultat = H + ':' + M + ':' + S;
document.getElementById('texte').value += 'OFF enemiga estará de vuelta en su pueblo a ' + resultat + '';
}

function snipeO() {
var timeArray = document.getElementById('snipe').value.split(':');
var travArray = document.getElementById('snipeT').value.split(':') ;
var H = parseInt(timeArray[0], 10) - parseInt(travArray[0], 10);
var M = parseInt(timeArray[1], 10) - parseInt(travArray[1], 10);
var S = parseInt(timeArray[2], 10) - parseInt(travArray[2], 10);
if(S < 0) {S = 60 - (S * -1);M --;}
if(M < 0) {M = 60 - (M * -1);H --;}
if(H < 0 ) {H = 24 - (H * -1);if(H>10) {H = 'El día antes a ' + H;}else if(H<10) {H = 'La veille à 0' + H;}}
if(S<10) {S = '0' + S;}
if(M<10) {M = '0' + M;}
if(H<10) {H = '0' + H;}
var resultat = H + ':' + M + ':' + S;
document.getElementById('texte').value += 'Hora de lanzamiento : ' + resultat + '';
}
function toReset() {
document.getElementById('texte').value = '';
}
</script>";
S += "<a style = 'position:absolute; bottom:5%;'href = 'javascript: window.close()'>Cerrar</a>";

popup.document.write(S);
popup.document.close();
void(0)
})();[/SPOIL]

Espero que les sea de utilidad :cool:
 
Última edición por un moderador:
Arriba