Page scroll to id - Version 1.5.7

Version Description

  • Added 'Highlight by next target' option. When enabled, highlight elements according to their target and next target position (useful when targets have zero dimensions).
  • Extended ps2id shortcode for creating targets in content editor.
Download this release

Release Info

Developer malihu
Plugin Icon 128x128 Page scroll to id
Version 1.5.7
Comparing to
See all releases

Code changes from version 1.5.6 to 1.5.7

includes/help/plugin-settings.inc CHANGED
@@ -69,6 +69,10 @@ $help_plugin_settings_text=<<<EOD
69
  Check "Keep highlight until next" when you need to keep the current element highlighted until the next one comes into view. This way at least one element always stays highlighted.
70
  </p>
71
 
 
 
 
 
72
  <p>
73
  <strong>Scroll to location hash</strong> -
74
  Scrolls to target id (e.g. <code>&lt;div id="id" /&gt;</code>) based on location hash (e.g. <code>mysite.com/mypage#id</code>) on page load. <br />
69
  Check "Keep highlight until next" when you need to keep the current element highlighted until the next one comes into view. This way at least one element always stays highlighted.
70
  </p>
71
 
72
+ <p>
73
+ Check "Highlight by next target" when your target elements have zero height and/or width to enable better highlighting. This option is similar to "Keep highlight until next" but it's especially useful when your target elements are in the form of <code>&lt;a id='id'&gt;&lt;/a&gt;</code>.
74
+ </p>
75
+
76
  <p>
77
  <strong>Scroll to location hash</strong> -
78
  Scrolls to target id (e.g. <code>&lt;div id="id" /&gt;</code>) based on location hash (e.g. <code>mysite.com/mypage#id</code>) on page load. <br />
includes/help/shortcodes.inc CHANGED
@@ -11,7 +11,7 @@ $help_shortcodes_text=<<<EOD
11
 
12
  <ul>
13
  <li>
14
- <code>url</code> - target element id <br />
15
  Examples: <br />
16
  <code>[ps2id url='#some-id']link[/ps2id]</code> <br />
17
  <code>[ps2id url='http://somesite.com/somepage/#some-id']link[/ps2id]</code>
@@ -25,6 +25,28 @@ $help_shortcodes_text=<<<EOD
25
  </li>
26
  </ul>
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  EOD;
29
  ?>
30
 
11
 
12
  <ul>
13
  <li>
14
+ <code>url</code> - link URL (the target element id the link points to) <br />
15
  Examples: <br />
16
  <code>[ps2id url='#some-id']link[/ps2id]</code> <br />
17
  <code>[ps2id url='http://somesite.com/somepage/#some-id']link[/ps2id]</code>
25
  </li>
26
  </ul>
27
 
28
+ <p>
29
+ <strong>Create target</strong> - <code>[ps2id id='#id' target='']</code>
30
+ </p>
31
+
32
+ <p>
33
+ <strong>Create target shrotcode attributes</strong>
34
+ </p>
35
+
36
+ <ul>
37
+ <li>
38
+ <code>id</code> - target element id <br />
39
+ Examples: <br />
40
+ <code>[ps2id id='some-id']</code>
41
+ </li>
42
+ <li>
43
+ <code>target</code> - the element that will be considered as the actual target (useful when you need proper highlighting with targets that have zero dimensions) <br />
44
+ Examples: <br />
45
+ <code>[ps2id id='some-id' target='#id + div']</code> - set the target as the next div from the #some-id element <br />
46
+ <code>[ps2id id='some-id' target='#another-id']</code> - set the target as the element with id: another-id
47
+ </li>
48
+ </ul>
49
+
50
  EOD;
51
  ?>
52
 
js/jquery.malihu.PageScroll2id-init.js CHANGED
@@ -63,6 +63,7 @@
63
  highlightClass:_o.instances[_p+"_instance_"+i]["highlightClass"]["value"],
64
  forceSingleHighlight:(_o.instances[_p+"_instance_"+i]["forceSingleHighlight"]["value"]==="true") ? true : false,
65
  keepHighlightUntilNext:(_o.instances[_p+"_instance_"+i]["keepHighlightUntilNext"]["value"]==="true") ? true : false,
 
66
  disablePluginBelow:_screen(_o.instances[_p+"_instance_"+i]["disablePluginBelow"]["value"].toString())
67
  });
