Version Description
- tested on WP 5.2.1
- make it works on Firefox
Download this release
Release Info
Developer | kubiq |
Plugin | MouseWheel Smooth Scroll |
Version | 5.2 |
Comparing to | |
See all releases |
Code changes from version 5.1 to 5.2
- js/SmoothScroll.js +5 -4
- js/SmoothScroll.min.js +1 -1
- mousewheel-smooth-scroll.php +5 -2
- readme.txt +6 -2
js/SmoothScroll.js
CHANGED
@@ -735,13 +735,14 @@ function pulse(x) {
|
|
735 |
***********************************************/
|
736 |
|
737 |
var userAgent = window.navigator.userAgent;
|
738 |
-
var isEdge = /Edge/.test(userAgent);
|
739 |
-
var isChrome = /chrome/i.test(userAgent) && !isEdge;
|
740 |
-
var isSafari = /safari/i.test(userAgent) && !isEdge;
|
|
|
741 |
var isMobile = /mobile/i.test(userAgent);
|
742 |
var isIEWin7 = /Windows NT 6.1/i.test(userAgent) && /rv:11/i.test(userAgent);
|
743 |
var isOldSafari = isSafari && (/Version\/8/i.test(userAgent) || /Version\/9/i.test(userAgent));
|
744 |
-
var isEnabledForBrowser = (isChrome || isSafari || isIEWin7) && !isMobile;
|
745 |
|
746 |
var supportsPassive = false;
|
747 |
try {
|
735 |
***********************************************/
|
736 |
|
737 |
var userAgent = window.navigator.userAgent;
|
738 |
+
var isEdge = /Edge/.test(userAgent);
|
739 |
+
var isChrome = /chrome/i.test(userAgent) && !isEdge;
|
740 |
+
var isSafari = /safari/i.test(userAgent) && !isEdge;
|
741 |
+
var isFirefox = /firefox/i.test(userAgent);
|
742 |
var isMobile = /mobile/i.test(userAgent);
|
743 |
var isIEWin7 = /Windows NT 6.1/i.test(userAgent) && /rv:11/i.test(userAgent);
|
744 |
var isOldSafari = isSafari && (/Version\/8/i.test(userAgent) || /Version\/9/i.test(userAgent));
|
745 |
+
var isEnabledForBrowser = (isChrome || isSafari || isIEWin7 || isFirefox) && !isMobile;
|
746 |
|
747 |
var supportsPassive = false;
|
748 |
try {
|
js/SmoothScroll.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(){var s,
|
1 |
+
!function(){var s,l,c,a,o={frameRate:150,animationTime:400,stepSize:100,pulseAlgorithm:!0,pulseScale:4,pulseNormalize:1,accelerationDelta:50,accelerationMax:3,keyboardSupport:!0,arrowScroll:50,fixedBackground:!0,excluded:""},p=o,u=!1,d=!1,i={x:0,y:0},f=!1,m=document.documentElement,h=[],w=/^Mac/.test(navigator.platform),v={left:37,up:38,right:39,down:40,spacebar:32,pageup:33,pagedown:34,end:35,home:36},y={37:1,38:1,39:1,40:1};function b(){if(!f&&document.body){f=!0;var e=document.body,t=document.documentElement,o=window.innerHeight,n=e.scrollHeight;if(m=0<=document.compatMode.indexOf("CSS")?t:e,s=e,p.keyboardSupport&&Y("keydown",D),top!=self)d=!0;else if(Z&&o<n&&(e.offsetHeight<=o||t.offsetHeight<=o)){var r,a=document.createElement("div");a.style.cssText="position:absolute; z-index:-10000; top:0; left:0; right:0; height:"+m.scrollHeight+"px",document.body.appendChild(a),c=function(){r||(r=setTimeout(function(){u||(a.style.height="0",a.style.height=m.scrollHeight+"px",r=null)},500))},setTimeout(c,10),Y("resize",c);if((l=new R(c)).observe(e,{attributes:!0,childList:!0,characterData:!1}),m.offsetHeight<=o){var i=document.createElement("div");i.style.clear="both",e.appendChild(i)}}p.fixedBackground||u||(e.style.backgroundAttachment="scroll",t.style.backgroundAttachment="scroll")}}var g=[],S=!1,x=Date.now();function k(d,f,m){var e,t;if(e=0<(e=f)?1:-1,t=0<(t=m)?1:-1,(i.x!==e||i.y!==t)&&(i.x=e,i.y=t,g=[],x=0),1!=p.accelerationMax){var o=Date.now()-x;if(o<p.accelerationDelta){var n=(1+50/o)/2;1<n&&(n=Math.min(n,p.accelerationMax),f*=n,m*=n)}x=Date.now()}if(g.push({x:f,y:m,lastX:f<0?.99:-.99,lastY:m<0?.99:-.99,start:Date.now()}),!S){var r=q(),h=d===r||d===document.body;null==d.$scrollBehavior&&function(e){var t=M(e);if(null==B[t]){var o=getComputedStyle(e,"")["scroll-behavior"];B[t]="smooth"==o}return B[t]}(d)&&(d.$scrollBehavior=d.style.scrollBehavior,d.style.scrollBehavior="auto");var w=function(e){for(var t=Date.now(),o=0,n=0,r=0;r<g.length;r++){var a=g[r],i=t-a.start,l=i>=p.animationTime,c=l?1:i/p.animationTime;p.pulseAlgorithm&&(c=F(c));var s=a.x*c-a.lastX>>0,u=a.y*c-a.lastY>>0;o+=s,n+=u,a.lastX+=s,a.lastY+=u,l&&(g.splice(r,1),r--)}h?window.scrollBy(o,n):(o&&(d.scrollLeft+=o),n&&(d.scrollTop+=n)),f||m||(g=[]),g.length?j(w,d,1e3/p.frameRate+1):(S=!1,null!=d.$scrollBehavior&&(d.style.scrollBehavior=d.$scrollBehavior,d.$scrollBehavior=null))};j(w,d,0),S=!0}}function e(e){f||b();var t=e.target;if(e.defaultPrevented||e.ctrlKey)return!0;if(N(s,"embed")||N(t,"embed")&&/\.pdf/i.test(t.src)||N(s,"object")||t.shadowRoot)return!0;var o=-e.wheelDeltaX||e.deltaX||0,n=-e.wheelDeltaY||e.deltaY||0;w&&(e.wheelDeltaX&&K(e.wheelDeltaX,120)&&(o=e.wheelDeltaX/Math.abs(e.wheelDeltaX)*-120),e.wheelDeltaY&&K(e.wheelDeltaY,120)&&(n=e.wheelDeltaY/Math.abs(e.wheelDeltaY)*-120)),o||n||(n=-e.wheelDelta||0),1===e.deltaMode&&(o*=40,n*=40);var r=z(t);return r?!!function(e){if(!e)return;h.length||(h=[e,e,e]);e=Math.abs(e),h.push(e),h.shift(),clearTimeout(a),a=setTimeout(function(){try{localStorage.SS_deltaBuffer=h.join(",")}catch(e){}},1e3);var t=120<e&&P(e);return!P(120)&&!P(100)&&!t}(n)||(1.2<Math.abs(o)&&(o*=p.stepSize/120),1.2<Math.abs(n)&&(n*=p.stepSize/120),k(r,o,n),e.preventDefault(),void C()):!d||!W||(Object.defineProperty(e,"target",{value:window.frameElement}),parent.wheel(e))}function D(e){var t=e.target,o=e.ctrlKey||e.altKey||e.metaKey||e.shiftKey&&e.keyCode!==v.spacebar;document.body.contains(s)||(s=document.activeElement);var n=/^(button|submit|radio|checkbox|file|color|image)$/i;if(e.defaultPrevented||/^(textarea|select|embed|object)$/i.test(t.nodeName)||N(t,"input")&&!n.test(t.type)||N(s,"video")||function(e){var t=e.target,o=!1;if(-1!=document.URL.indexOf("www.youtube.com/watch"))do{if(o=t.classList&&t.classList.contains("html5-video-controls"))break}while(t=t.parentNode);return o}(e)||t.isContentEditable||o)return!0;if((N(t,"button")||N(t,"input")&&n.test(t.type))&&e.keyCode===v.spacebar)return!0;if(N(t,"input")&&"radio"==t.type&&y[e.keyCode])return!0;var r=0,a=0,i=z(s);if(!i)return!d||!W||parent.keydown(e);var l=i.clientHeight;switch(i==document.body&&(l=window.innerHeight),e.keyCode){case v.up:a=-p.arrowScroll;break;case v.down:a=p.arrowScroll;break;case v.spacebar:a=-(e.shiftKey?1:-1)*l*.9;break;case v.pageup:a=.9*-l;break;case v.pagedown:a=.9*l;break;case v.home:i==document.body&&document.scrollingElement&&(i=document.scrollingElement),a=-i.scrollTop;break;case v.end:var c=i.scrollHeight-i.scrollTop-l;a=0<c?c+10:0;break;case v.left:r=-p.arrowScroll;break;case v.right:r=p.arrowScroll;break;default:return!0}k(i,r,a),e.preventDefault(),C()}function t(e){s=e.target}var n,r,M=(n=0,function(e){return e.uniqueID||(e.uniqueID=n++)}),E={},T={},B={};function C(){clearTimeout(r),r=setInterval(function(){E=T=B={}},1e3)}function H(e,t,o){for(var n=o?E:T,r=e.length;r--;)n[M(e[r])]=t;return t}function z(e){var t=[],o=document.body,n=m.scrollHeight;do{var r=(!1?E:T)[M(e)];if(r)return H(t,r);if(t.push(e),n===e.scrollHeight){var a=O(m)&&O(o)||X(m);if(d&&L(m)||!d&&a)return H(t,q())}else if(L(e)&&X(e))return H(t,e)}while(e=e.parentElement)}function L(e){return e.clientHeight+10<e.scrollHeight}function O(e){return"hidden"!==getComputedStyle(e,"").getPropertyValue("overflow-y")}function X(e){var t=getComputedStyle(e,"").getPropertyValue("overflow-y");return"scroll"===t||"auto"===t}function Y(e,t,o){window.addEventListener(e,t,o||!1)}function A(e,t,o){window.removeEventListener(e,t,o||!1)}function N(e,t){return e&&(e.nodeName||"").toLowerCase()===t.toLowerCase()}if(window.localStorage&&localStorage.SS_deltaBuffer)try{h=localStorage.SS_deltaBuffer.split(",")}catch(e){}function K(e,t){return Math.floor(e/t)==e/t}function P(e){return K(h[0],e)&&K(h[1],e)&&K(h[2],e)}var $,j=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e,t,o){window.setTimeout(e,o||1e3/60)},R=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,q=($=document.scrollingElement,function(){if(!$){var e=document.createElement("div");e.style.cssText="height:10000px;width:1px;",document.body.appendChild(e);var t=document.body.scrollTop;document.documentElement.scrollTop,window.scrollBy(0,3),$=document.body.scrollTop!=t?document.body:document.documentElement,window.scrollBy(0,-3),document.body.removeChild(e)}return $});function V(e){var t;return((e*=p.pulseScale)<1?e-(1-Math.exp(-e)):(e-=1,(t=Math.exp(-1))+(1-Math.exp(-e))*(1-t)))*p.pulseNormalize}function F(e){return 1<=e?1:e<=0?0:(1==p.pulseNormalize&&(p.pulseNormalize/=V(1)),V(e))}var I=window.navigator.userAgent,_=/Edge/.test(I),W=/chrome/i.test(I)&&!_,U=/safari/i.test(I)&&!_,G=/firefox/i.test(I),J=/mobile/i.test(I),Q=/Windows NT 6.1/i.test(I)&&/rv:11/i.test(I),Z=U&&(/Version\/8/i.test(I)||/Version\/9/i.test(I)),ee=(W||U||Q||G)&&!J,te=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){te=!0}}))}catch(e){}var oe=!!te&&{passive:!1},ne="onwheel"in document.createElement("div")?"wheel":"mousewheel";function re(e){for(var t in e)o.hasOwnProperty(t)&&(p[t]=e[t])}ne&&ee&&(Y(ne,e,oe),Y("mousedown",t),Y("load",b)),re.destroy=function(){l&&l.disconnect(),A(ne,e),A("mousedown",t),A("keydown",D),A("resize",c),A("load",b)},window.SmoothScrollOptions&&re(window.SmoothScrollOptions),"function"==typeof define&&define.amd?define(function(){return re}):"object"==typeof exports?module.exports=re:window.SmoothScroll=re}();
|
mousewheel-smooth-scroll.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: MouseWheel Smooth Scroll
|
4 |
Plugin URI: https://kubiq.sk
|
5 |
Description: MouseWheel smooth scrolling for your WordPress website
|
6 |
-
Version: 5.
|
7 |
Author: KubiQ
|
8 |
Author URI: https://kubiq.sk
|
9 |
Text Domain: wpmss
|
@@ -74,7 +74,7 @@ class wpmss{
|
|
74 |
}
|
75 |
|
76 |
function plugin_scripts_load(){
|
77 |
-
wp_enqueue_script( 'SmoothScroll', plugins_url( 'js/SmoothScroll.min.js', __FILE__ ), array('jquery'), '1.4.
|
78 |
wp_enqueue_script( 'wpmss_script', plugins_url( 'js/wpmss.min.js', __FILE__ ), array('jquery'), $this->settings['general']['timestamp'], 1 );
|
79 |
}
|
80 |
|
@@ -291,6 +291,9 @@ class wpmss{
|
|
291 |
}
|
292 |
|
293 |
function plugin_info_options(){ ?>
|
|
|
|
|
|
|
294 |
<p><?php _e( 'Any ideas, problems, issues?', 'wpmss' ) ?></p>
|
295 |
<p>Ing. Jakub Novák</p>
|
296 |
<p><a href="mailto:info@kubiq.sk" target="_blank">info@kubiq.sk</a></p>
|
3 |
Plugin Name: MouseWheel Smooth Scroll
|
4 |
Plugin URI: https://kubiq.sk
|
5 |
Description: MouseWheel smooth scrolling for your WordPress website
|
6 |
+
Version: 5.2
|
7 |
Author: KubiQ
|
8 |
Author URI: https://kubiq.sk
|
9 |
Text Domain: wpmss
|
74 |
}
|
75 |
|
76 |
function plugin_scripts_load(){
|
77 |
+
wp_enqueue_script( 'SmoothScroll', plugins_url( 'js/SmoothScroll.min.js', __FILE__ ), array('jquery'), '1.4.9.1', 1 );
|
78 |
wp_enqueue_script( 'wpmss_script', plugins_url( 'js/wpmss.min.js', __FILE__ ), array('jquery'), $this->settings['general']['timestamp'], 1 );
|
79 |
}
|
80 |
|
291 |
}
|
292 |
|
293 |
function plugin_info_options(){ ?>
|
294 |
+
<p>This plugin is only WordPress implementation of JS script from <strong title="Blaze (Balázs Galambosi)">gblazex</strong>.</p>
|
295 |
+
<p>Find more <a href="https://github.com/gblazex/smoothscroll-for-websites" target="_blank">on Github</a></p>
|
296 |
+
<hr>
|
297 |
<p><?php _e( 'Any ideas, problems, issues?', 'wpmss' ) ?></p>
|
298 |
<p>Ing. Jakub Novák</p>
|
299 |
<p><a href="mailto:info@kubiq.sk" target="_blank">info@kubiq.sk</a></p>
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: KubiQ
|
|
3 |
Donate link: https://kubiq.sk
|
4 |
Tags: smooth scroll, mousewheel scroll, scrolling
|
5 |
Requires at least: 3.0.1
|
6 |
-
Tested up to: 5.1
|
7 |
-
Stable tag: 5.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -26,6 +26,10 @@ Replace basic website scrolling "effect" with nice smooth scroll using mousewhee
|
|
26 |
|
27 |
== Changelog ==
|
28 |
|
|
|
|
|
|
|
|
|
29 |
= 5.1 =
|
30 |
* tested on WP 5.1
|
31 |
* updated scrolling script to version 1.4.9
|
3 |
Donate link: https://kubiq.sk
|
4 |
Tags: smooth scroll, mousewheel scroll, scrolling
|
5 |
Requires at least: 3.0.1
|
6 |
+
Tested up to: 5.2.1
|
7 |
+
Stable tag: 5.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
26 |
|
27 |
== Changelog ==
|
28 |
|
29 |
+
= 5.2 =
|
30 |
+
* tested on WP 5.2.1
|
31 |
+
* make it works on Firefox
|
32 |
+
|
33 |
= 5.1 =
|
34 |
* tested on WP 5.1
|
35 |
* updated scrolling script to version 1.4.9
|