Parcourir la source

3.7.5 - fix for touchscreen desktops

Fixes
- Calling .remove() throws an error after update to v. 3.7.4 #681
- more robust hybrid system support mouse + touch events aka no drag and
scroll #676
- scroll is not working on edge and firefox browsers in touchscreen
laptops #677
- typos on navigator.maxTouchPoints

Changes
- remove outdated self.visibility
InuYaksa il y a 7 ans
Parent
commit
708dc574a4

+ 1 - 1
README.md

@@ -1,5 +1,5 @@
 # jQuery.NiceScroll
-v. 3.7.4
+v. 3.7.5
 
 ## The best nicescroll release ever - extremely smooth and consistent in modern browsers and mobile devices, with low resource usage
 

+ 0 - 20
changelog_3.7.4.txt

@@ -1,20 +0,0 @@
-Changelog nicescroll release 3.7.4
-https://nicescroll.areaaperta.com/
-https://github.com/inuyaksa/jquery.nicescroll
-
-
-
-Fixes
-- touchpad scrolling support for MS Surface aka FYI - Browser test results on Surface Pro touchscreen and touchpad #668
-- changed scrollbarid setting procedure because uglify mades uncompatible code for IE8 aka use nicescroll in IE8 #672
-- preserve scrol chain
-- page scrollbar not customized on android
-- prevent bar flickering when window not changed aka Using this plugin I got a flickering scroll bar #674
-
-Changes 
-- more responsive direct scrolling from bars
-- more consistence scrolling speed on many browsers (Chrome, Firefox, Edge)
-- minor code optimizations and jshint check
-- jQuery "bind" event function changed to "on", migration to jQuery 3 (still jQuery 1 compatible) #361
-- Using jQuery.expr.pseudos, migration to jQuery 3 (still jQuery 1 compatible) #361
-- changed arguments for doScrollBy and doScrollLeftBy

+ 14 - 0
changelog_3.7.5.txt

@@ -0,0 +1,14 @@
+Changelog nicescroll release 3.7.5
+https://nicescroll.areaaperta.com/
+https://github.com/inuyaksa/jquery.nicescroll
+
+
+
+Fixes
+- Calling .remove() throws an error after update to v. 3.7.4 #681
+- more robust hybrid system support mouse + touch events aka no drag and scroll #676
+- scroll is not working on edge and firefox browsers in touchscreen laptops #677
+- typos on navigator.maxTouchPoints
+
+Changes 
+- remove outdated self.visibility

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 1
demo/js/jquery.nicescroll.min.js


+ 1 - 1
dist/jquery.nicescroll.iframehelper.min.js

@@ -1,2 +1,2 @@
-/* iframe helper for nicescroll v3.7.4 InuYaksa - MIT - https://nicescroll.areaaperta.com */
+/* iframe helper for jquery.nicescroll v3.7.5 InuYaksa - MIT - https://nicescroll.areaaperta.com */
 !function(e,t){function n(t){var n=e.createEvent("MouseEvents");n.initEvent("wheel",!0,!0),n.deltaMode=t.deltaMode,n.deltaX=t.deltaX,n.deltaY=t.deltaY,n.deltaZ=t.deltaZ,n.wheelDelta=t.wheelDelta,n.wheelDeltaX=t.wheelDeltaX,n.wheelDeltaY=t.wheelDeltaY,r.dispatchEvent(n)}function l(e){do{if(void 0!==$.data(e,"__nicescroll"))return e;e=e.parentNode||!1}while(e);return!1}var a=e.body,r=t.parent;if(r&&"createEvent"in e){a.addEventListener("wheel",n)}if(t.addEventListener){var i=function(){var t=e.createElement("style");return t.appendChild(e.createTextNode("")),e.head.appendChild(t),t.sheet}(),d=null,o=null,c=[];t.addEventListener("scroll",function(e){o&&t.scrollTo(c[0],c[1])}),t.addEventListener("load",function(){var e=!1;$.nicescroll.each(function(){var t=this;t.scrollstart(function(){e||i.insertRule("iframe { pointer-events: none !important; }",0),e=!0}),t.scrollend(function(){e&&i.deleteRule(0),e=!1})}),$("iframe").each(function(){this.addEventListener("mouseenter",function(e){var n=l(d=e.target);o=n,c=[t.scrollX,t.scrollY]}),this.addEventListener("mouseleave",function(e){d=o=null})})})}}(document,window);

+ 29 - 24
dist/jquery.nicescroll.js

@@ -1,6 +1,6 @@
 /* jquery.nicescroll
--- version 3.7.4
--- copyright 2017-07-02 InuYaksa*2017
+-- version 3.7.5
+-- copyright 2017-07-13 InuYaksa*2017
 -- licensed under the MIT
 --
 -- https://nicescroll.areaaperta.com/
@@ -171,7 +171,7 @@
     d.ischrome26 = (!d.ischrome38) && (d.ischrome && ("transition" in _style)); // issue with transform detection (maintain prefix)
 
     d.cantouch = ("ontouchstart" in _doc.documentElement) || ("ontouchstart" in _win); // with detection for Chrome Touch Emulation    
-    d.hasw3ctouch = (_win.PointerEvent || false) && ((navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); //IE11 pointer events, following W3C Pointer Events spec
+    d.hasw3ctouch = (_win.PointerEvent || false) && ((navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); //IE11 pointer events, following W3C Pointer Events spec
     d.hasmstouch = (!d.hasw3ctouch) && (_win.MSPointerEvent || false); // IE10 pointer events
 
     d.ismac = /^mac$/i.test(_platform);
@@ -261,7 +261,7 @@
 
     var self = this;
 
-    this.version = '3.7.4';
+    this.version = '3.7.5';
     this.name = 'nicescroll';
 
     this.me = me;
@@ -384,7 +384,7 @@
     this.hasfocus = false;
     this.hasmousefocus = false;
 
-    this.visibility = true;
+    //this.visibility = true;
     this.railslocked = false;  // locked by resize
     this.locked = false;  // prevent lost of locked status sets by user
     this.hidden = false; // rails always hidden
@@ -504,7 +504,6 @@
     };
     BezierClass.prototype = {
       B2: function (t) {
-        //return 3 * t * t * (1 - t);
         return 3 * (1 - t) * (1 - t) * t;
       },
       B3: function (t) {
@@ -1210,7 +1209,7 @@
                     return self.cancelEvent(e);
                   }
                   return self.stopPropagation(e);
-                }          
+                }
 
                 if (/SUBMIT|CANCEL|BUTTON/i.test($(tg).attr('type'))) {
                   self.preventclick = {
@@ -1757,7 +1756,8 @@
           self.cursorh && self.bind(self.cursorh, "touchend", self.ontouchendCursor);
         }
 
-        if (!cap.cantouch && !opt.emulatetouch) {
+//        if (!cap.cantouch && !opt.emulatetouch) {
+        if (!opt.emulatetouch && !cap.isandroid && !cap.isios) {
 
           self.bind((cap.hasmousecapture) ? self.win : _doc, "mouseup", self.onmouseup);
           self.bind(_doc, "mousemove", self.onmousemove);
@@ -1987,12 +1987,15 @@
           }
 
           if (!self.ispage && !self.haswrapper) {
+
+            var _dom = self.win[0];
+
             // redesigned MutationObserver for Chrome18+/Firefox14+/iOS6+ with support for: remove div, add/remove content
             if (ClsMutationObserver !== false) {
               self.observer = new ClsMutationObserver(function (mutations) {
                 mutations.forEach(self.onAttributeChange);
               });
-              self.observer.observe(self.win[0], {
+              self.observer.observe(_dom, {
                 childList: true,
                 characterData: false,
                 attributes: true,
@@ -2002,22 +2005,22 @@
                 mutations.forEach(function (mo) {
                   if (mo.removedNodes.length > 0) {
                     for (var dd in mo.removedNodes) {
-                      if (!!self && (mo.removedNodes[dd] == self.win[0])) return self.remove();
+                      if (!!self && (mo.removedNodes[dd] === _dom)) return self.remove();
                     }
                   }
                 });
               });
-              self.observerremover.observe(self.win[0].parentNode, {
+              self.observerremover.observe(_dom.parentNode, {
                 childList: true,
                 characterData: false,
                 attributes: false,
                 subtree: false
               });
             } else {
-              self.bind(self.win, (cap.isie && !cap.isie9) ? "propertychange" : "DOMAttrModified", self.onAttributeChange);
-              if (cap.isie9) self.win[0].attachEvent("onpropertychange", self.onAttributeChange); //IE9 DOMAttrModified bug
-              self.bind(self.win, "DOMNodeRemoved", function (e) {
-                if (e.target == self.win[0]) self.remove();
+              self.bind(_dom, (cap.isie && !cap.isie9) ? "propertychange" : "DOMAttrModified", self.onAttributeChange);
+              if (cap.isie9) _dom.attachEvent("onpropertychange", self.onAttributeChange); //IE9 DOMAttrModified bug
+              self.bind(_dom, "DOMNodeRemoved", function (e) {
+                if (e.target === _dom) self.remove();
               });
             }
           }
@@ -2283,10 +2286,10 @@
         return false;
       }
 
-      if (!self.hidden && !self.visibility) {
-        self.showRail().showRailHr();
+      if (!self.hidden) {
+        if (!self.rail.visibility) self.showRail();
+        if (self.railh && !self.railh.visibility) self.showRailHr();
       }
-      else if (self.railh && (!self.hidden && !self.railh.visibility)) self.showRailHr();
 
       if (self.istextarea && self.win.css('resize') && self.win.css('resize') != 'none') self.view.h -= 20;
 
@@ -2348,10 +2351,12 @@
 
       clearTimeout(hlazyresize);
 
+      tm = isNaN(tm) ? 240 : tm;
+
       hlazyresize = setTimeout(function () {
-        if (self) self.resize();
+        self && self.resize();
         hlazyresize=0;
-      }, tm||240);
+      }, tm);
 
       return self;
 
@@ -2515,7 +2520,7 @@
             de.a.splice(a);
             de.l.splice(a);
             if (de.a.length===0) {
-              self._unbind(dom,name,del.f);
+              self._unbind(dom,name,de.l.f);
               delegatevents[name] = null;
             }
           }
@@ -2559,7 +2564,7 @@
 
     this.showRail = function () {
       if ((self.page.maxh !== 0) && (self.ispage || self.win.css('display') != 'none')) {
-        self.visibility = true;
+        //self.visibility = true;
         self.rail.visibility = true;
         self.rail.css('display', 'block');
       }
@@ -2581,7 +2586,7 @@
     };
 
     this.hideRail = function () {
-      self.visibility = false;
+      //self.visibility = false;
       self.rail.visibility = false;
       self.rail.css('display', 'none');
       return self;
@@ -3227,7 +3232,7 @@
 
       };
 
-      this.cancelScroll = function () {        
+      this.cancelScroll = function () {
         if (self.timer) clearAnimationFrame(self.timer);
         self.timer = 0;
         self.bzscroll = false;

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 1
dist/jquery.nicescroll.min.js


+ 1 - 1
jquery.nicescroll.iframehelper.min.js

@@ -1,2 +1,2 @@
-/* iframe helper for nicescroll v3.7.4 InuYaksa - MIT - https://nicescroll.areaaperta.com */
+/* iframe helper for jquery.nicescroll v3.7.5 InuYaksa - MIT - https://nicescroll.areaaperta.com */
 !function(e,t){function n(t){var n=e.createEvent("MouseEvents");n.initEvent("wheel",!0,!0),n.deltaMode=t.deltaMode,n.deltaX=t.deltaX,n.deltaY=t.deltaY,n.deltaZ=t.deltaZ,n.wheelDelta=t.wheelDelta,n.wheelDeltaX=t.wheelDeltaX,n.wheelDeltaY=t.wheelDeltaY,r.dispatchEvent(n)}function l(e){do{if(void 0!==$.data(e,"__nicescroll"))return e;e=e.parentNode||!1}while(e);return!1}var a=e.body,r=t.parent;if(r&&"createEvent"in e){a.addEventListener("wheel",n)}if(t.addEventListener){var i=function(){var t=e.createElement("style");return t.appendChild(e.createTextNode("")),e.head.appendChild(t),t.sheet}(),d=null,o=null,c=[];t.addEventListener("scroll",function(e){o&&t.scrollTo(c[0],c[1])}),t.addEventListener("load",function(){var e=!1;$.nicescroll.each(function(){var t=this;t.scrollstart(function(){e||i.insertRule("iframe { pointer-events: none !important; }",0),e=!0}),t.scrollend(function(){e&&i.deleteRule(0),e=!1})}),$("iframe").each(function(){this.addEventListener("mouseenter",function(e){var n=l(d=e.target);o=n,c=[t.scrollX,t.scrollY]}),this.addEventListener("mouseleave",function(e){d=o=null})})})}}(document,window);

