From 612e652d4a9feac5331c0262bbe6d234df3542e7 Mon Sep 17 00:00:00 2001 From: Einar Egilsson Date: Sat, 9 May 2009 20:46:48 +0000 Subject: 1.7 start git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@209 119bf307-c92d-0410-89bd-8f53e6181181 --- chrome/content/redirect.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'chrome/content/redirect.js') diff --git a/chrome/content/redirect.js b/chrome/content/redirect.js index be6cb96..fe468f0 100644 --- a/chrome/content/redirect.js +++ b/chrome/content/redirect.js @@ -1,5 +1,13 @@ //// $Id$ +const kRedirectorWildcard = 'W'; +const kRedirectorRegex= 'R'; +var Redirector = Components.classes["@einaregilsson.com/redirector;1"].getService(Components.interfaces.nsISupports).wrappedJSObject; + +function $(id) { + return document.getElementById(id); +} + var Redirect = { onLoad : function() { @@ -9,7 +17,6 @@ var Redirect = { $('txtPattern').value = item.pattern; $('txtRedirectUrl').value = item.redirectUrl || ''; $('txtExcludePattern').value = item.excludePattern || ''; - $('chkOnlyIfLinkExists').checked = item.onlyIfLinkExists || false; $('txtPattern').focus(); this.strings = document.getElementById("redirector-strings"); @@ -32,15 +39,19 @@ var Redirect = { item.exampleUrl =$('txtExampleUrl').value; item.redirectUrl = $('txtRedirectUrl').value; item.excludePattern = $('txtExcludePattern').value; - item.onlyIfLinkExists = $('chkOnlyIfLinkExists').checked; item.saved = true; return true; }, + msgBox : function(title, text) { + Components.classes["@mozilla.org/embedcomp/prompt-service;1"] + .getService(Components.interfaces.nsIPromptService) + .alert(window, title, text); + }, + testPattern : function() { var redirectUrl, pattern, excludePattern, example, extName, isExcluded; - redirectUrl = $('txtRedirectUrl').value; pattern = $('txtPattern').value; excludePattern = $('txtExcludePattern').value; @@ -62,12 +73,11 @@ var Redirect = { var isRedirectMatch = redirectUrl || (redirectUrl === '' && $('txtRedirectUrl').value === ''); if (isRedirectMatch && !isExcluded) { - RedirLib.msgBox(extName, this.strings.getFormattedString('testPatternSuccess', [pattern, example, redirectUrl])); + this.msgBox(extName, this.strings.getFormattedString('testPatternSuccess', [pattern, example, redirectUrl])); } else if (isExcluded) { - RedirLib.msgBox(extName, this.strings.getFormattedString('testPatternExclude', [example, excludePattern])); + this.msgBox(extName, this.strings.getFormattedString('testPatternExclude', [example, excludePattern])); } else { - RedirLib.msgBox(extName, this.strings.getFormattedString('testPatternFailure', [pattern, example])); + this.msgBox(extName, this.strings.getFormattedString('testPatternFailure', [pattern, example])); } } - }; \ No newline at end of file -- cgit v1.2.3-70-g09d2