aboutsummaryrefslogtreecommitdiff
path: root/chrome
diff options
context:
space:
mode:
authorEinar Egilsson2007-08-07 12:59:18 +0000
committerEinar Egilsson2007-08-07 12:59:18 +0000
commit87b8db3e5ebf0911f613f71ce1251276ece47304 (patch)
tree042467f6560e93aaa58545f6bdcedb01999ea0b6 /chrome
parenta62300554bc3c4f0e5df918fef40c57fef521974 (diff)
Redirector 0.9.2
git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@74 119bf307-c92d-0410-89bd-8f53e6181181
Diffstat (limited to 'chrome')
-rw-r--r--chrome/content/redirect.js1
-rw-r--r--chrome/content/redirect.xul2
-rw-r--r--chrome/content/redirectList.js39
-rw-r--r--chrome/content/redirectList.xul1
-rw-r--r--chrome/locale/en-US/redirectList.dtd1
5 files changed, 33 insertions, 11 deletions
diff --git a/chrome/content/redirect.js b/chrome/content/redirect.js
index f4609e3..08af778 100644
--- a/chrome/content/redirect.js
+++ b/chrome/content/redirect.js
@@ -10,6 +10,7 @@ var Redirect = {
$('txtRedirectUrl').value = item.redirectUrl || '';
$('chkOnlyIfLinkExists').checked = item.onlyIfLinkExists || false;
+ $('txtPattern').focus();
this.strings = document.getElementById("redirector-strings");
if (item.patternType == kRedirectorRegex) {
diff --git a/chrome/content/redirect.xul b/chrome/content/redirect.xul
index 479729a..68d23c4 100644
--- a/chrome/content/redirect.xul
+++ b/chrome/content/redirect.xul
@@ -21,7 +21,7 @@
<rows>
<row>
<text value="&txtExampleUrl.label;" style="margin-top:6px;"/>
- <textbox id="txtExampleUrl" disabled="true" style="width:400px;"/>
+ <textbox id="txtExampleUrl" style="width:400px;"/>
</row>
<row>
<text value="&txtPattern.label;" style="margin-top:6px;"/>
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;
diff --git a/chrome/content/redirectList.xul b/chrome/content/redirectList.xul
index 264baa2..975497b 100644
--- a/chrome/content/redirectList.xul
+++ b/chrome/content/redirectList.xul
@@ -37,6 +37,7 @@
</listbox>
<hbox style="align:right;">
+ <button id="btnAdd" onclick="RedirectList.addRedirect();" label="&btnAdd.label;" disabled="false" />
<button id="btnEdit" onclick="RedirectList.editRedirect();" label="&btnEdit.label;" disabled="true" />
<button id="btnDelete" onclick="RedirectList.deleteRedirect();" label="&btnDelete.label;" disabled="true" />
<button id="btnClose" onclick="RedirectList.close();" label="&btnClose.label;"/>
diff --git a/chrome/locale/en-US/redirectList.dtd b/chrome/locale/en-US/redirectList.dtd
index 9af7605..21434c5 100644
--- a/chrome/locale/en-US/redirectList.dtd
+++ b/chrome/locale/en-US/redirectList.dtd
@@ -5,6 +5,7 @@
<!ENTITY colRedirectTo.label "Redirect to">
<!ENTITY colOnlyIfLinkExits.label "Only if link exists">
<!ENTITY colPatternType.label "Pattern type">
+<!ENTITY btnAdd.label "Add...">
<!ENTITY btnEdit.label "Edit...">
<!ENTITY btnDelete.label "Delete">
<!ENTITY btnClose.label "Close">