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

Unified Diff: chrome/content/options.js

Issue 8450003: Reimplemented whitelist handling (Closed)
Patch Set: Created Sept. 25, 2012, 3:48 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/content/options.js
===================================================================
--- a/chrome/content/options.js
+++ b/chrome/content/options.js
@@ -68,17 +68,17 @@ function updateList()
else if (a[0] > b[0])
return 1;
else
return 0;
});
whitelist.sort();
// Add the rules to the list
- if(ruleList.length > 0)
+ if (ruleList.length > 0)
{
for (let i = 0; i < ruleList.length; i++)
{
let [searchString, replacement] = ruleList[i];
let option = document.createElement('listitem');
option.setAttribute("value", searchString);
@@ -97,17 +97,17 @@ function updateList()
{
let option = document.createElement("listitem");
option.setAttribute("class", "auto-entry");
option.setAttribute("label", ruleListElement.getAttribute("_emptyLabel"));
ruleListElement.appendChild(option);
}
- if(whitelist.length > 0)
+ if (whitelist.length > 0)
{
for (let i = 0; i < whitelist.length; i++)
{
let option = document.createElement("listitem");
option.setAttribute("value", whitelist[i]);
option.setAttribute("label", whitelist[i])
whitelistElement.appendChild(option);
@@ -137,15 +137,20 @@ function addRule()
E("find").oninput();
}
function removeRule(btn, pref)
{
let list = E(btn.getAttribute("_list"));
let items = list.selectedItems;
+ let {onWhitelistEntryRemoved} = require("rules");
+
for (let i = items.length - 1; i >= 0; i--)
{
let searchString = items[i].getAttribute("value");
delete Prefs[pref][searchString];
+
+ if (pref == "whitelist")
+ onWhitelistEntryRemoved(searchString);
}
Prefs[pref] = JSON.parse(JSON.stringify(Prefs[pref]));
}
« no previous file with comments | « no previous file | chrome/content/tests/qunit.html » ('j') | chrome/content/tests/tests/suffixTreeManipulation.js » ('J')

Powered by Google App Engine
This is Rietveld