NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name package-finder // @namespace https://2yc.tw // @version 0.1.0 // @description Userscript to find npm package in GitHub // @author YY // @match https://github.com/* // @license MIT // @homepage https://github.com/x3388638/package-finder // @updateURL https://openuserjs.org/meta/x3388638/package-finder.meta.js // @grant none // ==/UserScript== !function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function o(){}n.r(t);function r(e){return e()}function c(){return Object.create(null)}function i(e){e.forEach(r)}function u(e){return"function"==typeof e}function a(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}new Set;function l(e,t){e.appendChild(t)}function s(e,t,n){e.insertBefore(t,n||null)}function f(e){e.parentNode.removeChild(e)}function d(e){return document.createElement(e)}function p(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function h(e){return document.createTextNode(e)}function m(e,t,n,o){return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)}function g(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}new Set;let $;function y(e){$=e}const b=[],v=[],w=[],x=[],_=Promise.resolve();let S=!1;function j(){S||(S=!0,_.then(M))}function k(e){w.push(e)}let E=!1;const O=new Set;function M(){if(!E){E=!0;do{for(let e=0;e<b.length;e+=1){const t=b[e];y(t),P(t.$$)}for(b.length=0;v.length;)v.pop()();for(let e=0;e<w.length;e+=1){const t=w[e];O.has(t)||(O.add(t),t())}w.length=0}while(b.length);for(;x.length;)x.pop()();S=!1,E=!1,O.clear()}}function P(e){if(null!==e.fragment){e.update(),i(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(k)}}const T=new Set;let q;function z(e,t){e&&e.i&&(T.delete(e),e.i(t))}function C(e,t,n,o){if(e&&e.o){if(T.has(e))return;T.add(e),q.c.push(()=>{T.delete(e),o&&(n&&e.d(1),o())}),e.o(t)}}"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;new Set(["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]);let A;function N(e,t,n){const{fragment:o,on_mount:c,on_destroy:a,after_update:l}=e.$$;o&&o.m(t,n),k(()=>{const t=c.map(r).filter(u);a?a.push(...t):i(t),e.$$.on_mount=[]}),l.forEach(k)}function B(e,t){const n=e.$$;null!==n.fragment&&(i(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function L(e,t,n,r,u,a,l=[-1]){const s=$;y(e);const d=t.props||{},p=e.$$={fragment:null,ctx:null,props:a,update:o,not_equal:u,bound:c(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(s?s.$$.context:[]),callbacks:c(),dirty:l};let h=!1;if(p.ctx=n?n(e,d,(t,n,...o)=>{const r=o.length?o[0]:n;return p.ctx&&u(p.ctx[t],p.ctx[t]=r)&&(p.bound[t]&&p.bound[t](r),h&&function(e,t){-1===e.$$.dirty[0]&&(b.push(e),j(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}(e,t)),n}):[],p.update(),h=!0,i(p.before_update),p.fragment=!!r&&r(p.ctx),t.target){if(t.hydrate){const e=(m=t.target,Array.from(m.childNodes));p.fragment&&p.fragment.l(e),e.forEach(f)}else p.fragment&&p.fragment.c();t.intro&&z(e.$$.fragment),N(e,t.target,t.anchor),M()}var m;y(s)}"function"==typeof HTMLElement&&(A=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){for(const e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(e,t,n){this[e]=n}$destroy(){B(this,1),this.$destroy=o}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(){}});class H{$destroy(){B(this,1),this.$destroy=o}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(){}}function I(e){let t,n;return{c(){t=p("svg"),n=p("path"),g(n,"fill-rule","evenodd"),g(n,"d","M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0\n 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"),g(t,"class","octicon octicon-search"),g(t,"viewBox","0 0 16 16"),g(t,"version","1.1"),g(t,"width",e[0]),g(t,"height",e[0]),g(t,"aria-hidden","true")},m(e,o){s(e,t,o),l(t,n)},p(e,[n]){1&n&&g(t,"width",e[0]),1&n&&g(t,"height",e[0])},i:o,o:o,d(e){e&&f(t)}}}function D(e,t,n){let{size:o=16}=t;return e.$set=e=>{"size"in e&&n(0,o=e.size)},[o]}var F=class extends H{constructor(e){super(),L(this,e,D,I,a,{size:0})}};function G(e){let t,n,r,c,i,u;return n=new F({}),{c(){var e;t=d("button"),(e=n.$$.fragment)&&e.c(),r=h("\n Package"),g(t,"class","btn btn-sm mr-5 f6")},m(o,a){s(o,t,a),N(n,t,null),l(t,r),c=!0,i||(u=m(t,"click",e[0]),i=!0)},p:o,i(e){c||(z(n.$$.fragment,e),c=!0)},o(e){C(n.$$.fragment,e),c=!1},d(e){e&&f(t),B(n),i=!1,u()}}}const J=/"name\s([\w-_]+)"\sfilename:package\.json/;function K(e){const t=document.querySelector(".js-jump-to-field");return[()=>{let e=t.value;if(e){const t=e.match(J);t&&(e=t[1]),window.location.href=`/search?q="name ${e}"+filename:package.json`}}]}var Q=class extends H{constructor(e){super(),L(this,e,K,G,a,{})}};const R="package-finder-root",U=document.createElement("div"),V=document.querySelector(".js-site-search");U.id=R,V.parentNode.insertBefore(U,V.nextSibling),new Q({target:document.getElementById(R)})}]);