New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dont-go

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dont-go - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

lib/dont-go.js

@@ -1,2 +0,2 @@

function t(t){void 0===t&&(t={});var e,i,n,o,c=Object.assign({title:"Don't go!",faviconSrc:"",timeout:0,interval:1e3},t),l=document.title,r=0;document.querySelectorAll('link[rel$="icon"]').length&&(e=document.querySelector('link[rel$="icon"]'),i=e.getAttribute("href")),c.faviconSrc.length&&((new Image).src=c.faviconSrc);var u=function(){"string"==typeof c.title?document.title=c.title:(document.title=c.title[0],o=setInterval(a,c.interval)),c.faviconSrc.length&&e.setAttribute("href",c.faviconSrc)},a=function(){++r>=c.title.length&&(r=0),document.title=c.title[r]};document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState?c.timeout>0?n=setTimeout(u,c.timeout):u():(document.title=l,e.setAttribute("href",i),clearTimeout(n),clearInterval(o))})}module.exports=t;
module.exports=function(t){void 0===t&&(t={});var e,i,n,o,c=Object.assign({title:"Don't go!",faviconSrc:"",timeout:0,interval:1e3},t),l=document.title,r=0;document.querySelectorAll('link[rel$="icon"]').length&&(e=document.querySelector('link[rel$="icon"]'),i=e.getAttribute("href")),c.faviconSrc.length&&((new Image).src=c.faviconSrc);var u=function(){"string"==typeof c.title?document.title=c.title:(document.title=c.title[0],o=setInterval(a,c.interval)),c.faviconSrc.length&&e.setAttribute("href",c.faviconSrc)},a=function(){++r>=c.title.length&&(r=0),document.title=c.title[r]};document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState?c.timeout>0?n=setTimeout(u,c.timeout):u():(document.title=l,e.setAttribute("href",i),clearTimeout(n),clearInterval(o))})};
//# sourceMappingURL=dont-go.js.map

@@ -1,61 +0,2 @@

function dontGo(options) {
if ( options === void 0 ) options = {};
var defaults = {
title: "Don't go!",
faviconSrc: '',
timeout: 0,
interval: 1000
};
var opts = Object.assign(defaults, options);
var originalTitle = document.title;
var favicon;
var originalFavicon;
var img;
var timeout;
var interval;
var counter = 0;
if (document.querySelectorAll('link[rel$="icon"]').length) {
favicon = document.querySelector('link[rel$="icon"]');
originalFavicon = favicon.getAttribute('href');
}
if (opts.faviconSrc.length) {
img = new Image();
img.src = opts.faviconSrc;
}
var setHidden = function () {
if (typeof opts.title === 'string') {
document.title = opts.title;
} else {
document.title = opts.title[0];
interval = setInterval(nextTitle, opts.interval);
}
if (opts.faviconSrc.length) {
favicon.setAttribute('href', opts.faviconSrc);
}
};
var nextTitle = function () {
counter++;
if (counter >= opts.title.length) {
counter = 0;
}
document.title = opts.title[counter];
};
document.addEventListener('visibilitychange', function () {
if (document.visibilityState === 'hidden') {
if (opts.timeout > 0) {
timeout = setTimeout(setHidden, opts.timeout);
} else {
setHidden();
}
} else {
document.title = originalTitle;
favicon.setAttribute('href', originalFavicon);
clearTimeout(timeout);
clearInterval(interval);
}
});
}
export default dontGo;
export default function(t){void 0===t&&(t={});var e,i,n,c,l=Object.assign({title:"Don't go!",faviconSrc:"",timeout:0,interval:1e3},t),o=document.title,r=0;document.querySelectorAll('link[rel$="icon"]').length&&(e=document.querySelector('link[rel$="icon"]'),i=e.getAttribute("href")),l.faviconSrc.length&&((new Image).src=l.faviconSrc);var u=function(){"string"==typeof l.title?document.title=l.title:(document.title=l.title[0],c=setInterval(a,l.interval)),l.faviconSrc.length&&e.setAttribute("href",l.faviconSrc)},a=function(){++r>=l.title.length&&(r=0),document.title=l.title[r]};document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState?l.timeout>0?n=setTimeout(u,l.timeout):u():(document.title=o,e.setAttribute("href",i),clearTimeout(n),clearInterval(c))})}
//# sourceMappingURL=dont-go.m.js.map
{
"name": "dont-go",
"version": "1.1.0",
"version": "1.1.1",
"description": "Client-side library to change the title and/or favicon of the page when it is inactive",
"author": "Tiaan du Plessis @tiaanduplessis",
"license": "MIT",
"source": "src/index.js",
"main": "lib/dont-go.js",
"module": "lib/dont-go.m.js",
"browser": "lib/dont-go.umd.js",
"keywords": [

@@ -19,3 +22,4 @@ "title",

"format": "prettier-standard src/index.js",
"test": "npm run format"
"lint": "standard --fix src/*.js",
"test": "npm run lint && npm run format"
},

@@ -34,6 +38,7 @@ "repository": {

"devDependencies": {
"gh-pages": "^1.0.0",
"microbundle": "^0.2.4",
"prettier-standard": "^8.0.0"
"gh-pages": "^2.0.1",
"microbundle": "^0.7.0",
"prettier-standard": "^8.0.1",
"standard": "^12.0.1"
}
}

@@ -29,19 +29,14 @@ <p align="center">

</div>
<br>
<div align="center">
Built with ❤︎ by <a href="http://tiaanduplessis.co.za/">Tiaan du Plessis</a> and <a href="https://github.com/tiaanduplessis/wenk/graphs/contributors">contributors</a>
</div>
<h2>Table of Contents</h2>
<details>
<summary>Table of Contents</summary>
<li><a href="#about">about</a></li>
<li><a href="#install">Install</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#demo">Demo</a></li>
<li><a href="#examples">Examples</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#license">License</a></li>
</details>
## Table of Contents
- [About](#about)
- [As Seen In](#as-seen-in)
- [Install](#install)
- [Usage](#usage)
- [Demo](#demo)
- [Examples](#examples)
- [Contributing](#contributing)
- [license](#license)
## About

@@ -55,2 +50,6 @@

## As Seen In
- [This Clever Trick Brings Visitors Back When They Tab Away](https://www.hongkiat.com/blog/dont-go-favicon-title/)
## Install

@@ -57,0 +56,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc