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

@berlinsms/overlay

v1.0.5

Published

jQuery-Plugin to popup an overlay with your own DOM. Arrage your DOM in pages and switch between pages

Downloads

3

Readme

jQuery Overlay

Homepage

Description

A jquery-plugin to popup an overlay.

The overlay can carry each dom you want.

The dom-elements are arranged in pages.

You can easy flipp between pages and hide and show them together with the oyerlay

Usage

Download js and css for bsms-overlay

https://static.berlinsms.de/toolsforcoder/overlay/dist/bsms-overlay.min.js
https://static.berlinsms.de/toolsforcoder/overlay/dist/bsms-overlay.css

Include jquery and js+css for bsms-overlay

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link rel="stylesheet" href="bsms-overlay.css">
<script src="bsms-overlay.min.js"></script>

Assign overlay to your dom, but make sure, the script is fully loaded, before you assign overlay, e.g. use jquerys 'ready'

$(document).ready(function () {
    $.bsmsOverlay();
});    

Create pages for the overlay.

$(document).ready(function () {
    $.bsmsOverlay()
        .addPage();
});    

Add callbacks, if you need whem:

$(document).ready(()=>{
    $.bsmsOverlay( { closeRequested: overlayCloseRequested, onClose: overlayOnClose } );
});    
function overlayCloseRequested() {
    return confirm('Close overlay ?');
}
function overlayOnClose() {
    alert('Overlay closed');
}

If you store the return value, you can use it, to add content or show or hide the previously created page

$(document).ready(function () {
    const $page1 = $.bsmsOverlay()
        .addPage();
    $page1.append($('<p>This is any content</p>'));
    $page1.show();
});   

It is not neccessary, to store the return value, if you provide a page-identifier

$(document).ready(function () {
    $.bsmsOverlay()
        .addPage('page-id-1');
    $.bsmsOverlay()
        .getPage('page-id-1').show();
}

And of course you can use jQuerys object-chains

$(document).ready(function () {
    const $overlay = $.bsmsOverlay()
        .addPage('page-id-1',$('<p>This is page 1 content</p>'))
        .addPage('page-id-2',$('<p>This is page 2 content</p>'))
        .showPage('page-id-1,'Title-Text on Page 1')
        .getPage('page-id-2')
        .append($('<p>More content on page 2</p>'))
        .addPage('page-id-3',$('<p>This is page 3 content</p>'));
}

Options

| Option | DESCRIPTION | DEFAULT | |----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------| | fadeInDuration | Duration the pages need to fadeIn | 500 | | closeRequested | Callback that fires when the user clicks the cross in the top right corner.- Return true to enable closing- Return false to undo the close. | null(allow close) | | onClose | Callback triggered when overlay is closed | null | | showClose | shows the close-cross | true | | showCredits | shows credits | true |

Functions

| Option | Parameter | DESCRIPTION | |----------|------------------------------|-----------------------------------------------| | addPage | pagename, title, $dom | Creates a new page containing the given DOM | | getPage | pagename | Retrieves a page | | showPage | pagename, title, afterFadeIn | Shows a page (and calls the callback after) | | hide | | Hides the overlay | | show | | Shows the overlay |

Meaning of the parameters

| Parameter | Default | Description | |-------------|----------------|--------------------------------------------------------------------------------------| | pagename | auto-generated | page-identifier, that you can use to access to a page (will not be shown on page) | | title | null | Title-text, that will be showed on the top of a page (null=dont change current title | | $dom | null | Jquery-Object, that will be append to a page | | afterFadeIn | null | Callback triggered when page-fade-in is finished (see fadeInDuration-option) |

Remarks:

  • if pagename is unknow, it will create a page with this pagename

  • if pagename is empty, a random pagename is generated

  • show: in page-context it will open this page, but in context of the overlay itself it opens the last shown page or an empty-page, if there is no last shown page