Created
January 17, 2013 15:54
-
-
Save shadowbq/4556950 to your computer and use it in GitHub Desktop.
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 Paint It Greyscale | |
// @namespace John Wrenn | |
// @description Surf the web in soothing shades of grey! | |
// @author shadowbq | |
// @grant none | |
// @include * | |
// ==/UserScript== | |
var $; | |
//document.body.style.visibility = 'hidden'; | |
// Add jQuery | |
(function(){ | |
if (typeof unsafeWindow.jQuery == 'undefined') { | |
var GM_Head = document.getElementsByTagName('head')[0] || document.documentElement, | |
GM_JQ = document.createElement('script'); | |
GM_JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'; | |
GM_JQ.type = 'text/javascript'; | |
GM_JQ.async = true; | |
GM_Head.insertBefore(GM_JQ, GM_Head.firstChild); | |
} | |
GM_wait(); | |
})(); | |
// Check if jQuery's loaded | |
function GM_wait() { | |
if (typeof unsafeWindow.jQuery == 'undefined') { | |
window.setTimeout(GM_wait, 100); | |
} else { | |
$ = unsafeWindow.jQuery.noConflict(true); | |
letsJQuery(); | |
} | |
} | |
// All your GM code must be inside this function | |
function letsJQuery() { | |
var ns = "http://www.w3.org/2000/svg"; | |
var svg = document.createElementNS(ns, "svg"); | |
var filter = document.createElementNS(ns, "filter"); | |
var matrix = document.createElementNS(ns, "feColorMatrix"); | |
var values = "0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"; | |
filter.setAttribute('id','fltr'); | |
matrix.setAttribute('values',values); | |
filter.appendChild(matrix); | |
svg.appendChild(filter); | |
$(document).ready(function() { | |
document.body.appendChild(svg); | |
document.body.style.filter="url(#fltr)"; | |
}); | |
} |
GUID for plugin: ca5a8350-c231-462b-a0b9-736de6a028e3
Dumb question: How do I get this to run? I installed it as an Addon and restarted Firefox, but could not find a menu item, button, etc. to turn on the effect. Then, since I already had Greasemonkey for something else, I put your code found here into a new User Script, but that didn't do anything either.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Grease Monkey Compiler:
https://arantius.com/misc/greasemonkey/script-compiler.php