Advertisement
Guest User

Untitled

a guest
Aug 29th, 2014
761
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. // Wall Destroyer auto click menu
  2. wallBtn = document.getElementById("clickable-hitwall");
  3. brickBtn = document.getElementById("clickable-makebricks");
  4.  
  5. (function () {
  6. var options = {
  7. panelId: 'wall-cheater',
  8. intervalDelay: 1,
  9. buttons: {
  10. 'hitWall': {
  11. label: 'Autoclick Wall',
  12. action: function () {
  13. toggleAutoAction('hitWall', function () {
  14. wallBtn.click();
  15. })
  16. }
  17. },
  18. 'hitBricks': {
  19. label: 'Autoclick Bricks',
  20. action: function () {
  21. toggleAutoAction('hitBricks', function () {
  22. brickBtn.click();
  23. })
  24. }
  25. },
  26. }
  27. };
  28.  
  29. addStyleSheet();
  30. addPanel();
  31. for (var name in options.buttons) {
  32. if (!options.buttons[name]) {
  33. return;
  34. }
  35. addButton(name, options.buttons[name].label, options.buttons[name].action);
  36. }
  37.  
  38. function autoAction(name, action) {
  39. if (!options.buttons[name]) {
  40. return;
  41. }
  42. options.buttons[name].interval = setInterval(action, options.intervalDelay);
  43. }
  44. function stopAutoAction(name) {
  45. clearInterval(options.buttons[name].interval);
  46. }
  47.  
  48. function toggleAutoAction(name, action) {
  49. if (!options.buttons[name].on) {
  50. autoAction(name, action);
  51. options.buttons[name].on = true;
  52. options.buttons[name].element.className = 'active';
  53. } else {
  54. stopAutoAction(name);
  55. options.buttons[name].on = false;
  56. options.buttons[name].element.className = '';
  57. }
  58. }
  59.  
  60. function addPanel() {
  61. if (document.getElementById(options.panelId)) {
  62. document.getElementById(options.panelId).remove();
  63. }
  64. options.panel = document.createElement("div");
  65. options.panel.id = options.panelId;
  66. document.body.appendChild(options.panel);
  67. }
  68.  
  69. function addButton(name, label, action) {
  70. if (!options.buttons[name]) {
  71. return;
  72. }
  73. options.buttons[name].element = document.createElement('button');
  74. options.buttons[name].element[(typeof document.body.style.WebkitAppearance == "string") ? "innerText" : "innerHTML"] = label;
  75. options.buttons[name].element.addEventListener('click', action);
  76. options.panel.appendChild(options.buttons[name].element);
  77. }
  78.  
  79. function addStyleSheet() {
  80. var stylesClassName = options.panelId + '-styles';
  81. var styles = document.getElementsByClassName(stylesClassName);
  82. if (styles.length <= 0) {
  83. styles = document.createElement('style');
  84. styles.type = 'text/css';
  85. styles.className += ' ' + stylesClassName;
  86. document.body.appendChild(styles);
  87. }
  88. var css = '#' + options.panelId + '{position:fixed;top:0;right:0;background:#000;color:#fff;padding:5px;z-index:9999;}#' + options.panelId + ' button{margin-left: 5px;}#' + options.panelId + ' button.active:after{content:"*";color:red;}';
  89. styles[(typeof document.body.style.WebkitAppearance == "string") ? "innerText" : "innerHTML"] = css;
  90. }
  91.  
  92.  
  93. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement