aboutsummaryrefslogtreecommitdiff
path: root/chrome/content/redirect.js
diff options
context:
space:
mode:
authorEinar Egilsson2007-06-02 00:24:35 +0000
committerEinar Egilsson2007-06-02 00:24:35 +0000
commitb0c6f7a2bff3d57f1c8d05a561dbd0bbca0228ca (patch)
treeb9d11f284141f8aacd80e917bcd05877c3aee6e1 /chrome/content/redirect.js
parentf77a93fe56b90c89d3a881d9af84d43e451efe8d (diff)
Redirector: All main functionality except Regex working.
git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@57 119bf307-c92d-0410-89bd-8f53e6181181
Diffstat (limited to 'chrome/content/redirect.js')
-rw-r--r--chrome/content/redirect.js39
1 files changed, 25 insertions, 14 deletions
diff --git a/chrome/content/redirect.js b/chrome/content/redirect.js
index cfd2a2e..5be85f7 100644
--- a/chrome/content/redirect.js
+++ b/chrome/content/redirect.js
@@ -3,29 +3,40 @@
var Redirect = {
onLoad : function() {
- var params = window.arguments[0];
- $('txtExampleUrl').value = params.inn.url;
- $('txtPattern').value = params.inn.url;
- $('txtRedirectUrl').value = params.inn.redirect || '';
-
+ var item = window.arguments[0];
+ item.saved = false;
+ $('txtExampleUrl').value = item.exampleUrl;
+ $('txtPattern').value = item.pattern;
+ $('txtRedirectUrl').value = item.redirectUrl || '';
+ $('chkOnlyIfLinkExists').checked = item.onlyIfLinkExists || false;
+
+ if (item.patternType == kRedirectorRegex) {
+ $('rdoRegex').setAttribute('selected', true);
+ $('rdoWildcard').setAttribute('selected', false);
+ }
},
onAccept : function() {
- var params = window.arguments[0];
-
- params.out.pattern = $('txtPattern').value;
- params.out.patternType = kRedirectorWildcard;
- params.out.exampleUrl =$('txtExampleUrl').value;
- params.out.redirectUrl = $('txtRedirectUrl').value;
- params.out.onlyIfLinkExists = $('chkOnlyIfLinkExists').checked;
+ var item = window.arguments[0];
+
+ item.pattern = $('txtPattern').value;
+ if ($('rdoRegex').selected) {
+ item.patternType = kRedirectorRegex;
+ } else {
+ item.patternType = kRedirectorWildcard;
+ }
+ item.exampleUrl =$('txtExampleUrl').value;
+ item.redirectUrl = $('txtRedirectUrl').value;
+ item.onlyIfLinkExists = $('chkOnlyIfLinkExists').checked;
+ item.saved = true;
return true;
},
testPattern : function() {
- try {
+ var match;
+
alert(Redirector.wildcardMatch($('txtPattern').value, $('txtExampleUrl').value));
- } catch(e) {alert(e);}
}
}; \ No newline at end of file