npmjs-explore

description

当前为 2022-06-22 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name npmjs-explore
  3. // @name:zh npmjs文件查看
  4. // @namespace https://github.com/lisonge
  5. // @version 1.0.0
  6. // @author lisonge
  7. // @description description
  8. // @license ISC
  9. // @icon https://i.songe.li/favicon.svg
  10. // @homepage https://github.com/lisonge/npmjs-explore#readme
  11. // @homepageURL https://github.com/lisonge/npmjs-explore#readme
  12. // @source https://github.com/lisonge/npmjs-explore.git
  13. // @supportURL https://github.com/lisonge/npmjs-explore/issues
  14. // @match https://www.npmjs.com/package/*
  15. // @require https://cdn.jsdelivr.net/npm/preact@10.8.1/dist/preact.min.js
  16. // ==/UserScript==
  17.  
  18. // use vite-plugin-monkey@0.2.13 at 2022-06-22T07:55:48.680Z
  19.  
  20. (function(require$$0) {
  21. var _a;
  22. "use strict";
  23. function _interopDefaultLegacy(e2) {
  24. return e2 && typeof e2 === "object" && "default" in e2 ? e2 : { "default": e2 };
  25. }
  26. var require$$0__default = /* @__PURE__ */ _interopDefaultLegacy(require$$0);
  27. var jsxs$1;
  28. var jsx$1;
  29. var r = require$$0__default["default"], _ = 0;
  30. function e(e2, o, n, t, l) {
  31. var u, f, i = {};
  32. for (f in o)
  33. f == "ref" ? u = o[f] : i[f] = o[f];
  34. 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 };
  35. if (typeof e2 == "function" && (u = e2.defaultProps))
  36. for (f in u)
  37. i[f] === void 0 && (i[f] = u[f]);
  38. return r.options.vnode && r.options.vnode(p), p;
  39. }
  40. r.Fragment, jsx$1 = e, jsxs$1 = e;
  41. const jsx = jsx$1;
  42. const jsxs = jsxs$1;
  43. const list = location.pathname.split("/");
  44. const packageName = list[2];
  45. const version = (_a = list[4]) != null ? _a : "latest";
  46. const jsdelivrUrl = `https://cdn.jsdelivr.net/npm/${packageName}@${version}/`;
  47. const unpkgUrl = `https://unpkg.com/browse/${packageName}@${version}/`;
  48. const App = jsxs("div", {
  49. style: {
  50. marginLeft: "20px"
  51. },
  52. children: [jsx("a", {
  53. href: jsdelivrUrl,
  54. title: jsdelivrUrl,
  55. target: "_blank",
  56. style: {
  57. color: "#bb2e3e",
  58. textDecoration: "none"
  59. },
  60. children: "jsdelivr"
  61. }), jsx("span", {
  62. style: {
  63. display: "inline-block",
  64. width: "10px"
  65. }
  66. }), jsx("a", {
  67. href: unpkgUrl,
  68. title: unpkgUrl,
  69. target: "_blank",
  70. style: {
  71. color: "#bb2e3e",
  72. textDecoration: "none"
  73. },
  74. children: "unpkg"
  75. })]
  76. });
  77. (() => {
  78. var _a2;
  79. const box = (_a2 = document.querySelector(`span[title="${packageName}"]`)) == null ? void 0 : _a2.parentElement;
  80. if (!box)
  81. return;
  82. const container = document.createElement("div");
  83. box.appendChild(container);
  84. require$$0.render(App, container);
  85. })();
  86. })(preact);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址