LEFT | RIGHT |
(no file at all) | |
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; |
135 | 135 |
136 var propertyExpression = match[2]; | 136 var propertyExpression = match[2]; |
137 var regexpString; | 137 var regexpString; |
138 if (propertyExpression.length >= 2 && propertyExpression[0] == "/" && | 138 if (propertyExpression.length >= 2 && propertyExpression[0] == "/" && |
139 propertyExpression[propertyExpression.length - 1] == "/") | 139 propertyExpression[propertyExpression.length - 1] == "/") |
140 regexpString = propertyExpression.slice(1, -1); | 140 regexpString = propertyExpression.slice(1, -1) |
| 141 .replace("\\x7B ", "{").replace("\\x7D ", "}"); |
141 else | 142 else |
142 regexpString = filterToRegExp(propertyExpression); | 143 regexpString = filterToRegExp(propertyExpression); |
143 | 144 |
144 this.patterns.push({ | 145 this.patterns.push({ |
145 text: pattern.text, | 146 text: pattern.text, |
146 regexp: new RegExp(regexpString, "i"), | 147 regexp: new RegExp(regexpString, "i"), |
147 prefix: pattern.selector.substr(0, match.index), | 148 prefix: pattern.selector.substr(0, match.index), |
148 suffix: pattern.selector.substr(match.index + match[0].length) | 149 suffix: pattern.selector.substr(match.index + match[0].length) |
149 }); | 150 }); |
150 } | 151 } |
151 | 152 |
152 callback(); | 153 callback(); |
153 }.bind(this)); | 154 }.bind(this)); |
154 }, | 155 }, |
155 | 156 |
156 apply: function() | 157 apply: function() |
157 { | 158 { |
158 if (this.patterns.length > 0) | 159 if (this.patterns.length > 0) |
159 { | 160 { |
160 var document = this.window.document; | 161 var document = this.window.document; |
161 this.addSelectors(document.styleSheets); | 162 this.addSelectors(document.styleSheets); |
162 document.addEventListener("load", this.onLoad.bind(this), true); | 163 document.addEventListener("load", this.onLoad.bind(this), true); |
163 } | 164 } |
164 } | 165 } |
165 }; | 166 }; |
LEFT | RIGHT |