Advertisement
Guest User

Untitled

a guest
Dec 28th, 2018
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.96 KB | None | 0 0
  1. // ==UserScript==
  2. // @name         Tribalwars sniper
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  Tribalwars sniper
  6. // @author       Doomness
  7. // @match        https://*.tribalwars.nl/game.php?village=*&screen=place&try=confirm
  8. // @grant        none
  9. // @require      http://code.jquery.com/jquery-latest.js
  10. // @require      http://cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.js
  11. // @run-at       document-end
  12. // ==/UserScript==
  13.  
  14. $(document).ready(function(){
  15.     var dt = new Date();
  16.     var time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
  17.  
  18.     $("head").append('<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.css">')
  19.     $($("table.vis")[0]).append(
  20.         '<p style="margin-top:5px; margin-bottom:0px;">Tijd van aankomst:</p>' +
  21.         '<input class="timepicker" style="margin-top:5px; font-size: 13px;">'+
  22.         '<input type="text" class="milidelay" placeholder="miliseconds delay" style="margin-top:5px; font-size: 13px;">'+
  23.         '<input id="snipebtn" type="button" class="btn" value="Snipe" style="width:100px; margin-top:3px;">'
  24.     );
  25.  
  26.     $("input.timepicker").timepicker(
  27.         {
  28.             timeFormat: 'HH:mm:ss',
  29.             minTime: '00:00:00',
  30.             maxTime: '23:59:59',
  31.             defaultTime: '00:00:00',
  32.             dynamic: false,
  33.             dropdown: false,
  34.             scrollbar: false
  35.         });
  36.     $("input#snipebtn").click(function(){
  37.         console.log('Snipe gezet op: '+ $("input.timepicker").val() +':'+ parseInt($("input.milidelay").val()));
  38.         $("input#snipebtn").parent().append('<p style="margin-bottom:0px; font-size:13px;"> Snipe gezet op: ' + $("input.timepicker").val() +':'+ parseInt($("input.milidelay").val()) +'</p>');
  39.         snipeTimer()
  40.     });
  41. })
  42.  
  43. function snipeTimer(){
  44.     if($("span.relative_time").text().indexOf($("input.timepicker").val()) >= 0){
  45.         setTimeout(function() {
  46.             $("input.troop_confirm_go").click();
  47.         }, parseInt($("input.milidelay").val()));
  48.     }
  49.     setTimeout(snipeTimer, 10);
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement