Easy Table of Contents - Version 2.0.40

Version Description

12/13/2022 = * BUG: Broken CSS after the new update #352 * BUG: Fixed TOC is combine & conflict with sidebar shortcode TOC #349 * BUG: Numbers are wrong #330 * BUG: Getting Header " H5 " AND " H6 " as strings below the Table of Content. #288 * BUG: Smooth Scroll Offset #143

Download this release

Release Info

Developer magazine3
Plugin Icon 128x128 Easy Table of Contents
Version 2.0.40
Comparing to
See all releases

Code changes from version 2.0.39 to 2.0.40

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: table of contents, toc
5
  Requires at least: 5.3
6
  Tested up to: 6.1.1
7
  Requires PHP: 5.6.20
8
- Stable tag: 2.0.39
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -105,6 +105,13 @@ Easy Table Contents is a fork of the excellent [Table of Contents Plus](https://
105
  4. Activate the plugin on the Plugins admin page.
106
 
107
  == Changelog ==
 
 
 
 
 
 
 
108
  = 2.0.39 11/30/2022 =
109
  * BUG: Toggle Icons going to opposite side when rtl option settings used #348
110
  * BUG: Newsletter subscribe form is not popping up during plugin activation. #344
5
  Requires at least: 5.3
6
  Tested up to: 6.1.1
7
  Requires PHP: 5.6.20
8
+ Stable tag: 2.0.40
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
105
  4. Activate the plugin on the Plugins admin page.
106
 
107
  == Changelog ==
108
+ = 2.0.40 12/13/2022 =
109
+ * BUG: Broken CSS after the new update #352
110
+ * BUG: Fixed TOC is combine & conflict with sidebar shortcode TOC #349
111
+ * BUG: Numbers are wrong #330
112
+ * BUG: Getting Header " H5 " AND " H6 " as strings below the Table of Content. #288
113
+ * BUG: Smooth Scroll Offset #143
114
+
115
  = 2.0.39 11/30/2022 =
116
  * BUG: Toggle Icons going to opposite side when rtl option settings used #348
117
  * BUG: Newsletter subscribe form is not popping up during plugin activation. #344
assets/js/front.js CHANGED
@@ -51,77 +51,6 @@ jQuery( function( $ ) {
51
  $( this ).css( 'width', '' );
52
  };
53
 
54
- var smoothScroll = parseInt( ezTOC.smooth_scroll );
55
-
56
- if ( 1 === smoothScroll ) {
57
-
58
- $( 'a.ez-toc-link' ).on( 'click', function() {
59
-
60
- var self = $( this );
61
-
62
- var target = '';
63
- var hostname = self.prop( 'hostname' );
64
- var pathname = self.prop( 'pathname' );
65
- var qs = self.prop( 'search' );
66
- var hash = self.prop( 'hash' );
67
-
68
- // ie strips out the preceding / from pathname
69
- if ( pathname.length > 0 ) {
70
- if ( pathname.charAt( 0 ) !== '/' ) {
71
- pathname = '/' + pathname;
72
- }
73
- }
74
-
75
- if ( ( window.location.hostname === hostname ) &&
76
- ( window.location.pathname === pathname ) &&
77
- ( window.location.search === qs ) &&
78
- ( hash !== '' )
79
- ) {
80
-
81
- // var id = decodeURIComponent( hash.replace( '#', '' ) );
82
- target = '[id="' + hash.replace( '#', '' ) + '"]';
83
-
84
- // verify it exists
85
- if ( $( target ).length === 0 ) {
86
- console.log( 'ezTOC scrollTarget Not Found: ' + target );
87
- target = '';
88
- }
89
-
90
- // check offset setting
91
- if ( typeof ezTOC.scroll_offset != 'undefined' ) {
92
-
93
- var offset = -1 * ezTOC.scroll_offset;
94
-
95
- } else {
96
-
97
- var adminbar = $( '#wpadminbar' );
98
-
99
- if ( adminbar.length > 0 ) {
100
-
101
- if ( adminbar.is( ':visible' ) )
102
- offset = -30; // admin bar exists, give it the default
103
- else
104
- offset = 0; // there is an admin bar but it's hidden, so no offset!
105
-
106
- } else {
107
-
108
- // no admin bar, so no offset!
109
- offset = 0;
110
- }
111
- }
112
-
113
- if ( target ) {
114
- $.smoothScroll( {
115
- scrollTarget: target,
116
- offset: offset,
117
- beforeScroll: deactivateSetActiveEzTocListElement,
118
- afterScroll: function() { setActiveEzTocListElement(); activateSetActiveEzTocListElement(); }
119
- } );
120
-
121
- }
122
- }
123
- } );
124
- }
125
 
126
  if ( typeof ezTOC.visibility_hide_by_default != 'undefined' ) {
127
 
51
  $( this ).css( 'width', '' );
52
  };
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  if ( typeof ezTOC.visibility_hide_by_default != 'undefined' ) {
56
 
assets/js/front.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(t){if("undefined"!=typeof ezTOC){function e(){if(0!==t(".ez-toc-widget-container.ez-toc-affix").length){var e=30;void 0!==ezTOC.scroll_offset&&(e=parseInt(ezTOC.scroll_offset)),t(ezTOC.affixSelector).stick_in_parent({inner_scrolling:!1,offset_top:e})}if(t.fn.shrinkTOCWidth=function(){t(this).css({width:"auto",display:"table"}),/MSIE 7\./.test(navigator.userAgent)&&t(this).css("width","")},1===parseInt(ezTOC.smooth_scroll)&&t("a.ez-toc-link").on("click",function(){var e=t(this),i="",o=e.prop("hostname"),a=e.prop("pathname"),c=e.prop("search"),s=e.prop("hash");if(a.length>0&&"/"!==a.charAt(0)&&(a="/"+a),window.location.hostname===o&&window.location.pathname===a&&window.location.search===c&&""!==s){if(0===t(i='[id="'+s.replace("#","")+'"]').length&&(console.log("ezTOC scrollTarget Not Found: "+i),i=""),void 0!==ezTOC.scroll_offset)var l=-1*ezTOC.scroll_offset;else{var n=t("#wpadminbar");l=n.length>0&&n.is(":visible")?-30:0}i&&t.smoothScroll({scrollTarget:i,offset:l,beforeScroll:v,afterScroll:function(){f(),d()}})}}),void 0!==ezTOC.visibility_hide_by_default){var i=t("a.ez-toc-toggle"),o=ezTOC.visibility_hide_by_default;t.each(i,function(e,i){var a=t(this),c=t(a).parents("#ez-toc-container,#ez-toc-widget-container").find("ul.ez-toc-list");Cookies?(1==Cookies.get("ezTOC_hidetoc-"+e)?t(a).data("visible",!1):t(a).data("visible",!0),Cookies.remove("ezTOC_hidetoc-"+e)):(t(a).data("visible",!0),Cookies.remove("ezTOC_hidetoc-"+e)),o&&t(a).data("visible",!1),t(a).data("visible")||c.hide(),t(a).on("click",function(i){i.preventDefault();let a=document.querySelector("#ez-toc-container");if(a)a.classList.toggle("toc_close");else{let s=document.querySelector(".ez-toc-widget-container");s.classList.toggle("toc_close")}t(this).data("visible")?(t(this).data("visible",!1),Cookies&&(o?Cookies.set("ezTOC_hidetoc-"+e,null,{path:"/"}):Cookies.set("ezTOC_hidetoc-"+e,"1",{expires:30,path:"/"})),c.hide("fast")):(t(this).data("visible",!0),Cookies&&(o?Cookies.set("ezTOC_hidetoc-"+e,"1",{expires:30,path:"/"}):Cookies.set("ezTOC_hidetoc-"+e,null,{path:"/"})),c.show("fast"))})})}var a,c,s,l=t("span.ez-toc-section").toArray(),n=(a=l,a.reduce(function(e,i){var o;return e[i.id]=t('.ez-toc-widget-container .ez-toc-list a[href="#'+t(o=i).attr("id")+'"]'),e},{})),r=t.map(n,function(t,e){return t}),h=(c=5,void 0!==ezTOC.smooth_scroll&&1===parseInt(ezTOC.smooth_scroll)&&(c=void 0!==ezTOC.scroll_offset?parseInt(ezTOC.scroll_offset):30),s=t("#wpadminbar"),s.length&&(c+=s.height()),c);function f(){var e,i,o,a,c,s=(e=h,i=l,o=t(window).scrollTop()+e+1,a=i[0],c=o-t(a).offset().top,i.forEach(function(e){var i=o-t(e).offset().top;i>0&&i<c&&(c=i,a=e)}),a);if(s){var f,d,v,p,g,u,z,$,b,m=n[s.id];(function t(e,i){i.forEach(function(t){e!==t&&t.parent().hasClass("active")&&t.parent().removeClass("active")})})(m,r),(v=(f=m).parent()).hasClass("active")||v.addClass("active"),b=(p=d=v,g=t(p),u=g.html(),g.parent().append('<li id="ez-toc-height-test" class="active">'+u+"</li>"),z=t("#ez-toc-height-test"),$=z.height(),z.remove(),$-g.children("ul").first().height()),t("#ez-toc-active-height").remove(),t('<style id="ez-toc-active-height">.ez-toc-widget-container ul.ez-toc-list li.active {height:'+b+"px;} </style>").appendTo("head")}}function d(){l.length>0&&t(".ez-toc-widget-container").length&&t(window).on("load resize scroll",f)}function v(){t(window).off("load resize scroll",f)}d()}ezTOC.init=function(){e()},e()}});
1
+ jQuery(function(t){if("undefined"!=typeof ezTOC){function e(){if(0!==t(".ez-toc-widget-container.ez-toc-affix").length){var e=30;void 0!==ezTOC.scroll_offset&&(e=parseInt(ezTOC.scroll_offset)),t(ezTOC.affixSelector).stick_in_parent({inner_scrolling:!1,offset_top:e})}if(t.fn.shrinkTOCWidth=function(){t(this).css({width:"auto",display:"table"}),/MSIE 7\./.test(navigator.userAgent)&&t(this).css("width","")},void 0!==ezTOC.visibility_hide_by_default){var i=t("a.ez-toc-toggle"),o=ezTOC.visibility_hide_by_default;t.each(i,function(e,i){var s=t(this),a=t(s).parents("#ez-toc-container,#ez-toc-widget-container").find("ul.ez-toc-list");Cookies?(1==Cookies.get("ezTOC_hidetoc-"+e)?t(s).data("visible",!1):t(s).data("visible",!0),Cookies.remove("ezTOC_hidetoc-"+e)):(t(s).data("visible",!0),Cookies.remove("ezTOC_hidetoc-"+e)),o&&t(s).data("visible",!1),t(s).data("visible")||a.hide(),t(s).on("click",function(i){i.preventDefault();let s=document.querySelector("#ez-toc-container");if(s)s.classList.toggle("toc_close");else{let c=document.querySelector(".ez-toc-widget-container");c.classList.toggle("toc_close")}t(this).data("visible")?(t(this).data("visible",!1),Cookies&&(o?Cookies.set("ezTOC_hidetoc-"+e,null,{path:"/"}):Cookies.set("ezTOC_hidetoc-"+e,"1",{expires:30,path:"/"})),a.hide("fast")):(t(this).data("visible",!0),Cookies&&(o?Cookies.set("ezTOC_hidetoc-"+e,"1",{expires:30,path:"/"}):Cookies.set("ezTOC_hidetoc-"+e,null,{path:"/"})),a.show("fast"))})})}var s,a,c,l=t("span.ez-toc-section").toArray(),n=(s=l,s.reduce(function(e,i){var o;return e[i.id]=t('.ez-toc-widget-container .ez-toc-list a[href="#'+t(o=i).attr("id")+'"]'),e},{})),r=t.map(n,function(t,e){return t}),h=(a=5,void 0!==ezTOC.smooth_scroll&&1===parseInt(ezTOC.smooth_scroll)&&(a=void 0!==ezTOC.scroll_offset?parseInt(ezTOC.scroll_offset):30),c=t("#wpadminbar"),c.length&&(a+=c.height()),a);function d(){var e,i,o,s,a,c=(e=h,i=l,o=t(window).scrollTop()+e+1,s=i[0],a=o-t(s).offset().top,i.forEach(function(e){var i=o-t(e).offset().top;i>0&&i<a&&(a=i,s=e)}),s);if(c){var d,f,v,u,g,p,z,$,b,C=n[c.id];(function t(e,i){i.forEach(function(t){e!==t&&t.parent().hasClass("active")&&t.parent().removeClass("active")})})(C,r),(v=(d=C).parent()).hasClass("active")||v.addClass("active"),b=(u=f=v,g=t(u),p=g.html(),g.parent().append('<li id="ez-toc-height-test" class="active">'+p+"</li>"),z=t("#ez-toc-height-test"),$=z.height(),z.remove(),$-g.children("ul").first().height()),t("#ez-toc-active-height").remove(),t('<style id="ez-toc-active-height">.ez-toc-widget-container ul.ez-toc-list li.active {height:'+b+"px;} </style>").appendTo("head")}}function f(){t(window).off("load resize scroll",d)}l.length>0&&t(".ez-toc-widget-container").length&&t(window).on("load resize scroll",d)}ezTOC.init=function(){e()},e()}});
easy-table-of-contents.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Easy Table of Contents
4
  * Plugin URI: https://tocwp.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: 2.0.39
7
  * Author: Magazine3
8
  * Author URI: https://tocwp.com/
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.39
30
  */
31
 
32
  use Easy_Plugins\Table_Of_Contents\Debug;
@@ -49,7 +49,7 @@ if ( ! class_exists( 'ezTOC' ) ) {
49
  * @since 1.0
50
  * @var string
51
  */
52
- const VERSION = '2.0.39';
53
 
54
  /**
55
  * Stores the instance of this class.
@@ -158,7 +158,9 @@ if ( ! class_exists( 'ezTOC' ) ) {
158
  }
159
 
160
  add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueueScripts' ) );
161
- add_action( 'wp_head', array( __CLASS__, 'inlineMainCountingCSS' ) );
 
 
162
  add_action('admin_head', array( __CLASS__, 'addEditorButton' ));
163
 
164
  if( !self::checkBeaverBuilderPluginActive() ) {
@@ -172,6 +174,23 @@ if ( ! class_exists( 'ezTOC' ) ) {
172
 
173
  }
174
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  /**
176
  * checkBeaverBuilderPluginActive Method
177
  * @since 2.0.34
@@ -261,15 +280,13 @@ if ( ! class_exists( 'ezTOC' ) ) {
261
  return false;
262
  }
263
 
264
- // wp_register_style( 'ez-icomoon', EZ_TOC_URL . "vendor/icomoon/style$min.css", array(), ezTOC::VERSION );
265
  if (!ezTOC_Option::get( 'inline_css' )) {
266
  wp_register_style( 'ez-toc', EZ_TOC_URL . "assets/css/screen$min.css",
267
- // array( 'ez-icomoon' ),
268
  ezTOC::VERSION );
269
  }
270
  if ( 'css' != ezTOC_Option::get( 'toc_loading' ) ) {
271
  wp_register_script( 'ez-toc-js-cookie', EZ_TOC_URL . "vendor/js-cookie/js.cookie$min.js", array(), '2.2.1', TRUE );
272
- wp_register_script( 'ez-toc-jquery-smooth-scroll', EZ_TOC_URL . "vendor/smooth-scroll/jquery.smooth-scroll$min.js", array( 'jquery' ), '2.2.0', TRUE );
273
  }
274
  wp_register_script( 'ez-toc-jquery-sticky-kit', EZ_TOC_URL . "vendor/sticky-kit/jquery.sticky-kit$min.js", array( 'jquery' ), '1.9.2', TRUE );
275
 
@@ -277,7 +294,7 @@ if ( ! class_exists( 'ezTOC' ) ) {
277
  wp_register_script(
278
  'ez-toc-js',
279
  EZ_TOC_URL . "assets/js/front{$min}.js",
280
- array( 'ez-toc-jquery-smooth-scroll', 'ez-toc-js-cookie', 'ez-toc-jquery-sticky-kit' ),
281
  ezTOC::VERSION . '-' . filemtime( EZ_TOC_PATH . "/assets/js/front{$min}.js" ),
282
  true
283
  );
@@ -287,19 +304,24 @@ if ( ! class_exists( 'ezTOC' ) ) {
287
 
288
  wp_enqueue_style( 'ez-toc' );
289
  self::inlineCSS();
 
 
 
 
290
  }
 
291
 
292
  if ( ezTOC_Option::get( 'sticky-toggle' ) ) {
293
  wp_register_style(
294
  'ez-toc-sticky',
295
  EZ_TOC_URL . "assets/css/ez-toc-sticky{$min}.css",
296
- // array( 'ez-icomoon' ),
297
  self::VERSION
298
  );
299
  wp_enqueue_style( 'ez-toc-sticky' );
300
  self::inlineStickyToggleCSS();
301
  wp_register_script( 'ez-toc-sticky', '', array(), '', true );
302
- wp_enqueue_script( 'ez-toc-sticky', '', '','', true );
303
  self::inlineStickyToggleJS();
304
  }
305
 
@@ -340,8 +362,31 @@ if ( ! class_exists( 'ezTOC' ) ) {
340
  if ( in_array( 'js_composer/js_composer.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
341
  self::inlineWPBakeryJS();
342
  }
 
 
343
  }
344
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  /**
346
  * inlineWPBakeryJS Method
347
  * Javascript code for WP Bakery Plugin issue for mobile screen
@@ -444,6 +489,8 @@ INLINEWPBAKERYJS;
444
  $css .= 'div#ez-toc-container ul.ez-toc-list a:hover {color: ' . ezTOC_Option::get( 'custom_link_hover_colour' ) . ';}';
445
  $css .= 'div#ez-toc-container ul.ez-toc-list a:visited {color: ' . ezTOC_Option::get( 'custom_link_visited_colour' ) . ';}';
446
  }
 
 
447
  }
448
 
449
  if ( $css ) {
@@ -454,16 +501,16 @@ INLINEWPBAKERYJS;
454
 
455
  }
456
 
457
- /**
458
  * inlineMainCountingCSS Method
459
  * for adding inlineCounting CSS
460
  * in wp_head in last
461
- * @since 2.0.37
462
- * @return void
463
  */
464
- public static function inlineMainCountingCSS() {
465
- $css = '';
466
- /**
467
  * RTL Direction
468
  * @since 2.0.33
469
  */
@@ -471,12 +518,15 @@ INLINEWPBAKERYJS;
471
  $css .= self::InlineCountingCSS( ezTOC_Option::get( 'heading-text-direction', 'ltr' ),'ez-toc-widget-direction','ez-toc-widget-container', 'counter', 'ez-toc-widget-container' );
472
 
473
  if( ezTOC_Option::get( 'sticky-toggle' ) ) {
474
- $css .= self::InlineCountingCSS( ezTOC_Option::get( 'heading-text-direction', 'ltr' ), 'ez-toc-sticky-toggle-direction', 'ez-toc-sticky-toggle-counter', 'counter', 'ez-toc-sticky-container' );
 
475
  }
476
  /* End rtl direction */
477
 
478
- echo "<style>$css</style>";
479
- }
 
 
480
 
481
  /**
482
  * InlineCountingCSS Method
@@ -494,7 +544,6 @@ INLINEWPBAKERYJS;
494
  {
495
  $list_type = ezTOC_Option::get( $counter, 'decimal' );
496
  if( $list_type != 'none' ) {
497
- wp_enqueue_style( 'ez-toc' );
498
  $inlineCSS = '';
499
  $counterListAll = array_merge( ezTOC_Option::getCounterListDecimal(), ezTOC_Option::getCounterList_i18n() );
500
  $listTypesForCounting = array_keys( $counterListAll );
@@ -545,8 +594,7 @@ INLINECSS;
545
  INLINECSS;
546
 
547
  }
548
- // wp_add_inline_style( 'ez-toc', $inlineCSS );
549
- return $inlineCSS;
550
  }
551
  }
552
 
3
  * Plugin Name: Easy Table of Contents
4
  * Plugin URI: https://tocwp.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: 2.0.40
7
  * Author: Magazine3
8
  * Author URI: https://tocwp.com/
9
  * Text Domain: easy-table-of-contents
26
  * @package Easy Table of Contents
27
  * @category Plugin
28
  * @author Magazine3
29
+ * @version 2.0.40
30
  */
31
 
32
  use Easy_Plugins\Table_Of_Contents\Debug;
49
  * @since 1.0
50
  * @var string
51
  */
52
+ const VERSION = '2.0.40';
53
 
54
  /**
55
  * Stores the instance of this class.
158
  }
159
 
160
  add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueueScripts' ) );
161
+ if ( ezTOC_Option::get( 'exclude_css' ) && 'css' == ezTOC_Option::get( 'toc_loading' ) ) {
162
+ add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueueScriptsforExcludeCSS' ) );
163
+ }
164
  add_action('admin_head', array( __CLASS__, 'addEditorButton' ));
165
 
166
  if( !self::checkBeaverBuilderPluginActive() ) {
174
 
175
  }
176
 
177
+
178
+ /**
179
+ * enqueueScriptsforExcludeCSS Method
180
+ * for adding toggle css on loading as CSS
181
+ * @access public
182
+ * @since 2.0.40
183
+ * @static
184
+ */
185
+ public static function enqueueScriptsforExcludeCSS()
186
+ {
187
+
188
+ $cssChecked = '#ez-toc-container input[type="checkbox"]:checked + nav, #ez-toc-widget-container input[type="checkbox"]:checked + nav {opacity: 0;max-height: 0;border: none;display: none;}';
189
+ wp_register_style( 'ez-toc-exclude-toggle-css', '', array(), ezTOC::VERSION );
190
+ wp_enqueue_style( 'ez-toc-exclude-toggle-css', '', array(), ezTOC::VERSION );
191
+ wp_add_inline_style( 'ez-toc-exclude-toggle-css', $cssChecked );
192
+ }
193
+
194
  /**
195
  * checkBeaverBuilderPluginActive Method
196
  * @since 2.0.34
280
  return false;
281
  }
282
 
 
283
  if (!ezTOC_Option::get( 'inline_css' )) {
284
  wp_register_style( 'ez-toc', EZ_TOC_URL . "assets/css/screen$min.css",
285
+ array( ),
286
  ezTOC::VERSION );
287
  }
288
  if ( 'css' != ezTOC_Option::get( 'toc_loading' ) ) {
289
  wp_register_script( 'ez-toc-js-cookie', EZ_TOC_URL . "vendor/js-cookie/js.cookie$min.js", array(), '2.2.1', TRUE );
 
290
  }
291
  wp_register_script( 'ez-toc-jquery-sticky-kit', EZ_TOC_URL . "vendor/sticky-kit/jquery.sticky-kit$min.js", array( 'jquery' ), '1.9.2', TRUE );
292
 
294
  wp_register_script(
295
  'ez-toc-js',
296
  EZ_TOC_URL . "assets/js/front{$min}.js",
297
+ array( 'ez-toc-js-cookie', 'ez-toc-jquery-sticky-kit' ),
298
  ezTOC::VERSION . '-' . filemtime( EZ_TOC_PATH . "/assets/js/front{$min}.js" ),
299
  true
300
  );
304
 
305
  wp_enqueue_style( 'ez-toc' );
306
  self::inlineCSS();
307
+ if ( ezTOC_Option::get( 'smooth_scroll' ) ) {
308
+ self::inlineScrollCSS();
309
+ }
310
+
311
  }
312
+
313
 
314
  if ( ezTOC_Option::get( 'sticky-toggle' ) ) {
315
  wp_register_style(
316
  'ez-toc-sticky',
317
  EZ_TOC_URL . "assets/css/ez-toc-sticky{$min}.css",
318
+ array( ),
319
  self::VERSION
320
  );
321
  wp_enqueue_style( 'ez-toc-sticky' );
322
  self::inlineStickyToggleCSS();
323
  wp_register_script( 'ez-toc-sticky', '', array(), '', true );
324
+ wp_enqueue_script( 'ez-toc-sticky', '', '', '', true );
325
  self::inlineStickyToggleJS();
326
  }
327
 
362
  if ( in_array( 'js_composer/js_composer.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
363
  self::inlineWPBakeryJS();
364
  }
365
+
366
+ self::inlineMainCountingCSS();
367
  }
368
+
369
+ /**
370
+ * inlineScrollCSS Method
371
+ * Set scroll offset & smoothness
372
+ *
373
+ * @since 2.0.40
374
+ * @static
375
+ * @uses wp_add_inline_style()
376
+ * @return void
377
+ *
378
+ */
379
+ private static function inlineScrollCSS()
380
+ {
381
+
382
+ $offset = wp_is_mobile() ? ezTOC_Option::get( 'mobile_smooth_scroll_offset', 0 ) : ezTOC_Option::get( 'smooth_scroll_offset', 30 );
383
+ $offset .= 'px';
384
+ $inlineScrollCSS = <<<INLINESCROLLCSS
385
+ html, body{ scroll-behavior: smooth; } span.ez-toc-section{ scroll-margin-top: $offset;}
386
+ INLINESCROLLCSS;
387
+ wp_add_inline_style( 'ez-toc', $inlineScrollCSS );
388
+ }
389
+
390
  /**
391
  * inlineWPBakeryJS Method
392
  * Javascript code for WP Bakery Plugin issue for mobile screen
489
  $css .= 'div#ez-toc-container ul.ez-toc-list a:hover {color: ' . ezTOC_Option::get( 'custom_link_hover_colour' ) . ';}';
490
  $css .= 'div#ez-toc-container ul.ez-toc-list a:visited {color: ' . ezTOC_Option::get( 'custom_link_visited_colour' ) . ';}';
491
  }
492
+
493
+
494
  }
495
 
496
  if ( $css ) {
501
 
502
  }
503
 
504
+ /**
505
  * inlineMainCountingCSS Method
506
  * for adding inlineCounting CSS
507
  * in wp_head in last
508
+ * @since 2.0.37
509
+ * @return void
510
  */
511
+ public static function inlineMainCountingCSS() {
512
+ $css = '';
513
+ /**
514
  * RTL Direction
515
  * @since 2.0.33
516
  */
518
  $css .= self::InlineCountingCSS( ezTOC_Option::get( 'heading-text-direction', 'ltr' ),'ez-toc-widget-direction','ez-toc-widget-container', 'counter', 'ez-toc-widget-container' );
519
 
520
  if( ezTOC_Option::get( 'sticky-toggle' ) ) {
521
+ $cssSticky = self::InlineCountingCSS( ezTOC_Option::get( 'heading-text-direction', 'ltr' ), 'ez-toc-sticky-toggle-direction', 'ez-toc-sticky-toggle-counter', 'counter', 'ez-toc-sticky-container' );
522
+ wp_add_inline_style( 'ez-toc-sticky', $cssSticky );
523
  }
524
  /* End rtl direction */
525
 
526
+ if ( ! ezTOC_Option::get( 'exclude_css' ) ) {
527
+ wp_add_inline_style( 'ez-toc', $css );
528
+ }
529
+ }
530
 
531
  /**
532
  * InlineCountingCSS Method
544
  {
545
  $list_type = ezTOC_Option::get( $counter, 'decimal' );
546
  if( $list_type != 'none' ) {
 
547
  $inlineCSS = '';
548
  $counterListAll = array_merge( ezTOC_Option::getCounterListDecimal(), ezTOC_Option::getCounterList_i18n() );
549
  $listTypesForCounting = array_keys( $counterListAll );
594
  INLINECSS;
595
 
596
  }
597
+ return $inlineCSS;
 
598
  }
599
  }
600
 
includes/class.post.php CHANGED
@@ -1292,19 +1292,25 @@ class ezTOC_Post {
1292
 
1293
  if ( ezTOC_Option::get( 'visibility' ) ) {
1294
  $cssIconID = uniqid();
 
 
 
 
 
1295
  if (ezTOC_Option::get( 'toc_loading' ) != 'css') {
1296
  $icon = ezTOC::getTOCToggleIcon();
1297
  if( function_exists( 'ez_toc_pro_activation_link' ) ) {
1298
  $icon = apply_filters('ez_toc_modify_icon',$icon);
1299
  }
1300
 
1301
- $html .= '<a href="#" class="ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle" area-label="ez-toc-toggle-icon-1"><label for="item-' . $cssIconID . '" aria-label="'.__( 'Table of Content', 'easy-table-of-contents' ).'">'.$icon.'</label><input type="checkbox" id="item-' . $cssIconID . '"></a>';
 
1302
  } else {
1303
  $toggle_view='';
1304
  if(ezTOC_Option::get('visibility_hide_by_default')==true){
1305
  $toggle_view= "checked";
1306
  }
1307
- $html .= '<label for="ez-toc-cssicon-toggle-item-' . $cssIconID . '" class="cssicon">' . ezTOC::getTOCToggleIcon() . '</label><label for="ez-toc-cssicon-toggle-item-' . $cssIconID . '" class="cssiconcheckbox">1</label><input type="checkbox" id="ez-toc-cssicon-toggle-item-' . $cssIconID . '" '.$toggle_view.'>';
1308
  }
1309
  }
1310
 
@@ -1333,7 +1339,7 @@ class ezTOC_Post {
1333
 
1334
  return $html;
1335
  }
1336
-
1337
  /**
1338
  * Displays the post's TOC.
1339
  *
1292
 
1293
  if ( ezTOC_Option::get( 'visibility' ) ) {
1294
  $cssIconID = uniqid();
1295
+
1296
+ $inputCheckboxExludeStyle = "";
1297
+ if ( ezTOC_Option::get( 'exclude_css' ) ) {
1298
+ $inputCheckboxExludeStyle = "style='display:none'";
1299
+ }
1300
  if (ezTOC_Option::get( 'toc_loading' ) != 'css') {
1301
  $icon = ezTOC::getTOCToggleIcon();
1302
  if( function_exists( 'ez_toc_pro_activation_link' ) ) {
1303
  $icon = apply_filters('ez_toc_modify_icon',$icon);
1304
  }
1305
 
1306
+
1307
+ $html .= '<a href="#" class="ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle" area-label="ez-toc-toggle-icon-1"><label for="item-' . $cssIconID . '" aria-label="'.__( 'Table of Content', 'easy-table-of-contents' ).'">'.$icon.'</label><input ' . $inputCheckboxExludeStyle . ' type="checkbox" id="item-' . $cssIconID . '"></a>';
1308
  } else {
1309
  $toggle_view='';
1310
  if(ezTOC_Option::get('visibility_hide_by_default')==true){
1311
  $toggle_view= "checked";
1312
  }
1313
+ $html .= '<label for="ez-toc-cssicon-toggle-item-' . $cssIconID . '" class="cssicon">' . ezTOC::getTOCToggleIcon() . '</label><label for="ez-toc-cssicon-toggle-item-' . $cssIconID . '" ' . $inputCheckboxExludeStyle . ' class="cssiconcheckbox">1</label><input type="checkbox" ' . $inputCheckboxExludeStyle . ' id="ez-toc-cssicon-toggle-item-' . $cssIconID . '" '.$toggle_view.'>';
1314
  }
1315
  }
1316
 
1339
 
1340
  return $html;
1341
  }
1342
+
1343
  /**
1344
  * Displays the post's TOC.
1345
  *
vendor/smooth-scroll/jquery.smooth-scroll.js DELETED
@@ -1,338 +0,0 @@
1
- (function($) {
2
- var version = '2.2.0';
3
- var optionOverrides = {};
4
- var defaults = {
5
- exclude: [],
6
- excludeWithin: [],
7
- offset: 0,
8
-
9
- // one of 'top' or 'left'
10
- direction: 'top',
11
-
12
- // if set, bind click events through delegation
13
- // supported since jQuery 1.4.2
14
- delegateSelector: null,
15
-
16
- // jQuery set of elements you wish to scroll (for $.smoothScroll).
17
- // if null (default), $('html, body').firstScrollable() is used.
18
- scrollElement: null,
19
-
20
- // only use if you want to override default behavior
21
- scrollTarget: null,
22
-
23
- // automatically focus the target element after scrolling to it
24
- autoFocus: false,
25
-
26
- // fn(opts) function to be called before scrolling occurs.
27
- // `this` is the element(s) being scrolled
28
- beforeScroll: function() {},
29
-
30
- // fn(opts) function to be called after scrolling occurs.
31
- // `this` is the triggering element
32
- afterScroll: function() {},
33
-
34
- // easing name. jQuery comes with "swing" and "linear." For others, you'll need an easing plugin
35
- // from jQuery UI or elsewhere
36
- easing: 'swing',
37
-
38
- // speed can be a number or 'auto'
39
- // if 'auto', the speed will be calculated based on the formula:
40
- // (current scroll position - target scroll position) / autoCoeffic
41
- speed: 400,
42
-
43
- // coefficient for "auto" speed
44
- autoCoefficient: 2,
45
-
46
- // $.fn.smoothScroll only: whether to prevent the default click action
47
- preventDefault: true
48
- };
49
-
50
- var getScrollable = function(opts) {
51
- var scrollable = [];
52
- var scrolled = false;
53
- var dir = opts.dir && opts.dir === 'left' ? 'scrollLeft' : 'scrollTop';
54
-
55
- this.each(function() {
56
- var el = $(this);
57
-
58
- if (this === document || this === window) {
59
- return;
60
- }
61
-
62
- if (document.scrollingElement && (this === document.documentElement || this === document.body)) {
63
- scrollable.push(document.scrollingElement);
64
-
65
- return false;
66
- }
67
-
68
- if (el[dir]() > 0) {
69
- scrollable.push(this);
70
- } else {
71
- // if scroll(Top|Left) === 0, nudge the element 1px and see if it moves
72
- el[dir](1);
73
- scrolled = el[dir]() > 0;
74
-
75
- if (scrolled) {
76
- scrollable.push(this);
77
- }
78
- // then put it back, of course
79
- el[dir](0);
80
- }
81
- });
82
-
83
- if (!scrollable.length) {
84
- this.each(function() {
85
- // If no scrollable elements and <html> has scroll-behavior:smooth because
86
- // "When this property is specified on the root element, it applies to the viewport instead."
87
- // and "The scroll-behavior property of the … body element is *not* propagated to the viewport."
88
- // → https://drafts.csswg.org/cssom-view/#propdef-scroll-behavior
89
- if (this === document.documentElement && $(this).css('scrollBehavior') === 'smooth') {
90
- scrollable = [this];
91
- }
92
-
93
- // If still no scrollable elements, fall back to <body>,
94
- // if it's in the jQuery collection
95
- // (doing this because Safari sets scrollTop async,
96
- // so can't set it to 1 and immediately get the value.)
97
- if (!scrollable.length && this.nodeName === 'BODY') {
98
- scrollable = [this];
99
- }
100
- });
101
- }
102
-
103
- // Use the first scrollable element if we're calling firstScrollable()
104
- if (opts.el === 'first' && scrollable.length > 1) {
105
- scrollable = [scrollable[0]];
106
- }
107
-
108
- return scrollable;
109
- };
110
-
111
- var rRelative = /^([\-\+]=)(\d+)/;
112
-
113
- $.fn.extend({
114
- scrollable: function(dir) {
115
- var scrl = getScrollable.call(this, {dir: dir});
116
-
117
- return this.pushStack(scrl);
118
- },
119
- firstScrollable: function(dir) {
120
- var scrl = getScrollable.call(this, {el: 'first', dir: dir});
121
-
122
- return this.pushStack(scrl);
123
- },
124
-
125
- smoothScroll: function(options, extra) {
126
- options = options || {};
127
-
128
- if (options === 'options') {
129
- if (!extra) {
130
- return this.first().data('ssOpts');
131
- }
132
-
133
- return this.each(function() {
134
- var $this = $(this);
135
- var opts = $.extend($this.data('ssOpts') || {}, extra);
136
-
137
- $(this).data('ssOpts', opts);
138
- });
139
- }
140
-
141
- var opts = $.extend({}, $.fn.smoothScroll.defaults, options);
142
-
143
- var clickHandler = function(event) {
144
- var escapeSelector = function(str) {
145
- return str.replace(/(:|\.|\/)/g, '\\$1');
146
- };
147
-
148
- var link = this;
149
- var $link = $(this);
150
- var thisOpts = $.extend({}, opts, $link.data('ssOpts') || {});
151
- var exclude = opts.exclude;
152
- var excludeWithin = thisOpts.excludeWithin;
153
- var elCounter = 0;
154
- var ewlCounter = 0;
155
- var include = true;
156
- var clickOpts = {};
157
- var locationPath = $.smoothScroll.filterPath(location.pathname);
158
- var linkPath = $.smoothScroll.filterPath(link.pathname);
159
- var hostMatch = location.hostname === link.hostname || !link.hostname;
160
- var pathMatch = thisOpts.scrollTarget || (linkPath === locationPath);
161
- var thisHash = escapeSelector(link.hash);
162
-
163
- if (thisHash && !$(thisHash).length) {
164
- include = false;
165
- }
166
-
167
- if (!thisOpts.scrollTarget && (!hostMatch || !pathMatch || !thisHash)) {
168
- include = false;
169
- } else {
170
- while (include && elCounter < exclude.length) {
171
- if ($link.is(escapeSelector(exclude[elCounter++]))) {
172
- include = false;
173
- }
174
- }
175
-
176
- while (include && ewlCounter < excludeWithin.length) {
177
- if ($link.closest(excludeWithin[ewlCounter++]).length) {
178
- include = false;
179
- }
180
- }
181
- }
182
-
183
- if (include) {
184
- if (thisOpts.preventDefault) {
185
- event.preventDefault();
186
- }
187
-
188
- $.extend(clickOpts, thisOpts, {
189
- scrollTarget: thisOpts.scrollTarget || thisHash,
190
- link: link
191
- });
192
-
193
- $.smoothScroll(clickOpts);
194
- }
195
- };
196
-
197
- if (options.delegateSelector !== null) {
198
- this
199
- .off('click.smoothscroll', options.delegateSelector)
200
- .on('click.smoothscroll', options.delegateSelector, clickHandler);
201
- } else {
202
- this
203
- .off('click.smoothscroll')
204
- .on('click.smoothscroll', clickHandler);
205
- }
206
-
207
- return this;
208
- }
209
- });
210
-
211
- var getExplicitOffset = function(val) {
212
- var explicit = {relative: ''};
213
- var parts = typeof val === 'string' && rRelative.exec(val);
214
-
215
- if (typeof val === 'number') {
216
- explicit.px = val;
217
- } else if (parts) {
218
- explicit.relative = parts[1];
219
- explicit.px = parseFloat(parts[2]) || 0;
220
- }
221
-
222
- return explicit;
223
- };
224
-
225
- var onAfterScroll = function(opts) {
226
- var $tgt = $(opts.scrollTarget);
227
-
228
- if (opts.autoFocus && $tgt.length) {
229
- $tgt[0].focus();
230
-
231
- if (!$tgt.is(document.activeElement)) {
232
- $tgt.prop({tabIndex: -1});
233
- $tgt[0].focus();
234
- }
235
- }
236
-
237
- opts.afterScroll.call(opts.link, opts);
238
- };
239
-
240
- $.smoothScroll = function(options, px) {
241
- if (options === 'options' && typeof px === 'object') {
242
- return $.extend(optionOverrides, px);
243
- }
244
- var opts, $scroller, speed, delta;
245
- var explicitOffset = getExplicitOffset(options);
246
- var scrollTargetOffset = {};
247
- var scrollerOffset = 0;
248
- var offPos = 'offset';
249
- var scrollDir = 'scrollTop';
250
- var aniProps = {};
251
- var aniOpts = {};
252
-
253
- if (explicitOffset.px) {
254
- opts = $.extend({link: null}, $.fn.smoothScroll.defaults, optionOverrides);
255
- } else {
256
- opts = $.extend({link: null}, $.fn.smoothScroll.defaults, options || {}, optionOverrides);
257
-
258
- if (opts.scrollElement) {
259
- offPos = 'position';
260
-
261
- if (opts.scrollElement.css('position') === 'static') {
262
- opts.scrollElement.css('position', 'relative');
263
- }
264
- }
265
-
266
- if (px) {
267
- explicitOffset = getExplicitOffset(px);
268
- }
269
- }
270
-
271
- scrollDir = opts.direction === 'left' ? 'scrollLeft' : scrollDir;
272
-
273
- if (opts.scrollElement) {
274
- $scroller = opts.scrollElement;
275
-
276
- if (!explicitOffset.px && !(/^(?:HTML|BODY)$/).test($scroller[0].nodeName)) {
277
- scrollerOffset = $scroller[scrollDir]();
278
- }
279
- } else {
280
- $scroller = $('html, body').firstScrollable(opts.direction);
281
- }
282
-
283
- // beforeScroll callback function must fire before calculating offset
284
- opts.beforeScroll.call($scroller, opts);
285
-
286
- scrollTargetOffset = explicitOffset.px ? explicitOffset : {
287
- relative: '',
288
- px: ($(opts.scrollTarget)[offPos]() && $(opts.scrollTarget)[offPos]()[opts.direction]) || 0
289
- };
290
-
291
- aniProps[scrollDir] = scrollTargetOffset.relative + (scrollTargetOffset.px + scrollerOffset + opts.offset);
292
-
293
- speed = opts.speed;
294
-
295
- // automatically calculate the speed of the scroll based on distance / coefficient
296
- if (speed === 'auto') {
297
-
298
- // $scroller[scrollDir]() is position before scroll, aniProps[scrollDir] is position after
299
- // When delta is greater, speed will be greater.
300
- delta = Math.abs(aniProps[scrollDir] - $scroller[scrollDir]());
301
-
302
- // Divide the delta by the coefficient
303
- speed = delta / opts.autoCoefficient;
304
- }
305
-
306
- aniOpts = {
307
- duration: speed,
308
- easing: opts.easing,
309
- complete: function() {
310
- onAfterScroll(opts);
311
- }
312
- };
313
-
314
- if (opts.step) {
315
- aniOpts.step = opts.step;
316
- }
317
-
318
- if ($scroller.length) {
319
- $scroller.stop().animate(aniProps, aniOpts);
320
- } else {
321
- onAfterScroll(opts);
322
- }
323
- };
324
-
325
- $.smoothScroll.version = version;
326
- $.smoothScroll.filterPath = function(string) {
327
- string = string || '';
328
-
329
- return string
330
- .replace(/^\//, '')
331
- .replace(/(?:index|default).[a-zA-Z]{3,4}$/, '')
332
- .replace(/\/$/, '');
333
- };
334
-
335
- // default options
336
- $.fn.smoothScroll.defaults = defaults;
337
-
338
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/smooth-scroll/jquery.smooth-scroll.min.js DELETED
@@ -1 +0,0 @@
1
- !function($){var version="2.2.0",optionOverrides={},defaults={exclude:[],excludeWithin:[],offset:0,direction:"top",delegateSelector:null,scrollElement:null,scrollTarget:null,autoFocus:!1,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficient:2,preventDefault:!0},getScrollable=function(opts){var scrollable=[],scrolled=!1,dir=opts.dir&&"left"===opts.dir?"scrollLeft":"scrollTop";return this.each((function(){var el=$(this);if(this!==document&&this!==window)return!document.scrollingElement||this!==document.documentElement&&this!==document.body?void(el[dir]()>0?scrollable.push(this):(el[dir](1),(scrolled=el[dir]()>0)&&scrollable.push(this),el[dir](0))):(scrollable.push(document.scrollingElement),!1)})),scrollable.length||this.each((function(){this===document.documentElement&&"smooth"===$(this).css("scrollBehavior")&&(scrollable=[this]),scrollable.length||"BODY"!==this.nodeName||(scrollable=[this])})),"first"===opts.el&&scrollable.length>1&&(scrollable=[scrollable[0]]),scrollable},rRelative=/^([\-\+]=)(\d+)/;$.fn.extend({scrollable:function(dir){var scrl=getScrollable.call(this,{dir:dir});return this.pushStack(scrl)},firstScrollable:function(dir){var scrl=getScrollable.call(this,{el:"first",dir:dir});return this.pushStack(scrl)},smoothScroll:function(options,extra){if("options"===(options=options||{}))return extra?this.each((function(){var $this=$(this),opts=$.extend($this.data("ssOpts")||{},extra);$(this).data("ssOpts",opts)})):this.first().data("ssOpts");var opts=$.extend({},$.fn.smoothScroll.defaults,options),clickHandler=function(event){var escapeSelector=function(str){return str.replace(/(:|\.|\/)/g,"\\$1")},link=this,$link=$(this),thisOpts=$.extend({},opts,$link.data("ssOpts")||{}),exclude=opts.exclude,excludeWithin=thisOpts.excludeWithin,elCounter=0,ewlCounter=0,include=!0,clickOpts={},locationPath=$.smoothScroll.filterPath(location.pathname),linkPath=$.smoothScroll.filterPath(this.pathname),hostMatch=location.hostname===this.hostname||!this.hostname,pathMatch=thisOpts.scrollTarget||linkPath===locationPath,thisHash=escapeSelector(this.hash);if(thisHash&&!$(thisHash).length&&(include=!1),thisOpts.scrollTarget||hostMatch&&pathMatch&&thisHash){for(;include&&elCounter<exclude.length;)$link.is(escapeSelector(exclude[elCounter++]))&&(include=!1);for(;include&&ewlCounter<excludeWithin.length;)$link.closest(excludeWithin[ewlCounter++]).length&&(include=!1)}else include=!1;include&&(thisOpts.preventDefault&&event.preventDefault(),$.extend(clickOpts,thisOpts,{scrollTarget:thisOpts.scrollTarget||thisHash,link:this}),$.smoothScroll(clickOpts))};return null!==options.delegateSelector?this.off("click.smoothscroll",options.delegateSelector).on("click.smoothscroll",options.delegateSelector,clickHandler):this.off("click.smoothscroll").on("click.smoothscroll",clickHandler),this}});var getExplicitOffset=function(val){var explicit={relative:""},parts="string"==typeof val&&rRelative.exec(val);return"number"==typeof val?explicit.px=val:parts&&(explicit.relative=parts[1],explicit.px=parseFloat(parts[2])||0),explicit},onAfterScroll=function(opts){var $tgt=$(opts.scrollTarget);opts.autoFocus&&$tgt.length&&($tgt[0].focus(),$tgt.is(document.activeElement)||($tgt.prop({tabIndex:-1}),$tgt[0].focus())),opts.afterScroll.call(opts.link,opts)};$.smoothScroll=function(options,px){if("options"===options&&"object"==typeof px)return $.extend(optionOverrides,px);var opts,$scroller,speed,delta,explicitOffset=getExplicitOffset(options),scrollTargetOffset={},scrollerOffset=0,offPos="offset",scrollDir="scrollTop",aniProps={},aniOpts={};explicitOffset.px?opts=$.extend({link:null},$.fn.smoothScroll.defaults,optionOverrides):((opts=$.extend({link:null},$.fn.smoothScroll.defaults,options||{},optionOverrides)).scrollElement&&(offPos="position","static"===opts.scrollElement.css("position")&&opts.scrollElement.css("position","relative")),px&&(explicitOffset=getExplicitOffset(px))),scrollDir="left"===opts.direction?"scrollLeft":scrollDir,opts.scrollElement?($scroller=opts.scrollElement,explicitOffset.px||/^(?:HTML|BODY)$/.test($scroller[0].nodeName)||(scrollerOffset=$scroller[scrollDir]())):$scroller=$("html, body").firstScrollable(opts.direction),opts.beforeScroll.call($scroller,opts),scrollTargetOffset=explicitOffset.px?explicitOffset:{relative:"",px:$(opts.scrollTarget)[offPos]()&&$(opts.scrollTarget)[offPos]()[opts.direction]||0},aniProps[scrollDir]=scrollTargetOffset.relative+(scrollTargetOffset.px+scrollerOffset+opts.offset),"auto"===(speed=opts.speed)&&(speed=(delta=Math.abs(aniProps[scrollDir]-$scroller[scrollDir]()))/opts.autoCoefficient),aniOpts={duration:speed,easing:opts.easing,complete:function(){onAfterScroll(opts)}},opts.step&&(aniOpts.step=opts.step),$scroller.length?$scroller.stop().animate(aniProps,aniOpts):onAfterScroll(opts)},$.smoothScroll.version="2.2.0",$.smoothScroll.filterPath=function(string){return(string=string||"").replace(/^\//,"").replace(/(?:index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},$.fn.smoothScroll.defaults=defaults}(jQuery);