Advertisement
SalimFadhil

backtime

Aug 25th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. // ==UserScript==
  2. // @name test
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://*/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. function calcular() {
  13. if(document.getElementById('bt1').value.match(/[0-9]{2}\:[0-9]{2}\:[0-9]{2}/) != null && document.getElementById('bt2').value.match(/[0-9]{2}\:[0-9]{2}\:[0-9]{2}/) != null) {
  14. var timeArray = document.getElementById('bt1').value.split(':');
  15. var travArray = document.getElementById('bt2').value.split(':');
  16. var result;
  17.  
  18. //Back Time
  19. var h = parseInt(timeArray[0], 10) + parseInt(travArray[0], 10);
  20. var m = parseInt(timeArray[1], 10) + parseInt(travArray[1], 10);
  21. var s = parseInt(timeArray[2], 10) + parseInt(travArray[2], 10);
  22.  
  23. if (s > 60) {
  24. m += 1;
  25. s -= 60;
  26. }
  27. if (m > 60) {
  28. h += 1;
  29. m -= 60;
  30. }
  31. if (h >= 24) {
  32. h -= 24;
  33. }
  34. if (s < 10) {
  35. s = '0' + s;
  36. }
  37. if (m < 10) {
  38. m = '0' + m;
  39. }
  40. if (h < 10) {
  41. h = '0' + h;
  42. }
  43. result = h + ':' + m + ':' + s;
  44. $("#resultado").html("قوات المهاجم سترجع في:&nbsp; " + result + ".");
  45.  
  46. //قنص
  47. var H = parseInt(timeArray[0], 10) - parseInt(travArray[0], 10);
  48. var M = parseInt(timeArray[1], 10) - parseInt(travArray[1], 10);
  49. var S = parseInt(timeArray[2], 10) - parseInt(travArray[2], 10);
  50.  
  51. if(S < 0) {S = 60 - (S * -1);M --;}
  52. if(M < 0) {M = 60 - (M * -1);H --;}
  53. if(H < 0 ) {H = 24 - (H * -1);if(H>10) {H = 'Ontem às ' + H;}else if(H<10) {H = 'Ontem às ' + H;}}
  54. if(S<10) {S = '0' + S;}
  55. if(M<10) {M = '0' + M;}
  56. if(H<10) {H = '0' + H;}
  57.  
  58. result = H + ':' + M + ':' + S;
  59. $("#resultado").html($("#resultado").html() + "<br />قنص: " + result);
  60. $("#resultado").fadeIn("slow");
  61. } else {
  62. $("#resultado").html("<p style='color: Blue;'>قم بوضع التوقيت <br />بهذا الشكل: 01:23:45</p> ");
  63. $("#resultado").fadeIn("slow");
  64. }
  65. }
  66.  
  67. var conteudo = $('#show_incoming_units').before('<center>'+
  68. '<br>'+
  69. '<b style="font-family:Times New Roman; font-size:18px;font-style:italic;">تم تعديل السكربت من قبل: <a id="Salim" href="https://forum.tribalwars.ae/index.php?members/abu-rajih.40926/" target="_blank" style="color:#111;font-family:Times New Roman;font-size:20px;font-style:italic;">سيد الاساطير</a>'+
  70. '</b></center>'+
  71. '<style>'+
  72. '#Salim{animation: salim 2s linear infinite;}'+
  73. '@keyframes salim{'+
  74. '0% {text-shadow:0 0 3px #0d0;}'+
  75. '20% {text-shadow:0 0 3px #d00;}'+
  76. '40% {text-shadow:0 0 3px #d0d;}'+
  77. '60% {text-shadow:0 0 3px #00d;}'+
  78. '75% {text-shadow:0 0 3px #000;}'+
  79. '90% {text-shadow:0 0 3px #f00;}'+
  80. '100%{text-shadow:0 0 3px #0d0;}}'+
  81. '</style></center>'+
  82. '<b style="font-family:times new roman"><div style="text-align: center;font-family:times new roman"> سرعة الوحده المتجهة للقرية:'+
  83. '<input placeholder=" 01:23:45" style="font-weight:bold;font-family:times new roman;text-align:center" type="text" id="bt2"> وقت وصول الهجمه:'+
  84. '<input placeholder="ادخل وقت وصول الهجمه" style="font-weight:bold;font-family:times new roman;text-align:center" type="text" id="bt1">'+
  85. '<input onClick="calcular()" style="padding-center: 28px; background: #6C4824 url(https://brtwscripts.com/calc-icon.png) no-repeat 10px" class="btn" type="submit" value="حساب وقت الباك تايم">'+
  86. '</div></b>');
  87.  
  88. $('#show_incoming_units').before('<b id="resultado" style="display: none;">باك تايم:&nbsp; xx:xx:xx<br />قنص: xx:xx:xx</b>');
  89.  
  90.  
  91. var TimeForAttackWillBeInMyVillage;
  92. $('#commands_incomings > form > table > tbody > tr.command-row.no_ignored_command').each(
  93. function(){
  94. /* */
  95. TimeForAttackWillBeInMyVillage = $(this).find('td:nth-child(2) > span').parent().text().replace(/[ا-ي ; a-z ; A-Z]/g , '').replace(/:[0-9]{3}/g , '');
  96. });
  97. /* */
  98. $('#bt1').val(TimeForAttackWillBeInMyVillage);
  99.  
  100.  
  101. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement