Created
October 6, 2019 20:20
-
-
Save D1mon/b11be2224d02441435ffe1cd3fadd87e to your computer and use it in GitHub Desktop.
compiled version of the surfingkeys.js file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// modules are defined as an array | |
// [ module function, map of requires ] | |
// | |
// map of requires is short require name -> numeric require | |
// | |
// anything defined in a previous bundle is accessed via the | |
// orig method which is the require for previous bundles | |
parcelRequire = (function (modules, cache, entry, globalName) { | |
// Save the require from previous bundle to this closure if any | |
var previousRequire = typeof parcelRequire === 'function' && parcelRequire; | |
var nodeRequire = typeof require === 'function' && require; | |
function newRequire(name, jumped) { | |
if (!cache[name]) { | |
if (!modules[name]) { | |
// if we cannot find the module within our internal map or | |
// cache jump to the current global require ie. the last bundle | |
// that was added to the page. | |
var currentRequire = typeof parcelRequire === 'function' && parcelRequire; | |
if (!jumped && currentRequire) { | |
return currentRequire(name, true); | |
} | |
// If there are other bundles on this page the require from the | |
// previous one is saved to 'previousRequire'. Repeat this as | |
// many times as there are bundles until the module is found or | |
// we exhaust the require chain. | |
if (previousRequire) { | |
return previousRequire(name, true); | |
} | |
// Try the node require function if it exists. | |
if (nodeRequire && typeof name === 'string') { | |
return nodeRequire(name); | |
} | |
var err = new Error('Cannot find module \'' + name + '\''); | |
err.code = 'MODULE_NOT_FOUND'; | |
throw err; | |
} | |
localRequire.resolve = resolve; | |
localRequire.cache = {}; | |
var module = cache[name] = new newRequire.Module(name); | |
modules[name][0].call(module.exports, localRequire, module, module.exports, this); | |
} | |
return cache[name].exports; | |
function localRequire(x){ | |
return newRequire(localRequire.resolve(x)); | |
} | |
function resolve(x){ | |
return modules[name][1][x] || x; | |
} | |
} | |
function Module(moduleName) { | |
this.id = moduleName; | |
this.bundle = newRequire; | |
this.exports = {}; | |
} | |
newRequire.isParcelRequire = true; | |
newRequire.Module = Module; | |
newRequire.modules = modules; | |
newRequire.cache = cache; | |
newRequire.parent = previousRequire; | |
newRequire.register = function (id, exports) { | |
modules[id] = [function (require, module) { | |
module.exports = exports; | |
}, {}]; | |
}; | |
var error; | |
for (var i = 0; i < entry.length; i++) { | |
try { | |
newRequire(entry[i]); | |
} catch (e) { | |
// Save first error but execute all entries | |
if (!error) { | |
error = e; | |
} | |
} | |
} | |
if (entry.length) { | |
// Expose entry point to Node, AMD or browser globals | |
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js | |
var mainExports = newRequire(entry[entry.length - 1]); | |
// CommonJS | |
if (typeof exports === "object" && typeof module !== "undefined") { | |
module.exports = mainExports; | |
// RequireJS | |
} else if (typeof define === "function" && define.amd) { | |
define(function () { | |
return mainExports; | |
}); | |
// <script> | |
} else if (globalName) { | |
this[globalName] = mainExports; | |
} | |
} | |
// Override the current require with this new one | |
parcelRequire = newRequire; | |
if (error) { | |
// throw error from earlier, _after updating parcelRequire_ | |
throw error; | |
} | |
return newRequire; | |
})({"bCLS":[function(require,module,exports) { | |
// Surfingkeys help categories | |
module.exports.categories = { | |
help: 0, | |
mouseClick: 1, | |
scroll: 2, | |
tabs: 3, | |
pageNav: 4, | |
sessions: 5, | |
searchSelectedWith: 6, | |
clipboard: 7, | |
omnibar: 8, | |
visualMode: 9, | |
vimMarks: 10, | |
settings: 11, | |
chromeURLs: 12, | |
proxy: 13, | |
misc: 14, | |
insertMode: 15 | |
}; | |
},{}],"Y/Oq":[function(require,module,exports) { | |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | |
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } | |
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } | |
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } | |
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | |
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | |
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | |
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | |
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | |
var _require = require("./help"), | |
categories = _require.categories; | |
var util = {}; | |
util.getCurrentLocation = function () { | |
var prop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "href"; | |
if (typeof window === "undefined") { | |
return ""; | |
} | |
return window.location[prop]; | |
}; | |
util.escape = function (str) { | |
return String(str).replace(/[&<>"'`=/]/g, function (s) { | |
return { | |
"&": "&", | |
"<": "<", | |
">": ">", | |
"\"": """, | |
"'": "'", | |
"/": "/", | |
"`": "`", | |
"=": "=" | |
}[s]; | |
}); | |
}; | |
util.createSuggestionItem = function (html) { | |
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | |
var li = document.createElement("li"); | |
li.innerHTML = html; | |
return { | |
html: li.outerHTML, | |
props: props | |
}; | |
}; | |
util.createURLItem = function (title, url) { | |
var sanitize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | |
var t = title; | |
var u = url; | |
if (sanitize) { | |
t = util.escape(t); | |
u = new URL(u).toString(); | |
} | |
return util.createSuggestionItem("\n <div class=\"title\">".concat(t, "</div>\n <div class=\"url\">").concat(u, "</div>\n "), { | |
url: u | |
}); | |
}; // Determine if the given rect is visible in the viewport | |
util.isRectVisibleInViewport = function (rect) { | |
return rect.height > 0 && rect.width > 0 && rect.bottom >= 0 && rect.right >= 0 && rect.top <= (window.innerHeight || document.documentElement.clientHeight) && rect.left <= (window.innerWidth || document.documentElement.clientWidth); | |
}; // Determine if the given element is visible in the viewport | |
util.isElementInViewport = function (e) { | |
return e.offsetHeight > 0 && e.offsetWidth > 0 && !e.getAttribute("disabled") && util.isRectVisibleInViewport(e.getBoundingClientRect()); | |
}; // Process Unmaps | |
util.rmMaps = function (a) { | |
if (typeof unmap === "undefined") { | |
return; | |
} | |
a.forEach(function (u) { | |
return unmap(u); | |
}); | |
}; | |
util.rmSearchAliases = function (a) { | |
return Object.entries(a).forEach(function (_ref) { | |
var _ref2 = _slicedToArray(_ref, 2), | |
leader = _ref2[0], | |
items = _ref2[1]; | |
if (typeof removeSearchAliasX === "undefined") { | |
return; | |
} | |
items.forEach(function (v) { | |
return removeSearchAliasX(v, leader); | |
}); | |
}); | |
}; // Process Mappings | |
util.processMaps = function (maps, aliases, siteleader) { | |
if (typeof map === "undefined" || typeof mapkey === "undefined") { | |
return; | |
} | |
var hydratedAliases = Object.entries(aliases).flatMap(function (_ref3) { | |
var _ref4 = _slicedToArray(_ref3, 2), | |
baseDomain = _ref4[0], | |
aliasDomains = _ref4[1]; | |
return aliasDomains.flatMap(function (a) { | |
return _defineProperty({}, a, maps[baseDomain]); | |
}); | |
}); | |
var mapsAndAliases = Object.assign.apply(Object, [{}, maps].concat(_toConsumableArray(hydratedAliases))); | |
Object.entries(mapsAndAliases).forEach(function (_ref6) { | |
var _ref7 = _slicedToArray(_ref6, 2), | |
domain = _ref7[0], | |
domainMaps = _ref7[1]; | |
return domainMaps.forEach(function (mapObj) { | |
var alias = mapObj.alias, | |
callback = mapObj.callback, | |
_mapObj$leader = mapObj.leader, | |
leader = _mapObj$leader === void 0 ? domain === "global" ? "" : siteleader : _mapObj$leader, | |
_mapObj$category = mapObj.category, | |
category = _mapObj$category === void 0 ? categories.misc : _mapObj$category, | |
_mapObj$description = mapObj.description, | |
description = _mapObj$description === void 0 ? "" : _mapObj$description; | |
var opts = {}; | |
var key = "".concat(leader).concat(alias); // Determine if it's a site-specific mapping | |
if (domain !== "global") { | |
var d = domain.replace(".", "\\."); | |
opts.domain = new RegExp("^http(s)?://(([a-zA-Z0-9-_]+\\.)*)(".concat(d, ")(/.*)?")); | |
} | |
var fullDescription = "#".concat(category, " ").concat(description); | |
if (mapObj.map !== undefined) { | |
map(alias, mapObj.map); | |
} else { | |
mapkey(key, fullDescription, callback, opts); | |
} | |
}); | |
}); | |
}; // process completions | |
util.processCompletions = function (completions, searchleader) { | |
return Object.values(completions).forEach(function (s) { | |
if (typeof Front === "undefined" || typeof addSearchAliasX === "undefined" || typeof mapkey === "undefined") { | |
return; | |
} | |
addSearchAliasX(s.alias, s.name, s.search, searchleader, s.compl, s.callback); | |
mapkey("".concat(searchleader).concat(s.alias), "#8Search ".concat(s.name), function () { | |
return Front.openOmnibar({ | |
type: "SearchEngine", | |
extra: s.alias | |
}); | |
}); | |
mapkey("c".concat(searchleader).concat(s.alias), "#8Search ".concat(s.name, " with clipboard contents"), function () { | |
Clipboard.read(function (c) { | |
Front.openOmnibar({ | |
type: "SearchEngine", | |
pref: c.data, | |
extra: s.alias | |
}); | |
}); | |
}); | |
}); | |
}; | |
util.addSettings = function (s) { | |
if (typeof settings === "undefined") { | |
return; | |
} | |
Object.assign(settings, s); | |
}; | |
module.exports = util; | |
},{"./help":"bCLS"}],"0LRR":[function(require,module,exports) { | |
module.exports = ["400", "401", "402", "403", "404", "405", "406", "407", "408", "409", "410", "411", "412", "413", "414", "415", "416", "417", "418", "419", "420", "421", "422", "423", "424", "425", "426", "427", "428", "429", "430", "431", "500", "501", "502", "503", "504", "505", "506", "507", "508", "509", "510", "511", "about", "access", "account", "admin", "anonymous", "any", "api", "apps", "attributes", "auth", "billing", "blob", "blog", "bounty", "branches", "business", "businesses", "c", "cache", "case-studies", "categories", "central", "certification", "changelog", "cla", "cloud", "codereview", "collection", "collections", "comments", "commit", "commits", "community", "companies", "compare", "contact", "contributing", "cookbook", "coupons", "customer", "customers", "dashboard", "dashboards", "design", "develop", "developer", "diff", "discover", "discussions", "docs", "downloads", "downtime", "editor", "editors", "edu", "enterprise", "events", "explore", "featured", "features", "files", "fixtures", "forked", "garage", "ghost", "gist", "gists", "graphs", "guide", "guides", "help", "help-wanted", "home", "hooks", "hosting", "hovercards", "identity", "images", "inbox", "individual", "info", "integration", "interfaces", "introduction", "investors", "issues", "jobs", "join", "journal", "journals", "lab", "labs", "languages", "launch", "layouts", "learn", "legal", "library", "linux", "listings", "lists", "login", "logos", "logout", "mac", "maintenance", "malware", "man", "marketplace", "mention", "mentioned", "mentioning", "mentions", "migrating", "milestones", "mine", "mirrors", "mobile", "navigation", "network", "new", "news", "none", "nonprofit", "nonprofits", "notices", "notifications", "oauth", "offer", "open-source", "organisations", "organizations", "orgs", "pages", "partners", "payments", "personal", "plans", "plugins", "popular", "popularity", "posts", "press", "pricing", "professional", "projects", "pulls", "raw", "readme", "recommendations", "redeem", "releases", "render", "reply", "repositories", "resources", "restore", "revert", "save-net-neutrality", "saved", "scraping", "search", "security", "services", "sessions", "settings", "shareholders", "shop", "showcases", "signin", "signup", "site", "spam", "ssh", "staff", "starred", "stars", "static", "status", "statuses", "storage", "store", "stories", "styleguide", "subscriptions", "suggest", "suggestion", "suggestions", "support", "suspended", "talks", "teach", "teacher", "teachers", "teaching", "teams", "ten", "terms", "timeline", "topic", "topics", "tos", "tour", "train", "training", "translations", "tree", "trending", "updates", "username", "users", "visualization", "w", "watching", "wiki", "windows", "works-with", "www0", "www1", "www2", "www3", "www4", "www5", "www6", "www7", "www8", "www9"]; | |
},{}],"x85g":[function(require,module,exports) { | |
module.exports = { | |
"avatars": { | |
"reserved": true, | |
"taken": true, | |
"typical": true, | |
"included": false | |
}, | |
"assets": { | |
"reserved": true, | |
"taken": true, | |
"typical": true, | |
"included": false | |
}, | |
"bookmarks": { | |
"reserved": true, | |
"taken": true, | |
"typical": true, | |
"included": false | |
}, | |
"checks": { | |
"reserved": true, | |
"taken": true, | |
"typical": true, | |
"included": false | |
}, | |
"conversations": { | |
"reserved": true, | |
"taken": true, | |
"typical": true, | |
"included": false | |
}, | |
"labels": { | |
"reserved": true, | |
"taken": true, | |
"typical": true, | |
"included": false | |
}, | |
"media": { | |
"reserved": true, | |
"taken": true, | |
"typical": true, | |
"included": false | |
}, | |
"nodes": { | |
"reserved": true, | |
"taken": true, | |
"typical": true, | |
"included": false | |
}, | |
"owners": { | |
"reserved": true, | |
"taken": true, | |
"typical": true, | |
"included": false | |
}, | |
"page": { | |
"reserved": true, | |
"taken": true, | |
"typical": true, | |
"included": false | |
}, | |
"registry": { | |
"reserved": true, | |
"taken": true, | |
"typical": true, | |
"included": false | |
}, | |
"seats": { | |
"reserved": true, | |
"taken": true, | |
"typical": true, | |
"included": false | |
}, | |
"shared": { | |
"reserved": true, | |
"taken": true, | |
"typical": true, | |
"included": false | |
}, | |
"tasks": { | |
"reserved": true, | |
"taken": true, | |
"typical": true, | |
"included": false | |
}, | |
"uploads": { | |
"reserved": true, | |
"taken": true, | |
"typical": true, | |
"included": false | |
}, | |
"account": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://github.com/settings/profile", | |
"included": true | |
}, | |
"apps": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://github.com/marketplace", | |
"included": true | |
}, | |
"blog": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://blog.github.com", | |
"included": true | |
}, | |
"c": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://github.com/contact", | |
"included": true | |
}, | |
"contributing": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://github.com/about/careers", | |
"included": true | |
}, | |
"customer": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://github.com/business/customers", | |
"included": true | |
}, | |
"customers": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://github.com/business/customers", | |
"included": true | |
}, | |
"developer": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://developer.github.com", | |
"included": true | |
}, | |
"edu": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://education.github.com", | |
"included": true | |
}, | |
"guides": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://help.github.com", | |
"included": true | |
}, | |
"help": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://help.github.com", | |
"included": true | |
}, | |
"launch": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://github.com/search", | |
"included": true | |
}, | |
"mac": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://desktop.github.com", | |
"included": true | |
}, | |
"mirrors": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://help.github.com/articles/about-github-mirrors/", | |
"included": true | |
}, | |
"pages": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://pages.github.com", | |
"included": true | |
}, | |
"plans": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://github.com/pricing", | |
"included": true | |
}, | |
"press": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://github.com/about/press", | |
"included": true | |
}, | |
"readme": { | |
"reserved": true, | |
"taken": true, | |
"typical": false, | |
"redirect": "https://github.com/about", | |
"included": true | |
}, | |
"repositories": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://github.com/trending", | |
"included": true | |
}, | |
"resources": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://resources.github.com", | |
"included": true | |
}, | |
"security": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://help.github.com/articles/github-security/", | |
"included": true | |
}, | |
"settings": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://github.com/settings/profile", | |
"included": true | |
}, | |
"signup": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://github.com/join", | |
"included": true | |
}, | |
"terms": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://help.github.com/articles/github-terms-of-service/", | |
"included": true | |
}, | |
"topic": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://github.com/topics", | |
"included": true | |
}, | |
"tos": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://help.github.com/articles/github-terms-of-service/", | |
"included": true | |
}, | |
"training": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://services.github.com", | |
"included": true | |
}, | |
"users": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://github.com", | |
"included": true | |
}, | |
"wiki": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://github.com", | |
"included": true | |
}, | |
"windows": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"redirect": "https://desktop.github.com", | |
"included": true | |
}, | |
"collections": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"included": true, | |
"notes": "Curated lists of GitHub repos" | |
}, | |
"hovercards": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"included": true, | |
"notes": "HTTP ERROR 406" | |
}, | |
"inbox": { | |
"reserved": true, | |
"taken": true, | |
"typical": false, | |
"redirect": "https://github.com/410", | |
"included": true, | |
"notes": "410 ERROR" | |
}, | |
"suggestions": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"included": true | |
}, | |
"suspended": { | |
"reserved": true, | |
"taken": true, | |
"typical": false, | |
"redirect": "https://github.com", | |
"included": true, | |
"notes": "Page behaviour depends on whether you're logged in or if your account is actually suspended" | |
}, | |
"case-studies": { | |
"reserved": false, | |
"taken": true, | |
"typical": false, | |
"included": true | |
}, | |
"watching": { | |
"reserved": false, | |
"taken": true, | |
"typical": false, | |
"included": true | |
}, | |
"save-net-neutrality": { | |
"reserved": false, | |
"taken": true, | |
"typical": false, | |
"included": true | |
}, | |
"ghost": { | |
"reserved": false, | |
"taken": true, | |
"typical": true, | |
"included": true | |
}, | |
"status": { | |
"reserved": true, | |
"taken": false, | |
"typical": false, | |
"included": true | |
} | |
}; | |
},{}],"eMKz":[function(require,module,exports) { | |
"use strict"; | |
const reservedNames = require("./reserved-names.json"); | |
const oddballs = require("./oddballs.json"); | |
exports.all = reservedNames; | |
exports.check = name => { | |
name = (name || "").toString().toLowerCase(); | |
return reservedNames.includes(name); | |
}; | |
exports.oddballs = name => name && name in oddballs ? oddballs[name] : Object.keys(oddballs).sort(); | |
},{"./reserved-names.json":"0LRR","./oddballs.json":"x85g"}],"U8fQ":[function(require,module,exports) { | |
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | |
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | |
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest(); } | |
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | |
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | |
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } | |
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } | |
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } | |
var ghReservedNames = require("github-reserved-names"); | |
var util = require("./util"); | |
var actions = {}; // Globally applicable actions | |
// =========================== | |
// URL Manipulation/querying | |
// ------------------------- | |
actions.vimEditURL = function () { | |
return Front.showEditor(util.getCurrentLocation(), function (url) { | |
actions.openLink(url)(); | |
}, "url"); | |
}; | |
actions.getURLPath = function () { | |
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | |
_ref$count = _ref.count, | |
count = _ref$count === void 0 ? 0 : _ref$count, | |
_ref$domain = _ref.domain, | |
domain = _ref$domain === void 0 ? false : _ref$domain; | |
var path = util.getCurrentLocation("pathname").slice(1); | |
if (count) { | |
path = path.split("/").slice(0, count).join("/"); | |
} | |
if (domain) { | |
path = "".concat(util.getCurrentLocation("hostname"), "/").concat(path); | |
} | |
return path; | |
}; | |
actions.copyURLPath = function () { | |
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | |
count = _ref2.count, | |
domain = _ref2.domain; | |
return function () { | |
return Clipboard.write(actions.getURLPath({ | |
count: count, | |
domain: domain | |
})); | |
}; | |
}; | |
actions.duplicateTab = function () { | |
return actions.openLink(util.getCurrentLocation("href"), { | |
newTab: true, | |
active: false | |
})(); | |
}; // Site/Page Information | |
// --------------------- | |
var ddossierUrl = "http://centralops.net/co/DomainDossier.aspx"; | |
actions.showWhois = function () { | |
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | |
_ref3$hostname = _ref3.hostname, | |
hostname = _ref3$hostname === void 0 ? util.getCurrentLocation("hostname") : _ref3$hostname; | |
return function () { | |
return actions.openLink("".concat(ddossierUrl, "?dom_whois=true&addr=").concat(hostname), { | |
newTab: true | |
})(); | |
}; | |
}; | |
actions.showDns = function () { | |
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | |
_ref4$hostname = _ref4.hostname, | |
hostname = _ref4$hostname === void 0 ? util.getCurrentLocation("hostname") : _ref4$hostname, | |
_ref4$verbose = _ref4.verbose, | |
verbose = _ref4$verbose === void 0 ? false : _ref4$verbose; | |
return function () { | |
var u = ""; | |
if (verbose) { | |
u = "".concat(ddossierUrl, "?dom_whois=true&dom_dns=true&traceroute=true&net_whois=true&svc_scan=true&addr=").concat(hostname); | |
} else { | |
u = "".concat(ddossierUrl, "?dom_dns=true&addr=").concat(hostname); | |
} | |
actions.openLink(u, { | |
newTab: true | |
})(); | |
}; | |
}; | |
var googleCacheUrl = "https://webcache.googleusercontent.com/search?q=cache:"; | |
actions.showGoogleCache = function () { | |
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | |
_ref5$href = _ref5.href, | |
href = _ref5$href === void 0 ? util.getCurrentLocation("href") : _ref5$href; | |
return function () { | |
return actions.openLink("".concat(googleCacheUrl).concat(href), { | |
newTab: true | |
})(); | |
}; | |
}; | |
var waybackUrl = "https://web.archive.org/web/*/"; | |
actions.showWayback = function () { | |
var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | |
_ref6$href = _ref6.href, | |
href = _ref6$href === void 0 ? util.getCurrentLocation("href") : _ref6$href; | |
return function () { | |
return actions.openLink("".concat(waybackUrl).concat(href), { | |
newTab: true | |
})(); | |
}; | |
}; | |
var outlineUrl = "https://outline.com/"; | |
actions.showOutline = function () { | |
var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | |
_ref7$href = _ref7.href, | |
href = _ref7$href === void 0 ? util.getCurrentLocation("href") : _ref7$href; | |
return function () { | |
return actions.openLink("".concat(outlineUrl).concat(href), { | |
newTab: true | |
})(); | |
}; | |
}; // Surfingkeys-specific actions | |
// ---------------------------- | |
actions.createHint = function (selector, action) { | |
return function () { | |
if (typeof action === "undefined") { | |
// Use manual reassignment rather than default arg so that we can pre-compile without access | |
// to the Hints object | |
action = Hints.dispatchMouseClick; // eslint-disable-line no-param-reassign | |
} | |
Hints.create(selector, action); | |
}; | |
}; | |
actions.openAnchor = function () { | |
var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | |
_ref8$newTab = _ref8.newTab, | |
newTab = _ref8$newTab === void 0 ? false : _ref8$newTab, | |
_ref8$active = _ref8.active, | |
active = _ref8$active === void 0 ? true : _ref8$active, | |
_ref8$prop = _ref8.prop, | |
prop = _ref8$prop === void 0 ? "href" : _ref8$prop; | |
return function (a) { | |
return actions.openLink(a[prop], { | |
newTab: newTab, | |
active: active | |
})(); | |
}; | |
}; | |
actions.openLink = function (url) { | |
var _ref9 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | |
_ref9$newTab = _ref9.newTab, | |
newTab = _ref9$newTab === void 0 ? false : _ref9$newTab, | |
_ref9$active = _ref9.active, | |
active = _ref9$active === void 0 ? true : _ref9$active; | |
return function () { | |
if (newTab) { | |
RUNTIME("openLink", { | |
tab: { | |
tabbed: true, | |
active: active | |
}, | |
url: url | |
}); | |
return; | |
} | |
window.location.assign(url); | |
}; | |
}; | |
actions.editSettings = function () { | |
return tabOpenLink(chrome.extension.getURL("/pages/options.html")); | |
}; | |
actions.togglePdfViewer = function () { | |
return chrome.storage.local.get("noPdfViewer", function (resp) { | |
if (!resp.noPdfViewer) { | |
chrome.storage.local.set({ | |
noPdfViewer: 1 | |
}, function () { | |
Front.showBanner("PDF viewer disabled."); | |
}); | |
} else { | |
chrome.storage.local.remove("noPdfViewer", function () { | |
Front.showBanner("PDF viewer enabled."); | |
}); | |
} | |
}); | |
}; | |
actions.previewLink = actions.createHint("a[href]", function (a) { | |
return Front.showEditor(a.href, function (url) { | |
return actions.openLink(url)(); | |
}, "url"); | |
}); // FakeSpot | |
// -------- | |
actions.fakeSpot = function () { | |
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : util.getCurrentLocation("href"); | |
return actions.openLink("https://fakespot.com/analyze?ra=true&url=".concat(url), { | |
newTab: true, | |
active: false | |
})(); | |
}; // Site-specific actions | |
// ===================== | |
// Amazon | |
// ----- | |
actions.az = {}; | |
actions.az.viewProduct = function () { | |
var reHost = /^([-\w]+[.])*amazon.\w+$/; | |
var rePath = /^(?:.*\/)*(?:dp|gp\/product)(?:\/(\w{10})).*/; | |
var elements = {}; | |
document.querySelectorAll("a[href]").forEach(function (a) { | |
var u = new URL(a.href); | |
if (u.hash.length === 0 && reHost.test(u.hostname)) { | |
var rePathRes = rePath.exec(u.pathname); | |
if (rePathRes === null || rePathRes.length !== 2) { | |
return; | |
} | |
if (!util.isElementInViewport(a)) { | |
return; | |
} | |
var asin = rePathRes[1]; | |
if (elements[asin] !== undefined) { | |
if (!(elements[asin].text.trim().length === 0 && a.text.trim().length > 0)) { | |
return; | |
} | |
} | |
elements[asin] = a; | |
} | |
}); | |
Hints.create(Object.values(elements), Hints.dispatchMouseClick); | |
}; // Godoc | |
// ----- | |
actions.viewGodoc = function () { | |
return actions.openLink("https://godoc.org/".concat(actions.getURLPath({ | |
count: 2, | |
domain: true | |
})), { | |
newTab: true | |
})(); | |
}; // GitHub | |
// ------ | |
actions.gh = {}; | |
actions.gh.star = function () { | |
var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | |
_ref10$toggle = _ref10.toggle, | |
toggle = _ref10$toggle === void 0 ? false : _ref10$toggle; | |
return function () { | |
var repo = util.getCurrentLocation("pathname").slice(1).split("/").slice(0, 2).join("/"); | |
var container = document.querySelector("div.starring-container"); | |
var status = container.classList.contains("on"); | |
var star = "★"; | |
var statusMsg = "starred"; | |
var verb = "is"; | |
if (status && toggle || !status && !toggle) { | |
statusMsg = "un".concat(statusMsg); | |
star = "☆"; | |
} | |
if (toggle) { | |
verb = "has been"; | |
if (status) { | |
container.querySelector(".starred>button").click(); | |
} else { | |
container.querySelector(".unstarred>button").click(); | |
} | |
} | |
Front.showBanner("".concat(star, " Repository ").concat(repo, " ").concat(verb, " ").concat(statusMsg, "!")); | |
}; | |
}; | |
actions.gh.openRepo = function () { | |
var elements = _toConsumableArray(document.querySelectorAll("a[href]")).filter(function (a) { | |
var u = new URL(a.href); | |
var _u$pathname$split$fil = u.pathname.split("/").filter(function (s) { | |
return s !== ""; | |
}), | |
_u$pathname$split$fil2 = _toArray(_u$pathname$split$fil), | |
user = _u$pathname$split$fil2[0], | |
repo = _u$pathname$split$fil2[1], | |
rest = _u$pathname$split$fil2.slice(2); | |
return u.origin === util.getCurrentLocation("origin") && typeof user === "string" && user.length > 0 && typeof repo === "string" && repo.length > 0 && rest.length === 0 && /^([a-zA-Z0-9]+-?)+$/.test(user) && !ghReservedNames.check(user); | |
}); | |
Hints.create(elements, Hints.dispatchMouseClick); | |
}; | |
actions.gh.openUser = function () { | |
var elements = _toConsumableArray(document.querySelectorAll("a[href]")).filter(function (a) { | |
var u = new URL(a.href); | |
var _u$pathname$split$fil3 = u.pathname.split("/").filter(function (s) { | |
return s !== ""; | |
}), | |
_u$pathname$split$fil4 = _toArray(_u$pathname$split$fil3), | |
user = _u$pathname$split$fil4[0], | |
rest = _u$pathname$split$fil4.slice(1); | |
return u.origin === util.getCurrentLocation("origin") && typeof user === "string" && user.length > 0 && rest.length === 0 && /^([a-zA-Z0-9]+-?)+$/.test(user) && !ghReservedNames.check(user); | |
}); | |
Hints.create(elements, Hints.dispatchMouseClick); | |
}; | |
actions.gh.openFile = function () { | |
var elements = _toConsumableArray(document.querySelectorAll("a[href]")).filter(function (a) { | |
var u = new URL(a.href); | |
var _u$pathname$split$fil5 = u.pathname.split("/").filter(function (s) { | |
return s !== ""; | |
}), | |
_u$pathname$split$fil6 = _toArray(_u$pathname$split$fil5), | |
user = _u$pathname$split$fil6[0], | |
repo = _u$pathname$split$fil6[1], | |
maybeBlob = _u$pathname$split$fil6[2], | |
rest = _u$pathname$split$fil6.slice(3); | |
return u.origin === util.getCurrentLocation("origin") && typeof user === "string" && user.length > 0 && typeof repo === "string" && repo.length > 0 && typeof maybeBlob === "string" && (maybeBlob === "blob" || maybeBlob === "tree") && rest.length !== 0 && /^([a-zA-Z0-9]+-?)+$/.test(user) && !ghReservedNames.check(user); | |
}); | |
Hints.create(elements, Hints.dispatchMouseClick); | |
}; | |
actions.gh.openIssue = function () { | |
var elements = _toConsumableArray(document.querySelectorAll("a[href]")).filter(function (a) { | |
var u = new URL(a.href); | |
var _u$pathname$split$fil7 = u.pathname.split("/").filter(function (s) { | |
return s !== ""; | |
}), | |
_u$pathname$split$fil8 = _slicedToArray(_u$pathname$split$fil7, 3), | |
user = _u$pathname$split$fil8[0], | |
repo = _u$pathname$split$fil8[1], | |
maybeIssues = _u$pathname$split$fil8[2]; | |
return u.origin === util.getCurrentLocation("origin") && typeof user === "string" && user.length > 0 && typeof repo === "string" && repo.length > 0 && maybeIssues === "issues" && /^([a-zA-Z0-9]+-?)+$/.test(user) && !ghReservedNames.check(user); | |
}); | |
Hints.create(elements, Hints.dispatchMouseClick); | |
}; | |
actions.gh.openPull = function () { | |
var elements = _toConsumableArray(document.querySelectorAll("a[href]")).filter(function (a) { | |
var u = new URL(a.href); | |
var _u$pathname$split$fil9 = u.pathname.split("/").filter(function (s) { | |
return s !== ""; | |
}), | |
_u$pathname$split$fil10 = _slicedToArray(_u$pathname$split$fil9, 3), | |
user = _u$pathname$split$fil10[0], | |
repo = _u$pathname$split$fil10[1], | |
maybePulls = _u$pathname$split$fil10[2]; | |
return u.origin === util.getCurrentLocation("origin") && typeof user === "string" && user.length > 0 && typeof repo === "string" && repo.length > 0 && /^pulls?$/.test(maybePulls) && /^([a-zA-Z0-9]+-?)+$/.test(user) && !ghReservedNames.check(user); | |
}); | |
Hints.create(elements, Hints.dispatchMouseClick); | |
}; | |
actions.gh.toggleLangStats = function () { | |
return document.querySelector("summary[title='Click for language details']").click(); | |
}; | |
actions.gh.goParent = function () { | |
var segments = util.getCurrentLocation("pathname").split("/").filter(function (s) { | |
return s !== ""; | |
}); | |
var newPath = function () { | |
var _segments = _slicedToArray(segments, 3), | |
user = _segments[0], | |
repo = _segments[1], | |
maybeBlob = _segments[2]; | |
switch (segments.length) { | |
case 0: | |
return false; | |
case 4: | |
switch (maybeBlob) { | |
case "blob": | |
case "tree": | |
return [user, repo]; | |
case "pull": | |
return [user, repo, "pulls"]; | |
default: | |
break; | |
} | |
break; | |
case 5: | |
if (maybeBlob === "blob") { | |
return [user, repo]; | |
} | |
break; | |
default: | |
break; | |
} | |
return segments.slice(0, segments.length - 1); | |
}(); | |
if (newPath !== false) { | |
var u = "".concat(util.getCurrentLocation("origin"), "/").concat(newPath.join("/")); | |
actions.openLink(u)(); | |
} | |
}; // GitLab | |
// ------ | |
actions.gl = {}; | |
actions.gl.star = function () { | |
var repo = util.getCurrentLocation("pathname").slice(1).split("/").slice(0, 2).join("/"); | |
var btn = document.querySelector(".btn.star-btn > span"); | |
btn.click(); | |
var action = "".concat(btn.textContent.toLowerCase(), "red"); | |
var star = "☆"; | |
if (action === "starred") { | |
star = "★"; | |
} | |
Front.showBanner("".concat(star, " Repository ").concat(repo, " ").concat(action)); | |
// ------ | |
actions.re = {}; | |
actions.re.collapseNextComment = function () { | |
var vis = Array.from(document.querySelectorAll(".noncollapsed.comment")).filter(function (e) { | |
return util.isElementInViewport(e); | |
}); | |
if (vis.length > 0) { | |
vis[0].querySelector(".expand").click(); | |
} | |
}; // Unfortunately, this does not work - Reddit will only load the first | |
// Expando | |
actions.re.toggleVisibleExpandos = function () { | |
var dir = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; | |
return function () { | |
var sel = ".expando-button"; | |
if (dir === -1) { | |
sel += ".expanded"; | |
} else if (dir === 1) { | |
sel += ".collapsed"; | |
} | |
Array.from(document.querySelectorAll(sel)).filter(function (e) { | |
return util.isElementInViewport(e); | |
}).forEach(function (e) { | |
return e.click(); | |
}); | |
}; | |
}; // HackerNews | |
// ---------- | |
actions.hn = {}; | |
actions.hn.goParent = function () { | |
var par = document.querySelector(".par>a"); | |
if (!par) { | |
return; | |
} | |
actions.openLink(par.href)(); | |
}; | |
actions.hn.collapseNextComment = function () { | |
var vis = Array.from(document.querySelectorAll("a.togg")).filter(function (e) { | |
return e.innerText === "[-]" && util.isElementInViewport(e); | |
}); | |
if (vis.length > 0) { | |
vis[0].click(); | |
} | |
}; | |
actions.hn.goPage = function () { | |
var dist = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; | |
var u; | |
try { | |
u = new URL(util.getCurrentLocation()); | |
} catch (e) { | |
return; | |
} | |
var page = u.searchParams.get("p"); | |
if (page === null || page === "") { | |
page = "1"; | |
} | |
var cur = parseInt(page, 10); | |
if (Number.isNaN(cur)) { | |
return; | |
} | |
var dest = cur + dist; | |
if (dest < 1) { | |
return; | |
} | |
u.searchParams.set("p", dest); | |
actions.openLink(u.href)(); | |
}; | |
actions.hn.openLinkAndComments = function (e) { | |
var linkUrl = e.querySelector("a.storylink").href; | |
var commentsUrl = e.nextElementSibling.querySelector("td > a[href*='item']:not(.storylink)").href; | |
actions.openLink(commentsUrl, { | |
newTab: true | |
})(); | |
actions.openLink(linkUrl, { | |
newTab: true | |
})(); | |
}; // ProductHunt | |
// ----------- | |
actions.ph = {}; | |
actions.ph.openExternal = function () { | |
Hints.create("ul[class^='postsList_'] > li > div[class^='item_']", function (p) { | |
return actions.openLink(p.querySelector("div[class^='meta_'] > div[class^='actions_'] > div[class^='minorActions_'] > a:nth-child(1)").href, { | |
newTab: true | |
})(); | |
}); | |
}; // Dribbble | |
// -------- | |
actions.dr = {}; | |
actions.dr.attachment = function () { | |
var cb = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (a) { | |
return actions.openLink(a, { | |
newTab: true | |
})(); | |
}; | |
return actions.createHint(".attachments .thumb", function (a) { | |
return cb(a.src.replace("/thumbnail/", "/")); | |
}); | |
}; // Wikipedia | |
// --------- | |
actions.wp = {}; | |
actions.wp.toggleSimple = function () { | |
var u = new URL(util.getCurrentLocation("href")); | |
u.hostname = u.hostname.split(".").map(function (s, i) { | |
if (i === 0) { | |
return s === "simple" ? "" : "simple"; | |
} | |
return s; | |
}).filter(function (s) { | |
return s !== ""; | |
}).join("."); | |
actions.openLink(u.href)(); | |
}; | |
module.exports = actions; | |
},{"github-reserved-names":"eMKz","./util":"Y/Oq"}],"BSXI":[function(require,module,exports) { | |
var actions = require("./actions"); | |
var _require = require("./help"), | |
categories = _require.categories; // Remove undesired default mappings | |
var unmaps = { | |
mappings: ["sb", "sw", "ob", "ow", "cp", ";cp", ";ap", "spa", "spb", "spd", "sps", "spc", "spi", "sfr", "zQ", "zz", "zR", "ab", "Q", "q", "ag", "af", ";s", "yp", "<Ctrl-j>", "<Ctrl-h>"], | |
searchAliases: { | |
s: ["g", "d", "b", "w", "s", "h"] | |
} | |
}; | |
var maps = { | |
global: [{ | |
alias: "F", | |
map: "gf", | |
category: categories.mouseClick, | |
description: "Open a link in non-active new tab" | |
}, { | |
alias: "zf", | |
category: categories.mouseClick, | |
description: "Open link URL in vim editor", | |
callback: actions.previewLink | |
}, { | |
alias: "w", | |
map: "k", | |
category: categories.scroll, | |
description: "Scroll up" | |
}, { | |
alias: "s", | |
map: "j", | |
category: categories.scroll, | |
description: "Scroll down" | |
}, { | |
alias: "gi", | |
category: categories.pageNav, | |
description: "Edit current URL with vim editor", | |
callback: actions.vimEditURL | |
}, { | |
alias: "gi", | |
category: categories.pageNav, | |
description: "Edit current URL with vim editor", | |
callback: actions.vimEditURL | |
}, { | |
alias: "gI", | |
category: categories.pageNav, | |
description: "View image in new tab", | |
callback: actions.createHint("img", function (i) { | |
return actions.openLink(i.src)(); | |
}) | |
}, { | |
alias: "yp", | |
category: categories.clipboard, | |
description: "Copy URL path of current page", | |
callback: actions.copyURLPath() | |
}, { | |
alias: "yI", | |
category: categories.clipboard, | |
description: "Copy Image URL", | |
callback: actions.createHint("img", function (i) { | |
return Clipboard.write(i.src); | |
}) | |
}, { | |
alias: "yT", | |
category: categories.tabs, | |
description: "Duplicate current tab (non-active new tab)", | |
callback: actions.duplicateTab | |
}, { | |
alias: ";se", | |
category: categories.settings, | |
description: "Edit Settings", | |
callback: actions.editSettings | |
}, { | |
alias: "gS", | |
category: categories.chromeURLs, | |
description: "Open Chrome settings" | |
}, { | |
alias: "=w", | |
category: categories.misc, | |
description: "Lookup whois information for domain", | |
callback: actions.showWhois() | |
}, { | |
alias: "=d", | |
category: categories.misc, | |
description: "Lookup dns information for domain", | |
callback: actions.showDns() | |
}, { | |
alias: "=D", | |
category: categories.misc, | |
description: "Lookup all information for domain", | |
callback: actions.showDns({ | |
verbose: true | |
}) | |
}, { | |
alias: "=c", | |
category: categories.misc, | |
description: "Show Google's cached version of page", | |
callback: actions.showGoogleCache() | |
}, { | |
alias: "=a", | |
category: categories.misc, | |
description: "Show Archive.org Wayback Machine for page", | |
callback: actions.showWayback() | |
}, { | |
alias: "=o", | |
category: categories.misc, | |
description: "Show outline.com version of page", | |
callback: actions.showOutline() | |
}, { | |
alias: ";pd", | |
category: categories.misc, | |
description: "Toggle PDF viewer from SurfingKeys", | |
callback: actions.togglePdfViewer | |
}, { | |
alias: "gxE", | |
map: "gxt", | |
category: categories.tabs, | |
description: "Close tab to left" | |
}, { | |
alias: "gxR", | |
map: "gxT", | |
category: categories.tabs, | |
description: "Close tab to right" | |
}], | |
"amazon.com": [{ | |
alias: "fs", | |
description: "Fakespot", | |
callback: actions.fakeSpot | |
}, { | |
alias: "a", | |
description: "View product", | |
callback: actions.az.viewProduct | |
}], | |
"www.google.com": [{ | |
alias: "a", | |
description: "Open search result", | |
callback: actions.createHint("a.fl, .r>a") | |
}, { | |
alias: "A", | |
description: "Open search result (non-active new tab)", | |
callback: actions.createHint("a.fl, .r>a", actions.openAnchor({ | |
newTab: true, | |
active: false | |
})) | |
}], | |
"algolia.com": [{ | |
alias: "a", | |
description: "Open search result", | |
callback: actions.createHint(".item-main h2>a:first-child") | |
}], | |
"duckduckgo.com": [{ | |
alias: "a", | |
description: "Open search result", | |
callback: actions.createHint(".result__a") | |
}, { | |
alias: "A", | |
description: "Open search result (non-active new tab)", | |
callback: actions.createHint(".result__a", actions.openAnchor({ | |
newTab: true, | |
active: false | |
})) | |
}, { | |
leader: "", | |
alias: "]]", | |
description: "Show more results", | |
callback: function callback() { | |
return document.querySelector(".result--more__btn").click(); | |
} | |
}], | |
"yelp.com": [{ | |
alias: "fs", | |
description: "Fakespot", | |
callback: actions.fakeSpot | |
}], | |
"youtube.com": [{ | |
leader: "", | |
alias: "A", | |
description: "Open video", | |
callback: actions.createHint("*[id='video-title']", actions.openAnchor({ | |
newTab: true | |
})) | |
}, { | |
leader: "", | |
alias: "C", | |
description: "Open channel", | |
callback: actions.createHint("*[id='byline']") | |
}, { | |
leader: "", | |
alias: "gH", | |
description: "Goto homepage", | |
callback: actions.openLink("https://www.youtube.com/feed/subscriptions?flow=2") | |
}, { | |
leader: "", | |
alias: "F", | |
description: "Toggle fullscreen", | |
callback: function callback() { | |
return document.querySelector(".ytp-fullscreen-button.ytp-button").click(); | |
} | |
}, { | |
leader: "", | |
alias: "<Space>", | |
description: "Play/pause", | |
callback: actions.createHint(".ytp-play-button") | |
}], | |
"vimeo.com": [{ | |
alias: "F", | |
description: "Toggle fullscreen", | |
callback: function callback() { | |
return document.querySelector(".fullscreen-icon").click(); | |
} | |
}], | |
"github.com": [{ | |
alias: "a", | |
description: "View Repository", | |
callback: actions.gh.openRepo | |
}, { | |
alias: "u", | |
description: "View User", | |
callback: actions.gh.openUser | |
}, { | |
alias: "f", | |
description: "View File", | |
callback: actions.gh.openFile | |
}, { | |
alias: "i", | |
description: "View Issue", | |
callback: actions.gh.openIssue | |
}, { | |
alias: "p", | |
description: "View Pull Request", | |
callback: actions.gh.openPull | |
}, { | |
// TODO: Add repetition support: 3gu | |
leader: "", | |
alias: "gu", | |
description: "Go up one path in the URL (GitHub)", | |
callback: actions.gh.goParent | |
}, { | |
alias: "s", | |
description: "Toggle Star", | |
callback: actions.gh.star({ | |
toggle: true | |
}) | |
}, { | |
alias: "S", | |
description: "Check Star", | |
callback: actions.gh.star({ | |
toggle: false | |
}) | |
}, { | |
alias: "y", | |
description: "Copy Project Path", | |
callback: actions.copyURLPath({ | |
count: 2 | |
}) | |
}, { | |
alias: "Y", | |
description: "Copy Project Path (including domain)", | |
callback: actions.copyURLPath({ | |
count: 2, | |
domain: true | |
}) | |
}, { | |
alias: "l", | |
description: "Toggle repo language stats", | |
callback: actions.gh.toggleLangStats | |
}, { | |
alias: "D", | |
description: "View GoDoc for Project", | |
callback: actions.viewGodoc | |
}], | |
"gitlab.com": [{ | |
alias: "s", | |
description: "Toggle Star", | |
callback: actions.gl.star | |
}, { | |
alias: "y", | |
description: "Copy Project Path", | |
callback: actions.copyURLPath({ | |
count: 2 | |
}) | |
}, { | |
alias: "Y", | |
description: "Copy Project Path (including domain)", | |
callback: actions.copyURLPath({ | |
count: 2, | |
domain: true | |
}) | |
}, { | |
alias: "D", | |
description: "View GoDoc for Project", | |
callback: actions.viewGodoc | |
}], | |
"twitter.com": [{ | |
alias: "f", | |
description: "Follow user", | |
callback: actions.createHint(".follow-button") | |
}, { | |
alias: "s", | |
description: "Like tweet", | |
callback: actions.createHint(".js-actionFavorite") | |
}, { | |
alias: "R", | |
description: "Retweet", | |
callback: actions.createHint(".js-actionRetweet") | |
}, { | |
alias: "c", | |
description: "Comment/Reply", | |
callback: actions.createHint(".js-actionReply") | |
}, { | |
alias: "t", | |
description: "New tweet", | |
callback: actions.createHint(".js-global-new-tweet") | |
}, { | |
alias: "T", | |
description: "Tweet to", | |
callback: actions.createHint(".NewTweetButton") | |
}, { | |
alias: "r", | |
description: "Load new tweets", | |
callback: actions.createHint(".new-tweets-bar") | |
}, { | |
alias: "g", | |
description: "Goto user", | |
callback: actions.createHint(".js-user-profile-link") | |
}], | |
"reddit.com": [{ | |
alias: "x", | |
description: "Collapse comment", | |
callback: actions.createHint(".expand") | |
}, { | |
alias: "X", | |
description: "Collapse next comment", | |
callback: actions.re.collapseNextComment | |
}, { | |
alias: "s", | |
description: "Upvote", | |
callback: actions.createHint(".arrow.up") | |
}, { | |
alias: "S", | |
description: "Downvote", | |
callback: actions.createHint(".arrow.down") | |
}, { | |
alias: "e", | |
description: "Expand expando", | |
callback: actions.createHint(".expando-button") | |
}, { | |
alias: "a", | |
description: "View post (link)", | |
callback: actions.createHint(".title") | |
}, { | |
alias: "A", | |
description: "View post (link) (non-active new tab)", | |
callback: actions.createHint(".title", actions.openAnchor({ | |
newTab: true, | |
active: false | |
})) | |
}, { | |
alias: "c", | |
description: "View post (comments)", | |
callback: actions.createHint(".comments") | |
}, { | |
alias: "C", | |
description: "View post (comments) (non-active new tab)", | |
callback: actions.createHint(".comments", actions.openAnchor({ | |
newTab: true, | |
active: false | |
})) | |
}], | |
"news.ycombinator.com": [{ | |
alias: "x", | |
description: "Collapse comment", | |
callback: actions.createHint(".togg") | |
}, { | |
alias: "X", | |
description: "Collapse next comment", | |
callback: actions.hn.collapseNextComment | |
}, { | |
alias: "s", | |
description: "Upvote", | |
callback: actions.createHint(".votearrow[title='upvote']") | |
}, { | |
alias: "S", | |
description: "Downvote", | |
callback: actions.createHint(".votearrow[title='downvote']") | |
}, { | |
alias: "a", | |
description: "View post (link)", | |
callback: actions.createHint(".storylink") | |
}, { | |
alias: "A", | |
description: "View post (link and comments)", | |
callback: actions.createHint(".athing", actions.hn.openLinkAndComments) | |
}, { | |
alias: "c", | |
description: "View post (comments)", | |
callback: actions.createHint("td > a[href*='item']:not(.storylink)") | |
}, { | |
alias: "C", | |
description: "View post (comments) (non-active new tab)", | |
callback: actions.createHint("td > a[href*='item']:not(.storylink)", actions.openAnchor({ | |
newTab: true, | |
active: false | |
})) | |
}, { | |
leader: "", | |
alias: "gp", | |
description: "Go to parent", | |
callback: actions.hn.goParent | |
}, { | |
leader: "", | |
alias: "]]", | |
description: "Next page", | |
callback: function callback() { | |
return actions.hn.goPage(1); | |
} | |
}, { | |
leader: "", | |
alias: "[[", | |
description: "Prev page", | |
callback: function callback() { | |
return actions.hn.goPage(-1); | |
} | |
}], | |
"producthunt.com": [{ | |
alias: "a", | |
description: "View product (external)", | |
callback: actions.ph.openExternal | |
}, { | |
alias: "v", | |
description: "View product", | |
callback: actions.createHint("ul[class^='postsList_'] > li > div[class^='item_'] > a") | |
}, { | |
alias: "s", | |
description: "Upvote product", | |
callback: actions.createHint("button[data-test='vote-button']") | |
}], | |
"dribbble.com": [{ | |
alias: "s", | |
description: "Heart Shot", | |
callback: actions.createHint(".toggle-fav, .like-shot") | |
}, { | |
alias: "a", | |
description: "View shot", | |
callback: actions.createHint(".dribbble-over, .gif-target, .more-thumbs a") | |
}, { | |
alias: "A", | |
description: "View shot (non-active new tab)", | |
callback: actions.createHint(".dribbble-over, .gif-target, .more-thumbs a", actions.openAnchor({ | |
newTab: true, | |
active: false | |
})) | |
}, { | |
alias: "v", | |
description: "View attachment image", | |
callback: actions.dr.attachment() | |
}, { | |
alias: "V", | |
description: "Yank attachment image source URL", | |
callback: actions.dr.attachment(function (a) { | |
return Clipboard.write(a); | |
}) | |
}, { | |
alias: "z", | |
description: "Zoom shot", | |
callback: actions.createHint(".single-img picture, .detail-shot img") | |
}], | |
"behance.net": [{ | |
alias: "s", | |
description: "Appreciate project", | |
callback: actions.createHint(".appreciation-button") | |
}, { | |
alias: "b", | |
description: "Add project to collection", | |
callback: function callback() { | |
return document.querySelector(".qa-action-collection").click(); | |
} | |
}, { | |
alias: "a", | |
description: "View project", | |
callback: actions.createHint(".rf-project-cover__title") | |
}, { | |
alias: "A", | |
description: "View project (non-active new tab)", | |
callback: actions.createHint(".rf-project-cover__title", actions.openAnchor({ | |
newTab: true, | |
active: false | |
})) | |
}], | |
"fonts.adobe.com": [{ | |
alias: "a", | |
description: "Activate font", | |
callback: actions.createHint(".spectrum-ToggleSwitch-input") | |
}, { | |
alias: "s", | |
description: "Favorite font", | |
callback: actions.createHint(".favorite-toggle-icon") | |
}], | |
"wikipedia.org": [{ | |
alias: "s", | |
description: "Toggle simple version of current article", | |
callback: actions.wp.toggleSimple | |
}, { | |
alias: "a", | |
description: "View page", | |
callback: actions.createHint("#bodyContent :not(sup):not(.mw-editsection) > a") | |
}], | |
"craigslist.org": [{ | |
alias: "a", | |
description: "View listing", | |
callback: actions.createHint("a.result-title") | |
}], | |
"stackoverflow.com": [{ | |
alias: "a", | |
description: "View question", | |
callback: actions.createHint("a.question-hyperlink") | |
}] // Aliases | |
}; | |
var aliases = { | |
"wikipedia.org": [// Wikimedia sites | |
"wiktionary.org", "wikiquote.org", "wikisource.org", "wikimedia.org", "mediawiki.org", "wikivoyage.org", "wikibooks.org", "wikinews.org", "wikiversity.org", "wikidata.org", // MediaWiki-powered sites | |
"wiki.archlinux.org"], | |
"stackoverflow.com": ["stackexchange.com", "serverfault.com", "superuser.com", "askubuntu.com", "stackapps.com", "mathoverflow.net"] | |
}; | |
module.exports = { | |
unmaps: unmaps, | |
maps: maps, | |
aliases: aliases | |
}; | |
},{"./actions":"U8fQ","./help":"bCLS"}],"pawg":[function(require,module,exports) { | |
/* eslint-disable no-unused-vars, camelcase */ | |
// This is a reference for how conf.priv.js should look. | |
// | |
// Copy this file to a new file named "conf.priv.js" and update | |
// the API keys as needed. | |
// | |
// WARNING: Don't `git commit` your actual "conf.priv.js" file if you | |
// add real API keys to it! Malicious parties frequently scan GitHub for | |
// these keys and use them for bad stuff. The "conf.priv.js" file is already | |
// ignored by .gitignore, but just be safe. | |
// These are private API keys which are required for certain search completions. | |
// You can obtain them all for free at the supplied links. | |
var keys = { | |
crunchbase: "", | |
// https://about.crunchbase.com/crunchbase-basic-access/ | |
google_cs: "", | |
// https://developers.google.com/custom-search/json-api/v1/overview?hl=en_US | |
google_yt: "", | |
// https://developers.google.com/youtube/v3/docs/ | |
wolframalpha: "", | |
// https://products.wolframalpha.com/api/ | |
domainr: "", | |
// https://market.mashape.com/domainr/domainr | |
alternativeTo: "", | |
// Extract the x-algolia-api-key sent with requests when typing in search box on alternativeto.net | |
// ****** Google Custom Search Engines ****** // | |
// Can be created at https://cse.google.com/cse | |
// Simply create a separate Custom Search Engine for each of the following entries, | |
// pasting the provided URL string(s) in the "Sites to Search" field. | |
// Then, after creation, go to the control panel for the new Search Engine and copy the | |
// Search Engine ID (cx) into the appropriate configuration variable below: | |
google_cx_ex: "", | |
// hexdocs.pm/*/master/*.html | |
google_cx_af: "", | |
// bbs.archlinux.org/* | |
google_cx_al: "", | |
// www.archlinux.org/packages/*/x86_64/* | |
google_cx_no: "", | |
// nodejs.org/api/* | |
google_cx_cs: "", | |
// chrome.google.com/webstore/* | |
google_cx_jq: "", | |
// api.jquery.com/* | |
google_cx_gg: "" // godoc.org/*, golang.org/pkg/* | |
}; | |
module.exports = { | |
keys: keys | |
}; | |
},{}],"HkY7":[function(require,module,exports) { | |
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | |
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | |
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | |
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | |
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | |
var _require = require("./conf.priv.js"), | |
keys = _require.keys; | |
var _require2 = require("./util"), | |
escape = _require2.escape, | |
createSuggestionItem = _require2.createSuggestionItem, | |
createURLItem = _require2.createURLItem; | |
var wpDefaultIcon = "data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2056%2056%22%20enable-background%3D%22new%200%200%2056%2056%22%3E%0A%20%20%20%20%3Cpath%20fill%3D%22%23eee%22%20d%3D%22M0%200h56v56h-56z%22%2F%3E%0A%20%20%20%20%3Cpath%20fill%3D%22%23999%22%20d%3D%22M36.4%2013.5h-18.6v24.9c0%201.4.9%202.3%202.3%202.3h18.7v-25c.1-1.4-1-2.2-2.4-2.2zm-6.2%203.5h5.1v6.4h-5.1v-6.4zm-8.8%200h6v1.8h-6v-1.8zm0%204.6h6v1.8h-6v-1.8zm0%2015.5v-1.8h13.8v1.8h-13.8zm13.8-4.5h-13.8v-1.8h13.8v1.8zm0-4.7h-13.8v-1.8h13.8v1.8z%22%2F%3E%0A%3C%2Fsvg%3E%0A"; | |
var cbDefaultIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAAAAAByaaZbAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAACYktHRAD/h4/MvwAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAAd0SU1FB+EICxEMErRVWUQAAABOdEVYdFJhdyBwcm9maWxlIHR5cGUgZXhpZgAKZXhpZgogICAgICAyMAo0NTc4Njk2NjAwMDA0OTQ5MmEwMDA4MDAwMDAwMDAwMDAwMDAwMDAwCnwMkD0AAAGXSURBVEjH1ZRvc4IwDMb7/T8dbVr/sEPlPJQd3g22GzJdmxVOHaQa8N2WN7wwvyZ5Eh/hngzxTwDr0If/TAK67POxbqxnpgCIx9dkrkEvswYnAFiutFSgtQapS4ejwFYqbXQXBmC+QxawuI/MJb0LiCq0DICNHoZRKQdYLKQZEhATcQmwDYD5GR8DDtfqaYAMActvTiVMaUvqhZPVYhYAK2SBAwGMTHngnc4wVmFPW9L6k1PJxbSCkfvhqolKSQhsWSClizNyxwAWdzIADixQRXRmdWSHthsg+TknaztFMZgC3vh/nG/qo68TLAKrCSrUg1ulp3cH+BpItBp3DZf0lFXVOIDnBdwKkLO4D5Q3QMO6HJ+hUb1NKNWMGJn3jf4ejPKn99CXOtsuyab95obGL/rpdZ7oIJK87iPiumG01drbdggoCZuq/f0XaB8/FbG62Ta5cD97XJwuZUT7ONbZTIK5m94hBuQs8535MsL5xxPw6ZoNj0DiyzhhcyMf9BJ0Jk1uRRpNyb4y0UaM9UI7E8+kt/EHgR/R6042JzmiwgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wOC0xMVQxNzoxMjoxOC0wNDowMLy29LgAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDgtMTFUMTc6MTI6MTgtMDQ6MDDN60wEAAAAAElFTkSuQmCC"; | |
var completions = {}; // Helper functions for Google Custom Search Engine completions | |
var googleCxURL = function googleCxURL(alias) { | |
var key = "google_cx_".concat(alias); | |
return "https://www.googleapis.com/customsearch/v1?key=".concat(keys.google_cs, "&cx=").concat(keys[key], "&q="); | |
}; | |
var googleCxPublicURL = function googleCxPublicURL(alias) { | |
var key = "google_cx_".concat(alias); | |
return "https://cse.google.com/cse/publicurl?cx=".concat(keys[key], "&q="); | |
}; | |
var googleCxCallback = function googleCxCallback(response) { | |
var res = JSON.parse(response.text).items; | |
return res.map(function (s) { | |
return createSuggestionItem("\n <div>\n <div class=\"title\"><strong>".concat(s.htmlTitle, "</strong></div>\n <div>").concat(s.htmlSnippet, "</div>\n </div>\n "), { | |
url: s.link | |
}); | |
}); | |
}; // ****** Arch Linux ****** // | |
// Arch Linux official repos | |
completions.al = { | |
alias: "al", | |
name: "archlinux", | |
search: "https://www.archlinux.org/packages/?arch=x86_64&q=", | |
compl: googleCxURL("al"), | |
callback: googleCxCallback // Arch Linux AUR | |
}; | |
completions.au = { | |
alias: "au", | |
name: "AUR", | |
favicon: "https://aur.archlinux.org/images/favicon.ico", | |
search: "https://aur.archlinux.org/packages/?O=0&SeB=nd&outdated=&SB=v&SO=d&PP=100&do_Search=Go&K=", | |
compl: "https://aur.archlinux.org/rpc?type=suggest&arg=" | |
}; | |
completions.au.callback = function (response) { | |
var res = JSON.parse(response.text); | |
return res.map(function (s) { | |
return createURLItem(s, "https://aur.archlinux.org/packages/".concat(s)); | |
}); | |
}; // Arch Linux Wiki | |
completions.aw = { | |
alias: "aw", | |
name: "archwiki", | |
search: "https://wiki.archlinux.org/index.php?go=go&search=", | |
compl: "https://wiki.archlinux.org/api.php?action=opensearch&format=json&formatversion=2&namespace=0&limit=10&suggest=true&search=" | |
}; | |
completions.aw.callback = function (response) { | |
return JSON.parse(response.text)[1]; | |
}; // Arch Linux Forums | |
completions.af = { | |
alias: "af", | |
name: "archforums", | |
domain: "bbs.archlinux.org", | |
search: googleCxPublicURL("af"), | |
compl: googleCxURL("af"), | |
callback: googleCxCallback // ****** Technical Resources ****** // | |
// AlternativeTo | |
}; | |
completions.at = { | |
alias: "at", | |
name: "alternativeTo", | |
search: "https://alternativeto.net/browse/search/?q=", | |
compl: "https://zidpns2vb0-dsn.algolia.net/1/indexes/fullitems?x-algolia-application-id=ZIDPNS2VB0&x-algolia-api-key=".concat(keys.alternativeTo, "&attributesToRetrieve=Name,UrlName,TagLine,Description,Likes,HasIcon,IconId,IconExtension,InternalUrl&query=") | |
}; | |
completions.at.callback = function (response) { | |
var res = JSON.parse(response.text); | |
return res.hits.map(function (s) { | |
var name = escape(s.Name); | |
var title = name; | |
var prefix = ""; | |
if (s._highlightResult) { | |
// eslint-disable-line no-underscore-dangle | |
if (s._highlightResult.Name) { | |
// eslint-disable-line no-underscore-dangle | |
title = s._highlightResult.Name.value; // eslint-disable-line no-underscore-dangle | |
} | |
} | |
if (s.Likes) { | |
prefix += "[\u2191".concat(s.Likes, "] "); | |
} | |
var tagline = ""; | |
if (s.TagLine) { | |
tagline = escape(s.TagLine); | |
} | |
var desc = s.Description ? "<div class=\"title\">".concat(escape(s.Description), "</div>") : ""; | |
var icUrl = wpDefaultIcon; | |
if (s.HasIcon) { | |
var icBase = "https://d2.alternativeto.net/dist/icons/"; | |
var icQuery = "?width=100&height=100&mode=crop&upscale=false"; | |
var icName = s.UrlName; | |
icUrl = encodeURI("".concat(icBase).concat(icName, "_").concat(s.IconId).concat(s.IconExtension).concat(icQuery)); | |
} | |
return createSuggestionItem("\n <div style=\"padding:5px;display:grid;grid-template-columns:60px 1fr;grid-gap:15px\">\n <img style=\"width:60px\" src=\"".concat(icUrl, "\" alt=\"").concat(escape(s.Name), "\">\n <div>\n <div class=\"title\"><strong>").concat(prefix).concat(title, "</strong> ").concat(tagline, "</div>\n ").concat(desc, "\n </div>\n </div>\n "), { | |
url: "https://".concat(s.InternalUrl) | |
}); | |
}); | |
}; // Chrome Webstore | |
completions.cs = { | |
alias: "cs", | |
name: "chromestore", | |
favicon: "https://www.google.com/images/icons/product/chrome_web_store-32.png", | |
search: "https://chrome.google.com/webstore/search/", | |
compl: googleCxURL("cs"), | |
callback: googleCxCallback | |
}; | |
var parseFirefoxAddonsRes = function parseFirefoxAddonsRes(response) { | |
return JSON.parse(response.text).results.map(function (s) { | |
var name = s.name; | |
if (_typeof(name) === "object") { | |
if (name[navigator.language] !== undefined) { | |
name = name[navigator.language]; | |
} else { | |
var _Object$values = Object.values(name); | |
var _Object$values2 = _slicedToArray(_Object$values, 1); | |
name = _Object$values2[0]; | |
} | |
} | |
name = escape(name); | |
var prefix = ""; | |
switch (s.type) { | |
case "extension": | |
prefix += "🧩 "; | |
break; | |
case "statictheme": | |
prefix += "🖌 "; | |
break; | |
default: | |
break; | |
} | |
return createSuggestionItem("\n <div style=\"padding:5px;display:grid;grid-template-columns:2em 1fr;grid-gap:15px\">\n <img style=\"width:2em\" src=\"".concat(s.icon_url, "\" alt=\"").concat(name, "\">\n <div>\n <div class=\"title\"><strong>").concat(prefix).concat(name, "</strong></div>\n </div>\n </div>\n "), { | |
url: s.url | |
}); | |
}); | |
}; // Firefox Addons | |
completions.fa = { | |
alias: "fa", | |
name: "firefox-addons", | |
search: "https://addons.mozilla.org/en-US/firefox/search/?q=", | |
compl: "https://addons.mozilla.org/api/v4/addons/autocomplete/?q=", | |
callback: parseFirefoxAddonsRes // Firefox Themes | |
}; | |
completions.ft = { | |
alias: "ft", | |
name: "firefox-themes", | |
search: "https://addons.mozilla.org/en-US/firefox/search/?type=statictheme&q=", | |
compl: "https://addons.mozilla.org/api/v4/addons/autocomplete/?type=statictheme&q=", | |
callback: parseFirefoxAddonsRes // Firefox Extensions | |
}; | |
completions.fe = { | |
alias: "fe", | |
name: "firefox-extensions", | |
search: "https://addons.mozilla.org/en-US/firefox/search/?type=extension&q=", | |
compl: "https://addons.mozilla.org/api/v4/addons/autocomplete/?type=extension&q=", | |
callback: parseFirefoxAddonsRes // OWASP Wiki | |
}; | |
completions.ow = { | |
alias: "ow", | |
name: "owasp", | |
search: "https://www.owasp.org/index.php?go=go&search=", | |
compl: "https://www.owasp.org/api.php?action=opensearch&format=json&formatversion=2&namespace=0&limit=10&suggest=true&search=" | |
}; | |
completions.ow.callback = function (response) { | |
return JSON.parse(response.text)[1]; | |
}; // StackOverflow | |
completions.so = { | |
alias: "so", | |
name: "stackoverflow", | |
search: "https://stackoverflow.com/search?q=", | |
compl: "https://api.stackexchange.com/2.2/search/advanced?pagesize=10&order=desc&sort=relevance&site=stackoverflow&q=" | |
}; | |
completions.so.callback = function (response) { | |
return JSON.parse(response.text).items.map(function (s) { | |
return createURLItem("[".concat(s.score, "] ").concat(s.title), s.link); | |
}); | |
}; // DockerHub repo search | |
completions.dh = { | |
alias: "dh", | |
name: "dockerhub", | |
search: "https://hub.docker.com/search/?page=1&q=", | |
compl: "https://hub.docker.com/v2/search/repositories/?page_size=20&query=" | |
}; | |
completions.dh.callback = function (response) { | |
return JSON.parse(response.text).results.map(function (s) { | |
var meta = ""; | |
var repo = s.repo_name; | |
meta += "[\u2605".concat(escape(s.star_count), "] "); | |
meta += "[\u2193".concat(escape(s.pull_count), "] "); | |
if (repo.indexOf("/") === -1) { | |
repo = "_/".concat(repo); | |
} | |
return createSuggestionItem("\n <div>\n <div class=\"title\"><strong>".concat(escape(repo), "</strong></div>\n <div>").concat(meta, "</div>\n <div>").concat(escape(s.short_description), "</div>\n </div>\n "), { | |
url: "https://hub.docker.com/r/".concat(repo) | |
}); | |
}); | |
}; // GitHub | |
completions.gh = { | |
alias: "gh", | |
name: "github", | |
search: "https://github.com/search?q=", | |
compl: "https://api.github.com/search/repositories?sort=stars&order=desc&q=" | |
}; | |
completions.gh.callback = function (response) { | |
return JSON.parse(response.text).items.map(function (s) { | |
var prefix = ""; | |
if (s.stargazers_count) { | |
prefix += "[\u2605".concat(s.stargazers_count, "] "); | |
} | |
return createURLItem(prefix + s.full_name, s.html_url); | |
}); | |
}; // Domainr domain search | |
completions.do = { | |
alias: "do", | |
name: "domainr", | |
search: "https://domainr.com/?q=", | |
compl: "https://5jmgqstc3m.execute-api.us-west-1.amazonaws.com/v1/domainr?q=" | |
}; | |
completions.do.callback = function (response) { | |
return Object.entries(JSON.parse(response.text)).map(function (_ref) { | |
var _ref2 = _slicedToArray(_ref, 2), | |
domain = _ref2[0], | |
data = _ref2[1]; | |
var color = "inherit"; | |
var symbol = "<strong>?</strong> "; | |
switch (data.summary) { | |
case "inactive": | |
color = "#23b000"; | |
symbol = "✔ "; | |
break; | |
case "unknown": | |
break; | |
default: | |
color = "#ff4d00"; | |
symbol = "✘ "; | |
} | |
return createSuggestionItem("<div><div class=\"title\" style=\"color:".concat(color, "\"><strong>").concat(symbol).concat(escape(domain), "</strong></div></div>"), { | |
url: "https://domainr.com/".concat(domain) | |
}); | |
}); | |
}; // Vim Wiki | |
completions.vw = { | |
alias: "vw", | |
name: "vimwiki", | |
favicon: "https://vignette.wikia.nocookie.net/vim/images/6/64/Favicon.ico", | |
search: "https://vim.fandom.com/wiki/Special:Search?query=", | |
compl: "https://vim.fandom.com/api.php?action=opensearch&format=json&formatversion=2&namespace=0&limit=10&suggest=true&search=" | |
}; | |
completions.vw.callback = function (response) { | |
return JSON.parse(response.text)[1].map(function (r) { | |
return createURLItem(r, "https://vim.fandom.com/wiki/".concat(r)); | |
}); | |
}; // ****** Shopping & Food ****** // | |
// Amazon | |
completions.az = { | |
alias: "az", | |
name: "amazon", | |
search: "https://smile.amazon.com/s/?field-keywords=", | |
compl: "https://completion.amazon.com/search/complete?method=completion&mkt=1&search-alias=aps&q=" | |
}; | |
completions.az.callback = function (response) { | |
return JSON.parse(response.text)[1]; | |
}; // Craigslist | |
completions.cl = { | |
alias: "cl", | |
name: "craigslist", | |
search: "https://www.craigslist.org/search/sss?query=", | |
compl: "https://www.craigslist.org/suggest?v=12&type=search&cat=sss&area=1&term=" | |
}; | |
completions.cl.callback = function (response) { | |
return JSON.parse(response.text); | |
}; // EBay | |
completions.eb = { | |
alias: "eb", | |
name: "ebay", | |
search: "https://www.ebay.com/sch/i.html?_nkw=", | |
compl: "https://autosug.ebay.com/autosug?callback=0&sId=0&kwd=" | |
}; | |
completions.eb.callback = function (response) { | |
return JSON.parse(response.text).res.sug; | |
}; // Yelp | |
completions.yp = { | |
alias: "yp", | |
name: "yelp", | |
search: "https://www.yelp.com/search?find_desc=", | |
compl: "https://www.yelp.com/search_suggest/v2/prefetch?prefix=" | |
}; | |
completions.yp.callback = function (response) { | |
var res = JSON.parse(response.text).response; | |
var words = []; | |
res.forEach(function (r) { | |
r.suggestions.forEach(function (s) { | |
var w = s.query; | |
if (words.indexOf(w) === -1) { | |
words.push(w); | |
} | |
}); | |
}); | |
return words; | |
}; // ****** General References, Calculators & Utilities ****** // | |
var parseDatamuseRes = function parseDatamuseRes(res) { | |
var o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | |
var opts = { | |
maxDefs: -1, | |
ellipsis: false | |
}; | |
Object.assign(opts, o); | |
return res.map(function (r) { | |
var defs = []; | |
var defsHtml = ""; | |
if ((opts.maxDefs <= -1 || opts.maxDefs > 0) && r.defs && r.defs.length > 0) { | |
var _iteratorNormalCompletion = true; | |
var _didIteratorError = false; | |
var _iteratorError = undefined; | |
try { | |
for (var _iterator = r.defs.slice(0, opts.maxDefs <= -1 ? undefined : opts.maxDefs)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | |
var d = _step.value; | |
var ds = d.split("\t"); | |
var partOfSpeech = "(".concat(escape(ds[0]), ")"); | |
var def = escape(ds[1]); | |
defs.push("<span><em>".concat(partOfSpeech, "</em> ").concat(def, "</span>")); | |
} | |
} catch (err) { | |
_didIteratorError = true; | |
_iteratorError = err; | |
} finally { | |
try { | |
if (!_iteratorNormalCompletion && _iterator.return != null) { | |
_iterator.return(); | |
} | |
} finally { | |
if (_didIteratorError) { | |
throw _iteratorError; | |
} | |
} | |
} | |
if (opts.ellipsis && r.defs.length > opts.maxDefs) { | |
defs.push("<span><em>…</em></span>"); | |
} | |
defsHtml = "<div>".concat(defs.join("<br />"), "</div>"); | |
} | |
return createSuggestionItem("\n <div>\n <div class=\"title\"><strong>".concat(escape(r.word), "</strong></div>\n ").concat(defsHtml, "\n </div>\n "), { | |
url: "".concat(opts.wordBaseURL).concat(r.word) | |
}); | |
}); | |
}; // Dictionary | |
completions.de = { | |
alias: "de", | |
name: "define", | |
search: "http://onelook.com/?w=", | |
compl: "https://api.datamuse.com/words?md=d&sp=%s*", | |
opts: { | |
maxDefs: 16, | |
ellipsis: true, | |
wordBaseURL: "http://onelook.com/?w=" | |
} | |
}; | |
completions.de.callback = function (response) { | |
var res = JSON.parse(response.text); | |
return parseDatamuseRes(res, completions.de.opts); | |
}; // Thesaurus | |
completions.th = { | |
alias: "th", | |
name: "thesaurus", | |
search: "https://www.onelook.com/thesaurus/?s=", | |
compl: "https://api.datamuse.com/words?md=d&ml=%s", | |
opts: { | |
maxDefs: 3, | |
ellipsis: true, | |
wordBaseURL: "http://onelook.com/thesaurus/?s=" | |
} | |
}; | |
completions.th.callback = function (response) { | |
var res = JSON.parse(response.text); | |
return parseDatamuseRes(res, completions.th.opts); | |
}; // Wikipedia | |
completions.wp = { | |
alias: "wp", | |
name: "wikipedia", | |
search: "https://en.wikipedia.org/w/index.php?search=", | |
compl: "https://en.wikipedia.org/w/api.php?action=query&format=json&generator=prefixsearch&prop=info|pageprops%7Cpageimages%7Cdescription&redirects=&ppprop=displaytitle&piprop=thumbnail&pithumbsize=100&pilimit=6&inprop=url&gpssearch=" | |
}; | |
completions.wp.callback = function (response) { | |
return Object.values(JSON.parse(response.text).query.pages).map(function (p) { | |
var img = p.thumbnail ? p.thumbnail.source : wpDefaultIcon; | |
var desc = p.description ? p.description : ""; | |
return createSuggestionItem("\n <div style=\"padding:5px;display:grid;grid-template-columns:60px 1fr;grid-gap:15px\">\n <img style=\"width:60px\" src=\"".concat(img, "\" alt=\"").concat(p.title, "\">\n <div>\n <div class=\"title\"><strong>").concat(p.title, "</strong></div>\n <div class=\"title\">").concat(desc, "</div>\n </div>\n </div>\n "), { | |
url: p.fullurl | |
}); | |
}); | |
}; // Wikipedia - Simple English version | |
completions.ws = { | |
alias: "ws", | |
name: "wikipedia-simple", | |
search: "https://simple.wikipedia.org/w/index.php?search=", | |
compl: "https://simple.wikipedia.org/w/api.php?action=query&format=json&generator=prefixsearch&prop=info|pageprops%7Cpageimages%7Cdescription&redirects=&ppprop=displaytitle&piprop=thumbnail&pithumbsize=100&pilimit=6&inprop=url&gpssearch=", | |
callback: completions.wp.callback // Wiktionary | |
}; | |
completions.wt = { | |
alias: "wt", | |
name: "wiktionary", | |
search: "https://en.wiktionary.org/w/index.php?search=", | |
compl: "https://en.wiktionary.org/w/api.php?action=query&format=json&generator=prefixsearch&gpssearch=" | |
}; | |
completions.wt.callback = function (response) { | |
return Object.values(JSON.parse(response.text).query.pages).map(function (p) { | |
return p.title; | |
}); | |
}; // WolframAlpha | |
completions.wa = { | |
alias: "wa", | |
name: "wolframalpha", | |
search: "http://www.wolframalpha.com/input/?i=", | |
compl: "http://api.wolframalpha.com/v2/query?appid=".concat(keys.wolframalpha, "&format=plaintext&output=json&reinterpret=true&input=%s") | |
}; | |
completions.wa.callback = function (response) { | |
var res = JSON.parse(response.text).queryresult; | |
if (res.error) { | |
return [createSuggestionItem("\n <div>\n <div class=\"title\"><strong>Error</strong> (Code ".concat(escape(res.error.code), ")</div>\n <div class=\"title\">").concat(escape(res.error.msg), "</div>\n </div>"), { | |
url: "https://www.wolframalpha.com/" | |
})]; | |
} | |
if (!res.success) { | |
if (res.tips) { | |
return [createSuggestionItem("\n <div>\n <div class=\"title\"><strong>No Results</strong></div>\n <div class=\"title\">".concat(escape(res.tips.text), "</div>\n </div>"), { | |
url: "https://www.wolframalpha.com/" | |
})]; | |
} | |
if (res.didyoumeans) { | |
return res.didyoumeans.map(function (s) { | |
return createSuggestionItem("\n <div>\n <div class=\"title\"><strong>Did you mean...?</strong></div>\n <div class=\"title\">".concat(escape(s.val), "</div>\n </div>"), { | |
url: "https://www.wolframalpha.com/" | |
}); | |
}); | |
} | |
return [createSuggestionItem("\n <div>\n <div class=\"title\"><strong>Error</strong></div>\n <div class=\"title\">An unknown error occurred.</div>\n </div>", { | |
url: "https://www.wolframalpha.com/" | |
})]; | |
} | |
var results = []; | |
res.pods.forEach(function (p) { | |
var result = { | |
title: escape(p.title), | |
values: [], | |
url: "http://www.wolframalpha.com/input/?i=" | |
}; | |
if (p.numsubpods > 0) { | |
result.url += encodeURIComponent(p.subpods[0].plaintext); | |
p.subpods.forEach(function (sp) { | |
if (!sp.plaintext) return; | |
var v = ""; | |
if (sp.title) { | |
v += "<strong>".concat(escape(sp.title), "</strong>: "); | |
} | |
v += escape(sp.plaintext); | |
result.values.push("<div class=\"title\">".concat(v, "</div>")); | |
}); | |
} | |
if (result.values.length > 0) { | |
results.push(result); | |
} | |
}); | |
return results.map(function (r) { | |
return createSuggestionItem("\n <div>\n <div class=\"title\"><strong>".concat(r.title, "</strong></div>\n ").concat(r.values.join("\n"), "\n </div>"), { | |
url: r.url | |
}); | |
}); | |
}; // ****** Business Utilities & References ****** // | |
var parseCrunchbase = function parseCrunchbase(response, parse) { | |
var res = JSON.parse(response.text).data.items; | |
if (res.length === 0) { | |
return [createSuggestionItem("\n <div>\n <div class=\"title\"><strong>No Results</strong></div>\n <div class=\"title\">Nothing matched your query</div>\n </div>", { | |
url: "https://www.crunchbase.com/" | |
})]; | |
} | |
var objs = res.map(function (obj) { | |
return parse(obj); | |
}); | |
return objs.map(function (p) { | |
var domain = p.domain ? " | <a href=\"https://".concat(p.domain, "\" target=\"_blank\">").concat(p.domain, "</a>") : ""; | |
var location = p.loc ? " located in <em>".concat(p.loc, "</em>") : ""; | |
return createSuggestionItem("\n <div style=\"padding:5px;display:grid;grid-template-columns:60px 1fr;grid-gap:15px\">\n <img style=\"width:60px\" src=\"".concat(p.img, "\" alt=\"").concat(p.name, "\">\n <div style=\"display:grid;grid-template-rows:1fr 1fr 0.8fr\">\n <div class=\"title\"><strong style=\"font-size: 1.2em\">").concat(p.name, "</strong></div>\n <div class=\"title\" style=\"font-size: 1.2em\">").concat(p.desc, "</div>\n <div class=\"title\"><em>").concat(p.role, "</em>").concat(location).concat(domain, "</div>\n </div>\n </div>"), { | |
url: p.url | |
}); | |
}); | |
}; // Crunchbase Organization Search | |
completions.co = { | |
alias: "co", | |
name: "crunchbase-orgs", | |
search: "https://www.crunchbase.com/textsearch?q=", | |
compl: "https://api.crunchbase.com/v/3/odm_organizations?user_key=".concat(keys.crunchbase, "&query=%s") | |
}; | |
completions.co.callback = function (response) { | |
return parseCrunchbase(response, function (org) { | |
var r = org.properties; | |
var p = { | |
name: escape(r.name), | |
domain: r.domain !== null ? escape(r.domain).replace(/\/$/, "") : null, | |
desc: escape(r.short_description), | |
role: escape(r.primary_role), | |
img: cbDefaultIcon, | |
loc: "", | |
url: "https://www.crunchbase.com/".concat(r.web_path) | |
}; | |
p.loc += r.city_name !== null ? escape(r.city_name) : ""; | |
p.loc += r.region_name !== null && p.loc !== "" ? ", " : ""; | |
p.loc += r.region_name !== null ? escape(r.region_name) : ""; | |
p.loc += r.country_code !== null && p.loc !== "" ? ", " : ""; | |
p.loc += r.country_code !== null ? escape(r.country_code) : ""; | |
if (r.profile_image_url !== null) { | |
var u = r.profile_image_url; | |
var img = u.slice(u.indexOf("t_api_images") + "t_api_images".length + 1); | |
p.img = "https://res-4.cloudinary.com/crunchbase-production/image/upload/c_lpad,h_100,w_100,f_auto,b_white,q_auto:eco/".concat(img); | |
} | |
return p; | |
}); | |
}; // Crunchbase People Search | |
completions.cp = { | |
alias: "cp", | |
name: "crunchbase-people", | |
search: "https://www.crunchbase.com/app/search/?q=", | |
compl: "https://api.crunchbase.com/v/3/odm_people?user_key=".concat(keys.crunchbase, "&query=%s") | |
}; | |
completions.cp.callback = function (response) { | |
return parseCrunchbase(response, function (person) { | |
var r = person.properties; | |
var p = { | |
name: "".concat(escape(r.first_name), " ").concat(escape(r.last_name)), | |
desc: "", | |
img: cbDefaultIcon, | |
role: "", | |
loc: "", | |
url: "https://www.crunchbase.com/".concat(r.web_path) | |
}; | |
p.desc += r.title !== null ? escape(r.title) : ""; | |
p.desc += r.organization_name !== null && p.desc !== "" ? ", " : ""; | |
p.desc += r.organization_name !== null ? escape(r.organization_name) : ""; | |
p.loc += r.city_name !== null ? escape(r.city_name) : ""; | |
p.loc += r.region_name !== null && p.loc !== "" ? ", " : ""; | |
p.loc += r.region_name !== null ? escape(r.region_name) : ""; | |
p.loc += r.country_code !== null && p.loc !== "" ? ", " : ""; | |
p.loc += r.country_code !== null ? escape(r.country_code) : ""; | |
if (r.profile_image_url !== null) { | |
var url = r.profile_image_url; | |
var path = url.split("/"); | |
var img = encodeURIComponent(path[path.length - 1]); | |
p.img = "http://public.crunchbase.com/t_api_images/v1402944794/c_pad,h_50,w_50/".concat(img); | |
} | |
return p; | |
}); | |
}; // ****** Search Engines ****** // | |
// DuckDuckGo | |
completions.dd = { | |
alias: "dd", | |
name: "duckduckgo", | |
search: "https://duckduckgo.com/?q=", | |
compl: "https://duckduckgo.com/ac/?q=" | |
}; | |
completions.dd.callback = function (response) { | |
return JSON.parse(response.text).map(function (r) { | |
return r.phrase; | |
}); | |
}; // DuckDuckGo - I'm Feeling Lucky | |
completions.D = { | |
alias: "D", | |
name: "duckduckgo-lucky", | |
search: "https://duckduckgo.com/?q=\\", | |
compl: "https://duckduckgo.com/ac/?q=\\", | |
callback: completions.dd.callback // DuckDuckGo Images | |
}; | |
completions.di = { | |
alias: "di", | |
name: "duckduckgo-images", | |
search: "https://duckduckgo.com/?ia=images&iax=images&q=", | |
compl: "https://duckduckgo.com/ac/?ia=images&iax=images&q=", | |
callback: completions.dd.callback // DuckDuckGo Videos | |
}; | |
completions.dv = { | |
alias: "dv", | |
name: "duckduckgo-videos", | |
search: "https://duckduckgo.com/?ia=videos&iax=videos&q=", | |
compl: "https://duckduckgo.com/ac/?ia=videos&iax=videos&q=", | |
callback: completions.dd.callback // DuckDuckGo News | |
}; | |
completions.dn = { | |
alias: "dn", | |
name: "duckduckgo-news", | |
search: "https://duckduckgo.com/?iar=news&ia=news&q=", | |
compl: "https://duckduckgo.com/ac/?iar=news&ia=news&q=", | |
callback: completions.dd.callback // DuckDuckGo Maps | |
}; | |
completions.dm = { | |
alias: "dm", | |
name: "duckduckgo-maps", | |
search: "https://duckduckgo.com/?ia=maps&iax=maps&iaxm=places&q=", | |
compl: "https://duckduckgo.com/ac/?ia=maps&iax=maps&iaxm=places&q=", | |
callback: completions.dd.callback // Google | |
}; | |
completions.go = { | |
alias: "go", | |
name: "google", | |
search: "https://www.google.com/search?q=", | |
compl: "https://www.google.com/complete/search?client=chrome-omni&gs_ri=chrome-ext&oit=1&cp=1&pgcl=7&q=" | |
}; | |
completions.go.callback = function (response) { | |
return JSON.parse(response.text)[1]; | |
}; // Google Images | |
completions.gi = { | |
alias: "gi", | |
name: "google-images", | |
search: "https://www.google.com/search?tbm=isch&q=", | |
compl: "https://www.google.com/complete/search?client=chrome-omni&gs_ri=chrome-ext&oit=1&cp=1&pgcl=7&ds=i&q=", | |
callback: completions.go.callback // Google - I'm Feeling Lucky | |
}; | |
completions.G = { | |
alias: "G", | |
name: "google-lucky", | |
search: "https://www.google.com/search?btnI=1&q=", | |
compl: "https://www.google.com/complete/search?client=chrome-omni&gs_ri=chrome-ext&oit=1&cp=1&pgcl=7&q=", | |
callback: completions.go.callback // ****** Elixir ****** // | |
// Hex.pm | |
}; | |
completions.hx = { | |
alias: "hx", | |
name: "hex", | |
search: "https://hex.pm/packages?sort=downloads&search=", | |
compl: "https://hex.pm/api/packages?sort=downloads&hx&search=" | |
}; | |
completions.hx.callback = function (response) { | |
return JSON.parse(response.text).map(function (s) { | |
var dls = ""; | |
var desc = ""; | |
var liscs = ""; | |
if (s.downloads && s.downloads.all) { | |
dls = "[\u2193".concat(escape(s.downloads.all), "] "); | |
} | |
if (s.meta) { | |
if (s.meta.description) { | |
desc = escape(s.meta.description); | |
} | |
if (s.meta.licenses) { | |
s.meta.licenses.forEach(function (l) { | |
liscs += "[©".concat(escape(l), "] "); | |
}); | |
} | |
} | |
return createSuggestionItem("\n <div>\n <div class=\"title\">".concat(escape(s.repository), "/<strong>").concat(escape(s.name), "</strong></div>\n <div>").concat(dls).concat(liscs, "</div>\n <div>").concat(desc, "</div>\n </div>\n "), { | |
url: s.html_url | |
}); | |
}); | |
}; // hexdocs | |
// Same as hex but links to documentation pages | |
completions.hd = { | |
alias: "hd", | |
name: "hexdocs", | |
search: "https://hex.pm/packages?sort=downloads&search=", | |
compl: "https://hex.pm/api/packages?sort=downloads&hd&search=" | |
}; | |
completions.hd.callback = function (response) { | |
return JSON.parse(response.text).map(function (s) { | |
var dls = ""; | |
var desc = ""; | |
if (s.downloads && s.downloads.all) { | |
dls = "[\u2193".concat(escape(s.downloads.all), "]"); | |
} | |
if (s.meta) { | |
if (s.meta.description) { | |
desc = escape(s.meta.description); | |
} | |
} | |
return createSuggestionItem("\n <div>\n <div class=\"title\">".concat(escape(s.repository), "/<strong>").concat(escape(s.name), "</strong>").concat(dls, "</div>\n <div></div>\n <div>").concat(desc, "</div>\n </div>\n "), { | |
url: "https://hexdocs.pm/".concat(encodeURIComponent(s.name)) | |
}); | |
}); | |
}; // Exdocs | |
// Similar to `hd` but searches inside docs using Google Custom Search | |
completions.ex = { | |
alias: "ex", | |
name: "exdocs", | |
search: "https://hex.pm/packages?sort=downloads&ex&search=", | |
compl: googleCxURL("ex") | |
}; | |
completions.ex.callback = function (response) { | |
return JSON.parse(response.text).items.map(function (s) { | |
var hash = ""; | |
var snippet = s.htmlSnippet; | |
var openTag = "<b>"; | |
var closeTag = "</b>"; | |
var openArgs = "("; | |
var closeArgs = ")"; | |
var f1 = snippet.indexOf(openTag); | |
if (f1 === -1) { | |
return null; | |
} | |
var f2 = snippet.indexOf(closeTag); | |
if (f2 === -1) { | |
return null; | |
} | |
f1 += openTag.length; | |
var f3 = f2 + closeTag.length; | |
var fname = snippet.slice(f1, f2); | |
var snippetEnd = snippet.slice(f3); | |
var a1 = snippetEnd.indexOf(openArgs); | |
if (a1 !== 0) { | |
return null; | |
} | |
var a2 = snippetEnd.indexOf(closeArgs); | |
if (a2 === -1) { | |
return null; | |
} | |
a2 += closeArgs.length; | |
var fargs = snippetEnd.slice(a1, a2); | |
var fary = fargs.replace(new RegExp(openArgs + closeArgs), "").split(",").length; | |
hash = escape("".concat(fname, "/").concat(fary)); | |
var moduleName = escape(s.title).split(" –")[0]; | |
var subtitle = ""; | |
if (hash) { | |
subtitle = "\n <div style=\"font-size:1.1em; line-height:1.25em\">\n <em>".concat(moduleName, "</em>.<strong>").concat(hash, "</strong>\n </div>"); | |
} | |
return createSuggestionItem("\n <div>\n <div class=\"title\"><strong>".concat(s.htmlTitle, "</strong></div>\n ").concat(subtitle, "\n <div>").concat(s.htmlSnippet, "</div>\n </div>\n "), { | |
url: "".concat(s.link, "#").concat(hash) | |
}); | |
}).filter(function (s) { | |
return s !== null; | |
}); | |
}; // ****** Golang ****** // | |
// Golang Docs (Google CSE) | |
completions.gg = { | |
alias: "gg", | |
name: "golang", | |
domain: "golang.org", | |
search: googleCxPublicURL("gg"), | |
compl: googleCxURL("gg"), | |
callback: googleCxCallback // Godoc | |
}; | |
completions.gd = { | |
alias: "gd", | |
name: "godoc", | |
search: "https://godoc.org/?q=", | |
compl: "https://api.godoc.org/search?q=" | |
}; | |
completions.gd.callback = function (response) { | |
return JSON.parse(response.text).results.map(function (s) { | |
var prefix = ""; | |
if (s.import_count) { | |
prefix += "[\u2193".concat(s.import_count, "] "); | |
} | |
if (s.stars) { | |
prefix += "[\u2605".concat(s.stars, "] "); | |
} | |
return createURLItem(prefix + s.path, "https://godoc.org/".concat(s.path)); | |
}); | |
}; // Gowalker | |
completions.gw = { | |
alias: "gw", | |
name: "gowalker", | |
favicon: "https://gowalker.org/img/favicon.png", | |
search: "https://gowalker.org/search?auto_redirect=true&q=", | |
compl: "https://gowalker.org/search/json?q=" | |
}; | |
completions.gw.callback = function (response) { | |
return JSON.parse(response.text).results.map(function (s) { | |
var title = escape(s.title); | |
var desc = escape(s.description); | |
return createSuggestionItem("\n <div>\n <div class=\"title\"><strong>".concat(title, "</strong></div>\n <div>").concat(desc, "</div>\n </div>\n "), { | |
url: "https://golang.org/doc/".concat(encodeURIComponent(s.url)) | |
}); | |
}); | |
}; // Go-Search | |
completions.gs = { | |
alias: "gs", | |
name: "go-search", | |
favicon: "https://go-search.org/images/logo-16.png", | |
search: "http://go-search.org/search?q=", | |
compl: "http://go-search.org/api?action=search&q=" | |
}; | |
completions.gs.callback = function (response) { | |
return JSON.parse(response.text).hits.map(function (r) { | |
return r.package; | |
}); | |
}; // ****** Haskell ****** // | |
// Hackage | |
completions.ha = { | |
alias: "ha", | |
name: "hackage", | |
favicon: "https://hackage.haskell.org/static/favicon.png", | |
search: "https://hackage.haskell.org/packages/search?terms=", | |
compl: "https://hackage.haskell.org/packages/search.json?terms=" | |
}; | |
completions.ha.callback = function (response) { | |
return JSON.parse(response.text).map(function (s) { | |
return createURLItem(s.name, "https://hackage.haskell.org/package/".concat(s.name)); | |
}); | |
}; // Hoogle | |
completions.ho = { | |
alias: "ho", | |
name: "hoogle", | |
favicon: "https://www.haskell.org/img/favicon.ico", | |
search: "https://www.haskell.org/hoogle/?hoogle=".concat(encodeURIComponent("+platform +xmonad +xmonad-contrib ")), | |
// This tells Hoogle to include these modules in the search - encodeURIComponent is only used for better readability | |
compl: "https://www.haskell.org/hoogle/?mode=json&hoogle=".concat(encodeURIComponent("+platform +xmonad +xmonad-contrib ")) | |
}; | |
completions.ho.callback = function (response) { | |
return JSON.parse(response.text).results.map(function (s) { | |
return createURLItem(s.self, s.location); | |
}); | |
}; // Haskell Wiki | |
completions.hw = { | |
alias: "hw", | |
name: "haskellwiki", | |
favicon: "https://www.haskell.org/img/favicon.ico", | |
search: "https://wiki.haskell.org/index.php?go=go&search=", | |
compl: "https://wiki.haskell.org/api.php?action=opensearch&format=json&formatversion=2&namespace=0&limit=10&suggest=true&search=" | |
}; | |
completions.hw.callback = function (response) { | |
return JSON.parse(response.text)[1]; | |
}; // Hayoo | |
completions.hy = { | |
alias: "hy", | |
name: "hayoo", | |
favicon: "https://www.haskell.org/img/favicon.ico", | |
search: "http://hayoo.fh-wedel.de/?query=", | |
compl: "http://hayoo.fh-wedel.de/json?query=" | |
}; | |
completions.hy.callback = function (response) { | |
return JSON.parse(response.text).result.map(function (s) { | |
return createURLItem("[".concat(s.resultType, "] ").concat(s.resultName), s.resultUri); | |
}); | |
}; // ****** HTML, CSS, JavaScript, NodeJS, ... ****** // | |
// jQuery API documentation | |
completions.jq = { | |
alias: "jq", | |
name: "jquery", | |
domain: "jquery.com", | |
search: googleCxPublicURL("jq"), | |
compl: googleCxURL("jq"), | |
callback: googleCxCallback // NodeJS standard library documentation | |
}; | |
completions.no = { | |
alias: "no", | |
name: "node", | |
domain: "nodejs.org", | |
search: googleCxPublicURL("no"), | |
compl: googleCxURL("no"), | |
callback: googleCxCallback // Mozilla Developer Network (MDN) | |
}; | |
completions.md = { | |
alias: "md", | |
name: "mdn", | |
search: "https://developer.mozilla.org/en-US/search?q=", | |
compl: "https://developer.mozilla.org/en-US/search.json?q=" | |
}; | |
completions.md.callback = function (response) { | |
var res = JSON.parse(response.text); | |
return res.documents.map(function (s) { | |
var excerpt = escape(s.excerpt); | |
if (excerpt.length > 240) { | |
excerpt = "".concat(excerpt.slice(0, 240), "\u2026"); | |
} | |
res.query.split(" ").forEach(function (q) { | |
excerpt = excerpt.replace(new RegExp(q, "gi"), "<strong>$&</strong>"); | |
}); | |
var title = escape(s.title); | |
var slug = escape(s.slug); | |
return createSuggestionItem("\n <div>\n <div class=\"title\"><strong>".concat(title, "</strong></div>\n <div style=\"font-size:0.8em\"><em>").concat(slug, "</em></div>\n <div>").concat(excerpt, "</div>\n </div>\n "), { | |
url: s.url | |
}); | |
}); | |
}; // NPM registry search | |
completions.np = { | |
alias: "np", | |
name: "npm", | |
favicon: "https://static.npmjs.com/da3ab40fb0861d15c83854c29f5f2962.png", | |
search: "https://www.npmjs.com/search?q=", | |
compl: "https://api.npms.io/v2/search/suggestions?size=20&q=" | |
}; | |
completions.np.callback = function (response) { | |
return JSON.parse(response.text).map(function (s) { | |
var flags = ""; | |
var desc = ""; | |
var stars = ""; | |
var score = ""; | |
if (s.package.description) { | |
desc = escape(s.package.description); | |
} | |
if (s.score) { | |
if (s.score.final) { | |
score = Math.round(Number(s.score.final) * 5); | |
stars = "★".repeat(score) + "☆".repeat(5 - score); | |
} | |
} | |
if (s.flags) { | |
Object.keys(s.flags).forEach(function (f) { | |
flags += "[<span style='color:#ff4d00'>\u2691</span> ".concat(escape(f), "] "); | |
}); | |
} | |
return createSuggestionItem("\n <div>\n <style>\n .title>em {\n font-weight: bold;\n }\n </style>\n <div class=\"title\">".concat(s.highlight, "</div>\n <div>\n <span style=\"font-size:2em;line-height:0.5em\">").concat(stars, "</span>\n <span>").concat(flags, "</span>\n </div>\n <div>").concat(desc, "</div>\n </div>\n "), { | |
url: s.package.links.npm | |
}); | |
}); | |
}; // ****** Social Media & Entertainment ****** // | |
// Hacker News (YCombinator) | |
completions.hn = { | |
alias: "hn", | |
name: "hackernews", | |
domain: "news.ycombinator.com", | |
search: "https://hn.algolia.com/?query=", | |
compl: "https://hn.algolia.com/api/v1/search?tags=(story,comment)&query=" | |
}; | |
completions.hn.callback = function (response) { | |
var res = JSON.parse(response.text); | |
return res.hits.map(function (s) { | |
var title = ""; | |
var prefix = ""; | |
if (s.points) { | |
prefix += "[\u2191".concat(s.points, "] "); | |
} | |
if (s.num_comments) { | |
prefix += "[\u21B2".concat(s.num_comments, "] "); | |
} | |
switch (s._tags[0]) { | |
// eslint-disable-line no-underscore-dangle | |
case "story": | |
title = s.title; // eslint-disable-line prefer-destructuring | |
break; | |
case "comment": | |
title = s.comment_text; | |
break; | |
default: | |
title = s.objectID; | |
} | |
var re = new RegExp("(".concat(res.query.split(" ").join("|"), ")"), "ig"); | |
title = title.replace(re, "<strong>$&</strong>"); | |
var url = "https://news.ycombinator.com/item?id=".concat(s.objectID); | |
return createSuggestionItem("\n <div>\n <div class=\"title\">".concat(prefix + title, "</div>\n <div class=\"url\">").concat(url, "</div>\n </div>\n "), { | |
url: url | |
}); | |
}); | |
completions.re = { | |
alias: "re", | |
name: "reddit", | |
search: "https://www.reddit.com/search?sort=relevance&t=all&q=", | |
compl: "https://api.reddit.com/search?syntax=plain&sort=relevance&limit=20&q=" | |
}; | |
completions.re.callback = function (response) { | |
return JSON.parse(response.text).data.children.map(function (s) { | |
return createURLItem("[".concat(s.data.score, "] ").concat(s.data.title), "https://reddit.com".concat(s.data.permalink)); | |
}); | |
}; // YouTube | |
completions.yt = { | |
alias: "yt", | |
name: "youtube", | |
search: "https://www.youtube.com/search?q=", | |
compl: "https://www.googleapis.com/youtube/v3/search?maxResults=20&part=snippet&type=video,channel&key=".concat(keys.google_yt, "&safeSearch=none&q=") | |
}; | |
completions.yt.callback = function (response) { | |
return JSON.parse(response.text).items.map(function (s) { | |
switch (s.id.kind) { | |
case "youtube#channel": | |
return createURLItem("".concat(s.snippet.channelTitle, ": ").concat(s.snippet.description), "https://youtube.com/channel/".concat(s.id.channelId)); | |
case "youtube#video": | |
return createURLItem(" \u25B6 ".concat(s.snippet.title), "https://youtu.be/".concat(s.id.videoId)); | |
default: | |
return null; | |
} | |
}).filter(function (s) { | |
return s !== null; | |
}); | |
}; | |
module.exports = completions; | |
},{"./conf.priv.js":"pawg","./util":"Y/Oq"}],"Nwkc":[function(require,module,exports) { | |
var util = require("./util"); | |
var keys = require("./keys"); | |
var completions = require("./completions"); // ---- Settings ----// | |
util.addSettings({ | |
hintAlign: "left", | |
omnibarSuggestionTimeout: 500, | |
richHintsForKeystroke: 1, | |
theme: "\n /* Disable RichHints CSS animation */\n .expandRichHints {\n animation: 0s ease-in-out 1 forwards expandRichHints;\n }\n .collapseRichHints {\n animation: 0s ease-in-out 1 forwards collapseRichHints;\n }\n " | |
}); | |
if (typeof Hints !== "undefined") { | |
Hints.characters = "qwertasdfgzxcvb"; | |
} // Leader for site-specific mappings | |
var siteleader = "<Space>"; // Leader for OmniBar searchEngines | |
var searchleader = "a"; // Process mappings and completions | |
// See ./keys.js and ./completions.js | |
util.rmMaps(keys.unmaps.mappings); | |
util.rmSearchAliases(keys.unmaps.searchAliases); | |
util.processMaps(keys.maps, keys.aliases, siteleader); | |
util.processCompletions(completions, searchleader); | |
module.exports = { | |
siteleader: siteleader, | |
searchleader: searchleader | |
}; | |
},{"./util":"Y/Oq","./keys":"BSXI","./completions":"HkY7"}]},{},["Nwkc"], null) | |
//# sourceMappingURL=/conf.js.map |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment