From 87b8db3e5ebf0911f613f71ce1251276ece47304 Mon Sep 17 00:00:00 2001 From: Einar Egilsson Date: Tue, 7 Aug 2007 12:59:18 +0000 Subject: Redirector 0.9.2 git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@74 119bf307-c92d-0410-89bd-8f53e6181181 --- chrome/content/redirectList.js | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'chrome/content/redirectList.js') 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; -- cgit v1.2.3-70-g09d2