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 🙏

© 2024 – Pkg Stats / Ryan Hefner

web-confirm

v1.0.2

Published

### 使用 该插件有四个参数,分别是标题、内容、按钮文案和按钮回调。文案和回调都是数组形式,因为是两个。

Downloads

1

Readme

一个提供确定、取消按钮的浏览器确认框插件

使用

该插件有四个参数,分别是标题、内容、按钮文案和按钮回调。文案和回调都是数组形式,因为是两个。

用法1:单行文本参数

    var Confirm = require('web-confirm');
    var c = new Confirm('导入教师','批量导入教师',['确定',"取消"],[function(){
        console.log('点击确定的回调');
    },function(){
        console.log('点击取消的回调');
        c.hide();
    }]);
    //调用show()方法
    c.show();

用法2:用html内容做参数,如下。当然,其中的 add-tc-content-box元素作为模板,需要事先在页面中写好,并隐藏。插件实例化之后,会自动删除模板。

    var Confirm = require('web-confirm');
    var addConfirm = new Confirm('添加教师', $('.add-tc-content-box'), ["确 定", "取 消"], [function () {
            console.log("确定")
        }, function () {
            addConfirm.hide();
        }]);

用法3:如果在弹窗显示前,需要在其中先给表单元素赋值,可以用editConfirm.ele方法获得弹窗的jquery对象。例如:editConfirm.ele.find('.J-work-num').val('KW0192')

        //编辑按钮
        $('.J-edit-btn').click(function () {
            var id = $(this).attr('item-id');
            //先根据ID拿到教师的信息,填充进弹窗中
            editConfirm.ele.find('.J-work-num').val('KW0192');
            editConfirm.ele.find('.J-name').val('爱新觉罗罗媚');
            editConfirm.show();
        })

有问题请联系:[email protected]