mirror of https://github.com/gorhill/uBlock.git
code review, polishing
This commit is contained in:
parent
d376c69e2f
commit
aa955ebe09
|
@ -483,14 +483,15 @@ var userFilterFromCandidate = function() {
|
|||
}
|
||||
|
||||
// Cosmetic filter?
|
||||
if ( v.slice(0, 2) === '##' ) {
|
||||
if ( v.lastIndexOf('##', 0) === 0 ) {
|
||||
return window.location.hostname + v;
|
||||
}
|
||||
|
||||
// If domain included in filter, no need for domain option
|
||||
if ( v.slice(0, 2) === '||' ) {
|
||||
if ( v.lastIndexOf('||', 0) === 0 ) {
|
||||
return v;
|
||||
}
|
||||
|
||||
// Assume net filter
|
||||
return v + '$domain=' + window.location.hostname;
|
||||
};
|
||||
|
@ -560,7 +561,11 @@ var onDialogClicked = function(ev) {
|
|||
else if ( ev.target.id === 'create' ) {
|
||||
var filter = userFilterFromCandidate();
|
||||
if ( filter ) {
|
||||
localMessager.send({ what: 'createUserFilter', filters: filter });
|
||||
var d = new Date();
|
||||
localMessager.send({
|
||||
what: 'createUserFilter',
|
||||
filters: '# ' + d.toLocaleString() + ' ' + window.location.href + '\n' + filter,
|
||||
});
|
||||
removeElements(elementsFromFilter(taCandidate.value));
|
||||
stopPicker();
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
if ( details.content.indexOf(content.trim()) !== -1 ) {
|
||||
return;
|
||||
}
|
||||
µb.saveUserFilters(details.content.trim() + '\n' + content.trim(), onSaved);
|
||||
µb.saveUserFilters(details.content.trim() + '\n\n' + content.trim(), onSaved);
|
||||
};
|
||||
|
||||
this.loadUserFilters(onLoaded);
|
||||
|
|
Loading…
Reference in New Issue