m24111

Untitled

Jun 22nd, 2020
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         DS Better Storage
  3. // @namespace    http://tampermonkey.net/
  4. // @version      1.0
  5. // @description  try to take over the world!
  6. // @author       XHunter
  7. // @match        *://command.drop-shock.com/headquarters_units.php*
  8. // @match        *://command.drop-shock.com/faction_storage.php*
  9. // @require      http://code.jquery.com/jquery-3.4.1.min.js
  10. // @grant        none
  11. // ==/UserScript==
  12. $(document).attr('unselectable','on')
  13.     .css({'-moz-user-select':'-moz-none',
  14.           '-moz-user-select':'none',
  15.           '-o-user-select':'none',
  16.           '-khtml-user-select':'none',
  17.           '-webkit-user-select':'none',
  18.           '-ms-user-select':'none',
  19.           'user-select':'none'
  20.          }).bind('selectstart', function(){ return false; });
  21.  
  22. var div = document.getElementById('bottomInfo')
  23. if (div != null){
  24.     div.style.position = 'fixed'
  25.     div.style.bottom = 0
  26.     div.style.right = '500px'
  27. }
  28.  
  29. var mouseDown = false
  30. $(document).mousedown(function(event){mouseDown = true})
  31. $(document).mouseup(function(event){mouseDown = false})
  32.  
  33.  
  34. function addListeners(checkingGroup){
  35.     var trs, cbs, radios, trs_radio
  36.     if (checkingGroup != null){
  37.         cbs = $(`#${checkingGroup}`).find('input.twCB[type=checkbox]')
  38.         radios = $(`#${checkingGroup}`).find('input.twCB[type=radio]')
  39.     }
  40.     else{
  41.         cbs = $('input.twCB[type=checkbox]')
  42.         radios = $('input.twCB[type=radio]')
  43.     }
  44.     trs = cbs.parent().parent()
  45.     trs_radio = radios.parent().parent()
  46.  
  47.     trs.mouseenter(function(event){
  48.         event.stopPropagation()
  49.         var cb = $(this).find('input.twCB[type=checkbox]')
  50.         if (CBshown && cb.length == 1 && mouseDown){
  51.             console.log(cb)
  52.             cb.click()
  53.         }
  54.     })
  55.  
  56.     trs.mousedown(function(event){
  57.         var cb = $(this).find('input.twCB[type=checkbox]')
  58.         if (CBshown && cb.length == 1){
  59.             cb.click()
  60.         }
  61.     })
  62.  
  63.     trs_radio.click(function(event){
  64.         var radio = $(this).find('input.twCB[type=radio]')
  65.         if (radio.length == 1){
  66.             radio.click()
  67.         }
  68.     })
  69.  
  70.     cbs.click(function(event){
  71.         event.stopPropagation()
  72.         var parent = $(this).parent().parent()
  73.         parent.css('background',$(this).is(":checked") ? 'purple' : '')
  74.     })
  75.  
  76.     radios.click(function(event){
  77.         event.stopPropagation()
  78.         for (var tr_radio of trs_radio){
  79.             $(tr_radio).css('background', $(tr_radio).find('input.twCB[type=radio]').is(":checked") ? 'purple' : '')
  80.         }
  81.     })
  82.  
  83.     cbs.css('display', 'none')
  84. }
  85.  
  86. var tr_plus = $('tr>td.endP>a').parent().parent()
  87. tr_plus.click(function(event){
  88.     $(this).find('td.endP>a')[0].click()
  89. })
  90. //Overwrite
  91. function hideCB_2() {
  92.     arrElements = getElementsByClassName("twCB", "input", document)
  93.     for(var i=0; i<arrElements.length; i++){
  94.         $(arrElements[i]).parent().parent().css('background', '')
  95.         if ($(arrElements[i]).is(":checked"))
  96.             $(arrElements[i]).click()
  97.         arrElements[i].style.visibility = "hidden"
  98.     }
  99.     CBshown = false;
  100. }
  101. hideCB = hideCB_2
  102.  
  103. function processGetGroup_2() {
  104.     if (webCheckGroup.readyState == 4) {
  105.         if (webCheckGroup.status == 200) {
  106.             document.getElementById(checkingGroup+"exp").style.visibility="hidden";
  107.             document.getElementById(checkingGroup+"exp").style.display="none";
  108.             document.getElementById(checkingGroup+"tr").style.visibility="visible";
  109.             if (fx) { document.getElementById(checkingGroup+"tr").style.display="table-row"; }
  110.             else { document.getElementById(checkingGroup+"tr").style.display="block"; }
  111.             document.getElementById(checkingGroup).innerHTML = webCheckGroup.responseText;
  112.             addListeners(checkingGroup)
  113.             checkingGroup = "none";
  114.             if (CBshown) { showCB(); }
  115.         }
  116.     }
  117. }
  118.  
  119. processGetGroup = processGetGroup_2
  120.  
  121. addListeners()
Advertisement
Add Comment
Please, Sign In to add comment