+ 29 - 24
jquery.nicescroll.js

@@ -1,6 +1,6 @@
 /* jquery.nicescroll
--- version 3.7.4
--- copyright 2017-07-02 InuYaksa*2017
+-- version 3.7.5
+-- copyright 2017-07-13 InuYaksa*2017
 -- licensed under the MIT
 --
 -- https://nicescroll.areaaperta.com/
@@ -171,7 +171,7 @@
     d.ischrome26 = (!d.ischrome38) && (d.ischrome && ("transition" in _style)); // issue with transform detection (maintain prefix)
 
     d.cantouch = ("ontouchstart" in _doc.documentElement) || ("ontouchstart" in _win); // with detection for Chrome Touch Emulation    
-    d.hasw3ctouch = (_win.PointerEvent || false) && ((navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); //IE11 pointer events, following W3C Pointer Events spec
+    d.hasw3ctouch = (_win.PointerEvent || false) && ((navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); //IE11 pointer events, following W3C Pointer Events spec
     d.hasmstouch = (!d.hasw3ctouch) && (_win.MSPointerEvent || false); // IE10 pointer events
 
     d.ismac = /^mac$/i.test(_platform);
@@ -261,7 +261,7 @@
 
     var self = this;
 
-    this.version = '3.7.4';
+    this.version = '3.7.5';
     this.name = 'nicescroll';
 
     this.me = me;
@@ -384,7 +384,7 @@
     this.hasfocus = false;
     this.hasmousefocus = false;
 
-    this.visibility = true;
+    //this.visibility = true;
     this.railslocked = false;  // locked by resize
     this.locked = false;  // prevent lost of locked status sets by user
     this.hidden = false; // rails always hidden
@@ -504,7 +504,6 @@
     };
     BezierClass.prototype = {
       B2: function (t) {
-        //return 3 * t * t * (1 - t);
         return 3 * (1 - t) * (1 - t) * t;
       },
       B3: function (t) {
@@ -1210,7 +1209,7 @@
                     return self.cancelEvent(e);
                   }
                   return self.stopPropagation(e);
-                }          
+                }
 
                 if (/SUBMIT|CANCEL|BUTTON/i.test($(tg).attr('type'))) {
                   self.preventclick = {
@@ -1757,7 +1756,8 @@
           self.cursorh && self.bind(self.cursorh, "touchend", self.ontouchendCursor);
         }
 
-        if (!cap.cantouch && !opt.emulatetouch) {
+//        if (!cap.cantouch && !opt.emulatetouch) {
+        if (!opt.emulatetouch && !cap.isandroid && !cap.isios) {
 
           self.bind((cap.hasmousecapture) ? self.win : _doc, "mouseup", self.onmouseup);
           self.bind(_doc, "mousemove", self.onmousemove);
@@ -1987,12 +1987,15 @@
           }
 
           if (!self.ispage && !self.haswrapper) {
+
+            var _dom = self.win[0];
+
             // redesigned MutationObserver for Chrome18+/Firefox14+/iOS6+ with support for: remove div, add/remove content
             if (ClsMutationObserver !== false) {
               self.observer = new ClsMutationObserver(function (mutations) {
                 mutations.forEach(self.onAttributeChange);
               });
-              self.observer.observe(self.win[0], {
+              self.observer.observe(_dom, {
                 childList: true,
                 characterData: false,
                 attributes: true,
@@ -2002,22 +2005,22 @@
                 mutations.forEach(function (mo) {
                   if (mo.removedNodes.length > 0) {
                     for (var dd in mo.removedNodes) {
-                      if (!!self && (mo.removedNodes[dd] == self.win[0])) return self.remove();
+                      if (!!self && (mo.removedNodes[dd] === _dom)) return self.remove();
                     }
                   }
                 });
               });
-              self.observerremover.observe(self.win[0].parentNode, {
+              self.observerremover.observe(_dom.parentNode, {
                 childList: true,
                 characterData: false,
                 attributes: false,
                 subtree: false
               });
             } else {
-              self.bind(self.win, (cap.isie && !cap.isie9) ? "propertychange" : "DOMAttrModified", self.onAttributeChange);
-              if (cap.isie9) self.win[0].attachEvent("onpropertychange", self.onAttributeChange); //IE9 DOMAttrModified bug
-              self.bind(self.win, "DOMNodeRemoved", function (e) {
-                if (e.target == self.win[0]) self.remove();
+              self.bind(_dom, (cap.isie && !cap.isie9) ? "propertychange" : "DOMAttrModified", self.onAttributeChange);
+              if (cap.isie9) _dom.attachEvent("onpropertychange", self.onAttributeChange); //IE9 DOMAttrModified bug
+              self.bind(_dom, "DOMNodeRemoved", function (e) {
+                if (e.target === _dom) self.remove();
               });
             }
           }
@@ -2283,10 +2286,10 @@
         return false;
       }
 
-      if (!self.hidden && !self.visibility) {
-        self.showRail().showRailHr();
+      if (!self.hidden) {
+        if (!self.rail.visibility) self.showRail();
+        if (self.railh && !self.railh.visibility) self.showRailHr();
       }
-      else if (self.railh && (!self.hidden && !self.railh.visibility)) self.showRailHr();
 
       if (self.istextarea && self.win.css('resize') && self.win.css('resize') != 'none') self.view.h -= 20;
 
@@ -2348,10 +2351,12 @@
 
       clearTimeout(hlazyresize);
 
+      tm = isNaN(tm) ? 240 : tm;
+
       hlazyresize = setTimeout(function () {
-        if (self) self.resize();
+        self && self.resize();
         hlazyresize=0;
-      }, tm||240);
+      }, tm);
 
       return self;
 
@@ -2515,7 +2520,7 @@
             de.a.splice(a);
             de.l.splice(a);
             if (de.a.length===0) {
-              self._unbind(dom,name,del.f);
+              self._unbind(dom,name,de.l.f);
               delegatevents[name] = null;
             }
           }
@@ -2559,7 +2564,7 @@
 
     this.showRail = function () {
       if ((self.page.maxh !== 0) && (self.ispage || self.win.css('display') != 'none')) {
-        self.visibility = true;
+        //self.visibility = true;
         self.rail.visibility = true;
         self.rail.css('display', 'block');
       }
@@ -2581,7 +2586,7 @@
     };
 
     this.hideRail = function () {
-      self.visibility = false;
+      //self.visibility = false;
       self.rail.visibility = false;
       self.rail.css('display', 'none');
       return self;
@@ -3227,7 +3232,7 @@
 
       };
 
-      this.cancelScroll = function () {        
+      this.cancelScroll = function () {
         if (self.timer) clearAnimationFrame(self.timer);
         self.timer = 0;
         self.bzscroll = false;

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 1
jquery.nicescroll.min.js


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff