Created
October 17, 2017 19:37
-
-
Save cazzer/67d1eaaa2681d79055de337ab80e0c15 to your computer and use it in GitHub Desktop.
Tamper Monkey no alerts script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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