npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

monkeyscript

v0.3.2

Published

主要应用于浏览器插件油猴脚本的非正常函数或功能

Readme

主要应用于浏览器插件油猴脚本的非常规函数或功能

注意:使用了?. startsWith includes等api 请注意打包的时候进行编译以便处理兼容性问题

Usage

  1. 异步获取元素
  • 由于延迟15ms获取,如果立即处理删除dom节点可能会出现闪烁的情况。如确实需要移除dom节点,建议添加css隐藏dom后再使用此功能
  • 由于获取到结果就立即返回,如果想获取所有元素可能会出现丢失的情况,建议指定元素
// 测试网站 bilibili https://www.bilibili.com/video/*
import { querySelectorAll } from 'monkeyscript'
function querySelector(){
    return querySelectorAll(...arguments).then( res => res[0]);
};
const base = performance.now();
querySelector('[class="bui-danmaku-switch-input"').then((res) => {
    console.log('总计用时', performance.now() - base)
    console.log("弹幕[class]", res);
});
querySelector('.bui-danmaku-switch-input').then((res) => {
    console.log("总计用时", performance.now() - base);
    console.log("弹幕.bui", res);
});
querySelector('.bpx-player-sending-area input.bui-checkbox-input').then((res) => {
    console.log("总计用时", performance.now() - base);
    console.log("弹幕.check", res);
});

// 测试网站 ****
// 获取同域iframe内元素栗子,不支持跨域
querySelector('#renewframe').then( res => {
    console.log("总计用时 iframe", performance.now() - base);
    return querySelector('.kclist1.fl dl:nth-of-type(3)', res)
}).then( res => {
    console.log("总计用时", performance.now() - base);
    console.log('我也不知道啥用途的 dl', res)
})

License

MIT

[0.3.2] - 2023-06-10

调整优化允许import和require两种方式使用

[0.3.1] - 2022-10-10

修复parseHeaderMeta获取最后一个块注释时的bug

[0.3.0] - 2022-10-04

新增 parseHeaderMeta 提取文件头部注释

[0.2.1] - 2022-10-03

添加 调整jsdoc提示

[0.2.0] - 2022-10-02

修改为ES modules

优化 独立出来awaitDocument

优化 定时器内执行查询,理论上监听所有节点和attr,如果监听都获取不到,定时器也获取不到,这里只起个兜底安慰效果

[0.1.0] - 2022-09-24

添加 异步获取元素