Skip to content

Instantly share code, notes, and snippets.

@cazzer
Created October 17, 2017 19:37
Show Gist options
  • Save cazzer/67d1eaaa2681d79055de337ab80e0c15 to your computer and use it in GitHub Desktop.
Save cazzer/67d1eaaa2681d79055de337ab80e0c15 to your computer and use it in GitHub Desktop.
Tamper Monkey no alerts script
// ==UserScript==
// @name No Alerts
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://*/*
// @grant none
// ==/UserScript==
(function(window, document) {
'use strict';
window.alert = function(message) {
var a = document.getElementById('tampermonkey-alert-modal') || makeNewAlert()
a.innerText = JSON.stringify(message)
}
// Your code here...
function makeNewAlert() {
var div = document.createElement('div')
div.style.position = 'fixed'
div.style.left = 'calc(50% - 200px)'
div.style.top = 'calc(50% - 200px)'
div.style.width = '400px'
div.style.height = '400px'
div.style.backgroundColor = 'lightgray'
div.style.padding = '14px'
div.style.fontSize = '1.2em'
div.onclick = function() {
div.remove()
}
document.body.appendChild(div)
return div
}
})(window, document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment