mui-sass 0.9.6 → 0.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/lib/mui/sass/version.rb +1 -1
- data/vendor/assets/javascripts/mui.js +54 -27
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91a5cebca7469d407e8a6be7552bf98821f14c9c
|
4
|
+
data.tar.gz: 25ad2199a8d4a469cd2ed7568b8e384be0d0f19d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19707a144ac4038997d2df51b4dd81b5c146b6671aa572f8c60961094e7c76eb1895e8ac487f078daf54e596631aa6bea0cc028a01e27123397c6ca5ef2332ef
|
7
|
+
data.tar.gz: 97b03aa65eef7516759b672d843dae3e8a9666c6b7377cc942998736aeca8384b92b604033edc4efe59d6dbe93a17c937b24c65ff7270c1946028e32c26a1ba3
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/mui/sass/version.rb
CHANGED
@@ -625,8 +625,10 @@ var config = require('../config'),
|
|
625
625
|
jqLite = require('./jqLite'),
|
626
626
|
scrollLock = 0,
|
627
627
|
scrollLockCls = 'mui-scroll-lock',
|
628
|
+
scrollLockPos,
|
628
629
|
scrollStyleEl,
|
629
630
|
scrollEventHandler,
|
631
|
+
_scrollBarWidth,
|
630
632
|
_supportsPointerEvents;
|
631
633
|
|
632
634
|
|
@@ -766,29 +768,30 @@ function enableScrollLockFn() {
|
|
766
768
|
|
767
769
|
// add lock
|
768
770
|
if (scrollLock === 1) {
|
769
|
-
var
|
770
|
-
|
771
|
-
|
771
|
+
var doc = document,
|
772
|
+
win = window,
|
773
|
+
htmlEl = doc.documentElement,
|
774
|
+
bodyEl = doc.body,
|
775
|
+
scrollBarWidth = getScrollBarWidth(),
|
772
776
|
cssProps,
|
773
|
-
cssStr
|
777
|
+
cssStr,
|
778
|
+
x;
|
774
779
|
|
775
780
|
// define scroll lock class dynamically
|
776
|
-
cssProps = [
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
// scrollbar-y
|
785
|
-
if (htmlEl.scrollHeight > htmlEl.clientHeight) {
|
786
|
-
cssProps.push('overflow-y:scroll');
|
787
|
-
}
|
781
|
+
cssProps = ['overflow:hidden'];
|
782
|
+
|
783
|
+
if (scrollBarWidth) {
|
784
|
+
// scrollbar-y
|
785
|
+
if (htmlEl.scrollHeight > htmlEl.clientHeight) {
|
786
|
+
x = parseInt(jqLite.css(bodyEl, 'padding-right')) + scrollBarWidth;
|
787
|
+
cssProps.push('padding-right:' + x + 'px');
|
788
|
+
}
|
788
789
|
|
789
|
-
|
790
|
-
|
791
|
-
|
790
|
+
// scrollbar-x
|
791
|
+
if (htmlEl.scrollWidth > htmlEl.clientWidth) {
|
792
|
+
x = parseInt(jqLite.css(bodyEl, 'padding-bottom')) + scrollBarWidth;
|
793
|
+
cssProps.push('padding-bottom:' + x + 'px');
|
794
|
+
}
|
792
795
|
}
|
793
796
|
|
794
797
|
// define css class dynamically
|
@@ -797,10 +800,11 @@ function enableScrollLockFn() {
|
|
797
800
|
scrollStyleEl = loadStyleFn(cssStr);
|
798
801
|
|
799
802
|
// cancel 'scroll' event listener callbacks
|
800
|
-
jqLite.on(
|
803
|
+
jqLite.on(win, 'scroll', scrollEventHandler, true);
|
801
804
|
|
802
805
|
// add scroll lock
|
803
|
-
jqLite.
|
806
|
+
scrollLockPos = {left: jqLite.scrollLeft(win), top: jqLite.scrollTop(win)};
|
807
|
+
jqLite.addClass(bodyEl, scrollLockCls);
|
804
808
|
}
|
805
809
|
}
|
806
810
|
|
@@ -818,22 +822,42 @@ function disableScrollLockFn(resetPos) {
|
|
818
822
|
|
819
823
|
// remove lock
|
820
824
|
if (scrollLock === 0) {
|
821
|
-
var htmlEl = document.documentElement,
|
822
|
-
top = parseInt(jqLite.css(htmlEl, 'top')),
|
823
|
-
left = parseInt(jqLite.css(htmlEl, 'left'));
|
824
|
-
|
825
825
|
// remove scroll lock and delete style element
|
826
|
-
jqLite.removeClass(
|
826
|
+
jqLite.removeClass(document.body, scrollLockCls);
|
827
827
|
scrollStyleEl.parentNode.removeChild(scrollStyleEl);
|
828
828
|
|
829
829
|
// restore scroll position
|
830
|
-
window.scrollTo(
|
830
|
+
if (resetPos) window.scrollTo(scrollLockPos.left, scrollLockPos.top);
|
831
831
|
|
832
832
|
// restore scroll event listeners
|
833
833
|
jqLite.off(window, 'scroll', scrollEventHandler, true);
|
834
834
|
}
|
835
835
|
}
|
836
836
|
|
837
|
+
/**
|
838
|
+
* Return scroll bar width.
|
839
|
+
*/
|
840
|
+
var getScrollBarWidth = function() {
|
841
|
+
// check cache
|
842
|
+
if (_scrollBarWidth !== undefined) return _scrollBarWidth;
|
843
|
+
|
844
|
+
// calculate scroll bar width
|
845
|
+
var doc = document,
|
846
|
+
bodyEl = doc.body,
|
847
|
+
el = doc.createElement('div');
|
848
|
+
|
849
|
+
el.innerHTML = '<div style="width:50px;height:50px;position:absolute;' +
|
850
|
+
'left:-50px;top:-50px;overflow:auto;"><div style="width:1px;' +
|
851
|
+
'height:100px;"></div></div>';
|
852
|
+
el = el.firstChild;
|
853
|
+
bodyEl.appendChild(el);
|
854
|
+
_scrollBarWidth = el.offsetWidth - el.clientWidth;
|
855
|
+
bodyEl.removeChild(el);
|
856
|
+
|
857
|
+
return _scrollBarWidth;
|
858
|
+
}
|
859
|
+
|
860
|
+
|
837
861
|
/**
|
838
862
|
* requestAnimationFrame polyfilled
|
839
863
|
* @param {Function} callback - The callback function
|
@@ -1931,6 +1955,9 @@ function initialize(inputEl) {
|
|
1931
1955
|
|
1932
1956
|
// add dirty class on focus
|
1933
1957
|
jqLite.on(inputEl, 'focus', function() {jqLite.addClass(this, dirtyClass);});
|
1958
|
+
|
1959
|
+
// add dirty class if element is currently focused
|
1960
|
+
if (document.activeElement === inputEl) jqLite.addClass(inputEl, dirtyClass);
|
1934
1961
|
}
|
1935
1962
|
|
1936
1963
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mui-sass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitriy Tarasov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|