Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 var propertySelectorRegExp = /\[\-abp\-properties=(["'])([^"']+)\1\]/; | 1 var propertySelectorRegExp = /\[\-abp\-properties=(["'])([^"']+)\1\]/; |
2 | 2 |
3 function splitSelector(selector) | 3 function splitSelector(selector) |
4 { | 4 { |
5 if (selector.indexOf(",") == -1) | 5 if (selector.indexOf(",") == -1) |
6 return [selector]; | 6 return [selector]; |
7 | 7 |
8 var selectors = []; | 8 var selectors = []; |
9 var start = 0; | 9 var start = 0; |
10 var level = 0; | 10 var level = 0; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 this.addSelectorsFunc(selectors, filters); | 114 this.addSelectorsFunc(selectors, filters); |
115 }, | 115 }, |
116 | 116 |
117 onLoad: function(event) | 117 onLoad: function(event) |
118 { | 118 { |
119 var stylesheet = event.target.sheet; | 119 var stylesheet = event.target.sheet; |
120 if (stylesheet) | 120 if (stylesheet) |
121 this.addSelectors([stylesheet]); | 121 this.addSelectors([stylesheet]); |
122 }, | 122 }, |
123 | 123 |
124 apply: function(callback) | 124 apply: function() |
Sebastian Noack
2017/02/18 11:28:13
The callback parameter is unused now.
wspee
2017/02/18 12:49:50
Done.
| |
125 { | 125 { |
126 this.getFiltersFunc(function(patterns) | 126 this.getFiltersFunc(function(patterns) |
127 { | 127 { |
128 this.patterns = []; | 128 this.patterns = []; |
129 for (var i = 0; i < patterns.length; i++) | 129 for (var i = 0; i < patterns.length; i++) |
130 { | 130 { |
131 var pattern = patterns[i]; | 131 var pattern = patterns[i]; |
132 var match = propertySelectorRegExp.exec(pattern.selector); | 132 var match = propertySelectorRegExp.exec(pattern.selector); |
133 if (!match) | 133 if (!match) |
134 continue; | 134 continue; |
(...skipping 17 matching lines...) Expand all Loading... | |
152 | 152 |
153 if (this.patterns.length > 0) | 153 if (this.patterns.length > 0) |
154 { | 154 { |
155 var document = this.window.document; | 155 var document = this.window.document; |
156 this.addSelectors(document.styleSheets); | 156 this.addSelectors(document.styleSheets); |
157 document.addEventListener("load", this.onLoad.bind(this), true); | 157 document.addEventListener("load", this.onLoad.bind(this), true); |
158 } | 158 } |
159 }.bind(this)); | 159 }.bind(this)); |
160 } | 160 } |
161 }; | 161 }; |
LEFT | RIGHT |