Skip to content

Instantly share code, notes, and snippets.

@ptcc
Created June 7, 2017 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ptcc/36807a5d38d267392a45d0a6ba5bfeec to your computer and use it in GitHub Desktop.
Save ptcc/36807a5d38d267392a45d0a6ba5bfeec to your computer and use it in GitHub Desktop.
javascript:(function(){function mouseEvent(type, sx, sy, cx, cy) { var evt; var e = { bubbles: true, cancelable: (type != "mousemove"), view: window, detail: 0, screenX: sx, screenY: sy, clientX: cx, clientY: cy, ctrlKey: false, altKey: false, shiftKey: false, metaKey: false, button: 0, relatedTarget: undefined }; if (typeof( document.createEvent ) == "function") { evt = document.createEvent("MouseEvents"); evt.initMouseEvent(type, e.bubbles, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, document.body.parentNode); } else if (document.createEventObject) { evt = document.createEventObject(); for (prop in e) { evt[prop] = e[prop]; } evt.button = { 0:1, 1:4, 2:2 }[evt.button] || evt.button; } return evt;}function dispatchEvent (el, evt) { if (el.dispatchEvent) { el.dispatchEvent(evt); } else if (el.fireEvent) { el.fireEvent('on' + type, evt); } return evt;}Array.prototype.forEach.apply(document.querySelectorAll("a[ajaxify^='/ajax/pages/invite/send_single']"),[function(el,i){ setTimeout(function(){ var evt = mouseEvent("click", 1, 50, 1, 50); dispatchEvent(el,evt)},500*i); }]);})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment