aboutsummaryrefslogtreecommitdiff
path: root/chrome/content/redirectList.js
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/content/redirectList.js')
-rw-r--r--chrome/content/redirectList.js39
1 files changed, 29 insertions, 10 deletions
diff --git a/chrome/content/redirectList.js b/chrome/content/redirectList.js
index 081359f..159bc8a 100644
--- a/chrome/content/redirectList.js
+++ b/chrome/content/redirectList.js
@@ -12,16 +12,7 @@ var RedirectList = {
var item, row, value;
for each (item in items) {
- row = document.createElement('listitem');
-
- this.createCell(row, item.pattern);
- this.createCell(row, item.exampleUrl);
- this.createCell(row, item.redirectUrl);
- this.createCell(row, item.onlyIfLinkExists);
- this.createCell(row, item.patternType);
-
- row.item = item;
-
+ row = this.createRow(item);
list.appendChild(row);
}
},
@@ -33,6 +24,18 @@ var RedirectList = {
row.appendChild(cell);
},
+ createRow : function(item) {
+ var row = document.createElement('listitem');
+
+ this.createCell(row, item.pattern);
+ this.createCell(row, item.exampleUrl);
+ this.createCell(row, item.redirectUrl);
+ this.createCell(row, item.onlyIfLinkExists);
+ this.createCell(row, item.patternType);
+
+ row.item = item;
+ return row;
+ },
onLoad : function() {
try {
@@ -51,6 +54,22 @@ var RedirectList = {
window.close();
},
+ addRedirect : function() {
+
+ var item = { pattern : '', exampleUrl : '', redirectUrl : '', onlyIfLinkExists : false, patternType : 'W'};
+
+ window.openDialog("chrome://redirector/content/redirect.xul",
+ "redirect",
+ "chrome,dialog,modal,centerscreen", item);
+
+ if (item.saved) {
+ var row = this.createRow(item);
+ $('lstRedirects').appendChild(row);
+ Redirector.addRedirect(item);
+ }
+
+ },
+
editRedirect : function() {
var listItem = this.lstRedirects.selectedItem;