Version Description
- Fixed various PHP notices in debug mode.
- Minor script optimizations.
Download this release
Release Info
Developer | malihu |
Plugin | Page scroll to id |
Version | 1.5.8 |
Comparing to | |
See all releases |
Code changes from version 1.5.7 to 1.5.8
- js/jquery.malihu.PageScroll2id.js +2 -2
- malihu-pagescroll2id.php +10 -8
- readme.txt +9 -1
js/jquery.malihu.PageScroll2id.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/* == Page scroll to id == Version: 1.5.
|
2 |
-
(function(f,j,n,g){var d="mPageScroll2id",k="mPS2id",v=".m_PageScroll2id,a[rel~='m_PageScroll2id'],.page-scroll-to-id,a[rel~='page-scroll-to-id']",l={scrollSpeed:1300,autoScrollSpeed:true,scrollEasing:"easeInOutExpo",scrollingEasing:"easeInOutCirc",pageEndSmoothScroll:true,layout:"vertical",offset:0,highlightSelector:false,clickedClass:k+"-clicked",targetClass:k+"-target",highlightClass:k+"-highlight",forceSingleHighlight:false,keepHighlightUntilNext:false,highlightByNextTarget:false,disablePluginBelow:false,clickEvents:true,onStart:function(){},onComplete:function(){},defaultSelector:false,live:true},r,c,i,a,s,h,p,q,o,t,b=0,e,u={init:function(w){var w=f.extend(true,{},l,w);f(n).data(k,w);c=f(n).data(k);r=(!r)?this.selector:r+","+this.selector;if(c.defaultSelector){if(typeof f(r)!=="object"||f(r).length===0){r=v}}if(c.clickEvents){f(n).undelegate("."+k).delegate(r,"click."+k,function(z){if(m._isDisabled.call(null)){m._removeClasses.call(null);return}var y=f(this),x=y.attr("href"),A=y.prop("href");if(x&&x.indexOf("#/")!==-1){return}m._reset.call(null);t=y.data("ps2id-offset")||0;if(m._isValid.call(null,x,A)&&m._findTarget.call(null,x)){z.preventDefault();a="selector";s=y;m._setClasses.call(null,true);m._scrollTo.call(null)}})}f(j).unbind("."+k).bind("scroll."+k+" resize."+k,function(){if(m._isDisabled.call(null)){m._removeClasses.call(null);return}var x=f("._"+k+"-t");x.each(function(z){var y=f(this),B=y.attr("id"),A=m._findHighlight.call(null,B);m._setClasses.call(null,false,y,A);if(z==x.length-1){m._extendClasses.call(null)}})});i=true;m._setup.call(null);m._live.call(null)},scrollTo:function(y,w){if(m._isDisabled.call(null)){m._removeClasses.call(null);return}if(y&&typeof y!=="undefined"){m._isInit.call(null);var x={layout:c.layout,offset:c.offset,clicked:false},w=f.extend(true,{},x,w);m._reset.call(null);q=w.layout;o=w.offset;y=(y.indexOf("#")!==-1)?y:"#"+y;if(m._isValid.call(null,y)&&m._findTarget.call(null,y)){a="scrollTo";s=w.clicked;if(s){m._setClasses.call(null,true)}m._scrollTo.call(null)}}},destroy:function(){f(j).unbind("."+k);f(n).undelegate("."+k).removeData(k);f("._"+k+"-t").removeData(k);m._removeClasses.call(null,true)}},m={_isDisabled:function(){var x=j,w="inner",y=c.disablePluginBelow instanceof Array?[c.disablePluginBelow[0]||0,c.disablePluginBelow[1]||0]:[c.disablePluginBelow||0,0];if(!("innerWidth" in j)){w="client";x=n.documentElement||n.body}return x[w+"Width"]<=y[0]||x[w+"Height"]<=y[1]},_isValid:function(w,z){if(!w){return}z=(!z)?w:z;var y=(z.indexOf("#/")!==-1)?z.split("#/")[0]:z.split("#")[0],x=j.location.toString().split("#")[0];return w!=="#"&&w.indexOf("#")!==-1&&(y===""||y===x)},_setup:function(){var x=m._highlightSelector(),w=1,y=0;return f(x).each(function(){var C=f(this),z=C.attr("href"),E=C.prop("href");if(m._isValid.call(null,z,E)){var D=(z.indexOf("#/")!==-1)?z.split("#/")[1]:z.split("#")[1],A=f("#"+D);if(A.length>0){if(c.highlightByNextTarget){if(A!==y){if(!y){A.data(k,{tn:"0"})}else{y.data(k,{tn:A})}y=A}}if(!A.hasClass("_"+k+"-t")){A.addClass("_"+k+"-t")}A.data(k,{i:w});if(!C.hasClass("_"+k+"-h")){C.addClass("_"+k+"-h")}var B=m._findHighlight.call(null,D);m._setClasses.call(null,false,A,B);b=w;w++;if(w==f(x).length){m._extendClasses.call(null)}}}})},_highlightSelector:function(){return(c.highlightSelector&&c.highlightSelector!=="")?c.highlightSelector:r},_findTarget:function(y){var x=(y.indexOf("#/")!==-1)?y.split("#/")[1]:y.split("#")[1],w=f("#"+x);if(w.length<1||w.css("position")==="fixed"){if(x==="top"){w=f("body")}else{return}}h=w;if(!q){q=c.layout}o=m._setOffset.call(null);p=[(w.offset().top-o[0]).toString(),(w.offset().left-o[1]).toString()];p[0]=(p[0]<0)?0:p[0];p[1]=(p[1]<0)?0:p[1];return p},_setOffset:function(){if(!o){o=(c.offset)?c.offset:0}if(t){o=t}var A,z,B,w;switch(typeof o){case"object":case"string":A=[(o.y)?o.y:o,(o.x)?o.x:o];z=[(A[0] instanceof jQuery)?A[0]:f(A[0]),(A[1] instanceof jQuery)?A[1]:f(A[1])];if(z[0].length>0){B=z[0].height();if(z[0].css("position")==="fixed"){B+=z[0][0].offsetTop}}else{if(!isNaN(parseFloat(A[0]))&&isFinite(A[0])){B=parseInt(A[0])}else{B=0}}if(z[1].length>0){w=z[1].width();if(z[1].css("position")==="fixed"){w+=z[1][0].offsetLeft}}else{if(!isNaN(parseFloat(A[1]))&&isFinite(A[1])){w=parseInt(A[1])}else{w=0}}break;case"function":A=o.call(null);if(A instanceof Array){B=A[0];w=A[1]}else{B=w=A}break;default:B=w=parseInt(o)}return[B,w]},_findHighlight:function(B){var A=j.location.toString().split("#")[0],x=f("._"+k+"-h[href='#"+B+"']"),y=f("._"+k+"-h[href='"+A+"#"+B+"']"),w=f("._"+k+"-h[href='#/"+B+"']"),z=f("._"+k+"-h[href='"+A+"#/"+B+"']");x=(x.length>0)?x:y;w=(w.length>0)?w:z;return(w.length>0)?w:x},_setClasses:function(B,x,y){var A=c.clickedClass,w=c.targetClass,z=c.highlightClass;if(B&&A&&A!==""){f("."+A).removeClass(A);s.addClass(A)}else{if(x&&w&&w!==""&&y&&z&&z!==""){if(m._currentTarget.call(null,x)){x.addClass(w);y.addClass(z)}else{if(!c.keepHighlightUntilNext||f("."+z).length>1){x.removeClass(w);y.removeClass(z)}}}}},_extendClasses:function(){var w=c.targetClass,B=c.highlightClass,D=f("."+w),A=f("."+B),C=w+"-first",z=w+"-last",y=B+"-first",x=B+"-last";f("._"+k+"-t").removeClass(C+" "+z);f("._"+k+"-h").removeClass(y+" "+x);if(!c.forceSingleHighlight){D.slice(0,1).addClass(C).end().slice(-1).addClass(z);A.slice(0,1).addClass(y).end().slice(-1).addClass(x)}else{if(c.keepHighlightUntilNext&&D.length>1){D.slice(0,1).removeClass(w);A.slice(0,1).removeClass(B)}else{D.slice(1).removeClass(w);A.slice(1).removeClass(B)}}},_removeClasses:function(w){f("."+c.clickedClass).removeClass(c.clickedClass);f("."+c.targetClass).removeClass(c.targetClass+" "+c.targetClass+"-first "+c.targetClass+"-last");f("."+c.highlightClass).removeClass(c.highlightClass+" "+c.highlightClass+"-first "+c.highlightClass+"-last");if(w){f("._"+k+"-t").removeClass("_"+k+"-t");f("._"+k+"-h").removeClass("_"+k+"-h")}},_currentTarget:function(M){var P=c["target_"+M.data(k).i],D=M.data("ps2id-target"),A=D?f(D)[0].getBoundingClientRect():M[0].getBoundingClientRect();if(typeof P!=="undefined"){var K=M.offset().top,L=M.offset().left,Q=(P.from)?P.from+K:K,B=(P.to)?P.to+K:K,N=(P.fromX)?P.fromX+L:L,z=(P.toX)?P.toX+L:L;return(A.top>=B&&A.top<=Q&&A.left>=z&&A.left<=N)}else{var I=f(j).height(),T=f(j).width(),G=D?f(D).height():M.height(),S=D?f(D).width():M.width(),F=1+(G/I),O=F,J=(G<I)?F*(I/G):F,w=1+(S/T),E=w,R=(S<T)?w*(T/S):w,U=[A.top<=I/O,A.bottom>=I/J,A.left<=T/E,A.right>=T/R];if(c.highlightByNextTarget){var C=M.data(k).tn;if(C){var H=C[0].getBoundingClientRect();if(c.layout==="vertical"){U=[A.top<=I/2,H.top>I/2,1,1]}else{if(c.layout==="horizontal"){U=[1,1,A.left<=T/2,H.left>T/2]}}}}return(U[0]&&U[1]&&U[2]&&U[3])}},_scrollTo:function(){c.scrollSpeed=parseInt(c.scrollSpeed);p=(c.pageEndSmoothScroll)?m._pageEndSmoothScroll.call(null):p;var x=f("html,body"),z=(c.autoScrollSpeed)?m._autoScrollSpeed.call(null):c.scrollSpeed,B=(x.is(":animated"))?c.scrollingEasing:c.scrollEasing,y=f(j).scrollTop(),w=f(j).scrollLeft();switch(q){case"horizontal":if(w!=p[1]){m._callbacks.call(null,"onStart");x.stop().animate({scrollLeft:p[1]},z,B).promise().then(function(){m._callbacks.call(null,"onComplete")})}break;case"auto":if(y!=p[0]||w!=p[1]){m._callbacks.call(null,"onStart");if(navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/)){var A;x.stop().animate({pageYOffset:p[0],pageXOffset:p[1]},{duration:z,easing:B,step:function(C,D){if(D.prop=="pageXOffset"){A=C}else{if(D.prop=="pageYOffset"){j.scrollTo(A,C)}}}}).promise().then(function(){m._callbacks.call(null,"onComplete")})}else{x.stop().animate({scrollTop:p[0],scrollLeft:p[1]},z,B).promise().then(function(){m._callbacks.call(null,"onComplete")})}}break;default:if(y!=p[0]){m._callbacks.call(null,"onStart");x.stop().animate({scrollTop:p[0]},z,B).promise().then(function(){m._callbacks.call(null,"onComplete")})}}},_pageEndSmoothScroll:function(){var w=f(n).height(),z=f(n).width(),y=f(j).height(),x=f(j).width();return[((w-p[0])<y)?w-y:p[0],((z-p[1])<x)?z-x:p[1]]},_autoScrollSpeed:function(){var y=f(j).scrollTop(),x=f(j).scrollLeft(),z=f(n).height(),w=f(n).width(),A=[c.scrollSpeed+((c.scrollSpeed*(Math.floor((Math.abs(p[0]-y)/z)*100)))/100),c.scrollSpeed+((c.scrollSpeed*(Math.floor((Math.abs(p[1]-x)/w)*100)))/100)];return Math.max.apply(Math,A)},_callbacks:function(w){if(!c){return}this[k]={trigger:a,clicked:s,target:h,scrollTo:{y:p[0],x:p[1]}};switch(w){case"onStart":c.onStart.call(null,this[k]);break;case"onComplete":c.onComplete.call(null,this[k]);break}},_reset:function(){q=o=t=false},_isInit:function(){if(!i){u.init.apply(this)}},_live:function(){e=setTimeout(function(){if(c.live){if(f(m._highlightSelector()).length!==b){m._setup.call(null)}}else{if(e){clearTimeout(e)}}m._live.call(null)},1000)},_easing:function(){f.easing.easeInQuad=f.easing.easeInQuad||function(y,z,w,B,A){return B*(z/=A)*z+w};f.easing.easeOutQuad=f.easing.easeOutQuad||function(y,z,w,B,A){return -B*(z/=A)*(z-2)+w};f.easing.easeInOutQuad=f.easing.easeInOutQuad||function(y,z,w,B,A){if((z/=A/2)<1){return B/2*z*z+w}return -B/2*((--z)*(z-2)-1)+w};f.easing.easeInCubic=f.easing.easeInCubic||function(y,z,w,B,A){return B*(z/=A)*z*z+w};f.easing.easeOutCubic=f.easing.easeOutCubic||function(y,z,w,B,A){return B*((z=z/A-1)*z*z+1)+w};f.easing.easeInOutCubic=f.easing.easeInOutCubic||function(y,z,w,B,A){if((z/=A/2)<1){return B/2*z*z*z+w}return B/2*((z-=2)*z*z+2)+w};f.easing.easeInQuart=f.easing.easeInQuart||function(y,z,w,B,A){return B*(z/=A)*z*z*z+w};f.easing.easeOutQuart=f.easing.easeOutQuart||function(y,z,w,B,A){return -B*((z=z/A-1)*z*z*z-1)+w};f.easing.easeInOutQuart=f.easing.easeInOutQuart||function(y,z,w,B,A){if((z/=A/2)<1){return B/2*z*z*z*z+w}return -B/2*((z-=2)*z*z*z-2)+w};f.easing.easeInQuint=f.easing.easeInQuint||function(y,z,w,B,A){return B*(z/=A)*z*z*z*z+w};f.easing.easeOutQuint=f.easing.easeOutQuint||function(y,z,w,B,A){return B*((z=z/A-1)*z*z*z*z+1)+w};f.easing.easeInOutQuint=f.easing.easeInOutQuint||function(y,z,w,B,A){if((z/=A/2)<1){return B/2*z*z*z*z*z+w}return B/2*((z-=2)*z*z*z*z+2)+w};f.easing.easeInExpo=f.easing.easeInExpo||function(y,z,w,B,A){return(z==0)?w:B*Math.pow(2,10*(z/A-1))+w};f.easing.easeOutExpo=f.easing.easeOutExpo||function(y,z,w,B,A){return(z==A)?w+B:B*(-Math.pow(2,-10*z/A)+1)+w};f.easing.easeInOutExpo=f.easing.easeInOutExpo||function(y,z,w,B,A){if(z==0){return w}if(z==A){return w+B}if((z/=A/2)<1){return B/2*Math.pow(2,10*(z-1))+w}return B/2*(-Math.pow(2,-10*--z)+2)+w};f.easing.easeInSine=f.easing.easeInSine||function(y,z,w,B,A){return -B*Math.cos(z/A*(Math.PI/2))+B+w};f.easing.easeOutSine=f.easing.easeOutSine||function(y,z,w,B,A){return B*Math.sin(z/A*(Math.PI/2))+w};f.easing.easeInOutSine=f.easing.easeInOutSine||function(y,z,w,B,A){return -B/2*(Math.cos(Math.PI*z/A)-1)+w};f.easing.easeInCirc=f.easing.easeInCirc||function(y,z,w,B,A){return -B*(Math.sqrt(1-(z/=A)*z)-1)+w};f.easing.easeOutCirc=f.easing.easeOutCirc||function(y,z,w,B,A){return B*Math.sqrt(1-(z=z/A-1)*z)+w};f.easing.easeInOutCirc=f.easing.easeInOutCirc||function(y,z,w,B,A){if((z/=A/2)<1){return -B/2*(Math.sqrt(1-z*z)-1)+w}return B/2*(Math.sqrt(1-(z-=2)*z)+1)+w};f.easing.easeInElastic=f.easing.easeInElastic||function(y,A,w,E,D){var B=1.70158;var C=0;var z=E;if(A==0){return w}if((A/=D)==1){return w+E}if(!C){C=D*0.3}if(z<Math.abs(E)){z=E;var B=C/4}else{var B=C/(2*Math.PI)*Math.asin(E/z)}return -(z*Math.pow(2,10*(A-=1))*Math.sin((A*D-B)*(2*Math.PI)/C))+w};f.easing.easeOutElastic=f.easing.easeOutElastic||function(y,A,w,E,D){var B=1.70158;var C=0;var z=E;if(A==0){return w}if((A/=D)==1){return w+E}if(!C){C=D*0.3}if(z<Math.abs(E)){z=E;var B=C/4}else{var B=C/(2*Math.PI)*Math.asin(E/z)}return z*Math.pow(2,-10*A)*Math.sin((A*D-B)*(2*Math.PI)/C)+E+w};f.easing.easeInOutElastic=f.easing.easeInOutElastic||function(y,A,w,E,D){var B=1.70158;var C=0;var z=E;if(A==0){return w}if((A/=D/2)==2){return w+E}if(!C){C=D*(0.3*1.5)}if(z<Math.abs(E)){z=E;var B=C/4}else{var B=C/(2*Math.PI)*Math.asin(E/z)}if(A<1){return -0.5*(z*Math.pow(2,10*(A-=1))*Math.sin((A*D-B)*(2*Math.PI)/C))+w}return z*Math.pow(2,-10*(A-=1))*Math.sin((A*D-B)*(2*Math.PI)/C)*0.5+E+w};f.easing.easeInBack=f.easing.easeInBack||function(y,z,w,C,B,A){if(A==g){A=1.70158}return C*(z/=B)*z*((A+1)*z-A)+w};f.easing.easeOutBack=f.easing.easeOutBack||function(y,z,w,C,B,A){if(A==g){A=1.70158}return C*((z=z/B-1)*z*((A+1)*z+A)+1)+w};f.easing.easeInOutBack=f.easing.easeInOutBack||function(y,z,w,C,B,A){if(A==g){A=1.70158}if((z/=B/2)<1){return C/2*(z*z*(((A*=(1.525))+1)*z-A))+w}return C/2*((z-=2)*z*(((A*=(1.525))+1)*z+A)+2)+w};f.easing.easeInBounce=f.easing.easeInBounce||function(y,z,w,B,A){return B-f.easing.easeOutBounce(y,A-z,0,B,A)+w};f.easing.easeOutBounce=f.easing.easeOutBounce||function(y,z,w,B,A){if((z/=A)<(1/2.75)){return B*(7.5625*z*z)+w}else{if(z<(2/2.75)){return B*(7.5625*(z-=(1.5/2.75))*z+0.75)+w}else{if(z<(2.5/2.75)){return B*(7.5625*(z-=(2.25/2.75))*z+0.9375)+w}else{return B*(7.5625*(z-=(2.625/2.75))*z+0.984375)+w}}}};f.easing.easeInOutBounce=f.easing.easeInOutBounce||function(y,z,w,B,A){if(z<A/2){return f.easing.easeInBounce(y,z*2,0,B,A)*0.5+w}return f.easing.easeOutBounce(y,z*2-A,0,B,A)*0.5+B*0.5+w}}};m._easing.call();f.fn[d]=function(w){if(u[w]){return u[w].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof w==="object"||!w){return u.init.apply(this,arguments)}else{f.error("Method "+w+" does not exist")}}};f[d]=function(w){if(u[w]){return u[w].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof w==="object"||!w){return u.init.apply(this,arguments)}else{f.error("Method "+w+" does not exist")}}};f[d].defaults=l})(jQuery,window,document);
|
1 |
+
/* == Page scroll to id == Version: 1.5.4, License: MIT License (MIT) */
|
2 |
+
!function(e,t,a,n){var l,s,i,r,o,c,u,g,h,f,d,p="mPageScroll2id",_="mPS2id",C=".m_PageScroll2id,a[rel~='m_PageScroll2id'],.page-scroll-to-id,a[rel~='page-scroll-to-id'],._ps2id",v={scrollSpeed:1300,autoScrollSpeed:!0,scrollEasing:"easeInOutExpo",scrollingEasing:"easeInOutCirc",pageEndSmoothScroll:!0,layout:"vertical",offset:0,highlightSelector:!1,clickedClass:_+"-clicked",targetClass:_+"-target",highlightClass:_+"-highlight",forceSingleHighlight:!1,keepHighlightUntilNext:!1,highlightByNextTarget:!1,disablePluginBelow:!1,clickEvents:!0,onStart:function(){},onComplete:function(){},defaultSelector:!1,live:!0},m=0,I={init:function(n){var n=e.extend(!0,{},v,n);if(e(a).data(_,n),s=e(a).data(_),!this.selector){var c="__"+_;this.each(function(){var t=e(this);t.hasClass(c)||t.addClass(c)}),this.selector="."+c}l=l?l+","+this.selector:this.selector,s.defaultSelector&&("object"!=typeof e(l)||0===e(l).length)&&(l=C),s.clickEvents&&e(a).undelegate("."+_).delegate(l,"click."+_,function(t){if(O._isDisabled.call(null))return void O._removeClasses.call(null);var a=e(this),n=a.attr("href"),l=a.prop("href");n&&-1!==n.indexOf("#/")||(O._reset.call(null),f=a.data("ps2id-offset")||0,O._isValid.call(null,n,l)&&O._findTarget.call(null,n)&&(t.preventDefault(),r="selector",o=a,O._setClasses.call(null,!0),O._scrollTo.call(null)))}),e(t).unbind("."+_).bind("scroll."+_+" resize."+_,function(){if(O._isDisabled.call(null))return void O._removeClasses.call(null);var t=e("._"+_+"-t");t.each(function(a){var n=e(this),l=n.attr("id"),s=O._findHighlight.call(null,l);O._setClasses.call(null,!1,n,s),a==t.length-1&&O._extendClasses.call(null)})}),i=!0,O._setup.call(null),O._live.call(null)},scrollTo:function(t,a){if(O._isDisabled.call(null))return void O._removeClasses.call(null);if(t&&"undefined"!=typeof t){O._isInit.call(null);var n={layout:s.layout,offset:s.offset,clicked:!1},a=e.extend(!0,{},n,a);O._reset.call(null),g=a.layout,h=a.offset,t=-1!==t.indexOf("#")?t:"#"+t,O._isValid.call(null,t)&&O._findTarget.call(null,t)&&(r="scrollTo",o=a.clicked,o&&O._setClasses.call(null,!0),O._scrollTo.call(null))}},destroy:function(){e(t).unbind("."+_),e(a).undelegate("."+_).removeData(_),e("._"+_+"-t").removeData(_),O._removeClasses.call(null,!0)}},O={_isDisabled:function(){var e=t,n="inner",l=s.disablePluginBelow instanceof Array?[s.disablePluginBelow[0]||0,s.disablePluginBelow[1]||0]:[s.disablePluginBelow||0,0];return"innerWidth"in t||(n="client",e=a.documentElement||a.body),e[n+"Width"]<=l[0]||e[n+"Height"]<=l[1]},_isValid:function(e,a){if(e){a=a?a:e;var n=-1!==a.indexOf("#/")?a.split("#/")[0]:a.split("#")[0],l=t.location.toString().split("#")[0];return"#"!==e&&-1!==e.indexOf("#")&&(""===n||n===l)}},_setup:function(){var t=O._highlightSelector(),a=1,n=0;return e(t).each(function(){var l=e(this),i=l.attr("href"),r=l.prop("href");if(O._isValid.call(null,i,r)){var o=-1!==i.indexOf("#/")?i.split("#/")[1]:i.split("#")[1],c=e("#"+o);if(c.length>0){s.highlightByNextTarget&&c!==n&&(n?n.data(_,{tn:c}):c.data(_,{tn:"0"}),n=c),c.hasClass("_"+_+"-t")||c.addClass("_"+_+"-t"),c.data(_,{i:a}),l.hasClass("_"+_+"-h")||l.addClass("_"+_+"-h");var u=O._findHighlight.call(null,o);O._setClasses.call(null,!1,c,u),m=a,a++,a==e(t).length&&O._extendClasses.call(null)}}})},_highlightSelector:function(){return s.highlightSelector&&""!==s.highlightSelector?s.highlightSelector:l},_findTarget:function(t){var a=-1!==t.indexOf("#/")?t.split("#/")[1]:t.split("#")[1],n=e("#"+a);if(n.length<1||"fixed"===n.css("position")){if("top"!==a)return;n=e("body")}return c=n,g||(g=s.layout),h=O._setOffset.call(null),u=[(n.offset().top-h[0]).toString(),(n.offset().left-h[1]).toString()],u[0]=u[0]<0?0:u[0],u[1]=u[1]<0?0:u[1],u},_setOffset:function(){h||(h=s.offset?s.offset:0),f&&(h=f);var t,a,n,l;switch(typeof h){case"object":case"string":t=[h.y?h.y:h,h.x?h.x:h],a=[t[0]instanceof jQuery?t[0]:e(t[0]),t[1]instanceof jQuery?t[1]:e(t[1])],a[0].length>0?(n=a[0].height(),"fixed"===a[0].css("position")&&(n+=a[0][0].offsetTop)):n=!isNaN(parseFloat(t[0]))&&isFinite(t[0])?parseInt(t[0]):0,a[1].length>0?(l=a[1].width(),"fixed"===a[1].css("position")&&(l+=a[1][0].offsetLeft)):l=!isNaN(parseFloat(t[1]))&&isFinite(t[1])?parseInt(t[1]):0;break;case"function":t=h.call(null),t instanceof Array?(n=t[0],l=t[1]):n=l=t;break;default:n=l=parseInt(h)}return[n,l]},_findHighlight:function(a){var n=t.location.toString().split("#")[0],l=e("._"+_+"-h[href='#"+a+"']"),s=e("._"+_+"-h[href='"+n+"#"+a+"']"),i=e("._"+_+"-h[href='#/"+a+"']"),r=e("._"+_+"-h[href='"+n+"#/"+a+"']");return l=l.length>0?l:s,i=i.length>0?i:r,i.length>0?i:l},_setClasses:function(t,a,n){var l=s.clickedClass,i=s.targetClass,r=s.highlightClass;t&&l&&""!==l?(e("."+l).removeClass(l),o.addClass(l)):a&&i&&""!==i&&n&&r&&""!==r&&(O._currentTarget.call(null,a)?(a.addClass(i),n.addClass(r)):(!s.keepHighlightUntilNext||e("."+r).length>1)&&(a.removeClass(i),n.removeClass(r)))},_extendClasses:function(){var t=s.targetClass,a=s.highlightClass,n=e("."+t),l=e("."+a),i=t+"-first",r=t+"-last",o=a+"-first",c=a+"-last";e("._"+_+"-t").removeClass(i+" "+r),e("._"+_+"-h").removeClass(o+" "+c),s.forceSingleHighlight?s.keepHighlightUntilNext&&n.length>1?(n.slice(0,1).removeClass(t),l.slice(0,1).removeClass(a)):(n.slice(1).removeClass(t),l.slice(1).removeClass(a)):(n.slice(0,1).addClass(i).end().slice(-1).addClass(r),l.slice(0,1).addClass(o).end().slice(-1).addClass(c))},_removeClasses:function(t){e("."+s.clickedClass).removeClass(s.clickedClass),e("."+s.targetClass).removeClass(s.targetClass+" "+s.targetClass+"-first "+s.targetClass+"-last"),e("."+s.highlightClass).removeClass(s.highlightClass+" "+s.highlightClass+"-first "+s.highlightClass+"-last"),t&&(e("._"+_+"-t").removeClass("_"+_+"-t"),e("._"+_+"-h").removeClass("_"+_+"-h"))},_currentTarget:function(a){var n=s["target_"+a.data(_).i],l=a.data("ps2id-target"),i=l?e(l)[0].getBoundingClientRect():a[0].getBoundingClientRect();if("undefined"!=typeof n){var r=a.offset().top,o=a.offset().left,c=n.from?n.from+r:r,u=n.to?n.to+r:r,g=n.fromX?n.fromX+o:o,h=n.toX?n.toX+o:o;return i.top>=u&&i.top<=c&&i.left>=h&&i.left<=g}var f=e(t).height(),d=e(t).width(),p=l?e(l).height():a.height(),C=l?e(l).width():a.width(),v=1+p/f,m=v,I=f>p?v*(f/p):v,O=1+C/d,S=O,b=d>C?O*(d/C):O,M=[i.top<=f/m,i.bottom>=f/I,i.left<=d/S,i.right>=d/b];if(s.highlightByNextTarget){var y=a.data(_).tn;if(y){var k=y[0].getBoundingClientRect();"vertical"===s.layout?M=[i.top<=f/2,k.top>f/2,1,1]:"horizontal"===s.layout&&(M=[1,1,i.left<=d/2,k.left>d/2])}}return M[0]&&M[1]&&M[2]&&M[3]},_scrollTo:function(){s.scrollSpeed=parseInt(s.scrollSpeed),u=s.pageEndSmoothScroll?O._pageEndSmoothScroll.call(null):u;var a=e("html,body"),n=s.autoScrollSpeed?O._autoScrollSpeed.call(null):s.scrollSpeed,l=a.is(":animated")?s.scrollingEasing:s.scrollEasing,i=e(t).scrollTop(),r=e(t).scrollLeft();switch(g){case"horizontal":r!=u[1]&&(O._callbacks.call(null,"onStart"),a.stop().animate({scrollLeft:u[1]},n,l).promise().then(function(){O._callbacks.call(null,"onComplete")}));break;case"auto":if(i!=u[0]||r!=u[1])if(O._callbacks.call(null,"onStart"),navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/)){var o;a.stop().animate({pageYOffset:u[0],pageXOffset:u[1]},{duration:n,easing:l,step:function(e,a){"pageXOffset"==a.prop?o=e:"pageYOffset"==a.prop&&t.scrollTo(o,e)}}).promise().then(function(){O._callbacks.call(null,"onComplete")})}else a.stop().animate({scrollTop:u[0],scrollLeft:u[1]},n,l).promise().then(function(){O._callbacks.call(null,"onComplete")});break;default:i!=u[0]&&(O._callbacks.call(null,"onStart"),a.stop().animate({scrollTop:u[0]},n,l).promise().then(function(){O._callbacks.call(null,"onComplete")}))}},_pageEndSmoothScroll:function(){var n=e(a).height(),l=e(a).width(),s=e(t).height(),i=e(t).width();return[n-u[0]<s?n-s:u[0],l-u[1]<i?l-i:u[1]]},_autoScrollSpeed:function(){var n=e(t).scrollTop(),l=e(t).scrollLeft(),i=e(a).height(),r=e(a).width(),o=[s.scrollSpeed+s.scrollSpeed*Math.floor(Math.abs(u[0]-n)/i*100)/100,s.scrollSpeed+s.scrollSpeed*Math.floor(Math.abs(u[1]-l)/r*100)/100];return Math.max.apply(Math,o)},_callbacks:function(e){if(s)switch(this[_]={trigger:r,clicked:o,target:c,scrollTo:{y:u[0],x:u[1]}},e){case"onStart":s.onStart.call(null,this[_]);break;case"onComplete":s.onComplete.call(null,this[_])}},_reset:function(){g=h=f=!1},_isInit:function(){i||I.init.apply(this)},_live:function(){d=setTimeout(function(){s.live?e(O._highlightSelector()).length!==m&&O._setup.call(null):d&&clearTimeout(d),O._live.call(null)},1e3)},_easing:function(){e.easing.easeInQuad=e.easing.easeInQuad||function(e,t,a,n,l){return n*(t/=l)*t+a},e.easing.easeOutQuad=e.easing.easeOutQuad||function(e,t,a,n,l){return-n*(t/=l)*(t-2)+a},e.easing.easeInOutQuad=e.easing.easeInOutQuad||function(e,t,a,n,l){return(t/=l/2)<1?n/2*t*t+a:-n/2*(--t*(t-2)-1)+a},e.easing.easeInCubic=e.easing.easeInCubic||function(e,t,a,n,l){return n*(t/=l)*t*t+a},e.easing.easeOutCubic=e.easing.easeOutCubic||function(e,t,a,n,l){return n*((t=t/l-1)*t*t+1)+a},e.easing.easeInOutCubic=e.easing.easeInOutCubic||function(e,t,a,n,l){return(t/=l/2)<1?n/2*t*t*t+a:n/2*((t-=2)*t*t+2)+a},e.easing.easeInQuart=e.easing.easeInQuart||function(e,t,a,n,l){return n*(t/=l)*t*t*t+a},e.easing.easeOutQuart=e.easing.easeOutQuart||function(e,t,a,n,l){return-n*((t=t/l-1)*t*t*t-1)+a},e.easing.easeInOutQuart=e.easing.easeInOutQuart||function(e,t,a,n,l){return(t/=l/2)<1?n/2*t*t*t*t+a:-n/2*((t-=2)*t*t*t-2)+a},e.easing.easeInQuint=e.easing.easeInQuint||function(e,t,a,n,l){return n*(t/=l)*t*t*t*t+a},e.easing.easeOutQuint=e.easing.easeOutQuint||function(e,t,a,n,l){return n*((t=t/l-1)*t*t*t*t+1)+a},e.easing.easeInOutQuint=e.easing.easeInOutQuint||function(e,t,a,n,l){return(t/=l/2)<1?n/2*t*t*t*t*t+a:n/2*((t-=2)*t*t*t*t+2)+a},e.easing.easeInExpo=e.easing.easeInExpo||function(e,t,a,n,l){return 0==t?a:n*Math.pow(2,10*(t/l-1))+a},e.easing.easeOutExpo=e.easing.easeOutExpo||function(e,t,a,n,l){return t==l?a+n:n*(-Math.pow(2,-10*t/l)+1)+a},e.easing.easeInOutExpo=e.easing.easeInOutExpo||function(e,t,a,n,l){return 0==t?a:t==l?a+n:(t/=l/2)<1?n/2*Math.pow(2,10*(t-1))+a:n/2*(-Math.pow(2,-10*--t)+2)+a},e.easing.easeInSine=e.easing.easeInSine||function(e,t,a,n,l){return-n*Math.cos(t/l*(Math.PI/2))+n+a},e.easing.easeOutSine=e.easing.easeOutSine||function(e,t,a,n,l){return n*Math.sin(t/l*(Math.PI/2))+a},e.easing.easeInOutSine=e.easing.easeInOutSine||function(e,t,a,n,l){return-n/2*(Math.cos(Math.PI*t/l)-1)+a},e.easing.easeInCirc=e.easing.easeInCirc||function(e,t,a,n,l){return-n*(Math.sqrt(1-(t/=l)*t)-1)+a},e.easing.easeOutCirc=e.easing.easeOutCirc||function(e,t,a,n,l){return n*Math.sqrt(1-(t=t/l-1)*t)+a},e.easing.easeInOutCirc=e.easing.easeInOutCirc||function(e,t,a,n,l){return(t/=l/2)<1?-n/2*(Math.sqrt(1-t*t)-1)+a:n/2*(Math.sqrt(1-(t-=2)*t)+1)+a},e.easing.easeInElastic=e.easing.easeInElastic||function(e,t,a,n,l){var s=1.70158,i=0,r=n;if(0==t)return a;if(1==(t/=l))return a+n;if(i||(i=.3*l),r<Math.abs(n)){r=n;var s=i/4}else var s=i/(2*Math.PI)*Math.asin(n/r);return-(r*Math.pow(2,10*(t-=1))*Math.sin(2*(t*l-s)*Math.PI/i))+a},e.easing.easeOutElastic=e.easing.easeOutElastic||function(e,t,a,n,l){var s=1.70158,i=0,r=n;if(0==t)return a;if(1==(t/=l))return a+n;if(i||(i=.3*l),r<Math.abs(n)){r=n;var s=i/4}else var s=i/(2*Math.PI)*Math.asin(n/r);return r*Math.pow(2,-10*t)*Math.sin(2*(t*l-s)*Math.PI/i)+n+a},e.easing.easeInOutElastic=e.easing.easeInOutElastic||function(e,t,a,n,l){var s=1.70158,i=0,r=n;if(0==t)return a;if(2==(t/=l/2))return a+n;if(i||(i=.3*l*1.5),r<Math.abs(n)){r=n;var s=i/4}else var s=i/(2*Math.PI)*Math.asin(n/r);return 1>t?-.5*r*Math.pow(2,10*(t-=1))*Math.sin(2*(t*l-s)*Math.PI/i)+a:r*Math.pow(2,-10*(t-=1))*Math.sin(2*(t*l-s)*Math.PI/i)*.5+n+a},e.easing.easeInBack=e.easing.easeInBack||function(e,t,a,l,s,i){return i==n&&(i=1.70158),l*(t/=s)*t*((i+1)*t-i)+a},e.easing.easeOutBack=e.easing.easeOutBack||function(e,t,a,l,s,i){return i==n&&(i=1.70158),l*((t=t/s-1)*t*((i+1)*t+i)+1)+a},e.easing.easeInOutBack=e.easing.easeInOutBack||function(e,t,a,l,s,i){return i==n&&(i=1.70158),(t/=s/2)<1?l/2*t*t*(((i*=1.525)+1)*t-i)+a:l/2*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)+a},e.easing.easeInBounce=e.easing.easeInBounce||function(t,a,n,l,s){return l-e.easing.easeOutBounce(t,s-a,0,l,s)+n},e.easing.easeOutBounce=e.easing.easeOutBounce||function(e,t,a,n,l){return(t/=l)<1/2.75?7.5625*n*t*t+a:2/2.75>t?n*(7.5625*(t-=1.5/2.75)*t+.75)+a:2.5/2.75>t?n*(7.5625*(t-=2.25/2.75)*t+.9375)+a:n*(7.5625*(t-=2.625/2.75)*t+.984375)+a},e.easing.easeInOutBounce=e.easing.easeInOutBounce||function(t,a,n,l,s){return s/2>a?.5*e.easing.easeInBounce(t,2*a,0,l,s)+n:.5*e.easing.easeOutBounce(t,2*a-s,0,l,s)+.5*l+n}}};O._easing.call(),e.fn[p]=function(t){return I[t]?I[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):I.init.apply(this,arguments)},e[p]=function(t){return I[t]?I[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):I.init.apply(this,arguments)},e[p].defaults=v}(jQuery,window,document);
|
malihu-pagescroll2id.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Page scroll to id
|
4 |
Plugin URI: http://manos.malihu.gr/page-scroll-to-id
|
5 |
Description: Page scroll to id is an easy-to-use jQuery plugin that enables animated page scrolling to specific id within the document.
|
6 |
-
Version: 1.5.
|
7 |
Author: malihu
|
8 |
Author URI: http://manos.malihu.gr
|
9 |
License: MIT License (MIT)
|
@@ -45,7 +45,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
45 |
|
46 |
class malihuPageScroll2id{ // --edit--
|
47 |
|
48 |
-
protected $version='1.5.
|
49 |
protected $update_option=null;
|
50 |
|
51 |
protected $plugin_name='Page scroll to id'; // Plugin name --edit--
|
@@ -334,17 +334,19 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
|
|
334 |
|
335 |
public function validate_plugin_settings(){
|
336 |
if(!empty($_POST)){
|
337 |
-
if($_POST[$this->db_prefix.'reset']==='true'
|
338 |
// Reset all to default
|
339 |
$_POST[$this->db_prefix.'instances']=$this->default;
|
340 |
}else{
|
341 |
// Update settings array
|
342 |
-
$
|
343 |
-
|
344 |
-
$
|
345 |
-
|
|
|
|
|
|
|
346 |
}
|
347 |
-
$_POST[$this->db_prefix.'instances']=$update; // Save array to plugin option
|
348 |
}
|
349 |
}
|
350 |
}
|
3 |
Plugin Name: Page scroll to id
|
4 |
Plugin URI: http://manos.malihu.gr/page-scroll-to-id
|
5 |
Description: Page scroll to id is an easy-to-use jQuery plugin that enables animated page scrolling to specific id within the document.
|
6 |
+
Version: 1.5.8
|
7 |
Author: malihu
|
8 |
Author URI: http://manos.malihu.gr
|
9 |
License: MIT License (MIT)
|
45 |
|
46 |
class malihuPageScroll2id{ // --edit--
|
47 |
|
48 |
+
protected $version='1.5.8'; // Plugin version --edit--
|
49 |
protected $update_option=null;
|
50 |
|
51 |
protected $plugin_name='Page scroll to id'; // Plugin name --edit--
|
334 |
|
335 |
public function validate_plugin_settings(){
|
336 |
if(!empty($_POST)){
|
337 |
+
if(isset($_POST[$this->db_prefix.'reset']) && $_POST[$this->db_prefix.'reset']==='true'){
|
338 |
// Reset all to default
|
339 |
$_POST[$this->db_prefix.'instances']=$this->default;
|
340 |
}else{
|
341 |
// Update settings array
|
342 |
+
if(isset($_POST[$this->db_prefix.'total_instances'])){
|
343 |
+
$instances=$_POST[$this->db_prefix.'total_instances'];
|
344 |
+
for($i=0; $i<$instances; $i++){
|
345 |
+
$instance=$this->plugin_options_array('validate',$i,null,null);
|
346 |
+
$update[$this->pl_pfx.'instance_'.$i]=$instance;
|
347 |
+
}
|
348 |
+
$_POST[$this->db_prefix.'instances']=$update; // Save array to plugin option
|
349 |
}
|
|
|
350 |
}
|
351 |
}
|
352 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: page scrolling, page animation, navigation, single-page navigation
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.0
|
7 |
-
Stable tag: 1.5.
|
8 |
License: The MIT License (MIT)
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
@@ -140,6 +140,10 @@ Yes but you probably need to implement the plugin in your theme **manually**. Se
|
|
140 |
|
141 |
== Changelog ==
|
142 |
|
|
|
|
|
|
|
|
|
143 |
= 1.5.7 =
|
144 |
* Added 'Highlight by next target' option. When enabled, highlight elements according to their target and next target position (useful when targets have zero dimensions).
|
145 |
* Extended `ps2id` shortcode for creating targets in content editor.
|
@@ -202,6 +206,10 @@ Yes but you probably need to implement the plugin in your theme **manually**. Se
|
|
202 |
|
203 |
== Upgrade Notice ==
|
204 |
|
|
|
|
|
|
|
|
|
205 |
= 1.5.7 =
|
206 |
|
207 |
Added 'Highlight by next target' option and extended `ps2id` shortcode for creating targets in content editor.
|
4 |
Tags: page scrolling, page animation, navigation, single-page navigation
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.0
|
7 |
+
Stable tag: 1.5.8
|
8 |
License: The MIT License (MIT)
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
140 |
|
141 |
== Changelog ==
|
142 |
|
143 |
+
= 1.5.8 =
|
144 |
+
* Fixed various PHP notices in debug mode.
|
145 |
+
* Minor script optimizations.
|
146 |
+
|
147 |
= 1.5.7 =
|
148 |
* Added 'Highlight by next target' option. When enabled, highlight elements according to their target and next target position (useful when targets have zero dimensions).
|
149 |
* Extended `ps2id` shortcode for creating targets in content editor.
|
206 |
|
207 |
== Upgrade Notice ==
|
208 |
|
209 |
+
= 1.5.8 =
|
210 |
+
|
211 |
+
Fixed various PHP notices in debug mode, minor script optimizations.
|
212 |
+
|
213 |
= 1.5.7 =
|
214 |
|
215 |
Added 'Highlight by next target' option and extended `ps2id` shortcode for creating targets in content editor.
|