The SEO Framework - Version 4.1.3

Version Description

Before heading into 2021, we wanted to set free four bugs.

Pro tip: If you can no longer switch TSF's settings tabs, try hitting 'CMD+SHIFT+R' (Mac) or 'CTRL+SHIFT+R' (Windows); these keyboard shortcuts will force-fetch the latest scripts from your server.

Download this release

Release Info

Developer Cybr
Plugin Icon 128x128 The SEO Framework
Version 4.1.3
Comparing to
See all releases

Code changes from version 4.1.2 to 4.1.3

autodescription.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: The SEO Framework
4
  * Plugin URI: https://theseoframework.com/
5
  * Description: An automated, advanced, accessible, unbranded and extremely fast SEO solution for your WordPress website.
6
- * Version: 4.1.2
7
  * Author: The SEO Framework Team
8
  * Author URI: https://theseoframework.com/
9
  * License: GPLv3
@@ -46,7 +46,7 @@ defined( 'ABSPATH' ) or die;
46
  *
47
  * @since 2.3.5
48
  */
49
- define( 'THE_SEO_FRAMEWORK_VERSION', '4.1.2' );
50
 
51
  /**
52
  * The plugin Database version.
3
  * Plugin Name: The SEO Framework
4
  * Plugin URI: https://theseoframework.com/
5
  * Description: An automated, advanced, accessible, unbranded and extremely fast SEO solution for your WordPress website.
6
+ * Version: 4.1.3
7
  * Author: The SEO Framework Team
8
  * Author URI: https://theseoframework.com/
9
  * License: GPLv3
46
  *
47
  * @since 2.3.5
48
  */
49
+ define( 'THE_SEO_FRAMEWORK_VERSION', '4.1.3' );
50
 
51
  /**
52
  * The plugin Database version.
inc/classes/admin-init.class.php CHANGED
@@ -445,6 +445,7 @@ class Admin_Init extends Init {
445
  * Registers dismissible persistent notice, that'll respawn during page load until dismissed or otherwise expired.
446
  *
447
  * @since 4.1.0
 
448
  * @uses $this->generate_dismissible_persistent_notice()
449
  *
450
  * @param string $message The notice message. Expected to be escaped if $escape is false.
@@ -465,6 +466,8 @@ class Admin_Init extends Init {
465
  * 'count' => int Optional. The number of times the persistent notice may appear (for everyone allowed to see it).
466
  * Set to -1 for unlimited. When -1, the notice must be removed from display manually.
467
  * 'timeout' => int Optional. The number of seconds the notice should remain valid for display. Set to -1 to disable check.
 
 
468
  * }
469
  */
470
  public function register_dismissible_persistent_notice( $message, $key, array $args = [], array $conditions = [] ) {
@@ -499,6 +502,9 @@ class Admin_Init extends Init {
499
  // Required key for security.
500
  if ( ! $conditions['capability'] ) return;
501
 
 
 
 
502
  // Add current time to timeout, so we can compare against it later.
503
  if ( $conditions['timeout'] > -1 )
504
  $conditions['timeout'] += time();
445
  * Registers dismissible persistent notice, that'll respawn during page load until dismissed or otherwise expired.
446
  *
447
  * @since 4.1.0
448
+ * @since 4.1.3 Now handles timeout values below -1 gracefully, by purging the whole notification gracelessly.
449
  * @uses $this->generate_dismissible_persistent_notice()
450
  *
451
  * @param string $message The notice message. Expected to be escaped if $escape is false.
466
  * 'count' => int Optional. The number of times the persistent notice may appear (for everyone allowed to see it).
467
  * Set to -1 for unlimited. When -1, the notice must be removed from display manually.
468
  * 'timeout' => int Optional. The number of seconds the notice should remain valid for display. Set to -1 to disable check.
469
+ * When the timeout is below -1, then the notification will not be outputted.
470
+ * Do not input non-integer values (such as `false`), for those might cause adverse events.
471
  * }
472
  */
473
  public function register_dismissible_persistent_notice( $message, $key, array $args = [], array $conditions = [] ) {
502
  // Required key for security.
503
  if ( ! $conditions['capability'] ) return;
504
 
505
+ // Timeout already expired. Let's not register it.
506
+ if ( $conditions['timeout'] < -1 ) return;
507
+
508
  // Add current time to timeout, so we can compare against it later.
509
  if ( $conditions['timeout'] > -1 )
510
  $conditions['timeout'] += time();
inc/classes/admin-pages.class.php CHANGED
@@ -444,6 +444,7 @@ class Admin_Pages extends Profile {
444
  * Outputs registered dismissible persistent notice.
445
  *
446
  * @since 4.1.0
 
447
  * @uses $this->output_dismissible_persistent_notice()
448
  * @uses $this->count_down_persistent_notice()
449
  * @global string $page_hook
@@ -463,7 +464,7 @@ class Admin_Pages extends Profile {
463
  if ( $cond['screens'] && ! \in_array( $base, $cond['screens'], true ) ) continue;
464
  if ( $cond['excl_screens'] && \in_array( $base, $cond['excl_screens'], true ) ) continue;
465
 
466
- if ( $cond['timeout'] > -1 && $cond['timeout'] < time() ) {
467
  $this->clear_persistent_notice( $key );
468
  continue;
469
  }
444
  * Outputs registered dismissible persistent notice.
445
  *
446
  * @since 4.1.0
447
+ * @since 4.1.2 Now only ignores timeout values of -1 to test against.
448
  * @uses $this->output_dismissible_persistent_notice()
449
  * @uses $this->count_down_persistent_notice()
450
  * @global string $page_hook
464
  if ( $cond['screens'] && ! \in_array( $base, $cond['screens'], true ) ) continue;
465
  if ( $cond['excl_screens'] && \in_array( $base, $cond['excl_screens'], true ) ) continue;
466
 
467
+ if ( -1 !== $cond['timeout'] && $cond['timeout'] < time() ) {
468
  $this->clear_persistent_notice( $key );
469
  continue;
470
  }
inc/classes/bridges/listtable.class.php CHANGED
@@ -124,6 +124,7 @@ abstract class ListTable {
124
  $post_type = stripslashes( $_POST['post_type'] );
125
  $pto = $post_type ? \get_post_type_object( $post_type ) : false;
126
 
 
127
  if ( $pto && \current_user_can( 'edit_' . $pto->capability_type, (int) $_POST['post_ID'] ) )
128
  $this->init_columns_ajax();
129
  }
124
  $post_type = stripslashes( $_POST['post_type'] );
125
  $pto = $post_type ? \get_post_type_object( $post_type ) : false;
126
 
127
+ // TODO shouldn't we just use `edit_post`? See _output_column_contents_for_post && get_post_type_capabilities
128
  if ( $pto && \current_user_can( 'edit_' . $pto->capability_type, (int) $_POST['post_ID'] ) )
129
  $this->init_columns_ajax();
130
  }
inc/classes/bridges/scripts.class.php CHANGED
@@ -107,6 +107,7 @@ final class Scripts {
107
  static::prepare_media_scripts();
108
 
109
  $_scripts[] = static::get_post_edit_scripts();
 
110
  $_scripts[] = static::get_media_scripts();
111
  $_scripts[] = static::get_title_scripts();
112
  $_scripts[] = static::get_description_scripts();
@@ -143,6 +144,7 @@ final class Scripts {
143
  static::prepare_metabox_scripts();
144
 
145
  $_scripts[] = static::get_seo_settings_scripts();
 
146
  $_scripts[] = static::get_media_scripts();
147
  $_scripts[] = static::get_title_scripts();
148
  $_scripts[] = static::get_description_scripts();
@@ -413,7 +415,7 @@ final class Scripts {
413
  [
414
  'id' => 'tsf-settings',
415
  'type' => 'js',
416
- 'deps' => [ 'jquery', 'tsf-ays', 'tsf-title', 'tsf-description', 'tsf', 'tsf-tt', 'wp-color-picker', 'wp-util' ],
417
  'autoload' => true,
418
  'name' => 'settings',
419
  'base' => THE_SEO_FRAMEWORK_DIR_URL . 'lib/js/',
@@ -471,7 +473,7 @@ final class Scripts {
471
  [
472
  'id' => 'tsf-post',
473
  'type' => 'js',
474
- 'deps' => [ 'jquery', 'tsf-ays', 'tsf-title', 'tsf-description', 'tsf-social', 'tsf-tt', 'tsf' ],
475
  'autoload' => true,
476
  'name' => 'post',
477
  'base' => THE_SEO_FRAMEWORK_DIR_URL . 'lib/js/',
@@ -590,6 +592,29 @@ final class Scripts {
590
  ];
591
  }
592
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
593
  /**
594
  * Returns Media scripts params.
595
  *
107
  static::prepare_media_scripts();
108
 
109
  $_scripts[] = static::get_post_edit_scripts();
110
+ $_scripts[] = static::get_tabs_scripts();
111
  $_scripts[] = static::get_media_scripts();
112
  $_scripts[] = static::get_title_scripts();
113
  $_scripts[] = static::get_description_scripts();
144
  static::prepare_metabox_scripts();
145
 
146
  $_scripts[] = static::get_seo_settings_scripts();
147
+ $_scripts[] = static::get_tabs_scripts();
148
  $_scripts[] = static::get_media_scripts();
149
  $_scripts[] = static::get_title_scripts();
150
  $_scripts[] = static::get_description_scripts();
415
  [
416
  'id' => 'tsf-settings',
417
  'type' => 'js',
418
+ 'deps' => [ 'jquery', 'tsf-ays', 'tsf-title', 'tsf-description', 'tsf', 'tsf-tabs', 'tsf-tt', 'wp-color-picker', 'wp-util' ],
419
  'autoload' => true,
420
  'name' => 'settings',
421
  'base' => THE_SEO_FRAMEWORK_DIR_URL . 'lib/js/',
473
  [
474
  'id' => 'tsf-post',
475
  'type' => 'js',
476
+ 'deps' => [ 'jquery', 'tsf-ays', 'tsf-title', 'tsf-description', 'tsf-social', 'tsf-tabs', 'tsf-tt', 'tsf' ],
477
  'autoload' => true,
478
  'name' => 'post',
479
  'base' => THE_SEO_FRAMEWORK_DIR_URL . 'lib/js/',
592
  ];
593
  }
594
 
595
+ /**
596
+ * Returns Tabs scripts params.
597
+ *
598
+ * @since 4.1.3
599
+ *
600
+ * @return array The script params.
601
+ */
602
+ public static function get_tabs_scripts() {
603
+ return [
604
+ 'id' => 'tsf-tabs',
605
+ 'type' => 'js',
606
+ 'deps' => [], // nada.
607
+ 'autoload' => true,
608
+ 'name' => 'tabs',
609
+ 'base' => THE_SEO_FRAMEWORK_DIR_URL . 'lib/js/',
610
+ 'ver' => THE_SEO_FRAMEWORK_VERSION,
611
+ 'l10n' => [
612
+ 'name' => 'tsfTabsL10n',
613
+ 'data' => [],
614
+ ],
615
+ ];
616
+ }
617
+
618
  /**
619
  * Returns Media scripts params.
620
  *
inc/classes/bridges/sitemap.class.php CHANGED
@@ -271,9 +271,12 @@ final class Sitemap {
271
  * @param int $timeout How many seconds the user has to wait. Optional. Leave 0 to send a generic message.
272
  */
273
  public function output_locked_header( $timeout = 0 ) {
 
274
  static::$tsf->clean_response_header();
 
275
  \status_header( 503 );
276
  \nocache_headers();
 
277
  if ( $timeout ) {
278
  printf(
279
  'Sitemap is locked for %d seconds. Try again later.',
@@ -282,6 +285,7 @@ final class Sitemap {
282
  } else {
283
  echo 'Sitemap is locked temporarily. Try again later.';
284
  }
 
285
  echo PHP_EOL;
286
  exit;
287
  }
@@ -427,6 +431,7 @@ final class Sitemap {
427
  * Outputs the sitemap header.
428
  *
429
  * @since 4.0.0
 
430
  */
431
  public function output_sitemap_header() {
432
 
@@ -434,7 +439,7 @@ final class Sitemap {
434
 
435
  if ( static::$tsf->get_option( 'sitemap_styles' ) ) {
436
  printf(
437
- '<?xml-stylesheet type="text/xsl" href="%s"?>',
438
  // phpcs:ignore, WordPress.Security.EscapeOutput
439
  $this->get_expected_sitemap_endpoint_url( 'xsl-stylesheet' )
440
  );
271
  * @param int $timeout How many seconds the user has to wait. Optional. Leave 0 to send a generic message.
272
  */
273
  public function output_locked_header( $timeout = 0 ) {
274
+
275
  static::$tsf->clean_response_header();
276
+
277
  \status_header( 503 );
278
  \nocache_headers();
279
+
280
  if ( $timeout ) {
281
  printf(
282
  'Sitemap is locked for %d seconds. Try again later.',
285
  } else {
286
  echo 'Sitemap is locked temporarily. Try again later.';
287
  }
288
+
289
  echo PHP_EOL;
290
  exit;
291
  }
431
  * Outputs the sitemap header.
432
  *
433
  * @since 4.0.0
434
+ * @since 4.1.3 Added a trailing newline to the stylesheet-tag for readability.
435
  */
436
  public function output_sitemap_header() {
437
 
439
 
440
  if ( static::$tsf->get_option( 'sitemap_styles' ) ) {
441
  printf(
442
+ '<?xml-stylesheet type="text/xsl" href="%s"?>' . "\n",
443
  // phpcs:ignore, WordPress.Security.EscapeOutput
444
  $this->get_expected_sitemap_endpoint_url( 'xsl-stylesheet' )
445
  );
inc/classes/cache.class.php CHANGED
@@ -113,6 +113,8 @@ class Cache extends Site_Options {
113
  *
114
  * @since 2.8.0
115
  * @since 3.0.0 Process is halted when no valid $post_id is supplied.
 
 
116
  *
117
  * @param int $post_id The Post ID that has been updated.
118
  * @return bool True on success, false on failure.
@@ -123,11 +125,9 @@ class Cache extends Site_Options {
123
 
124
  $success[] = $this->delete_cache( 'post', $post_id );
125
 
126
- if ( $this->get_option( 'sitemaps_output' ) ) {
127
- // Don't flush sitemap on revision.
128
- if ( ! \wp_is_post_revision( $post_id ) )
129
- $success[] = $this->delete_cache( 'sitemap' );
130
- }
131
 
132
  return ! \in_array( false, $success, true );
133
  }
@@ -826,10 +826,7 @@ class Cache extends Site_Options {
826
  */
827
  public function delete_sitemap_transient() {
828
 
829
- static $run = false;
830
-
831
- if ( $run )
832
- return false;
833
 
834
  $transient = $this->get_sitemap_transient_name();
835
  $transient and \delete_transient( $transient );
@@ -856,7 +853,7 @@ class Cache extends Site_Options {
856
  \The_SEO_Framework\Bridges\Ping::ping_search_engines();
857
  }
858
 
859
- return $run = true;
860
  }
861
 
862
  /**
113
  *
114
  * @since 2.8.0
115
  * @since 3.0.0 Process is halted when no valid $post_id is supplied.
116
+ * @since 4.1.3 Now flushes the sitemap cache (and instigates pinging thereof)
117
+ * even when TSF sitemaps are disabled.
118
  *
119
  * @param int $post_id The Post ID that has been updated.
120
  * @return bool True on success, false on failure.
125
 
126
  $success[] = $this->delete_cache( 'post', $post_id );
127
 
128
+ // Don't flush sitemap on revision.
129
+ if ( ! \wp_is_post_revision( $post_id ) )
130
+ $success[] = $this->delete_cache( 'sitemap' );
 
 
131
 
132
  return ! \in_array( false, $success, true );
133
  }
826
  */
827
  public function delete_sitemap_transient() {
828
 
829
+ if ( _has_run( __METHOD__ ) ) return false;
 
 
 
830
 
831
  $transient = $this->get_sitemap_transient_name();
832
  $transient and \delete_transient( $transient );
853
  \The_SEO_Framework\Bridges\Ping::ping_search_engines();
854
  }
855
 
856
+ return true;
857
  }
858
 
859
  /**
inc/classes/sanitize.class.php CHANGED
@@ -1390,6 +1390,7 @@ class Sanitize extends Admin_Pages {
1390
  *
1391
  * @since 2.2.8
1392
  * @since 2.8.0 Method is now public.
 
1393
  *
1394
  * @param string $new_value String, a URL, possibly unsafe.
1395
  * @return string String a safe URL with Query Arguments.
1390
  *
1391
  * @since 2.2.8
1392
  * @since 2.8.0 Method is now public.
1393
+ * @TODO rename to s_url_keep_query?
1394
  *
1395
  * @param string $new_value String, a URL, possibly unsafe.
1396
  * @return string String a safe URL with Query Arguments.
inc/functions/upgrade-suggestion.php CHANGED
@@ -55,7 +55,8 @@ _prepare( $previous_version, $current_version );
55
  * 3. Can now run on the front-end without crashing.
56
  * 4. Added the first two parameters, $previous_version and $current_version.
57
  * 5. Now tests if the upgrade actually happened, before invoking the suggestion.
58
- * @since 4.1.2 Can now communicate with Extension Manager.
 
59
  * @access private
60
  *
61
  * @param string $previous_version The previous version the site upgraded from, if any.
@@ -71,15 +72,17 @@ function _prepare( $previous_version, $current_version ) {
71
  //? 2
72
  if ( ! \is_main_site() ) return;
73
 
74
- $show_sale = true;
75
-
76
- if ( \function_exists( '\\tsf_extension_manager' ) && method_exists( \tsf_extension_manager(), 'is_connected_user' ) ) {
77
- $show_sale = ! \tsf_extension_manager()->is_connected_user();
78
- }
79
- if ( $show_sale ) {
80
- // phpcs:ignore, TSF.Performance.Opcodes.ShouldHaveNamespaceEscape
81
- _suggest_temp_sale( $previous_version, $current_version );
82
- }
 
 
83
 
84
  //? 3a
85
  if ( \defined( 'TSF_EXTENSION_MANAGER_VERSION' ) ) return;
55
  * 3. Can now run on the front-end without crashing.
56
  * 4. Added the first two parameters, $previous_version and $current_version.
57
  * 5. Now tests if the upgrade actually happened, before invoking the suggestion.
58
+ * @since 4.1.2 Can now communicate with Extension Manager for the edge-case sale.
59
+ * @since 4.1.3 Commented out sale notification conditions, as those can't be met anyway.
60
  * @access private
61
  *
62
  * @param string $previous_version The previous version the site upgraded from, if any.
72
  //? 2
73
  if ( ! \is_main_site() ) return;
74
 
75
+ // phpcs:disable, Squiz.PHP.CommentedOutCode, Squiz.Commenting.InlineComment
76
+ // $show_sale = true;
77
+
78
+ // if ( \function_exists( '\\tsf_extension_manager' ) && method_exists( \tsf_extension_manager(), 'is_connected_user' ) ) {
79
+ // $show_sale = ! \tsf_extension_manager()->is_connected_user();
80
+ // }
81
+ // if ( $show_sale ) {
82
+ // // phpcs:ignore, TSF.Performance.Opcodes.ShouldHaveNamespaceEscape
83
+ // _suggest_temp_sale( $previous_version, $current_version );
84
+ // }
85
+ // phpcs:enable, Squiz.PHP.CommentedOutCode, Squiz.Commenting.InlineComment
86
 
87
  //? 3a
88
  if ( \defined( 'TSF_EXTENSION_MANAGER_VERSION' ) ) return;
inc/views/edit/seo-settings-singular.php CHANGED
@@ -507,12 +507,10 @@ switch ( $instance ) :
507
  </div>
508
  </div>
509
  <div class="tsf-flex-setting-input tsf-flex">
510
- <textarea class="large-text" name="autodescription[_twitter_description]" id="autodescription_twitter_description" placeholder="<?php echo esc_attr( $social_placeholders['description']['twitter'] ); ?>" rows="3" cols="4" autocomplete=off>
511
- <?php
512
  // Textareas don't require sanitization in HTML5... other than removing the closing </textarea> tag...?
513
  echo $this->esc_attr_preserve_amp( $this->get_post_meta_item( '_twitter_description' ) );
514
- ?>
515
- </textarea>
516
  </div>
517
  </div>
518
  <?php
507
  </div>
508
  </div>
509
  <div class="tsf-flex-setting-input tsf-flex">
510
+ <textarea class="large-text" name="autodescription[_twitter_description]" id="autodescription_twitter_description" placeholder="<?php echo esc_attr( $social_placeholders['description']['twitter'] ); ?>" rows="3" cols="4" autocomplete=off><?php
 
511
  // Textareas don't require sanitization in HTML5... other than removing the closing </textarea> tag...?
512
  echo $this->esc_attr_preserve_amp( $this->get_post_meta_item( '_twitter_description' ) );
513
+ ?></textarea>
 
514
  </div>
515
  </div>
516
  <?php
lib/css/tsf.css CHANGED
@@ -448,6 +448,25 @@ body.rtl .tsf-remove-image-button.button {
448
  }
449
  }
450
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
451
  @media screen and (max-width: 782px) {
452
  .notice.tsf-notice,
453
  .wp-core-ui .notice.tsf-notice {
448
  }
449
  }
450
 
451
+ @keyframes tsf-fade-in {
452
+ 0% {
453
+ opacity: 0;
454
+ }
455
+ 100% {
456
+ opacity: 1;
457
+ }
458
+ }
459
+
460
+
461
+ @keyframes tsf-fade-out {
462
+ 0% {
463
+ opacity: 1;
464
+ }
465
+ 100% {
466
+ opacity: 0;
467
+ }
468
+ }
469
+
470
  @media screen and (max-width: 782px) {
471
  .notice.tsf-notice,
472
  .wp-core-ui .notice.tsf-notice {
lib/css/tsf.min.css CHANGED
@@ -1 +1 @@
1
- .tsf-js .hide-if-tsf-js,.tsf-no-js .hide-if-no-tsf-js{display:none}.notice.tsf-notice{position:relative;padding-right:38px}body.rtl .notice.tsf-notice{padding-right:12px;padding-left:38px}.tsf-notice.tsf-show-icon p:before{content:'';margin-right:12px;background:0 0;display:inline-block;font:400 14px/16px dashicons;speak:none;height:16px;text-align:center;vertical-align:middle;width:16px;line-height:14px;-webkit-font-smoothing:antialiased}body.rtl .tsf-notice.tsf-show-icon p:before{margin-right:0;margin-left:12px}.error.tsf-notice.tsf-show-icon p:before{color:#dc3232;content:"\f534"}.notice-warning.tsf-notice.tsf-show-icon p:before{color:#ffb900;content:"\f227"}.notice-info.tsf-notice.tsf-show-icon p:before{color:#00a0d2;font-size:16px;content:"\f223"}.updated.tsf-notice.tsf-show-icon p:before{color:#46b450;font-size:16px;content:"\f147"}.tsf-notice .tsf-dismiss{position:absolute;top:0;right:0;border:none;margin:0;padding:10px;background:0 0;color:#72777c;cursor:pointer;text-decoration:none}body.rtl .tsf-notice .tsf-dismiss{right:initial;left:0}.tsf-dismiss:hover{color:#c00}.tsf-dismiss:focus{outline:0;box-shadow:0 0 0 1px #5b9dd9,0 0 2px 1px rgba(30,140,190,.8)}.tsf-dismiss:before{background:0 0;color:currentColor;content:"\f153";display:block;font:400 16px/20px dashicons;speak:none;height:20px;text-align:center;width:20px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.tsf-seo-bar-item{text-decoration:none;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.tsf-title-wrap{position:relative;display:block;padding:0;height:auto;width:auto}.tsf-title-offset{visibility:hidden;height:0;display:inline-block;position:absolute;left:0;color:transparent;white-space:pre}body.rtl .tsf-title-offset{left:initial;right:0}.tsf-title-placeholder-additions,.tsf-title-placeholder-prefix{position:absolute;color:#777;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:content-box;top:0;left:0;overflow:hidden;white-space:pre;text-overflow:ellipsis;will-change:left,right}body.rtl .tsf-title-placeholder-additions,body.rtl .tsf-title-placeholder-prefix{left:initial;right:0}.tsf-title-placeholder-additions{display:none}.fixed .column-tsf-seo-bar-wrap{width:11%}.tsf-seo-bar{display:block;width:95%;max-width:190px;padding:0}.tsf-seo-bar-inner-wrap{display:flex;flex-direction:row;flex:1 1 auto;flex-wrap:wrap;justify-content:flex-start}.tsf-seo-bar-section-wrap{min-width:2em;flex:1 1 auto}.tsf-seo-bar-item{display:block;color:#fff;text-align:center;border:1px solid rgba(0,0,0,.1);text-shadow:0 0 3px rgba(0,0,0,.5)}.tsf-seo-bar-item:focus{outline:0;box-shadow:0 0 0 1px currentColor inset}body.no-js .tsf-seo-bar-item{cursor:default}.tsf-seo-bar-bad{background-color:#dd3811}.tsf-seo-bar-okay{background-color:#ffa700}.tsf-seo-bar-good{background-color:#0cc34b}.tsf-seo-bar-unknown{background-color:#007bd2}.tsf-seo-bar-undefined{background-color:#767676}#col-container,#col-right{overflow:initial}.tsf-help{font-weight:400}.tsf-notice{clear:both}.tsf-flex{box-sizing:border-box;display:flex;flex:1 1 auto;flex-flow:column wrap;justify-content:flex-start}input.tsf-default-selected{border-color:#1c9d38}input.tsf-default-selected:checked:before{color:#1c9d38}input.tsf-warning-selected{border-color:#dd3811}input.tsf-warning-selected:checked:before{color:#dd3811}label.tsf-disabled{color:#999}input.tsf-disabled,label.tsf-disabled{cursor:default}.tsf-fields{font-size:13px;line-height:1.5;margin:1em 0}.tsf-fields .tsf-toblock{display:block;width:100%;margin-bottom:4px}.tsf-fields p.description{margin:7px 0 5px;color:#666}.tsf-option-spacer{margin:1em 0}.tsf-select-wrap{margin-top:7px;margin-bottom:14px}.tsf-select-wrap:last-of-type{margin-bottom:0}.tsf-select-block>select{margin-top:7px;margin-bottom:14px;display:block}.tsf-select-block:last-of-type>select{margin-bottom:0}.tsf-checkbox-wrapper{margin-top:15px}.tsf-checkbox-wrapper:first-child{margin-top:0}.tsf-metaboxes legend h4{margin:2px 0}.tsf-metaboxes legend p:last-of-type{margin-bottom:0}.tsf-counter .tsf-ajax{margin-left:3px}body.rtl .tsf-counter .tsf-aja{margin-left:0;margin-right:3px}.tsf-ajax:before{display:inline-block;line-height:1;font-family:dashicons;font-style:normal;font-weight:400;font-size:1.225em;vertical-align:middle;content:""}.tsf-ajax.tsf-loading:before{content:"\f463";color:#007bd2;animation:tsf-spin 1.5s linear infinite}.tsf-ajax.tsf-error:before{content:"\f158";color:#dd3811}.tsf-ajax.tsf-success:before{content:"\f147";color:#0cc34b}.tsf-ajax.tsf-unknown:after{content:"\f223";color:#057c99}.tsf-remove-image-button.button,.tsf-set-image-button.button{margin-right:8px}body.rtl .tsf-remove-image-button.button,body.rtl .tsf-set-image-button.button{margin-right:0;margin-left:8px}.tsf-image-preview{line-height:inherit;vertical-align:text-bottom}#tsf-inpost-box input[type=text]::-webkit-input-placeholder,#tsf-inpost-box textarea::-webkit-input-placeholder,.tsf-metaboxes input[type=text]::-webkit-input-placeholder,.tsf-metaboxes textarea::-webkit-input-placeholder{transition:color .33s ease-in,text-shadow .33s ease-in}#tsf-inpost-box input[type=text]::-ms-clear,.tsf-metaboxes input[type=text]::-ms-clear,.tsf-quick-edit-columns input[type=text]::-ms-clear{display:none}#tsf-inpost-box input[type=text]::-moz-placeholder,#tsf-inpost-box textarea::-moz-placeholder,.tsf-metaboxes input[type=text]::-moz-placeholder,.tsf-metaboxes textarea::-moz-placeholder{transition:color .33s ease-in,text-shadow .33s ease-in}#tsf-inpost-box input[type=text]:-ms-input-placeholder,#tsf-inpost-box textarea:-ms-input-placeholder,.tsf-metaboxes input[type=text]:-ms-input-placeholder,.tsf-metaboxes textarea:-ms-input-placeholder{transition:color .33s ease-in,text-shadow .33s ease-in}#tsf-inpost-box input[type=text]:focus::-webkit-input-placeholder,#tsf-inpost-box textarea:focus::-webkit-input-placeholder,.tsf-metaboxes input[type=text]:focus::-webkit-input-placeholder,.tsf-metaboxes textarea:focus::-webkit-input-placeholder{color:transparent;text-shadow:0 0 1px rgba(114,119,124,.75)}#tsf-inpost-box input[type=text]:focus::-moz-placeholder,#tsf-inpost-box textarea:focus::-moz-placeholder,.tsf-metaboxe textarea:focus::-moz-placeholder,.tsf-metaboxes input[type=text]:focus::-moz-placeholder{color:transparent;text-shadow:0 0 1px rgba(114,119,124,.75)}#tsf-inpost-box input[type=text]:focus:-ms-input-placeholder,#tsf-inpost-box textarea:focus:-ms-input-placeholder,.tsf-metaboxes input[type=text]:focus:-ms-input-placeholder,.tsf-metaboxes textarea:focus:-ms-input-placeholder{color:transparent;text-shadow:0 0 1px rgba(114,119,124,.75)}@keyframes tsf-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@media screen and (max-width:782px){.notice.tsf-notice,.wp-core-ui .notice.tsf-notice{padding-right:46px}body.rtl .notice.tsf-notice,body.rtl.wp-core-ui .notice.tsf-notice{padding-right:10px;padding-left:46px}.tsf-inpost-box p.tsf-fields,.tsf-metaboxes p.tsf-fields{line-height:2.8}#tsf-home-title-location label span,#tsf-title-location label span{min-width:40px}.wp-list-table .is-expanded td.tsf-seo-bar-wrap:not(.hidden){overflow:initial!important}}@media screen and (max-width:642px){.tsf-nav-desktop{display:none}}@-moz-document url-prefix(){input.tsf-default-selected{box-shadow:0 0 0 1px #1c9d38}input.tsf-warning-selected{box-shadow:0 0 0 1px #dd3811}}
1
+ .tsf-js .hide-if-tsf-js,.tsf-no-js .hide-if-no-tsf-js{display:none}.notice.tsf-notice{position:relative;padding-right:38px}body.rtl .notice.tsf-notice{padding-right:12px;padding-left:38px}.tsf-notice.tsf-show-icon p:before{content:'';margin-right:12px;background:0 0;display:inline-block;font:400 14px/16px dashicons;speak:none;height:16px;text-align:center;vertical-align:middle;width:16px;line-height:14px;-webkit-font-smoothing:antialiased}body.rtl .tsf-notice.tsf-show-icon p:before{margin-right:0;margin-left:12px}.error.tsf-notice.tsf-show-icon p:before{color:#dc3232;content:"\f534"}.notice-warning.tsf-notice.tsf-show-icon p:before{color:#ffb900;content:"\f227"}.notice-info.tsf-notice.tsf-show-icon p:before{color:#00a0d2;font-size:16px;content:"\f223"}.updated.tsf-notice.tsf-show-icon p:before{color:#46b450;font-size:16px;content:"\f147"}.tsf-notice .tsf-dismiss{position:absolute;top:0;right:0;border:none;margin:0;padding:10px;background:0 0;color:#72777c;cursor:pointer;text-decoration:none}body.rtl .tsf-notice .tsf-dismiss{right:initial;left:0}.tsf-dismiss:hover{color:#c00}.tsf-dismiss:focus{outline:0;box-shadow:0 0 0 1px #5b9dd9,0 0 2px 1px rgba(30,140,190,.8)}.tsf-dismiss:before{background:0 0;color:currentColor;content:"\f153";display:block;font:400 16px/20px dashicons;speak:none;height:20px;text-align:center;width:20px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.tsf-seo-bar-item{text-decoration:none;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.tsf-title-wrap{position:relative;display:block;padding:0;height:auto;width:auto}.tsf-title-offset{visibility:hidden;height:0;display:inline-block;position:absolute;left:0;color:transparent;white-space:pre}body.rtl .tsf-title-offset{left:initial;right:0}.tsf-title-placeholder-additions,.tsf-title-placeholder-prefix{position:absolute;color:#777;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:content-box;top:0;left:0;overflow:hidden;white-space:pre;text-overflow:ellipsis;will-change:left,right}body.rtl .tsf-title-placeholder-additions,body.rtl .tsf-title-placeholder-prefix{left:initial;right:0}.tsf-title-placeholder-additions{display:none}.fixed .column-tsf-seo-bar-wrap{width:11%}.tsf-seo-bar{display:block;width:95%;max-width:190px;padding:0}.tsf-seo-bar-inner-wrap{display:flex;flex-direction:row;flex:1 1 auto;flex-wrap:wrap;justify-content:flex-start}.tsf-seo-bar-section-wrap{min-width:2em;flex:1 1 auto}.tsf-seo-bar-item{display:block;color:#fff;text-align:center;border:1px solid rgba(0,0,0,.1);text-shadow:0 0 3px rgba(0,0,0,.5)}.tsf-seo-bar-item:focus{outline:0;box-shadow:0 0 0 1px currentColor inset}body.no-js .tsf-seo-bar-item{cursor:default}.tsf-seo-bar-bad{background-color:#dd3811}.tsf-seo-bar-okay{background-color:#ffa700}.tsf-seo-bar-good{background-color:#0cc34b}.tsf-seo-bar-unknown{background-color:#007bd2}.tsf-seo-bar-undefined{background-color:#767676}#col-container,#col-right{overflow:initial}.tsf-help{font-weight:400}.tsf-notice{clear:both}.tsf-flex{box-sizing:border-box;display:flex;flex:1 1 auto;flex-flow:column wrap;justify-content:flex-start}input.tsf-default-selected{border-color:#1c9d38}input.tsf-default-selected:checked:before{color:#1c9d38}input.tsf-warning-selected{border-color:#dd3811}input.tsf-warning-selected:checked:before{color:#dd3811}label.tsf-disabled{color:#999}input.tsf-disabled,label.tsf-disabled{cursor:default}.tsf-fields{font-size:13px;line-height:1.5;margin:1em 0}.tsf-fields .tsf-toblock{display:block;width:100%;margin-bottom:4px}.tsf-fields p.description{margin:7px 0 5px;color:#666}.tsf-option-spacer{margin:1em 0}.tsf-select-wrap{margin-top:7px;margin-bottom:14px}.tsf-select-wrap:last-of-type{margin-bottom:0}.tsf-select-block>select{margin-top:7px;margin-bottom:14px;display:block}.tsf-select-block:last-of-type>select{margin-bottom:0}.tsf-checkbox-wrapper{margin-top:15px}.tsf-checkbox-wrapper:first-child{margin-top:0}.tsf-metaboxes legend h4{margin:2px 0}.tsf-metaboxes legend p:last-of-type{margin-bottom:0}.tsf-counter .tsf-ajax{margin-left:3px}body.rtl .tsf-counter .tsf-aja{margin-left:0;margin-right:3px}.tsf-ajax:before{display:inline-block;line-height:1;font-family:dashicons;font-style:normal;font-weight:400;font-size:1.225em;vertical-align:middle;content:""}.tsf-ajax.tsf-loading:before{content:"\f463";color:#007bd2;animation:tsf-spin 1.5s linear infinite}.tsf-ajax.tsf-error:before{content:"\f158";color:#dd3811}.tsf-ajax.tsf-success:before{content:"\f147";color:#0cc34b}.tsf-ajax.tsf-unknown:after{content:"\f223";color:#057c99}.tsf-remove-image-button.button,.tsf-set-image-button.button{margin-right:8px}body.rtl .tsf-remove-image-button.button,body.rtl .tsf-set-image-button.button{margin-right:0;margin-left:8px}.tsf-image-preview{line-height:inherit;vertical-align:text-bottom}#tsf-inpost-box input[type=text]::-webkit-input-placeholder,#tsf-inpost-box textarea::-webkit-input-placeholder,.tsf-metaboxes input[type=text]::-webkit-input-placeholder,.tsf-metaboxes textarea::-webkit-input-placeholder{transition:color .33s ease-in,text-shadow .33s ease-in}#tsf-inpost-box input[type=text]::-ms-clear,.tsf-metaboxes input[type=text]::-ms-clear,.tsf-quick-edit-columns input[type=text]::-ms-clear{display:none}#tsf-inpost-box input[type=text]::-moz-placeholder,#tsf-inpost-box textarea::-moz-placeholder,.tsf-metaboxes input[type=text]::-moz-placeholder,.tsf-metaboxes textarea::-moz-placeholder{transition:color .33s ease-in,text-shadow .33s ease-in}#tsf-inpost-box input[type=text]:-ms-input-placeholder,#tsf-inpost-box textarea:-ms-input-placeholder,.tsf-metaboxes input[type=text]:-ms-input-placeholder,.tsf-metaboxes textarea:-ms-input-placeholder{transition:color .33s ease-in,text-shadow .33s ease-in}#tsf-inpost-box input[type=text]:focus::-webkit-input-placeholder,#tsf-inpost-box textarea:focus::-webkit-input-placeholder,.tsf-metaboxes input[type=text]:focus::-webkit-input-placeholder,.tsf-metaboxes textarea:focus::-webkit-input-placeholder{color:transparent;text-shadow:0 0 1px rgba(114,119,124,.75)}#tsf-inpost-box input[type=text]:focus::-moz-placeholder,#tsf-inpost-box textarea:focus::-moz-placeholder,.tsf-metaboxe textarea:focus::-moz-placeholder,.tsf-metaboxes input[type=text]:focus::-moz-placeholder{color:transparent;text-shadow:0 0 1px rgba(114,119,124,.75)}#tsf-inpost-box input[type=text]:focus:-ms-input-placeholder,#tsf-inpost-box textarea:focus:-ms-input-placeholder,.tsf-metaboxes input[type=text]:focus:-ms-input-placeholder,.tsf-metaboxes textarea:focus:-ms-input-placeholder{color:transparent;text-shadow:0 0 1px rgba(114,119,124,.75)}@keyframes tsf-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes tsf-fade-in{0%{opacity:0}100%{opacity:1}}@keyframes tsf-fade-out{0%{opacity:1}100%{opacity:0}}@media screen and (max-width:782px){.notice.tsf-notice,.wp-core-ui .notice.tsf-notice{padding-right:46px}body.rtl .notice.tsf-notice,body.rtl.wp-core-ui .notice.tsf-notice{padding-right:10px;padding-left:46px}.tsf-inpost-box p.tsf-fields,.tsf-metaboxes p.tsf-fields{line-height:2.8}#tsf-home-title-location label span,#tsf-title-location label span{min-width:40px}.wp-list-table .is-expanded td.tsf-seo-bar-wrap:not(.hidden){overflow:initial!important}}@media screen and (max-width:642px){.tsf-nav-desktop{display:none}}@-moz-document url-prefix(){input.tsf-default-selected{box-shadow:0 0 0 1px #1c9d38}input.tsf-warning-selected{box-shadow:0 0 0 1px #dd3811}}
lib/js/post.js CHANGED
@@ -182,161 +182,29 @@ window.tsfPost = function( $ ) {
182
  /**
183
  * Sets the navigation tabs content equal to the buttons.
184
  *
185
- * @todo Merge with tsfSettings._initTabs?
186
- * It's basically a carbon copy, aside from the trigger and classes.
187
  * @since 4.0.0
 
188
  * @access private
189
  *
190
  * @function
191
  * @return {(undefined|null)}
192
  */
193
  const _initTabs = () => {
194
-
195
- let togglePromises = {},
196
- toggleTarget = {},
197
- toggleWrap = {},
198
- toggleContainer = {};
199
-
200
- const tabToggledEvent = new CustomEvent( 'tsf-flex-tab-toggled' );
201
-
202
- /**
203
- * Sets correct tab content and classes on toggle.
204
- *
205
- * @function
206
- * @param {Event} event
207
- * @return {(undefined|null)}
208
- */
209
- const flexTabToggle = ( event ) => {
210
-
211
- const currentToggle = event.target;
212
- const onload = ! event.isTrusted;
213
-
214
- // Why is this here? For broken customEvent triggers?
215
- // if ( ! currentToggle.checked ) return;
216
-
217
- const toggleId = event.target.id,
218
- toggleName = event.target.name;
219
-
220
- toggleWrap.hasOwnProperty( toggleName ) || (
221
- toggleWrap[ toggleName ] = currentToggle.closest( '.tsf-flex-nav-tab-wrapper' )
222
- );
223
-
224
- const activeClass = 'tsf-flex-tab-content-active',
225
- toggleActiveClass = 'tsf-flex-tab-active',
226
- previousToggle = toggleWrap[ toggleName ].querySelector( `.${toggleActiveClass}` );
227
-
228
- if ( ! onload ) {
229
- // Perform validity check, this prevents non-invoking hidden browser validation errors.
230
- const invalidInput = document.querySelector( `.${activeClass} :invalid` );
231
- if ( invalidInput ) {
232
- invalidInput.reportValidity();
233
-
234
- if ( previousToggle )
235
- previousToggle.checked = true;
236
-
237
- currentToggle.checked = false;
238
-
239
- event.stopPropagation();
240
- event.preventDefault();
241
- return false; // stop propagation in jQuery.
242
- }
243
- }
244
-
245
- if ( previousToggle ) {
246
- previousToggle.classList.remove( toggleActiveClass );
247
- let label = document.querySelector( `.tsf-flex-nav-tab-label[for="${previousToggle.id}"]` );
248
- label && label.classList.remove( 'tsf-no-focus-ring' );
249
- }
250
- currentToggle.classList.add( toggleActiveClass );
251
-
252
- if ( onload ) {
253
- const newContent = document.getElementById( `${toggleId}-content` );
254
-
255
- if ( ! newContent.classList.contains( activeClass ) ) {
256
- const allContent = document.querySelectorAll( `.${toggleName}-content` );
257
- allContent && allContent.forEach( element => {
258
- element.classList.remove( activeClass );
259
- } );
260
- newContent && newContent.classList.add( activeClass );
261
- }
262
-
263
- document.getElementById( toggleId ).dispatchEvent( tabToggledEvent );
264
- } else {
265
- if ( ! toggleContainer.hasOwnProperty( toggleName ) ) {
266
- toggleContainer[ toggleName ] = currentToggle.closest( '.inside' );
267
- togglePromises[ toggleName ] = void 0;
268
- }
269
-
270
- const fadeOutTimeout = 150;
271
-
272
- // Set toggleTarget for (active or upcoming) Promise.
273
- toggleTarget[ toggleName ] = toggleId;
274
- // If the promise is running, let it finish and consider the newly set ID.
275
- if ( 'undefined' !== typeof togglePromises[ toggleName ] ) return;
276
-
277
- const $allContent = $( '.' + toggleName + '-content' );
278
- const setCorrectTab = () => {
279
- $( `#${toggleTarget[ toggleName ]}-content` ).stop( false, true ).addClass( activeClass ).fadeIn( 250 );
280
- toggleContainer[ toggleName ].style.minHeight = '';
281
- return new Promise( resolve => setTimeout( resolve, fadeOutTimeout ) );
282
- };
283
- const lockHeight = () => {
284
- toggleContainer[ toggleName ].style.minHeight = toggleContainer[ toggleName ].getBoundingClientRect().height;
285
- }
286
-
287
- togglePromises[ toggleName ] = () => new Promise( resolve => {
288
- // Lock height, so to prevent jumping.
289
- lockHeight();
290
-
291
- // Stop any running animations, and hide the content. Put in $.Deferred so to run the thenable only once.
292
- $.when( $allContent.stop( false, true ).fadeOut( fadeOutTimeout ) ).then( () => {
293
- $allContent.removeClass( activeClass );
294
- resolve();
295
- } );
296
- } ).then(
297
- setCorrectTab
298
- ).then( () => {
299
- let toggledContent = document.getElementById( `${toggleTarget[ toggleName ]}-content` );
300
-
301
- // Test if the correct tab has been set--otherwise, try again.
302
- // Resolve if the query fails, so to prevent an infinite loop.
303
- if ( ! toggledContent || toggledContent.classList.contains( activeClass ) ) {
304
- document.getElementById( toggleTarget[ toggleName ] ).dispatchEvent( tabToggledEvent );
305
- togglePromises[ toggleName ] = void 0;
306
- } else {
307
- // Lock height to prevent jumping.
308
- lockHeight();
309
- // Hide everything instantly. We don't make false promises here.
310
- $allContent.removeClass( activeClass );
311
- // Retry self.
312
- togglePromises[ toggleName ]();
313
- }
314
- } );
315
-
316
- togglePromises[ toggleName ]();
317
  }
318
- }
319
-
320
- /**
321
- * Sets a class to the active element which helps excluding focus rings.
322
- *
323
- * @see flexTabToggle Handles this class.
324
- *
325
- * @function
326
- * @param {Event} event
327
- * @return {(undefined|null)}
328
- */
329
- const addNoFocusClass = event => event.currentTarget.classList.add( 'tsf-no-focus-ring' );
330
- document.querySelectorAll( '.tsf-flex-nav-tab-wrapper .tsf-flex-nav-tab-label' ).forEach( el => {
331
- el.addEventListener( 'click', addNoFocusClass );
332
- } );
333
-
334
- document.querySelectorAll( '.tsf-flex-nav-tab-radio' ).forEach( el => {
335
- el.addEventListener( 'change', flexTabToggle );
336
- } );
337
- document.querySelectorAll( '.tsf-flex-nav-tab-radio:checked' ).forEach( el => {
338
- el.dispatchEvent( new Event( 'change' ) );
339
- } );
340
  }
341
 
342
  /**
182
  /**
183
  * Sets the navigation tabs content equal to the buttons.
184
  *
 
 
185
  * @since 4.0.0
186
+ * @since 4.1.3 Now offloaded to tsfTabs.
187
  * @access private
188
  *
189
  * @function
190
  * @return {(undefined|null)}
191
  */
192
  const _initTabs = () => {
193
+ tsfTabs.initStack(
194
+ 'tsfSettings',
195
+ {
196
+ tabToggledEvent: new CustomEvent( 'tsf-flex-tab-toggled' ),
197
+ HTMLClasses: {
198
+ wrapper: 'tsf-flex-nav-tab-wrapper',
199
+ tabRadio: 'tsf-flex-nav-tab-radio',
200
+ tabLabel: 'tsf-flex-nav-tab-label',
201
+ activeTab: 'tsf-flex-tab-active', // change to tsf-flex-nav-tab-active?
202
+ // TODO make this tsf-flex-tab-active-content (force -content affix?)
203
+ activeTabContent: 'tsf-flex-tab-content-active',
204
+ },
205
+ fixHistory: true, // doesn't work since the inputs reset on navigation; enabled for future-proofing.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  }
207
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  }
209
 
210
  /**
lib/js/post.min.js CHANGED
@@ -1 +1 @@
1
- 'use strict';window.tsfPost=function(a){const b="undefined"!=typeof tsfPostL10n&&tsfPostL10n,c="autodescription_title",d="autodescription_description",e=()=>{if(!document.querySelector(".tsf-flex"))return;let b={};const c=d=>{let e=d.querySelector(".tsf-flex-nav-tab-inner"),f=d.getElementsByClassName("tsf-flex-nav-name"),g=e.clientWidth<=d.clientWidth;if(g){if(+(d.dataset.displayedNames||1))return;d.dataset.displayedNames=1,a(f).stop(!1,!0).fadeIn(250)}else{if(!+(d.dataset.displayedNames||1))return;d.dataset.displayedNames=0,a(f).hide()}+d.dataset.displayedNames&&(e.clientWidth>d.clientWidth?(a(f).stop(!1,!0).hide(),d.dataset.displayedNames=0):setTimeout(()=>{cancelAnimationFrame(b[d.id]),b[d.id]=requestAnimationFrame(()=>c(d))},7))};window.addEventListener("tsf-flex-resize",a=>{let d=a.detail.target||document.getElementById("tsf-flex-inpost-tabs-wrapper");d&&(b[d.id]=requestAnimationFrame(()=>c(d)))});const d=a=>{window.dispatchEvent(new CustomEvent("tsf-flex-resize",{bubbles:!1,cancelable:!1,detail:{target:a}}))};if("undefined"!=typeof window.ResizeObserver){let a={};const b=new ResizeObserver(b=>{for(const c of b){let b=c.target;cancelAnimationFrame(a[b.id]),a[b.id]=requestAnimationFrame(()=>{b.dataset.lastWidth||(b.dataset.lastWidth=0),+b.clientWidth!=+b.dataset.lastWidth&&(b.dataset.lastWidth=b.clientWidth,d(b))})}});b.observe(document.getElementById("tsf-flex-inpost-tabs-wrapper"))}else{const b=()=>setTimeout(d,10);a(document).on("wp-window-resized orientationchange",b),a("#collapse-menu").on("click",b),a(".columns-prefs :input[type=radio]").on("change",b),a(".meta-box-sortables").on("sortupdate",b),a(document).on("postbox-moved",b),a("#tsf-inpost-box .handle-order-higher, #tsf-inpost-box .handle-order-lower").on("click",b)}d()},f=()=>{let b={},c={},d={},e={};const f=new CustomEvent("tsf-flex-tab-toggled"),g=g=>{const h=g.target,i=!g.isTrusted,j=g.target.id,k=g.target.name;d.hasOwnProperty(k)||(d[k]=h.closest(".tsf-flex-nav-tab-wrapper"));const l="tsf-flex-tab-content-active",m="tsf-flex-tab-active",n=d[k].querySelector(`.${m}`);if(!i){const a=document.querySelector(`.${l} :invalid`);if(a)return a.reportValidity(),n&&(n.checked=!0),h.checked=!1,g.stopPropagation(),g.preventDefault(),!1}if(n){n.classList.remove(m);let a=document.querySelector(`.tsf-flex-nav-tab-label[for="${n.id}"]`);a&&a.classList.remove("tsf-no-focus-ring")}if(h.classList.add(m),i){const a=document.getElementById(`${j}-content`);if(!a.classList.contains(l)){const b=document.querySelectorAll(`.${k}-content`);b&&b.forEach(a=>{a.classList.remove(l)}),a&&a.classList.add(l)}document.getElementById(j).dispatchEvent(f)}else{e.hasOwnProperty(k)||(e[k]=h.closest(".inside"),b[k]=void 0);const d=150;if(c[k]=j,"undefined"!=typeof b[k])return;const g=a("."+k+"-content"),i=()=>(a(`#${c[k]}-content`).stop(!1,!0).addClass(l).fadeIn(250),e[k].style.minHeight="",new Promise(a=>setTimeout(a,d))),m=()=>{e[k].style.minHeight=e[k].getBoundingClientRect().height};b[k]=()=>new Promise(b=>{m(),a.when(g.stop(!1,!0).fadeOut(d)).then(()=>{g.removeClass(l),b()})}).then(i).then(()=>{let a=document.getElementById(`${c[k]}-content`);!a||a.classList.contains(l)?(document.getElementById(c[k]).dispatchEvent(f),b[k]=void 0):(m(),g.removeClass(l),b[k]())}),b[k]()}},h=a=>a.currentTarget.classList.add("tsf-no-focus-ring");document.querySelectorAll(".tsf-flex-nav-tab-wrapper .tsf-flex-nav-tab-label").forEach(a=>{a.addEventListener("click",h)}),document.querySelectorAll(".tsf-flex-nav-tab-radio").forEach(a=>{a.addEventListener("change",g)}),document.querySelectorAll(".tsf-flex-nav-tab-radio:checked").forEach(a=>{a.dispatchEvent(new Event("change"))})},g=()=>{const c=1,d=2,e=document.getElementById("autodescription_noindex");let f,g=0,h="";const i=()=>{clearTimeout(f),f=setTimeout(()=>{let a=document.getElementById("autodescription_canonical");a&&(h=h||a.placeholder,a.placeholder=g&c||g&d?"":h)},50)},j=a=>{h=a,i()};a(document).on("tsf-updated-gutenberg-link",(a,b)=>j(b));const k=a=>{let b=e.querySelector("[value=\"0\"]"),d="";switch(a){case"password":case"private":d="noindex",g|=c;break;default:case"public":d=e.dataset.defaultUnprotected,g&=~c;}b&&(b.innerHTML=e.dataset.defaultI18n.replace("%s",tsf.decodeEntities(d))),i()};a(document).on("tsf-updated-gutenberg-visibility",(a,b)=>k(b));const l=document.querySelector("#visibility .save-post-visibility");l&&l.addEventListener("click",()=>{let b=a("#visibility").find("input:radio:checked").val();if("password"===b){let c=a("#visibility").find("#post_password").val();c&&c.length||(b="public")}k(b)}),b.states.isPrivate?k("private"):b.states.isProtected?k("password"):k("public");const m=a=>{let b="";switch(+a){case 0:b=e.dataset.defaultUnprotected;break;case-1:b="index";break;case 1:b="noindex";}"noindex"===b?g|=d:g&=~d,i()};e.addEventListener("change",a=>m(a.target.value)),m(e.value)},h=()=>{const d=document.getElementById(c);if(!d)return;const e=document.getElementById("autodescription_title_no_blogname");tsfTitle.setInputElement(d);let f=JSON.parse(document.getElementById("tsf-title-data_"+c).dataset.state);tsfTitle.updateStateOf(c,"allowReferenceChange",!f.refTitleLocked),tsfTitle.updateStateOf(c,"defaultTitle",f.defaultTitle.trim()),tsfTitle.updateStateOf(c,"addAdditions",f.addAdditions),tsfTitle.updateStateOf(c,"useSocialTagline",!!(f.useSocialTagline||!1)),tsfTitle.updateStateOf(c,"additionValue",f.additionValue.trim()),tsfTitle.updateStateOf(c,"additionPlacement",f.additionPlacement),tsfTitle.updateStateOf(c,"hasLegacy",!!(f.hasLegacy||!1));e&&(e.addEventListener("change",a=>{let d=tsfTitle.getStateOf(c,"addAdditions"),e=!a.target.checked;b.params.additionsForcedDisabled?e=!1:b.params.additionsForcedEnabled&&(e=!0),d!==e&&tsfTitle.updateStateOf(c,"addAdditions",e)}),e.dispatchEvent(new Event("change")));const g=a=>{let b=tsfTitle.getStateOf(c,"prefixValue"),d="";switch(a){case"password":d=tsfTitle.protectedPrefix;break;case"private":d=tsfTitle.privatePrefix;break;default:case"public":d="";}d!==b&&tsfTitle.updateStateOf(c,"prefixValue",d)};a(document).on("tsf-updated-gutenberg-visibility",(a,b)=>g(b));const h=document.querySelector("#visibility .save-post-visibility");h&&h.addEventListener("click",()=>{let b=a("#visibility").find("input:radio:checked").val();if("password"===b){let c=a("#visibility").find("#post_password").val();c&&c.length||(b="public")}g(b)}),b.states.isPrivate?g("private"):b.states.isProtected&&g("password");const i=a=>{a="string"==typeof a&&a.trim()||"";let b=tsfTitle.stripTitleTags?tsf.stripTags(a):a;b=b||tsfTitle.untitledTitle,tsfTitle.updateStateOf(c,"defaultTitle",b)};if(!b.params.isFront){const b=document.querySelector("#titlewrap #title");b&&b.addEventListener("input",a=>i(a.target.value)),a(document).on("tsf-updated-gutenberg-title",(a,b)=>i(b))}tsfTitle.enqueueUnregisteredInputTrigger(c)},i=()=>{let c=document.getElementById(d);if(!c)return;let e=JSON.parse(document.getElementById("tsf-description-data_"+d).dataset.state);tsfDescription.setInputElement(c),tsfDescription.updateStateOf(d,"allowReferenceChange",!e.refDescriptionLocked),tsfDescription.updateStateOf(d,"defaultDescription",e.defaultDescription.trim()),tsfDescription.updateStateOf(d,"hasLegacy",!!(e.hasLegacy||!1)),tsfDescription.enqueueUnregisteredInputTrigger(d);const f=a=>{let b=tsfDescription.getStateOf(d,"useDefaultDescription"),c=!0;switch(a){case"password":case"private":c=!1;break;default:case"public":c=!0;}c!==b&&tsfDescription.updateStateOf(d,"useDefaultDescription",c)};a(document).on("tsf-updated-gutenberg-visibility",(a,b)=>f(b));const g=document.querySelector("#visibility .save-post-visibility");g&&g.addEventListener("click",()=>{let b=a("#visibility").find("input:radio:checked").val();if("password"===b){let c=a("#visibility").find("#post_password").val();c&&c.length||(b="public")}f(b)}),b.states.isPrivate?f("private"):b.states.isProtected&&f("password")},j=()=>{const b=()=>{tsfTitle.enqueueUnregisteredInputTrigger(c),tsfDescription.enqueueUnregisteredInputTrigger(d)};a("#tsf-flex-inpost-tab-general").on("tsf-flex-tab-toggled",b),window.addEventListener("tsf-flex-resize",b)},k=()=>{b.states.isGutenbergPage&&("tsfTT"in window&&tsfTT.addBoundary("#editor"),document.addEventListener("tsf-gutenberg-sidebar-opened",()=>{"tsfTT"in window&&tsfTT.addBoundary(".edit-post-sidebar .components-panel")}))},l=()=>{if(!b.states.isGutenbergPage)return;const c=document.querySelector(".tsf-seo-bar"),e=document.querySelector("#tsf-doing-it-right-wrap .tsf-ajax"),f=document.getElementById(d),g=document.getElementById("autodescription_og_description"),h=document.getElementById("autodescription_twitter_description"),i=document.getElementById("autodescription_socialimage-url"),j={seobar:!!c,metadescription:!!f,ogdescription:!!g,twdescription:!!h,imageurl:!!i},k=b=>{switch(b=tsf.convertJSONResponse(b),b.type){case"success":const f=75;setTimeout(()=>{tsfDescription&&tsfDescription.updateStateOf(d,"defaultDescription",b.data.metadescription.trim()),tsfSocial&&(tsfSocial.updateState("ogDescPlaceholder",b.data.ogdescription.trim()),tsfSocial.updateState("twDescPlaceholder",b.data.twdescription.trim())),i.placeholder=tsf.decodeEntities(b.data.imageurl),i.dispatchEvent(new Event("change")),"tsfAys"in window&&tsfAys.reset()},f),a(c).fadeOut(f,()=>{e&&tsf.unsetAjaxLoader(e,!0)}).html(b.data.seobar).fadeIn(500,()=>{"tsfTT"in window&&tsfTT.triggerReset()});break;case"failure":e&&tsf.unsetAjaxLoader(e,!1);break;default:e&&tsf.resetAjaxLoader(e);}},l=()=>{e&&tsf.unsetAjaxLoader(e,!1)};document.addEventListener("tsf-gutenberg-onsave",()=>{e&&tsf.resetAjaxLoader(e),e&&tsf.setAjaxLoader(e);let c={method:"POST",url:ajaxurl,datatype:"json",data:{action:"the_seo_framework_update_post_data",nonce:tsf.l10n.nonces.edit_posts,post_id:b.states.id,get:j},async:!0,timeout:7e3,success:k,error:l};a.ajax(c)})},m=()=>{g(),h(),i(),j()},n=()=>{e(),f(),k(),l(),tsfSocial.initTitleInputs({ref:document.getElementById("tsf-title-reference_"+c),refNa:document.getElementById("tsf-title-noadditions-reference_"+c),meta:document.getElementById(c),og:document.getElementById("autodescription_og_title"),tw:document.getElementById("autodescription_twitter_title")}),tsfSocial.initDescriptionInputs({ref:document.getElementById("tsf-description-reference_"+d),meta:document.getElementById(d),og:document.getElementById("autodescription_og_description"),tw:document.getElementById("autodescription_twitter_description")})};return Object.assign({load:()=>{document.body.addEventListener("tsf-onload",m),document.body.addEventListener("tsf-ready",n)}},{},{l10n:b})}(jQuery),window.tsfPost.load();
1
+ 'use strict';window.tsfPost=function(a){const b="undefined"!=typeof tsfPostL10n&&tsfPostL10n,c="autodescription_title",d="autodescription_description",e=()=>{if(!document.querySelector(".tsf-flex"))return;let b={};const c=d=>{let e=d.querySelector(".tsf-flex-nav-tab-inner"),f=d.getElementsByClassName("tsf-flex-nav-name"),g=e.clientWidth<=d.clientWidth;if(g){if(+(d.dataset.displayedNames||1))return;d.dataset.displayedNames=1,a(f).stop(!1,!0).fadeIn(250)}else{if(!+(d.dataset.displayedNames||1))return;d.dataset.displayedNames=0,a(f).hide()}+d.dataset.displayedNames&&(e.clientWidth>d.clientWidth?(a(f).stop(!1,!0).hide(),d.dataset.displayedNames=0):setTimeout(()=>{cancelAnimationFrame(b[d.id]),b[d.id]=requestAnimationFrame(()=>c(d))},7))};window.addEventListener("tsf-flex-resize",a=>{let d=a.detail.target||document.getElementById("tsf-flex-inpost-tabs-wrapper");d&&(b[d.id]=requestAnimationFrame(()=>c(d)))});const d=a=>{window.dispatchEvent(new CustomEvent("tsf-flex-resize",{bubbles:!1,cancelable:!1,detail:{target:a}}))};if("undefined"!=typeof window.ResizeObserver){let a={};const b=new ResizeObserver(b=>{for(const c of b){let b=c.target;cancelAnimationFrame(a[b.id]),a[b.id]=requestAnimationFrame(()=>{b.dataset.lastWidth||(b.dataset.lastWidth=0),+b.clientWidth!=+b.dataset.lastWidth&&(b.dataset.lastWidth=b.clientWidth,d(b))})}});b.observe(document.getElementById("tsf-flex-inpost-tabs-wrapper"))}else{const b=()=>setTimeout(d,10);a(document).on("wp-window-resized orientationchange",b),a("#collapse-menu").on("click",b),a(".columns-prefs :input[type=radio]").on("change",b),a(".meta-box-sortables").on("sortupdate",b),a(document).on("postbox-moved",b),a("#tsf-inpost-box .handle-order-higher, #tsf-inpost-box .handle-order-lower").on("click",b)}d()},f=()=>{tsfTabs.initStack("tsfSettings",{tabToggledEvent:new CustomEvent("tsf-flex-tab-toggled"),HTMLClasses:{wrapper:"tsf-flex-nav-tab-wrapper",tabRadio:"tsf-flex-nav-tab-radio",tabLabel:"tsf-flex-nav-tab-label",activeTab:"tsf-flex-tab-active",activeTabContent:"tsf-flex-tab-content-active"},fixHistory:!0})},g=()=>{const c=1,d=2,e=document.getElementById("autodescription_noindex");let f,g=0,h="";const i=()=>{clearTimeout(f),f=setTimeout(()=>{let a=document.getElementById("autodescription_canonical");a&&(h=h||a.placeholder,a.placeholder=g&c||g&d?"":h)},50)},j=a=>{h=a,i()};a(document).on("tsf-updated-gutenberg-link",(a,b)=>j(b));const k=a=>{let b=e.querySelector("[value=\"0\"]"),d="";switch(a){case"password":case"private":d="noindex",g|=c;break;default:case"public":d=e.dataset.defaultUnprotected,g&=~c;}b&&(b.innerHTML=e.dataset.defaultI18n.replace("%s",tsf.decodeEntities(d))),i()};a(document).on("tsf-updated-gutenberg-visibility",(a,b)=>k(b));const l=document.querySelector("#visibility .save-post-visibility");l&&l.addEventListener("click",()=>{let b=a("#visibility").find("input:radio:checked").val();if("password"===b){let c=a("#visibility").find("#post_password").val();c&&c.length||(b="public")}k(b)}),b.states.isPrivate?k("private"):b.states.isProtected?k("password"):k("public");const m=a=>{let b="";switch(+a){case 0:b=e.dataset.defaultUnprotected;break;case-1:b="index";break;case 1:b="noindex";}"noindex"===b?g|=d:g&=~d,i()};e.addEventListener("change",a=>m(a.target.value)),m(e.value)},h=()=>{const d=document.getElementById(c);if(!d)return;const e=document.getElementById("autodescription_title_no_blogname");tsfTitle.setInputElement(d);let f=JSON.parse(document.getElementById("tsf-title-data_"+c).dataset.state);tsfTitle.updateStateOf(c,"allowReferenceChange",!f.refTitleLocked),tsfTitle.updateStateOf(c,"defaultTitle",f.defaultTitle.trim()),tsfTitle.updateStateOf(c,"addAdditions",f.addAdditions),tsfTitle.updateStateOf(c,"useSocialTagline",!!(f.useSocialTagline||!1)),tsfTitle.updateStateOf(c,"additionValue",f.additionValue.trim()),tsfTitle.updateStateOf(c,"additionPlacement",f.additionPlacement),tsfTitle.updateStateOf(c,"hasLegacy",!!(f.hasLegacy||!1));e&&(e.addEventListener("change",a=>{let d=tsfTitle.getStateOf(c,"addAdditions"),e=!a.target.checked;b.params.additionsForcedDisabled?e=!1:b.params.additionsForcedEnabled&&(e=!0),d!==e&&tsfTitle.updateStateOf(c,"addAdditions",e)}),e.dispatchEvent(new Event("change")));const g=a=>{let b=tsfTitle.getStateOf(c,"prefixValue"),d="";switch(a){case"password":d=tsfTitle.protectedPrefix;break;case"private":d=tsfTitle.privatePrefix;break;default:case"public":d="";}d!==b&&tsfTitle.updateStateOf(c,"prefixValue",d)};a(document).on("tsf-updated-gutenberg-visibility",(a,b)=>g(b));const h=document.querySelector("#visibility .save-post-visibility");h&&h.addEventListener("click",()=>{let b=a("#visibility").find("input:radio:checked").val();if("password"===b){let c=a("#visibility").find("#post_password").val();c&&c.length||(b="public")}g(b)}),b.states.isPrivate?g("private"):b.states.isProtected&&g("password");const i=a=>{a="string"==typeof a&&a.trim()||"";let b=tsfTitle.stripTitleTags?tsf.stripTags(a):a;b=b||tsfTitle.untitledTitle,tsfTitle.updateStateOf(c,"defaultTitle",b)};if(!b.params.isFront){const b=document.querySelector("#titlewrap #title");b&&b.addEventListener("input",a=>i(a.target.value)),a(document).on("tsf-updated-gutenberg-title",(a,b)=>i(b))}tsfTitle.enqueueUnregisteredInputTrigger(c)},i=()=>{let c=document.getElementById(d);if(!c)return;let e=JSON.parse(document.getElementById("tsf-description-data_"+d).dataset.state);tsfDescription.setInputElement(c),tsfDescription.updateStateOf(d,"allowReferenceChange",!e.refDescriptionLocked),tsfDescription.updateStateOf(d,"defaultDescription",e.defaultDescription.trim()),tsfDescription.updateStateOf(d,"hasLegacy",!!(e.hasLegacy||!1)),tsfDescription.enqueueUnregisteredInputTrigger(d);const f=a=>{let b=tsfDescription.getStateOf(d,"useDefaultDescription"),c=!0;switch(a){case"password":case"private":c=!1;break;default:case"public":c=!0;}c!==b&&tsfDescription.updateStateOf(d,"useDefaultDescription",c)};a(document).on("tsf-updated-gutenberg-visibility",(a,b)=>f(b));const g=document.querySelector("#visibility .save-post-visibility");g&&g.addEventListener("click",()=>{let b=a("#visibility").find("input:radio:checked").val();if("password"===b){let c=a("#visibility").find("#post_password").val();c&&c.length||(b="public")}f(b)}),b.states.isPrivate?f("private"):b.states.isProtected&&f("password")},j=()=>{const b=()=>{tsfTitle.enqueueUnregisteredInputTrigger(c),tsfDescription.enqueueUnregisteredInputTrigger(d)};a("#tsf-flex-inpost-tab-general").on("tsf-flex-tab-toggled",b),window.addEventListener("tsf-flex-resize",b)},k=()=>{b.states.isGutenbergPage&&("tsfTT"in window&&tsfTT.addBoundary("#editor"),document.addEventListener("tsf-gutenberg-sidebar-opened",()=>{"tsfTT"in window&&tsfTT.addBoundary(".edit-post-sidebar .components-panel")}))},l=()=>{if(!b.states.isGutenbergPage)return;const c=document.querySelector(".tsf-seo-bar"),e=document.querySelector("#tsf-doing-it-right-wrap .tsf-ajax"),f=document.getElementById(d),g=document.getElementById("autodescription_og_description"),h=document.getElementById("autodescription_twitter_description"),i=document.getElementById("autodescription_socialimage-url"),j={seobar:!!c,metadescription:!!f,ogdescription:!!g,twdescription:!!h,imageurl:!!i},k=b=>{switch(b=tsf.convertJSONResponse(b),b.type){case"success":const f=75;setTimeout(()=>{tsfDescription&&tsfDescription.updateStateOf(d,"defaultDescription",b.data.metadescription.trim()),tsfSocial&&(tsfSocial.updateState("ogDescPlaceholder",b.data.ogdescription.trim()),tsfSocial.updateState("twDescPlaceholder",b.data.twdescription.trim())),i.placeholder=tsf.decodeEntities(b.data.imageurl),i.dispatchEvent(new Event("change")),"tsfAys"in window&&tsfAys.reset()},f),a(c).fadeOut(f,()=>{e&&tsf.unsetAjaxLoader(e,!0)}).html(b.data.seobar).fadeIn(500,()=>{"tsfTT"in window&&tsfTT.triggerReset()});break;case"failure":e&&tsf.unsetAjaxLoader(e,!1);break;default:e&&tsf.resetAjaxLoader(e);}},l=()=>{e&&tsf.unsetAjaxLoader(e,!1)};document.addEventListener("tsf-gutenberg-onsave",()=>{e&&tsf.resetAjaxLoader(e),e&&tsf.setAjaxLoader(e);let c={method:"POST",url:ajaxurl,datatype:"json",data:{action:"the_seo_framework_update_post_data",nonce:tsf.l10n.nonces.edit_posts,post_id:b.states.id,get:j},async:!0,timeout:7e3,success:k,error:l};a.ajax(c)})},m=()=>{g(),h(),i(),j()},n=()=>{e(),f(),k(),l(),tsfSocial.initTitleInputs({ref:document.getElementById("tsf-title-reference_"+c),refNa:document.getElementById("tsf-title-noadditions-reference_"+c),meta:document.getElementById(c),og:document.getElementById("autodescription_og_title"),tw:document.getElementById("autodescription_twitter_title")}),tsfSocial.initDescriptionInputs({ref:document.getElementById("tsf-description-reference_"+d),meta:document.getElementById(d),og:document.getElementById("autodescription_og_description"),tw:document.getElementById("autodescription_twitter_description")})};return Object.assign({load:()=>{document.body.addEventListener("tsf-onload",m),document.body.addEventListener("tsf-ready",n)}},{},{l10n:b})}(jQuery),window.tsfPost.load();
lib/js/settings.js CHANGED
@@ -1121,175 +1121,28 @@ window.tsfSettings = function( $ ) {
1121
  * Sets a class to the active element which helps excluding focus rings.
1122
  *
1123
  * @since 4.0.0
 
1124
  * @access private
1125
  *
1126
  * @function
1127
  * @return {(undefined|null)}
1128
  */
1129
  const _initTabs = () => {
1130
-
1131
- let togglePromises = {},
1132
- toggleTarget = {},
1133
- toggleWrap = {},
1134
- toggleContainer = {};
1135
-
1136
- const tabToggledEvent = new CustomEvent( 'tsf-tab-toggled' );
1137
-
1138
- /**
1139
- * Sets correct tab content and classes on toggle.
1140
- *
1141
- * @function
1142
- * @param {Event} event
1143
- * @return {(undefined|null)}
1144
- */
1145
- const tabToggle = ( event ) => {
1146
-
1147
- const currentToggle = event.target;
1148
- const onload = ! event.isTrusted;
1149
-
1150
- // Why is this here? For broken customEvent triggers?
1151
- // if ( ! currentToggle.checked ) return;
1152
-
1153
- const toggleId = event.target.id,
1154
- toggleName = event.target.name;
1155
-
1156
- toggleWrap.hasOwnProperty( toggleName ) || (
1157
- toggleWrap[ toggleName ] = currentToggle.closest( '.tsf-nav-tab-wrapper' )
1158
- );
1159
-
1160
- const activeClass = 'tsf-active-tab-content',
1161
- toggleActiveClass = 'tsf-tab-active',
1162
- previousToggle = toggleWrap[ toggleName ].querySelector( `.${toggleActiveClass}` );
1163
-
1164
- if ( ! onload ) {
1165
- // Perform validity check, this prevents non-invoking hidden browser validation errors.
1166
- const invalidInput = document.querySelector( `.${activeClass} :invalid` );
1167
- if ( invalidInput ) {
1168
- invalidInput.reportValidity();
1169
-
1170
- if ( previousToggle )
1171
- previousToggle.checked = true;
1172
-
1173
- currentToggle.checked = false;
1174
-
1175
- event.stopPropagation();
1176
- event.preventDefault();
1177
- return false; // stop propagation in jQuery.
1178
- }
1179
- }
1180
-
1181
- if ( previousToggle ) {
1182
- previousToggle.classList.remove( toggleActiveClass );
1183
- let label = document.querySelector( `.tsf-nav-tab[for="${previousToggle.id}"]` );
1184
- label && label.classList.remove( 'tsf-no-focus-ring' );
1185
- }
1186
- currentToggle.classList.add( toggleActiveClass );
1187
-
1188
- if ( onload ) {
1189
- const newContent = document.getElementById( `${toggleId}-content` );
1190
-
1191
- if ( newContent && ! newContent.classList.contains( activeClass ) ) {
1192
- const allContent = document.querySelectorAll( `.${toggleName}-content` );
1193
- allContent && allContent.forEach( element => {
1194
- element.classList.remove( activeClass );
1195
- } );
1196
- newContent.classList.add( activeClass );
1197
- }
1198
-
1199
- document.getElementById( toggleId ).dispatchEvent( tabToggledEvent );
1200
- } else {
1201
- if ( ! toggleContainer.hasOwnProperty( toggleName ) ) {
1202
- toggleContainer[ toggleName ] = currentToggle.closest( '.inside' );
1203
- togglePromises[ toggleName ] = void 0;
1204
- }
1205
-
1206
- // Set toggleTarget for (active or upcoming) Promise. This value is set early, so Promises in race conditions will use this.
1207
- toggleTarget[ toggleName ] = toggleId;
1208
-
1209
- // If the promise is running, let it finish and consider the newly set ID.
1210
- if ( 'undefined' !== typeof togglePromises[ toggleName ] ) return;
1211
-
1212
- const fadeOutTimeout = 150;
1213
-
1214
- const $allContent = $( `.${toggleName}-content` );
1215
- const setCorrectTab = () => {
1216
- $( `#${toggleTarget[ toggleName ]}-content` ).stop( false, true ).addClass( activeClass ).fadeIn( 250 );
1217
- toggleContainer[ toggleName ].style.minHeight = '';
1218
- return new Promise( resolve => setTimeout( resolve, fadeOutTimeout ) );
1219
- };
1220
- const lockHeight = () => {
1221
- toggleContainer[ toggleName ].style.minHeight = toggleContainer[ toggleName ].getBoundingClientRect().height;
1222
- }
1223
-
1224
- togglePromises[ toggleName ] = () => new Promise( resolve => {
1225
- // Lock height, so to prevent jumping.
1226
- lockHeight();
1227
-
1228
- // Stop any running animations, and hide the content. Put in $.Deferred so to run the thenable only once.
1229
- $.when( $allContent.stop( false, true ).fadeOut( fadeOutTimeout ) ).then( () => {
1230
- $allContent.removeClass( activeClass );
1231
- resolve();
1232
- } );
1233
- } ).then(
1234
- setCorrectTab
1235
- ).then( () => {
1236
- let toggledContent = document.getElementById( `${toggleTarget[ toggleName ]}-content` );
1237
-
1238
- // Test if the correct tab has been set--otherwise, try again.
1239
- // Resolve if the query fails, so to prevent an infinite loop.
1240
- if ( ! toggledContent || toggledContent.classList.contains( activeClass ) ) {
1241
- document.getElementById( toggleTarget[ toggleName ] ).dispatchEvent( tabToggledEvent );
1242
- togglePromises[ toggleName ] = void 0;
1243
- } else {
1244
- // Lock height to prevent jumping.
1245
- lockHeight();
1246
- // Hide everything instantly. We don't make false promises here.
1247
- $allContent.removeClass( activeClass );
1248
- // Retry self.
1249
- togglePromises[ toggleName ]();
1250
- }
1251
- } );
1252
-
1253
- togglePromises[ toggleName ]();
1254
  }
1255
- }
1256
-
1257
- /**
1258
- * Sets a class to the active element which helps excluding focus rings.
1259
- *
1260
- * @see tabToggle Handles this class.
1261
- *
1262
- * @function
1263
- * @param {Event} event
1264
- * @return {(undefined|null)}
1265
- */
1266
- const addNoFocusClass = event => event.currentTarget.classList.add( 'tsf-no-focus-ring' );
1267
- document.querySelectorAll( '.tsf-nav-tab-wrapper .tsf-nav-tab' ).forEach( el => {
1268
- el.addEventListener( 'click', addNoFocusClass );
1269
- } );
1270
-
1271
- document.querySelectorAll( '.tsf-tabs-radio' ).forEach( el => {
1272
- el.addEventListener( 'change', tabToggle );
1273
- } );
1274
-
1275
- /**
1276
- * Sets the correct tab based on selected radio button prior window.history navigation.
1277
- *
1278
- * @see tabToggle Handles this HTML class.
1279
- *
1280
- * @function
1281
- * @return {(undefined|null)}
1282
- */
1283
- const _correctTabFocus = () => {
1284
- // Don't handle subsequent triggers.
1285
- window.removeEventListener( 'load', _correctTabFocus );
1286
-
1287
- document.querySelectorAll( '.tsf-tabs-radio:checked' ).forEach( el => {
1288
- el.dispatchEvent( new Event( 'change' ) );
1289
- } );
1290
- }
1291
- // Delay the fix, so not to delay the interactive state... even though it causes a page jump. This merely addresses an edge-case.
1292
- window.addEventListener( 'load', _correctTabFocus );
1293
  }
1294
 
1295
  return Object.assign( {
1121
  * Sets a class to the active element which helps excluding focus rings.
1122
  *
1123
  * @since 4.0.0
1124
+ * @since 4.1.3 Now offloaded to tsfTabs.
1125
  * @access private
1126
  *
1127
  * @function
1128
  * @return {(undefined|null)}
1129
  */
1130
  const _initTabs = () => {
1131
+ tsfTabs.initStack(
1132
+ 'tsfSettings',
1133
+ {
1134
+ tabToggledEvent: new CustomEvent( 'tsf-tab-toggled' ),
1135
+ HTMLClasses: {
1136
+ wrapper: 'tsf-nav-tab-wrapper',
1137
+ tabRadio: 'tsf-tabs-radio', // bad name
1138
+ tabLabel: 'tsf-nav-tab',
1139
+ activeTab: 'tsf-tab-active',
1140
+ // TODO make this tsf-tab-active-content (force -content affix?)
1141
+ activeTabContent: 'tsf-active-tab-content',
1142
+ },
1143
+ fixHistory: true, // false for flex? Doesn't seem like it was?
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1144
  }
1145
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1146
  }
1147
 
1148
  return Object.assign( {
lib/js/settings.min.js CHANGED
@@ -1 +1 @@
1
- 'use strict';window.tsfSettings=function(a){const b="undefined"!=typeof tsfSettingsL10n&&tsfSettingsL10n,c=a=>`autodescription-site-settings[${a}]`,d=()=>{const b=a(window),d=document.getElementById(c("display_character_counter"));d&&d.addEventListener("click",a=>{document.querySelectorAll(".tsf-counter-wrap").forEach(b=>{b.style.display=a.target.checked?"":"none"}),a.target.checked&&tsfC.triggerCounterUpdate()});const e=document.getElementById(c("display_pixel_counter"));e&&e.addEventListener("click",a=>{document.querySelectorAll(".tsf-pixel-counter-wrap").forEach(b=>{b.style.display=a.target.checked?"":"none"}),a.target.checked&&tsfC.triggerCounterUpdate()});const f=wp.template("tsf-disabled-post-type-help")(),g=wp.template("tsf-disabled-taxonomy-help")(),h=wp.template("tsf-disabled-taxonomy-from-pt-help")(),i=a=>tsf.escapeString("tsf-disabled-post-type-input-clone-"+a),j=a=>tsf.escapeString("tsf-disabled-taxonomy-input-clone-"+a),k=a=>[document.getElementById(`${c("noindex_post_types")}[${a}]`),document.getElementById(`${c("nofollow_post_types")}[${a}]`),document.getElementById(`${c("noarchive_post_types")}[${a}]`)].filter(a=>a),l=a=>[document.getElementById(`${c("noindex_taxonomies")}[${a}]`),document.getElementById(`${c("nofollow_taxonomies")}[${a}]`),document.getElementById(`${c("noarchive_taxonomies")}[${a}]`)].filter(a=>a),m=(b,c)=>{c?(k(b).forEach(c=>{if(c){let d=c.cloneNode(!0);d.type="hidden",d.value=c.checked?c.value:"",d.id+="-cloned",d.classList.add(i(b)),c.disabled=!0,c.dataset.disabledWarning=1,a(c.closest("label")).append(f).append(d)}}),tsfTT.triggerReset()):k(b).forEach(a=>{a&&a.dataset.disabledWarning&&(a.closest("label").querySelector(".tsf-post-type-warning").remove(),document.querySelectorAll("."+i(b)).forEach(a=>{a.remove()}),a.disabled=!1,a.dataset.disabledWarning="")})},n=(b,c)=>{c?(l(b).forEach(c=>{if(c){let d=c.cloneNode(!0);d.type="hidden",d.value=c.checked?c.value:"",d.id+="-cloned",d.classList.add(j(b)),c.disabled=!0,c.dataset.disabledWarning=1,a(c.closest("label")).append(g).append(d)}}),tsfTT.triggerReset()):l(b).forEach(a=>{a&&a.dataset.disabledWarning&&(a.closest("label").querySelector(".tsf-taxonomy-warning").remove(),document.querySelectorAll("."+j(b)).forEach(a=>{a.remove()}),a.disabled=!1,a.dataset.disabledWarning="")})},o=(b,d)=>{let e=document.getElementById(`${c("disabled_taxonomies")}[${b}]`);d?(a(e.closest("label")).append(h),tsfTT.triggerReset()):e.closest("label").querySelector(".tsf-taxonomy-from-pt-warning").remove()},p=new Set,q=new Set,r=new Set,s=new Set,t=()=>{let a=document.querySelectorAll(".tsf-excluded-taxonomies"),b=!1;a.forEach(a=>{let c=a.name.split(/(?:.+\[)(.+?)(?:])/).join(""),d=JSON.parse(a.dataset.postTypes),e=d.every(a=>p.has(a));e?(!s.has(c)&&(b=!0),s.add(c)):s.has(c)&&(s.delete(c),b=!0),b&&w(c)})};let u=new Map;const v=a=>u.get(a)||new Set;b.on("tsf-post-type-support-changed",(a,b)=>{m(b,p.has(b)),t()}),b.on("tsf-taxonomy-support-changed",(a,b)=>{v("excludedTaxonomiesAll").size!==r.size&&n(b,r.has(b)),v("excludedPtTaxonomies").size!==s.size&&o(b,s.has(b)),u.set("excludedTaxonomiesAll",new Set(r)),u.set("excludedTaxonomies",new Set(q)),u.set("excludedPtTaxonomies",new Set(s))});const w=a=>{r.clear(),q.forEach(a=>r.add(a)),s.forEach(a=>r.add(a)),b.trigger("tsf-taxonomy-support-changed",[a,r,q,s])};let x=!1;const y=a=>{if(a.target.name){let c=a.target.name.split(/(?:.+\[)(.+?)(?:])/).join("");a.target.checked?(p.add(c),b.trigger("tsf-post-type-support-changed",[c,p])):x&&(p.delete(c),b.trigger("tsf-post-type-support-changed",[c,p]))}},z=a=>{if(a.target.name){let b=a.target.name.split(/(?:.+\[)(.+?)(?:])/).join("");a.target.checked?(q.add(b),w(b)):x&&(q.delete(b),w(b))}},A=new Event("change");document.querySelectorAll(".tsf-excluded-post-types").forEach(a=>{a.addEventListener("change",y),a.dispatchEvent(A)}),document.querySelectorAll(".tsf-excluded-taxonomies").forEach(a=>{a.addEventListener("change",z),a.dispatchEvent(A)}),x=!0},e=()=>{document.querySelectorAll(".tsf-color-picker").forEach(b=>{let c=a(b),d="",e=c.data("tsf-default-color");c.wpColorPicker({defaultColor:e,width:238,change:()=>{d=c.wpColorPicker("color"),""===d&&(d=e),b.value=e,tsfAys.registerChange()},clear:()=>{e.length&&(b.value=e,c.closest(".wp-picker-container").find(".wp-color-result").css("backgroundColor",e)),tsfAys.registerChange()},palettes:!1})})},f=()=>{const b=document.getElementById(c("title_rem_additions")),d=document.getElementById(c("social_title_rem_additions")),e=wp.template("tsf-disabled-title-additions-help")();b&&(b.addEventListener("change",()=>{b.checked?(document.querySelectorAll(".tsf-title-additions-js").forEach(a=>a.style.display="none"),d&&(d.dataset.disabledWarning=1,a(d.closest("label")).append(e),tsfTT.triggerReset())):(document.querySelectorAll(".tsf-title-additions-js").forEach(a=>a.style.display="inline"),d&&d.dataset.disabledWarning&&d.closest("label").querySelector(".tsf-title-additions-warning").remove())}),b.dispatchEvent(new Event("change")));const f=a=>{let b="left"===a.target.value;document.querySelectorAll(".tsf-title-additions-example-left").forEach(a=>{a.style.display=b?"inline":"none"}),document.querySelectorAll(".tsf-title-additions-example-right").forEach(a=>{a.style.display=b?"none":"inline"})};document.querySelectorAll("#tsf-title-location input").forEach(a=>{a.addEventListener("click",f)});const g=document.getElementById(c("title_rem_prefixes"));g&&g.addEventListener("click",a=>{document.querySelectorAll(".tsf-title-prefix-example").forEach(b=>{b.style.display=a.target.checked?"none":"inline"})});const h=a=>{const b=tsf.decodeEntities(a.target.dataset.entity),c="tsf-title-separator-active";document.querySelectorAll(".tsf-sep-js").forEach(a=>{a.innerText=` ${b} `}),window.dispatchEvent(new CustomEvent("tsf-title-sep-updated",{detail:{separator:b}}));let d=document.querySelector(`.${c}`);d&&d.classList.remove(c,"tsf-no-focus-ring");let e=document.querySelector(`label[for="${a.target.id}"]`);e&&e.classList.add(c)};document.querySelectorAll("#tsf-title-separator input").forEach(a=>{a.addEventListener("click",h)});const i=a=>{a.target.classList.add("tsf-no-focus-ring")};document.querySelectorAll("#tsf-title-separator label").forEach(a=>{a.addEventListener("click",i)})},g=()=>{const d=c("homepage_title"),e=document.getElementById(d),f=document.getElementById(c("homepage_title_tagline")),g=document.getElementById(c("homepage_tagline"));tsfTitle.setInputElement(e);let h=JSON.parse(document.getElementById("tsf-title-data_"+d).dataset.state);tsfTitle.updateStateOf(d,"allowReferenceChange",!h.refTitleLocked),tsfTitle.updateStateOf(d,"defaultTitle",h.defaultTitle.trim()),tsfTitle.updateStateOf(d,"addAdditions",h.addAdditions),tsfTitle.updateStateOf(d,"useSocialTagline",!!(h.useSocialTagline||!1)),tsfTitle.updateStateOf(d,"additionValue",h.additionValue.trim()),tsfTitle.updateStateOf(d,"additionPlacement",h.additionPlacement),tsfTitle.updateStateOf(d,"hasLegacy",!!(h.hasLegacy||!1)),tsfTitle.enqueueUnregisteredInputTrigger(d);const i=a=>{let b=tsfTitle.getStateOf(d,"additionPlacement"),c="left"===a.target.value?"before":"after";c!==b&&tsfTitle.updateStateOf(d,"additionPlacement",c)};document.querySelectorAll("#tsf-home-title-location input").forEach(a=>{a.addEventListener("click",i)});const j=a=>{let b=tsfTitle.getStateOf(d,"prefixValue"),c="";switch(a){case"password":c=tsfTitle.protectedPrefix;break;case"private":c=tsfTitle.privatePrefix;break;default:case"public":c="";}c!==b&&tsfTitle.updateStateOf(d,"prefixValue",c)};b.states.isFrontPrivate?j("private"):b.states.isFrontProtected&&j("password");e.addEventListener("input",a=>{let b=document.querySelectorAll(".tsf-custom-title-js"),c=tsf.decodeEntities(tsf.sDoubleSpace(a.target.value.trim()));c.length?(c=tsf.escapeString(c),b.forEach(a=>a.innerHTML=c)):(c=tsf.escapeString(tsf.decodeEntities(tsfTitle.getStateOf(d,"defaultTitle"))),b.forEach(a=>a.innerHTML=c))}),e.dispatchEvent(new Event("input"));let k,l=a(".tsf-custom-tagline-js");const m=()=>{clearTimeout(k),k=setTimeout(()=>{let b=tsfTitle.getStateOf(d,"additionValue");b=tsf.decodeEntities(tsf.sDoubleSpace(b.trim())),b.length&&tsfTitle.getStateOf(d,"addAdditions")?(l.html(tsf.escapeString(b)),a(".tsf-custom-blogname-js").show()):a(".tsf-custom-blogname-js").hide()})};f.addEventListener("input",()=>{let a=tsfTitle.getStateOf(d,"additionValue"),b=f.value.trim();b.length||(b=f.placeholder||""),b=tsf.escapeString(tsf.decodeEntities(b.trim())),a!==b&&(tsfTitle.updateStateOf(d,"additionValue",b),m())}),f.dispatchEvent(new Event("input"));g.addEventListener("change",a=>{let b=!1;a.target.checked?(b=!0,f.readOnly=!1):(b=!1,f.readOnly=!0),tsfTitle.updateStateOf(d,"addAdditions",b),m()}),g.dispatchEvent(new Event("change"));window.addEventListener("tsf-title-sep-updated",a=>{tsfTitle.updateStateAll("separator",a.detail.separator)})},h=()=>{const a=c("homepage_description");let b=JSON.parse(document.getElementById("tsf-description-data_"+a).dataset.state);tsfDescription.setInputElement(document.getElementById(a)),tsfDescription.updateStateOf(a,"defaultDescription",b.defaultDescription.trim()),tsfDescription.updateStateOf(a,"hasLegacy",!!(b.hasLegacy||!1)),tsfDescription.enqueueUnregisteredInputTrigger(a)},i=()=>{const b=()=>{tsfTitle.enqueueUnregisteredInputTrigger(c("homepage_title")),tsfDescription.enqueueUnregisteredInputTrigger(c("homepage_description"))};a(document).on("postbox-toggled",function(a,c){if("autodescription-homepage-settings"===c.id){let a=c.querySelector(".inside");0<a.offsetHeight&&0<a.offsetWidth&&b()}});const d=document.getElementById("tsf-homepage-tab-general");d&&d.addEventListener("tsf-tab-toggled",b)},j=()=>{const a=document.getElementById(c("social_title_rem_additions"));a&&a.addEventListener("change",a=>{a.target.checked?tsfTitle.updateStateAll("useSocialTagline",!1):tsfTitle.updateStateAll("useSocialTagline",!0)})},k=()=>{const b=document.getElementById(c("set_copyright_directives"));if(b){const a=["max_snippet_length","max_image_preview","max_video_preview"].map(a=>document.getElementById(c(a))),d="tsf-toggle-directives-surrogate";b.addEventListener("change",b=>{b.target.checked?(a.forEach(a=>a.disabled=!1),document.querySelectorAll(`.${d}`).forEach(a=>a.remove())):a.forEach(a=>{a.disabled=!0;let b=document.createElement("input");b.type="hidden",b.name=a.name||"",b.value=a.value||0,b.classList.add(d),a.insertAdjacentElement("afterend",b)})}),b.dispatchEvent(new Event("change"))}const d=a(window),e=wp.template("tsf-robots-pt-help")(),f={},g={};[f,g].forEach(a=>{a.noindex=new Set,a.nofollow=new Set,a.noarchive=new Set});const h=(b,d,f)=>{let g=document.getElementById(`${c(`${d}_taxonomies`)}[${b}]`);f?(a(g.closest("label")).append(e),tsfTT.triggerReset()):g.closest("label").querySelector(".tsf-taxonomy-from-pt-robots-warning").remove(),m(b)},i=a=>{let b=document.querySelectorAll(`.tsf-robots-taxonomies[data-robots="${a}"]`),c=!1;b.forEach(b=>{let d=b.name.split(/(?:.+\[)(.+?)(?:])/).join(""),e=JSON.parse(b.dataset.postTypes),h=e.every(b=>f[a].has(b));h?(!g[a].has(d)&&(c=!0),g[a].add(d)):g[a].has(d)&&(g[a].delete(d),c=!0),c&&l(d,a)})};let j={noindex:new Map,nofollow:new Map,noarchive:new Map};const k=(a,b)=>j[b].get(a)||new Set;d.on("tsf-post-type-robots-changed",(a,b,c)=>{i(c)}),d.on("tsf-taxonomy-robots-changed",(a,b,c)=>{k("robotsPtTaxonomies",c).size!==g[c].size&&h(b,c,g[c].has(b)),j[c].set("robotsPtTaxonomies",new Set(g[c]))});const l=(a,b)=>{d.trigger("tsf-taxonomy-robots-changed",[a,b,g[b]])},m=a=>{for(let b in g)if(g[b].has(a)){let d=document.getElementById(`${c(`${b}_taxonomies`)}[${a}]`),e=d.closest("label").querySelector(".tsf-taxonomy-from-pt-robots-warning");e.style.display=d.dataset.disabledWarning?"none":""}};d.on("tsf-taxonomy-support-changed",(a,b)=>m(b));let n=!1;const o=a=>{if(a.target.name){let b=a.target.name.split(/(?:.+\[)(.+?)(?:])/).join(""),c=a.target.dataset.robots;a.target.checked?(f[c].add(b),d.trigger("tsf-post-type-robots-changed",[b,c,f[c]])):n&&(f[c].delete(b),d.trigger("tsf-post-type-robots-changed",[b,c,f[c]]))}},p=new Event("change");document.querySelectorAll(".tsf-robots-post-types").forEach(a=>{a.addEventListener("change",o),a.dispatchEvent(p)}),n=!0},l=()=>{const a=["google_verification","bing_verification","yandex_verification","baidu_verification","pint_verification"].map(a=>document.getElementById(c(a))),b=a=>{let b=a.clipboardData&&a.clipboardData.getData("text")||"";if(b){let c=/<meta[^>]+content=(\"|\')?([^\"\'>\s]+)\1?.*?>/i.exec(b);c&&2 in c&&"string"==typeof c[2]&&c[2].length&&(a.stopPropagation(),a.preventDefault(),a.target.value=c[2],tsfAys.registerChange())}};a.forEach(a=>a.addEventListener("paste",b))},m=()=>{d(),f(),g(),h(),i(),j(),k(),l(),e()},n=()=>{const a=c("homepage_title"),b=c("homepage_description");tsfSocial.initTitleInputs({ref:document.getElementById("tsf-title-reference_"+a),refNa:document.getElementById("tsf-title-noadditions-reference_"+a),meta:document.getElementById(a),og:document.getElementById(c("homepage_og_title")),tw:document.getElementById(c("homepage_twitter_title"))}),tsfSocial.initDescriptionInputs({ref:document.getElementById("tsf-description-reference_"+b),meta:document.getElementById(b),og:document.getElementById(c("homepage_og_description")),tw:document.getElementById(c("homepage_twitter_description"))})},o=()=>{let b={},c={},d={},e={};const f=new CustomEvent("tsf-tab-toggled"),g=g=>{const h=g.target,i=!g.isTrusted,j=g.target.id,k=g.target.name;d.hasOwnProperty(k)||(d[k]=h.closest(".tsf-nav-tab-wrapper"));const l="tsf-active-tab-content",m="tsf-tab-active",n=d[k].querySelector(`.${m}`);if(!i){const a=document.querySelector(`.${l} :invalid`);if(a)return a.reportValidity(),n&&(n.checked=!0),h.checked=!1,g.stopPropagation(),g.preventDefault(),!1}if(n){n.classList.remove(m);let a=document.querySelector(`.tsf-nav-tab[for="${n.id}"]`);a&&a.classList.remove("tsf-no-focus-ring")}if(h.classList.add(m),i){const a=document.getElementById(`${j}-content`);if(a&&!a.classList.contains(l)){const b=document.querySelectorAll(`.${k}-content`);b&&b.forEach(a=>{a.classList.remove(l)}),a.classList.add(l)}document.getElementById(j).dispatchEvent(f)}else{if(e.hasOwnProperty(k)||(e[k]=h.closest(".inside"),b[k]=void 0),c[k]=j,"undefined"!=typeof b[k])return;const d=150,g=a(`.${k}-content`),i=()=>(a(`#${c[k]}-content`).stop(!1,!0).addClass(l).fadeIn(250),e[k].style.minHeight="",new Promise(a=>setTimeout(a,d))),m=()=>{e[k].style.minHeight=e[k].getBoundingClientRect().height};b[k]=()=>new Promise(b=>{m(),a.when(g.stop(!1,!0).fadeOut(d)).then(()=>{g.removeClass(l),b()})}).then(i).then(()=>{let a=document.getElementById(`${c[k]}-content`);!a||a.classList.contains(l)?(document.getElementById(c[k]).dispatchEvent(f),b[k]=void 0):(m(),g.removeClass(l),b[k]())}),b[k]()}},h=a=>a.currentTarget.classList.add("tsf-no-focus-ring");document.querySelectorAll(".tsf-nav-tab-wrapper .tsf-nav-tab").forEach(a=>{a.addEventListener("click",h)}),document.querySelectorAll(".tsf-tabs-radio").forEach(a=>{a.addEventListener("change",g)});const i=()=>{window.removeEventListener("load",i),document.querySelectorAll(".tsf-tabs-radio:checked").forEach(a=>{a.dispatchEvent(new Event("change"))})};window.addEventListener("load",i)};return Object.assign({load:()=>{a("div.updated, div.error, div.notice, .notice-error, .notice-warning, .notice-info").insertAfter(".wp-header-end"),document.body.addEventListener("tsf-onload",m),document.body.addEventListener("tsf-ready",n),o()}},{},{l10n:b})}(jQuery),window.tsfSettings.load();
1
+ 'use strict';window.tsfSettings=function(a){const b="undefined"!=typeof tsfSettingsL10n&&tsfSettingsL10n,c=a=>`autodescription-site-settings[${a}]`,d=()=>{const b=a(window),d=document.getElementById(c("display_character_counter"));d&&d.addEventListener("click",a=>{document.querySelectorAll(".tsf-counter-wrap").forEach(b=>{b.style.display=a.target.checked?"":"none"}),a.target.checked&&tsfC.triggerCounterUpdate()});const e=document.getElementById(c("display_pixel_counter"));e&&e.addEventListener("click",a=>{document.querySelectorAll(".tsf-pixel-counter-wrap").forEach(b=>{b.style.display=a.target.checked?"":"none"}),a.target.checked&&tsfC.triggerCounterUpdate()});const f=wp.template("tsf-disabled-post-type-help")(),g=wp.template("tsf-disabled-taxonomy-help")(),h=wp.template("tsf-disabled-taxonomy-from-pt-help")(),i=a=>tsf.escapeString("tsf-disabled-post-type-input-clone-"+a),j=a=>tsf.escapeString("tsf-disabled-taxonomy-input-clone-"+a),k=a=>[document.getElementById(`${c("noindex_post_types")}[${a}]`),document.getElementById(`${c("nofollow_post_types")}[${a}]`),document.getElementById(`${c("noarchive_post_types")}[${a}]`)].filter(a=>a),l=a=>[document.getElementById(`${c("noindex_taxonomies")}[${a}]`),document.getElementById(`${c("nofollow_taxonomies")}[${a}]`),document.getElementById(`${c("noarchive_taxonomies")}[${a}]`)].filter(a=>a),m=(b,c)=>{c?(k(b).forEach(c=>{if(c){let d=c.cloneNode(!0);d.type="hidden",d.value=c.checked?c.value:"",d.id+="-cloned",d.classList.add(i(b)),c.disabled=!0,c.dataset.disabledWarning=1,a(c.closest("label")).append(f).append(d)}}),tsfTT.triggerReset()):k(b).forEach(a=>{a&&a.dataset.disabledWarning&&(a.closest("label").querySelector(".tsf-post-type-warning").remove(),document.querySelectorAll("."+i(b)).forEach(a=>{a.remove()}),a.disabled=!1,a.dataset.disabledWarning="")})},n=(b,c)=>{c?(l(b).forEach(c=>{if(c){let d=c.cloneNode(!0);d.type="hidden",d.value=c.checked?c.value:"",d.id+="-cloned",d.classList.add(j(b)),c.disabled=!0,c.dataset.disabledWarning=1,a(c.closest("label")).append(g).append(d)}}),tsfTT.triggerReset()):l(b).forEach(a=>{a&&a.dataset.disabledWarning&&(a.closest("label").querySelector(".tsf-taxonomy-warning").remove(),document.querySelectorAll("."+j(b)).forEach(a=>{a.remove()}),a.disabled=!1,a.dataset.disabledWarning="")})},o=(b,d)=>{let e=document.getElementById(`${c("disabled_taxonomies")}[${b}]`);d?(a(e.closest("label")).append(h),tsfTT.triggerReset()):e.closest("label").querySelector(".tsf-taxonomy-from-pt-warning").remove()},p=new Set,q=new Set,r=new Set,s=new Set,t=()=>{let a=document.querySelectorAll(".tsf-excluded-taxonomies"),b=!1;a.forEach(a=>{let c=a.name.split(/(?:.+\[)(.+?)(?:])/).join(""),d=JSON.parse(a.dataset.postTypes),e=d.every(a=>p.has(a));e?(!s.has(c)&&(b=!0),s.add(c)):s.has(c)&&(s.delete(c),b=!0),b&&w(c)})};let u=new Map;const v=a=>u.get(a)||new Set;b.on("tsf-post-type-support-changed",(a,b)=>{m(b,p.has(b)),t()}),b.on("tsf-taxonomy-support-changed",(a,b)=>{v("excludedTaxonomiesAll").size!==r.size&&n(b,r.has(b)),v("excludedPtTaxonomies").size!==s.size&&o(b,s.has(b)),u.set("excludedTaxonomiesAll",new Set(r)),u.set("excludedTaxonomies",new Set(q)),u.set("excludedPtTaxonomies",new Set(s))});const w=a=>{r.clear(),q.forEach(a=>r.add(a)),s.forEach(a=>r.add(a)),b.trigger("tsf-taxonomy-support-changed",[a,r,q,s])};let x=!1;const y=a=>{if(a.target.name){let c=a.target.name.split(/(?:.+\[)(.+?)(?:])/).join("");a.target.checked?(p.add(c),b.trigger("tsf-post-type-support-changed",[c,p])):x&&(p.delete(c),b.trigger("tsf-post-type-support-changed",[c,p]))}},z=a=>{if(a.target.name){let b=a.target.name.split(/(?:.+\[)(.+?)(?:])/).join("");a.target.checked?(q.add(b),w(b)):x&&(q.delete(b),w(b))}},A=new Event("change");document.querySelectorAll(".tsf-excluded-post-types").forEach(a=>{a.addEventListener("change",y),a.dispatchEvent(A)}),document.querySelectorAll(".tsf-excluded-taxonomies").forEach(a=>{a.addEventListener("change",z),a.dispatchEvent(A)}),x=!0},e=()=>{document.querySelectorAll(".tsf-color-picker").forEach(b=>{let c=a(b),d="",e=c.data("tsf-default-color");c.wpColorPicker({defaultColor:e,width:238,change:()=>{d=c.wpColorPicker("color"),""===d&&(d=e),b.value=e,tsfAys.registerChange()},clear:()=>{e.length&&(b.value=e,c.closest(".wp-picker-container").find(".wp-color-result").css("backgroundColor",e)),tsfAys.registerChange()},palettes:!1})})},f=()=>{const b=document.getElementById(c("title_rem_additions")),d=document.getElementById(c("social_title_rem_additions")),e=wp.template("tsf-disabled-title-additions-help")();b&&(b.addEventListener("change",()=>{b.checked?(document.querySelectorAll(".tsf-title-additions-js").forEach(a=>a.style.display="none"),d&&(d.dataset.disabledWarning=1,a(d.closest("label")).append(e),tsfTT.triggerReset())):(document.querySelectorAll(".tsf-title-additions-js").forEach(a=>a.style.display="inline"),d&&d.dataset.disabledWarning&&d.closest("label").querySelector(".tsf-title-additions-warning").remove())}),b.dispatchEvent(new Event("change")));const f=a=>{let b="left"===a.target.value;document.querySelectorAll(".tsf-title-additions-example-left").forEach(a=>{a.style.display=b?"inline":"none"}),document.querySelectorAll(".tsf-title-additions-example-right").forEach(a=>{a.style.display=b?"none":"inline"})};document.querySelectorAll("#tsf-title-location input").forEach(a=>{a.addEventListener("click",f)});const g=document.getElementById(c("title_rem_prefixes"));g&&g.addEventListener("click",a=>{document.querySelectorAll(".tsf-title-prefix-example").forEach(b=>{b.style.display=a.target.checked?"none":"inline"})});const h=a=>{const b=tsf.decodeEntities(a.target.dataset.entity),c="tsf-title-separator-active";document.querySelectorAll(".tsf-sep-js").forEach(a=>{a.innerText=` ${b} `}),window.dispatchEvent(new CustomEvent("tsf-title-sep-updated",{detail:{separator:b}}));let d=document.querySelector(`.${c}`);d&&d.classList.remove(c,"tsf-no-focus-ring");let e=document.querySelector(`label[for="${a.target.id}"]`);e&&e.classList.add(c)};document.querySelectorAll("#tsf-title-separator input").forEach(a=>{a.addEventListener("click",h)});const i=a=>{a.target.classList.add("tsf-no-focus-ring")};document.querySelectorAll("#tsf-title-separator label").forEach(a=>{a.addEventListener("click",i)})},g=()=>{const d=c("homepage_title"),e=document.getElementById(d),f=document.getElementById(c("homepage_title_tagline")),g=document.getElementById(c("homepage_tagline"));tsfTitle.setInputElement(e);let h=JSON.parse(document.getElementById("tsf-title-data_"+d).dataset.state);tsfTitle.updateStateOf(d,"allowReferenceChange",!h.refTitleLocked),tsfTitle.updateStateOf(d,"defaultTitle",h.defaultTitle.trim()),tsfTitle.updateStateOf(d,"addAdditions",h.addAdditions),tsfTitle.updateStateOf(d,"useSocialTagline",!!(h.useSocialTagline||!1)),tsfTitle.updateStateOf(d,"additionValue",h.additionValue.trim()),tsfTitle.updateStateOf(d,"additionPlacement",h.additionPlacement),tsfTitle.updateStateOf(d,"hasLegacy",!!(h.hasLegacy||!1)),tsfTitle.enqueueUnregisteredInputTrigger(d);const i=a=>{let b=tsfTitle.getStateOf(d,"additionPlacement"),c="left"===a.target.value?"before":"after";c!==b&&tsfTitle.updateStateOf(d,"additionPlacement",c)};document.querySelectorAll("#tsf-home-title-location input").forEach(a=>{a.addEventListener("click",i)});const j=a=>{let b=tsfTitle.getStateOf(d,"prefixValue"),c="";switch(a){case"password":c=tsfTitle.protectedPrefix;break;case"private":c=tsfTitle.privatePrefix;break;default:case"public":c="";}c!==b&&tsfTitle.updateStateOf(d,"prefixValue",c)};b.states.isFrontPrivate?j("private"):b.states.isFrontProtected&&j("password");e.addEventListener("input",a=>{let b=document.querySelectorAll(".tsf-custom-title-js"),c=tsf.decodeEntities(tsf.sDoubleSpace(a.target.value.trim()));c.length?(c=tsf.escapeString(c),b.forEach(a=>a.innerHTML=c)):(c=tsf.escapeString(tsf.decodeEntities(tsfTitle.getStateOf(d,"defaultTitle"))),b.forEach(a=>a.innerHTML=c))}),e.dispatchEvent(new Event("input"));let k,l=a(".tsf-custom-tagline-js");const m=()=>{clearTimeout(k),k=setTimeout(()=>{let b=tsfTitle.getStateOf(d,"additionValue");b=tsf.decodeEntities(tsf.sDoubleSpace(b.trim())),b.length&&tsfTitle.getStateOf(d,"addAdditions")?(l.html(tsf.escapeString(b)),a(".tsf-custom-blogname-js").show()):a(".tsf-custom-blogname-js").hide()})};f.addEventListener("input",()=>{let a=tsfTitle.getStateOf(d,"additionValue"),b=f.value.trim();b.length||(b=f.placeholder||""),b=tsf.escapeString(tsf.decodeEntities(b.trim())),a!==b&&(tsfTitle.updateStateOf(d,"additionValue",b),m())}),f.dispatchEvent(new Event("input"));g.addEventListener("change",a=>{let b=!1;a.target.checked?(b=!0,f.readOnly=!1):(b=!1,f.readOnly=!0),tsfTitle.updateStateOf(d,"addAdditions",b),m()}),g.dispatchEvent(new Event("change"));window.addEventListener("tsf-title-sep-updated",a=>{tsfTitle.updateStateAll("separator",a.detail.separator)})},h=()=>{const a=c("homepage_description");let b=JSON.parse(document.getElementById("tsf-description-data_"+a).dataset.state);tsfDescription.setInputElement(document.getElementById(a)),tsfDescription.updateStateOf(a,"defaultDescription",b.defaultDescription.trim()),tsfDescription.updateStateOf(a,"hasLegacy",!!(b.hasLegacy||!1)),tsfDescription.enqueueUnregisteredInputTrigger(a)},i=()=>{const b=()=>{tsfTitle.enqueueUnregisteredInputTrigger(c("homepage_title")),tsfDescription.enqueueUnregisteredInputTrigger(c("homepage_description"))};a(document).on("postbox-toggled",function(a,c){if("autodescription-homepage-settings"===c.id){let a=c.querySelector(".inside");0<a.offsetHeight&&0<a.offsetWidth&&b()}});const d=document.getElementById("tsf-homepage-tab-general");d&&d.addEventListener("tsf-tab-toggled",b)},j=()=>{const a=document.getElementById(c("social_title_rem_additions"));a&&a.addEventListener("change",a=>{a.target.checked?tsfTitle.updateStateAll("useSocialTagline",!1):tsfTitle.updateStateAll("useSocialTagline",!0)})},k=()=>{const b=document.getElementById(c("set_copyright_directives"));if(b){const a=["max_snippet_length","max_image_preview","max_video_preview"].map(a=>document.getElementById(c(a))),d="tsf-toggle-directives-surrogate";b.addEventListener("change",b=>{b.target.checked?(a.forEach(a=>a.disabled=!1),document.querySelectorAll(`.${d}`).forEach(a=>a.remove())):a.forEach(a=>{a.disabled=!0;let b=document.createElement("input");b.type="hidden",b.name=a.name||"",b.value=a.value||0,b.classList.add(d),a.insertAdjacentElement("afterend",b)})}),b.dispatchEvent(new Event("change"))}const d=a(window),e=wp.template("tsf-robots-pt-help")(),f={},g={};[f,g].forEach(a=>{a.noindex=new Set,a.nofollow=new Set,a.noarchive=new Set});const h=(b,d,f)=>{let g=document.getElementById(`${c(`${d}_taxonomies`)}[${b}]`);f?(a(g.closest("label")).append(e),tsfTT.triggerReset()):g.closest("label").querySelector(".tsf-taxonomy-from-pt-robots-warning").remove(),m(b)},i=a=>{let b=document.querySelectorAll(`.tsf-robots-taxonomies[data-robots="${a}"]`),c=!1;b.forEach(b=>{let d=b.name.split(/(?:.+\[)(.+?)(?:])/).join(""),e=JSON.parse(b.dataset.postTypes),h=e.every(b=>f[a].has(b));h?(!g[a].has(d)&&(c=!0),g[a].add(d)):g[a].has(d)&&(g[a].delete(d),c=!0),c&&l(d,a)})};let j={noindex:new Map,nofollow:new Map,noarchive:new Map};const k=(a,b)=>j[b].get(a)||new Set;d.on("tsf-post-type-robots-changed",(a,b,c)=>{i(c)}),d.on("tsf-taxonomy-robots-changed",(a,b,c)=>{k("robotsPtTaxonomies",c).size!==g[c].size&&h(b,c,g[c].has(b)),j[c].set("robotsPtTaxonomies",new Set(g[c]))});const l=(a,b)=>{d.trigger("tsf-taxonomy-robots-changed",[a,b,g[b]])},m=a=>{for(let b in g)if(g[b].has(a)){let d=document.getElementById(`${c(`${b}_taxonomies`)}[${a}]`),e=d.closest("label").querySelector(".tsf-taxonomy-from-pt-robots-warning");e.style.display=d.dataset.disabledWarning?"none":""}};d.on("tsf-taxonomy-support-changed",(a,b)=>m(b));let n=!1;const o=a=>{if(a.target.name){let b=a.target.name.split(/(?:.+\[)(.+?)(?:])/).join(""),c=a.target.dataset.robots;a.target.checked?(f[c].add(b),d.trigger("tsf-post-type-robots-changed",[b,c,f[c]])):n&&(f[c].delete(b),d.trigger("tsf-post-type-robots-changed",[b,c,f[c]]))}},p=new Event("change");document.querySelectorAll(".tsf-robots-post-types").forEach(a=>{a.addEventListener("change",o),a.dispatchEvent(p)}),n=!0},l=()=>{const a=["google_verification","bing_verification","yandex_verification","baidu_verification","pint_verification"].map(a=>document.getElementById(c(a))),b=a=>{let b=a.clipboardData&&a.clipboardData.getData("text")||"";if(b){let c=/<meta[^>]+content=(\"|\')?([^\"\'>\s]+)\1?.*?>/i.exec(b);c&&2 in c&&"string"==typeof c[2]&&c[2].length&&(a.stopPropagation(),a.preventDefault(),a.target.value=c[2],tsfAys.registerChange())}};a.forEach(a=>a.addEventListener("paste",b))},m=()=>{d(),f(),g(),h(),i(),j(),k(),l(),e()},n=()=>{const a=c("homepage_title"),b=c("homepage_description");tsfSocial.initTitleInputs({ref:document.getElementById("tsf-title-reference_"+a),refNa:document.getElementById("tsf-title-noadditions-reference_"+a),meta:document.getElementById(a),og:document.getElementById(c("homepage_og_title")),tw:document.getElementById(c("homepage_twitter_title"))}),tsfSocial.initDescriptionInputs({ref:document.getElementById("tsf-description-reference_"+b),meta:document.getElementById(b),og:document.getElementById(c("homepage_og_description")),tw:document.getElementById(c("homepage_twitter_description"))})},o=()=>{tsfTabs.initStack("tsfSettings",{tabToggledEvent:new CustomEvent("tsf-tab-toggled"),HTMLClasses:{wrapper:"tsf-nav-tab-wrapper",tabRadio:"tsf-tabs-radio",tabLabel:"tsf-nav-tab",activeTab:"tsf-tab-active",activeTabContent:"tsf-active-tab-content"},fixHistory:!0})};return Object.assign({load:()=>{a("div.updated, div.error, div.notice, .notice-error, .notice-warning, .notice-info").insertAfter(".wp-header-end"),document.body.addEventListener("tsf-onload",m),document.body.addEventListener("tsf-ready",n),o()}},{},{l10n:b})}(jQuery),window.tsfSettings.load();
lib/js/tabs.js ADDED
@@ -0,0 +1,372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * This file holds The SEO Framework plugin's JS code for the UI Tabs.
3
+ * Serve JavaScript as an addition, not as an ends or means.
4
+ *
5
+ * @author Sybre Waaijer <https://cyberwire.nl/>
6
+ * @link <https://wordpress.org/plugins/autodescription/>
7
+ */
8
+
9
+ /**
10
+ * The SEO Framework plugin
11
+ * Copyright (C) 2020 Sybre Waaijer, CyberWire (https://cyberwire.nl/)
12
+ *
13
+ * This program is free software: you can redistribute it and/or modify
14
+ * it under the terms of the GNU General Public License version 3 as published
15
+ * by the Free Software Foundation.
16
+ *
17
+ * This program is distributed in the hope that it will be useful,
18
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ * GNU General Public License for more details.
21
+ *
22
+ * You should have received a copy of the GNU General Public License
23
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
24
+ */
25
+
26
+ 'use strict';
27
+
28
+ /**
29
+ * Holds tsfTabs values in an object to avoid polluting global namespace.
30
+ *
31
+ * No jQuery. Cool.
32
+ *
33
+ * @since 4.1.3
34
+ *
35
+ * @constructor
36
+ */
37
+ window.tsfTabs = function() {
38
+
39
+ /**
40
+ * Data property injected by WordPress l10n handler.
41
+ *
42
+ * @since 4.1.3
43
+ * @access public
44
+ * @type {(Object<string, *>)|boolean|null} l10n Localized strings
45
+ */
46
+ const l10n = 'undefined' !== typeof tsfTabsL10n && tsfTabsL10n;
47
+
48
+ /**
49
+ * @since 4.1.3
50
+ * @access protected (readonly)
51
+ * @see tsfTabs.getStack()
52
+ * @type {(Map<string,*>)} The argument stack for ID.
53
+ */
54
+ const tabStack = new Map();
55
+
56
+ /**
57
+ * @since 4.1.3
58
+ * @access private
59
+ * @type {(Map<string,*>)} The cache.
60
+ */
61
+ const _toggleCache = new Map();
62
+
63
+ /**
64
+ * Sets the correct tab based on selected radio button prior window.history navigation.
65
+ *
66
+ * @since 4.1.3
67
+ * @access private
68
+ *
69
+ * @function
70
+ * @return {(undefined|null)}
71
+ */
72
+ const _correctTabFocus = () => {
73
+ let changeEvent = new Event( 'change' );
74
+
75
+ tabStack.forEach( args => {
76
+ if ( ! args.fixHistory ) return;
77
+ document.querySelectorAll( `.${args.HTMLClasses.tabRadio}:checked` ).forEach( el => {
78
+ el.dispatchEvent( changeEvent );
79
+ } );
80
+ } );
81
+ }
82
+
83
+ /**
84
+ * Toggles a tab instantly, without animations.
85
+ *
86
+ * @since 4.1.3
87
+ * @access public
88
+ *
89
+ * @function
90
+ * @param {string} stackId The stack family ID.
91
+ * @param {HTMLInputElement} target The radio input element of the tab.
92
+ * @return {(undefined|null)}
93
+ */
94
+ const toggleToInstant = ( stackId, target ) => {
95
+
96
+ const stack = getStack( stackId );
97
+ const newContent = document.getElementById( `${target.id}-content` );
98
+
99
+ if ( ! newContent.classList.contains( stack.HTMLClasses.activeTabContent ) ) {
100
+ const allContent = document.querySelectorAll( `.${target.name}-content` );
101
+
102
+ allContent && allContent.forEach( element => {
103
+ element.classList.remove( stack.HTMLClasses.activeTabContent );
104
+ } );
105
+
106
+ newContent && newContent.classList.add( stack.HTMLClasses.activeTabContent );
107
+ }
108
+
109
+ document.getElementById( target.id ).dispatchEvent( stack.tabToggledEvent );
110
+ }
111
+
112
+ /**
113
+ * Toggles a tab with animations.
114
+ *
115
+ * @since 4.1.3
116
+ * @access public
117
+ *
118
+ * @function
119
+ * @param {string} stackId The stack family ID.
120
+ * @param {HTMLInputElement} target The radio input element of the tab.
121
+ * @return {(undefined|null)}
122
+ */
123
+ const toggleTo = ( stackId, target ) => {
124
+
125
+ const cacheId = target.name;
126
+ const stack = getStack( stackId );
127
+
128
+ const fadeOutTimeout = 125;
129
+ const fadeInTimeout = 175;
130
+ const fadeCSS = {
131
+ fadeIn: {
132
+ opacity: 1,
133
+ animation: 'tsf-fade-in',
134
+ animationDuration: `${fadeInTimeout}ms`,
135
+ animationTimingFunction: 'cubic-bezier(.54,.12,.90,.60)',
136
+ },
137
+ fadeOut: {
138
+ opacity: 0,
139
+ animation: 'tsf-fade-out',
140
+ animationDuration: `${fadeOutTimeout}ms`,
141
+ animationTimingFunction: 'cubic-bezier(.54,.12,.90,.60)',
142
+ }
143
+ };
144
+
145
+ const fadeIn = element => { for ( const prop in fadeCSS.fadeIn ) element.style[ prop ] = fadeCSS.fadeIn[ prop ] };
146
+ const fadeOut = element => { for ( const prop in fadeCSS.fadeOut ) element.style[ prop ] = fadeCSS.fadeOut[ prop ] };
147
+
148
+ const container = _toggleCache.get( 'container' ).get( cacheId );
149
+ const allContent = document.querySelectorAll( `.${target.name}-content` );
150
+
151
+ const lockHeight = () => {
152
+ container.style.boxSizing = 'border-box'; // FIXME this won't cause issues, right...? Ugh.
153
+ container.style.minHeight = `${container.getBoundingClientRect().height}px`;
154
+ }
155
+ const unLockHeight = () => {
156
+ container.style.minHeight = '';
157
+ }
158
+
159
+ const setCorrectTab = async () => {
160
+ let newContent = document.getElementById( `${_toggleCache.get( 'target' ).get( cacheId )}-content` );
161
+
162
+ // Lock height, so to prevent jumping.
163
+ lockHeight();
164
+ allContent.forEach( el => { el.classList.remove( stack.HTMLClasses.activeTabContent ) } );
165
+
166
+ newContent.classList.add( stack.HTMLClasses.activeTabContent );
167
+ unLockHeight();
168
+ fadeIn( newContent );
169
+ // Resolve at 2/3th of fade-in time, content should already be well visible.
170
+ await new Promise( _resolve => setTimeout( _resolve, fadeInTimeout * 2/3 ) );
171
+
172
+ return testTab(); // do not pass newContent!
173
+ };
174
+ const testTab = async () => {
175
+ // Regain this value from a new query, for the toggle's target-cache might've changed.
176
+ let newContent = document.getElementById( `${_toggleCache.get( 'target' ).get( cacheId )}-content` );
177
+
178
+ // Test if the correct tab has been set--otherwise, try again.
179
+ if ( ! newContent || newContent.classList.contains( stack.HTMLClasses.activeTabContent ) ) {
180
+ clearPromise();
181
+ document.getElementById( _toggleCache.get( 'target' ).get( cacheId ) )
182
+ .dispatchEvent( stack.tabToggledEvent );
183
+ } else {
184
+ // Lock height isothermically to prevent jumping.
185
+ lockHeight();
186
+ // Hide everything instantly. We don't make false promises here.
187
+ allContent.forEach( el => { el.classList.remove( stack.HTMLClasses.activeTabContent ) } );
188
+ // Loop until succesful. Use animationFrame so to not clog up the CPU if this lands in an infinite loop.
189
+ requestAnimationFrame( () => {
190
+ setCorrectTab() && clearPromise()
191
+ } );
192
+ }
193
+ }
194
+
195
+ const doPromise = () => new Promise( async resolve => {
196
+ allContent.forEach( fadeOut );
197
+ // Await fadeout before continuing (with fadeIn at setCorrectTab).
198
+ // await setTimeout( resolve, fadeOutTimeout );
199
+ await new Promise( _resolve => setTimeout( _resolve, fadeOutTimeout ) );
200
+ // resolve();
201
+ return setCorrectTab() && resolve();
202
+ } );
203
+ const clearPromise = () => _toggleCache.get( 'promises' ).delete( cacheId );
204
+
205
+ const runPromise = () => {
206
+ if ( _toggleCache.get( 'promises' ).has( cacheId ) ) return;
207
+
208
+ _toggleCache.get( 'promises' ).set( cacheId, doPromise );
209
+ _toggleCache.get( 'promises' ).get( cacheId )();
210
+ }
211
+ runPromise();
212
+ }
213
+
214
+ /**
215
+ * Toggle tab on tab-radio-change browser event.
216
+ *
217
+ * @since 4.1.3
218
+ * @access private
219
+ *
220
+ * @function
221
+ * @param {*} stackId
222
+ * @param {Event} event
223
+ * @return {(undefined|null)}
224
+ */
225
+ const _toggle = ( stackId, event ) => {
226
+
227
+ const stack = getStack( stackId );
228
+
229
+ const currentToggle = event.target;
230
+ const onload = ! event.isTrusted;
231
+
232
+ const toggleId = event.target.id;
233
+ const toggleName = event.target.name;
234
+
235
+ const cacheId = toggleName;
236
+
237
+ _toggleCache.get( 'wrap' ).has( cacheId ) || (
238
+ _toggleCache.get( 'wrap' ).set( cacheId, currentToggle.closest( `.${stack.HTMLClasses.wrapper}` ) )
239
+ );
240
+
241
+ const previousToggle = _toggleCache.get( 'wrap' ).get( cacheId ).querySelector( `.${stack.HTMLClasses.activeTab}` );
242
+
243
+ if ( ! onload ) {
244
+ // Perform validity check, this prevents non-invoking hidden browser validation errors.
245
+ // On failure, no tab-switching will happen: the previous tab will become reactivated.
246
+ const invalidInput = document.querySelector( `.${stack.HTMLClasses.activeTabContent} :invalid` );
247
+ if ( invalidInput ) {
248
+ invalidInput.reportValidity();
249
+
250
+ if ( previousToggle )
251
+ previousToggle.checked = true;
252
+
253
+ currentToggle.checked = false;
254
+
255
+ event.stopPropagation();
256
+ event.preventDefault();
257
+ return false;
258
+ }
259
+ }
260
+
261
+ if ( previousToggle ) {
262
+ previousToggle.classList.remove( stack.HTMLClasses.activeTab );
263
+ let label = document.querySelector( `.${stack.HTMLClasses.tabLabel}[for="${previousToggle.id}"]` );
264
+ label && label.classList.remove( 'tsf-no-focus-ring' );
265
+ }
266
+ currentToggle.classList.add( stack.HTMLClasses.activeTab );
267
+
268
+ if ( onload ) {
269
+ toggleToInstant( stackId, event.target );
270
+ } else {
271
+ if ( ! _toggleCache.get( 'container' ).has( cacheId ) ) {
272
+ // instead of 'inside', shouldn't we pick anything blockable?
273
+ _toggleCache.get( 'container' ).set( cacheId, currentToggle.closest( '.inside' ) );
274
+ }
275
+
276
+ // Set toggleTarget for (active or upcoming) Promise. This value is set early, so Promises in race conditions will use this.
277
+ _toggleCache.get( 'target' ).set( cacheId, toggleId );
278
+
279
+ // If the promise is running, let it finish and consider the newly set ID.
280
+ if ( _toggleCache.get( 'promises' ).has( cacheId ) ) return;
281
+
282
+ toggleTo( stackId, event.target );
283
+ }
284
+ }
285
+
286
+ /**
287
+ * Returns the registered stack.
288
+ *
289
+ * @since 4.1.3
290
+ * @access public
291
+ * @see tsfTabs.initStack() which registers the stack via param args.
292
+ *
293
+ * @function
294
+ * @param {String} stackId The stack ID for which to get the stack.
295
+ * @return {(Object<string, *>)} Immutable Map contents.
296
+ */
297
+ const getStack = stackId => tabStack.get( stackId );
298
+
299
+ /**
300
+ * Initializes a tab-switcher stack.
301
+ *
302
+ * A stack is merely an array of settings. The stack postulates certain events
303
+ * and HTMLClasses to be used. However, there may be an unlimited number of
304
+ * tabs registered in the DOM, even those with different 'form'-names, acting
305
+ * independently with each their own wrapper.
306
+ * For an example, see `tsfSettings._initTabs()` and visit the SEO Settings page.
307
+ *
308
+ * @since 4.1.3
309
+ * @access public
310
+ * @see tsfTabs.initStack registers the stack.
311
+ *
312
+ * @function
313
+ * @param {String} stackId The stack ID for which to get the stack.
314
+ * @param {Object} args The stack arguments.
315
+ * @param {CustomEvent} args.tabToggledEvent The Event firing after a tab toggled successfully.
316
+ * @param {(Object<string, *>)} args.HTMLClasses The HTML classes pertinent to the stack. Expects:
317
+ * wrapper, tabRadio, tabLabel, activeTab, activeTabContent
318
+ * @param {Boolean} args.fixHistory Whether to switch tabs based when browser history is used.
319
+ * e.g. user hits back-button, non-default-tabRadio is still
320
+ * checked, but not switched to correctly. Edge case.
321
+ * @return {(undefined|null)}
322
+ */
323
+ const initStack = ( stackId, args ) => {
324
+
325
+ tabStack.set( stackId, args );
326
+
327
+ const stack = getStack( stackId );
328
+
329
+ const toggleForwarder = event => _toggle( stackId, event );
330
+ const addNoFocusClass = event => event.currentTarget.classList.add( 'tsf-no-focus-ring' );
331
+
332
+ // Set tab-content on-change.
333
+ document.querySelectorAll( `.${stack.HTMLClasses.tabRadio}` ).forEach( el => {
334
+ el.addEventListener( 'change', toggleForwarder );
335
+ } );
336
+
337
+ // Prevent focus rings on-click.
338
+ document.querySelectorAll( `.${stack.HTMLClasses.wrapper} .${stack.HTMLClasses.tabLabel}` ).forEach( el => {
339
+ el.addEventListener( 'click', addNoFocusClass );
340
+ } );
341
+ }
342
+
343
+ return Object.assign( {
344
+ /**
345
+ * Initialises all aspects of the scripts.
346
+ * You shouldn't call this.
347
+ *
348
+ * @since 4.1.3
349
+ * @access protected
350
+ *
351
+ * @function
352
+ * @return {undefined}
353
+ */
354
+ load: () => {
355
+ _toggleCache.set( 'promises', new Map() );
356
+ _toggleCache.set( 'target', new Map() );
357
+ _toggleCache.set( 'wrap', new Map() );
358
+ _toggleCache.set( 'container', new Map() );
359
+
360
+ // Delay the focus fix, so not to delay the interactive state... even though it causes a page jump. This merely addresses an edge-case.
361
+ window.addEventListener( 'load', _correctTabFocus );
362
+ }
363
+ }, {
364
+ toggleToInstant,
365
+ toggleTo,
366
+ getStack,
367
+ initStack,
368
+ }, {
369
+ l10n,
370
+ } );
371
+ }();
372
+ window.tsfTabs.load();
lib/js/tabs.min.js ADDED
@@ -0,0 +1 @@
 
1
+ 'use strict';window.tsfTabs=function(){const a="undefined"!=typeof tsfTabsL10n&&tsfTabsL10n,b=new Map,c=new Map,d=()=>{let a=new Event("change");b.forEach(b=>{b.fixHistory&&document.querySelectorAll(`.${b.HTMLClasses.tabRadio}:checked`).forEach(b=>{b.dispatchEvent(a)})})},e=(a,b)=>{const c=h(a),d=document.getElementById(`${b.id}-content`);if(!d.classList.contains(c.HTMLClasses.activeTabContent)){const a=document.querySelectorAll(`.${b.name}-content`);a&&a.forEach(a=>{a.classList.remove(c.HTMLClasses.activeTabContent)}),d&&d.classList.add(c.HTMLClasses.activeTabContent)}document.getElementById(b.id).dispatchEvent(c.tabToggledEvent)},f=(a,b)=>{const d=b.name,e=h(a),f=125,g=175,i={fadeIn:{opacity:1,animation:"tsf-fade-in",animationDuration:`${g}ms`,animationTimingFunction:"cubic-bezier(.54,.12,.90,.60)"},fadeOut:{opacity:0,animation:"tsf-fade-out",animationDuration:`${f}ms`,animationTimingFunction:"cubic-bezier(.54,.12,.90,.60)"}},j=a=>{for(const b in i.fadeIn)a.style[b]=i.fadeIn[b]},k=a=>{for(const b in i.fadeOut)a.style[b]=i.fadeOut[b]},l=c.get("container").get(d),m=document.querySelectorAll(`.${b.name}-content`),n=()=>{l.style.boxSizing="border-box",l.style.minHeight=`${l.getBoundingClientRect().height}px`},o=()=>{l.style.minHeight=""},p=async()=>{let a=document.getElementById(`${c.get("target").get(d)}-content`);return n(),m.forEach(a=>{a.classList.remove(e.HTMLClasses.activeTabContent)}),a.classList.add(e.HTMLClasses.activeTabContent),o(),j(a),await new Promise(a=>setTimeout(a,2*g/3)),q()},q=async()=>{let a=document.getElementById(`${c.get("target").get(d)}-content`);!a||a.classList.contains(e.HTMLClasses.activeTabContent)?(s(),document.getElementById(c.get("target").get(d)).dispatchEvent(e.tabToggledEvent)):(n(),m.forEach(a=>{a.classList.remove(e.HTMLClasses.activeTabContent)}),requestAnimationFrame(()=>{p()&&s()}))},r=()=>new Promise(async a=>(m.forEach(k),await new Promise(a=>setTimeout(a,f)),p()&&a())),s=()=>c.get("promises").delete(d);(()=>{c.get("promises").has(d)||(c.get("promises").set(d,r),c.get("promises").get(d)())})()},g=(a,b)=>{const d=h(a),g=b.target,i=!b.isTrusted,j=b.target.id,k=b.target.name,l=k;c.get("wrap").has(l)||c.get("wrap").set(l,g.closest(`.${d.HTMLClasses.wrapper}`));const m=c.get("wrap").get(l).querySelector(`.${d.HTMLClasses.activeTab}`);if(!i){const a=document.querySelector(`.${d.HTMLClasses.activeTabContent} :invalid`);if(a)return a.reportValidity(),m&&(m.checked=!0),g.checked=!1,b.stopPropagation(),b.preventDefault(),!1}if(m){m.classList.remove(d.HTMLClasses.activeTab);let a=document.querySelector(`.${d.HTMLClasses.tabLabel}[for="${m.id}"]`);a&&a.classList.remove("tsf-no-focus-ring")}if(g.classList.add(d.HTMLClasses.activeTab),i)e(a,b.target);else{if(c.get("container").has(l)||c.get("container").set(l,g.closest(".inside")),c.get("target").set(l,j),c.get("promises").has(l))return;f(a,b.target)}},h=a=>b.get(a);return Object.assign({load:()=>{c.set("promises",new Map),c.set("target",new Map),c.set("wrap",new Map),c.set("container",new Map),window.addEventListener("load",d)}},{toggleToInstant:e,toggleTo:f,getStack:h,initStack:(a,c)=>{b.set(a,c);const d=h(a),e=b=>g(a,b),f=a=>a.currentTarget.classList.add("tsf-no-focus-ring");document.querySelectorAll(`.${d.HTMLClasses.tabRadio}`).forEach(a=>{a.addEventListener("change",e)}),document.querySelectorAll(`.${d.HTMLClasses.wrapper} .${d.HTMLClasses.tabLabel}`).forEach(a=>{a.addEventListener("click",f)})}},{l10n:a})}(),window.tsfTabs.load();
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: seo, xml sitemap, google search, open graph, schema.org, twitter card, per
5
  Requires at least: 5.1.0
6
  Tested up to: 5.6
7
  Requires PHP: 5.6.0
8
- Stable tag: 4.1.2
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -192,7 +192,7 @@ To correctly analyze your website, it must be done from the outside. If we load
192
 
193
  Please visit [the support forums](https://wordpress.org/support/plugin/autodescription) and kindly tell us about it.
194
 
195
- We'll try to get back to you within 72 hours. Typically, we reply within a day.
196
 
197
  = I am a developer; how can I help? =
198
 
@@ -246,6 +246,12 @@ If you wish to display breadcrumbs, then your theme should provide this. Alterna
246
 
247
  == Changelog ==
248
 
 
 
 
 
 
 
249
  = 4.1.2 =
250
 
251
  In this minor update, we ensured compatibility with PHP 8 and WP 5.6. TSF now also fully integrates with WordPress Core Sitemaps, which you can configure via the SEO settings. If you decide to keep using TSF's optimized sitemap, you can now enjoy prerendering, DoS protection, and full Polylang integration. Lastly, you'll find various accessibility improvements, and we fixed [about a dozen bugs](https://theseoframework.com/?p=3650#detailed).
5
  Requires at least: 5.1.0
6
  Tested up to: 5.6
7
  Requires PHP: 5.6.0
8
+ Stable tag: 4.1.3
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
192
 
193
  Please visit [the support forums](https://wordpress.org/support/plugin/autodescription) and kindly tell us about it.
194
 
195
+ We'll try to get back to you within a week. Typically, we reply within three days.
196
 
197
  = I am a developer; how can I help? =
198
 
246
 
247
  == Changelog ==
248
 
249
+ = 4.1.3 =
250
+
251
+ Before heading into 2021, we wanted to [set free four bugs](https://theseoframework.com/?p=3660#detailed).
252
+
253
+ Pro tip: If you can no longer switch TSF's settings tabs, try hitting 'CMD+SHIFT+R' (Mac) or 'CTRL+SHIFT+R' (Windows); these keyboard shortcuts will force-fetch the latest scripts from your server.
254
+
255
  = 4.1.2 =
256
 
257
  In this minor update, we ensured compatibility with PHP 8 and WP 5.6. TSF now also fully integrates with WordPress Core Sitemaps, which you can configure via the SEO settings. If you decide to keep using TSF's optimized sitemap, you can now enjoy prerendering, DoS protection, and full Polylang integration. Lastly, you'll find various accessibility improvements, and we fixed [about a dozen bugs](https://theseoframework.com/?p=3650#detailed).