🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

vue-smoothscroll

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-smoothscroll - npm Package Compare versions

Comparing version

to
0.0.4

{
"name": "vue-smoothscroll",
"homepage": "http://www.eicoding.com",
"version": "0.0.3",
"version": "0.0.4",
"description": "it's a vuejs version of smoothscroll",

@@ -6,0 +6,0 @@ "author": "teddyzhu",

@@ -16,3 +16,3 @@ //

// Vue By Teddy Zhu
module.exports = function(Vue) {
module.exports = function (Vue) {

@@ -53,3 +53,3 @@ // Scroll Variables (tweakable)

var isFrame = false;
var direction = { x: 0, y: 0 };
var direction = {x: 0, y: 0};
var initDone = false;

@@ -74,4 +74,6 @@ var root = document.documentElement;

};
var wheelEvent;
var isRun = false;
var fullPageElem;
var clearfix;
/***********************************************

@@ -116,8 +118,8 @@ * INITIALIZE

/**
* Please duplicate this radar for a Safari fix!
* Please duplicate this radar for a Safari fix!
* rdar://22376037
* https://openradar.appspot.com/radar?id=4965070979203072
*
*
* Only applies to Safari now, Chrome fixed it in v45:
* This fixes a bug where the areas left and right to
* This fixes a bug where the areas left and right to
* the content does not trigger the onmousewheel event

@@ -128,5 +130,5 @@ * on some pages. e.g.: html, body { height: 100% }

(body.offsetHeight <= windowHeight ||
html.offsetHeight <= windowHeight)) {
html.offsetHeight <= windowHeight)) {
var fullPageElem = document.createElement('div');
fullPageElem = document.createElement('div');
fullPageElem.style.cssText = 'position:absolute; z-index:-10000; ' +

@@ -139,5 +141,5 @@ 'top:0; left:0; right:0; height:' +

var pendingRefresh;
refreshSize = function() {
refreshSize = function () {
if (pendingRefresh) return; // could also be: clearTimeout(pendingRefresh);
pendingRefresh = setTimeout(function() {
pendingRefresh = setTimeout(function () {
if (isExcluded) return; // could be running after cleanup

@@ -159,3 +161,3 @@ fullPageElem.style.height = '0';

characterData: false
// subtree: true
// subtree: true
};

@@ -167,3 +169,3 @@

if (root.offsetHeight <= windowHeight) {
var clearfix = document.createElement('div');
clearfix = document.createElement('div');
clearfix.style.clear = 'both';

@@ -185,8 +187,15 @@ body.appendChild(clearfix);

function cleanup() {
observer && observer.disconnect();
removeEvent(wheelEvent, wheel);
removeEvent('mousedown', mousedown);
removeEvent('keydown', keydown);
removeEvent('resize', refreshSize);
removeEvent('load', init);
if (isRun) {
observer && observer.disconnect();
removeEvent(wheelEvent, wheel);
removeEvent('mousedown', mousedown);
removeEvent('keydown', keydown);
removeEvent('resize', refreshSize);
removeEvent('load', init);
fullPageElem && document.body.removeChild(fullPageElem);
clearfix && document.body.removeChild(clearfix);
fullPageElem = null;
clearfix = null;
isRun = false;
}
}

@@ -196,3 +205,3 @@

/************************************************
* SCROLLING
* SCROLLING
************************************************/

@@ -241,3 +250,3 @@

var step = function(time) {
var step = function (time) {

@@ -414,3 +423,3 @@ var now = Date.now();

if ((isNodeName(target, 'button') ||
isNodeName(target, 'input') && buttonTypes.test(target.type)) &&
isNodeName(target, 'input') && buttonTypes.test(target.type)) &&
event.keyCode === key.spacebar) {

@@ -480,5 +489,5 @@ return true;

var uniqueID = (function() {
var uniqueID = (function () {
var i = 0;
return function(el) {
return function (el) {
return el.uniqueID || (el.uniqueID = i++);

@@ -495,3 +504,5 @@ };

clearTimeout(clearCacheTimer);
clearCacheTimer = setInterval(function() { cache = {}; }, 1 * 1000);
clearCacheTimer = setInterval(function () {
cache = {};
}, 1 * 1000);
}

@@ -594,3 +605,3 @@

clearTimeout(deltaBufferTimer);
deltaBufferTimer = setTimeout(function() {
deltaBufferTimer = setTimeout(function () {
if (window.localStorage) {

@@ -609,4 +620,4 @@ localStorage.SS_deltaBuffer = deltaBuffer.join(',');

return (isDivisible(deltaBuffer[0], divisor) &&
isDivisible(deltaBuffer[1], divisor) &&
isDivisible(deltaBuffer[2], divisor));
isDivisible(deltaBuffer[1], divisor) &&
isDivisible(deltaBuffer[2], divisor));
}

@@ -620,3 +631,3 @@

isControl = (elem.classList &&
elem.classList.contains('html5-video-controls'));
elem.classList.contains('html5-video-controls'));
if (isControl) break;

@@ -628,18 +639,18 @@ } while (elem = elem.parentNode);

var requestFrame = (function() {
var requestFrame = (function () {
return (window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function(callback, element, delay) {
window.setTimeout(callback, delay || (1000 / 60));
});
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function (callback, element, delay) {
window.setTimeout(callback, delay || (1000 / 60));
});
})();
var MutationObserver = (window.MutationObserver ||
window.WebKitMutationObserver ||
window.MozMutationObserver);
window.WebKitMutationObserver ||
window.MozMutationObserver);
var getScrollRoot = (function() {
var getScrollRoot = (function () {
var SCROLL_ROOT;
return function() {
return function () {
if (!SCROLL_ROOT) {

@@ -715,3 +726,2 @@ var dummy = document.createElement('div');

var wheelEvent;
if ('onwheel' in document.createElement('div'))

@@ -727,3 +737,3 @@ wheelEvent = 'wheel';

}
isRun = true;
}

@@ -745,2 +755,3 @@

window.SmoothScroll = SmoothScroll;
if (window.SmoothScrollOptions) // async API

@@ -751,3 +762,3 @@ SmoothScroll(window.SmoothScrollOptions)

$SmoothScroll: {
get: function() {
get: function () {
return SmoothScroll;

@@ -759,3 +770,2 @@ }

}