68
  //scroll to location hash on page load
63
  highlightClass:_o.instances[_p+"_instance_"+i]["highlightClass"]["value"],
64
  forceSingleHighlight:(_o.instances[_p+"_instance_"+i]["forceSingleHighlight"]["value"]==="true") ? true : false,
65
  keepHighlightUntilNext:(_o.instances[_p+"_instance_"+i]["keepHighlightUntilNext"]["value"]==="true") ? true : false,
66
+ highlightByNextTarget:(_o.instances[_p+"_instance_"+i]["highlightByNextTarget"]["value"]==="true") ? true : false,
67
  disablePluginBelow:_screen(_o.instances[_p+"_instance_"+i]["disablePluginBelow"]["value"].toString())
68
  });
69
  //scroll to location hash on page load
js/jquery.malihu.PageScroll2id.js CHANGED
@@ -1,2 +1,2 @@
1
- /* == Page scroll to id == Version: 1.5.2, License: MIT License (MIT) */
2
- (function(d,h,l,e){var c="mPageScroll2id",i="mPS2id",t=".m_PageScroll2id,a[rel~='m_PageScroll2id'],.page-scroll-to-id,a[rel~='page-scroll-to-id']",j={scrollSpeed:1300,autoScrollSpeed:true,scrollEasing:"easeInOutExpo",scrollingEasing:"easeInOutCirc",pageEndSmoothScroll:true,layout:"vertical",offset:0,highlightSelector:false,clickedClass:i+"-clicked",targetClass:i+"-target",highlightClass:i+"-highlight",forceSingleHighlight:false,keepHighlightUntilNext:false,disablePluginBelow:false,clickEvents:true,onStart:function(){},onComplete:function(){},defaultSelector:false},p,b,g,a,q,f,n,o,m,r,s={init:function(u){var u=d.extend(true,{},j,u);d(l).data(i,u);b=d(l).data(i);p=(!p)?this.selector:p+","+this.selector;if(b.defaultSelector){if(typeof d(p)!=="object"||d(p).length===0){p=t}}if(b.clickEvents){d(l).undelegate("."+i).delegate(p,"click."+i,function(x){if(k._isDisabled.call(null)){k._removeClasses.call(null);return}var w=d(this),v=w.attr("href"),y=w.prop("href");if(v&&v.indexOf("#/")!==-1){return}k._reset.call(null);r=w.data("ps2id-offset")||0;if(k._isValid.call(null,v,y)&&k._findTarget.call(null,v)){x.preventDefault();a="selector";q=w;k._setClasses.call(null,true);k._scrollTo.call(null)}})}d(h).unbind("."+i).bind("scroll."+i+" resize."+i,function(){if(k._isDisabled.call(null)){k._removeClasses.call(null);return}var v=d("._"+i+"-t");v.each(function(x){var w=d(this),z=w.attr("id"),y=k._findHighlight.call(null,z);k._setClasses.call(null,false,w,y);if(x==v.length-1){k._extendClasses.call(null)}})});g=true;k._setup.call(null)},scrollTo:function(w,u){if(k._isDisabled.call(null)){k._removeClasses.call(null);return}if(w&&typeof w!=="undefined"){k._isInit.call(null);var v={layout:b.layout,offset:b.offset,clicked:false},u=d.extend(true,{},v,u);k._reset.call(null);o=u.layout;m=u.offset;w=(w.indexOf("#")!==-1)?w:"#"+w;if(k._isValid.call(null,w)&&k._findTarget.call(null,w)){a="scrollTo";q=u.clicked;if(q){k._setClasses.call(null,true)}k._scrollTo.call(null)}}},destroy:function(){d(h).unbind("."+i);d(l).undelegate("."+i).removeData(i);d("._"+i+"-t").removeData(i);k._removeClasses.call(null,true)}},k={_isDisabled:function(){var v=h,u="inner",w=b.disablePluginBelow instanceof Array?[b.disablePluginBelow[0]||0,b.disablePluginBelow[1]||0]:[b.disablePluginBelow||0,0];if(!("innerWidth" in h)){u="client";v=l.documentElement||l.body}return v[u+"Width"]<=w[0]||v[u+"Height"]<=w[1]},_isValid:function(u,x){if(!u){return}x=(!x)?u:x;var w=(x.indexOf("#/")!==-1)?x.split("#/")[0]:x.split("#")[0],v=h.location.toString().split("#")[0];return u!=="#"&&u.indexOf("#")!==-1&&(w===""||w===v)},_setup:function(){var v=(b.highlightSelector&&b.highlightSelector!=="")?b.highlightSelector:p,u=1;return d(v).each(function(){var z=d(this),w=z.attr("href"),B=z.prop("href");if(k._isValid.call(null,w,B)){var A=(w.indexOf("#/")!==-1)?w.split("#/")[1]:w.split("#")[1],x=d("#"+A);if(x.length>0){if(!x.hasClass("_"+i+"-t")){x.addClass("_"+i+"-t").data(i,{i:u})}if(!z.hasClass("_"+i+"-h")){z.addClass("_"+i+"-h")}var y=k._findHighlight.call(null,A);k._setClasses.call(null,false,x,y);u++;if(u==d(v).length){k._extendClasses.call(null)}}}})},_findTarget:function(w){var v=(w.indexOf("#/")!==-1)?w.split("#/")[1]:w.split("#")[1],u=d("#"+v);if(u.length<1||u.css("position")==="fixed"){if(v==="top"){u=d("body")}else{return}}f=u;if(!o){o=b.layout}m=k._setOffset.call(null);n=[(u.offset().top-m[0]).toString(),(u.offset().left-m[1]).toString()];n[0]=(n[0]<0)?0:n[0];n[1]=(n[1]<0)?0:n[1];return n},_setOffset:function(){if(!m){m=(b.offset)?b.offset:0}if(r){m=r}var w,v,z,u;switch(typeof m){case"object":case"string":w=[(m.y)?m.y:m,(m.x)?m.x:m];v=[(w[0] instanceof jQuery)?w[0]:d(w[0]),(w[1] instanceof jQuery)?w[1]:d(w[1])];if(v[0].length>0){z=v[0].height();if(v[0].css("position")==="fixed"){z+=v[0][0].offsetTop}}else{if(!isNaN(parseFloat(w[0]))&&isFinite(w[0])){z=parseInt(w[0])}else{z=0}}if(v[1].length>0){u=v[1].width();if(v[1].css("position")==="fixed"){u+=v[1][0].offsetLeft}}else{if(!isNaN(parseFloat(w[1]))&&isFinite(w[1])){u=parseInt(w[1])}else{u=0}}break;case"function":w=m.call(null);if(w instanceof Array){z=w[0];u=w[1]}else{z=u=w}break;default:z=u=parseInt(m)}return[z,u]},_findHighlight:function(z){var y=h.location.toString().split("#")[0],v=d("._"+i+"-h[href='#"+z+"']"),w=d("._"+i+"-h[href='"+y+"#"+z+"']"),u=d("._"+i+"-h[href='#/"+z+"']"),x=d("._"+i+"-h[href='"+y+"#/"+z+"']");v=(v.length>0)?v:w;u=(u.length>0)?u:x;return(u.length>0)?u:v},_setClasses:function(z,v,w){var y=b.clickedClass,u=b.targetClass,x=b.highlightClass;if(z&&y&&y!==""){d("."+y).removeClass(y);q.addClass(y)}else{if(v&&u&&u!==""&&w&&x&&x!==""){if(k._currentTarget.call(null,v)){v.addClass(u);w.addClass(x)}else{if(!b.keepHighlightUntilNext||d("."+x).length>1){v.removeClass(u);w.removeClass(x)}}}}},_extendClasses:function(){var u=b.targetClass,z=b.highlightClass,B=d("."+u),y=d("."+z),A=u+"-first",x=u+"-last",w=z+"-first",v=z+"-last";d("._"+i+"-t").removeClass(A+" "+x);d("._"+i+"-h").removeClass(w+" "+v);if(!b.forceSingleHighlight){B.slice(0,1).addClass(A).end().slice(-1).addClass(x);y.slice(0,1).addClass(w).end().slice(-1).addClass(v)}else{if(b.keepHighlightUntilNext&&B.length>1){B.slice(0,1).removeClass(u);y.slice(0,1).removeClass(z)}else{B.slice(1).removeClass(u);y.slice(1).removeClass(z)}}},_removeClasses:function(u){d("."+b.clickedClass).removeClass(b.clickedClass);d("."+b.targetClass).removeClass(b.targetClass+" "+b.targetClass+"-first "+b.targetClass+"-last");d("."+b.highlightClass).removeClass(b.highlightClass+" "+b.highlightClass+"-first "+b.highlightClass+"-last");if(u){d("._"+i+"-t").removeClass("_"+i+"-t");d("._"+i+"-h").removeClass("_"+i+"-h")}},_currentTarget:function(H){var K=b["target_"+H.data(i).i],w=H[0].getBoundingClientRect();if(typeof K!=="undefined"){var F=H.offset().top,G=H.offset().left,L=(K.from)?K.from+F:F,z=(K.to)?K.to+F:F,I=(K.fromX)?K.fromX+G:G,v=(K.toX)?K.toX+G:G;return(w.top>=z&&w.top<=L&&w.left>=v&&w.left<=I)}else{var D=d(h).height(),O=d(h).width(),C=H.height(),N=H.width(),B=1+(C/D),J=B,E=(C<D)?B*(D/C):B,u=1+(N/O),A=u,M=(N<O)?u*(O/N):u;return(w.top<=D/J&&w.bottom>=D/E&&w.left<=O/A&&w.right>=O/M)}},_scrollTo:function(){b.scrollSpeed=parseInt(b.scrollSpeed);n=(b.pageEndSmoothScroll)?k._pageEndSmoothScroll.call(null):n;var v=d("html,body"),x=(b.autoScrollSpeed)?k._autoScrollSpeed.call(null):b.scrollSpeed,z=(v.is(":animated"))?b.scrollingEasing:b.scrollEasing,w=d(h).scrollTop(),u=d(h).scrollLeft();switch(o){case"horizontal":if(u!=n[1]){k._callbacks.call(null,"onStart");v.stop().animate({scrollLeft:n[1]},x,z).promise().then(function(){k._callbacks.call(null,"onComplete")})}break;case"auto":if(w!=n[0]||u!=n[1]){k._callbacks.call(null,"onStart");if(navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/)){var y;v.stop().animate({pageYOffset:n[0],pageXOffset:n[1]},{duration:x,easing:z,step:function(A,B){if(B.prop=="pageXOffset"){y=A}else{if(B.prop=="pageYOffset"){h.scrollTo(y,A)}}}}).promise().then(function(){k._callbacks.call(null,"onComplete")})}else{v.stop().animate({scrollTop:n[0],scrollLeft:n[1]},x,z).promise().then(function(){k._callbacks.call(null,"onComplete")})}}break;default:if(w!=n[0]){k._callbacks.call(null,"onStart");v.stop().animate({scrollTop:n[0]},x,z).promise().then(function(){k._callbacks.call(null,"onComplete")})}}},_pageEndSmoothScroll:function(){var u=d(l).height(),x=d(l).width(),w=d(h).height(),v=d(h).width();return[((u-n[0])<w)?u-w:n[0],((x-n[1])<v)?x-v:n[1]]},_autoScrollSpeed:function(){var w=d(h).scrollTop(),v=d(h).scrollLeft(),x=d(l).height(),u=d(l).width(),y=[b.scrollSpeed+((b.scrollSpeed*(Math.floor((Math.abs(n[0]-w)/x)*100)))/100),b.scrollSpeed+((b.scrollSpeed*(Math.floor((Math.abs(n[1]-v)/u)*100)))/100)];return Math.max.apply(Math,y)},_callbacks:function(u){if(!b){return}this[i]={trigger:a,clicked:q,target:f,scrollTo:{y:n[0],x:n[1]}};switch(u){case"onStart":b.onStart.call(null,this[i]);break;case"onComplete":b.onComplete.call(null,this[i]);break}},_reset:function(){o=m=r=false},_isInit:function(){if(!g){s.init.apply(this)}},_easing:function(){d.easing.easeInQuad=d.easing.easeInQuad||function(v,w,u,z,y){return z*(w/=y)*w+u};d.easing.easeOutQuad=d.easing.easeOutQuad||function(v,w,u,z,y){return -z*(w/=y)*(w-2)+u};d.easing.easeInOutQuad=d.easing.easeInOutQuad||function(v,w,u,z,y){if((w/=y/2)<1){return z/2*w*w+u}return -z/2*((--w)*(w-2)-1)+u};d.easing.easeInCubic=d.easing.easeInCubic||function(v,w,u,z,y){return z*(w/=y)*w*w+u};d.easing.easeOutCubic=d.easing.easeOutCubic||function(v,w,u,z,y){return z*((w=w/y-1)*w*w+1)+u};d.easing.easeInOutCubic=d.easing.easeInOutCubic||function(v,w,u,z,y){if((w/=y/2)<1){return z/2*w*w*w+u}return z/2*((w-=2)*w*w+2)+u};d.easing.easeInQuart=d.easing.easeInQuart||function(v,w,u,z,y){return z*(w/=y)*w*w*w+u};d.easing.easeOutQuart=d.easing.easeOutQuart||function(v,w,u,z,y){return -z*((w=w/y-1)*w*w*w-1)+u};d.easing.easeInOutQuart=d.easing.easeInOutQuart||function(v,w,u,z,y){if((w/=y/2)<1){return z/2*w*w*w*w+u}return -z/2*((w-=2)*w*w*w-2)+u};d.easing.easeInQuint=d.easing.easeInQuint||function(v,w,u,z,y){return z*(w/=y)*w*w*w*w+u};d.easing.easeOutQuint=d.easing.easeOutQuint||function(v,w,u,z,y){return z*((w=w/y-1)*w*w*w*w+1)+u};d.easing.easeInOutQuint=d.easing.easeInOutQuint||function(v,w,u,z,y){if((w/=y/2)<1){return z/2*w*w*w*w*w+u}return z/2*((w-=2)*w*w*w*w+2)+u};d.easing.easeInExpo=d.easing.easeInExpo||function(v,w,u,z,y){return(w==0)?u:z*Math.pow(2,10*(w/y-1))+u};d.easing.easeOutExpo=d.easing.easeOutExpo||function(v,w,u,z,y){return(w==y)?u+z:z*(-Math.pow(2,-10*w/y)+1)+u};d.easing.easeInOutExpo=d.easing.easeInOutExpo||function(v,w,u,z,y){if(w==0){return u}if(w==y){return u+z}if((w/=y/2)<1){return z/2*Math.pow(2,10*(w-1))+u}return z/2*(-Math.pow(2,-10*--w)+2)+u};d.easing.easeInSine=d.easing.easeInSine||function(v,w,u,z,y){return -z*Math.cos(w/y*(Math.PI/2))+z+u};d.easing.easeOutSine=d.easing.easeOutSine||function(v,w,u,z,y){return z*Math.sin(w/y*(Math.PI/2))+u};d.easing.easeInOutSine=d.easing.easeInOutSine||function(v,w,u,z,y){return -z/2*(Math.cos(Math.PI*w/y)-1)+u};d.easing.easeInCirc=d.easing.easeInCirc||function(v,w,u,z,y){return -z*(Math.sqrt(1-(w/=y)*w)-1)+u};d.easing.easeOutCirc=d.easing.easeOutCirc||function(v,w,u,z,y){return z*Math.sqrt(1-(w=w/y-1)*w)+u};d.easing.easeInOutCirc=d.easing.easeInOutCirc||function(v,w,u,z,y){if((w/=y/2)<1){return -z/2*(Math.sqrt(1-w*w)-1)+u}return z/2*(Math.sqrt(1-(w-=2)*w)+1)+u};d.easing.easeInElastic=d.easing.easeInElastic||function(v,y,u,C,B){var z=1.70158;var A=0;var w=C;if(y==0){return u}if((y/=B)==1){return u+C}if(!A){A=B*0.3}if(w<Math.abs(C)){w=C;var z=A/4}else{var z=A/(2*Math.PI)*Math.asin(C/w)}return -(w*Math.pow(2,10*(y-=1))*Math.sin((y*B-z)*(2*Math.PI)/A))+u};d.easing.easeOutElastic=d.easing.easeOutElastic||function(v,y,u,C,B){var z=1.70158;var A=0;var w=C;if(y==0){return u}if((y/=B)==1){return u+C}if(!A){A=B*0.3}if(w<Math.abs(C)){w=C;var z=A/4}else{var z=A/(2*Math.PI)*Math.asin(C/w)}return w*Math.pow(2,-10*y)*Math.sin((y*B-z)*(2*Math.PI)/A)+C+u};d.easing.easeInOutElastic=d.easing.easeInOutElastic||function(v,y,u,C,B){var z=1.70158;var A=0;var w=C;if(y==0){return u}if((y/=B/2)==2){return u+C}if(!A){A=B*(0.3*1.5)}if(w<Math.abs(C)){w=C;var z=A/4}else{var z=A/(2*Math.PI)*Math.asin(C/w)}if(y<1){return -0.5*(w*Math.pow(2,10*(y-=1))*Math.sin((y*B-z)*(2*Math.PI)/A))+u}return w*Math.pow(2,-10*(y-=1))*Math.sin((y*B-z)*(2*Math.PI)/A)*0.5+C+u};d.easing.easeInBack=d.easing.easeInBack||function(v,w,u,A,z,y){if(y==e){y=1.70158}return A*(w/=z)*w*((y+1)*w-y)+u};d.easing.easeOutBack=d.easing.easeOutBack||function(v,w,u,A,z,y){if(y==e){y=1.70158}return A*((w=w/z-1)*w*((y+1)*w+y)+1)+u};d.easing.easeInOutBack=d.easing.easeInOutBack||function(v,w,u,A,z,y){if(y==e){y=1.70158}if((w/=z/2)<1){return A/2*(w*w*(((y*=(1.525))+1)*w-y))+u}return A/2*((w-=2)*w*(((y*=(1.525))+1)*w+y)+2)+u};d.easing.easeInBounce=d.easing.easeInBounce||function(v,w,u,z,y){return z-d.easing.easeOutBounce(v,y-w,0,z,y)+u};d.easing.easeOutBounce=d.easing.easeOutBounce||function(v,w,u,z,y){if((w/=y)<(1/2.75)){return z*(7.5625*w*w)+u}else{if(w<(2/2.75)){return z*(7.5625*(w-=(1.5/2.75))*w+0.75)+u}else{if(w<(2.5/2.75)){return z*(7.5625*(w-=(2.25/2.75))*w+0.9375)+u}else{return z*(7.5625*(w-=(2.625/2.75))*w+0.984375)+u}}}};d.easing.easeInOutBounce=d.easing.easeInOutBounce||function(v,w,u,z,y){if(w<y/2){return d.easing.easeInBounce(v,w*2,0,z,y)*0.5+u}return d.easing.easeOutBounce(v,w*2-y,0,z,y)*0.5+z*0.5+u}}};k._easing.call();d.fn[c]=function(u){if(s[u]){return s[u].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof u==="object"||!u){return s.init.apply(this,arguments)}else{d.error("Method "+u+" does not exist")}}};d[c]=function(u){if(s[u]){return s[u].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof u==="object"||!u){return s.init.apply(this,arguments)}else{d.error("Method "+u+" does not exist")}}};d[c].defaults=j})(jQuery,window,document);
1
+ /* == Page scroll to id == Version: 1.5.3, License: MIT License (MIT) */
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);
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.6
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.6'; // Plugin version --edit--
49
  protected $update_option=null;
