-
-
Save anonymous/2fbc844709a818490639 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const PARSER_MAX_RESULTS = 20; | |
| const thi$ = (selector) => $(selector, this); | |
| jQuery.fn.outerHTML = function(s) { | |
| return this[0].outerHTML; | |
| }; | |
| CmdUtils.makeSearchCommand({ | |
| name: "mvn", | |
| url: "http://search.maven.org/solrsearch/select?q={QUERY}&rows=" + PARSER_MAX_RESULTS + "&wt=xml", | |
| parser: { | |
| container: "response > result > doc", | |
| title: function() { | |
| var group = $("str[name=g]", this).text(); | |
| var id = $("str[name=a]", this).text(); | |
| var version = $("str[name=latestVersion]", this).text(); | |
| var timestamp = new Date(Number($("[name=timestamp]", this).text())); | |
| return $("<div>").append( | |
| $("<a>") | |
| .attr("href", `http://search.maven.org/#artifactdetails|${group}|${id}|${version}|jar`) | |
| .text(`${group} % ${id} % ${version}`), | |
| $("<div>").text(timestamp.toDateString()) | |
| ); | |
| }, | |
| maxResults: PARSER_MAX_RESULTS | |
| }, | |
| }); | |
| // generated by create-search-command | |
| CmdUtils.makeSearchCommand({ | |
| name: "maven", | |
| url: "http://mvnrepository.com/search?q={QUERY}", | |
| parser: { | |
| container: "#maincontent .im", | |
| title: ".im-header", | |
| body: ".im-description", | |
| maxResults: PARSER_MAX_RESULTS | |
| }, | |
| }); | |
| // generated by create-search-command | |
| CmdUtils.makeSearchCommand({ | |
| name: "github", | |
| url: "https://github.com/search?utf8=%E2%9C%93&q={QUERY}", | |
| parser: { | |
| container: "li.repo-list-item", | |
| title: "h3.repo-list-name", | |
| body: function() {return $("<div>").append([ | |
| thi$(".repo-list-stats"), | |
| $(".repo-list-description", this), | |
| $(".repo-list-meta", this), | |
| ]);}, | |
| maxResults: PARSER_MAX_RESULTS | |
| }, | |
| }); | |
| // generated by create-search-command | |
| CmdUtils.makeSearchCommand({ | |
| name: "disconnect", | |
| url: "https://search.disconnect.me/searchTerms/search?query={QUERY}", | |
| parser: { | |
| container: "ul#normal-results > li:not(.ads-area)", | |
| title: "a.title", | |
| maxResults: PARSER_MAX_RESULTS, | |
| body: "p:last", | |
| }, | |
| }); | |
| // generated by create-search-command | |
| CmdUtils.makeSearchCommand({ | |
| name: "stackoverflow", | |
| url: "https://api.stackexchange.com/2.2/search/advanced?order=desc&sort=activity&q={QUERY}&site=stackoverflow", | |
| parser: { | |
| type: "json", | |
| container: "items", | |
| title: "title", | |
| href: 'link', | |
| body: function(obj) { | |
| var tags = $('<div>').append( | |
| obj.tags.map(t => { | |
| return $('<span>').text(t).css({ | |
| background: 'gray', | |
| margin: '2pt' | |
| }); | |
| }) | |
| ); | |
| var borderColor = obj.is_answered ? 'green' : 'red'; | |
| return $('<div>').append( | |
| tags, | |
| $('<div>').text(`answers: ${obj.answer_count}`), | |
| $('<div>').text(`last active: ${new Date(obj.last_activity_date * 1000).toDateString()}`), | |
| $('<div>').text(`score: ${obj.score}`), | |
| $('<div>').text(`views: ${obj.view_count}`) | |
| ).css({ | |
| 'border-left': `3pt solid ${borderColor}`, | |
| 'padding-left': '5pt' | |
| }).outerHTML(); | |
| }, | |
| maxResults: PARSER_MAX_RESULTS, | |
| }, | |
| }); | |
| // generated by create-search-command | |
| CmdUtils.makeSearchCommand({ | |
| name: "chef", | |
| url: "https://docs.chef.io/search.html?q={QUERY}", | |
| }); | |
| // generated by create-search-command | |
| CmdUtils.makeSearchCommand({ | |
| name: "cookbook", | |
| url: "https://supermarket.chef.io/cookbooks?utf8=%E2%9C%93&q={QUERY}", | |
| parser: { | |
| container: "ul.listing > li", | |
| title: function() { | |
| return $("<div>").append([ | |
| $("a[rel=cookbook]",this), | |
| $("<code>").text(" | "), | |
| $("span.meta", this)]); | |
| }, | |
| href: "a[rel=cookbook]", | |
| maxResults: PARSER_MAX_RESULTS, | |
| body: "div.body-content", | |
| }, | |
| }); | |
| // generated by create-search-command | |
| CmdUtils.makeSearchCommand({ | |
| name: "addon", | |
| url: "https://addons.mozilla.org/en-US/firefox/search/?q={QUERY}&appver=44.0&platform=mac", | |
| parser: { | |
| maxResults: PARSER_MAX_RESULTS, | |
| container: "div.item.addon", | |
| title: "h3", | |
| href: "h3 > a", | |
| body: "div.info > :not(h3)", | |
| }, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment