mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-24 01:20:37 +03:00
version 1.7.3
This commit is contained in:
@@ -2,13 +2,13 @@
|
|||||||
* OverlayScrollbars
|
* OverlayScrollbars
|
||||||
* https://github.com/KingSora/OverlayScrollbars
|
* https://github.com/KingSora/OverlayScrollbars
|
||||||
*
|
*
|
||||||
* Version: 1.7.2
|
* Version: 1.7.3
|
||||||
*
|
*
|
||||||
* Copyright KingSora.
|
* Copyright KingSora.
|
||||||
* https://github.com/KingSora
|
* https://github.com/KingSora
|
||||||
*
|
*
|
||||||
* Released under the MIT license.
|
* Released under the MIT license.
|
||||||
* Date: 10.06.2019
|
* Date: 23.06.2019
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+90
-70
@@ -2,13 +2,13 @@
|
|||||||
* OverlayScrollbars
|
* OverlayScrollbars
|
||||||
* https://github.com/KingSora/OverlayScrollbars
|
* https://github.com/KingSora/OverlayScrollbars
|
||||||
*
|
*
|
||||||
* Version: 1.7.2
|
* Version: 1.7.3
|
||||||
*
|
*
|
||||||
* Copyright KingSora.
|
* Copyright KingSora.
|
||||||
* https://github.com/KingSora
|
* https://github.com/KingSora
|
||||||
*
|
*
|
||||||
* Released under the MIT license.
|
* Released under the MIT license.
|
||||||
* Date: 10.06.2019
|
* Date: 23.06.2019
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
@@ -1665,6 +1665,7 @@
|
|||||||
var scrollbarDummyElement = FRAMEWORK('<div id="os-dummy-scrollbar-size"><div></div></div>');
|
var scrollbarDummyElement = FRAMEWORK('<div id="os-dummy-scrollbar-size"><div></div></div>');
|
||||||
var scrollbarDummyElement0 = scrollbarDummyElement[0];
|
var scrollbarDummyElement0 = scrollbarDummyElement[0];
|
||||||
var dummyContainerChild = FRAMEWORK(scrollbarDummyElement.children('div').eq(0));
|
var dummyContainerChild = FRAMEWORK(scrollbarDummyElement.children('div').eq(0));
|
||||||
|
var getCptStyle = window.getComputedStyle;
|
||||||
|
|
||||||
bodyElement.append(scrollbarDummyElement);
|
bodyElement.append(scrollbarDummyElement);
|
||||||
scrollbarDummyElement.hide().show(); //fix IE8 bug (incorrect measuring)
|
scrollbarDummyElement.hide().show(); //fix IE8 bug (incorrect measuring)
|
||||||
@@ -1689,7 +1690,7 @@
|
|||||||
//scrollbarDummyElement.css(strOverflow, strHidden).hide().css(strOverflow, strScroll).show();
|
//scrollbarDummyElement.css(strOverflow, strHidden).hide().css(strOverflow, strScroll).show();
|
||||||
//return (scrollbarDummyElement0[LEXICON.oH] - scrollbarDummyElement0[LEXICON.cH]) === 0 && (scrollbarDummyElement0[LEXICON.oW] - scrollbarDummyElement0[LEXICON.cW]) === 0;
|
//return (scrollbarDummyElement0[LEXICON.oH] - scrollbarDummyElement0[LEXICON.cH]) === 0 && (scrollbarDummyElement0[LEXICON.oW] - scrollbarDummyElement0[LEXICON.cW]) === 0;
|
||||||
|
|
||||||
return scrollbarDummyElement.css('scrollbar-width') === 'none' || window.getComputedStyle(scrollbarDummyElement0, '::-webkit-scrollbar').getPropertyValue('display') === 'none';
|
return scrollbarDummyElement.css('scrollbar-width') === 'none' || (getCptStyle ? getCptStyle(scrollbarDummyElement0, '::-webkit-scrollbar').getPropertyValue('display') === 'none' : false);
|
||||||
})(),
|
})(),
|
||||||
overlayScrollbarDummySize : { x: 30, y: 30 },
|
overlayScrollbarDummySize : { x: 30, y: 30 },
|
||||||
msie : (function() {
|
msie : (function() {
|
||||||
@@ -2211,6 +2212,8 @@
|
|||||||
//MutationObserver:
|
//MutationObserver:
|
||||||
var _mutationObserverHost;
|
var _mutationObserverHost;
|
||||||
var _mutationObserverContent;
|
var _mutationObserverContent;
|
||||||
|
var _mutationObserverHostCallback;
|
||||||
|
var _mutationObserverContentCallback;
|
||||||
var _mutationObserversConnected;
|
var _mutationObserversConnected;
|
||||||
|
|
||||||
//textarea:
|
//textarea:
|
||||||
@@ -2520,67 +2523,72 @@
|
|||||||
var sizeAuto;
|
var sizeAuto;
|
||||||
var action;
|
var action;
|
||||||
|
|
||||||
_mutationObserverHost = new mutationObserver(function (mutations) {
|
_mutationObserverHostCallback = function(mutations) {
|
||||||
if (!_initialized || _isSleeping)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var doUpdate = false;
|
var doUpdate = false;
|
||||||
var mutation;
|
var mutation;
|
||||||
FRAMEWORK.each(mutations, function () {
|
|
||||||
mutation = this;
|
if (_initialized && !_isSleeping) {
|
||||||
mutationTarget = mutation.target;
|
FRAMEWORK.each(mutations, function () {
|
||||||
mutationAttrName = mutation.attributeName;
|
mutation = this;
|
||||||
|
mutationTarget = mutation.target;
|
||||||
|
mutationAttrName = mutation.attributeName;
|
||||||
|
|
||||||
if (mutationAttrName === LEXICON.c)
|
if (mutationAttrName === LEXICON.c)
|
||||||
doUpdate = hostClassNamesChanged(mutation.oldValue, mutationTarget.className);
|
doUpdate = hostClassNamesChanged(mutation.oldValue, mutationTarget.className);
|
||||||
else if (mutationAttrName === LEXICON.s)
|
else if (mutationAttrName === LEXICON.s)
|
||||||
doUpdate = mutation.oldValue !== mutationTarget[LEXICON.s].cssText;
|
doUpdate = mutation.oldValue !== mutationTarget[LEXICON.s].cssText;
|
||||||
else
|
else
|
||||||
doUpdate = true;
|
doUpdate = true;
|
||||||
|
|
||||||
|
if (doUpdate)
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
if (doUpdate)
|
if (doUpdate)
|
||||||
return false;
|
_base.update(_strAuto);
|
||||||
});
|
}
|
||||||
|
return doUpdate;
|
||||||
if (doUpdate)
|
};
|
||||||
_base.update(_strAuto);
|
_mutationObserverContentCallback = function (mutations) {
|
||||||
});
|
|
||||||
_mutationObserverContent = new mutationObserver(function (mutations) {
|
|
||||||
if (!_initialized || _isSleeping)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var doUpdate = false;
|
var doUpdate = false;
|
||||||
var mutation;
|
var mutation;
|
||||||
FRAMEWORK.each(mutations, function () {
|
|
||||||
mutation = this;
|
if (_initialized && !_isSleeping) {
|
||||||
doUpdate = isUnknownMutation(mutation);
|
FRAMEWORK.each(mutations, function () {
|
||||||
return !doUpdate;
|
mutation = this;
|
||||||
});
|
doUpdate = isUnknownMutation(mutation);
|
||||||
|
return !doUpdate;
|
||||||
|
});
|
||||||
|
|
||||||
if (doUpdate) {
|
if (doUpdate) {
|
||||||
now = COMPATIBILITY.now();
|
now = COMPATIBILITY.now();
|
||||||
sizeAuto = (_heightAutoCache || _widthAutoCache);
|
sizeAuto = (_heightAutoCache || _widthAutoCache);
|
||||||
action = function () {
|
action = function () {
|
||||||
if(!_destroyed) {
|
if(!_destroyed) {
|
||||||
contentLastUpdate = now;
|
contentLastUpdate = now;
|
||||||
|
|
||||||
//if cols, rows or wrap attr was changed
|
//if cols, rows or wrap attr was changed
|
||||||
if (_isTextarea)
|
if (_isTextarea)
|
||||||
textareaUpdate();
|
textareaUpdate();
|
||||||
|
|
||||||
if (sizeAuto)
|
if (sizeAuto)
|
||||||
update();
|
update();
|
||||||
else
|
else
|
||||||
_base.update(_strAuto);
|
_base.update(_strAuto);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
clearTimeout(contentTimeout);
|
clearTimeout(contentTimeout);
|
||||||
if (mutationObserverContentLag <= 0 || now - contentLastUpdate > mutationObserverContentLag || !sizeAuto)
|
if (mutationObserverContentLag <= 0 || now - contentLastUpdate > mutationObserverContentLag || !sizeAuto)
|
||||||
action();
|
action();
|
||||||
else
|
else
|
||||||
contentTimeout = setTimeout(action, mutationObserverContentLag);
|
contentTimeout = setTimeout(action, mutationObserverContentLag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
return doUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
_mutationObserverHost = new mutationObserver(_mutationObserverHostCallback);
|
||||||
|
_mutationObserverContent = new mutationObserver(_mutationObserverContentCallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2601,7 +2609,7 @@
|
|||||||
subtree: !_isTextarea,
|
subtree: !_isTextarea,
|
||||||
childList: !_isTextarea,
|
childList: !_isTextarea,
|
||||||
characterData: !_isTextarea,
|
characterData: !_isTextarea,
|
||||||
attributeFilter: _isTextarea ? ['wrap', 'cols', 'rows'] : [LEXICON.i, LEXICON.c, LEXICON.s]
|
attributeFilter: _isTextarea ? ['wrap', 'cols', 'rows'] : [LEXICON.i, LEXICON.c, LEXICON.s, 'open']
|
||||||
});
|
});
|
||||||
|
|
||||||
_mutationObserversConnected = true;
|
_mutationObserversConnected = true;
|
||||||
@@ -2620,8 +2628,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disconnects the MutationObservers if they are supported.
|
||||||
|
* @returns {boolean|undefined} True if the MutationObservers needed to be synchronized, false or undefined otherwise.
|
||||||
|
*/
|
||||||
|
function synchronizeMutationObservers() {
|
||||||
|
if(_mutationObserversConnected) {
|
||||||
|
var mutHost = _mutationObserverHostCallback(_mutationObserverHost.takeRecords());
|
||||||
|
var mutContent = _mutationObserverContentCallback(_mutationObserverContent.takeRecords());
|
||||||
|
|
||||||
//==== Events of elements ====//
|
return mutHost || mutContent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//==== Events of elements ====//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method gets called every time the host element gets resized. IMPORTANT: Padding changes are detected too!!
|
* This method gets called every time the host element gets resized. IMPORTANT: Padding changes are detected too!!
|
||||||
@@ -2988,7 +3009,7 @@
|
|||||||
return sizeIsAffected;
|
return sizeIsAffected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//==== Update ====//
|
//==== Update ====//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3057,7 +3078,7 @@
|
|||||||
* @param hostSizeChanged True if this method was called due to a host size change.
|
* @param hostSizeChanged True if this method was called due to a host size change.
|
||||||
* @param contentSizeChanged True if this method was called due to a content size change.
|
* @param contentSizeChanged True if this method was called due to a content size change.
|
||||||
* @param force True if every property shall be updated and the cache shall be ignored.
|
* @param force True if every property shall be updated and the cache shall be ignored.
|
||||||
* @param preventSwallowing True if this method shall be executed event if it could be swallowed.
|
* @param preventSwallowing True if this method shall be executed even if it could be swallowed.
|
||||||
*/
|
*/
|
||||||
function update(hostSizeChanged, contentSizeChanged, force, preventSwallowing) {
|
function update(hostSizeChanged, contentSizeChanged, force, preventSwallowing) {
|
||||||
var now = COMPATIBILITY.now();
|
var now = COMPATIBILITY.now();
|
||||||
@@ -4115,7 +4136,7 @@
|
|||||||
dispatchCallback("onUpdated", { forced: force });
|
dispatchCallback("onUpdated", { forced: force });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//==== Options ====//
|
//==== Options ====//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -5088,8 +5109,8 @@
|
|||||||
function getHostElementInvertedScale() {
|
function getHostElementInvertedScale() {
|
||||||
var rect = _paddingElementNative.getBoundingClientRect();
|
var rect = _paddingElementNative.getBoundingClientRect();
|
||||||
return {
|
return {
|
||||||
x : _supportTransform ? 1 / (MATH.round(rect.width) / _paddingElementNative[LEXICON.oW]) : 1,
|
x : _supportTransform ? 1 / (MATH.round(rect.width) / _paddingElementNative[LEXICON.oW]) || 1 : 1,
|
||||||
y : _supportTransform ? 1 / (MATH.round(rect.height) / _paddingElementNative[LEXICON.oH]) : 1
|
y : _supportTransform ? 1 / (MATH.round(rect.height) / _paddingElementNative[LEXICON.oH]) || 1 : 1
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5398,18 +5419,18 @@
|
|||||||
var isString = type(force) == TYPES.s;
|
var isString = type(force) == TYPES.s;
|
||||||
var imgElementSelector = 'img';
|
var imgElementSelector = 'img';
|
||||||
var imgElementLoadEvent = 'load';
|
var imgElementLoadEvent = 'load';
|
||||||
var isPlus = isString && force.slice(-1) == '+';
|
|
||||||
if(isString) {
|
if(isString) {
|
||||||
if (force.indexOf(_strAuto) === 0) {
|
if (force === _strAuto) {
|
||||||
attrsChanged = meaningfulAttrsChanged();
|
attrsChanged = meaningfulAttrsChanged();
|
||||||
contentSizeC = updateAutoContentSizeChanged();
|
contentSizeC = updateAutoContentSizeChanged();
|
||||||
if (attrsChanged || contentSizeC || isPlus)
|
if (attrsChanged || contentSizeC)
|
||||||
update(false, contentSizeC, false, isPlus);
|
update(false, contentSizeC, false);
|
||||||
}
|
}
|
||||||
else if (force === 'zoom')
|
else if (force === 'zoom')
|
||||||
update(true, true);
|
update(true, true);
|
||||||
}
|
}
|
||||||
else {
|
else if(!synchronizeMutationObservers() || force) {
|
||||||
force = _isSleeping || force;
|
force = _isSleeping || force;
|
||||||
_isSleeping = false;
|
_isSleeping = false;
|
||||||
update(false, false, force, true);
|
update(false, false, force, true);
|
||||||
@@ -5421,6 +5442,7 @@
|
|||||||
FRAMEWORK(el).off(imgElementLoadEvent, imgOnLoad).on(imgElementLoadEvent, imgOnLoad);
|
FRAMEWORK(el).off(imgElementLoadEvent, imgOnLoad).on(imgElementLoadEvent, imgOnLoad);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -5628,7 +5650,9 @@
|
|||||||
isRTLNormalized: _normalizeRTLCache
|
isRTLNormalized: _normalizeRTLCache
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
synchronizeMutationObservers();
|
||||||
|
|
||||||
var normalizeRTL = _normalizeRTLCache;
|
var normalizeRTL = _normalizeRTLCache;
|
||||||
var coordinatesXAxisProps = [_strX, _strLeft, 'l'];
|
var coordinatesXAxisProps = [_strX, _strLeft, 'l'];
|
||||||
var coordinatesYAxisProps = [_strY, _strTop, 't'];
|
var coordinatesYAxisProps = [_strY, _strTop, 't'];
|
||||||
@@ -5691,8 +5715,6 @@
|
|||||||
};
|
};
|
||||||
var getFinalScroll = function (isX, rawScroll) {
|
var getFinalScroll = function (isX, rawScroll) {
|
||||||
var isString = type(rawScroll) == TYPES.s;
|
var isString = type(rawScroll) == TYPES.s;
|
||||||
if(isString)
|
|
||||||
_base.update(_strAuto + '+');
|
|
||||||
var operator;
|
var operator;
|
||||||
var amount;
|
var amount;
|
||||||
var scrollInfo = isX ? _scrollHorizontalInfo : _scrollVerticalInfo;
|
var scrollInfo = isX ? _scrollHorizontalInfo : _scrollVerticalInfo;
|
||||||
@@ -5822,8 +5844,6 @@
|
|||||||
if (finalElement[strLength] === 0)
|
if (finalElement[strLength] === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_base.update(_strAuto + '+');
|
|
||||||
|
|
||||||
//margin can be [ boolean, number, array of 2, array of 4, object ]
|
//margin can be [ boolean, number, array of 2, array of 4, object ]
|
||||||
if (marginType == TYPES.n || marginType == TYPES.b)
|
if (marginType == TYPES.n || marginType == TYPES.b)
|
||||||
margin = generateMargin([margin, margin, margin, margin]);
|
margin = generateMargin([margin, margin, margin, margin]);
|
||||||
|
|||||||
Vendored
+3
-3
File diff suppressed because one or more lines are too long
@@ -2,13 +2,13 @@
|
|||||||
* OverlayScrollbars
|
* OverlayScrollbars
|
||||||
* https://github.com/KingSora/OverlayScrollbars
|
* https://github.com/KingSora/OverlayScrollbars
|
||||||
*
|
*
|
||||||
* Version: 1.7.2
|
* Version: 1.7.3
|
||||||
*
|
*
|
||||||
* Copyright KingSora.
|
* Copyright KingSora.
|
||||||
* https://github.com/KingSora
|
* https://github.com/KingSora
|
||||||
*
|
*
|
||||||
* Released under the MIT license.
|
* Released under the MIT license.
|
||||||
* Date: 10.06.2019
|
* Date: 23.06.2019
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
@@ -588,6 +588,7 @@
|
|||||||
var scrollbarDummyElement = FRAMEWORK('<div id="os-dummy-scrollbar-size"><div></div></div>');
|
var scrollbarDummyElement = FRAMEWORK('<div id="os-dummy-scrollbar-size"><div></div></div>');
|
||||||
var scrollbarDummyElement0 = scrollbarDummyElement[0];
|
var scrollbarDummyElement0 = scrollbarDummyElement[0];
|
||||||
var dummyContainerChild = FRAMEWORK(scrollbarDummyElement.children('div').eq(0));
|
var dummyContainerChild = FRAMEWORK(scrollbarDummyElement.children('div').eq(0));
|
||||||
|
var getCptStyle = window.getComputedStyle;
|
||||||
|
|
||||||
bodyElement.append(scrollbarDummyElement);
|
bodyElement.append(scrollbarDummyElement);
|
||||||
scrollbarDummyElement.hide().show(); //fix IE8 bug (incorrect measuring)
|
scrollbarDummyElement.hide().show(); //fix IE8 bug (incorrect measuring)
|
||||||
@@ -612,7 +613,7 @@
|
|||||||
//scrollbarDummyElement.css(strOverflow, strHidden).hide().css(strOverflow, strScroll).show();
|
//scrollbarDummyElement.css(strOverflow, strHidden).hide().css(strOverflow, strScroll).show();
|
||||||
//return (scrollbarDummyElement0[LEXICON.oH] - scrollbarDummyElement0[LEXICON.cH]) === 0 && (scrollbarDummyElement0[LEXICON.oW] - scrollbarDummyElement0[LEXICON.cW]) === 0;
|
//return (scrollbarDummyElement0[LEXICON.oH] - scrollbarDummyElement0[LEXICON.cH]) === 0 && (scrollbarDummyElement0[LEXICON.oW] - scrollbarDummyElement0[LEXICON.cW]) === 0;
|
||||||
|
|
||||||
return scrollbarDummyElement.css('scrollbar-width') === 'none' || window.getComputedStyle(scrollbarDummyElement0, '::-webkit-scrollbar').getPropertyValue('display') === 'none';
|
return scrollbarDummyElement.css('scrollbar-width') === 'none' || (getCptStyle ? getCptStyle(scrollbarDummyElement0, '::-webkit-scrollbar').getPropertyValue('display') === 'none' : false);
|
||||||
})(),
|
})(),
|
||||||
overlayScrollbarDummySize : { x: 30, y: 30 },
|
overlayScrollbarDummySize : { x: 30, y: 30 },
|
||||||
msie : (function() {
|
msie : (function() {
|
||||||
@@ -1134,6 +1135,8 @@
|
|||||||
//MutationObserver:
|
//MutationObserver:
|
||||||
var _mutationObserverHost;
|
var _mutationObserverHost;
|
||||||
var _mutationObserverContent;
|
var _mutationObserverContent;
|
||||||
|
var _mutationObserverHostCallback;
|
||||||
|
var _mutationObserverContentCallback;
|
||||||
var _mutationObserversConnected;
|
var _mutationObserversConnected;
|
||||||
|
|
||||||
//textarea:
|
//textarea:
|
||||||
@@ -1443,67 +1446,72 @@
|
|||||||
var sizeAuto;
|
var sizeAuto;
|
||||||
var action;
|
var action;
|
||||||
|
|
||||||
_mutationObserverHost = new mutationObserver(function (mutations) {
|
_mutationObserverHostCallback = function(mutations) {
|
||||||
if (!_initialized || _isSleeping)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var doUpdate = false;
|
var doUpdate = false;
|
||||||
var mutation;
|
var mutation;
|
||||||
FRAMEWORK.each(mutations, function () {
|
|
||||||
mutation = this;
|
if (_initialized && !_isSleeping) {
|
||||||
mutationTarget = mutation.target;
|
FRAMEWORK.each(mutations, function () {
|
||||||
mutationAttrName = mutation.attributeName;
|
mutation = this;
|
||||||
|
mutationTarget = mutation.target;
|
||||||
|
mutationAttrName = mutation.attributeName;
|
||||||
|
|
||||||
if (mutationAttrName === LEXICON.c)
|
if (mutationAttrName === LEXICON.c)
|
||||||
doUpdate = hostClassNamesChanged(mutation.oldValue, mutationTarget.className);
|
doUpdate = hostClassNamesChanged(mutation.oldValue, mutationTarget.className);
|
||||||
else if (mutationAttrName === LEXICON.s)
|
else if (mutationAttrName === LEXICON.s)
|
||||||
doUpdate = mutation.oldValue !== mutationTarget[LEXICON.s].cssText;
|
doUpdate = mutation.oldValue !== mutationTarget[LEXICON.s].cssText;
|
||||||
else
|
else
|
||||||
doUpdate = true;
|
doUpdate = true;
|
||||||
|
|
||||||
|
if (doUpdate)
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
if (doUpdate)
|
if (doUpdate)
|
||||||
return false;
|
_base.update(_strAuto);
|
||||||
});
|
}
|
||||||
|
return doUpdate;
|
||||||
if (doUpdate)
|
};
|
||||||
_base.update(_strAuto);
|
_mutationObserverContentCallback = function (mutations) {
|
||||||
});
|
|
||||||
_mutationObserverContent = new mutationObserver(function (mutations) {
|
|
||||||
if (!_initialized || _isSleeping)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var doUpdate = false;
|
var doUpdate = false;
|
||||||
var mutation;
|
var mutation;
|
||||||
FRAMEWORK.each(mutations, function () {
|
|
||||||
mutation = this;
|
if (_initialized && !_isSleeping) {
|
||||||
doUpdate = isUnknownMutation(mutation);
|
FRAMEWORK.each(mutations, function () {
|
||||||
return !doUpdate;
|
mutation = this;
|
||||||
});
|
doUpdate = isUnknownMutation(mutation);
|
||||||
|
return !doUpdate;
|
||||||
|
});
|
||||||
|
|
||||||
if (doUpdate) {
|
if (doUpdate) {
|
||||||
now = COMPATIBILITY.now();
|
now = COMPATIBILITY.now();
|
||||||
sizeAuto = (_heightAutoCache || _widthAutoCache);
|
sizeAuto = (_heightAutoCache || _widthAutoCache);
|
||||||
action = function () {
|
action = function () {
|
||||||
if(!_destroyed) {
|
if(!_destroyed) {
|
||||||
contentLastUpdate = now;
|
contentLastUpdate = now;
|
||||||
|
|
||||||
//if cols, rows or wrap attr was changed
|
//if cols, rows or wrap attr was changed
|
||||||
if (_isTextarea)
|
if (_isTextarea)
|
||||||
textareaUpdate();
|
textareaUpdate();
|
||||||
|
|
||||||
if (sizeAuto)
|
if (sizeAuto)
|
||||||
update();
|
update();
|
||||||
else
|
else
|
||||||
_base.update(_strAuto);
|
_base.update(_strAuto);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
clearTimeout(contentTimeout);
|
clearTimeout(contentTimeout);
|
||||||
if (mutationObserverContentLag <= 0 || now - contentLastUpdate > mutationObserverContentLag || !sizeAuto)
|
if (mutationObserverContentLag <= 0 || now - contentLastUpdate > mutationObserverContentLag || !sizeAuto)
|
||||||
action();
|
action();
|
||||||
else
|
else
|
||||||
contentTimeout = setTimeout(action, mutationObserverContentLag);
|
contentTimeout = setTimeout(action, mutationObserverContentLag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
return doUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
_mutationObserverHost = new mutationObserver(_mutationObserverHostCallback);
|
||||||
|
_mutationObserverContent = new mutationObserver(_mutationObserverContentCallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1524,7 +1532,7 @@
|
|||||||
subtree: !_isTextarea,
|
subtree: !_isTextarea,
|
||||||
childList: !_isTextarea,
|
childList: !_isTextarea,
|
||||||
characterData: !_isTextarea,
|
characterData: !_isTextarea,
|
||||||
attributeFilter: _isTextarea ? ['wrap', 'cols', 'rows'] : [LEXICON.i, LEXICON.c, LEXICON.s]
|
attributeFilter: _isTextarea ? ['wrap', 'cols', 'rows'] : [LEXICON.i, LEXICON.c, LEXICON.s, 'open']
|
||||||
});
|
});
|
||||||
|
|
||||||
_mutationObserversConnected = true;
|
_mutationObserversConnected = true;
|
||||||
@@ -1543,8 +1551,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disconnects the MutationObservers if they are supported.
|
||||||
|
* @returns {boolean|undefined} True if the MutationObservers needed to be synchronized, false or undefined otherwise.
|
||||||
|
*/
|
||||||
|
function synchronizeMutationObservers() {
|
||||||
|
if(_mutationObserversConnected) {
|
||||||
|
var mutHost = _mutationObserverHostCallback(_mutationObserverHost.takeRecords());
|
||||||
|
var mutContent = _mutationObserverContentCallback(_mutationObserverContent.takeRecords());
|
||||||
|
|
||||||
//==== Events of elements ====//
|
return mutHost || mutContent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//==== Events of elements ====//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method gets called every time the host element gets resized. IMPORTANT: Padding changes are detected too!!
|
* This method gets called every time the host element gets resized. IMPORTANT: Padding changes are detected too!!
|
||||||
@@ -1911,7 +1932,7 @@
|
|||||||
return sizeIsAffected;
|
return sizeIsAffected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//==== Update ====//
|
//==== Update ====//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1980,7 +2001,7 @@
|
|||||||
* @param hostSizeChanged True if this method was called due to a host size change.
|
* @param hostSizeChanged True if this method was called due to a host size change.
|
||||||
* @param contentSizeChanged True if this method was called due to a content size change.
|
* @param contentSizeChanged True if this method was called due to a content size change.
|
||||||
* @param force True if every property shall be updated and the cache shall be ignored.
|
* @param force True if every property shall be updated and the cache shall be ignored.
|
||||||
* @param preventSwallowing True if this method shall be executed event if it could be swallowed.
|
* @param preventSwallowing True if this method shall be executed even if it could be swallowed.
|
||||||
*/
|
*/
|
||||||
function update(hostSizeChanged, contentSizeChanged, force, preventSwallowing) {
|
function update(hostSizeChanged, contentSizeChanged, force, preventSwallowing) {
|
||||||
var now = COMPATIBILITY.now();
|
var now = COMPATIBILITY.now();
|
||||||
@@ -3038,7 +3059,7 @@
|
|||||||
dispatchCallback("onUpdated", { forced: force });
|
dispatchCallback("onUpdated", { forced: force });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//==== Options ====//
|
//==== Options ====//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4011,8 +4032,8 @@
|
|||||||
function getHostElementInvertedScale() {
|
function getHostElementInvertedScale() {
|
||||||
var rect = _paddingElementNative.getBoundingClientRect();
|
var rect = _paddingElementNative.getBoundingClientRect();
|
||||||
return {
|
return {
|
||||||
x : _supportTransform ? 1 / (MATH.round(rect.width) / _paddingElementNative[LEXICON.oW]) : 1,
|
x : _supportTransform ? 1 / (MATH.round(rect.width) / _paddingElementNative[LEXICON.oW]) || 1 : 1,
|
||||||
y : _supportTransform ? 1 / (MATH.round(rect.height) / _paddingElementNative[LEXICON.oH]) : 1
|
y : _supportTransform ? 1 / (MATH.round(rect.height) / _paddingElementNative[LEXICON.oH]) || 1 : 1
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4321,18 +4342,18 @@
|
|||||||
var isString = type(force) == TYPES.s;
|
var isString = type(force) == TYPES.s;
|
||||||
var imgElementSelector = 'img';
|
var imgElementSelector = 'img';
|
||||||
var imgElementLoadEvent = 'load';
|
var imgElementLoadEvent = 'load';
|
||||||
var isPlus = isString && force.slice(-1) == '+';
|
|
||||||
if(isString) {
|
if(isString) {
|
||||||
if (force.indexOf(_strAuto) === 0) {
|
if (force === _strAuto) {
|
||||||
attrsChanged = meaningfulAttrsChanged();
|
attrsChanged = meaningfulAttrsChanged();
|
||||||
contentSizeC = updateAutoContentSizeChanged();
|
contentSizeC = updateAutoContentSizeChanged();
|
||||||
if (attrsChanged || contentSizeC || isPlus)
|
if (attrsChanged || contentSizeC)
|
||||||
update(false, contentSizeC, false, isPlus);
|
update(false, contentSizeC, false);
|
||||||
}
|
}
|
||||||
else if (force === 'zoom')
|
else if (force === 'zoom')
|
||||||
update(true, true);
|
update(true, true);
|
||||||
}
|
}
|
||||||
else {
|
else if(!synchronizeMutationObservers() || force) {
|
||||||
force = _isSleeping || force;
|
force = _isSleeping || force;
|
||||||
_isSleeping = false;
|
_isSleeping = false;
|
||||||
update(false, false, force, true);
|
update(false, false, force, true);
|
||||||
@@ -4344,6 +4365,7 @@
|
|||||||
FRAMEWORK(el).off(imgElementLoadEvent, imgOnLoad).on(imgElementLoadEvent, imgOnLoad);
|
FRAMEWORK(el).off(imgElementLoadEvent, imgOnLoad).on(imgElementLoadEvent, imgOnLoad);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4551,7 +4573,9 @@
|
|||||||
isRTLNormalized: _normalizeRTLCache
|
isRTLNormalized: _normalizeRTLCache
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
synchronizeMutationObservers();
|
||||||
|
|
||||||
var normalizeRTL = _normalizeRTLCache;
|
var normalizeRTL = _normalizeRTLCache;
|
||||||
var coordinatesXAxisProps = [_strX, _strLeft, 'l'];
|
var coordinatesXAxisProps = [_strX, _strLeft, 'l'];
|
||||||
var coordinatesYAxisProps = [_strY, _strTop, 't'];
|
var coordinatesYAxisProps = [_strY, _strTop, 't'];
|
||||||
@@ -4614,8 +4638,6 @@
|
|||||||
};
|
};
|
||||||
var getFinalScroll = function (isX, rawScroll) {
|
var getFinalScroll = function (isX, rawScroll) {
|
||||||
var isString = type(rawScroll) == TYPES.s;
|
var isString = type(rawScroll) == TYPES.s;
|
||||||
if(isString)
|
|
||||||
_base.update(_strAuto + '+');
|
|
||||||
var operator;
|
var operator;
|
||||||
var amount;
|
var amount;
|
||||||
var scrollInfo = isX ? _scrollHorizontalInfo : _scrollVerticalInfo;
|
var scrollInfo = isX ? _scrollHorizontalInfo : _scrollVerticalInfo;
|
||||||
@@ -4745,8 +4767,6 @@
|
|||||||
if (finalElement[strLength] === 0)
|
if (finalElement[strLength] === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_base.update(_strAuto + '+');
|
|
||||||
|
|
||||||
//margin can be [ boolean, number, array of 2, array of 4, object ]
|
//margin can be [ boolean, number, array of 2, array of 4, object ]
|
||||||
if (marginType == TYPES.n || marginType == TYPES.b)
|
if (marginType == TYPES.n || marginType == TYPES.b)
|
||||||
margin = generateMargin([margin, margin, margin, margin]);
|
margin = generateMargin([margin, margin, margin, margin]);
|
||||||
|
|||||||
Vendored
+3
-3
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name":"overlayscrollbars",
|
"name":"overlayscrollbars",
|
||||||
"version":"1.7.2",
|
"version":"1.7.3",
|
||||||
"description":"A javascript scrollbar plugin which hides native scrollbars, provides custom styleable overlay scrollbars and keeps the native functionality and feeling.",
|
"description":"A javascript scrollbar plugin which hides native scrollbars, provides custom styleable overlay scrollbars and keeps the native functionality and feeling.",
|
||||||
"keywords":[
|
"keywords":[
|
||||||
"overlayscrollbars",
|
"overlayscrollbars",
|
||||||
|
|||||||
Reference in New Issue
Block a user