50
 
51
  protected $plugin_name='Page scroll to id'; // Plugin name --edit--
@@ -319,8 +319,14 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
319
  "shortcode_class" => "_'.$shortcode_class.'",
320
  "url" => "",
321
  "offset" => "",
 
 
322
  ), $atts));
323
- return "<a href=\"".$url."\" class=\"".$shortcode_class."\" data-ps2id-offset=\"".esc_attr($offset)."\">".do_shortcode($content)."</a>";
 
 
 
 
324
  ');
325
  add_shortcode($tag, $pl_shortcodes[$i]);
326
  }
@@ -496,6 +502,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
496
  $d11='mPS2id-highlight';
497
  $d12='false';
498
  $d14='false';
 
499
  $d13='false';
500
  $d15=0;
501
  // Values
@@ -515,6 +522,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
515
  $v11=$this->sanitize_input('class', $_POST[$this->db_prefix.$i.'_highlightClass'], $d11);
516
  $v12=(isset($_POST[$this->db_prefix.$i.'_forceSingleHighlight'])) ? 'true' : 'false';
517
  $v14=(isset($_POST[$this->db_prefix.$i.'_keepHighlightUntilNext'])) ? 'true' : 'false';
 
518
  $v13=(isset($_POST[$this->db_prefix.$i.'_scrollToHash'])) ? 'true' : 'false';
519
  $v15=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_disablePluginBelow'], $d15);
520
  break;
@@ -543,6 +551,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
543
  $v11=(isset($j['highlightClass'])) ? $j['highlightClass']['value'] : $d11;
544
  $v12=(isset($j['forceSingleHighlight'])) ? $j['forceSingleHighlight']['value'] : $d12;
545
  $v14=(isset($j['keepHighlightUntilNext'])) ? $j['keepHighlightUntilNext']['value'] : $d14;
 
546
  $v13=(isset($j['scrollToHash'])) ? $j['scrollToHash']['value'] : $d13;
547
  $v15=(isset($j['disablePluginBelow'])) ? $j['disablePluginBelow']['value'] : $d15;
548
  break;
@@ -561,6 +570,7 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
561
  $v11=$d11;
562
  $v12=$d12;
563
  $v14=$d14;
 
564
  $v13=$d13;
565
  $v15=$d15;
566
  }
@@ -747,6 +757,18 @@ if(!class_exists('malihuPageScroll2id')){ // --edit--
747
  'description' => 'Keep the current element highlighted until the next one comes into view',
748
  'wrapper' => 'fieldset'
749
  ),
 
 
 
 
 
 
 
 
 
 
 
 
750
  'scrollToHash' => array(
751
  'value' => $v13,
752
  'values' => null,
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
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.7'; // Plugin version --edit--
49
  protected $update_option=null;
50
 
51
  protected $plugin_name='Page scroll to id'; // Plugin name --edit--
319
  "shortcode_class" => "_'.$shortcode_class.'",
320
  "url" => "",
321
  "offset" => "",
322
+ "id" => "",
323
+ "target" => "",
324
  ), $atts));
