Browse files

Whitespace cleanup

  • Loading branch information...
1 parent 69441ad commit 39499f1317cff11f6cd115f2b6a838cb8017ab5e @nmaier nmaier committed Mar 31, 2011
View
10 chrome/content/prefStub.xul
@@ -28,10 +28,10 @@
catch (ex) {
window.open(document.getElementById('url').value);
}
-
+
close();
}
-
+
try {
try {
let _m = {};
@@ -50,11 +50,11 @@
'acPane'
);
}
-
+
close();
}
catch (ex) {
document.getElementById('mainbox').hidden = false;
- }
+ }
]]></script>
-</dialog>
+</dialog>
View
36 chrome/content/prefpane.js
@@ -43,12 +43,12 @@ var acPlugins = {
FilePicker: Components.Constructor('@mozilla.org/filepicker;1', 'nsIFilePicker', 'init'),
LocalFile: Components.Constructor('@mozilla.org/file/local;1', 'nsILocalFile', 'initWithPath'),
Process: Components.Constructor('@mozilla.org/process/util;1', 'nsIProcess', 'init'),
-
+
init: function acPL_init() {
this._pane = document.getElementById('acPane');
this._pref = document.getElementById('acPrefPlugins');
this._list = document.getElementById('acListPlugins');
-
+
Components.utils.import('resource://dtaac/plugins.jsm', this._plugins);
this.reload();
@@ -64,21 +64,21 @@ var acPlugins = {
}
return s;
}
-
+
while (this._list.childNodes.length) {
this._list.removeChild(this._list.firstChild);
}
-
+
let p = [];
try {
p = this._plugins.nsJSON.decode(this._pref.value);
}
catch (ex) { /* no op */ }
-
+
if (!(p instanceof Array)) {
p = [];
}
- let plugs = [];
+ let plugs = [];
for (let f in this._plugins.enumerate(true)) {
let date = new Date(f.date);
date = zeropad(date.getUTCFullYear(), 4)
@@ -118,7 +118,7 @@ var acPlugins = {
fp.appendFilter('JSON Plugin', '*.json');
fp.defaultExtension = "json";
fp.filterIndex = 1;
-
+
let rv = fp.show();
if (rv == Ci.nsIFilePicker.returnOK) {
let installed = this._plugins.installFromFile(fp.file);
@@ -127,15 +127,15 @@ var acPlugins = {
},
showNewPlugin: function() {
this.np_clearErrors();
-
+
$('acNPprefix', 'acNPmatch').forEach(function(e) e.value = '');
$('acNPns').value = Preferences.getExt('anticontainer.namespace', '');
$('acNPauthor').value = Preferences.getExt('anticontainer.author', '');
-
+
if (!$('acNPns').value) {
$('acNPns').value = this._plugins.DEFAULT_NAMESPACE;
}
-
+
$('acPluginsDeck').selectedIndex = 1;
},
showPluginList: function(id) {
@@ -193,7 +193,7 @@ var acPlugins = {
// nothing selected;
return null;
}
-
+
_ed = new this.LocalFile(_ed);
_ed.followLinks = true;
if (!_ed.exists() || !_ed.isExecutable()) {
@@ -243,11 +243,11 @@ var acPlugins = {
nb.appendNotification(err, null, null, nb.PRIORITY_CRITICAL_MEDIUM, null);
},
np_clearErrors: function(err) $('acNPErrors').removeAllNotifications(true),
-
+
createNewPlugin: function() {
let p = {};
let errs = 0;
-
+
this.np_clearErrors();
for each (let e in $('acNPtype', 'acNPns', 'acNPauthor', 'acNPprefix', 'acNPmatch', 'acNPstatic')) {
@@ -267,21 +267,21 @@ var acPlugins = {
}
}
p.static = p.static == 'true';
-
+
if (errs) {
return;
}
-
+
try {
let plug = this._plugins.createNewPlugin(p);
-
+
try {
this.showInEditor(plug.file);
}
catch (ex) {
Debug.log("Failed to launch editor", ex);
}
-
+
Preferences.setExt('anticontainer.namespace', p.ns);
Preferences.setExt('anticontainer.author', p.author);
this.showPluginList(plug.id);
@@ -313,4 +313,4 @@ var acPlugins = {
return "";
}
};
-addEventListener('load', function() acPlugins.init(), true);
+addEventListener('load', function() acPlugins.init(), true);
View
36 chrome/content/webinstall.xhtml
@@ -21,11 +21,11 @@
let plug = null;
let plugins = {};
-
+
function $(id) {
return document.getElementById(id);
}
-
+
function load() {
Components.utils.import('resource://dtaac/plugins.jsm', plugins);
@@ -35,13 +35,13 @@
if (typeof plug == 'string') {
throw plug;
}
-
+
$('prefix').textContent = plug.prefix;
$('match').textContent = plug.match;
if (plug.author) {
$('author').textContent = plug.author;
}
-
+
switch (plug.type) {
]]>
case 'resolver':
@@ -61,17 +61,17 @@
break;
<![CDATA[
}
-
+
$('code').textContent = plugins.prettyJSON(plug.source);
}
catch (ex) {
$('errmsg').textContent = ex;
toHide = $('plugin');
}
-
+
toHide.style.display = 'none';
}
-
+
function install() {
$('install').setAttribute('disabled', 'true');
$('cancel').textContent = $('back').textContent;
@@ -98,9 +98,9 @@
}
catch (ex) {
alert("Failed to load mediator; update DTA");
- }
+ }
}
- addEventListener('load', load, true);
+ addEventListener('load', load, true);
]]></script>
</head>
<body dir="&locale.dir;">
@@ -109,7 +109,7 @@
<div id="plugin">
<p>&wi.intro;</p>
<p>&wi.intro2;</p>
-
+
<h3>&wi.details;</h3>
<table>
<tr>
@@ -136,25 +136,25 @@
<h3>&wi.source;</h3>
<pre id="code"/>
</div>
-
-
+
+
<h3>&wi.caution;</h3>
<p>&wi.cautiontext;</p>
-
+
<div class="buttons">
<button id="install" onclick="install();">&wi.install;</button>
<button id="cancel" onclick="back();">&wi.cancel;</button>
</div>
</div>
-
+
<div id="error">
<h2>&wi.invalid;</h2>
<p>&wi.invalidtext;</p>
- <div class="buttons">
+ <div class="buttons">
<button id="back" onclick="back();">&wi.back;</button>
</div>
- <p id="errmsg"/>
- </div>
+ <p id="errmsg"/>
+ </div>
</div>
</body>
-</html>
+</html>
View
2 chrome/skin/webinstall.css
@@ -75,4 +75,4 @@ pre {
}
#errmsg {
opacity: 0.20;
-}
+}
View
4 components/services.js
@@ -120,7 +120,7 @@ AutoFilter.prototype = {
},
get plugins() {
let plgs = {};
- Components.utils.import('resource://dtaac/plugins.jsm', plgs);
+ module('resource://dtaac/plugins.jsm', plgs);
delete AutoFilter.prototype.plugins;
return this.plugins = AutoFilter.prototype.plugins = plgs;
},
@@ -248,7 +248,7 @@ WebInstallConverter.prototype = {
try {
// load the plugins module
let plugs = {};
- Components.utils.import('resource://dtaac/plugins.jsm', plugs);
+ module('resource://dtaac/plugins.jsm', plugs);
// close the storage stream output
this._bout.flush();
View
34 modules/plugins.jsm
@@ -116,7 +116,7 @@ Observer.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference, Ci.nsIWeakReference]),
QueryReferent: function(iid) this.QueryInterface(iid),
GetWeakReference: function() this,
-
+
observe: function() {
this.notify();
},
@@ -132,7 +132,7 @@ function validatePlugin(o) {
if (['redirector', 'resolver', 'sandbox', 'expander'].indexOf(o.type) == -1) {
throw new Error("Failed to load plugin: invalid type");
}
-
+
switch (o.type) {
case 'resolver':
if (!o.finder || !o.builder) {
@@ -155,13 +155,13 @@ function validatePlugin(o) {
}
break;
}
-
+
if (!o.prefix || typeof o.prefix != 'string') {
throw new Error("Failed to load plugin: prefix omitted");
}
-
+
o.source = nsJSON.encode(o);
-
+
for each (let x in ['match', 'pattern', 'gone']) {
if (x in o) {
o['str' + x] = o[x];
@@ -187,17 +187,17 @@ function validatePlugin(o) {
for each (let b in ['decode', 'static', 'omitReferrer', 'sendInitialReferrer', 'useServerName', 'useOriginName', 'noFilter']) {
o[b] = !!o[b];
}
-
+
if (!o.priority || typeof o.priority != 'number') {
o.priority = 0;
}
o.priority = Math.round(o.priority);
-
+
if (!o.ns) {
o.ns = DEFAULT_NAMESPACE;
}
o.ns = o.ns.toString();
-
+
o.id = o.prefix + '@' + o.ns;
return o;
}
@@ -238,7 +238,7 @@ function idToFilename(id) id.replace(/[^\w\d\._@-]/gi, '-') + ".json";
function enumerate(all) {
let disabled = !!all ? [] : nsJSON.decode(Prefs.getCharPref('anticontainer.disabled_plugins'));
let i = 0;
-
+
// load builtin plugins
for each (let o in __builtinPlugins__) {
++i;
@@ -247,7 +247,7 @@ function enumerate(all) {
}
yield o;
}
-
+
// load user plugins
let e = USER_DIR.directoryEntries;
while (e.hasMoreElements()) {
@@ -262,7 +262,7 @@ function enumerate(all) {
o.priority += 3;
o.managed = false;
-
+
++i;
yield o;
}
@@ -311,7 +311,7 @@ function installFromStringOrObject(str) {
cs.close();
Observer.notify();
return {id: p.id, file: pf};
-}
+}
/**
* Installs a plugin as retrieved from the web
@@ -362,7 +362,7 @@ function createNewPlugin(plugin) {
plugin.generator = "<fill generator>";
break;
}
- return installFromStringOrObject(plugin);
+ return installFromStringOrObject(plugin);
}
const _store = {};
@@ -402,7 +402,7 @@ function prettyJSON(objectOrString, initialIndent) {
// and modified to do some pretty printing
function prettyPrint(_oo, _l) {
let _p = [];
-
+
function l(n) {
let rv = '';
while(--n >= 0) {
@@ -460,7 +460,7 @@ function prettyJSON(objectOrString, initialIndent) {
}
}
p(_oo, _l ? _l : 0);
-
+
return _p.join("");
}
if (typeof objectOrString != 'string') {
@@ -489,8 +489,8 @@ function prettyJSON(objectOrString, initialIndent) {
log("Failed to load builtin: " + o.toSource());
log(ex);
}
- }
+ }
Observer.notify();
};
req.send(null);
-})();
+})();
View
2 modules/replacementgenerator.jsm
@@ -112,4 +112,4 @@ function _replace(str, match, urlMatch) {
return replacements[method](args, match, urlMatch);
}
-function generateReplacement(builder, match, urlMatch) builder.replace(/\{.+?\}/g, function(str) _replace(str, match, urlMatch));
+function generateReplacement(builder, match, urlMatch) builder.replace(/\{.+?\}/g, function(str) _replace(str, match, urlMatch));
View
2 modules/sandboxscripts.jsm
@@ -11,4 +11,4 @@ r.overrideMimeType('text/javascript');
r.open('GET', 'chrome://dtaac/content/sandboxscripts.js', false);
r.send(null);
-const SandboxScripts = r.responseText;
+const SandboxScripts = r.responseText;

0 comments on commit 39499f1

Please sign in to comment.