Add-Link-To-NPM-Devtool-Tech

add an link to npm devtool tech in npm package page

Verze ze dne 18. 05. 2022. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name                Add-Link-To-NPM-Devtool-Tech
// @name:zh-CN          给npm包添加一个到NPM-Devtool-Tech的链接
// @namespace           http://tampermonkey.net/
// @version             0.0.1
// @description         add an link to npm devtool tech in npm package page
// @description:zh-CN   add an link to npm devtool tech in npm package page
// @author              kkopite
// @match               https://www.npmjs.com/package/*
// @icon                https://www.google.com/s2/favicons?sz=64&domain=www.npmjs.com
// @grant               none
// ==/UserScript==

(function () {
  'use strict'

  const h3s = document.querySelectorAll('h3')
  let h3 = [...h3s].find(h => h.innerText === 'Install')

  const link = document.createElement('div')
  const url = `https://npm.devtool.tech/${window.location.pathname.split('/')[2]}`
  link.innerHTML = `
  <div class="dib w-50 bb b--black-10 pr2 w-100">
    <h3 id="devtoolTech" class="f5 mt2 pt2 mb0">DevTool Tech</h3>
    <p class="_40aff104 fw6 mb3 mt2 truncate black-80 f5">
      <a aria-labelledby="DevTool Tech" class="b2812e30 f2874b88 fw6 mb3 mt2 truncate black-80 f4 link" href="${url}" target="_blank" rel="noopener noreferrer nofollow">
      <span>${url}</span>
      </a>
    </p>
  </div>
  `

  h3.parentNode.insertBefore(link, h3.nextSibling.nextSibling)

})()