325
+ if($id!==""){
326
+ return "<a id=\"".$id."\" data-ps2id-target=\"".sanitize_text_field($target)."\">".do_shortcode($content)."</a>";
327
+ }else{
328
+ return "<a href=\"".$url."\" class=\"".$shortcode_class."\" data-ps2id-offset=\"".esc_attr($offset)."\">".do_shortcode($content)."</a>";
329
+ }
330
  ');
331
  add_shortcode($tag, $pl_shortcodes[$i]);
332
  }
502
  $d11='mPS2id-highlight';
503
  $d12='false';
504
  $d14='false';
505
+ $d16='false';
506
  $d13='false';
507
  $d15=0;
508
  // Values
522
  $v11=$this->sanitize_input('class', $_POST[$this->db_prefix.$i.'_highlightClass'], $d11);
523
  $v12=(isset($_POST[$this->db_prefix.$i.'_forceSingleHighlight'])) ? 'true' : 'false';
524
  $v14=(isset($_POST[$this->db_prefix.$i.'_keepHighlightUntilNext'])) ? 'true' : 'false';
525
+ $v16=(isset($_POST[$this->db_prefix.$i.'_highlightByNextTarget'])) ? 'true' : 'false';
526
  $v13=(isset($_POST[$this->db_prefix.$i.'_scrollToHash'])) ? 'true' : 'false';
527
  $v15=$this->sanitize_input('text', $_POST[$this->db_prefix.$i.'_disablePluginBelow'], $d15);
528
  break;
551
  $v11=(isset($j['highlightClass'])) ? $j['highlightClass']['value'] : $d11;
552
  $v12=(isset($j['forceSingleHighlight'])) ? $j['forceSingleHighlight']['value'] : $d12;
553
  $v14=(isset($j['keepHighlightUntilNext'])) ? $j['keepHighlightUntilNext']['value'] : $d14;
554
+ $v16=(isset($j['highlightByNextTarget'])) ? $j['highlightByNextTarget']['value'] : $d16;
555
  $v13=(isset($j['scrollToHash'])) ? $j['scrollToHash']['value'] : $d13;
556
  $v15=(isset($j['disablePluginBelow'])) ? $j['disablePluginBelow']['value'] : $d15;
557
  break;
570
  $v11=$d11;
571
  $v12=$d12;
572
  $v14=$d14;
573
+ $v16=$d16;
574
  $v13=$d13;
575
  $v15=$d15;
576
  }
757
  'description' => 'Keep the current element highlighted until the next one comes into view',
758
  'wrapper' => 'fieldset'
759
  ),
760
+ 'highlightByNextTarget' => array(
761
+ 'value' => $v16,
762
+ 'values' => null,
763
+ 'id' => $this->db_prefix.$i.'_highlightByNextTarget',
764
+ 'field_type' => 'checkbox',
765
+ 'label' => '',
766
+ 'checkbox_label' => 'Highlight by next target',
767
+ 'radio_labels' => null,
768
+ 'field_info' => null,
769
+ 'description' => 'Set targets length according to their next adjacent target position (useful when target elements have zero dimensions)',
770
+ 'wrapper' => 'fieldset'
771
+ ),
772
  'scrollToHash' => array(
773
  'value' => $v13,
774
  'values' => null,
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.6
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.6 =
144
  * Changed the way 'Force single highlight' option works. When enabled, it now highlights the first highlighted element instead of last.
145
  * Extended highlight and target classes with additional ones in order to differentiate the first and last elements. You can now use `.mPS2id-highlight-first`, `.mPS2id-highlight-last`, `.mPS2id-target-first` and `.mPS2id-target-last` in order to target the first and last highlighted links and targets in your CSS.
@@ -198,6 +202,10 @@ Yes but you probably need to implement the plugin in your theme **manually**. Se
198
 
199
  == Upgrade Notice ==
200
 
 
 
 
 
201
  = 1.5.6 =
202
 
203
  'Force single highlight' option will now highlight the first element instead of last, Extended highlight and target classes with additional ones, Added 'Keep highlight until next' and 'Disable plugin below screen-size' options, extended help, updated readme.txt.
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.7
8
  License: The MIT License (MIT)
9
  License URI: http://opensource.org/licenses/MIT
10
 
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.
146
+
147
  = 1.5.6 =
148
  * Changed the way 'Force single highlight' option works. When enabled, it now highlights the first highlighted element instead of last.
149
  * Extended highlight and target classes with additional ones in order to differentiate the first and last elements. You can now use `.mPS2id-highlight-first`, `.mPS2id-highlight-last`, `.mPS2id-target-first` and `.mPS2id-target-last` in order to target the first and last highlighted links and targets in your CSS.
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.
208
+
209
  = 1.5.6 =
210
 
211
  'Force single highlight' option will now highlight the first element instead of last, Extended highlight and target classes with additional ones, Added 'Keep highlight until next' and 'Disable plugin below screen-size' options, extended help, updated readme.txt.