npmjs-explore

description

2022-06-22 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         npmjs-explore
// @name:zh      npmjs文件查看
// @namespace    https://github.com/lisonge
// @version      1.0.0
// @author       lisonge
// @description  description
// @license      ISC
// @icon         https://i.songe.li/favicon.svg
// @homepage     https://github.com/lisonge/npmjs-explore#readme
// @homepageURL  https://github.com/lisonge/npmjs-explore#readme
// @source       https://github.com/lisonge/npmjs-explore.git
// @supportURL   https://github.com/lisonge/npmjs-explore/issues
// @match        https://www.npmjs.com/package/*
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/preact.min.js
// ==/UserScript==

// use [email protected] at 2022-06-22T07:55:48.680Z

(function(require$$0) {
  var _a;
  "use strict";
  function _interopDefaultLegacy(e2) {
    return e2 && typeof e2 === "object" && "default" in e2 ? e2 : { "default": e2 };
  }
  var require$$0__default = /* @__PURE__ */ _interopDefaultLegacy(require$$0);
  var jsxs$1;
  var jsx$1;
  var r = require$$0__default["default"], _ = 0;
  function e(e2, o, n, t, l) {
    var u, f, i = {};
    for (f in o)
      f == "ref" ? u = o[f] : i[f] = o[f];
    var p = { type: e2, props: i, key: n, ref: u, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: --_, __source: l, __self: t };
    if (typeof e2 == "function" && (u = e2.defaultProps))
      for (f in u)
        i[f] === void 0 && (i[f] = u[f]);
    return r.options.vnode && r.options.vnode(p), p;
  }
  r.Fragment, jsx$1 = e, jsxs$1 = e;
  const jsx = jsx$1;
  const jsxs = jsxs$1;
  const list = location.pathname.split("/");
  const packageName = list[2];
  const version = (_a = list[4]) != null ? _a : "latest";
  const jsdelivrUrl = `https://cdn.jsdelivr.net/npm/${packageName}@${version}/`;
  const unpkgUrl = `https://unpkg.com/browse/${packageName}@${version}/`;
  const App = jsxs("div", {
    style: {
      marginLeft: "20px"
    },
    children: [jsx("a", {
      href: jsdelivrUrl,
      title: jsdelivrUrl,
      target: "_blank",
      style: {
        color: "#bb2e3e",
        textDecoration: "none"
      },
      children: "jsdelivr"
    }), jsx("span", {
      style: {
        display: "inline-block",
        width: "10px"
      }
    }), jsx("a", {
      href: unpkgUrl,
      title: unpkgUrl,
      target: "_blank",
      style: {
        color: "#bb2e3e",
        textDecoration: "none"
      },
      children: "unpkg"
    })]
  });
  (() => {
    var _a2;
    const box = (_a2 = document.querySelector(`span[title="${packageName}"]`)) == null ? void 0 : _a2.parentElement;
    if (!box)
      return;
    const container = document.createElement("div");
    box.appendChild(container);
    require$$0.render(App, container);
  })();
})(preact);