Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. // ==UserScript==
  2. // @name NotABug Enhancement Suite
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://nab.cx/*
  8. // @grant none
  9. // @require http://code.jquery.com/jquery-3.3.1.min.js
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. let timerDn;
  15. let timerUp;
  16.  
  17. function addGlobalStyle(css) {
  18. var head, style;
  19. head = document.getElementsByTagName('head')[0];
  20. if (!head) { return; }
  21. style = document.createElement('style');
  22. style.type = 'text/css';
  23. style.innerHTML = css;
  24. head.appendChild(style);
  25. }
  26.  
  27. //display: inline-block;
  28. addGlobalStyle('.arrow { margin: 2px auto; }');
  29.  
  30. $('.midcol').on('click', '.spammer', function() {
  31. let el;
  32. if ($(this).hasClass('upmod')) {
  33. clearInterval(timerUp);
  34. $(this).toggleClass('upmod up');
  35. } else if ($(this).hasClass('downmod')) {
  36. clearInterval(timerDn);
  37. $(this).toggleClass('downmod down');
  38. } else if ($(this).hasClass('up')) {
  39. el = $(this).next('.up');
  40. function voteUp() {
  41. if (el.hasClass('up')) el.click();
  42. }
  43. timerUp = setInterval(voteUp, 5000);
  44. voteUp();
  45. $(this).toggleClass('up upmod');
  46. } else if ($(this).hasClass('down')) {
  47. el = $(this).prev('.down');
  48. function voteDn() {
  49. if (el.hasClass('down')) el.click();
  50. }
  51. timerDn = setInterval(voteDn, 5000);
  52. voteDn();
  53. $(this).toggleClass('down downmod');
  54. }
  55.  
  56. });
  57.  
  58. const style = 'background-size: 100%; height: 0.75em; width: 0.75em;';
  59. $('.midcol').prepend('<div class="spammer arrow up" style="'+style+'"></div>');
  60. $('.midcol').append('<div class="spammer arrow down" style="'+style+'"></div>');
  61. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement