diff --git a/background/commands.js b/background/commands.js index 491eff0d1..4040b8cfe 100644 --- a/background/commands.js +++ b/background/commands.js @@ -45,7 +45,7 @@ var Commands = { registry[pair[0]] = Utils.makeCommand(pair[1]); } }, - parseKeyMappings: function(line) { + parseKeyMappings: (function(line) { var key, lines, splitLine, mk = 0, _i = 0, _len, mkReg, registry, details, available; registry = CommandsData.keyToCommandRegistry = Object.create(null); mkReg = Object.create(null); @@ -96,8 +96,8 @@ var Commands = { } } CommandsData.mapKeyRegistry = mk > 0 ? mkReg : null; - }, - populateCommandKeys: function() { + }), + populateCommandKeys: (function() { var key, ref, ref2, arr, keyRe = Utils.keyRe, ch, j, last, tmp, func; ref = Object.create(null); for (ch = 10; 0 <= --ch; ) { ref[ch] = 1; } @@ -144,7 +144,7 @@ var Commands = { } Settings.Init && Settings.Init(); return ref; - }, + }), defaultKeyMappings: [ ["?", "showHelp"], diff --git a/background/help_dialog.js b/background/help_dialog.js index a0b186d37..9311ae319 100644 --- a/background/help_dialog.js +++ b/background/help_dialog.js @@ -1,6 +1,6 @@ "use strict"; var HelpDialog = { - render: function(request) { + render: (function(request) { var command, commandsToKey, key, ref = CommandsData.keyToCommandRegistry, result; Object.setPrototypeOf(request, null); commandsToKey = Object.create(null); @@ -20,8 +20,8 @@ var HelpDialog = { return s != null ? s : HelpDialog.groupHtml(group, commandsToKey, CommandsData.availableCommands, showUnbound, showNames); }); - }, - groupHtml: function(group, commandsToKey, availableCommands, showUnbound, showNames) { + }), + groupHtml: (function(group, commandsToKey, availableCommands, showUnbound, showNames) { var bindings, command, html, isAdvanced, _i, _len, _ref, keys, description, push; html = []; _ref = this.commandGroups[group]; @@ -46,8 +46,8 @@ var HelpDialog = { } } return html.join(""); - }, - commandHtml: function(html, isAdvanced, bindings, description, command) { + }), + commandHtml: (function(html, isAdvanced, bindings, description, command) { html.push('\n\t'); if (description) { html.push('' @@ -62,7 +62,7 @@ var HelpDialog = { , bindings); } html.push("\n\n"); - }, + }), commandGroups: { pageNavigation: ["scrollDown", "scrollUp", "scrollLeft", "scrollRight", "scrollToTop" , "scrollToBottom", "scrollToLeft", "scrollToRight", "scrollPageDown", "scrollPageUp" @@ -98,9 +98,8 @@ var HelpDialog = { misc: ["showHelp", "autoCopy", "autoOpen", "searchAs", "searchInAnother", "toggleLinkHintCharacters" , "toggleSwitchTemp", "passNextKey", "debugBackground", "blank"] }, - advancedCommands: { - __proto__: null - , toggleViewSource: 1, clearFindHistory: 1 + advancedCommands: Object.setPrototypeOf({ + toggleViewSource: 1, clearFindHistory: 1 , scrollToLeft: 1, scrollToRight: 1, moveTabToNextWindow: 1 , moveTabToNewWindow: 1, moveTabToIncognito: 1, reloadGivenTab: 1, focusOrLaunch: 1 , goUp: 1, goToRoot: 1, focusInput: 1, "LinkHints.activateModeWithQueue": 1, enableCSTemp: 1 @@ -114,5 +113,5 @@ var HelpDialog = { , "LinkHints.activateModeToHover": 1, "LinkHints.unhoverLast": 1 , toggleLinkHintCharacters: 1, toggleSwitchTemp: 1, "LinkHints.activateModeToLeave": 1 , "Vomnibar.activateEditUrl": 1, "Vomnibar.activateEditUrlInNewTab": 1 - } + }, null) }; diff --git a/background/others.js b/background/others.js index a0f2ca394..426a52d8f 100644 --- a/background/others.js +++ b/background/others.js @@ -82,7 +82,7 @@ if (Settings.get("vimSync") === true) setTimeout(function() { if (!chrome.storag }); }, 400); -setTimeout(function() { if (!chrome.browserAction) { return; } +setTimeout((function() { if (!chrome.browserAction) { return; } var func = Settings.updateHooks.showActionIcon, imageData, tabIds; function loadImageAndSetIcon(type, path) { var img, i, cache = Object.create(null), count = 0, @@ -153,9 +153,9 @@ setTimeout(function() { if (!chrome.browserAction) { return; } } }; Settings.postUpdate("showActionIcon"); -}, 150); +}), 150); -setTimeout(function() { if (!chrome.omnibox) { return; } +setTimeout((function() { if (!chrome.omnibox) { return; } var last, firstResult, lastSuggest, tempRequest, timeout = 0, sessionIds, suggestions = null, outTimeout = 0, outTime, defaultSug = { description: "Open: %s" }, @@ -291,7 +291,7 @@ setTimeout(function() { if (!chrome.omnibox) { return; } }; chrome.omnibox.onInputChanged.addListener(onInput); chrome.omnibox.onInputEntered.addListener(onEnter); -}, 600); +}), 600); var a, cb; // According to tests: onInstalled will be executed after 0 ~ 16 ms if needed @@ -354,11 +354,11 @@ setTimeout(function() { }, 500); }); -setTimeout(function() { +setTimeout((function() { if (a) { a.removeListener(cb); chrome.runtime.onInstalled = a = null; } cb = function(b) { a = b; console.log(b); }; Utils.resetRe(); -}, 1200); +}), 1200); diff --git a/background/utils.js b/background/utils.js index 95162c06e..03e69735e 100644 --- a/background/utils.js +++ b/background/utils.js @@ -60,7 +60,7 @@ var Utils = { _jsNotEscapeRe: /["\[\]{}\u00ff-\uffff]|%(?![\dA-F]{2}|[\da-f]{2})/, filePathRe: /^['"]?((?:[A-Za-z]:[\\/]|\/(?:Users|home|root)\/)[^'"]*)['"]?$/, lastUrlType: 0, - convertToUrl: function(string, keyword, vimiumUrlWork) { + convertToUrl: (function(string, keyword, vimiumUrlWork) { string = string.trim(); if (string.charCodeAt(10) === 58 && string.substring(0, 11).toLowerCase() === "javascript:") { if (Settings.CONST.ChromeVersion < 46 && string.indexOf('%', 11) > 0 @@ -175,7 +175,7 @@ var Utils = { : type === 1 ? ("http://" + oldString) : type === 2 ? ("http:" + oldString) : oldString; - }, + }), checkSpecialSchemes: function(string, i, spacePos) { var isSlash = string[i + 1] === "/"; switch (string.substring(0, i)) { @@ -406,7 +406,7 @@ var Utils = { } catch (e) {} return url; }, - parseSearchEngines: function(str, map) { + parseSearchEngines: (function(str, map) { var ids, pair, key, val, obj, _i, _len, ind, rSlash = /[^\\]\//, rules = [], rEscapeSpace = /\\\s/g, rSpace = /\s/, rEscapeS = /\\s/g, rColon = /\\:/g, rPercent = /\\%/g, rRe = /\sre=/i, a = str.replace(/\\\n/g, '').split('\n'), @@ -489,12 +489,12 @@ var Utils = { obj.name = str ? this.DecodeURLPart(str) : ids[ids.length - 1].trimLeft(); } return rules; - }, + }), escapeAllRe: /[$()*+.?\[\\\]\^{|}]/g, _spaceOrPlusRe: /\\\+|%20| /g, _queryRe: /[#?]/, alphaRe: /[a-z]/i, - reparseSearchUrl: function (url, ind) { + reparseSearchUrl: (function (url, ind) { var prefix, str, str2, ind2; if (!this.protocolRe.test(url)) { return; } prefix = url.substring(0, ind - 1); @@ -524,7 +524,7 @@ var Utils = { ).replace(this._spaceOrPlusRe, "(?:\\+|%20| )"); prefix = this.prepareReparsingPrefix(prefix); return [prefix, new RegExp(str + str2 + url, this.alphaRe.test(str2) ? "i" : "")]; - }, + }), prepareReparsingPrefix: function(prefix) { if (prefix.startsWith("http://") || prefix.startsWith("https://")) { prefix = prefix.substring(prefix[4] === 's' ? 8 : 7); @@ -572,11 +572,11 @@ var Utils = { }; if (!String.prototype.startsWith) { -String.prototype.startsWith = function(s) { +String.prototype.startsWith = (function(s) { return this.length >= s.length && this.lastIndexOf(s, 0) === 0; -}; -String.prototype.endsWith || (String.prototype.endsWith = function(s) { +}); +String.prototype.endsWith || (String.prototype.endsWith = (function(s) { var i = this.length - s.length; return i >= 0 && this.indexOf(s, i) === i; -}); +})); } diff --git a/content/frontend.js b/content/frontend.js index 94beffc88..2cdd90c71 100644 --- a/content/frontend.js +++ b/content/frontend.js @@ -50,12 +50,12 @@ var VSettings, VHUD, VPort, VEventMode; ClearPort: function() { vPort.port = null; }, - connect: function(isFirst) { + connect: (function(isFirst) { var port, data = { name: "vimium++." + ((window.top === window) * 4 + document.hasFocus() * 2 + isFirst) }; port = this.port = isInjected ? chrome.runtime.connect(VimiumInjector.id, data) : chrome.runtime.connect(data); port.onDisconnect.addListener(this.ClearPort); port.onMessage.addListener(this.Listener); - } + }) }; location.href !== "about:blank" || isInjected ? vPort.connect(1) : (window.onload = function() { window.onload = null; setTimeout(function() { @@ -204,13 +204,13 @@ var VSettings, VHUD, VPort, VEventMode; HUD.enabled = true; ELs.OnWndFocus = vPort.safePost.bind(vPort, { handler: "frameFocused" }); }, - hook: function(f, c) { + hook: (function(f, c) { f("keydown", this.onKeydown, true); f("keyup", this.onKeyup, true); c || f("focus", this.onFocus, true); f("blur", this.onBlur, true); f.call(document, "DOMActivate", ELs.onActivate, true); - } + }) }; ELs.hook(addEventListener); diff --git a/weidu/js/jqm.min.js b/weidu/js/jqm.min.js index a458aeda9..fb3b43dfb 100644 --- a/weidu/js/jqm.min.js +++ b/weidu/js/jqm.min.js @@ -6,7 +6,7 @@ * Copyright (C) <2011> by * Released under the MIT X11 License; */ -var $=function(){ +var $=(function(){ function u(a){return a in s?s[a]:s[a]=RegExp("(^|\\s)"+a+"(\\s|$)")} function o(a){for(var c=0;c