Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Coin Collector auto click menu
- blockBtn = document.getElementById("clickable-hitblock");
- yoshiBtn = document.getElementById("clickable-clickyoshi");
- (function () {
- var options = {
- panelId: 'block-cheater',
- intervalDelay: 1,
- buttons: {
- 'hitBlock': {
- label: 'Autoclick block',
- action: function () {
- toggleAutoAction('hitBlock', function () {
- blockBtn.click();
- })
- }
- },
- 'hitYoshi': {
- label: 'Autoclick Yoshi',
- action: function () {
- toggleAutoAction('hitYoshi', function () {
- yoshiBtn.click();
- })
- }
- },
- }
- };
- addStyleSheet();
- addPanel();
- for (var name in options.buttons) {
- if (!options.buttons[name]) {
- return;
- }
- addButton(name, options.buttons[name].label, options.buttons[name].action);
- }
- function autoAction(name, action) {
- if (!options.buttons[name]) {
- return;
- }
- options.buttons[name].interval = setInterval(action, options.intervalDelay);
- }
- function stopAutoAction(name) {
- clearInterval(options.buttons[name].interval);
- }
- function toggleAutoAction(name, action) {
- if (!options.buttons[name].on) {
- autoAction(name, action);
- options.buttons[name].on = true;
- options.buttons[name].element.className = 'active';
- } else {
- stopAutoAction(name);
- options.buttons[name].on = false;
- options.buttons[name].element.className = '';
- }
- }
- function addPanel() {
- if (document.getElementById(options.panelId)) {
- document.getElementById(options.panelId).remove();
- }
- options.panel = document.createElement("div");
- options.panel.id = options.panelId;
- document.body.appendChild(options.panel);
- }
- function addButton(name, label, action) {
- if (!options.buttons[name]) {
- return;
- }
- options.buttons[name].element = document.createElement('button');
- options.buttons[name].element[(typeof document.body.style.WebkitAppearance == "string") ? "innerText" : "innerHTML"] = label;
- options.buttons[name].element.addEventListener('click', action);
- options.panel.appendChild(options.buttons[name].element);
- }
- function addStyleSheet() {
- var stylesClassName = options.panelId + '-styles';
- var styles = document.getElementsByClassName(stylesClassName);
- if (styles.length <= 0) {
- styles = document.createElement('style');
- styles.type = 'text/css';
- styles.className += ' ' + stylesClassName;
- document.body.appendChild(styles);
- }
- 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;}';
- styles[(typeof document.body.style.WebkitAppearance == "string") ? "innerText" : "innerHTML"] = css;
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement