new module to enable editing and deleting of bookmarks
[conkeror/arlinius.git] / modules / selectively-unstyle.js
bloba38219ef6c9ad9ec9b44431924ce079c1631e135
1 /**
2 * (C) Copyright 2009 John J. Foerch
4 * Use, modification, and distribution are subject to the terms specified in the
5 * COPYING file.
6 **/
8 define_variable('selectively_unstyle_alist', [],
9 "Alist mapping url-matching regular expressions to predicates to "+
10 "selectively disable stylesheets. All predicates corresponding to "+
11 "matching regexps will be used. Predicates are functions of one "+
12 "argument. They receive a styleSheet object as their argument, and "+
13 "if they return true, that stylesheet will be disabled.");
16 function selectively_unstyle (buffer) {
17 var uri = buffer.current_uri.spec;
18 for each (let entry in selectively_unstyle_alist) {
19 if (entry[0](uri)) {
20 let func = entry[1];
21 for each (var sheet in buffer.document.styleSheets) {
22 func(sheet);
28 add_hook("buffer_loaded_hook", selectively_unstyle);
30 provide("selectively-unstyle");