summaryrefslogtreecommitdiff
path: root/extensions/perdomainsettings
diff options
context:
space:
mode:
authorportix <none@none>2012-12-11 22:18:03 +0100
committerportix <none@none>2012-12-11 22:18:03 +0100
commit986d8ad7dd3023c8c52286d939461983b1dc91ab (patch)
treeba7f3ba12c3ae5524b21a5ad40d5b902329038d4 /extensions/perdomainsettings
parentd701849f7925ab0950f632129e23bce1b7d889af (diff)
downloaddwb-986d8ad7dd3023c8c52286d939461983b1dc91ab.zip
Indentation in perdomainsettings
Diffstat (limited to 'extensions/perdomainsettings')
-rw-r--r--extensions/perdomainsettings172
1 files changed, 94 insertions, 78 deletions
diff --git a/extensions/perdomainsettings b/extensions/perdomainsettings
index 862cd98b..b8a6ab6c 100644
--- a/extensions/perdomainsettings
+++ b/extensions/perdomainsettings
@@ -127,97 +127,113 @@ var defaultConfig = {
//>DEFAULT_CONFIG
};
-function apply(o, settings) {
- var key;
- var defaults = true;
- var websettings = o.settings;
- for (key in settings) {
- if (!o.set[key]) {
- websettings[key] = settings[key];
- o.set[key] = true;
+function apply(o, settings)
+{
+ var key;
+ var defaults = true;
+ var websettings = o.settings;
+ for (key in settings)
+ {
+ if (!o.set[key])
+ {
+ websettings[key] = settings[key];
+ o.set[key] = true;
+ }
+ else
+ defaults = false;
}
- else {
- defaults = false;
- }
- }
- return defaults;
+ return defaults;
}
-function onNavigation(wv, frame, request, action) {
- var length = webviews.length;
- var i, host, domain;
- var found = false;
- var o = null;
- for (i=0; i<length && o === null; i++) {
- if (webviews[i].webview === wv) {
- o = webviews[i];
+function onNavigation(wv, frame, request, action)
+{
+ var length = webviews.length;
+ var i, host, domain;
+ var found = false;
+ var o = null;
+ for (i=0; i<length && o === null; i++)
+ {
+ if (webviews[i].webview === wv)
+ o = webviews[i];
}
- }
- if (o === null) {
- o = { webview : wv, defaults : false, settings : wv.settings };
- webviews.push(o);
- }
- o.set = {};
- if (frame === wv.mainFrame) {
- try {
- var uri = request.uri;
- host = request.message.uri.host;
- domain = util.domainFromHost(host);
- if (domains[domain]) {
- apply(o, domains[domain]);
- o.defaults = false;
- }
- if (hosts[host]) {
- apply(o, hosts[host]);
- o.defaults = false;
- }
- if (uris[uri]) {
- apply(o, uris[uri]);
- o.defaults = false;
- }
- if (o.defaults === false && apply(o, defaults)) {
- o.defaults = true;
- }
+ if (o === null)
+ {
+ o = { webview : wv, defaults : false, settings : wv.settings };
+ webviews.push(o);
}
- catch (e) {
- extensions.error(me, e);
+ o.set = {};
+ if (frame === wv.mainFrame)
+ {
+ try
+ {
+ var uri = request.uri;
+ host = request.message.uri.host;
+ domain = util.domainFromHost(host);
+ if (domains[domain])
+ {
+ apply(o, domains[domain]);
+ o.defaults = false;
+ }
+ if (hosts[host])
+ {
+ apply(o, hosts[host]);
+ o.defaults = false;
+ }
+ if (uris[uri])
+ {
+ apply(o, uris[uri]);
+ o.defaults = false;
+ }
+ if (o.defaults === false && apply(o, defaults))
+ o.defaults = true;
+ }
+ catch (e)
+ {
+ extensions.error(me, e);
+ }
}
- }
}
function onCloseTab(wv) {
- var i;
- for (i=0; i<webviews.length; i++) {
- if (webviews[i].webview === wv) {
- webviews.splice(i, 1);
- return;
+ var i;
+ for (i=0; i<webviews.length; i++)
+ {
+ if (webviews[i].webview === wv)
+ {
+ webviews.splice(i, 1);
+ return;
+ }
}
- }
}
return {
- init : function (config) {
- if (!config) {
- extensions.error(me, "Missing config");
- return false;
- }
- domains = config.domains || defaultConfig.domains;
- hosts = config.hosts || defaultConfig.hosts;
- uris = config.uris || defaultConfig.uris;
- defaults = config.defaults || defaultConfig.defaults;
- sigNavigation = signals.connect("navigation", onNavigation);
- sigCloseTab = signals.connect("closeTab", onCloseTab);
- return true;
- },
- end : function () {
- if (sigNavigation >= 0) {
- signals.disconnect(sigNavigation);
- sigNavigation = -1;
- }
- if (sigCloseTab >= 0) {
- signals.disconnect(sigCloseTab);
- sigCloseTab = -1;
+ init : function (config)
+ {
+ if (!config)
+ {
+ extensions.error(me, "Missing config");
+ return false;
+ }
+ domains = config.domains || defaultConfig.domains;
+ hosts = config.hosts || defaultConfig.hosts;
+ uris = config.uris || defaultConfig.uris;
+ defaults = config.defaults || defaultConfig.defaults;
+ sigNavigation = signals.connect("navigation", onNavigation);
+ sigCloseTab = signals.connect("closeTab", onCloseTab);
+ return true;
+ },
+ end : function ()
+ {
+ if (sigNavigation >= 0)
+ {
+ signals.disconnect(sigNavigation);
+ sigNavigation = -1;
+ }
+ if (sigCloseTab >= 0)
+ {
+ signals.disconnect(sigCloseTab);
+ sigCloseTab = -1;
+ }
}
- }
};
// vim: set ft=javascript: