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 🙏

© 2025 – Pkg Stats / Ryan Hefner

uncensore

v1.0.0

Published

Tiny library to reveal uncensored thoughts

Readme

Uncensore.js

Tiny library to reveal uncensored thoughts.

Installation

npm install --save uncensore

Markup

Markup defines only 2 custom HTML5 attributes.

1. data-censore

As the rule this attribute applies to inline element, because assumes to wrap short phrase only.

<span data-censore="бля">видете ли</span>

2. data-uncensore

data-uncensore attribute applies to uncensore container element in case if application state is active, otherwise it's does not simply exists. This attribute appears automaticly and doesn't need to be set manually.

Usage

Note: in examples below concrete class object overrides class itself. it's not good practice, however simple example not assumed to use few class object simultaneously.

1. Include

Direct include

Include script into your project and execute code right after DOM loaded.

<!-- ... -->
<script src="/static/assets/vendor/unsektor/uncensore.js"></script>
<script>
window.addEventListener('DOMContentLoaded', function (e) {
    var uncensore = new uncensore();
});
</script>
</body>
<!-- ... -->

Include in frontend application

// AMD
define(['uncensore'], function (uncensore) {
    // ...
})

// ES6 / ES2015 module
import uncensore from 'uncensore'

// CommonJS
var uncensore = require('unsektor/uncensore');

// Property of window object
window.uncensore()
// ... or simply 
uncensore();

2. Use

Example 1 (Simplest way):

// Make sure that library initialization is not before DOM loaded, because
// it's required to detect application state for instant highligth.
window.addEventListener('DOMContentLoaded', function () {
    window.uncensore = new uncensore();
});

Example 2 (Example 1 + customization):

// Custom uncensore container DOM element
var uncensoreContainer = document.querySelector('#myContainer');

// Web-site page URI to redirect user first time used this function
var uncensoreInfoPageURI = window.location.protocol + '//www.example.tld/censore';

var uncensore = new uncensore(uncensoreContainer, {
    'uri': uncensoreInfoPageURI
});

Example 3 (Example 2 + domain configuration):

If your web-aplplication also serves subdomains, it's required to define base domain (e.g., 'example.tld').

// Custom uncensore container DOM element
var uncensoreContainer = document.body;

// Web-site page URI to redirect user first time used this function
var uncensoreInfoPageURI = window.location.protocol + '//www.example.tld/censore';

// Domain configuration option (e.g., 'example.com' or 'subdomain.example.com'). 
// If not specified, defaults to the host portion of the current document location 
// (but not including subdomains).
var uncensoreDomain = 'example.tld';

var uncensore = new uncensore(uncensoreContainer, {
    'uri': uncensoreInfoPageURI,
    'domain': uncensoreDomain
});

Example 4 (Example 3 + Custom code):

var uncensore = require('unsektor/uncensore');
var uncensoreContainer = document.body;

/* @group Optional code block */
var censureToggledHandler = function (e) {
    if (!e.detail.state){
        e.detail.censoredElement.removeAttribute('aria-label');
        e.detail.censoredElement.classList.remove('tooltipped', 'tooltipped-n')
    } else {
        if (e.detail.censureValueBefore !== "") {
            e.detail.censoredElement.setAttribute('aria-label', e.detail.censureValueBefore);
            e.detail.censoredElement.classList.add('tooltipped', 'tooltipped-n')
        }
    }
};

// Subscribe handler callback function to uncencsore container to handle uncensore toggle action event.
uncensoreContainer.addEventListener('censureToggled', censureToggledHandler);
/* @end */

window.uncensore = new uncensore(uncensoreContainer, {
    'uri': uncensoreInfoPageURI,
    'domain': uncensoreDomain
});

if uncensore instance defined in global scope, you may toggle application mode manually. It's useful to build web-site page to warn user first time used this function. For example:

<!-- ... -->
<div class="button" onclick="uncensore.toggle();">
    <span data-censore="Bring the fucking censore back">Turn censore off</span>
</div>
<!-- ... -->

3. Stylization

This library is not specially designed to be compatible with each markup methodology, because idea assumes to hide censored content, especially from SEO robots.

// SCSS code

/* Censored element stylization */
[data-censore] {
  // disabled state
  border-bottom: 1px rgba(0, 0, 0, .12) dotted;

  // enabled state
  body[data-uncensore] & {
    background: rgba(255, 0, 0, .08);
    cursor: pointer;
    transition: background-color .3s ease;
    border-bottom-color: transparent;
  }
}

/* Other element stylization depending on uncensore application state */
.censore-block {
  // disabled state
  color: white;

  // enabled state
  body[data-uncensore] & {
    color: red;
  }
}

// Note: code will be different in case if your application uses not-standard container element.

Finally, writing some custom code using event system (like in example 4) makes possible to extend this application as needed.

Keyboard shortuct

This library also provides a keyboard shortcut to toggle application state ⌥D (Alt + D).

Acknowledgment

  • Александр Котомкин
  • Анна Желяк

Change Log

License ISC