Created
October 29, 2011 08:02
-
-
Save 0mg/1324219 to your computer and use it in GitHub Desktop.
UserCSS.js for Opera
This file contains hidden or 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 UserCSS | |
// @include * | |
// ==/UserScript== | |
(function() { | |
function userCSS(event) { | |
[ | |
{ | |
url: "http://example.com/", | |
css: "#side{display:none!important}" | |
}, | |
{ | |
url: "http://example.org/", | |
css: "body{font-size:80%!important}" | |
} | |
].forEach(function(list) { | |
if (location.href.indexOf(list.url) >= 0) { | |
var style = document.createElement("style"); | |
style.textContent = list.css; | |
document.head.appendChild(style); | |
} | |
}); | |
} | |
opera.addEventListener("BeforeCSS", function(event) { | |
opera.removeEventListener(event.type, arguments.callee, false); | |
userCSS.apply(null, arguments); | |
userCSS = function() {}; | |
}, false); | |
addEventListener("DOMContentLoaded", function(event) { | |
userCSS.apply(null, arguments); | |
userCSS = function() {}; | |
}, false); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment