Added support for comments in pattern lists
This commit is contained in:
parent
a1aba3746e
commit
94d596d525
@ -15,7 +15,9 @@ function killStickyIfMatch(result) {
|
|||||||
result.matchingPatterns.split("\n") :
|
result.matchingPatterns.split("\n") :
|
||||||
[ ]);
|
[ ]);
|
||||||
for (let pattern of matchingPatterns) {
|
for (let pattern of matchingPatterns) {
|
||||||
if (pattern && location.href.match(new RegExp(pattern))) {
|
if (pattern &&
|
||||||
|
!pattern.hasPrefix("#") &&
|
||||||
|
location.href.match(new RegExp(pattern))) {
|
||||||
shouldKillSticky = true;
|
shouldKillSticky = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -24,7 +26,9 @@ function killStickyIfMatch(result) {
|
|||||||
result.exclusionPatterns.split("\n") :
|
result.exclusionPatterns.split("\n") :
|
||||||
[ ];
|
[ ];
|
||||||
for (let pattern of exclusionPatterns) {
|
for (let pattern of exclusionPatterns) {
|
||||||
if (pattern && location.href.match(new RegExp(pattern))) {
|
if (pattern &&
|
||||||
|
!pattern.hasPrefix("#") &&
|
||||||
|
location.href.match(new RegExp(pattern))) {
|
||||||
shouldKillSticky = false;
|
shouldKillSticky = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
12
functions.js
12
functions.js
@ -22,6 +22,14 @@ Element.prototype.removeActivateEvent = function() {
|
|||||||
this.removeEventListener("keyup", ael);
|
this.removeEventListener("keyup", ael);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********/
|
||||||
|
/* UTILITY */
|
||||||
|
/***********/
|
||||||
|
|
||||||
|
String.prototype.hasPrefix = function (prefix) {
|
||||||
|
return (this.lastIndexOf(prefix, 0) === 0);
|
||||||
|
}
|
||||||
|
|
||||||
/***********/
|
/***********/
|
||||||
/* HELPERS */
|
/* HELPERS */
|
||||||
/***********/
|
/***********/
|
||||||
@ -35,7 +43,3 @@ function killSticky() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
String.prototype.hasPrefix = function (prefix) {
|
|
||||||
return (this.lastIndexOf(prefix, 0) === 0);
|
|
||||||
}
|
|
||||||
|
|||||||
8
popup.js
8
popup.js
@ -69,13 +69,17 @@ function recalculatePatternEffects() {
|
|||||||
ASK.pageMatched = false;
|
ASK.pageMatched = false;
|
||||||
ASK.pageExcluded = false;
|
ASK.pageExcluded = false;
|
||||||
for (let pattern of ASK.matchingPatterns) {
|
for (let pattern of ASK.matchingPatterns) {
|
||||||
if (pattern && ASK.activeTabLocation.match(new RegExp(pattern))) {
|
if (pattern &&
|
||||||
|
!pattern.hasPrefix("#") &&
|
||||||
|
ASK.activeTabLocation.match(new RegExp(pattern))) {
|
||||||
ASK.pageMatched = true;
|
ASK.pageMatched = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let pattern of ASK.exclusionPatterns) {
|
for (let pattern of ASK.exclusionPatterns) {
|
||||||
if (pattern && ASK.activeTabLocation.match(new RegExp(pattern))) {
|
if (pattern &&
|
||||||
|
!pattern.hasPrefix("#") &&
|
||||||
|
ASK.activeTabLocation.match(new RegExp(pattern))) {
|
||||||
ASK.pageExcluded = true;
|
ASK.pageExcluded = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user