Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/filterClasses.js

Issue 6305806509146112: Issue 427 - Remove non-standard function and getter syntax (Closed)
Patch Set: Wow sorry for those wrong braces, I am so used to a different style that I didn't even realize what… Created May 18, 2014, 10:51 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/elemHide.js ('k') | lib/filterStorage.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 __proto__: Filter.prototype, 232 __proto__: Filter.prototype,
233 233
234 _disabled: false, 234 _disabled: false,
235 _hitCount: 0, 235 _hitCount: 0,
236 _lastHit: 0, 236 _lastHit: 0,
237 237
238 /** 238 /**
239 * Defines whether the filter is disabled 239 * Defines whether the filter is disabled
240 * @type Boolean 240 * @type Boolean
241 */ 241 */
242 get disabled() this._disabled, 242 get disabled()
243 {
244 return this._disabled;
245 },
243 set disabled(value) 246 set disabled(value)
244 { 247 {
245 if (value != this._disabled) 248 if (value != this._disabled)
246 { 249 {
247 let oldValue = this._disabled; 250 let oldValue = this._disabled;
248 this._disabled = value; 251 this._disabled = value;
249 FilterNotifier.triggerListeners("filter.disabled", this, value, oldValue); 252 FilterNotifier.triggerListeners("filter.disabled", this, value, oldValue);
250 } 253 }
251 return this._disabled; 254 return this._disabled;
252 }, 255 },
253 256
254 /** 257 /**
255 * Number of hits on the filter since the last reset 258 * Number of hits on the filter since the last reset
256 * @type Number 259 * @type Number
257 */ 260 */
258 get hitCount() this._hitCount, 261 get hitCount()
262 {
263 return this._hitCount;
264 },
259 set hitCount(value) 265 set hitCount(value)
260 { 266 {
261 if (value != this._hitCount) 267 if (value != this._hitCount)
262 { 268 {
263 let oldValue = this._hitCount; 269 let oldValue = this._hitCount;
264 this._hitCount = value; 270 this._hitCount = value;
265 FilterNotifier.triggerListeners("filter.hitCount", this, value, oldValue); 271 FilterNotifier.triggerListeners("filter.hitCount", this, value, oldValue);
266 } 272 }
267 return this._hitCount; 273 return this._hitCount;
268 }, 274 },
269 275
270 /** 276 /**
271 * Last time the filter had a hit (in milliseconds since the beginning of the epoch) 277 * Last time the filter had a hit (in milliseconds since the beginning of the epoch)
272 * @type Number 278 * @type Number
273 */ 279 */
274 get lastHit() this._lastHit, 280 get lastHit()
281 {
282 return this._lastHit;
283 },
275 set lastHit(value) 284 set lastHit(value)
276 { 285 {
277 if (value != this._lastHit) 286 if (value != this._lastHit)
278 { 287 {
279 let oldValue = this._lastHit; 288 let oldValue = this._lastHit;
280 this._lastHit = value; 289 this._lastHit = value;
281 FilterNotifier.triggerListeners("filter.lastHit", this, value, oldValue); 290 FilterNotifier.triggerListeners("filter.lastHit", this, value, oldValue);
282 } 291 }
283 return this._lastHit; 292 return this._lastHit;
284 }, 293 },
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 this.contentType = contentType; 466 this.contentType = contentType;
458 if (matchCase) 467 if (matchCase)
459 this.matchCase = matchCase; 468 this.matchCase = matchCase;
460 if (thirdParty != null) 469 if (thirdParty != null)
461 this.thirdParty = thirdParty; 470 this.thirdParty = thirdParty;
462 471
463 if (regexpSource.length >= 2 && regexpSource[0] == "/" && regexpSource[regexpS ource.length - 1] == "/") 472 if (regexpSource.length >= 2 && regexpSource[0] == "/" && regexpSource[regexpS ource.length - 1] == "/")
464 { 473 {
465 // The filter is a regular expression - convert it immediately to catch synt ax errors 474 // The filter is a regular expression - convert it immediately to catch synt ax errors
466 let regexp = new RegExp(regexpSource.substr(1, regexpSource.length - 2), thi s.matchCase ? "" : "i"); 475 let regexp = new RegExp(regexpSource.substr(1, regexpSource.length - 2), thi s.matchCase ? "" : "i");
467 this.__defineGetter__("regexp", function() regexp); 476 this.__defineGetter__("regexp", () => regexp);
468 } 477 }
469 else 478 else
470 { 479 {
471 // No need to convert this filter to regular expression yet, do it on demand 480 // No need to convert this filter to regular expression yet, do it on demand
472 this.regexpSource = regexpSource; 481 this.regexpSource = regexpSource;
473 } 482 }
474 } 483 }
475 exports.RegExpFilter = RegExpFilter; 484 exports.RegExpFilter = RegExpFilter;
476 485
477 RegExpFilter.prototype = 486 RegExpFilter.prototype =
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 .replace(/\\\^/g, "(?:[\\x00-\\x24\\x26-\\x2C\\x2F\\x3A-\\x40\\x5B-\\x5E\\ x60\\x7B-\\x7F]|$)") 524 .replace(/\\\^/g, "(?:[\\x00-\\x24\\x26-\\x2C\\x2F\\x3A-\\x40\\x5B-\\x5E\\ x60\\x7B-\\x7F]|$)")
516 .replace(/^\\\|\\\|/, "^[\\w\\-]+:\\/+(?!\\/)(?:[^\\/]+\\.)?") // process extended anchor at expression start 525 .replace(/^\\\|\\\|/, "^[\\w\\-]+:\\/+(?!\\/)(?:[^\\/]+\\.)?") // process extended anchor at expression start
517 .replace(/^\\\|/, "^") // process anchor at expression start 526 .replace(/^\\\|/, "^") // process anchor at expression start
518 .replace(/\\\|$/, "$") // process anchor at expression end 527 .replace(/\\\|$/, "$") // process anchor at expression end
519 .replace(/^(\.\*)/, "") // remove leading wildcards 528 .replace(/^(\.\*)/, "") // remove leading wildcards
520 .replace(/(\.\*)$/, ""); // remove trailing wildcards 529 .replace(/(\.\*)$/, ""); // remove trailing wildcards
521 530
522 let regexp = new RegExp(source, this.matchCase ? "" : "i"); 531 let regexp = new RegExp(source, this.matchCase ? "" : "i");
523 532
524 delete this.regexpSource; 533 delete this.regexpSource;
525 this.__defineGetter__("regexp", function() regexp); 534 this.__defineGetter__("regexp", () => regexp);
526 return this.regexp; 535 return this.regexp;
527 }, 536 },
528 /** 537 /**
529 * Content types the filter applies to, combination of values from RegExpFilte r.typeMap 538 * Content types the filter applies to, combination of values from RegExpFilte r.typeMap
530 * @type Number 539 * @type Number
531 */ 540 */
532 contentType: 0x7FFFFFFF, 541 contentType: 0x7FFFFFFF,
533 /** 542 /**
534 * Defines whether the filter should distinguish between lower and upper case letters 543 * Defines whether the filter should distinguish between lower and upper case letters
535 * @type Boolean 544 * @type Boolean
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 function ElemHideException(text, domains, selector) 891 function ElemHideException(text, domains, selector)
883 { 892 {
884 ElemHideBase.call(this, text, domains, selector); 893 ElemHideBase.call(this, text, domains, selector);
885 } 894 }
886 exports.ElemHideException = ElemHideException; 895 exports.ElemHideException = ElemHideException;
887 896
888 ElemHideException.prototype = 897 ElemHideException.prototype =
889 { 898 {
890 __proto__: ElemHideBase.prototype 899 __proto__: ElemHideBase.prototype
891 }; 900 };
OLDNEW
« no previous file with comments | « lib/elemHide.js ('k') | lib/filterStorage.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld