forked from Sol0mone/zrfz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
27 lines (27 loc) · 957 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function modifCSSRule(sChemin, sPropriete, sVal) {
var bFind = false;
var aStyleSheets = document.styleSheets;
var exp_reg = new RegExp(sChemin, "gi");
// si la css est externe et d'un autre nom de domaine
// cssRules: lève une DOMException: "The operation is insecure."
// code: 18
// message: "The operation is insecure."
// name: "SecurityError"
//
for (var i = 0; i < aStyleSheets.length; ++i) {
try {
var aCssRules = aStyleSheets[i].cssRules;
for (var j = 0; j < aCssRules.length; ++j) {
if (exp_reg.test(aCssRules[j].selectorText)) {
aCssRules[j].style[sPropriete] = sVal;
bFind = true;
} //if
} //for
} catch (error) {
//cssRules: lève une DOMException: "The operation is insecure."
console.log(error);
continue
}
}
return bFind;
}