aboutsummaryrefslogtreecommitdiff
path: root/chrome/content/code/editRedirect.xul.js
diff options
context:
space:
mode:
authorEinar Egilsson2009-11-11 07:59:43 +0000
committerEinar Egilsson2009-11-11 07:59:43 +0000
commit100883d6c539e0fa23b2baec668e4d48cf5d2506 (patch)
tree618ea301adf91b556bdae2985354578fc4c0f6ec /chrome/content/code/editRedirect.xul.js
parentd8c8ad84b03be92d40f4569b4c1b8a5822dc924d (diff)
Fixed error when pressing Cancel on the Import file picker.
Converted spaces to tabs on all .js files. git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@294 119bf307-c92d-0410-89bd-8f53e6181181
Diffstat (limited to 'chrome/content/code/editRedirect.xul.js')
-rw-r--r--chrome/content/code/editRedirect.xul.js88
1 files changed, 44 insertions, 44 deletions
diff --git a/chrome/content/code/editRedirect.xul.js b/chrome/content/code/editRedirect.xul.js
index 0902645..650a8bf 100644
--- a/chrome/content/code/editRedirect.xul.js
+++ b/chrome/content/code/editRedirect.xul.js
@@ -1,16 +1,16 @@
//// $Id$
var EditRedirect = {
- txtExampleUrl : null,
- txtIncludePattern : null,
- txtRedirectUrl : null,
- txtExcludePattern : null,
- chkUnescapeMatches : null,
- rdoRegex : null,
- rdoWildcard : null,
-
- onLoad : function() {
- var args = window.arguments[0];
+ txtExampleUrl : null,
+ txtIncludePattern : null,
+ txtRedirectUrl : null,
+ txtExcludePattern : null,
+ chkUnescapeMatches : null,
+ rdoRegex : null,
+ rdoWildcard : null,
+
+ onLoad : function() {
+ var args = window.arguments[0];
var redirect = args.redirect;
this.txtExampleUrl = document.getElementById('txtExampleUrl');
this.txtIncludePattern = document.getElementById('txtIncludePattern');
@@ -25,14 +25,14 @@ var EditRedirect = {
this.txtExcludePattern.value = redirect.excludePattern;
this.txtRedirectUrl.value = redirect.redirectUrl;
this.chkUnescapeMatches.setAttribute('checked', redirect.unescapeMatches);
- this.rdoRegex.setAttribute('selected', redirect.isRegex());
- this.rdoWildcard.setAttribute('selected', redirect.isWildcard());
+ this.rdoRegex.setAttribute('selected', redirect.isRegex());
+ this.rdoWildcard.setAttribute('selected', redirect.isWildcard());
- this.txtIncludePattern.focus();
- this.strings = document.getElementById("redirector-strings");
- },
+ this.txtIncludePattern.focus();
+ this.strings = document.getElementById("redirector-strings");
+ },
- onAccept : function() {
+ onAccept : function() {
var args = window.arguments[0];
var msg, title;
args.saved = true;
@@ -50,12 +50,12 @@ var EditRedirect = {
return rv == 0;
} else {
var resultUrl = result.redirectTo;
- if (!resultUrl.match(/https?:/)) {
- var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
- var uri = ioService.newURI(args.redirect.exampleUrl, null, null);
- resultUrl = uri.resolve(resultUrl);
- }
-
+ if (!resultUrl.match(/https?:/)) {
+ var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
+ var uri = ioService.newURI(args.redirect.exampleUrl, null, null);
+ resultUrl = uri.resolve(resultUrl);
+ }
+
var secondResult = args.redirect.getMatch(resultUrl);
if (secondResult.isMatch) {
title = this.strings.getString('errorExampleUrlMatchesRecursiveTitle');
@@ -65,16 +65,16 @@ var EditRedirect = {
}
}
}
- return true;
- },
+ return true;
+ },
- msgBox : function(title, text) {
- Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService)
- .alert(window, title, text);
- },
-
- saveValues : function(redirect) {
+ msgBox : function(title, text) {
+ Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Components.interfaces.nsIPromptService)
+ .alert(window, title, text);
+ },
+
+ saveValues : function(redirect) {
redirect.exampleUrl = this.txtExampleUrl.value;
redirect.includePattern = this.txtIncludePattern.value;
redirect.excludePattern = this.txtExcludePattern.value;
@@ -83,21 +83,21 @@ var EditRedirect = {
var val = this.chkUnescapeMatches.getAttribute('checked');
redirect.unescapeMatches = val === 'true' || val === true;
//Disabled cannot be set here
- },
-
- testPattern : function() {
- try {
+ },
+
+ testPattern : function() {
+ try {
var redirect = new Redirect();
this.saveValues(redirect);
var extName = this.strings.getString('extensionName');
var result = redirect.test();
- if (result.isMatch) {
- this.msgBox(extName, this.strings.getFormattedString('testPatternSuccess', [redirect.includePattern, redirect.exampleUrl, result.redirectTo]));
- } else if (result.isExcludeMatch) {
- this.msgBox(extName, this.strings.getFormattedString('testPatternExclude', [redirect.exampleUrl, redirect.excludePattern]));
- } else {
- this.msgBox(extName, this.strings.getFormattedString('testPatternFailure', [redirect.includePattern, redirect.exampleUrl]));
- }
- } catch(e) {alert(e);}
- }
+ if (result.isMatch) {
+ this.msgBox(extName, this.strings.getFormattedString('testPatternSuccess', [redirect.includePattern, redirect.exampleUrl, result.redirectTo]));
+ } else if (result.isExcludeMatch) {
+ this.msgBox(extName, this.strings.getFormattedString('testPatternExclude', [redirect.exampleUrl, redirect.excludePattern]));
+ } else {
+ this.msgBox(extName, this.strings.getFormattedString('testPatternFailure', [redirect.includePattern, redirect.exampleUrl]));
+ }
+ } catch(e) {alert(e);}
+ }
}; \ No newline at end of file