Easy Table of Contents - Version 1.6

Version Description

Requires WordPress >

Download this release

Release Info

Developer shazahm1@hotmail.com
Plugin Icon 128x128 Easy Table of Contents
Version 1.6
Comparing to
See all releases

Code changes from version 1.5 to 1.6

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: table of contents, toc
5
  Requires at least: 4.3
6
  Tested up to: 4.9
7
  Requires PHP: 5.3
8
- Stable tag: 1.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -90,6 +90,21 @@ Easy Table Contents is a fork of the excellent [Table of Contents Plus](https://
90
 
91
  == Changelog ==
92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  = 1.5 02/20/2018 =
94
  * BUG: Correct CSS selector to properly target the link color.
95
  * OTHER: Update the WayPoints library.
@@ -220,3 +235,5 @@ Requires WordPress >= 4.4 and PHP >= 5.3. PHP version >= 7.1 recommended.
220
  = 1.5 =
221
  Requires WordPress >= 4.4 and PHP >= 5.3. PHP version >= 7.1 recommended.
222
 
 
 
5
  Requires at least: 4.3
6
  Tested up to: 4.9
7
  Requires PHP: 5.3
8
+ Stable tag: 1.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
90
 
91
  == Changelog ==
92
 
93
+ = 1.6 03/15/2018 =
94
+ * NEW: Add `px` option for font size unit.
95
+ * NEW: Add title font size and weight settings options.
96
+ * NEW: Add the Mobile Smooth Scroll Offset option.
97
+ * TWEAK: Change default for font size unit from `px` to `%` to match the default options values.
98
+ * TWEAK: Correct CSS selector so margin is properly applied between the title and TOC items.
99
+ * TWEAK: Honor HTML added via `ez_toc_title` filter.
100
+ * TWEAK: Ensure the ezTOC content filter is not applied when running `the_content` filter.
101
+ * TWEAK: Only enqueue the javascript if the page is eligible for a TOC.
102
+ * TWEAK: Update icomoon CSS to remove unecessary CSS selectors to prevent possible conflicts.
103
+ * TWEAK: The smooth scroll offset needs to be taken into account when defining the offset_top property when affixing the widget.
104
+ * OTHER: Update frontend minified CSS file.
105
+ * OTHER: Update the frontend minified javascript file.
106
+ * DEV: phpDoc corrections.
107
+
108
  = 1.5 02/20/2018 =
109
  * BUG: Correct CSS selector to properly target the link color.
110
  * OTHER: Update the WayPoints library.
235
  = 1.5 =
236
  Requires WordPress >= 4.4 and PHP >= 5.3. PHP version >= 7.1 recommended.
237
 
238
+ = 1.6 =
239
+ Requires WordPress >= 4.4 and PHP >= 5.3. PHP version >= 7.1 recommended.
assets/css/screen.css CHANGED
@@ -70,8 +70,8 @@
70
  #ez-toc-container p.ez-toc-title {
71
  text-align: left;
72
  /*font-family: "Arial Narrow", sans-serif;*/
73
- font-size: 18px;
74
- font-weight: 500;
75
  line-height: 1.45;
76
  margin: 0;
77
  padding: 0;
@@ -98,7 +98,7 @@
98
  /*font-size: 90%;*/
99
  /*}*/
100
 
101
- #ez-toc-container p.ez-toc-title + ul.ez-toc-list {
102
  margin-top: 1em;
103
  }
104
 
70
  #ez-toc-container p.ez-toc-title {
71
  text-align: left;
72
  /*font-family: "Arial Narrow", sans-serif;*/
73
+ /*font-size: 120%;*/
74
+ /*font-weight: 500;*/
75
  line-height: 1.45;
76
  margin: 0;
77
  padding: 0;
98
  /*font-size: 90%;*/
99
  /*}*/
100
 
101
+ #ez-toc-container div.ez-toc-title-container + ul.ez-toc-list {
102
  margin-top: 1em;
103
  }
104
 
assets/css/screen.min.css CHANGED
@@ -1,24 +1 @@
1
- #ez-toc-container{background:#f9f9f9;border:1px solid #aaa;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.05);box-shadow:0 1px 1px rgba(0,0,0,0.05);display:table;margin-bottom:1em;padding:10px;position:relative;width:auto}
2
- .ez-toc-widget-container{position:relative;white-space:nowrap}#ez-toc-container.ez-toc-light-blue{background:#edf6ff}#ez-toc-container.ez-toc-white{background:#fff}
3
- #ez-toc-container.ez-toc-black{background:#000}#ez-toc-container.ez-toc-transparent{background:none transparent}.ez-toc-widget-container ul.ez-toc-list{padding:0 10px}
4
- #ez-toc-container ul ul,.ez-toc div.ez-toc-widget-container ul ul{margin-left:1.5em}#ez-toc-container ul,#ez-toc-container li{margin:0;padding:0}#ez-toc-container ul,#ez-toc-container li,#ez-toc-container ul li,.ez-toc-widget-container,.ez-toc-widget-container li{background:0;list-style-type:none;list-style:none;line-height:1.6;margin:0;overflow:hidden;z-index:1}
5
- #ez-toc-container p.ez-toc-title{text-align:left;font-size:18px;font-weight:500;line-height:1.45;margin:0;padding:0}.ez-toc-title-container{display:table;width:100%}
6
- .ez-toc-title,.ez-toc-title-toggle{display:table-cell;text-align:left;vertical-align:middle}#ez-toc-container.ez-toc-black p.ez-toc-title{color:#FFF}#ez-toc-container p.ez-toc-title+ul.ez-toc-list{margin-top:1em}
7
- .ez-toc-wrap-left{float:left;margin-right:10px}.ez-toc-wrap-right{float:right;margin-left:10px}#ez-toc-container a{color:#444;text-decoration:none;text-shadow:none}
8
- #ez-toc-container a:visited{color:#9f9f9f}#ez-toc-container a:hover{text-decoration:underline}#ez-toc-container.ez-toc-black a{color:#FFF}#ez-toc-container.ez-toc-black a:visited{color:#FFF}
9
- #ez-toc-container a.ez-toc-toggle{color:#444}#ez-toc-container.counter-hierarchy ul,.ez-toc-widget-container.counter-hierarchy ul,#ez-toc-container.counter-flat ul,.ez-toc-widget-container.counter-flat ul{counter-reset:item}
10
- #ez-toc-container.counter-numeric li,.ez-toc-widget-container.counter-numeric li{list-style-type:decimal;list-style-position:inside}#ez-toc-container.counter-decimal ul.ez-toc-list li a::before,.ez-toc-widget-container.counter-decimal ul.ez-toc-list li a::before{content:counters(item,".") ". ";counter-increment:item}
11
- #ez-toc-container.counter-roman li a::before,.ez-toc-widget-container.counter-roman ul.ez-toc-list li a::before{content:counters(item,".",upper-roman) ". ";counter-increment:item}
12
- .ez-toc-widget-container ul.ez-toc-list li::before{content:' ';position:absolute;left:0;right:0;height:30px;line-height:30px;z-index:-1}
13
- .ez-toc-widget-container ul.ez-toc-list li.active::before{background-color:#ededed}.ez-toc-widget-container li.active>a{font-weight:900}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:normal;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;background-image:none;border:1px solid transparent;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}
14
- .btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus{color:#333;text-decoration:none}
15
- .btn:active,.btn.active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}
16
- .btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default:hover,.btn-default:focus,.btn-default:active,.btn-default.active{color:#333;background-color:#ebebeb;border-color:#adadad}
17
- .btn-default:active,.btn-default.active{background-image:none}.btn-sm,.btn-xs{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-xs{padding:1px 5px}
18
- .btn-default{text-shadow:0 -1px 0 rgba(0,0,0,0.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.15),0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 0 rgba(255,255,255,0.15),0 1px 1px rgba(0,0,0,0.075)}
19
- .btn-default:active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn:active,.btn.active{background-image:none}
20
- .btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-gradient(linear,left 0,left 100%,from(#fff),to(#e0e0e0));background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-moz-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffe0e0e0',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}
21
- .btn-default:hover,.btn-default:focus{background-color:#e0e0e0;background-position:0 -15px}.btn-default:active,.btn-default.active{background-color:#e0e0e0;border-color:#dbdbdb}
22
- .pull-right{float:right!important;margin-left:10px}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';-webkit-font-smoothing:antialiased;font-style:normal;font-weight:normal;line-height:1;-moz-osx-font-smoothing:grayscale}
23
- .glyphicon:empty{width:1em}.ez-toc-toggle i.glyphicon{font-size:16px;margin-left:2px}[class*="ez-toc-icon-"]{font-family:'ez-toc-icomoon'!important;speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
24
- .ez-toc-icon-toggle:before{content:"\e87a"}
1
+ #ez-toc-container{background:#F9F9F9;border:1px solid #AAA;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05);display:table;margin-bottom:1em;padding:10px;position:relative;width:auto}.ez-toc-widget-container{position:relative;white-space:nowrap}#ez-toc-container.ez-toc-light-blue{background:#EDF6FF}#ez-toc-container.ez-toc-white{background:#FFF}#ez-toc-container.ez-toc-black{background:#000}#ez-toc-container.ez-toc-transparent{background:none}.ez-toc-widget-container ul.ez-toc-list{padding:0 10px}#ez-toc-container ul ul,.ez-toc div.ez-toc-widget-container ul ul{margin-left:1.5em}#ez-toc-container li,#ez-toc-container ul{padding:0}#ez-toc-container li,#ez-toc-container ul,#ez-toc-container ul li,.ez-toc-widget-container,.ez-toc-widget-container li{background:0 0;list-style:none;line-height:1.6;margin:0;overflow:hidden;z-index:1}.btn,.btn-default.active,.btn-default:active{background-image:none}#ez-toc-container p.ez-toc-title{text-align:left;line-height:1.45;margin:0;padding:0}.ez-toc-title-container{display:table;width:100%}.ez-toc-title,.ez-toc-title-toggle{display:table-cell;text-align:left;vertical-align:middle}.btn,.glyphicon{display:inline-block}#ez-toc-container.ez-toc-black p.ez-toc-title{color:#FFF}#ez-toc-container div.ez-toc-title-container+ul.ez-toc-list{margin-top:1em}.ez-toc-wrap-left{float:left;margin-right:10px}.ez-toc-wrap-right{float:right;margin-left:10px}#ez-toc-container a{color:#444;text-decoration:none;text-shadow:none}#ez-toc-container a:visited{color:#9f9f9f}#ez-toc-container a:hover{text-decoration:underline}#ez-toc-container.ez-toc-black a,#ez-toc-container.ez-toc-black a:visited{color:#FFF}#ez-toc-container a.ez-toc-toggle{color:#444}#ez-toc-container.counter-flat ul,#ez-toc-container.counter-hierarchy ul,.ez-toc-widget-container.counter-flat ul,.ez-toc-widget-container.counter-hierarchy ul{counter-reset:item}#ez-toc-container.counter-numeric li,.ez-toc-widget-container.counter-numeric li{list-style-type:decimal;list-style-position:inside}#ez-toc-container.counter-decimal ul.ez-toc-list li a::before,.ez-toc-widget-container.counter-decimal ul.ez-toc-list li a::before{content:counters(item,".") ". ";counter-increment:item}#ez-toc-container.counter-roman li a::before,.ez-toc-widget-container.counter-roman ul.ez-toc-list li a::before{content:counters(item,".",upper-roman) ". ";counter-increment:item}.ez-toc-widget-container ul.ez-toc-list li::before{content:' ';position:absolute;left:0;right:0;height:30px;line-height:30px;z-index:-1}.ez-toc-widget-container ul.ez-toc-list li.active::before{background-color:#EDEDED}.ez-toc-widget-container li.active>a{font-weight:900}.btn{padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid transparent;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125);background-image:none}.btn-default{color:#333;background-color:#fff}.btn-default.active,.btn-default:active,.btn-default:focus,.btn-default:hover{color:#333;background-color:#ebebeb;border-color:#adadad}.btn-sm,.btn-xs{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.glyphicon,[class*=ez-toc-icon-]{font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.btn-xs{padding:1px 5px}.btn-default{-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);text-shadow:0 1px 0 #fff;background-image:-webkit-gradient(linear,left 0,left 100%,from(#fff),to(#e0e0e0));background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-moz-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);background-repeat:repeat-x;border-color:#ccc;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-default:active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-default:focus,.btn-default:hover{background-color:#e0e0e0;background-position:0 -15px}.btn-default.active,.btn-default:active{background-color:#e0e0e0;border-color:#dbdbdb}.pull-right{float:right!important;margin-left:10px}.glyphicon{position:relative;top:1px;font-family:'Glyphicons Halflings'}.glyphicon:empty{width:1em}.ez-toc-toggle i.glyphicon{font-size:16px;margin-left:2px}[class*=ez-toc-icon-]{font-family:ez-toc-icomoon!important;speak:none;font-variant:normal;text-transform:none}.ez-toc-icon-toggle:before{content:"\e87a"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/front.js CHANGED
@@ -6,9 +6,23 @@ jQuery( document ).ready( function( $ ) {
6
 
7
  if ( 0 !== affix.length ) {
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  $( ezTOC.affixSelector ).stick_in_parent({
10
  inner_scrolling : false,
11
- offset_top : 30
12
  });
13
  }
14
 
6
 
7
  if ( 0 !== affix.length ) {
8
 
9
+ /**
10
+ * The smooth scroll offset needs to be taken into account when defining the offset_top property.
11
+ * @link https://github.com/shazahm1/Easy-Table-of-Contents/issues/19
12
+ *
13
+ * @type {number}
14
+ */
15
+ var affixOffset = 30;
16
+
17
+ // check offset setting
18
+ if ( typeof ezTOC.scroll_offset != 'undefined' ) {
19
+
20
+ affixOffset = ezTOC.scroll_offset;
21
+ }
22
+
23
  $( ezTOC.affixSelector ).stick_in_parent({
24
  inner_scrolling : false,
25
+ offset_top : affixOffset
26
  });
27
  }
28
 
assets/js/front.min.js CHANGED
@@ -1,15 +1,6 @@
1
- jQuery(document).ready(function(e){if(typeof ezTOC!="undefined"){var b=e(".ez-toc-widget-container.ez-toc-affix");if(0!==b.length){e(ezTOC.affixSelector).stick_in_parent({inner_scrolling:false,offset_top:30});
2
- }e.fn.shrinkTOCWidth=function(){e(this).css({width:"auto",display:"table"});if(/MSIE 7\./.test(navigator.userAgent)){e(this).css("width","");}};if(ezTOC.smooth_scroll==1){var f=hostname=pathname=qs=hash=null;
3
- e("body a").click(function(k){hostname=e(this).prop("hostname");pathname=e(this).prop("pathname");qs=e(this).prop("search");hash=e(this).prop("hash");if(pathname.length>0){if(pathname.charAt(0)!="/"){pathname="/"+pathname;
4
- }}if((window.location.hostname==hostname)&&(window.location.pathname==pathname)&&(window.location.search==qs)&&(hash!=="")){var j=hash.replace(/([ !"$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g,"\\$1");
5
- if(e(j).length>0){f=hash;}else{anchor=hash;anchor=anchor.replace("#","");f='a[name="'+anchor+'"]';if(e(f).length==0){f="";}}if(typeof ezTOC.scroll_offset!="undefined"){var l=-1*ezTOC.scroll_offset;
6
- }else{var i=e("#wpadminbar");if(i.length>0){if(i.is(":visible")){l=-30;}else{l=0;}}else{l=0;}}if(f){e.smoothScroll({scrollTarget:f,offset:l});}}});}if(typeof ezTOC.visibility_hide_by_default!="undefined"){var a=e("a.ez-toc-toggle");
7
- var g=ezTOC.visibility_hide_by_default;if(Cookies){Cookies.get("ezTOC_hidetoc")==1?a.data("visible",false):a.data("visible",true);}else{a.data("visible",true);
8
- }if(g){a.data("visible",false);}if(!a.data("visible")){e("ul.ez-toc-list").hide();}a.click(function(i){i.preventDefault();if(e(this).data("visible")){e(this).data("visible",false);
9
- if(Cookies){if(g){Cookies.set("ezTOC_hidetoc",null,{path:"/"});}else{Cookies.set("ezTOC_hidetoc","1",{expires:30,path:"/"});}}e("ul.ez-toc-list").hide("fast");
10
- }else{e(this).data("visible",true);if(Cookies){if(g){Cookies.set("ezTOC_hidetoc","1",{expires:30,path:"/"});}else{Cookies.set("ezTOC_hidetoc",null,{path:"/"});
11
- }}e("ul.ez-toc-list").show("fast");}});}function h(i){return e('.ez-toc-widget-container .ez-toc-list a[href="#'+e(i).attr("id")+'"]');}function d(j){var i=(typeof ezTOC.scroll_offset!="undefined")?parseInt(ezTOC.scroll_offset):30;
12
- var l=e(j).height()+i;var k=e("#wpadminbar");if(0===k.length){l=l-30;}return parseInt(l);}e("span.ez-toc-section").waypoint(function(j){var i=h(this.element).toggleClass("active",j==="down");
13
- i.toggleClass("active",j==="down").parent().toggleClass("active",j==="down");},{offset:"90%"});e("span.ez-toc-section").waypoint(function(j){var i=h(this.element).toggleClass("active",j==="up");
14
- i.toggleClass("active",j==="up").parent().toggleClass("active",j==="up");},{offset:d(this.element)});var c=e(".ez-toc-widget-container ul.ez-toc-list li").css("line-height");
15
- e("<style>.ez-toc-widget-container ul.ez-toc-list li::before{line-height:"+c+";height:"+c+"}</style>").appendTo("head");}});
1
+ jQuery(document).ready(function(a){if("undefined"!=typeof ezTOC){var f=function(b){return a('.ez-toc-widget-container .ez-toc-list a[href="#'+a(b).attr("id")+'"]')};if(0!==a(".ez-toc-widget-container.ez-toc-affix").length){var c=30;"undefined"!=typeof ezTOC.scroll_offset&&(c=ezTOC.scroll_offset);a(ezTOC.affixSelector).stick_in_parent({inner_scrolling:!1,offset_top:c})}a.fn.shrinkTOCWidth=function(){a(this).css({width:"auto",display:"table"});/MSIE 7\./.test(navigator.userAgent)&&a(this).css("width",
2
+ "")};if(1==ezTOC.smooth_scroll){var d=hostname=pathname=qs=hash=null;a("body a").click(function(b){hostname=a(this).prop("hostname");pathname=a(this).prop("pathname");qs=a(this).prop("search");hash=a(this).prop("hash");0<pathname.length&&"/"!=pathname.charAt(0)&&(pathname="/"+pathname);window.location.hostname==hostname&&window.location.pathname==pathname&&window.location.search==qs&&""!==hash&&(b=hash.replace(/([ !"$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g,"\\$1"),0<a(b).length?d=hash:(anchor=hash,anchor=
3
+ anchor.replace("#",""),d='a[name="'+anchor+'"]',0==a(d).length&&(d="")),"undefined"!=typeof ezTOC.scroll_offset?b=-1*ezTOC.scroll_offset:(b=a("#wpadminbar"),b=0<b.length?b.is(":visible")?-30:0:0),d&&a.smoothScroll({scrollTarget:d,offset:b}))})}if("undefined"!=typeof ezTOC.visibility_hide_by_default){c=a("a.ez-toc-toggle");var e=ezTOC.visibility_hide_by_default;Cookies?1==Cookies.get("ezTOC_hidetoc")?c.data("visible",!1):c.data("visible",!0):c.data("visible",!0);e&&c.data("visible",!1);c.data("visible")||
4
+ a("ul.ez-toc-list").hide();c.click(function(b){b.preventDefault();a(this).data("visible")?(a(this).data("visible",!1),Cookies&&(e?Cookies.set("ezTOC_hidetoc",null,{path:"/"}):Cookies.set("ezTOC_hidetoc","1",{expires:30,path:"/"})),a("ul.ez-toc-list").hide("fast")):(a(this).data("visible",!0),Cookies&&(e?Cookies.set("ezTOC_hidetoc","1",{expires:30,path:"/"}):Cookies.set("ezTOC_hidetoc",null,{path:"/"})),a("ul.ez-toc-list").show("fast"))})}a("span.ez-toc-section").waypoint(function(a){f(this.element).toggleClass("active",
5
+ "down"===a).toggleClass("active","down"===a).parent().toggleClass("active","down"===a)},{offset:"90%"});a("span.ez-toc-section").waypoint(function(a){f(this.element).toggleClass("active","up"===a).toggleClass("active","up"===a).parent().toggleClass("active","up"===a)},{offset:function(b){var c="undefined"!=typeof ezTOC.scroll_offset?parseInt(ezTOC.scroll_offset):30;b=a(b).height()+c;0===a("#wpadminbar").length&&(b-=30);return parseInt(b)}(this.element)});c=a(".ez-toc-widget-container ul.ez-toc-list li").css("line-height");
6
+ a("<style>.ez-toc-widget-container ul.ez-toc-list li::before{line-height:"+c+";height:"+c+"}</style>").appendTo("head")}});
 
 
 
 
 
 
 
 
 
easy-table-of-contents.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Easy Table of Contents
4
  * Plugin URI: http://connections-pro.com/
5
  * Description: Adds a user friendly and fully automatic way to create and display a table of contents generated from the page content.
6
- * Version: 1.5
7
  * Author: Steven A. Zahm
8
  * Author URI: http://connections-pro.com/
9
  * Text Domain: easy-table-of-contents
@@ -26,7 +26,7 @@
26
  * @package Easy Table of Contents
27
  * @category Plugin
28
  * @author Steven A. Zahm
29
- * @version 1.5
30
  */
31
 
32
  // Exit if accessed directly
@@ -45,7 +45,7 @@ if ( ! class_exists( 'ezTOC' ) ) {
45
  * @since 1.0
46
  * @var string
47
  */
48
- const VERSION = '1.5';
49
 
50
  /**
51
  * Stores the instance of this class.
@@ -245,7 +245,9 @@ if ( ! class_exists( 'ezTOC' ) ) {
245
  $js_vars['width'] = esc_js( $width );
246
  }
247
 
248
- $js_vars['scroll_offset'] = esc_js( ezTOC_Option::get( 'smooth_scroll_offset' ) );
 
 
249
 
250
  if ( ezTOC_Option::get( 'widget_affix_selector' ) ) {
251
 
@@ -271,6 +273,8 @@ if ( ! class_exists( 'ezTOC' ) ) {
271
 
272
  if ( ! ezTOC_Option::get( 'exclude_css' ) ) {
273
 
 
 
274
  $css .= 'div#ez-toc-container ul li {font-size: ' . ezTOC_Option::get( 'font_size' ) . ezTOC_Option::get( 'font_size_units' ) . ';}';
275
 
276
  if ( ezTOC_Option::get( 'theme' ) == 'custom' || ezTOC_Option::get( 'width' ) != 'auto' ) {
@@ -433,7 +437,7 @@ if ( ! class_exists( 'ezTOC' ) ) {
433
  // start lists
434
  if ( $current_depth != (int) $matches[ $i ][2] ) {
435
 
436
- for ( $current_depth; $current_depth < (int) $matches[ $i ][2]; $current_depth ++ ) {
437
 
438
  $numbered_items[ $current_depth + 1 ] = 0;
439
  $html .= '<ul><li>';
@@ -444,13 +448,14 @@ if ( ! class_exists( 'ezTOC' ) ) {
444
  if ( in_array( $matches[ $i ][2], ezTOC_Option::get( 'heading_levels' ) ) ) {
445
 
446
  //$title = apply_filters( 'ez_toc_title', strip_tags( wp_kses_post( $matches[ $i ][0] ) ) );
447
- $title = strip_tags( apply_filters( 'ez_toc_title', $matches[ $i ][0] ) );
 
448
 
449
  //$html .= '<a href="#' . self::url_anchor_target( $title ) . '">';
450
  $html .= sprintf(
451
  '<a href="%1$s" title="%2$s">',
452
  esc_url( '#' . self::url_anchor_target( $matches[ $i ][0] ) ),
453
- esc_attr( $title )
454
  );
455
 
456
  //if ( 'decimal' == ezTOC_Option::get( 'counter' ) ) {
@@ -476,7 +481,7 @@ if ( ! class_exists( 'ezTOC' ) ) {
476
 
477
  if ( $current_depth > (int) $matches[ $i + 1 ][2] ) {
478
 
479
- for ( $current_depth; $current_depth > (int) $matches[ $i + 1 ][2]; $current_depth -- ) {
480
 
481
  $html .= '</li></ul>';
482
  $numbered_items[ $current_depth ] = 0;
@@ -777,7 +782,8 @@ if ( ! class_exists( 'ezTOC' ) ) {
777
 
778
  $items .= '<li><a href="' . esc_url( '#' . $anchor ) . '">';
779
  //$title = apply_filters( 'ez_toc_title', strip_tags( wp_kses_post( $toc[ $i ][0] ) ) );
780
- $title = strip_tags( apply_filters( 'ez_toc_title', $toc[ $i ][0] ) );
 
781
 
782
  //if ( 'decimal' == ezTOC_Option::get( 'counter' ) ) {
783
  //
@@ -1051,12 +1057,12 @@ if ( ! class_exists( 'ezTOC' ) ) {
1051
  $html .= ob_get_clean();
1052
 
1053
  $html .= '</div>' . PHP_EOL;
 
 
 
1054
  }
1055
  }
1056
 
1057
- // Enqueue the script.
1058
- wp_enqueue_script( 'ez-toc-js' );
1059
-
1060
  return array( 'find' => $find, 'replace' => $replace, 'content' => $html );
1061
  }
1062
 
3
  * Plugin Name: Easy Table of Contents
4
  * Plugin URI: http://connections-pro.com/
5
  * Description: Adds a user friendly and fully automatic way to create and display a table of contents generated from the page content.
6
+ * Version: 1.6
7
  * Author: Steven A. Zahm
8
  * Author URI: http://connections-pro.com/
9
  * Text Domain: easy-table-of-contents
26
  * @package Easy Table of Contents
27
  * @category Plugin
28
  * @author Steven A. Zahm
29
+ * @version 1.6
30
  */
31
 
32
  // Exit if accessed directly
45
  * @since 1.0
46
  * @var string
47
  */
48
+ const VERSION = '1.6';
49
 
50
  /**
51
  * Stores the instance of this class.
245
  $js_vars['width'] = esc_js( $width );
246
  }
247
 
248
+ $offset = wp_is_mobile() ? ezTOC_Option::get( 'mobile_smooth_scroll_offset', 0 ) : ezTOC_Option::get( 'smooth_scroll_offset', 30 );
249
+
250
+ $js_vars['scroll_offset'] = esc_js( $offset );
251
 
252
  if ( ezTOC_Option::get( 'widget_affix_selector' ) ) {
253
 
273
 
274
  if ( ! ezTOC_Option::get( 'exclude_css' ) ) {
275
 
276
+ $css .= 'div#ez-toc-container p.ez-toc-title {font-size: ' . ezTOC_Option::get( 'title_font_size', 120 ) . ezTOC_Option::get( 'title_font_size_units', '%' ) . ';}';
277
+ $css .= 'div#ez-toc-container p.ez-toc-title {font-weight: ' . ezTOC_Option::get( 'title_font_weight', 500 ) . ';}';
278
  $css .= 'div#ez-toc-container ul li {font-size: ' . ezTOC_Option::get( 'font_size' ) . ezTOC_Option::get( 'font_size_units' ) . ';}';
279
 
280
  if ( ezTOC_Option::get( 'theme' ) == 'custom' || ezTOC_Option::get( 'width' ) != 'auto' ) {
437
  // start lists
438
  if ( $current_depth != (int) $matches[ $i ][2] ) {
439
 
440
+ for ( $current_depth; $current_depth < (int) $matches[ $i ][2]; $current_depth++ ) {
441
 
442
  $numbered_items[ $current_depth + 1 ] = 0;
443
  $html .= '<ul><li>';
448
  if ( in_array( $matches[ $i ][2], ezTOC_Option::get( 'heading_levels' ) ) ) {
449
 
450
  //$title = apply_filters( 'ez_toc_title', strip_tags( wp_kses_post( $matches[ $i ][0] ) ) );
451
+ $title = apply_filters( 'ez_toc_title', $matches[ $i ][0] );
452
+ $title = preg_replace( '/<\/?h\d[^>]*>/muU', '', $title );
453
 
454
  //$html .= '<a href="#' . self::url_anchor_target( $title ) . '">';
455
  $html .= sprintf(
456
  '<a href="%1$s" title="%2$s">',
457
  esc_url( '#' . self::url_anchor_target( $matches[ $i ][0] ) ),
458
+ esc_attr( strip_tags( $title ) )
459
  );
460
 
461
  //if ( 'decimal' == ezTOC_Option::get( 'counter' ) ) {
481
 
482
  if ( $current_depth > (int) $matches[ $i + 1 ][2] ) {
483
 
484
+ for ( $current_depth; $current_depth > (int) $matches[ $i + 1 ][2]; $current_depth-- ) {
485
 
486
  $html .= '</li></ul>';
487
  $numbered_items[ $current_depth ] = 0;
782
 
783
  $items .= '<li><a href="' . esc_url( '#' . $anchor ) . '">';
784
  //$title = apply_filters( 'ez_toc_title', strip_tags( wp_kses_post( $toc[ $i ][0] ) ) );
785
+ $title = apply_filters( 'ez_toc_title', $matches[ $i ][0] );
786
+ $title = preg_replace( '/<\/?h\d[^>]*>/muU', '', $title );
787
 
788
  //if ( 'decimal' == ezTOC_Option::get( 'counter' ) ) {
789
  //
1057
  $html .= ob_get_clean();
1058
 
1059
  $html .= '</div>' . PHP_EOL;
1060
+
1061
+ // Enqueue the script.
1062
+ wp_enqueue_script( 'ez-toc-js' );
1063
  }
1064
  }
1065
 
 
 
 
1066
  return array( 'find' => $find, 'replace' => $replace, 'content' => $html );
1067
  }
1068
 
includes/class.options.php CHANGED
@@ -331,6 +331,31 @@ if ( ! class_exists( 'ezTOC_Option' ) ) {
331
  ),
332
  'default' => 'none',
333
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  'font_size' => array(
335
  'id' => 'font_size',
336
  'name' => __( 'Font Size', 'easy-table-of-contents' ),
@@ -484,6 +509,14 @@ if ( ! class_exists( 'ezTOC_Option' ) ) {
484
  'size' => 'small',
485
  'default' => 30
486
  ),
 
 
 
 
 
 
 
 
487
  'restrict_path' => array(
488
  'id' => 'restrict_path',
489
  'name' => __( 'Limit Path', 'easy-table-of-contents' ),
@@ -539,6 +572,7 @@ if ( ! class_exists( 'ezTOC_Option' ) ) {
539
  'counter' => 'decimal',
540
  'smooth_scroll' => TRUE,
541
  'smooth_scroll_offset' => 30,
 
542
  'visibility' => TRUE,
543
  //'visibility_show' => 'show',
544
  //'visibility_hide' => 'hide',
@@ -547,6 +581,9 @@ if ( ! class_exists( 'ezTOC_Option' ) ) {
547
  'width_custom' => 275,
548
  'width_custom_units' => 'px',
549
  'wrapping' => 'none',
 
 
 
550
  'font_size' => 95,
551
  'font_size_units' => '%',
552
  'theme' => 'grey',
@@ -601,7 +638,7 @@ if ( ! class_exists( 'ezTOC_Option' ) ) {
601
  * @param string $key
602
  * @param bool|FALSE $default
603
  *
604
- * @return mixed|void
605
  */
606
  public static function get( $key, $default = FALSE ) {
607
 
@@ -1225,10 +1262,11 @@ if ( ! class_exists( 'ezTOC_Option' ) ) {
1225
  'desc' => '',
1226
  'options' => array(
1227
  'pt' => 'pt',
 
1228
  '%' => '%',
1229
  'em' => 'em',
1230
  ),
1231
- 'default' => 'px',
1232
  )
1233
  );
1234
 
331
  ),
332
  'default' => 'none',
333
  ),
334
+ 'title_font_size' => array(
335
+ 'id' => 'title_font_size',
336
+ 'name' => __( 'Title Font Size', 'easy-table-of-contents' ),
337
+ 'desc' => '',
338
+ 'type' => 'font_size',
339
+ 'default' => 120,
340
+ ),
341
+ 'title_font_weight' => array(
342
+ 'id' => 'title_font_weight',
343
+ 'name' => __( 'Title Font Weight', 'easy-table-of-contents' ),
344
+ 'desc' => '',
345
+ 'type' => 'select',
346
+ 'options' => array(
347
+ '100' => __( 'Thin', 'easy-table-of-contents' ),
348
+ '200' => __( 'Extra Light', 'easy-table-of-contents' ),
349
+ '300' => __( 'Light', 'easy-table-of-contents' ),
350
+ '400' => __( 'Normal', 'easy-table-of-contents' ),
351
+ '500' => __( 'Medium', 'easy-table-of-contents' ),
352
+ '600' => __( 'Semi Bold', 'easy-table-of-contents' ),
353
+ '700' => __( 'Bold', 'easy-table-of-contents' ),
354
+ '800' => __( 'Extra Bold', 'easy-table-of-contents' ),
355
+ '900' => __( 'Heavy', 'easy-table-of-contents' ),
356
+ ),
357
+ 'default' => '500',
358
+ ),
359
  'font_size' => array(
360
  'id' => 'font_size',
361
  'name' => __( 'Font Size', 'easy-table-of-contents' ),
509
  'size' => 'small',
510
  'default' => 30
511
  ),
512
+ 'mobile_smooth_scroll_offset' => array(
513
+ 'id' => 'mobile_smooth_scroll_offset',
514
+ 'name' => __( 'Mobile Smooth Scroll Offset', 'easy-table-of-contents' ),
515
+ 'desc' => 'px<br/>' . __( 'This provides the same function as the Smooth Scroll Offset option above but applied when the user is visiting your site on a mobile device.', 'easy-table-of-contents' ),
516
+ 'type' => 'number',
517
+ 'size' => 'small',
518
+ 'default' => 0
519
+ ),
520
  'restrict_path' => array(
521
  'id' => 'restrict_path',
522
  'name' => __( 'Limit Path', 'easy-table-of-contents' ),
572
  'counter' => 'decimal',
573
  'smooth_scroll' => TRUE,
574
  'smooth_scroll_offset' => 30,
575
+ 'moile_smooth_scroll_offset' => 0,
576
  'visibility' => TRUE,
577
  //'visibility_show' => 'show',
578
  //'visibility_hide' => 'hide',
581
  'width_custom' => 275,
582
  'width_custom_units' => 'px',
583
  'wrapping' => 'none',
584
+ 'title_font_size' => 120,
585
+ 'title_font_size_units' => '%',
586
+ 'title_font_weight' => 500,
587
  'font_size' => 95,
588
  'font_size_units' => '%',
589
  'theme' => 'grey',
638
  * @param string $key
639
  * @param bool|FALSE $default
640
  *
641
+ * @return mixed
642
  */
643
  public static function get( $key, $default = FALSE ) {
644
 
1262
  'desc' => '',
1263
  'options' => array(
1264
  'pt' => 'pt',
1265
+ 'px' => 'px',
1266
  '%' => '%',
1267
  'em' => 'em',
1268
  ),
1269
+ 'default' => '%',
1270
  )
1271
  );
1272
 
includes/class.widget-toc.php CHANGED
@@ -144,7 +144,13 @@ if ( ! class_exists( 'ezTOC_Widget' ) ) {
144
 
145
  $find = $replace = array();
146
  $post = get_post( $wp_query->post->ID );
 
 
 
 
 
147
  $content = apply_filters( 'the_content', $post->post_content );
 
148
 
149
  /**
150
  * @var string $before_widget
144
 
145
  $find = $replace = array();
146
  $post = get_post( $wp_query->post->ID );
147
+
148
+ /*
149
+ * Ensure the ezTOC content filter is not applied when running `the_content` filter.
150
+ */
151
+ remove_filter( 'the_content', array( 'ezTOC', 'the_content' ), 100 );
152
  $content = apply_filters( 'the_content', $post->post_content );
153
+ add_filter( 'the_content', array( 'ezTOC', 'the_content' ), 100 );
154
 
155
  /**
156
  * @var string $before_widget
vendor/icomoon/style.css CHANGED
@@ -8,21 +8,24 @@
8
  font-weight: normal;
9
  font-style: normal;
10
  }
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
- i {
13
- font-family: 'ez-toc-icomoon';
14
- speak: none;
15
- font-style: normal;
16
- font-weight: normal;
17
- font-variant: normal;
18
- text-transform: none;
19
- line-height: 1;
20
 
21
- /* Better Font Rendering =========== */
22
- -webkit-font-smoothing: antialiased;
23
- -moz-osx-font-smoothing: grayscale;
24
- }
25
-
26
- .icon-menu:before {
27
- content: "\e87a";
28
- }
8
  font-weight: normal;
9
  font-style: normal;
10
  }
11
+ /*
12
+ * Do not load these styles!!!
13
+ * @link https://wordpress.org/support/topic/specify-css-rule-for-tag/
14
+ */
15
+ /*i {*/
16
+ /*font-family: 'ez-toc-icomoon';*/
17
+ /*speak: none;*/
18
+ /*font-style: normal;*/
19
+ /*font-weight: normal;*/
20
+ /*font-variant: normal;*/
21
+ /*text-transform: none;*/
22
+ /*line-height: 1;*/
23
 
24
+ /*!* Better Font Rendering =========== *!*/
25
+ /*-webkit-font-smoothing: antialiased;*/
26
+ /*-moz-osx-font-smoothing: grayscale;*/
27
+ /*}*/
 
 
 
 
28
 
29
+ /*.icon-menu:before {*/
30
+ /*content: "\e87a";*/
31
+ /*}*/
 
 
 
 
 
vendor/icomoon/style.min.css CHANGED
@@ -1,3 +1 @@
1
- @font-face{font-family:'ez-toc-icomoon';src:url('fonts/ez-toc-icomoon.eot?-5j7dhv');src:url('fonts/ez-toc-icomoon.eot?#iefix-5j7dhv') format('embedded-opentype'),url('fonts/ez-toc-icomoon.ttf?-5j7dhv') format('truetype'),url('fonts/ez-toc-icomoon.woff?-5j7dhv') format('woff'),url('fonts/ez-toc-icomoon.svg?-5j7dhv#ez-toc-icomoon') format('svg');font-weight:normal;font-style:normal}
2
- i{font-family:'ez-toc-icomoon';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
3
- .icon-menu:before{content:"\e87a"}
1
+ @font-face{font-family:ez-toc-icomoon;src:url(fonts/ez-toc-icomoon.eot?-5j7dhv);src:url(fonts/ez-toc-icomoon.eot?#iefix-5j7dhv) format('embedded-opentype'),url(fonts/ez-toc-icomoon.ttf?-5j7dhv) format('truetype'),url(fonts/ez-toc-icomoon.woff?-5j7dhv) format('woff'),url(fonts/ez-toc-icomoon.svg?-5j7dhv#ez-toc-icomoon) format('svg');font-weight:400;font-style:normal}