+32
-26
lines changedFilter options
+32
-26
lines changed Original file line number Diff line number Diff line change
@@ -774,35 +774,19 @@ vAPI.injectScriptlet = function(doc, text) {
774
774
addProceduralSelectors(selectors) {
775
775
const addedSelectors = [];
776
776
let mustCommit = this.domIsWatched;
777
-
for ( const raw of selectors ) {
778
-
if ( this.selectors.has(raw) ) { continue; }
779
-
const o = JSON.parse(raw);
780
-
// CSS selector-based styles.
781
-
if (
782
-
o.action !== undefined &&
783
-
o.action[0] === ':style' &&
784
-
o.tasks === undefined
785
-
) {
786
-
this.domFilterer.addCSSRule(o.selector, o.action[1]);
787
-
mustCommit = true;
788
-
continue;
789
-
}
790
-
if ( o.pseudo !== undefined ) {
791
-
this.domFilterer.addCSSRule(o.selector, vAPI.hideStyle);
792
-
mustCommit = true;
793
-
continue;
794
-
}
777
+
for ( const selector of selectors ) {
778
+
if ( this.selectors.has(selector.raw) ) { continue; }
795
779
let style, styleToken;
796
-
if ( o.action === undefined ) {
780
+
if ( selector.action === undefined ) {
797
781
style = vAPI.hideStyle;
798
-
} else if ( o.action[0] === ':style' ) {
799
-
style = o.action[1];
782
+
} else if ( selector.action[0] === ':style' ) {
783
+
style = selector.action[1];
800
784
}
801
785
if ( style !== undefined ) {
802
786
styleToken = this.styleTokenFromStyle(style);
803
787
}
804
-
const pselector = new PSelectorRoot(o, styleToken);
805
-
this.selectors.set(raw, pselector);
788
+
const pselector = new PSelectorRoot(selector, styleToken);
789
+
this.selectors.set(selector.raw, pselector);
806
790
addedSelectors.push(pselector);
807
791
mustCommit = true;
808
792
}
@@ -1063,9 +1047,31 @@ vAPI.injectScriptlet = function(doc, text) {
1063
1047
return this.proceduralFilterer;
1064
1048
}
1065
1049
1066
-
addProceduralSelectors(aa) {
1067
-
if ( Array.isArray(aa) === false || aa.length === 0 ) { return; }
1068
-
this.proceduralFiltererInstance().addProceduralSelectors(aa);
1050
+
addProceduralSelectors(selectors) {
1051
+
if ( Array.isArray(selectors) === false || selectors.length === 0 ) {
1052
+
return;
1053
+
}
1054
+
const procedurals = [];
1055
+
for ( const raw of selectors ) {
1056
+
const o = JSON.parse(raw);
1057
+
if (
1058
+
o.action !== undefined &&
1059
+
o.action[0] === ':style' &&
1060
+
o.tasks === undefined
1061
+
) {
1062
+
this.addCSSRule(o.selector, o.action[1]);
1063
+
continue;
1064
+
}
1065
+
if ( o.pseudo !== undefined ) {
1066
+
this.addCSSRule(o.selector, vAPI.hideStyle);
1067
+
continue;
1068
+
}
1069
+
procedurals.push(o);
1070
+
}
1071
+
if ( procedurals.length !== 0 ) {
1072
+
this.proceduralFiltererInstance()
1073
+
.addProceduralSelectors(procedurals);
1074
+
}
1069
1075
}
1070
1076
1071
1077
createProceduralFilter(o) {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4