Socket
Socket
Sign inDemoInstall

gumshoejs

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.1 to 5.0.0

7

dist/gumshoe.js
/*!
* gumshoe v4.0.1
* gumshoejs v5.0.0
* A simple, framework-agnostic scrollspy script.

@@ -406,5 +406,4 @@ * (c) 2019 Chris Ferdinandi

* Initialize the current instantiation
* @param {Object} options User options and settings
*/
publicAPIs.init = function (options) {
var init = function () {

@@ -433,3 +432,3 @@ // Merge user options into defaults

publicAPIs.init(options);
init();
return publicAPIs;

@@ -436,0 +435,0 @@

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

/*! gumshoe v4.0.1 | (c) 2019 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/gumshoe */
!(function(t,n){"function"==typeof define&&define.amd?define([],(function(){return n(t)})):"object"==typeof exports?module.exports=n(t):t.Gumshoe=n(t)})("undefined"!=typeof global?global:"undefined"!=typeof window?window:this,(function(t){"use strict";var n={navClass:"active",contentClass:"active",nested:!1,nestedClass:"active",offset:0,reflow:!1,events:!0},e=function(t,n,e){if(e.settings.events){var o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});n.dispatchEvent(o)}},o=function(t){var n=0;if(t.offsetParent)for(;t;)n+=t.offsetTop,t=t.offsetParent;return n>=0?n:0},s=function(t){t.sort((function(t,n){return o(t.content)<o(n.content)?-1:1}))},i=function(t,n){var e=t.getBoundingClientRect(),o=(function(t){return"function"==typeof t.offset?parseFloat(t.offset()):parseFloat(t.offset)})(n);return parseInt(e.top,10)<=o&&parseInt(e.bottom,10)>o},r=function(t,n){if(n.nested){var e=t.parentNode.closest("li");e&&(e.classList.remove(n.nestedClass),r(e,n))}},a=function(t,n){if(t){var o=t.nav.closest("li");o&&(o.classList.remove(n.navClass),t.content.classList.remove(n.contentClass),r(o,n),e("gumshoeDeactivate",o,{link:t.nav,content:t.content,settings:n}))}},c=function(t,n){if(n.nested){var e=t.parentNode.closest("li");e&&(e.classList.add(n.nestedClass),c(e,n))}};return function(o,r){var f,l,u,d,v,p={};p.setup=function(){f=document.querySelectorAll(o),l=[],Array.prototype.forEach.call(f,(function(t){var n=document.getElementById(decodeURIComponent(t.hash.substr(1)));n&&l.push({nav:t,content:n})})),s(l)},p.detect=function(){var t=(function(t,n){for(var e=t.length-1;e>=0;e--)if(i(t[e].content,n))return t[e]})(l,v);t?u&&t.content===u.content||(a(u,v),(function(t,n){if(t){var o=t.nav.closest("li");o&&(o.classList.add(n.navClass),t.content.classList.add(n.contentClass),c(o,n),e("gumshoeActivate",o,{link:t.nav,content:t.content,settings:n}))}})(t,v),u=t):u&&(a(u,v),u=null)};var m=function(n){d&&t.cancelAnimationFrame(d),d=t.requestAnimationFrame(p.detect)},y=function(n){d&&t.cancelAnimationFrame(d),d=t.requestAnimationFrame((function(){s(),p.detect()}))};return p.destroy=function(){u&&a(u),t.removeEventListener("scroll",m,!1),v.reflow&&t.removeEventListener("resize",y,!1),l=null,f=null,u=null,d=null,v=null},p.init=function(e){v=(function(){var t={};return Array.prototype.forEach.call(arguments,(function(n){for(var e in n){if(!n.hasOwnProperty(e))return;t[e]=n[e]}})),t})(n,e||{}),p.setup(),p.detect(),t.addEventListener("scroll",m,!1),v.reflow&&t.addEventListener("resize",y,!1)},p.init(r),p}}));
/*! gumshoejs v5.0.0 | (c) 2019 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/gumshoe */
!(function(t,e){"function"==typeof define&&define.amd?define([],(function(){return e(t)})):"object"==typeof exports?module.exports=e(t):t.Gumshoe=e(t)})("undefined"!=typeof global?global:"undefined"!=typeof window?window:this,(function(t){"use strict";var e={navClass:"active",contentClass:"active",nested:!1,nestedClass:"active",offset:0,reflow:!1,events:!0},n=function(t,e,n){if(n.settings.events){var o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e.dispatchEvent(o)}},o=function(t){var e=0;if(t.offsetParent)for(;t;)e+=t.offsetTop,t=t.offsetParent;return e>=0?e:0},s=function(t){t.sort((function(t,e){return o(t.content)<o(e.content)?-1:1}))},r=function(t,e){var n=t.getBoundingClientRect(),o=(function(t){return"function"==typeof t.offset?parseFloat(t.offset()):parseFloat(t.offset)})(e);return parseInt(n.top,10)<=o&&parseInt(n.bottom,10)>o},a=function(t,e){if(e.nested){var n=t.parentNode.closest("li");n&&(n.classList.remove(e.nestedClass),a(n,e))}},i=function(t,e){if(t){var o=t.nav.closest("li");o&&(o.classList.remove(e.navClass),t.content.classList.remove(e.contentClass),a(o,e),n("gumshoeDeactivate",o,{link:t.nav,content:t.content,settings:e}))}},c=function(t,e){if(e.nested){var n=t.parentNode.closest("li");n&&(n.classList.add(e.nestedClass),c(n,e))}};return function(o,a){var l,f,u,d,v,p={};p.setup=function(){l=document.querySelectorAll(o),f=[],Array.prototype.forEach.call(l,(function(t){var e=document.getElementById(decodeURIComponent(t.hash.substr(1)));e&&f.push({nav:t,content:e})})),s(f)},p.detect=function(){var t=(function(t,e){for(var n=t.length-1;n>=0;n--)if(r(t[n].content,e))return t[n]})(f,v);t?u&&t.content===u.content||(i(u,v),(function(t,e){if(t){var o=t.nav.closest("li");o&&(o.classList.add(e.navClass),t.content.classList.add(e.contentClass),c(o,e),n("gumshoeActivate",o,{link:t.nav,content:t.content,settings:e}))}})(t,v),u=t):u&&(i(u,v),u=null)};var m=function(e){d&&t.cancelAnimationFrame(d),d=t.requestAnimationFrame(p.detect)},y=function(e){d&&t.cancelAnimationFrame(d),d=t.requestAnimationFrame((function(){s(),p.detect()}))};p.destroy=function(){u&&i(u),t.removeEventListener("scroll",m,!1),v.reflow&&t.removeEventListener("resize",y,!1),f=null,l=null,u=null,d=null,v=null};return v=(function(){var t={};return Array.prototype.forEach.call(arguments,(function(e){for(var n in e){if(!e.hasOwnProperty(n))return;t[n]=e[n]}})),t})(e,a||{}),p.setup(),p.detect(),t.addEventListener("scroll",m,!1),v.reflow&&t.addEventListener("resize",y,!1),p}}));
/*!
* gumshoe v4.0.1
* gumshoejs v5.0.0
* A simple, framework-agnostic scrollspy script.

@@ -445,5 +445,4 @@ * (c) 2019 Chris Ferdinandi

* Initialize the current instantiation
* @param {Object} options User options and settings
*/
publicAPIs.init = function (options) {
var init = function () {

@@ -472,3 +471,3 @@ // Merge user options into defaults

publicAPIs.init(options);
init();
return publicAPIs;

@@ -475,0 +474,0 @@

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

/*! gumshoe v4.0.1 | (c) 2019 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/gumshoe */
Element.prototype.closest||(Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest=function(t){var e=this;if(!document.documentElement.contains(this))return null;do{if(e.matches(t))return e;e=e.parentElement}while(null!==e);return null}),(function(){if("function"==typeof window.CustomEvent)return!1;function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}t.prototype=window.Event.prototype,window.CustomEvent=t})(),(function(t,e){"function"==typeof define&&define.amd?define([],(function(){return e(t)})):"object"==typeof exports?module.exports=e(t):t.Gumshoe=e(t)})("undefined"!=typeof global?global:"undefined"!=typeof window?window:this,(function(t){"use strict";var e={navClass:"active",contentClass:"active",nested:!1,nestedClass:"active",offset:0,reflow:!1,events:!0},n=function(t,e,n){if(n.settings.events){var o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e.dispatchEvent(o)}},o=function(t){var e=0;if(t.offsetParent)for(;t;)e+=t.offsetTop,t=t.offsetParent;return e>=0?e:0},s=function(t){t.sort((function(t,e){return o(t.content)<o(e.content)?-1:1}))},r=function(t,e){var n=t.getBoundingClientRect(),o=(function(t){return"function"==typeof t.offset?parseFloat(t.offset()):parseFloat(t.offset)})(e);return parseInt(n.top,10)<=o&&parseInt(n.bottom,10)>o},i=function(t,e){if(e.nested){var n=t.parentNode.closest("li");n&&(n.classList.remove(e.nestedClass),i(n,e))}},c=function(t,e){if(t){var o=t.nav.closest("li");o&&(o.classList.remove(e.navClass),t.content.classList.remove(e.contentClass),i(o,e),n("gumshoeDeactivate",o,{link:t.nav,content:t.content,settings:e}))}},a=function(t,e){if(e.nested){var n=t.parentNode.closest("li");n&&(n.classList.add(e.nestedClass),a(n,e))}};return function(o,i){var l,u,f,d,v,m={};m.setup=function(){l=document.querySelectorAll(o),u=[],Array.prototype.forEach.call(l,(function(t){var e=document.getElementById(decodeURIComponent(t.hash.substr(1)));e&&u.push({nav:t,content:e})})),s(u)},m.detect=function(){var t=(function(t,e){for(var n=t.length-1;n>=0;n--)if(r(t[n].content,e))return t[n]})(u,v);t?f&&t.content===f.content||(c(f,v),(function(t,e){if(t){var o=t.nav.closest("li");o&&(o.classList.add(e.navClass),t.content.classList.add(e.contentClass),a(o,e),n("gumshoeActivate",o,{link:t.nav,content:t.content,settings:e}))}})(t,v),f=t):f&&(c(f,v),f=null)};var p=function(e){d&&t.cancelAnimationFrame(d),d=t.requestAnimationFrame(m.detect)},E=function(e){d&&t.cancelAnimationFrame(d),d=t.requestAnimationFrame((function(){s(),m.detect()}))};return m.destroy=function(){f&&c(f),t.removeEventListener("scroll",p,!1),v.reflow&&t.removeEventListener("resize",E,!1),u=null,l=null,f=null,d=null,v=null},m.init=function(n){v=(function(){var t={};return Array.prototype.forEach.call(arguments,(function(e){for(var n in e){if(!e.hasOwnProperty(n))return;t[n]=e[n]}})),t})(e,n||{}),m.setup(),m.detect(),t.addEventListener("scroll",p,!1),v.reflow&&t.addEventListener("resize",E,!1)},m.init(i),m}}));
/*! gumshoejs v5.0.0 | (c) 2019 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/gumshoe */
Element.prototype.closest||(Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest=function(t){var e=this;if(!document.documentElement.contains(this))return null;do{if(e.matches(t))return e;e=e.parentElement}while(null!==e);return null}),(function(){if("function"==typeof window.CustomEvent)return!1;function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}t.prototype=window.Event.prototype,window.CustomEvent=t})(),(function(t,e){"function"==typeof define&&define.amd?define([],(function(){return e(t)})):"object"==typeof exports?module.exports=e(t):t.Gumshoe=e(t)})("undefined"!=typeof global?global:"undefined"!=typeof window?window:this,(function(t){"use strict";var e={navClass:"active",contentClass:"active",nested:!1,nestedClass:"active",offset:0,reflow:!1,events:!0},n=function(t,e,n){if(n.settings.events){var o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e.dispatchEvent(o)}},o=function(t){var e=0;if(t.offsetParent)for(;t;)e+=t.offsetTop,t=t.offsetParent;return e>=0?e:0},s=function(t){t.sort((function(t,e){return o(t.content)<o(e.content)?-1:1}))},r=function(t,e){var n=t.getBoundingClientRect(),o=(function(t){return"function"==typeof t.offset?parseFloat(t.offset()):parseFloat(t.offset)})(e);return parseInt(n.top,10)<=o&&parseInt(n.bottom,10)>o},c=function(t,e){if(e.nested){var n=t.parentNode.closest("li");n&&(n.classList.remove(e.nestedClass),c(n,e))}},i=function(t,e){if(t){var o=t.nav.closest("li");o&&(o.classList.remove(e.navClass),t.content.classList.remove(e.contentClass),c(o,e),n("gumshoeDeactivate",o,{link:t.nav,content:t.content,settings:e}))}},a=function(t,e){if(e.nested){var n=t.parentNode.closest("li");n&&(n.classList.add(e.nestedClass),a(n,e))}};return function(o,c){var l,u,f,d,v,m={};m.setup=function(){l=document.querySelectorAll(o),u=[],Array.prototype.forEach.call(l,(function(t){var e=document.getElementById(decodeURIComponent(t.hash.substr(1)));e&&u.push({nav:t,content:e})})),s(u)},m.detect=function(){var t=(function(t,e){for(var n=t.length-1;n>=0;n--)if(r(t[n].content,e))return t[n]})(u,v);t?f&&t.content===f.content||(i(f,v),(function(t,e){if(t){var o=t.nav.closest("li");o&&(o.classList.add(e.navClass),t.content.classList.add(e.contentClass),a(o,e),n("gumshoeActivate",o,{link:t.nav,content:t.content,settings:e}))}})(t,v),f=t):f&&(i(f,v),f=null)};var p=function(e){d&&t.cancelAnimationFrame(d),d=t.requestAnimationFrame(m.detect)},E=function(e){d&&t.cancelAnimationFrame(d),d=t.requestAnimationFrame((function(){s(),m.detect()}))};m.destroy=function(){f&&i(f),t.removeEventListener("scroll",p,!1),v.reflow&&t.removeEventListener("resize",E,!1),u=null,l=null,f=null,d=null,v=null};return v=(function(){var t={};return Array.prototype.forEach.call(arguments,(function(e){for(var n in e){if(!e.hasOwnProperty(n))return;t[n]=e[n]}})),t})(e,c||{}),m.setup(),m.detect(),t.addEventListener("scroll",p,!1),v.reflow&&t.addEventListener("resize",E,!1),m}}));
{
"name": "gumshoejs",
"version": "4.0.1",
"version": "5.0.0",
"description": "A simple, framework-agnostic scrollspy script.",

@@ -5,0 +5,0 @@ "main": "./dist/js/gumshoe.min.js",

@@ -6,2 +6,3 @@ # Gumshoe [![Build Status](https://travis-ci.org/cferdinandi/gumshoe.svg)](https://travis-ci.org/cferdinandi/gumshoe)

[Getting Started](#getting-started) | [Nested Navigation](#nested-navigation) | [Reflows](#catching-reflows) | [Fixed Headers](#accounting-for-fixed-headers) | [API](#api) | [What's new?](#whats-new) | [Browser Compatibility](#browser-compatibility) | [License](#license)

@@ -250,42 +251,7 @@ <hr>

#### init()
Reinitialize Gumshoe. This is called automatically when you instantiate your `new Gumshoe` object, but can be used to reinitialize your instance after running `destroy()`.
**Example**
```javascript
var spy = new Gumshoe('#my-awesome-nav a');
spy.destroy();
// Some time later...
spy.init({
// New options
});
```
## What's new?
## Working with the Source Files
If you would prefer, you can work with the development code in the `src` directory using the included [Gulp build system](http://gulpjs.com/). This compiles, lints, and minifies code.
### Dependencies
Make sure these are installed first.
* [Node.js](http://nodejs.org)
* [Gulp](http://gulpjs.com) `sudo npm install -g gulp`
### Quick Start
1. In bash/terminal/command line, `cd` into your project directory.
2. Run `npm install` to install required files.
3. When it's done installing, run one of the task runners to get going:
* `gulp` manually compiles files.
* `gulp watch` automatically compiles files when changes are made and applies changes using [LiveReload](http://livereload.com/).
## Migrating to Gumshoe 4 from Older Versions
Gumshoe 4 is a ground-up rewrite.

@@ -307,2 +273,3 @@

- Automatic header offsetting has been removed.
- The public `init()` method has been deprecated.

@@ -309,0 +276,0 @@

@@ -398,5 +398,4 @@ (function (root, factory) {

* Initialize the current instantiation
* @param {Object} options User options and settings
*/
publicAPIs.init = function (options) {
var init = function () {

@@ -425,3 +424,3 @@ // Merge user options into defaults

publicAPIs.init(options);
init();
return publicAPIs;

@@ -428,0 +427,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc