diff options
author | Einar Egilsson | 2007-06-02 23:53:51 +0000 |
---|---|---|
committer | Einar Egilsson | 2007-06-02 23:53:51 +0000 |
commit | a62300554bc3c4f0e5df918fef40c57fef521974 (patch) | |
tree | 4ac4ca9fcb526e18c581da292a3a924d50336ed7 /chrome/content/redirect.js | |
parent | b0c6f7a2bff3d57f1c8d05a561dbd0bbca0228ca (diff) |
git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@58 119bf307-c92d-0410-89bd-8f53e6181181
Diffstat (limited to 'chrome/content/redirect.js')
-rw-r--r-- | chrome/content/redirect.js | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/chrome/content/redirect.js b/chrome/content/redirect.js index 5be85f7..f4609e3 100644 --- a/chrome/content/redirect.js +++ b/chrome/content/redirect.js @@ -10,6 +10,8 @@ var Redirect = { $('txtRedirectUrl').value = item.redirectUrl || ''; $('chkOnlyIfLinkExists').checked = item.onlyIfLinkExists || false; + this.strings = document.getElementById("redirector-strings"); + if (item.patternType == kRedirectorRegex) { $('rdoRegex').setAttribute('selected', true); $('rdoWildcard').setAttribute('selected', false); @@ -34,9 +36,25 @@ var Redirect = { }, testPattern : function() { - var match; + var redirectUrl, pattern, example, extName; + + redirectUrl = $('txtRedirectUrl').value; + pattern = $('txtPattern').value; + example = $('txtExampleUrl').value; + + extName = this.strings.getString('extensionName'); - alert(Redirector.wildcardMatch($('txtPattern').value, $('txtExampleUrl').value)); + if ($('rdoRegex').selected) { + redirectUrl = Redirector.regexMatch(pattern, example, redirectUrl); + } else { + redirectUrl = Redirector.wildcardMatch(pattern, example, redirectUrl); + } + + if (redirectUrl || (redirectUrl === '' && $('txtRedirectUrl').value === '')) { + RedirLib.msgBox(extName, this.strings.getFormattedString('testPatternSuccess', [pattern, example, redirectUrl])); + } else { + RedirLib.msgBox(extName, this.strings.getFormattedString('testPatternFailure', [pattern, example])); + } } };
\ No newline at end of file |