The SEO Framework - Version 4.2.1

Version Description

This minor update addresses a few regressions brought in v4.2.0; it fixes the canonical URL for paginated categories, corrects an API typo, and rectifies a few edge cases. TSF now also supports PHP 8.1.

Download this release

Release Info

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

Code changes from version 4.2.0 to 4.2.1

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.2.0
7
  * Author: The SEO Framework Team
8
  * Author URI: https://theseoframework.com/
9
  * License: GPLv3
@@ -41,7 +41,7 @@ defined( 'ABSPATH' ) or die;
41
  *
42
  * @since 2.3.5
43
  */
44
- define( 'THE_SEO_FRAMEWORK_VERSION', '4.2.0' );
45
 
46
  /**
47
  * 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.2.1
7
  * Author: The SEO Framework Team
8
  * Author URI: https://theseoframework.com/
9
  * License: GPLv3
41
  *
42
  * @since 2.3.5
43
  */
44
+ define( 'THE_SEO_FRAMEWORK_VERSION', '4.2.1' );
45
 
46
  /**
47
  * The plugin Database version.
bootstrap/upgrade.php CHANGED
@@ -98,6 +98,7 @@ function _previous_db_version() {
98
  * 4. Added an upgrading lock. Preventing upgrades running simultaneously.
99
  * While this lock is active, the SEO Settings can't be accessed, either.
100
  * @since 4.1.0 Now checks whether the lock is successfully set before proceeding. Preventing race conditions.
 
101
  */
102
  function _do_upgrade() {
103
 
@@ -112,7 +113,7 @@ function _do_upgrade() {
112
  exit;
113
  }
114
 
115
- $timeout = 5 * MINUTE_IN_SECONDS;
116
 
117
  $lock = _set_upgrade_lock( $timeout );
118
  // Lock failed to create--probably because it was already locked (or the database failed us).
@@ -124,8 +125,10 @@ function _do_upgrade() {
124
  register_shutdown_function( __NAMESPACE__ . '\\_release_upgrade_lock' );
125
 
126
  \wp_raise_memory_limit( 'tsf_upgrade' );
127
- // This may lower the default timeout--which is good. Prevents overlap.
128
- set_time_limit( $timeout );
 
 
129
 
130
  /**
131
  * Clear the cache to prevent an update_option() from saving a stale database version to the cache.
98
  * 4. Added an upgrading lock. Preventing upgrades running simultaneously.
99
  * While this lock is active, the SEO Settings can't be accessed, either.
100
  * @since 4.1.0 Now checks whether the lock is successfully set before proceeding. Preventing race conditions.
101
+ * @since 4.2.1 No longer lowers the PHP execution time limit -- only increases it.
102
  */
103
  function _do_upgrade() {
104
 
113
  exit;
114
  }
115
 
116
+ $timeout = 5 * MINUTE_IN_SECONDS; // Same as WP Core, function update_core().
117
 
118
  $lock = _set_upgrade_lock( $timeout );
119
  // Lock failed to create--probably because it was already locked (or the database failed us).
125
  register_shutdown_function( __NAMESPACE__ . '\\_release_upgrade_lock' );
126
 
127
  \wp_raise_memory_limit( 'tsf_upgrade' );
128
+
129
+ $ini_max_execution_time = (int) ini_get( 'max_execution_time' );
130
+ if ( 0 !== $ini_max_execution_time )
131
+ set_time_limit( max( $ini_max_execution_time, $timeout ) );
132
 
133
  /**
134
  * Clear the cache to prevent an update_option() from saving a stale database version to the cache.
inc/classes/bridges/sitemap.class.php CHANGED
@@ -294,6 +294,7 @@ final class Sitemap {
294
  * at least as long as PHP is allowed to run.
295
  *
296
  * @since 4.1.2
 
297
  *
298
  * @param string $sitemap_id The sitemap ID.
299
  * @return bool True on succes, false on failure.
@@ -303,8 +304,14 @@ final class Sitemap {
303
  $lock_key = $this->get_lock_key( $sitemap_id );
304
  if ( ! $lock_key ) return false;
305
 
306
- // This is rather at most as PHP will run. However, 3 minutes to generate a sitemap is already ludicrous.
307
- $timeout = (int) min( ini_get( 'max_execution_time' ), 3 * MINUTE_IN_SECONDS );
 
 
 
 
 
 
308
 
309
  return \set_transient(
310
  $lock_key,
@@ -491,7 +498,7 @@ final class Sitemap {
491
  parse_url(
492
  static::$tsf->get_home_url(),
493
  PHP_URL_PATH
494
- ),
495
  '/'
496
  )
497
  );
294
  * at least as long as PHP is allowed to run.
295
  *
296
  * @since 4.1.2
297
+ * @since 4.2.1 Now considers "unlimited" execution time (0) that'd've prevented locks altogether.
298
  *
299
  * @param string $sitemap_id The sitemap ID.
300
  * @return bool True on succes, false on failure.
304
  $lock_key = $this->get_lock_key( $sitemap_id );
305
  if ( ! $lock_key ) return false;
306
 
307
+ $ini_max_execution_time = (int) ini_get( 'max_execution_time' );
308
+
309
+ if ( 0 === $ini_max_execution_time ) { // Unlimited. Let's still put a limit on the lock.
310
+ $timeout = 3 * MINUTE_IN_SECONDS;
311
+ } else {
312
+ // This is rather at most as PHP will run. However, 3 minutes to generate a sitemap is already ludicrous.
313
+ $timeout = (int) min( $ini_max_execution_time, 3 * MINUTE_IN_SECONDS );
314
+ }
315
 
316
  return \set_transient(
317
  $lock_key,
498
  parse_url(
499
  static::$tsf->get_home_url(),
500
  PHP_URL_PATH
501
+ ) ?? '',
502
  '/'
503
  )
504
  );
inc/classes/builders/sitemap/base.class.php CHANGED
@@ -68,6 +68,7 @@ class Base extends Main {
68
  * TODO consider expanding this feature for multilingual sites?
69
  *
70
  * @since 4.1.2
 
71
  */
72
  public function prerender_sitemap() {
73
 
@@ -78,7 +79,9 @@ class Base extends Main {
78
  // Don't prerender if the sitemap is already generated.
79
  if ( false !== static::$tsf->get_transient( $this->base_get_sitemap_store_key() ) ) return;
80
 
81
- set_time_limit( (int) max( ini_get( 'max_execution_time' ), 3 * MINUTE_IN_SECONDS ) );
 
 
82
 
83
  // Somehow, the 'base' key is unavailable, the database failed, or a lock is already in place. Either way, bail.
84
  if ( ! $bridge->lock_sitemap( 'base' ) ) return;
68
  * TODO consider expanding this feature for multilingual sites?
69
  *
70
  * @since 4.1.2
71
+ * @since 4.2.1 Now no longer lowers the PHP execution time limit from unlimited to 3 minutes.
72
  */
73
  public function prerender_sitemap() {
74
 
79
  // Don't prerender if the sitemap is already generated.
80
  if ( false !== static::$tsf->get_transient( $this->base_get_sitemap_store_key() ) ) return;
81
 
82
+ $ini_max_execution_time = (int) ini_get( 'max_execution_time' );
83
+ if ( 0 !== $ini_max_execution_time )
84
+ set_time_limit( max( $ini_max_execution_time, 3 * MINUTE_IN_SECONDS ) );
85
 
86
  // Somehow, the 'base' key is unavailable, the database failed, or a lock is already in place. Either way, bail.
87
  if ( ! $bridge->lock_sitemap( 'base' ) ) return;
inc/classes/core.class.php CHANGED
@@ -625,14 +625,14 @@ class Core {
625
  + ( 0.7152 * $get_relative_luminance( $g ) )
626
  + ( 0.0722 * $get_relative_luminance( $b ) );
627
 
628
- // Build light greyscale.
629
- $gr = ( $r * 0.2989 / 8 ) * $rl;
630
- $gg = ( $g * 0.5870 / 8 ) * $rl;
631
- $gb = ( $b * 0.1140 / 8 ) * $rl;
632
 
633
  // Invert colors if they hit this luminance boundary.
634
  if ( $rl < 0.5 ) {
635
- // Build dark greyscale. bitwise operators round...
636
  $gr ^= 0xFF;
637
  $gg ^= 0xFF;
638
  $gb ^= 0xFF;
625
  + ( 0.7152 * $get_relative_luminance( $g ) )
626
  + ( 0.0722 * $get_relative_luminance( $b ) );
627
 
628
+ // Build light greyscale. Rounding is required for bitwise operation (PHP8.1+).
629
+ $gr = round( ( $r * 0.2989 / 8 ) * $rl );
630
+ $gg = round( ( $g * 0.5870 / 8 ) * $rl );
631
+ $gb = round( ( $b * 0.1140 / 8 ) * $rl );
632
 
633
  // Invert colors if they hit this luminance boundary.
634
  if ( $rl < 0.5 ) {
635
+ // Build dark greyscale. bitwise operators...
636
  $gr ^= 0xFF;
637
  $gg ^= 0xFF;
638
  $gb ^= 0xFF;
inc/classes/detect.class.php CHANGED
@@ -1214,7 +1214,13 @@ class Detect extends Render {
1214
  public function is_subdirectory_installation() {
1215
  return memo() ?? memo(
1216
  (bool) \strlen(
1217
- ltrim( parse_url( \get_option( 'home' ), PHP_URL_PATH ), ' \\/' )
 
 
 
 
 
 
1218
  )
1219
  );
1220
  }
1214
  public function is_subdirectory_installation() {
1215
  return memo() ?? memo(
1216
  (bool) \strlen(
1217
+ ltrim(
1218
+ parse_url(
1219
+ \get_option( 'home' ),
1220
+ PHP_URL_PATH
1221
+ ) ?? '',
1222
+ ' \\/'
1223
+ )
1224
  )
1225
  );
1226
  }
inc/classes/generate-url.class.php CHANGED
@@ -456,7 +456,7 @@ class Generate_Url extends Generate_Title {
456
  if ( \is_wp_error( $url ) )
457
  return umemo( __METHOD__, '', $term_id, $taxonomy );
458
 
459
- if ( null !== $term_id ) {
460
  $paged = $this->paged();
461
 
462
  if ( $paged > 1 )
@@ -704,7 +704,7 @@ class Generate_Url extends Generate_Title {
704
  if ( 'relative' === $scheme ) {
705
  $url = ltrim( preg_replace( '/^\w+:\/\/[^\/]*/', '', $url ) );
706
 
707
- if ( '' !== $url && '/' === $url[0] )
708
  $url = '/' . ltrim( $url, "/ \t\n\r\0\x0B" );
709
  } else {
710
  $url = preg_replace( '#^\w+://#', $scheme . '://', $url );
@@ -732,17 +732,16 @@ class Generate_Url extends Generate_Title {
732
  */
733
  public function add_url_pagination( $url, $page = null, $use_base = null ) {
734
 
735
- $_page = $page ?? max( $this->paged(), $this->page() );
736
 
737
- if ( $_page < 2 )
738
  return $url;
739
 
740
- $_use_base = $use_base ?? (
741
  $this->is_real_front_page() || $this->is_archive() || $this->is_singular_archive() || $this->is_search()
742
  );
743
 
744
  if ( $this->pretty_permalinks ) {
745
-
746
  $_query = parse_url( $url, PHP_URL_QUERY );
747
  // Remove queries, add them back later.
748
  if ( $_query )
@@ -751,19 +750,19 @@ class Generate_Url extends Generate_Title {
751
  static $base;
752
  $base = $base ?: $GLOBALS['wp_rewrite']->pagination_base;
753
 
754
- if ( $_use_base ) {
755
- $url = \user_trailingslashit( \trailingslashit( $url ) . "$base/$_page", 'paged' );
756
  } else {
757
- $url = \user_trailingslashit( \trailingslashit( $url ) . $_page, 'single_paged' );
758
  }
759
 
760
  if ( $_query )
761
  $url = $this->append_url_query( $url, $_query );
762
  } else {
763
- if ( $_use_base ) {
764
- $url = \add_query_arg( 'paged', $_page, $url );
765
  } else {
766
- $url = \add_query_arg( 'page', $_page, $url );
767
  }
768
  }
769
 
456
  if ( \is_wp_error( $url ) )
457
  return umemo( __METHOD__, '', $term_id, $taxonomy );
458
 
459
+ if ( null === $term_id ) {
460
  $paged = $this->paged();
461
 
462
  if ( $paged > 1 )
704
  if ( 'relative' === $scheme ) {
705
  $url = ltrim( preg_replace( '/^\w+:\/\/[^\/]*/', '', $url ) );
706
 
707
+ if ( '/' === ( $url[0] ?? '' ) )
708
  $url = '/' . ltrim( $url, "/ \t\n\r\0\x0B" );
709
  } else {
710
  $url = preg_replace( '#^\w+://#', $scheme . '://', $url );
732
  */
733
  public function add_url_pagination( $url, $page = null, $use_base = null ) {
734
 
735
+ $page = $page ?? max( $this->paged(), $this->page() );
736
 
737
+ if ( $page < 2 )
738
  return $url;
739
 
740
+ $use_base = $use_base ?? (
741
  $this->is_real_front_page() || $this->is_archive() || $this->is_singular_archive() || $this->is_search()
742
  );
743
 
744
  if ( $this->pretty_permalinks ) {
 
745
  $_query = parse_url( $url, PHP_URL_QUERY );
746
  // Remove queries, add them back later.
747
  if ( $_query )
750
  static $base;
751
  $base = $base ?: $GLOBALS['wp_rewrite']->pagination_base;
752
 
753
+ if ( $use_base ) {
754
+ $url = \user_trailingslashit( \trailingslashit( $url ) . "$base/$page", 'paged' );
755
  } else {
756
+ $url = \user_trailingslashit( \trailingslashit( $url ) . $page, 'single_paged' );
757
  }
758
 
759
  if ( $_query )
760
  $url = $this->append_url_query( $url, $_query );
761
  } else {
762
+ if ( $use_base ) {
763
+ $url = \add_query_arg( 'paged', $page, $url );
764
  } else {
765
+ $url = \add_query_arg( 'page', $page, $url );
766
  }
767
  }
768
 
inc/compat/plugin-polylang.php CHANGED
@@ -34,7 +34,13 @@ function _polylang_fix_sitemap_base_bath( $path ) {
34
  // Polylang determines language sporadically from content: can't be trusted.
35
  // NOTE: Thanks to '_polylang_blocklist_tsf_urls', this yields a different value albeit the same code.
36
  // That's Polylang for you: can't trust your own code.
37
- $path = rtrim( parse_url( \get_home_url(), PHP_URL_PATH ), '/' );
 
 
 
 
 
 
38
  break;
39
  default:
40
  // Polylang can differentiate languages by (sub)domain/directory name early. No need to interfere.
34
  // Polylang determines language sporadically from content: can't be trusted.
35
  // NOTE: Thanks to '_polylang_blocklist_tsf_urls', this yields a different value albeit the same code.
36
  // That's Polylang for you: can't trust your own code.
37
+ $path = rtrim(
38
+ parse_url(
39
+ \get_home_url(),
40
+ PHP_URL_PATH
41
+ ) ?? '',
42
+ '/'
43
+ );
44
  break;
45
  default:
46
  // Polylang can differentiate languages by (sub)domain/directory name early. No need to interfere.
inc/views/settings/metaboxes/sitemaps.php CHANGED
@@ -156,20 +156,11 @@ switch ( $this->get_view_instance( 'sitemaps', $instance ) ) :
156
  <?php
157
  HTML::description( __( 'This setting affects how many pages are requested from the database per query.', 'autodescription' ) );
158
 
159
- if ( has_filter( 'the_seo_framework_sitemap_post_limit' ) ) :
160
- ?>
161
- <input type=hidden name="<?php Input::field_name( 'sitemap_query_limit' ); ?>" value="<?php echo absint( $this->get_sitemap_post_limit() ); ?>">
162
- <p>
163
- <input type="number" id="<?php Input::field_id( 'sitemap_query_limit' ); ?>" value="<?php echo absint( $this->get_sitemap_post_limit() ); ?>" disabled />
164
- </p>
165
- <?php
166
- else :
167
- ?>
168
- <p>
169
- <input type="number" min=1 max=50000 name="<?php Input::field_name( 'sitemap_query_limit' ); ?>" id="<?php Input::field_id( 'sitemap_query_limit' ); ?>" placeholder="<?php echo absint( $this->get_default_option( 'sitemap_query_limit' ) ); ?>" value="<?php echo absint( $this->get_option( 'sitemap_query_limit' ) ); ?>" />
170
- </p>
171
- <?php
172
- endif;
173
  HTML::description( __( 'Consider lowering this value when the sitemap shows a white screen or notifies you of memory exhaustion.', 'autodescription' ) );
174
  break;
175
 
156
  <?php
157
  HTML::description( __( 'This setting affects how many pages are requested from the database per query.', 'autodescription' ) );
158
 
159
+ ?>
160
+ <p>
161
+ <input type="number" min=1 max=50000 name="<?php Input::field_name( 'sitemap_query_limit' ); ?>" id="<?php Input::field_id( 'sitemap_query_limit' ); ?>" placeholder="<?php echo absint( $this->get_default_option( 'sitemap_query_limit' ) ); ?>" value="<?php echo absint( $this->get_option( 'sitemap_query_limit' ) ); ?>" />
162
+ </p>
163
+ <?php
 
 
 
 
 
 
 
 
 
164
  HTML::description( __( 'Consider lowering this value when the sitemap shows a white screen or notifies you of memory exhaustion.', 'autodescription' ) );
165
  break;
166
 
lib/js/settings.js CHANGED
@@ -58,10 +58,11 @@ window.tsfSettings = function( $ ) {
58
  const _getSettingsId = name => `autodescription-site-settings[${name}]`;
59
 
60
  /**
61
- * Clone of tsf.disPatchAtInteractive.
62
  * Eases programming, trims minified script size.
63
  *
64
  * @since 4.2.0
 
65
  * @access private
66
  * @ignore
67
  *
@@ -69,7 +70,7 @@ window.tsfSettings = function( $ ) {
69
  * @param {Element} element The element to dispatch the event upon.
70
  * @param {string} eventName The event name to trigger. Mustn't be custom.
71
  */
72
- const _disPatchAtInteractive = tsf.disPatchAtInteractive;
73
 
74
  /**
75
  * Initializes input helpers for the General Settings.
@@ -235,11 +236,11 @@ window.tsfSettings = function( $ ) {
235
  }
236
  document.querySelectorAll( '.tsf-excluded-post-types' ).forEach( el => {
237
  el.addEventListener( 'change', checkDisabledPT );
238
- _disPatchAtInteractive( el, 'change' );
239
  } );
240
  document.querySelectorAll( '.tsf-excluded-taxonomies' ).forEach( el => {
241
  el.addEventListener( 'change', checkDisabledTaxonomy );
242
- _disPatchAtInteractive( el, 'change' );
243
  } );
244
 
245
  init = true;
@@ -335,7 +336,7 @@ window.tsfSettings = function( $ ) {
335
  }
336
  if ( additionsToggle ) {
337
  additionsToggle.addEventListener( 'change', toggleAdditionsDisplayExample );
338
- _disPatchAtInteractive( additionsToggle, 'change' );
339
  }
340
 
341
  /**
@@ -374,7 +375,7 @@ window.tsfSettings = function( $ ) {
374
  document.querySelectorAll( '#tsf-title-location input' ).forEach( el => {
375
  el.addEventListener( 'change', toggleAdditionsLocationExample );
376
  if ( el.checked )
377
- _disPatchAtInteractive( el, 'change' );
378
  } );
379
 
380
  /**
@@ -402,7 +403,7 @@ window.tsfSettings = function( $ ) {
402
  const titleRemPrefixes = document.getElementById( _getSettingsId( 'title_rem_prefixes' ) );
403
  if ( titleRemPrefixes ) {
404
  titleRemPrefixes.addEventListener( 'change', adjustPrefixExample );
405
- _disPatchAtInteractive( titleRemPrefixes, 'change' );
406
  }
407
 
408
  /**
@@ -474,7 +475,7 @@ window.tsfSettings = function( $ ) {
474
  }
475
  if ( siteTitleInput ) {
476
  siteTitleInput.addEventListener( 'input', adjustSiteTitleExampleOuput );
477
- _disPatchAtInteractive( siteTitleInput, 'input' );
478
  }
479
  }
480
 
@@ -523,7 +524,7 @@ window.tsfSettings = function( $ ) {
523
  }
524
  document.querySelectorAll( '#tsf-home-title-location input' ).forEach( el => {
525
  el.addEventListener( 'change', toggleHoverAdditionsPlacement );
526
- _disPatchAtInteractive( el, 'change' );
527
  } );
528
 
529
  /**
@@ -579,7 +580,7 @@ window.tsfSettings = function( $ ) {
579
  }
580
  }
581
  titleInput.addEventListener( 'input', adjustHomepageExampleOutput );
582
- _disPatchAtInteractive( titleInput, 'input' );
583
 
584
  let updateHomePageTaglineExampleOutputBuffer;
585
  /**
@@ -626,7 +627,7 @@ window.tsfSettings = function( $ ) {
626
  updateHomePageTaglineExampleOutput();
627
  }
628
  taglineInput.addEventListener( 'input', updateHoverAdditionsValue );
629
- _disPatchAtInteractive( taglineInput, 'input' );
630
 
631
  /**
632
  * Toggle tagline end examples within the Left/Right example for the homepage titles.
@@ -652,7 +653,7 @@ window.tsfSettings = function( $ ) {
652
  updateHomePageTaglineExampleOutput();
653
  }
654
  taglineToggle.addEventListener( 'change', toggleHomePageTaglineExampleDisplay );
655
- _disPatchAtInteractive( taglineToggle, 'change' );
656
 
657
  /**
658
  * Updates separator used in the titles.
@@ -911,7 +912,7 @@ window.tsfSettings = function( $ ) {
911
 
912
  if ( select ) {
913
  select.addEventListener( 'change', switchPostTypeSettingsView );
914
- _disPatchAtInteractive( select, 'change' );
915
  }
916
 
917
  }
@@ -1030,7 +1031,7 @@ window.tsfSettings = function( $ ) {
1030
  if ( blogNameTrigger ) {
1031
  document.body.addEventListener( 'tsf-update-title-rem-additions', updateTitleRemoveAdditions );
1032
  blogNameTrigger.addEventListener( 'change', updateTitleAdditions );
1033
- _disPatchAtInteractive( blogNameTrigger, 'change' );
1034
  }
1035
 
1036
  tsfTitle.enqueueUnregisteredInputTrigger( _titleId );
@@ -1278,7 +1279,7 @@ window.tsfSettings = function( $ ) {
1278
  }
1279
  if ( socialTitleRemoveAdditions ) {
1280
  socialTitleRemoveAdditions.addEventListener( 'change', updateSocialAdditions );
1281
- _disPatchAtInteractive( socialTitleRemoveAdditions, 'change' );
1282
  }
1283
  }
1284
 
@@ -1326,7 +1327,7 @@ window.tsfSettings = function( $ ) {
1326
  }
1327
  }
1328
  copyrightToggle.addEventListener( 'change', toggleCopyrightControl );
1329
- _disPatchAtInteractive( copyrightToggle, 'change' );
1330
  }
1331
 
1332
  const robotsPostTypes = {},
@@ -1486,7 +1487,7 @@ window.tsfSettings = function( $ ) {
1486
  }
1487
  document.querySelectorAll( '.tsf-robots-post-types' ).forEach( el => {
1488
  el.addEventListener( 'change', checkRobotsPT );
1489
- _disPatchAtInteractive( el, 'change' );
1490
  } );
1491
 
1492
  const checkRobotsSite = event => {
@@ -1504,7 +1505,7 @@ window.tsfSettings = function( $ ) {
1504
  }
1505
  document.querySelectorAll( '.tsf-robots-site' ).forEach( el => {
1506
  el.addEventListener( 'change', checkRobotsSite );
1507
- _disPatchAtInteractive( el, 'change' );
1508
  } );
1509
 
1510
  init = true;
58
  const _getSettingsId = name => `autodescription-site-settings[${name}]`;
59
 
60
  /**
61
+ * Clone of tsf.dispatchAtInteractive.
62
  * Eases programming, trims minified script size.
63
  *
64
  * @since 4.2.0
65
+ * @FIXME: disPatch should be dispatch...
66
  * @access private
67
  * @ignore
68
  *
70
  * @param {Element} element The element to dispatch the event upon.
71
  * @param {string} eventName The event name to trigger. Mustn't be custom.
72
  */
73
+ const _dispatchAtInteractive = tsf.dispatchAtInteractive;
74
 
75
  /**
76
  * Initializes input helpers for the General Settings.
236
  }
237
  document.querySelectorAll( '.tsf-excluded-post-types' ).forEach( el => {
238
  el.addEventListener( 'change', checkDisabledPT );
239
+ _dispatchAtInteractive( el, 'change' );
240
  } );
241
  document.querySelectorAll( '.tsf-excluded-taxonomies' ).forEach( el => {
242
  el.addEventListener( 'change', checkDisabledTaxonomy );
243
+ _dispatchAtInteractive( el, 'change' );
244
  } );
245
 
246
  init = true;
336
  }
337
  if ( additionsToggle ) {
338
  additionsToggle.addEventListener( 'change', toggleAdditionsDisplayExample );
339
+ _dispatchAtInteractive( additionsToggle, 'change' );
340
  }
341
 
342
  /**
375
  document.querySelectorAll( '#tsf-title-location input' ).forEach( el => {
376
  el.addEventListener( 'change', toggleAdditionsLocationExample );
377
  if ( el.checked )
378
+ _dispatchAtInteractive( el, 'change' );
379
  } );
380
 
381
  /**
403
  const titleRemPrefixes = document.getElementById( _getSettingsId( 'title_rem_prefixes' ) );
404
  if ( titleRemPrefixes ) {
405
  titleRemPrefixes.addEventListener( 'change', adjustPrefixExample );
406
+ _dispatchAtInteractive( titleRemPrefixes, 'change' );
407
  }
408
 
409
  /**
475
  }
476
  if ( siteTitleInput ) {
477
  siteTitleInput.addEventListener( 'input', adjustSiteTitleExampleOuput );
478
+ _dispatchAtInteractive( siteTitleInput, 'input' );
479
  }
480
  }
481
 
524
  }
525
  document.querySelectorAll( '#tsf-home-title-location input' ).forEach( el => {
526
  el.addEventListener( 'change', toggleHoverAdditionsPlacement );
527
+ _dispatchAtInteractive( el, 'change' );
528
  } );
529
 
530
  /**
580
  }
581
  }
582
  titleInput.addEventListener( 'input', adjustHomepageExampleOutput );
583
+ _dispatchAtInteractive( titleInput, 'input' );
584
 
585
  let updateHomePageTaglineExampleOutputBuffer;
586
  /**
627
  updateHomePageTaglineExampleOutput();
628
  }
629
  taglineInput.addEventListener( 'input', updateHoverAdditionsValue );
630
+ _dispatchAtInteractive( taglineInput, 'input' );
631
 
632
  /**
633
  * Toggle tagline end examples within the Left/Right example for the homepage titles.
653
  updateHomePageTaglineExampleOutput();
654
  }
655
  taglineToggle.addEventListener( 'change', toggleHomePageTaglineExampleDisplay );
656
+ _dispatchAtInteractive( taglineToggle, 'change' );
657
 
658
  /**
659
  * Updates separator used in the titles.
912
 
913
  if ( select ) {
914
  select.addEventListener( 'change', switchPostTypeSettingsView );
915
+ _dispatchAtInteractive( select, 'change' );
916
  }
917
 
918
  }
1031
  if ( blogNameTrigger ) {
1032
  document.body.addEventListener( 'tsf-update-title-rem-additions', updateTitleRemoveAdditions );
1033
  blogNameTrigger.addEventListener( 'change', updateTitleAdditions );
1034
+ _dispatchAtInteractive( blogNameTrigger, 'change' );
1035
  }
1036
 
1037
  tsfTitle.enqueueUnregisteredInputTrigger( _titleId );
1279
  }
1280
  if ( socialTitleRemoveAdditions ) {
1281
  socialTitleRemoveAdditions.addEventListener( 'change', updateSocialAdditions );
1282
+ _dispatchAtInteractive( socialTitleRemoveAdditions, 'change' );
1283
  }
1284
  }
1285
 
1327
  }
1328
  }
1329
  copyrightToggle.addEventListener( 'change', toggleCopyrightControl );
1330
+ _dispatchAtInteractive( copyrightToggle, 'change' );
1331
  }
1332
 
1333
  const robotsPostTypes = {},
1487
  }
1488
  document.querySelectorAll( '.tsf-robots-post-types' ).forEach( el => {
1489
  el.addEventListener( 'change', checkRobotsPT );
1490
+ _dispatchAtInteractive( el, 'change' );
1491
  } );
1492
 
1493
  const checkRobotsSite = event => {
1505
  }
1506
  document.querySelectorAll( '.tsf-robots-site' ).forEach( el => {
1507
  el.addEventListener( 'change', checkRobotsSite );
1508
+ _dispatchAtInteractive( el, 'change' );
1509
  } );
1510
 
1511
  init = true;
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=tsf.disPatchAtInteractive,e=()=>{document.getElementById(c("display_character_counter"))?.addEventListener("click",a=>{document.querySelectorAll(".tsf-counter-wrap").forEach(b=>{b.style.display=a.target.checked?"":"none"}),a.target.checked&&tsfC.triggerCounterUpdate()});document.getElementById(c("display_pixel_counter"))?.addEventListener("click",a=>{document.querySelectorAll(".tsf-pixel-counter-wrap").forEach(b=>{b.style.display=a.target.checked?"":"none"}),a.target.checked&&tsfC.triggerCounterUpdate()});const a=new Set,b=new Set,e=new Set,f=new Set;document.body.addEventListener("tsf-post-type-support-changed",()=>{let b=document.querySelectorAll(".tsf-excluded-taxonomies"),c=!1;b.forEach(b=>{const d=b.name.split(/(?:.+\[)(.+?)(?:])/).join(""),f=JSON.parse(b.dataset?.postTypes||0)||[],g=f&&f.every(b=>a.has(b));g?(!e.has(d)&&(c=!0),e.add(d)):e.has(d)&&(e.delete(d),c=!0),h(),c&&i(d)})});const g=new Map;document.body.addEventListener("tsf-taxonomy-support-changed",()=>{g.set("excludedTaxonomiesAll",new Set(f)),g.set("excludedTaxonomies",new Set(b)),g.set("excludedPtTaxonomies",new Set(e))});const h=()=>{f.clear(),b.forEach(a=>f.add(a)),e.forEach(a=>f.add(a))},i=a=>{document.body.dispatchEvent(new CustomEvent("tsf-taxonomy-support-changed",{detail:{taxonomy:a,set:b,setPt:e,setAll:f}}))},j=b=>{document.body.dispatchEvent(new CustomEvent("tsf-post-type-support-changed",{detail:{postType:b,set:a}}))};let k=!1;const l=b=>{if(b.target.name){let c=b.target.name.split(/(?:.+\[)(.+?)(?:])/).join("");b.target.checked?(a.add(c),j(c)):k&&(a.delete(c),j(c))}},m=a=>{if(a.target.name){let c=a.target.name.split(/(?:.+\[)(.+?)(?:])/).join("");a.target.checked?(b.add(c),h(),i(c)):k&&(b.delete(c),h(),i(c))}};document.querySelectorAll(".tsf-excluded-post-types").forEach(a=>{a.addEventListener("change",l),d(a,"change")}),document.querySelectorAll(".tsf-excluded-taxonomies").forEach(a=>{a.addEventListener("change",m),d(a,"change")}),k=!0},f=()=>{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})})},g=()=>{const a=document.getElementById(c("title_rem_additions")),b=document.getElementById(c("social_title_rem_additions")),e=wp.template("tsf-disabled-title-additions-help-social")();a&&(a.addEventListener("change",a=>{a.target.checked?(document.querySelectorAll(".tsf-title-additions-js").forEach(a=>a.style.display="none"),b&&(b.dataset.disabledWarning=1,b.closest("label").insertAdjacentHTML("beforeend",e),tsfTT.triggerReset())):(document.querySelectorAll(".tsf-title-additions-js").forEach(a=>a.style.display="inline"),b?.dataset.disabledWarning&&b.closest("label").querySelector(".tsf-title-additions-warning-social")?.remove()),document.body.dispatchEvent(new CustomEvent("tsf-update-title-rem-additions",{detail:{removeAdditions:!!a.target.checked}}))}),d(a,"change"));const f=a=>{let b;document.getElementsByName(a.target.name).forEach(a=>{a.checked&&(b=a.value)});const d="left"===b,e="tsf-title-additions-location-hidden";document.querySelectorAll(".tsf-title-additions-example-left").forEach(a=>{a.classList.toggle(e,!d),a.classList.remove("hidden")}),document.querySelectorAll(".tsf-title-additions-example-right").forEach(a=>{a.classList.toggle(e,d),a.classList.remove("hidden")}),tsfTitle.updateStateAll("additionPlacement",d?"before":"after",c("homepage_title"))};document.querySelectorAll("#tsf-title-location input").forEach(a=>{a.addEventListener("change",f),a.checked&&d(a,"change")});const g=document.getElementById(c("title_rem_prefixes"));g&&(g.addEventListener("change",a=>{const b=!a.target.checked,d="tsf-title-tax-prefix-hidden";document.querySelectorAll(".tsf-title-tax-prefix").forEach(a=>{a.classList.toggle(d,!b),a.classList.remove("hidden")}),document.querySelectorAll(".tsf-title-tax-noprefix").forEach(a=>{a.classList.toggle(d,b),a.classList.remove("hidden")}),tsfTitle.updateStateAll("showPrefix",b,c("homepage_title"))}),d(g,"change"));const h=a=>{const b=tsf.decodeEntities(a.target.dataset.entity),c="tsf-title-separator-active";document.querySelectorAll(".tsf-sep-js").forEach(a=>{a.textContent=` ${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)});const j=c("homepage_title"),k=document.getElementById(c("site_title"));k&&(k.addEventListener("input",a=>{let b=document.querySelectorAll(".tsf-site-title-js"),c=tsf.decodeEntities(tsf.sDoubleSpace(a.target.value.trim()));c=c||tsf.decodeEntities(a.target.placeholder),tsfTitle.updateStateOf(j,"defaultTitle",c),tsfTitle.updateStateAll("additionValue",c,j);let d=tsf.escapeString(c);b.forEach(a=>{a.innerHTML=d})}),d(k,"input"))},h=()=>{const a=c("homepage_title"),e=document.getElementById(a),f=document.getElementById(c("homepage_title_tagline")),g=document.getElementById(c("homepage_tagline"));tsfTitle.setInputElement(e);const h=JSON.parse(document.getElementById(`tsf-title-data_${a}`)?.dataset.state||0);tsfTitle.updateStateOf(a,"allowReferenceChange",!h.refTitleLocked),tsfTitle.updateStateOf(a,"defaultTitle",h.defaultTitle),tsfTitle.updateStateOf(a,"addAdditions",h.addAdditions),tsfTitle.updateStateOf(a,"useSocialTagline",!!(h.useSocialTagline||!1)),tsfTitle.updateStateOf(a,"additionValue",h.additionValue),tsfTitle.updateStateOf(a,"additionPlacement",h.additionPlacement),tsfTitle.updateStateOf(a,"hasLegacy",!!(h.hasLegacy||!1)),tsfTitle.enqueueUnregisteredInputTrigger(a);const i=b=>{let c="left"===b.target.value?"before":"after";tsfTitle.updateStateOf(a,"additionPlacement",c)};document.querySelectorAll("#tsf-home-title-location input").forEach(a=>{a.addEventListener("change",i),d(a,"change")});const j=b=>{let c=tsfTitle.getStateOf(a,"prefixValue"),d="";switch(b){case"password":d=tsfTitle.protectedPrefix;break;case"private":d=tsfTitle.privatePrefix;break;default:case"public":d="";}d!==c&&tsfTitle.updateStateOf(a,"prefixValue",d)};b.states.isFrontPrivate?j("private"):b.states.isFrontProtected&&j("password");e.addEventListener("input",b=>{let c=document.querySelectorAll(".tsf-custom-title-js"),d=tsf.decodeEntities(tsf.sDoubleSpace(b.target.value.trim()));d.length?(d=tsf.escapeString(d),c.forEach(a=>a.innerHTML=d)):(d=tsf.escapeString(tsf.decodeEntities(tsfTitle.getStateOf(a,"defaultTitle"))),c.forEach(a=>a.innerHTML=d))}),d(e,"input");let k;const l=()=>{clearTimeout(k),k=setTimeout(()=>{let b=tsfTitle.getStateOf(a,"additionValue");b=tsf.decodeEntities(tsf.sDoubleSpace(b.trim())),b.length&&tsfTitle.getStateOf(a,"addAdditions")?(document.querySelectorAll(".tsf-custom-tagline-js").forEach(a=>{a.innerHTML=tsf.escapeString(b)}),document.querySelectorAll(".tsf-custom-blogname-js").forEach(a=>{a.style.display=null})):document.querySelectorAll(".tsf-custom-blogname-js").forEach(a=>{a.style.display="none"})},1e3/60)};f.addEventListener("input",()=>{let b=f.value.trim();b.length||(b=f.placeholder||""),b=tsf.escapeString(tsf.decodeEntities(b.trim())),tsfTitle.updateStateOf(a,"additionValue",b),l()}),d(f,"input");g.addEventListener("change",b=>{let c=!1;b.target.checked?(c=!0,f.readOnly=!1):(c=!1,f.readOnly=!0),tsfTitle.updateStateOf(a,"addAdditions",c),l()}),d(g,"change");window.addEventListener("tsf-title-sep-updated",a=>{tsfTitle.updateStateAll("separator",a.detail.separator)})},i=()=>{const a=c("homepage_description");tsfDescription.setInputElement(document.getElementById(a));const b=JSON.parse(document.getElementById(`tsf-description-data_${a}`)?.dataset.state||0);b&&(tsfDescription.updateStateOf(a,"defaultDescription",b.defaultDescription.trim()),tsfDescription.updateStateOf(a,"hasLegacy",!!(b.hasLegacy||!1))),tsfDescription.enqueueUnregisteredInputTrigger(a)},j=()=>{const a="homepage_social_settings";tsfSocial.setInputInstance(a,c("homepage_title"),c("homepage_description"));const b=JSON.parse(document.getElementById(`tsf-social-data_${a}`)?.dataset.settings||0);b&&(tsfSocial.updateStateOf(a,"addAdditions",b.og.state.addAdditions),tsfSocial.updateStateOf(a,"defaults",{ogTitle:b.og.state.defaultTitle,twTitle:b.tw.state.defaultTitle,ogDesc:b.og.state.defaultDesc,twDesc:b.tw.state.defaultDesc}),tsfSocial.updateStateOf(a,"placeholderLocks",{ogTitle:b.og.state?.titlePhLock||!1,twTitle:b.tw.state?.titlePhLock||!1,ogDesc:b.og.state?.descPhLock||!1,twDesc:b.tw.state?.descPhLock||!1}))},k=()=>{const b=()=>{tsfTitle.enqueueUnregisteredInputTrigger(c("homepage_title")),tsfDescription.enqueueUnregisteredInputTrigger(c("homepage_description"))};a(document).on("postbox-toggled",(a,c)=>{if("autodescription-homepage-settings"===c.id){let a=c.querySelector(".inside");0<a.offsetHeight&&0<a.offsetWidth&&b()}}),document.getElementById("tsf-homepage-tab-general")?.addEventListener("tsf-tab-toggled",b)},l=(a,b)=>`${c("pta")}[${a}][${b}]`;let m;const n=()=>m||=JSON.parse(document.getElementById("tsf-post-type-archive-data")?.dataset.postTypes||0)||{},o=()=>{const a=n(),b=Object.keys(a).length;switch(!0){case 1<b:p();case 0<b:q();break;default:}for(const b in a)r(b),s(b),t(b),u(b),v(b)},p=()=>{const a=n(),b=document.getElementById("tsf-post-type-archive-selector"),c=document.createElement("option"),e=document.getElementById("tsf-post-type-archive-header-wrap");e&&(e.style.display=null);(()=>{for(const d in a){let e=c.cloneNode();e.value=tsf.escapeString(d),e.innerHTML=tsf.escapeString(a[d].label),b?.appendChild(e)}})(),document.querySelectorAll(".tsf-post-type-header").forEach(a=>a.classList.add("hidden"));let f,g;const h=a=>{clearTimeout(f),f=setTimeout(()=>{g&&e?.removeChild(g),document.querySelectorAll(".tsf-post-type-archive-wrap").forEach(b=>{a.target.value===b.dataset.postType?(b.style.display=null,g=b.querySelector(".tsf-post-type-archive-details")?.cloneNode(!0)):b.style.display="none",b.classList.remove("hide-if-tsf-js")}),g&&e?.appendChild(g),document.body.dispatchEvent(new CustomEvent("tsf-post-type-archive-switched",{detail:{postType:a.target.value,hasKompaanChocolateBananaBeer:!1}}))},1e3/60)};b&&(b.addEventListener("change",h),d(b,"change"))},q=()=>{document.body.addEventListener("tsf-post-type-support-changed",a=>{const{postType:b,set:c}=a.detail,d=document.querySelector(`.tsf-post-type-archive-wrap[data-post-type="${b}"]`),e=c.has(b);d?.querySelector(".tsf-post-type-archive-if-excluded")?.classList.toggle("hidden",!e),d?.querySelector(".tsf-post-type-archive-if-not-excluded")?.classList.toggle("hidden",e),document.body.dispatchEvent(new CustomEvent("tsf-post-type-archive-switched",{detail:{postType:b}}))})},r=a=>{const b=l(a,"doctitle"),e=document.getElementById(b);tsfTitle.setInputElement(e);const f=JSON.parse(document.getElementById(`tsf-title-data_${b}`)?.dataset.state||0);f&&(tsfTitle.updateStateOf(b,"defaultTitle",f.defaultTitle),tsfTitle.updateStateOf(b,"addAdditions",f.addAdditions),tsfTitle.updateStateOf(b,"useSocialTagline",!!(f.useSocialTagline||!1)),tsfTitle.updateStateOf(b,"additionValue",f.additionValue),tsfTitle.updateStateOf(b,"additionPlacement",f.additionPlacement),tsfTitle.updateStateOf(b,"prefixValue",f.prefixValue),tsfTitle.updateStateOf(b,"showPrefix",f.showPrefix));e.addEventListener("input",a=>{let d=!a.target.value.trim().length;document.getElementById(c("title_rem_prefixes"))?.checked&&(d=!1),tsfTitle.updateStateOf(b,"showPrefix",d)});const g=wp.template("tsf-disabled-title-additions-help")(),h=document.getElementById(l(a,"title_no_blog_name"));h&&(document.body.addEventListener("tsf-update-title-rem-additions",a=>{const{removeAdditions:b}=a.detail;h.disabled=b,b?(h.closest("label").insertAdjacentHTML("beforeend",g),tsfTT.triggerReset()):h.closest("label").querySelector(".tsf-title-additions-warning")?.remove(),h.dispatchEvent(new Event("change"))}),h.addEventListener("change",a=>{let d=!a.target.checked;document.getElementById(c("title_rem_additions"))?.checked&&(d=!1),tsfTitle.updateStateOf(b,"addAdditions",d)}),d(h,"change")),tsfTitle.enqueueUnregisteredInputTrigger(b)},s=a=>{const b=l(a,"description");tsfDescription.setInputElement(document.getElementById(b));const c=JSON.parse(document.getElementById(`tsf-description-data_${b}`)?.dataset.state||0);c&&tsfDescription.updateStateOf(b,"defaultDescription",c.defaultDescription.trim()),tsfDescription.enqueueUnregisteredInputTrigger(b)},t=a=>{const b=`pta_social_settings_${a}`,c=JSON.parse(document.getElementById(`tsf-social-data_${b}`)?.dataset.settings||0);tsfSocial.setInputInstance(b,l(a,"doctitle"),l(a,"description")),tsfSocial.updateStateOf(b,"addAdditions",c.og.state.addAdditions),tsfSocial.updateStateOf(b,"defaults",{ogTitle:c.og.state.defaultTitle,twTitle:c.tw.state.defaultTitle,ogDesc:c.og.state.defaultDesc,twDesc:c.tw.state.defaultDesc})},u=a=>{const b={site:new Map,pt:new Map},c=c=>{let d=!1;return"noindex"===c&&(d=!n()[a].hasPosts),d||b.site.get(c)||b.pt.get(c)},d=b=>{const d=document.getElementById(l(a,b)),e=d?.querySelector("[value=\"0\"]"),f=d?.dataset||{};let g=f.defaultI18n?.replace("%s",tsf.decodeEntities(c(b)?f.defaultOff:f.defaultOn));g!==e.innerHTML&&(e.innerHTML=g,d.dispatchEvent(new Event("change")))};document.body.addEventListener("tsf-post-type-robots-changed",c=>{const{postType:e,robotsType:f,set:g}=c.detail;a!==e||(b.pt.set(f,g.has(a)),d(f))}),document.body.addEventListener("tsf-site-robots-changed",a=>{const{checked:c,robotsType:e}=a.detail;b.site.set(e,!!c),d(e)}),["noindex","nofollow","noarchive"].forEach(a=>{d(a)});const e=document.getElementById(l(a,"canonical")),f=document.getElementById(l(a,"noindex")),g=b=>{let d="",f="";0===b?d=c("noindex")?"noindex":"index":-1===b?d="index":1===b?d="noindex":void 0;f="noindex"==d?"":n()[a].url,e.placeholder=f};e&&f&&(f.addEventListener("change",a=>g(+a.target.value)),g(+f.value))},v=b=>{const c=()=>{tsfTitle.enqueueUnregisteredInputTrigger(l(b,"doctitle")),tsfDescription.enqueueUnregisteredInputTrigger(l(b,"description"))};a(document).on("postbox-toggled",(a,b)=>{if("autodescription-post-type-archive-settings"===b.id){let a=b.querySelector(".inside");0<a.offsetHeight&&0<a.offsetWidth&&c()}});document.body.addEventListener("tsf-post-type-archive-switched",a=>{a.detail?.postType===b&&c()}),document.getElementById(`tsf-post_type_archive_${b}-tab-general`)?.addEventListener("tsf-tab-toggled",c)},w=()=>{const a=document.getElementById(c("social_title_rem_additions"));a&&(a.addEventListener("change",a=>{a.target.checked?tsfSocial.updateStateAll("addAdditions",!1):tsfSocial.updateStateAll("addAdditions",!0)}),d(a,"change"))},x=()=>{const a=document.getElementById(c("set_copyright_directives"));if(a){const b=["max_snippet_length","max_image_preview","max_video_preview"].map(a=>document.getElementById(c(a))),e="tsf-toggle-directives-surrogate";a.addEventListener("change",a=>{a.target.checked?(b.forEach(a=>a.disabled=!1),document.querySelectorAll(`.${e}`).forEach(a=>a.remove())):b.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(e),a.insertAdjacentElement("afterend",b)})}),d(a,"change")}const b={},e={};[b,e].forEach(a=>{a.noindex=new Set,a.nofollow=new Set,a.noarchive=new Set});const f=(a,c)=>{document.body.dispatchEvent(new CustomEvent("tsf-post-type-robots-changed",{detail:{postType:a,robotsType:c,set:b[c]}}))},g=(a,b)=>{document.body.dispatchEvent(new CustomEvent("tsf-taxonomy-robots-changed",{detail:{taxonomy:a,robotsType:b,set:e[b]}}))},h=(a,b)=>{document.body.dispatchEvent(new CustomEvent("tsf-site-robots-changed",{detail:{checked:a,robotsType:b}}))},i=wp.template("tsf-robots-pt-help")(),j=(a,b,d)=>{let e=document.getElementById(`${c(`${b}_taxonomies`)}[${a}]`);d?(e.closest("label").insertAdjacentHTML("beforeend",i),tsfTT.triggerReset()):e.closest("label").querySelector(".tsf-taxonomy-from-pt-robots-warning")?.remove(),n(a)},k=a=>{const c=document.querySelectorAll(`.tsf-robots-taxonomies[data-robots="${a}"]`);let d=!1;c.forEach(c=>{let f=c.name.split(/(?:.+\[)(.+?)(?:])/).join("");const h=JSON.parse(c.dataset.postTypes||0),i=h&&h.every(c=>b[a].has(c));i?(!e[a].has(f)&&(d=!0),e[a].add(f)):e[a].has(f)&&(e[a].delete(f),d=!0),d&&g(f,a)})},l={noindex:new Map,nofollow:new Map,noarchive:new Map},m=(a,b)=>l[b].get(a)||new Set;document.body.addEventListener("tsf-taxonomy-robots-changed",a=>{const{taxonomy:b,robotsType:c}=a.detail;m("robotsPtTaxonomies",c).size!==e[c].size&&j(b,c,e[c].has(b)),l[c].set("robotsPtTaxonomies",new Set(e[c]))});document.body.addEventListener("tsf-post-type-robots-changed",a=>{k(a.detail.robotsType)});const n=a=>{for(let b in e)if(e[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":""}};document.body.addEventListener("tsf-taxonomy-support-changed",a=>n(a.detail.taxonomy));let o=!1;const p=a=>{let c=a.target?.name.split(/(?:.+\[)(.+?)(?:])/).join(""),d=a.target?.dataset.robots;a.target.checked?(b[d].add(c),f(c,d)):o&&(b[d].delete(c),f(c,d))};document.querySelectorAll(".tsf-robots-post-types").forEach(a=>{a.addEventListener("change",p),d(a,"change")});const q=a=>{let b=a.target?.dataset.robots,c=a.target.checked;c?h(c,b):o&&h(c,b)};document.querySelectorAll(".tsf-robots-site").forEach(a=>{a.addEventListener("change",q),d(a,"change")}),o=!0},y=()=>{const a=a=>tsf.escapeString(`tsf-disabled-post-type-input-clone-${a}`),b=wp.template("tsf-disabled-post-type-help")(),d=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);document.body.addEventListener("tsf-post-type-support-changed",c=>{const{postType:e,set:f}=c.detail;f.has(e)?(d(e).forEach(c=>{if(c){let d=c.cloneNode(!0);d.type="hidden",d.value=c.checked?c.value:"",d.id+="-cloned",d.classList.add(a(e)),c.disabled=!0,c.dataset.disabledWarning=1;const f=c.closest("label");f.insertAdjacentHTML("beforeend",b),f.append(d)}}),tsfTT.triggerReset()):d(e).forEach(b=>{b&&b.dataset.disabledWarning&&(b.closest("label").querySelector(".tsf-post-type-warning").remove(),document.querySelectorAll(`.${a(e)}`).forEach(a=>{a.remove()}),b.disabled=!1,b.dataset.disabledWarning="")})});const e=wp.template("tsf-disabled-taxonomy-help")(),f=wp.template("tsf-disabled-taxonomy-from-pt-help")(),g=a=>tsf.escapeString(`tsf-disabled-taxonomy-input-clone-${a}`),h=a=>[document.getElementById(`${c("noindex_taxonomies")}[${a}]`),document.getElementById(`${c("nofollow_taxonomies")}[${a}]`),document.getElementById(`${c("noarchive_taxonomies")}[${a}]`)].filter(a=>a);document.body.addEventListener("tsf-taxonomy-support-changed",a=>{const{taxonomy:b,set:d,setPt:i,setAll:j}=a.detail;j.has(b)?(h(b).forEach(a=>{if(a){let c=a.cloneNode(!0);c.type="hidden",c.value=a.checked?a.value:"",c.id+="-cloned",c.classList.add(g(b)),a.disabled=!0,a.dataset.disabledWarning=1;const d=a.closest("label");d.querySelector(".tsf-taxonomy-warning")||d.insertAdjacentHTML("beforeend",e),d.querySelector(g(b))||d.append(c)}}),tsfTT.triggerReset()):h(b).forEach(a=>{a&&a.dataset.disabledWarning&&(a.closest("label").querySelector(".tsf-taxonomy-warning")?.remove(),document.querySelectorAll(`.${g(b)}`).forEach(a=>{a.remove()}),a.disabled=!1,a.dataset.disabledWarning="")});const k=document.getElementById(`${c("disabled_taxonomies")}[${b}]`);i.has(b)?!k.closest("label").querySelector(".tsf-taxonomy-from-pt-warning")&&(k.closest("label").insertAdjacentHTML("beforeend",f),tsfTT.triggerReset()):k.closest("label").querySelector(".tsf-taxonomy-from-pt-warning")?.remove()})},z=()=>{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]?.length&&(a.stopPropagation(),a.preventDefault(),a.target.value=c[2],tsfAys.registerChange())}};a.forEach(a=>a.addEventListener("paste",b))},A=()=>{e(),g(),h(),i(),j(),k(),o(),w(),x(),y(),z(),f()},B=()=>{},C=()=>{tsfTabs.initStack("tsfSettings",{tabToggledEvent:new CustomEvent("tsf-tab-toggled"),HTMLClasses:{wrapper:"tsf-nav-tab-wrapper",tabRadio:"tsf-nav-tab-radio",tabLabel:"tsf-nav-tab-label",activeTab:"tsf-nav-tab-active",activeTabContent:"tsf-nav-tab-content-active"},fixHistory:!0})};return Object.assign({load:()=>{const a=document.querySelector(".wp-header-end");document.querySelectorAll("div.updated, div.error, div.notice, .notice-error, .notice-warning, .notice-info").forEach(b=>{a.insertAdjacentElement("afterend",b)}),document.body.addEventListener("tsf-onload",A),document.body.addEventListener("tsf-ready",B),C()}},{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=tsf.dispatchAtInteractive,e=()=>{document.getElementById(c("display_character_counter"))?.addEventListener("click",a=>{document.querySelectorAll(".tsf-counter-wrap").forEach(b=>{b.style.display=a.target.checked?"":"none"}),a.target.checked&&tsfC.triggerCounterUpdate()});document.getElementById(c("display_pixel_counter"))?.addEventListener("click",a=>{document.querySelectorAll(".tsf-pixel-counter-wrap").forEach(b=>{b.style.display=a.target.checked?"":"none"}),a.target.checked&&tsfC.triggerCounterUpdate()});const a=new Set,b=new Set,e=new Set,f=new Set;document.body.addEventListener("tsf-post-type-support-changed",()=>{let b=document.querySelectorAll(".tsf-excluded-taxonomies"),c=!1;b.forEach(b=>{const d=b.name.split(/(?:.+\[)(.+?)(?:])/).join(""),f=JSON.parse(b.dataset?.postTypes||0)||[],g=f&&f.every(b=>a.has(b));g?(!e.has(d)&&(c=!0),e.add(d)):e.has(d)&&(e.delete(d),c=!0),h(),c&&i(d)})});const g=new Map;document.body.addEventListener("tsf-taxonomy-support-changed",()=>{g.set("excludedTaxonomiesAll",new Set(f)),g.set("excludedTaxonomies",new Set(b)),g.set("excludedPtTaxonomies",new Set(e))});const h=()=>{f.clear(),b.forEach(a=>f.add(a)),e.forEach(a=>f.add(a))},i=a=>{document.body.dispatchEvent(new CustomEvent("tsf-taxonomy-support-changed",{detail:{taxonomy:a,set:b,setPt:e,setAll:f}}))},j=b=>{document.body.dispatchEvent(new CustomEvent("tsf-post-type-support-changed",{detail:{postType:b,set:a}}))};let k=!1;const l=b=>{if(b.target.name){let c=b.target.name.split(/(?:.+\[)(.+?)(?:])/).join("");b.target.checked?(a.add(c),j(c)):k&&(a.delete(c),j(c))}},m=a=>{if(a.target.name){let c=a.target.name.split(/(?:.+\[)(.+?)(?:])/).join("");a.target.checked?(b.add(c),h(),i(c)):k&&(b.delete(c),h(),i(c))}};document.querySelectorAll(".tsf-excluded-post-types").forEach(a=>{a.addEventListener("change",l),d(a,"change")}),document.querySelectorAll(".tsf-excluded-taxonomies").forEach(a=>{a.addEventListener("change",m),d(a,"change")}),k=!0},f=()=>{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})})},g=()=>{const a=document.getElementById(c("title_rem_additions")),b=document.getElementById(c("social_title_rem_additions")),e=wp.template("tsf-disabled-title-additions-help-social")();a&&(a.addEventListener("change",a=>{a.target.checked?(document.querySelectorAll(".tsf-title-additions-js").forEach(a=>a.style.display="none"),b&&(b.dataset.disabledWarning=1,b.closest("label").insertAdjacentHTML("beforeend",e),tsfTT.triggerReset())):(document.querySelectorAll(".tsf-title-additions-js").forEach(a=>a.style.display="inline"),b?.dataset.disabledWarning&&b.closest("label").querySelector(".tsf-title-additions-warning-social")?.remove()),document.body.dispatchEvent(new CustomEvent("tsf-update-title-rem-additions",{detail:{removeAdditions:!!a.target.checked}}))}),d(a,"change"));const f=a=>{let b;document.getElementsByName(a.target.name).forEach(a=>{a.checked&&(b=a.value)});const d="left"===b,e="tsf-title-additions-location-hidden";document.querySelectorAll(".tsf-title-additions-example-left").forEach(a=>{a.classList.toggle(e,!d),a.classList.remove("hidden")}),document.querySelectorAll(".tsf-title-additions-example-right").forEach(a=>{a.classList.toggle(e,d),a.classList.remove("hidden")}),tsfTitle.updateStateAll("additionPlacement",d?"before":"after",c("homepage_title"))};document.querySelectorAll("#tsf-title-location input").forEach(a=>{a.addEventListener("change",f),a.checked&&d(a,"change")});const g=document.getElementById(c("title_rem_prefixes"));g&&(g.addEventListener("change",a=>{const b=!a.target.checked,d="tsf-title-tax-prefix-hidden";document.querySelectorAll(".tsf-title-tax-prefix").forEach(a=>{a.classList.toggle(d,!b),a.classList.remove("hidden")}),document.querySelectorAll(".tsf-title-tax-noprefix").forEach(a=>{a.classList.toggle(d,b),a.classList.remove("hidden")}),tsfTitle.updateStateAll("showPrefix",b,c("homepage_title"))}),d(g,"change"));const h=a=>{const b=tsf.decodeEntities(a.target.dataset.entity),c="tsf-title-separator-active";document.querySelectorAll(".tsf-sep-js").forEach(a=>{a.textContent=` ${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)});const j=c("homepage_title"),k=document.getElementById(c("site_title"));k&&(k.addEventListener("input",a=>{let b=document.querySelectorAll(".tsf-site-title-js"),c=tsf.decodeEntities(tsf.sDoubleSpace(a.target.value.trim()));c=c||tsf.decodeEntities(a.target.placeholder),tsfTitle.updateStateOf(j,"defaultTitle",c),tsfTitle.updateStateAll("additionValue",c,j);let d=tsf.escapeString(c);b.forEach(a=>{a.innerHTML=d})}),d(k,"input"))},h=()=>{const a=c("homepage_title"),e=document.getElementById(a),f=document.getElementById(c("homepage_title_tagline")),g=document.getElementById(c("homepage_tagline"));tsfTitle.setInputElement(e);const h=JSON.parse(document.getElementById(`tsf-title-data_${a}`)?.dataset.state||0);tsfTitle.updateStateOf(a,"allowReferenceChange",!h.refTitleLocked),tsfTitle.updateStateOf(a,"defaultTitle",h.defaultTitle),tsfTitle.updateStateOf(a,"addAdditions",h.addAdditions),tsfTitle.updateStateOf(a,"useSocialTagline",!!(h.useSocialTagline||!1)),tsfTitle.updateStateOf(a,"additionValue",h.additionValue),tsfTitle.updateStateOf(a,"additionPlacement",h.additionPlacement),tsfTitle.updateStateOf(a,"hasLegacy",!!(h.hasLegacy||!1)),tsfTitle.enqueueUnregisteredInputTrigger(a);const i=b=>{let c="left"===b.target.value?"before":"after";tsfTitle.updateStateOf(a,"additionPlacement",c)};document.querySelectorAll("#tsf-home-title-location input").forEach(a=>{a.addEventListener("change",i),d(a,"change")});const j=b=>{let c=tsfTitle.getStateOf(a,"prefixValue"),d="";switch(b){case"password":d=tsfTitle.protectedPrefix;break;case"private":d=tsfTitle.privatePrefix;break;default:case"public":d="";}d!==c&&tsfTitle.updateStateOf(a,"prefixValue",d)};b.states.isFrontPrivate?j("private"):b.states.isFrontProtected&&j("password");e.addEventListener("input",b=>{let c=document.querySelectorAll(".tsf-custom-title-js"),d=tsf.decodeEntities(tsf.sDoubleSpace(b.target.value.trim()));d.length?(d=tsf.escapeString(d),c.forEach(a=>a.innerHTML=d)):(d=tsf.escapeString(tsf.decodeEntities(tsfTitle.getStateOf(a,"defaultTitle"))),c.forEach(a=>a.innerHTML=d))}),d(e,"input");let k;const l=()=>{clearTimeout(k),k=setTimeout(()=>{let b=tsfTitle.getStateOf(a,"additionValue");b=tsf.decodeEntities(tsf.sDoubleSpace(b.trim())),b.length&&tsfTitle.getStateOf(a,"addAdditions")?(document.querySelectorAll(".tsf-custom-tagline-js").forEach(a=>{a.innerHTML=tsf.escapeString(b)}),document.querySelectorAll(".tsf-custom-blogname-js").forEach(a=>{a.style.display=null})):document.querySelectorAll(".tsf-custom-blogname-js").forEach(a=>{a.style.display="none"})},1e3/60)};f.addEventListener("input",()=>{let b=f.value.trim();b.length||(b=f.placeholder||""),b=tsf.escapeString(tsf.decodeEntities(b.trim())),tsfTitle.updateStateOf(a,"additionValue",b),l()}),d(f,"input");g.addEventListener("change",b=>{let c=!1;b.target.checked?(c=!0,f.readOnly=!1):(c=!1,f.readOnly=!0),tsfTitle.updateStateOf(a,"addAdditions",c),l()}),d(g,"change");window.addEventListener("tsf-title-sep-updated",a=>{tsfTitle.updateStateAll("separator",a.detail.separator)})},i=()=>{const a=c("homepage_description");tsfDescription.setInputElement(document.getElementById(a));const b=JSON.parse(document.getElementById(`tsf-description-data_${a}`)?.dataset.state||0);b&&(tsfDescription.updateStateOf(a,"defaultDescription",b.defaultDescription.trim()),tsfDescription.updateStateOf(a,"hasLegacy",!!(b.hasLegacy||!1))),tsfDescription.enqueueUnregisteredInputTrigger(a)},j=()=>{const a="homepage_social_settings";tsfSocial.setInputInstance(a,c("homepage_title"),c("homepage_description"));const b=JSON.parse(document.getElementById(`tsf-social-data_${a}`)?.dataset.settings||0);b&&(tsfSocial.updateStateOf(a,"addAdditions",b.og.state.addAdditions),tsfSocial.updateStateOf(a,"defaults",{ogTitle:b.og.state.defaultTitle,twTitle:b.tw.state.defaultTitle,ogDesc:b.og.state.defaultDesc,twDesc:b.tw.state.defaultDesc}),tsfSocial.updateStateOf(a,"placeholderLocks",{ogTitle:b.og.state?.titlePhLock||!1,twTitle:b.tw.state?.titlePhLock||!1,ogDesc:b.og.state?.descPhLock||!1,twDesc:b.tw.state?.descPhLock||!1}))},k=()=>{const b=()=>{tsfTitle.enqueueUnregisteredInputTrigger(c("homepage_title")),tsfDescription.enqueueUnregisteredInputTrigger(c("homepage_description"))};a(document).on("postbox-toggled",(a,c)=>{if("autodescription-homepage-settings"===c.id){let a=c.querySelector(".inside");0<a.offsetHeight&&0<a.offsetWidth&&b()}}),document.getElementById("tsf-homepage-tab-general")?.addEventListener("tsf-tab-toggled",b)},l=(a,b)=>`${c("pta")}[${a}][${b}]`;let m;const n=()=>m||=JSON.parse(document.getElementById("tsf-post-type-archive-data")?.dataset.postTypes||0)||{},o=()=>{const a=n(),b=Object.keys(a).length;switch(!0){case 1<b:p();case 0<b:q();break;default:}for(const b in a)r(b),s(b),t(b),u(b),v(b)},p=()=>{const a=n(),b=document.getElementById("tsf-post-type-archive-selector"),c=document.createElement("option"),e=document.getElementById("tsf-post-type-archive-header-wrap");e&&(e.style.display=null);(()=>{for(const d in a){let e=c.cloneNode();e.value=tsf.escapeString(d),e.innerHTML=tsf.escapeString(a[d].label),b?.appendChild(e)}})(),document.querySelectorAll(".tsf-post-type-header").forEach(a=>a.classList.add("hidden"));let f,g;const h=a=>{clearTimeout(f),f=setTimeout(()=>{g&&e?.removeChild(g),document.querySelectorAll(".tsf-post-type-archive-wrap").forEach(b=>{a.target.value===b.dataset.postType?(b.style.display=null,g=b.querySelector(".tsf-post-type-archive-details")?.cloneNode(!0)):b.style.display="none",b.classList.remove("hide-if-tsf-js")}),g&&e?.appendChild(g),document.body.dispatchEvent(new CustomEvent("tsf-post-type-archive-switched",{detail:{postType:a.target.value,hasKompaanChocolateBananaBeer:!1}}))},1e3/60)};b&&(b.addEventListener("change",h),d(b,"change"))},q=()=>{document.body.addEventListener("tsf-post-type-support-changed",a=>{const{postType:b,set:c}=a.detail,d=document.querySelector(`.tsf-post-type-archive-wrap[data-post-type="${b}"]`),e=c.has(b);d?.querySelector(".tsf-post-type-archive-if-excluded")?.classList.toggle("hidden",!e),d?.querySelector(".tsf-post-type-archive-if-not-excluded")?.classList.toggle("hidden",e),document.body.dispatchEvent(new CustomEvent("tsf-post-type-archive-switched",{detail:{postType:b}}))})},r=a=>{const b=l(a,"doctitle"),e=document.getElementById(b);tsfTitle.setInputElement(e);const f=JSON.parse(document.getElementById(`tsf-title-data_${b}`)?.dataset.state||0);f&&(tsfTitle.updateStateOf(b,"defaultTitle",f.defaultTitle),tsfTitle.updateStateOf(b,"addAdditions",f.addAdditions),tsfTitle.updateStateOf(b,"useSocialTagline",!!(f.useSocialTagline||!1)),tsfTitle.updateStateOf(b,"additionValue",f.additionValue),tsfTitle.updateStateOf(b,"additionPlacement",f.additionPlacement),tsfTitle.updateStateOf(b,"prefixValue",f.prefixValue),tsfTitle.updateStateOf(b,"showPrefix",f.showPrefix));e.addEventListener("input",a=>{let d=!a.target.value.trim().length;document.getElementById(c("title_rem_prefixes"))?.checked&&(d=!1),tsfTitle.updateStateOf(b,"showPrefix",d)});const g=wp.template("tsf-disabled-title-additions-help")(),h=document.getElementById(l(a,"title_no_blog_name"));h&&(document.body.addEventListener("tsf-update-title-rem-additions",a=>{const{removeAdditions:b}=a.detail;h.disabled=b,b?(h.closest("label").insertAdjacentHTML("beforeend",g),tsfTT.triggerReset()):h.closest("label").querySelector(".tsf-title-additions-warning")?.remove(),h.dispatchEvent(new Event("change"))}),h.addEventListener("change",a=>{let d=!a.target.checked;document.getElementById(c("title_rem_additions"))?.checked&&(d=!1),tsfTitle.updateStateOf(b,"addAdditions",d)}),d(h,"change")),tsfTitle.enqueueUnregisteredInputTrigger(b)},s=a=>{const b=l(a,"description");tsfDescription.setInputElement(document.getElementById(b));const c=JSON.parse(document.getElementById(`tsf-description-data_${b}`)?.dataset.state||0);c&&tsfDescription.updateStateOf(b,"defaultDescription",c.defaultDescription.trim()),tsfDescription.enqueueUnregisteredInputTrigger(b)},t=a=>{const b=`pta_social_settings_${a}`,c=JSON.parse(document.getElementById(`tsf-social-data_${b}`)?.dataset.settings||0);tsfSocial.setInputInstance(b,l(a,"doctitle"),l(a,"description")),tsfSocial.updateStateOf(b,"addAdditions",c.og.state.addAdditions),tsfSocial.updateStateOf(b,"defaults",{ogTitle:c.og.state.defaultTitle,twTitle:c.tw.state.defaultTitle,ogDesc:c.og.state.defaultDesc,twDesc:c.tw.state.defaultDesc})},u=a=>{const b={site:new Map,pt:new Map},c=c=>{let d=!1;return"noindex"===c&&(d=!n()[a].hasPosts),d||b.site.get(c)||b.pt.get(c)},d=b=>{const d=document.getElementById(l(a,b)),e=d?.querySelector("[value=\"0\"]"),f=d?.dataset||{};let g=f.defaultI18n?.replace("%s",tsf.decodeEntities(c(b)?f.defaultOff:f.defaultOn));g!==e.innerHTML&&(e.innerHTML=g,d.dispatchEvent(new Event("change")))};document.body.addEventListener("tsf-post-type-robots-changed",c=>{const{postType:e,robotsType:f,set:g}=c.detail;a!==e||(b.pt.set(f,g.has(a)),d(f))}),document.body.addEventListener("tsf-site-robots-changed",a=>{const{checked:c,robotsType:e}=a.detail;b.site.set(e,!!c),d(e)}),["noindex","nofollow","noarchive"].forEach(a=>{d(a)});const e=document.getElementById(l(a,"canonical")),f=document.getElementById(l(a,"noindex")),g=b=>{let d="",f="";0===b?d=c("noindex")?"noindex":"index":-1===b?d="index":1===b?d="noindex":void 0;f="noindex"==d?"":n()[a].url,e.placeholder=f};e&&f&&(f.addEventListener("change",a=>g(+a.target.value)),g(+f.value))},v=b=>{const c=()=>{tsfTitle.enqueueUnregisteredInputTrigger(l(b,"doctitle")),tsfDescription.enqueueUnregisteredInputTrigger(l(b,"description"))};a(document).on("postbox-toggled",(a,b)=>{if("autodescription-post-type-archive-settings"===b.id){let a=b.querySelector(".inside");0<a.offsetHeight&&0<a.offsetWidth&&c()}});document.body.addEventListener("tsf-post-type-archive-switched",a=>{a.detail?.postType===b&&c()}),document.getElementById(`tsf-post_type_archive_${b}-tab-general`)?.addEventListener("tsf-tab-toggled",c)},w=()=>{const a=document.getElementById(c("social_title_rem_additions"));a&&(a.addEventListener("change",a=>{a.target.checked?tsfSocial.updateStateAll("addAdditions",!1):tsfSocial.updateStateAll("addAdditions",!0)}),d(a,"change"))},x=()=>{const a=document.getElementById(c("set_copyright_directives"));if(a){const b=["max_snippet_length","max_image_preview","max_video_preview"].map(a=>document.getElementById(c(a))),e="tsf-toggle-directives-surrogate";a.addEventListener("change",a=>{a.target.checked?(b.forEach(a=>a.disabled=!1),document.querySelectorAll(`.${e}`).forEach(a=>a.remove())):b.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(e),a.insertAdjacentElement("afterend",b)})}),d(a,"change")}const b={},e={};[b,e].forEach(a=>{a.noindex=new Set,a.nofollow=new Set,a.noarchive=new Set});const f=(a,c)=>{document.body.dispatchEvent(new CustomEvent("tsf-post-type-robots-changed",{detail:{postType:a,robotsType:c,set:b[c]}}))},g=(a,b)=>{document.body.dispatchEvent(new CustomEvent("tsf-taxonomy-robots-changed",{detail:{taxonomy:a,robotsType:b,set:e[b]}}))},h=(a,b)=>{document.body.dispatchEvent(new CustomEvent("tsf-site-robots-changed",{detail:{checked:a,robotsType:b}}))},i=wp.template("tsf-robots-pt-help")(),j=(a,b,d)=>{let e=document.getElementById(`${c(`${b}_taxonomies`)}[${a}]`);d?(e.closest("label").insertAdjacentHTML("beforeend",i),tsfTT.triggerReset()):e.closest("label").querySelector(".tsf-taxonomy-from-pt-robots-warning")?.remove(),n(a)},k=a=>{const c=document.querySelectorAll(`.tsf-robots-taxonomies[data-robots="${a}"]`);let d=!1;c.forEach(c=>{let f=c.name.split(/(?:.+\[)(.+?)(?:])/).join("");const h=JSON.parse(c.dataset.postTypes||0),i=h&&h.every(c=>b[a].has(c));i?(!e[a].has(f)&&(d=!0),e[a].add(f)):e[a].has(f)&&(e[a].delete(f),d=!0),d&&g(f,a)})},l={noindex:new Map,nofollow:new Map,noarchive:new Map},m=(a,b)=>l[b].get(a)||new Set;document.body.addEventListener("tsf-taxonomy-robots-changed",a=>{const{taxonomy:b,robotsType:c}=a.detail;m("robotsPtTaxonomies",c).size!==e[c].size&&j(b,c,e[c].has(b)),l[c].set("robotsPtTaxonomies",new Set(e[c]))});document.body.addEventListener("tsf-post-type-robots-changed",a=>{k(a.detail.robotsType)});const n=a=>{for(let b in e)if(e[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":""}};document.body.addEventListener("tsf-taxonomy-support-changed",a=>n(a.detail.taxonomy));let o=!1;const p=a=>{let c=a.target?.name.split(/(?:.+\[)(.+?)(?:])/).join(""),d=a.target?.dataset.robots;a.target.checked?(b[d].add(c),f(c,d)):o&&(b[d].delete(c),f(c,d))};document.querySelectorAll(".tsf-robots-post-types").forEach(a=>{a.addEventListener("change",p),d(a,"change")});const q=a=>{let b=a.target?.dataset.robots,c=a.target.checked;c?h(c,b):o&&h(c,b)};document.querySelectorAll(".tsf-robots-site").forEach(a=>{a.addEventListener("change",q),d(a,"change")}),o=!0},y=()=>{const a=a=>tsf.escapeString(`tsf-disabled-post-type-input-clone-${a}`),b=wp.template("tsf-disabled-post-type-help")(),d=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);document.body.addEventListener("tsf-post-type-support-changed",c=>{const{postType:e,set:f}=c.detail;f.has(e)?(d(e).forEach(c=>{if(c){let d=c.cloneNode(!0);d.type="hidden",d.value=c.checked?c.value:"",d.id+="-cloned",d.classList.add(a(e)),c.disabled=!0,c.dataset.disabledWarning=1;const f=c.closest("label");f.insertAdjacentHTML("beforeend",b),f.append(d)}}),tsfTT.triggerReset()):d(e).forEach(b=>{b&&b.dataset.disabledWarning&&(b.closest("label").querySelector(".tsf-post-type-warning").remove(),document.querySelectorAll(`.${a(e)}`).forEach(a=>{a.remove()}),b.disabled=!1,b.dataset.disabledWarning="")})});const e=wp.template("tsf-disabled-taxonomy-help")(),f=wp.template("tsf-disabled-taxonomy-from-pt-help")(),g=a=>tsf.escapeString(`tsf-disabled-taxonomy-input-clone-${a}`),h=a=>[document.getElementById(`${c("noindex_taxonomies")}[${a}]`),document.getElementById(`${c("nofollow_taxonomies")}[${a}]`),document.getElementById(`${c("noarchive_taxonomies")}[${a}]`)].filter(a=>a);document.body.addEventListener("tsf-taxonomy-support-changed",a=>{const{taxonomy:b,set:d,setPt:i,setAll:j}=a.detail;j.has(b)?(h(b).forEach(a=>{if(a){let c=a.cloneNode(!0);c.type="hidden",c.value=a.checked?a.value:"",c.id+="-cloned",c.classList.add(g(b)),a.disabled=!0,a.dataset.disabledWarning=1;const d=a.closest("label");d.querySelector(".tsf-taxonomy-warning")||d.insertAdjacentHTML("beforeend",e),d.querySelector(g(b))||d.append(c)}}),tsfTT.triggerReset()):h(b).forEach(a=>{a&&a.dataset.disabledWarning&&(a.closest("label").querySelector(".tsf-taxonomy-warning")?.remove(),document.querySelectorAll(`.${g(b)}`).forEach(a=>{a.remove()}),a.disabled=!1,a.dataset.disabledWarning="")});const k=document.getElementById(`${c("disabled_taxonomies")}[${b}]`);i.has(b)?!k.closest("label").querySelector(".tsf-taxonomy-from-pt-warning")&&(k.closest("label").insertAdjacentHTML("beforeend",f),tsfTT.triggerReset()):k.closest("label").querySelector(".tsf-taxonomy-from-pt-warning")?.remove()})},z=()=>{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]?.length&&(a.stopPropagation(),a.preventDefault(),a.target.value=c[2],tsfAys.registerChange())}};a.forEach(a=>a.addEventListener("paste",b))},A=()=>{e(),g(),h(),i(),j(),k(),o(),w(),x(),y(),z(),f()},B=()=>{},C=()=>{tsfTabs.initStack("tsfSettings",{tabToggledEvent:new CustomEvent("tsf-tab-toggled"),HTMLClasses:{wrapper:"tsf-nav-tab-wrapper",tabRadio:"tsf-nav-tab-radio",tabLabel:"tsf-nav-tab-label",activeTab:"tsf-nav-tab-active",activeTabContent:"tsf-nav-tab-content-active"},fixHistory:!0})};return Object.assign({load:()=>{const a=document.querySelector(".wp-header-end");document.querySelectorAll("div.updated, div.error, div.notice, .notice-error, .notice-warning, .notice-info").forEach(b=>{a.insertAdjacentElement("afterend",b)}),document.body.addEventListener("tsf-onload",A),document.body.addEventListener("tsf-ready",B),C()}},{l10n:b})}(jQuery),window.tsfSettings.load();
lib/js/tsf.js CHANGED
@@ -376,9 +376,9 @@ window.tsf = function( $ ) {
376
  * @param {string} replacement
377
  */
378
  const deprecatedFunc = ( name, version, replacement ) => {
379
- version = version ? ` The SEO Framework ${version}` : '';
380
  replacement = replacement ? ` Use ${replacement} instead.` : '';
381
- console.warn( `[DEPRECATED]: ${name} is deprecated since${version}.${replacement}` );
382
  }
383
 
384
  /**
@@ -503,14 +503,14 @@ window.tsf = function( $ ) {
503
  /**
504
  * Offsets callback to interactive event.
505
  *
506
- * @since 4.2.0
507
  * @access public
508
  *
509
  * @function
510
  * @param {Element} element The element to dispatch the event upon.
511
  * @param {string} eventName The event name to trigger. Mustn't be custom.
512
  */
513
- const disPatchAtInteractive = ( element, eventName ) => {
514
 
515
  _dispatchEvents.add( [ element, eventName ] );
516
 
@@ -740,7 +740,7 @@ window.tsf = function( $ ) {
740
  resetAjaxLoader,
741
  deprecatedFunc,
742
  triggerNoticeReset,
743
- disPatchAtInteractive,
744
  }, {
745
  l10n
746
  } );
376
  * @param {string} replacement
377
  */
378
  const deprecatedFunc = ( name, version, replacement ) => {
379
+ version = version ? ` since The SEO Framework ${version}` : '';
380
  replacement = replacement ? ` Use ${replacement} instead.` : '';
381
+ console.warn( `[DEPRECATED]: ${name} is deprecated${version}.${replacement}` );
382
  }
383
 
384
  /**
503
  /**
504
  * Offsets callback to interactive event.
505
  *
506
+ * @since 4.2.1
507
  * @access public
508
  *
509
  * @function
510
  * @param {Element} element The element to dispatch the event upon.
511
  * @param {string} eventName The event name to trigger. Mustn't be custom.
512
  */
513
+ const dispatchAtInteractive = ( element, eventName ) => {
514
 
515
  _dispatchEvents.add( [ element, eventName ] );
516
 
740
  resetAjaxLoader,
741
  deprecatedFunc,
742
  triggerNoticeReset,
743
+ dispatchAtInteractive,
744
  }, {
745
  l10n
746
  } );
lib/js/tsf.min.js CHANGED
@@ -1 +1 @@
1
- 'use strict';window.tsf=function(a){const b="undefined"!=typeof tsfL10n&&tsfL10n;let c;const d=()=>{if(void 0===c){try{c=!!new DOMParser().parseFromString("","text/html")}catch(a){}c=!!c}return c};let e;const f=a=>{if(!a?.length)return"";let b={"<":"&#x3C;",">":"&#x3E;","\\":"&#x5C;"};return a=a.replace(/[<>\\]/g,a=>b[a]),d()?(e=e||new DOMParser,a=e.parseFromString(a,"text/html").documentElement.textContent):(e=e||document.createElement("span"),e.innerHTML=a,a=h(e.textContent)),a},g=a=>{if(!a.length)return"";let b={"&":"&#x26;","<":"&#x3C;",">":"&#x3E;",'"':"&#x22;","'":"&#x27;","\\":"&#x5C;","/":"&#x2F;"};return a.replace(/[&<>"'\\\/]/g,a=>b[a])},h=a=>a.replace(/&amp;|&#x0{0,3}26;|&#38;/gi,"&"),i=()=>{let b=a(".postbox[id^=\"autodescription-\"], .postbox#tsf-inpost-box");a(document).on("postbox-toggled",(c,d)=>{if(!d||!b.is(d))return;d=a(d);let e=d.find("input:invalid, select:invalid, textarea:invalid");e.length&&setTimeout(()=>{if(d.is(":hidden")){let b=d.attr("id");a(`#${b}-hide`).trigger("click.postboxes")}else if(d.hasClass("closed"))d.find(".hndle, .handlediv").first().trigger("click.postboxes");else{let b=e.get(0);a(b).is(":visible")&&b.reportValidity()}})})},j=()=>{const b=b=>{let c=a(b.target).parents(".tsf-notice").first(),d=b.target.dataset&&b.target.dataset.key||void 0,e=b.target.dataset&&b.target.dataset.nonce||void 0;c.fadeTo(100,0,()=>{c.slideUp(100,()=>{c.remove()})}),d&&e&&wp.ajax.post("tsf_dismiss_notice",{tsf_dismiss_key:d,tsf_dismiss_nonce:e})},c=()=>{document.querySelectorAll(".tsf-dismiss").forEach(a=>a.addEventListener("click",b))};document.body.addEventListener("tsf-reset-notice-listeners",c),c()};let k=new Set,l=!1;const m=(a,b)=>{k.add([a,b]),l||(document.body.addEventListener("tsf-interactive",n),l=!0)},n=()=>{k.forEach(([a,b])=>{a.dispatchEvent(new Event(b))})};let o;const p=()=>{clearTimeout(o),o=setTimeout(()=>document.body.dispatchEvent(new CustomEvent("tsf-reset-notice-listeners")),100)};let q,r,s=!1;const t=100,u=()=>{clearTimeout(q),q=setTimeout(()=>{s=!1},t),s?(clearTimeout(r),r=setTimeout(u,t)):(s=!0,dispatchEvent(new CustomEvent("tsf-resize")))};let v=!1;const w=()=>{v||(v=!0,document.body.dispatchEvent(new CustomEvent("tsf-interactive")))},x=()=>{document.body.dispatchEvent(new CustomEvent("tsf-ready"))},y=()=>{document.body.dispatchEvent(new CustomEvent("tsf-onload"))};let z=!1;const A=()=>{z||(document.removeEventListener("DOMContentLoaded",A),document.removeEventListener("load",A),y(),i(),j(),x(),z=!0,document.addEventListener("load",w),setTimeout(w,100))};return Object.assign({load:()=>{"complete"!==document.readyState&&("loading"===document.readyState||document.documentElement.doScroll)?(document.addEventListener("DOMContentLoaded",A),document.addEventListener("load",A)):setTimeout(A()),window.addEventListener("resize",u)}},{stripTags:a=>a.length&&a.replace(/(<([^>]+)?>?)/ig,"")||"",decodeEntities:f,escapeString:g,ampHTMLtoText:h,sDoubleSpace:a=>a.replace(/\s{2,}/g," "),sSingleLine:a=>a.replace(/[\x0A\x0B\x0C\x0D]/g," "),sTabs:a=>a.replace(/\x09/g," "),getStringLength:a=>{let b,c=0;return a.length&&(b=document.createElement("span"),b.innerHTML=g(a).trim(),c=b.childNodes?.[0].nodeValue.length||0),+c},selectByValue:(a,b)=>{if(!a instanceof HTMLSelectElement)return;let c;for(let d=0;d<a.options.length;++d)if(b==a.options[d].value){c=d;break}if(void 0===c)for(let d=0;d<a.options.length;++d)if(b==a.options[d].innerHTML){c=d;break}void 0!==c&&(a.selectedIndex=c)},convertJSONResponse:a=>{let b=a&&a.json||void 0,c=1===b;if(!c){let b=a;try{a=JSON.parse(a),c=!0}catch(a){c=!1}c||(a=b)}return a},setAjaxLoader:b=>{a(b).toggleClass("tsf-loading")},unsetAjaxLoader:(b,c)=>{let d="tsf-success",e=2500;c||(d="tsf-error",e=5e3),a(b).removeClass("tsf-loading").addClass(d).fadeOut(e)},resetAjaxLoader:b=>{a(b).stop(!1,!0).empty().prop("class","tsf-ajax").show()},deprecatedFunc:(a,b,c)=>{b=b?` The SEO Framework ${b}`:"",c=c?` Use ${c} instead.`:"",void 0},triggerNoticeReset:p,disPatchAtInteractive:m},{l10n:b})}(jQuery),window.tsf.load();
1
+ 'use strict';window.tsf=function(a){const b="undefined"!=typeof tsfL10n&&tsfL10n;let c;const d=()=>{if(void 0===c){try{c=!!new DOMParser().parseFromString("","text/html")}catch(a){}c=!!c}return c};let e;const f=a=>{if(!a?.length)return"";let b={"<":"&#x3C;",">":"&#x3E;","\\":"&#x5C;"};return a=a.replace(/[<>\\]/g,a=>b[a]),d()?(e=e||new DOMParser,a=e.parseFromString(a,"text/html").documentElement.textContent):(e=e||document.createElement("span"),e.innerHTML=a,a=h(e.textContent)),a},g=a=>{if(!a.length)return"";let b={"&":"&#x26;","<":"&#x3C;",">":"&#x3E;",'"':"&#x22;","'":"&#x27;","\\":"&#x5C;","/":"&#x2F;"};return a.replace(/[&<>"'\\\/]/g,a=>b[a])},h=a=>a.replace(/&amp;|&#x0{0,3}26;|&#38;/gi,"&"),i=()=>{let b=a(".postbox[id^=\"autodescription-\"], .postbox#tsf-inpost-box");a(document).on("postbox-toggled",(c,d)=>{if(!d||!b.is(d))return;d=a(d);let e=d.find("input:invalid, select:invalid, textarea:invalid");e.length&&setTimeout(()=>{if(d.is(":hidden")){let b=d.attr("id");a(`#${b}-hide`).trigger("click.postboxes")}else if(d.hasClass("closed"))d.find(".hndle, .handlediv").first().trigger("click.postboxes");else{let b=e.get(0);a(b).is(":visible")&&b.reportValidity()}})})},j=()=>{const b=b=>{let c=a(b.target).parents(".tsf-notice").first(),d=b.target.dataset&&b.target.dataset.key||void 0,e=b.target.dataset&&b.target.dataset.nonce||void 0;c.fadeTo(100,0,()=>{c.slideUp(100,()=>{c.remove()})}),d&&e&&wp.ajax.post("tsf_dismiss_notice",{tsf_dismiss_key:d,tsf_dismiss_nonce:e})},c=()=>{document.querySelectorAll(".tsf-dismiss").forEach(a=>a.addEventListener("click",b))};document.body.addEventListener("tsf-reset-notice-listeners",c),c()};let k=new Set,l=!1;const m=(a,b)=>{k.add([a,b]),l||(document.body.addEventListener("tsf-interactive",n),l=!0)},n=()=>{k.forEach(([a,b])=>{a.dispatchEvent(new Event(b))})};let o;const p=()=>{clearTimeout(o),o=setTimeout(()=>document.body.dispatchEvent(new CustomEvent("tsf-reset-notice-listeners")),100)};let q,r,s=!1;const t=100,u=()=>{clearTimeout(q),q=setTimeout(()=>{s=!1},t),s?(clearTimeout(r),r=setTimeout(u,t)):(s=!0,dispatchEvent(new CustomEvent("tsf-resize")))};let v=!1;const w=()=>{v||(v=!0,document.body.dispatchEvent(new CustomEvent("tsf-interactive")))},x=()=>{document.body.dispatchEvent(new CustomEvent("tsf-ready"))},y=()=>{document.body.dispatchEvent(new CustomEvent("tsf-onload"))};let z=!1;const A=()=>{z||(document.removeEventListener("DOMContentLoaded",A),document.removeEventListener("load",A),y(),i(),j(),x(),z=!0,document.addEventListener("load",w),setTimeout(w,100))};return Object.assign({load:()=>{"complete"!==document.readyState&&("loading"===document.readyState||document.documentElement.doScroll)?(document.addEventListener("DOMContentLoaded",A),document.addEventListener("load",A)):setTimeout(A()),window.addEventListener("resize",u)}},{stripTags:a=>a.length&&a.replace(/(<([^>]+)?>?)/ig,"")||"",decodeEntities:f,escapeString:g,ampHTMLtoText:h,sDoubleSpace:a=>a.replace(/\s{2,}/g," "),sSingleLine:a=>a.replace(/[\x0A\x0B\x0C\x0D]/g," "),sTabs:a=>a.replace(/\x09/g," "),getStringLength:a=>{let b,c=0;return a.length&&(b=document.createElement("span"),b.innerHTML=g(a).trim(),c=b.childNodes?.[0].nodeValue.length||0),+c},selectByValue:(a,b)=>{if(!a instanceof HTMLSelectElement)return;let c;for(let d=0;d<a.options.length;++d)if(b==a.options[d].value){c=d;break}if(void 0===c)for(let d=0;d<a.options.length;++d)if(b==a.options[d].innerHTML){c=d;break}void 0!==c&&(a.selectedIndex=c)},convertJSONResponse:a=>{let b=a&&a.json||void 0,c=1===b;if(!c){let b=a;try{a=JSON.parse(a),c=!0}catch(a){c=!1}c||(a=b)}return a},setAjaxLoader:b=>{a(b).toggleClass("tsf-loading")},unsetAjaxLoader:(b,c)=>{let d="tsf-success",e=2500;c||(d="tsf-error",e=5e3),a(b).removeClass("tsf-loading").addClass(d).fadeOut(e)},resetAjaxLoader:b=>{a(b).stop(!1,!0).empty().prop("class","tsf-ajax").show()},deprecatedFunc:(a,b,c)=>{b=b?` since The SEO Framework ${b}`:"",c=c?` Use ${c} instead.`:"",void 0},triggerNoticeReset:p,dispatchAtInteractive:m},{l10n:b})}(jQuery),window.tsf.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.5.0
6
  Tested up to: 5.8
7
  Requires PHP: 7.2.0
8
- Stable tag: 4.2.0
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -247,6 +247,10 @@ If you wish to display breadcrumbs, then your theme should provide this. Alterna
247
 
248
  == Changelog ==
249
 
 
 
 
 
250
  = 4.2.0 - Perfect =
251
 
252
  *Come with me, and you'll be in a world of pure imagination. - [Gene Wilder, Anthony Newley, Leslie Bricusse](https://www.youtube.com/watch?v=SVi3-PrQ0pY)*
5
  Requires at least: 5.5.0
6
  Tested up to: 5.8
7
  Requires PHP: 7.2.0
8
+ Stable tag: 4.2.1
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
247
 
248
  == Changelog ==
249
 
250
+ = 4.2.1 =
251
+
252
+ This minor update addresses a few regressions brought in v4.2.0; it fixes the canonical URL for paginated categories, corrects an API typo, and [rectifies a few edge cases](https://theseoframework.com/?p=3836). TSF now also supports PHP 8.1.
253
+
254
  = 4.2.0 - Perfect =
255
 
256
  *Come with me, and you'll be in a world of pure imagination. - [Gene Wilder, Anthony Newley, Leslie Bricusse](https://www.youtube.com/watch?v=SVi3-PrQ0pY)*