diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js old mode 100644 new mode 100755 index 56a2d46a..237fbb23 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -970,7 +970,7 @@ function History() //{{{ completion.history = function _history(context, maxItems) { context.format = history.format; - context.title = ["History"] + context.title = ["History"]; context.compare = CompletionContext.Sort.unsorted; //context.background = true; if (context.maxItems == null) @@ -1027,7 +1027,7 @@ function History() //{{{ let sh = window.getWebNavigation().sessionHistory; let obj = []; obj.index = sh.index; - obj.__iterator__ = function() util.Array.iteritems(this) + obj.__iterator__ = function () util.Array.iteritems(this); for (let i in util.range(0, sh.count)) { obj[i] = { index: i, __proto__: sh.getEntryAtIndex(i, false) }; diff --git a/common/content/browser.js b/common/content/browser.js old mode 100644 new mode 100755 index 70202978..06931ea5 --- a/common/content/browser.js +++ b/common/content/browser.js @@ -71,7 +71,7 @@ function Browser() //{{{ // Stolen from browser.jar/content/browser/browser.js, more or less. try { - var docCharset = getBrowser().docShell.QueryInterface(Ci.nsIDocCharset).charset = val + var docCharset = getBrowser().docShell.QueryInterface(Ci.nsIDocCharset).charset = val; PlacesUtils.history.setCharsetForURI(getWebNavigation().currentURI, val); getWebNavigation().reload(Ci.nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE); } @@ -95,19 +95,24 @@ function Browser() //{{{ let services = modules.services; // Storage objects are global to all windows, 'modules' isn't. storage.newObject("private-mode", function () { ({ - init: function () { + init: function () + { services.get("observer").addObserver(this, "private-browsing", false); services.get("observer").addObserver(this, "quit-application", false); this.private = services.get("privateBrowsing").privateBrowsingEnabled; }, - observe: function (subject, topic, data) { - if (topic == "private-browsing") { + observe: function (subject, topic, data) + { + if (topic == "private-browsing") + { if (data == "enter") storage.privateMode = true; else if (data == "exit") storage.privateMode = false; storage.fireEvent("private-mode", "change", storage.privateMode); - } else if (topic == "quit-application") { + } + else if (topic == "quit-application") + { services.get("observer").removeObserver(this, "quit-application"); services.get("observer").removeObserver(this, "private-browsing"); } diff --git a/common/content/commands.js b/common/content/commands.js old mode 100644 new mode 100755 index a7bd70d1..0e4f83b4 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -1171,7 +1171,7 @@ function Commands() //{{{ // then get completions of the command name let [count, cmd, bang, args] = commands.parseCommand(context.filter); let [, prefix, junk] = context.filter.match(/^(:*\d*)\w*(.?)/) || []; - context.advance(prefix.length) + context.advance(prefix.length); if (!junk) return context.fork("", 0, this, "command"); diff --git a/common/content/completion.js b/common/content/completion.js old mode 100644 new mode 100755 index 5ad4f13f..5c3e237f --- a/common/content/completion.js +++ b/common/content/completion.js @@ -128,7 +128,7 @@ function CompletionContext(editor, name, offset) //{{{ return this.filters. reduce(function (res, filter) res.filter(function (item) filter.call(self, item)), items); - } + }; /** * @property {Array} An array of predicates on which to filter the * results. @@ -256,12 +256,12 @@ CompletionContext.prototype = { let prefix = self.value.substring(minStart, context.offset); return context.items.map(function makeItem(item) ({ text: prefix + item.text, item: item.item })); }); - return { start: minStart, items: util.Array.flatten(items), longestSubstring: this.longestAllSubstring } + return { start: minStart, items: util.Array.flatten(items), longestSubstring: this.longestAllSubstring }; } catch (e) { liberator.reportError(e); - return { start: 0, items: [], longestAllSubstring: "" } + return { start: 0, items: [], longestAllSubstring: "" }; } }, // Temporary @@ -306,7 +306,7 @@ CompletionContext.prototype = { this._completions = items; let self = this; if (this.updateAsync && !this.noUpdate) - liberator.callInMainThread(function () { self.onUpdate.call(self) }); + liberator.callInMainThread(function () { self.onUpdate.call(self); }); }, get createRow() this._createRow || template.completionRow, // XXX @@ -319,7 +319,7 @@ CompletionContext.prototype = { set filter(val) { delete this._ignoreCase; - return this._filter = val + return this._filter = val; }, get format() ({ @@ -347,7 +347,7 @@ CompletionContext.prototype = { let [k, v] = i; let _k = "_" + k; if (typeof v == "string" && /^[.[]/.test(v)) - v = eval("(function (i) i" + v + ")") + v = eval("(function (i) i" + v + ")"); if (typeof v == "function") res.__defineGetter__(k, function () _k in this ? this[_k] : (this[_k] = v(this.item))); else @@ -358,7 +358,7 @@ CompletionContext.prototype = { }, get regenerate() this._generate && (!this.completions || !this.itemCache[this.key] || this.cache.offset != this.offset), - set regenerate(val) { if (val) delete this.itemCache[this.key] }, + set regenerate(val) { if (val) delete this.itemCache[this.key]; }, get generate() !this._generate ? null : function () { @@ -438,7 +438,7 @@ CompletionContext.prototype = { filtered.forEach(function (item) { item.unquoted = item.text; item.text = quote[0] + quote[1](item.text) + quote[2]; - }) + }); return this.cache.filtered = filtered; }, @@ -573,7 +573,7 @@ CompletionContext.prototype = { fork: function fork(name, offset, self, completer) { if (typeof completer == "string") - completer = self[completer] + completer = self[completer]; let context = new CompletionContext(this, name, offset); this.contextList.push(context); if (completer) @@ -762,7 +762,7 @@ function Completion() //{{{ } catch (e) {} return iterator; - } + }; // Search the object for strings starting with @key. // If @last is defined, key is a quoted string, it's @@ -812,7 +812,7 @@ function Completion() //{{{ }); return compl; - } + }; this.eval = function eval(arg, key, tmp) { @@ -837,7 +837,7 @@ function Completion() //{{{ { delete context[EVAL_TMP]; } - } + }; // Get an element from the stack. If @n is negative, // count from the top of the stack, otherwise, the bottom. @@ -851,7 +851,7 @@ function Completion() //{{{ if (m == null) return a; return a[a.length - m - 1]; - } + }; function buildStack(filter) { @@ -862,7 +862,7 @@ function Completion() //{{{ top = [i, arg, [i], [], [], [], []]; last = top[CHAR]; stack.push(top); - } + }; let pop = function pop(arg) { if (top[CHAR] != arg) @@ -882,7 +882,7 @@ function Completion() //{{{ last = top[CHAR]; let ret = stack.pop(); return ret; - } + }; let i = 0, c = ""; // Current index and character, respectively. @@ -1056,7 +1056,7 @@ function Completion() //{{{ prev = dot + 1; obj = self.eval(s, cacheKey, obj); } - return [[obj, cacheKey]] + return [[obj, cacheKey]]; } function getObjKey(frame) @@ -1113,13 +1113,13 @@ function Completion() //{{{ if (!isnan(a.item.key) && !isnan(b.item.key)) return a.item.key - b.item.key; return isnan(b.item.key) - isnan(a.item.key) || compare(a, b); - } + }; if (!context.anchored) // We've already listed anchored matches, so don't list them again here. context.filters.push(function (item) util.compareIgnoreCase(item.text.substr(0, this.filter.length), this.filter)); if (obj == cache.evalContext) context.regenerate = true; context.generate = function () self.objectKeys(obj); - } + }; } // TODO: Make this a generic completion helper function. let filter = key + (string || ""); @@ -1226,7 +1226,7 @@ function Completion() //{{{ let res = completer.call(self, context, func, obj, args); if (res) context.completions = res; - } + }; obj[0][1] += "." + func + "(... [" + args.length + "]"; return complete.call(this, obj, key, compl, string, last); @@ -1346,7 +1346,7 @@ function Completion() //{{{ let numLocationCompletions = 0; // how many async completions did we already return to the caller? let start = 0; let skip = 0; - + if (options["urlseparator"]) skip = context.filter.match("^.*" + options["urlseparator"]); // start after the last 'urlseparator' @@ -1372,7 +1372,7 @@ function Completion() //{{{ urls: function (context, tags) { let compare = String.localeCompare; - let contains = String.indexOf + let contains = String.indexOf; if (context.ignoreCase) { compare = util.compareIgnoreCase; diff --git a/common/content/events.js b/common/content/events.js old mode 100644 new mode 100755 index 3d96a76b..2785d0fc --- a/common/content/events.js +++ b/common/content/events.js @@ -97,7 +97,7 @@ function AutoCommands() //{{{ if (args.bang) autocommands.remove(event, regex); if (args["-javascript"]) - cmd = eval("(function(args) { with(args) {" + cmd + "} })"); + cmd = eval("(function (args) { with(args) {" + cmd + "} })"); autocommands.add(events, regex, cmd); } else @@ -351,7 +351,7 @@ function Events() //{{{ pendingMotionMap: null, // e.g. "d{motion}" if we wait for a motion of the "d" command pendingArgMap: null, // pending map storage for commands like m{a-z} count: -1 // parsed count from the input buffer - } + }; var fullscreen = window.fullScreen; @@ -471,9 +471,9 @@ function Events() //{{{ .replace(/^NUMPAD/, "k")]; if (k in keyTable) names = keyTable[k]; - code_key[v] = names[0] + code_key[v] = names[0]; for (let [,name] in Iterator(names)) - key_code[name.toLowerCase()] = v + key_code[name.toLowerCase()] = v; } // HACK: as Gecko does not include an event for <, we must add this in manually. @@ -1013,7 +1013,7 @@ function Events() //{{{ */ fromString: function (input) { - let out = [] + let out = []; let re = RegExp("<.*?>?>|[^<]|<(?!.*>)", "g"); let match; @@ -1042,7 +1042,7 @@ function Events() //{{{ { if (evt_obj.shiftKey) { - keyname = keyname.toUpperCase() + keyname = keyname.toUpperCase(); if (keyname == keyname.toLowerCase()) evt_obj.liberatorShift = true; } @@ -1062,7 +1062,7 @@ function Events() //{{{ } else // spaces, control characters, and < { - evt_obj.keyCode = key_code[keyname] + evt_obj.keyCode = key_code[keyname]; evt_obj.charCode = 0; } } @@ -1079,7 +1079,7 @@ function Events() //{{{ if (evt_obj.keyCode == 32 || evt_obj.charCode == 32) evt_obj.charCode = evt_obj.keyCode = 32; // if (evt_obj.keyCode == 60 || evt_obj.charCode == 60) - evt_obj.charCode = evt_obj.keyCode = 60 // + evt_obj.charCode = evt_obj.keyCode = 60; // out.push(evt_obj); } @@ -1321,7 +1321,7 @@ function Events() //{{{ if (config.focusChange) return void config.focusChange(win); - urlbar = document.getElementById("urlbar"); + let urlbar = document.getElementById("urlbar"); if (elem == null && urlbar && urlbar.inputField == lastFocus) liberator.threadYield(true); diff --git a/common/content/hints.js b/common/content/hints.js old mode 100644 new mode 100755 index 1de5f65e..ed3f1493 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -818,7 +818,7 @@ function Hints() //{{{ ["contains", "The typed characters are split on whitespace. The resulting groups must all appear in the hint."], ["wordstartswith", "The typed characters are split on whitespace. The resulting groups must all match the beginings of words, in order."], ["firstletters", "Behaves like wordstartswith, but all groups much match a sequence of words."], - ["custom", "Delegate to a custom function: liberator.plugins.customHintMatcher(hintString)"], + ["custom", "Delegate to a custom function: liberator.plugins.customHintMatcher(hintString)"] ], validator: Option.validateCompleter }); diff --git a/common/content/io.js b/common/content/io.js old mode 100644 new mode 100755 index 815c15db..94645256 --- a/common/content/io.js +++ b/common/content/io.js @@ -478,7 +478,7 @@ function IO() //{{{ } return util.Array.flatten(commands); - } + }; }; completion.addUrlCompleter("f", "Local files", completion.file); diff --git a/common/content/liberator.js b/common/content/liberator.js old mode 100644 new mode 100755 index 8c162242..83e73895 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -489,7 +489,7 @@ const liberator = (function () //{{{ bang: true, completer: function (context) { - completion.extension(context) + completion.extension(context); if (command.filter) context.filters.push(command.filter); }, @@ -852,7 +852,7 @@ const liberator = (function () //{{{ function (elem) [elem.textContent, file]); }); return util.Array.flatten(res); - } + }; }; completion.menuItem = function menuItem(context) { @@ -866,7 +866,7 @@ const liberator = (function () //{{{ context.title = ["Toolbar"]; context.keys = { text: function (item) item.getAttribute("toolbarname"), description: function () "" }; context.completions = buffer.evaluateXPath("./*[@toolbarname]", document, toolbox); - } + }; }); /////////////////////////////////////////////////////////////////////////////}}} @@ -913,7 +913,7 @@ const liberator = (function () //{{{ } //const Extension = new Struct("id", "name", "description", "icon", "enabled", "version"); - return extensions.map(function(e) ({ + return extensions.map(function (e) ({ id: e.id, name: e.name, description: getRdfProperty(e, "description"), diff --git a/common/content/mappings.js b/common/content/mappings.js old mode 100644 new mode 100755 index d5e46f19..a29ee581 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -266,7 +266,7 @@ function Mappings() //{{{ } for (map in mappingsIterator(modes, user)) if (map.rhs && map.noremap == noremap) - ] + ]; } }; diff --git a/common/content/modes.js b/common/content/modes.js old mode 100644 new mode 100755 index ed3798d9..51caaf65 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -259,7 +259,7 @@ const modes = (function () //{{{ set main(value) { this.set(value); }, get extended() extended, - set extended(value) { this.set(null, value) } + set extended(value) { this.set(null, value); } }; diff --git a/common/content/options.js b/common/content/options.js old mode 100644 new mode 100755 index d38c0509..99851dd4 --- a/common/content/options.js +++ b/common/content/options.js @@ -762,7 +762,7 @@ function Options() //{{{ return {i} {prefix}{value} - + ; }) } ; diff --git a/common/content/style.js b/common/content/style.js old mode 100644 new mode 100755 index b6afc8b7..11512a68 --- a/common/content/style.js +++ b/common/content/style.js @@ -306,7 +306,7 @@ function Styles(name, store) { this.registerSheet(cssUri(wrapCSS(sheet))); if (sheet.agent) - this.registerAgentSheet(cssUri(wrapCSS(sheet))) + this.registerAgentSheet(cssUri(wrapCSS(sheet))); } catch (e) { @@ -335,7 +335,7 @@ function Styles(name, store) let names = system ? systemNames : userNames; if (typeof sheet === "number") return sheets[sheet]; - return names[sheet] + return names[sheet]; }; /** diff --git a/common/content/ui.js b/common/content/ui.js old mode 100644 new mode 100755 index 02b1db3d..bf3e08df --- a/common/content/ui.js +++ b/common/content/ui.js @@ -363,7 +363,7 @@ function CommandLine() //{{{ { case this.UP: if (this.selected == null) - idx = -2 + idx = -2; else idx = this.selected - 1; break; @@ -2126,7 +2126,7 @@ function StatusLine() //{{{ value = value.replace(/[\u200e\u200f\u202a\u202b\u202c\u202d\u202e]/g, encodeURIComponent); return value; - } + }; if (url == null) // TODO: this probably needs a more general solution. diff --git a/common/content/util.js b/common/content/util.js old mode 100644 new mode 100755 index 867a3123..8f2024ca --- a/common/content/util.js +++ b/common/content/util.js @@ -524,7 +524,7 @@ const util = { //{{{ value = template.highlight(value, true, 150); // FIXME: Inline style. - key = {i}; + let key = {i}; if (!isNaN(i)) i = parseInt(i); else if (/^[A-Z_]+$/.test(i)) @@ -649,7 +649,7 @@ const util = { //{{{ if (options["urlseparator"]) urls = util.splitLiteral(str, RegExp("\\s*" + options["urlseparator"] + "\\s*")); else - urls = [str] + urls = [str]; return urls.map(function (url) { try @@ -741,8 +741,8 @@ util.Array = function Array_(ary) { return util.Array(res); return res; }, - concat: function() [].concat.apply(this.__proto__, arguments), - map: function() this.__noSuchMethod__("map", Array.slice(arguments)), + concat: function () [].concat.apply(this.__proto__, arguments), + map: function () this.__noSuchMethod__("map", Array.slice(arguments)), }; return obj; } diff --git a/muttator/content/mail.js b/muttator/content/mail.js old mode 100644 new mode 100755 index b48af15a..c510a43d --- a/muttator/content/mail.js +++ b/muttator/content/mail.js @@ -251,7 +251,7 @@ function Mail() //{{{ function () { if (gDBView && gDBView.selection.count < 1) - return liberator.beep(); + return void liberator.beep(); MsgOpenNewTabForMessage(); }); @@ -558,7 +558,7 @@ function Mail() //{{{ function (arg) { if (!GetSelectedMessages()) - return liberator.beep(); + return void liberator.beep(); switch (arg) { @@ -664,7 +664,7 @@ function Mail() //{{{ "Select a folder", function (args) { - let count = Math.max(0, args.count - 1) + let count = Math.max(0, args.count - 1); let arg = args.literalArg || "Inbox"; let folder = mail.getFolders(arg, true, true)[count]; diff --git a/xulmus/content/player.js b/xulmus/content/player.js old mode 100644 new mode 100755 index 1a184fd8..896a3759 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -193,7 +193,7 @@ function Player() // {{{ mappings.add([modes.PLAYER], [""], "Rate the current media item " + rating, function () { player.rateMediaItem(rating); }); - } + }; } ////////////////// ///////////////////////////////////////////////////////////}}} @@ -306,9 +306,9 @@ function Player() // {{{ } if (/^[-+]/.test(arg)) - arg[0] == "-" ? player.seekBackward(value) : player.seekForward(value) + arg[0] == "-" ? player.seekBackward(value) : player.seekForward(value); else - player.seekTo(value) + player.seekTo(value); }, { argCount: "1" });