Commit 91446461 authored by Andrea Giammarchi's avatar Andrea Giammarchi

reverted json change

parent fc3f25a1
......@@ -272,6 +272,8 @@ class IOFilterList extends IOElement
// in case of empty filter, remove it
if (!text)
{
if (!update)
return;
browser.runtime.sendMessage({
type: "filters.remove",
text: filter.text
......@@ -283,13 +285,10 @@ class IOFilterList extends IOElement
this.render();
}
});
this._filter = null;
return;
}
// update filter and title
filter.text = text;
currentTarget.title = text;
// store the initial filter value once
// needed to remove the filter once finished the editing
if (!prevFilterText.has(filter))
......@@ -306,6 +305,8 @@ class IOFilterList extends IOElement
// add + remove the filter on Enter / update
if (update)
{
filter.text = text;
currentTarget.title = text;
// drop any validation action at distance
this._validating = 0;
if (this.filters.some(f => f.text === filter.text && f !== filter))
......@@ -363,7 +364,10 @@ class IOFilterList extends IOElement
onblur(event)
{
if (this._changingFocus)
{
this._filter = null;
return;
}
this.onkeyup(event);
this._filter = null;
}
......@@ -578,7 +582,7 @@ const issues = new WeakMap();
// used to show warnings in the last column
const warnings = new WeakMap();
const warning = browser.i18n.getMessage("options_filterList_slow");
const warningSlow = browser.i18n.getMessage("filter_slow");
// relate either issues or warnings to a filter
const createImageFor = (weakMap, filter) =>
......@@ -589,7 +593,7 @@ const createImageFor = (weakMap, filter) =>
if (isIssue)
image.title = filter.reason;
else
image.title = warning;
image.title = warningSlow;
weakMap.set(filter, image);
return image;
};
......@@ -708,7 +712,7 @@ function setupPort()
{
const {text, disabled} = message.args[0];
const filter = this.filters.find(f => f.text === text);
if (disabled !== filter.disabled)
if (filter && disabled !== filter.disabled)
{
dispatchError.call(this, "filter.disabled", filter);
filter.disabled = disabled;
......
......@@ -166,7 +166,6 @@ class IOFilterTable extends IOElement
{
const filters = event.detail
.split(/(?:\r\n|\n)/)
.map(text => ({text}))
.reverse();
browser.runtime.sendMessage({
......@@ -195,9 +194,6 @@ class IOFilterTable extends IOElement
}
else
{
// force the footer to be visible since errors are shown there
this.renderFooter();
this.footer.classList.add("visible");
this.onerror({detail: {errors}});
}
});
......
......@@ -361,6 +361,7 @@
const addedFilters = new Set();
for (const filter of filters)
{
filter.disabled = false;
filterStorage.addFilter(filter);
addedFilters.add(filter.text);
}
......@@ -583,7 +584,10 @@
if (result.error)
errors.push(result.error.toString());
else if (result.filter)
{
result.disabled = false;
filterStorage.addFilter(result.filter);
}
return errors;
}
......
......@@ -292,10 +292,6 @@
"description": "Update button in Advanced tab",
"message": "update all filter lists"
},
"options_filterList_slow": {
"description": "A slow filter highlighted through the warning icon",
"message": "The pattern you entered is too short and, therefore, will slow down Adblock Plus, hindering your browsing experience. Please enter a longer pattern."
},
"options_customFilters_title": {
"description": "Section title in Advanced tab",
"message": "Your custom filters"
......
......@@ -11,6 +11,10 @@
"filter_invalid_regexp": {
"message": "Invalid regular expression"
},
"filter_slow": {
"description": "A slow filter highlighted through the warning icon",
"message": "The pattern you entered is too short and, therefore, will slow down Adblock Plus, hindering your browsing experience. Please enter a longer pattern."
},
"filter_snippet_nodomain": {
"message": "No active domain specified for snippet filter"
},
......@@ -28,6 +32,6 @@
},
"unexpected_filter_list_header": {
"description": "Error message shown when the user attempts to add a custom filter that has the format of a header (e.g. \"[Adblock Plus 2.0]\") which are only allowed in filter lists",
"message": "Filter list headers are only supported in downloadable filter lists."
"message": "Filter list headers aren't allowed here"
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment