Version Description
07/19/2022 = * TWEAK: Added Oxygen pagebulider compatibility #198 * TWEAK: Added toggle state class to container #129 * TWEAK: Added Refresh Toggle State #149 * BUG: TOC not showing in WooCommerce category description #134 * BUG: TOC links not working with emoji in title #117 * BUG: TOC not running on nested excluded filters #118 * BUG: Showing incorrect excerpt in a grid with Genesis Framework and other themes #144
Download this release
Release Info
Developer | magazine3 |
Plugin | Easy Table of Contents |
Version | 2.0.29 |
Comparing to | |
See all releases |
Code changes from version 2.0.28 to 2.0.29
- README.txt +10 -1
- assets/js/front.js +5 -0
- assets/js/front.min.js +1 -1
- easy-table-of-contents.php +7 -4
- includes/inc.functions.php +26 -0
- vendor/js-cookie/js.cookie.min.js +7 -7
README.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: table of contents, toc
|
|
5 |
Requires at least: 5.3
|
6 |
Tested up to: 6.0
|
7 |
Requires PHP: 5.6.20
|
8 |
-
Stable tag: 2.0.
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -97,6 +97,15 @@ Easy Table Contents is a fork of the excellent [Table of Contents Plus](https://
|
|
97 |
|
98 |
== Changelog ==
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
= 2.0.28 07/15/2022 =
|
101 |
* TWEAK: Added Sidebar placement option for TOC #156
|
102 |
* TWEAK: Added SeedProd Pro compatibility #157
|
5 |
Requires at least: 5.3
|
6 |
Tested up to: 6.0
|
7 |
Requires PHP: 5.6.20
|
8 |
+
Stable tag: 2.0.29
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
97 |
|
98 |
== Changelog ==
|
99 |
|
100 |
+
= 2.0.29 07/19/2022 =
|
101 |
+
* TWEAK: Added Oxygen pagebulider compatibility #198
|
102 |
+
* TWEAK: Added toggle state class to container #129
|
103 |
+
* TWEAK: Added Refresh Toggle State #149
|
104 |
+
* BUG: TOC not showing in WooCommerce category description #134
|
105 |
+
* BUG: TOC links not working with emoji in title #117
|
106 |
+
* BUG: TOC not running on nested excluded filters #118
|
107 |
+
* BUG: Showing incorrect excerpt in a grid with Genesis Framework and other themes #144
|
108 |
+
|
109 |
= 2.0.28 07/15/2022 =
|
110 |
* TWEAK: Added Sidebar placement option for TOC #156
|
111 |
* TWEAK: Added SeedProd Pro compatibility #157
|
assets/js/front.js
CHANGED
@@ -134,10 +134,12 @@ jQuery( function( $ ) {
|
|
134 |
if ( Cookies ) {
|
135 |
|
136 |
Cookies.get( 'ezTOC_hidetoc' ) == 1 ? toggle.data( 'visible', false ) : toggle.data( 'visible', true );
|
|
|
137 |
|
138 |
} else {
|
139 |
|
140 |
toggle.data( 'visible', true );
|
|
|
141 |
}
|
142 |
|
143 |
if ( invert ) {
|
@@ -153,6 +155,9 @@ jQuery( function( $ ) {
|
|
153 |
toggle.on( 'click', function( event ) {
|
154 |
|
155 |
event.preventDefault();
|
|
|
|
|
|
|
156 |
|
157 |
if ( $( this ).data( 'visible' ) ) {
|
158 |
|
134 |
if ( Cookies ) {
|
135 |
|
136 |
Cookies.get( 'ezTOC_hidetoc' ) == 1 ? toggle.data( 'visible', false ) : toggle.data( 'visible', true );
|
137 |
+
Cookies.remove('ezTOC_hidetoc')
|
138 |
|
139 |
} else {
|
140 |
|
141 |
toggle.data( 'visible', true );
|
142 |
+
Cookies.remove('ezTOC_hidetoc')
|
143 |
}
|
144 |
|
145 |
if ( invert ) {
|
155 |
toggle.on( 'click', function( event ) {
|
156 |
|
157 |
event.preventDefault();
|
158 |
+
|
159 |
+
const main = document.querySelector("#ez-toc-container");
|
160 |
+
main.classList.toggle("toc_close");
|
161 |
|
162 |
if ( $( this ).data( 'visible' ) ) {
|
163 |
|
assets/js/front.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function($){if("undefined"!=typeof ezTOC){function
|
1 |
+
jQuery(function($){if("undefined"!=typeof ezTOC){function a(){if(0!==$(".ez-toc-widget-container.ez-toc-affix").length){var c=30;void 0!==ezTOC.scroll_offset&&(c=parseInt(ezTOC.scroll_offset)),$(ezTOC.affixSelector).stick_in_parent({inner_scrolling:!1,offset_top:c})}if($.fn.shrinkTOCWidth=function(){$(this).css({width:"auto",display:"table"}),/MSIE 7\./.test(navigator.userAgent)&&$(this).css("width","")},1===parseInt(ezTOC.smooth_scroll)&&$("a.ez-toc-link").on("click",function(){var c=$(this),a="",g=c.prop("hostname"),b=c.prop("pathname"),h=c.prop("search"),d=c.prop("hash");if(b.length>0&&"/"!==b.charAt(0)&&(b="/"+b),window.location.hostname===g&&window.location.pathname===b&&window.location.search===h&&""!==d){if(0===$(a='[id="'+d.replace("#","")+'"]').length&&(console.log("ezTOC scrollTarget Not Found: "+a),a=""),void 0!==ezTOC.scroll_offset)var e=-1*ezTOC.scroll_offset;else{var f=$("#wpadminbar");e=f.length>0&&f.is(":visible")?-30:0}a&&$.smoothScroll({scrollTarget:a,offset:e,beforeScroll:n,afterScroll:function(){m(),j()}})}}),void 0!==ezTOC.visibility_hide_by_default){var e=$("ul.ez-toc-list"),a=$("a.ez-toc-toggle"),f=ezTOC.visibility_hide_by_default;a.css("display","inline"),Cookies?(1==Cookies.get("ezTOC_hidetoc")?a.data("visible",!1):a.data("visible",!0),Cookies.remove("ezTOC_hidetoc")):(a.data("visible",!0),Cookies.remove("ezTOC_hidetoc")),f&&a.data("visible",!1),a.data("visible")||e.hide(),a.on("click",function(a){a.preventDefault();let b=document.querySelector("#ez-toc-container");b.classList.toggle("toc_close"),$(this).data("visible")?($(this).data("visible",!1),Cookies&&(f?Cookies.set("ezTOC_hidetoc",null,{path:"/"}):Cookies.set("ezTOC_hidetoc","1",{expires:30,path:"/"})),e.hide("fast")):($(this).data("visible",!0),Cookies&&(f?Cookies.set("ezTOC_hidetoc","1",{expires:30,path:"/"}):Cookies.set("ezTOC_hidetoc",null,{path:"/"})),e.show("fast"))})}var g,b,d,h=$("span.ez-toc-section").toArray(),i=(g=h).reduce(function(a,b){var c;return a[b.id]=$('.ez-toc-widget-container .ez-toc-list a[href="#'+$(b).attr("id")+'"]'),a},{}),k=$.map(i,function(a,b){return a}),l=(b=5,void 0!==ezTOC.smooth_scroll&&1===parseInt(ezTOC.smooth_scroll)&&(b=void 0!==ezTOC.scroll_offset?parseInt(ezTOC.scroll_offset):30),(d=$("#wpadminbar")).length&&(b+=d.height()),b);function m(){var a=o(l,h);if(a){var b=i[a.id];p(b,k),q(b)}}function j(){h.length>0&&$(".ez-toc-widget-container").length&&$(window).on("load resize scroll",m)}function n(){$(window).off("load resize scroll",m)}function o(c,a){var d=$(window).scrollTop()+c+1,b=a[0],e=d-$(b).offset().top;return a.forEach(function(c){var a=d-$(c).offset().top;a>0&&a<e&&(e=a,b=c)}),b}function p(b,a){a.forEach(function(a){b!==a&&a.parent().hasClass("active")&&a.parent().removeClass("active")})}function q(g){var i,h,a,d,b,e,f,c=g.parent();c.hasClass("active")||c.addClass("active"),f=(d=(a=$(h=c)).html(),a.parent().append('<li id="ez-toc-height-test" class="active">'+d+"</li>"),b=$("#ez-toc-height-test"),e=b.height(),b.remove(),e-a.children("ul").first().height()),$("#ez-toc-active-height").remove(),$('<style id="ez-toc-active-height">.ez-toc-widget-container ul.ez-toc-list li.active::before {height:'+f+"px;} </style>").appendTo("head")}j()}ezTOC.init=function(){a()},a()}})
|
easy-table-of-contents.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Easy Table of Contents
|
4 |
* Plugin URI: https://magazine3.company/
|
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: 2.0.
|
7 |
* Author: Magazine3
|
8 |
* Author URI: https://magazine3.company/
|
9 |
* Text Domain: easy-table-of-contents
|
@@ -26,7 +26,7 @@
|
|
26 |
* @package Easy Table of Contents
|
27 |
* @category Plugin
|
28 |
* @author Magazine3
|
29 |
-
* @version 2.0.
|
30 |
*/
|
31 |
|
32 |
use Easy_Plugins\Table_Of_Contents\Debug;
|
@@ -48,7 +48,7 @@ if ( ! class_exists( 'ezTOC' ) ) {
|
|
48 |
* @since 1.0
|
49 |
* @var string
|
50 |
*/
|
51 |
-
const VERSION = '2.0.
|
52 |
|
53 |
/**
|
54 |
* Stores the instance of this class.
|
@@ -577,6 +577,9 @@ if ( ! class_exists( 'ezTOC' ) ) {
|
|
577 |
$apply = false;
|
578 |
}
|
579 |
|
|
|
|
|
|
|
580 |
/**
|
581 |
* Whether or not to apply `the_content` filter callback.
|
582 |
*
|
@@ -767,4 +770,4 @@ function ez_toc_redirect() {
|
|
767 |
wp_redirect("options-general.php?page=table-of-contents#welcome");
|
768 |
}
|
769 |
}
|
770 |
-
}
|
3 |
* Plugin Name: Easy Table of Contents
|
4 |
* Plugin URI: https://magazine3.company/
|
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: 2.0.29
|
7 |
* Author: Magazine3
|
8 |
* Author URI: https://magazine3.company/
|
9 |
* Text Domain: easy-table-of-contents
|
26 |
* @package Easy Table of Contents
|
27 |
* @category Plugin
|
28 |
* @author Magazine3
|
29 |
+
* @version 2.0.29
|
30 |
*/
|
31 |
|
32 |
use Easy_Plugins\Table_Of_Contents\Debug;
|
48 |
* @since 1.0
|
49 |
* @var string
|
50 |
*/
|
51 |
+
const VERSION = '2.0.29';
|
52 |
|
53 |
/**
|
54 |
* Stores the instance of this class.
|
577 |
$apply = false;
|
578 |
}
|
579 |
|
580 |
+
if ( ! empty( array_intersect( $wp_current_filter, array( 'get_the_excerpt', 'init', 'wp_head' ) ) ) ) {
|
581 |
+
$apply = false;
|
582 |
+
}
|
583 |
/**
|
584 |
* Whether or not to apply `the_content` filter callback.
|
585 |
*
|
770 |
wp_redirect("options-general.php?page=table-of-contents#welcome");
|
771 |
}
|
772 |
}
|
773 |
+
}
|
includes/inc.functions.php
CHANGED
@@ -96,4 +96,30 @@ function ez_toc_inline_styles(){
|
|
96 |
}
|
97 |
if (ezTOC_Option::get( 'inline_css' )) {
|
98 |
add_action('wp_head', 'ez_toc_inline_styles');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
96 |
}
|
97 |
if (ezTOC_Option::get( 'inline_css' )) {
|
98 |
add_action('wp_head', 'ez_toc_inline_styles');
|
99 |
+
}
|
100 |
+
|
101 |
+
add_action( 'woocommerce_archive_description', 'ez_toc_woo_category_desc' );
|
102 |
+
function ez_toc_woo_category_desc() {
|
103 |
+
if (!function_exists('vtde_php_upgrade_notice')) {
|
104 |
+
return false;
|
105 |
+
}
|
106 |
+
$term_object = get_queried_object();
|
107 |
+
$desc = $term_object->description;
|
108 |
+
preg_match_all( '@<h1.*?>(.*?)<\/h1>@', $desc, $matches );
|
109 |
+
$array = $matches[1];
|
110 |
+
$container = '<div id="ez-toc-container" class="counter-hierarchy counter-decimal ez-toc-grey"><div class="ez-toc-title-container"><p class="ez-toc-title">Table of Contents</p><span class="ez-toc-title-toggle"><a class="ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle" style="display: inline;"><i class="ez-toc-glyphicon ez-toc-icon-toggle"></i></a></span></div><nav><ul class="ez-toc-list">';
|
111 |
+
foreach ( $array as $val ) {
|
112 |
+
$vals .= '<li><a class="anchor" href="#'.$val.'">'.$val.'</a></li>';
|
113 |
+
$desc = preg_replace('/<h1>(.*?)<\/h1>/', "<h1 id='$1'>$1</h1>", $desc);
|
114 |
+
}
|
115 |
+
$last .= '</ul></nav></div>';
|
116 |
+
$desc = $container . $vals . $last . $desc;
|
117 |
+
echo $desc;
|
118 |
+
}
|
119 |
+
add_action('wp_head', 'ez_toc_woo_cat_desc_remove');
|
120 |
+
function ez_toc_woo_cat_desc_remove(){
|
121 |
+
if (!function_exists('vtde_php_upgrade_notice')) {
|
122 |
+
return false;
|
123 |
+
}
|
124 |
+
remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
|
125 |
}
|
vendor/js-cookie/js.cookie.min.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
/*!
|
2 |
-
* JavaScript Cookie v2.2.1
|
3 |
-
* https://github.com/js-cookie/js-cookie
|
4 |
-
*
|
5 |
-
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
6 |
-
* Released under the MIT license
|
7 |
-
*/
|
8 |
!function(factory){var registeredInModuleLoader;if("function"==typeof define&&define.amd&&(define(factory),registeredInModuleLoader=!0),"object"==typeof exports&&(module.exports=factory(),registeredInModuleLoader=!0),!registeredInModuleLoader){var OldCookies=window.Cookies,api=window.Cookies=factory();api.noConflict=function(){return window.Cookies=OldCookies,api}}}((function(){function extend(){for(var i=0,result={};i<arguments.length;i++){var attributes=arguments[i];for(var key in attributes)result[key]=attributes[key]}return result}function decode(s){return s.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function init(converter){function api(){}function set(key,value,attributes){if("undefined"!=typeof document){"number"==typeof(attributes=extend({path:"/"},api.defaults,attributes)).expires&&(attributes.expires=new Date(1*new Date+864e5*attributes.expires)),attributes.expires=attributes.expires?attributes.expires.toUTCString():"";try{var result=JSON.stringify(value);/^[\{\[]/.test(result)&&(value=result)}catch(e){}value=converter.write?converter.write(value,key):encodeURIComponent(String(value)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),key=encodeURIComponent(String(key)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var stringifiedAttributes="";for(var attributeName in attributes)attributes[attributeName]&&(stringifiedAttributes+="; "+attributeName,!0!==attributes[attributeName]&&(stringifiedAttributes+="="+attributes[attributeName].split(";")[0]));return document.cookie=key+"="+value+stringifiedAttributes}}function get(key,json){if("undefined"!=typeof document){for(var jar={},cookies=document.cookie?document.cookie.split("; "):[],i=0;i<cookies.length;i++){var parts=cookies[i].split("="),cookie=parts.slice(1).join("=");json||'"'!==cookie.charAt(0)||(cookie=cookie.slice(1,-1));try{var name=decode(parts[0]);if(cookie=(converter.read||converter)(cookie,name)||decode(cookie),json)try{cookie=JSON.parse(cookie)}catch(e){}if(jar[name]=cookie,key===name)break}catch(e){}}return key?jar[key]:jar}}return api.set=set,api.get=function(key){return get(key,!1)},api.getJSON=function(key){return get(key,!0)},api.remove=function(key,attributes){set(key,"",extend(attributes,{expires:-1}))},api.defaults={},api.withConverter=init,api}return init((function(){}))}));
|
1 |
+
/*!
|
2 |
+
* JavaScript Cookie v2.2.1
|
3 |
+
* https://github.com/js-cookie/js-cookie
|
4 |
+
*
|
5 |
+
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
6 |
+
* Released under the MIT license
|
7 |
+
*/
|
8 |
!function(factory){var registeredInModuleLoader;if("function"==typeof define&&define.amd&&(define(factory),registeredInModuleLoader=!0),"object"==typeof exports&&(module.exports=factory(),registeredInModuleLoader=!0),!registeredInModuleLoader){var OldCookies=window.Cookies,api=window.Cookies=factory();api.noConflict=function(){return window.Cookies=OldCookies,api}}}((function(){function extend(){for(var i=0,result={};i<arguments.length;i++){var attributes=arguments[i];for(var key in attributes)result[key]=attributes[key]}return result}function decode(s){return s.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function init(converter){function api(){}function set(key,value,attributes){if("undefined"!=typeof document){"number"==typeof(attributes=extend({path:"/"},api.defaults,attributes)).expires&&(attributes.expires=new Date(1*new Date+864e5*attributes.expires)),attributes.expires=attributes.expires?attributes.expires.toUTCString():"";try{var result=JSON.stringify(value);/^[\{\[]/.test(result)&&(value=result)}catch(e){}value=converter.write?converter.write(value,key):encodeURIComponent(String(value)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),key=encodeURIComponent(String(key)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var stringifiedAttributes="";for(var attributeName in attributes)attributes[attributeName]&&(stringifiedAttributes+="; "+attributeName,!0!==attributes[attributeName]&&(stringifiedAttributes+="="+attributes[attributeName].split(";")[0]));return document.cookie=key+"="+value+stringifiedAttributes}}function get(key,json){if("undefined"!=typeof document){for(var jar={},cookies=document.cookie?document.cookie.split("; "):[],i=0;i<cookies.length;i++){var parts=cookies[i].split("="),cookie=parts.slice(1).join("=");json||'"'!==cookie.charAt(0)||(cookie=cookie.slice(1,-1));try{var name=decode(parts[0]);if(cookie=(converter.read||converter)(cookie,name)||decode(cookie),json)try{cookie=JSON.parse(cookie)}catch(e){}if(jar[name]=cookie,key===name)break}catch(e){}}return key?jar[key]:jar}}return api.set=set,api.get=function(key){return get(key,!1)},api.getJSON=function(key){return get(key,!0)},api.remove=function(key,attributes){set(key,"",extend(attributes,{expires:-1}))},api.defaults={},api.withConverter=init,api}return init((function(){}))}));
|