Table of Contents Plus - Version 1109

Version Description

  • Released: 12 September 2011
  • Adjusted hide action for a smoother transition.
  • Apply custom link and hover colours (when selected) to show/hide link in the title.
  • Renamed jquery.cookie.min.js to jquery.c.min.js to overcome false positive with mod_security. Mod_security would block requests to this file which would break the ability to save a user's show/hide preference. In some cases, it has also broken other javascript functionality. Additionally, a better graceful non disruptive fallback is now in place to prevent possible repeat. Thanks goes to Shonie for helping debug the issue.
  • Moved 'visibility option' into 'heading text'.
  • Fixed: restored smooth scroll effect for Internet Explorer since 1108.2 introduced 'pathname' checks.
Download this release

Release Info

Developer conjur3r
Plugin Icon 128x128 Table of Contents Plus
Version 1109
Comparing to
See all releases

Code changes from version 1108.2 to 1109

Files changed (6) hide show
  1. admin.js +5 -5
  2. front.js +17 -4
  3. jquery.cookie.min.js → jquery.c.min.js +0 -0
  4. readme.txt +9 -1
  5. screen.css +1 -1
  6. toc.php +32 -29
admin.js CHANGED
@@ -5,12 +5,12 @@ jQuery(document).ready(function($) {
5
 
6
  $('ul#tabbed-nav li').click(function(event) {
7
  event.preventDefault();
8
- $('ul#tabbed-nav li').removeClass('active'); //Remove any "active" class
9
- $(this).addClass('active'); //Add "active" class to selected tab
10
- $('.tab_content').hide(); //Hide all tab content
11
 
12
- var activeTab = $(this).find('a').attr('href'); //Find the href attribute value to identify the active tab + content
13
- $(activeTab).fadeIn(); //Fade in the active ID content
14
  });
15
 
16
  $('h3 span.show_hide a').click(function(event) {
5
 
6
  $('ul#tabbed-nav li').click(function(event) {
7
  event.preventDefault();
8
+ $('ul#tabbed-nav li').removeClass('active');
9
+ $(this).addClass('active');
10
+ $('.tab_content').hide();
11
 
12
+ var activeTab = $(this).find('a').attr('href');
13
+ $(activeTab).fadeIn();
14
  });
15
 
16
  $('h3 span.show_hide a').click(function(event) {
front.js CHANGED
@@ -18,6 +18,13 @@ jQuery(document).ready(function($) {
18
  hash = $(this).attr('hash');
19
  }
20
 
 
 
 
 
 
 
 
21
  if ( (window.location.hostname == hostname) && (window.location.pathname == pathname) && (window.location.search == qs) && (hash !== '') ) {
22
  // escape jquery selector chars, but keep the #
23
  var hash_selector = hash.replace(/([ !"$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g, '\\$1');
@@ -55,7 +62,12 @@ jQuery(document).ready(function($) {
55
  $(this).css('width', '');
56
  }
57
 
58
- var visibility_text = ($.cookie('tocplus_hidetoc')) ? tocplus.visibility_show : tocplus.visibility_hide ;
 
 
 
 
 
59
  $('#toc_container p.toc_title').append(' <span class="toc_toggle">[<a href="#">' + visibility_text + '</a>]</span>');
60
  if ( visibility_text == tocplus.visibility_show ) {
61
  $('ul.toc_list').hide();
@@ -67,17 +79,18 @@ jQuery(document).ready(function($) {
67
  switch( $(this).html() ) {
68
  case $('<div/>').html(tocplus.visibility_hide).text():
69
  $(this).html(tocplus.visibility_show);
70
- $.cookie('tocplus_hidetoc', '1', { expires: 30, path: '/' });
 
71
  $('#toc_container').shrinkTOCWidth();
72
  break;
73
 
74
  case $('<div/>').html(tocplus.visibility_show).text(): // do next
75
  default:
76
  $(this).html(tocplus.visibility_hide);
77
- $.cookie('tocplus_hidetoc', null, { path: '/' });
78
  $('#toc_container').css('width', tocplus.width);
 
79
  }
80
- $('ul.toc_list').toggle('fast');
81
  });
82
  }
83
 
18
  hash = $(this).attr('hash');
19
  }
20
 
21
+ // ie strips out the preceeding / from pathname
22
+ if ( pathname.length > 0 ) {
23
+ if ( pathname.charAt(0) != '/' ) {
24
+ pathname = '/' + pathname;
25
+ }
26
+ }
27
+
28
  if ( (window.location.hostname == hostname) && (window.location.pathname == pathname) && (window.location.search == qs) && (hash !== '') ) {
29
  // escape jquery selector chars, but keep the #
30
  var hash_selector = hash.replace(/([ !"$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g, '\\$1');
62
  $(this).css('width', '');
63
  }
64
 
65
+ if ( $.cookie )
66
+ var visibility_text = ($.cookie('tocplus_hidetoc')) ? tocplus.visibility_show : tocplus.visibility_hide ;
67
+ else
68
+ var visibility_text = tocplus.visibility_hide;
69
+
70
+
71
  $('#toc_container p.toc_title').append(' <span class="toc_toggle">[<a href="#">' + visibility_text + '</a>]</span>');
72
  if ( visibility_text == tocplus.visibility_show ) {
73
  $('ul.toc_list').hide();
79
  switch( $(this).html() ) {
80
  case $('<div/>').html(tocplus.visibility_hide).text():
81
  $(this).html(tocplus.visibility_show);
82
+ if ( $.cookie ) $.cookie('tocplus_hidetoc', '1', { expires: 30, path: '/' });
83
+ $('ul.toc_list').hide('fast');
84
  $('#toc_container').shrinkTOCWidth();
85
  break;
86
 
87
  case $('<div/>').html(tocplus.visibility_show).text(): // do next
88
  default:
89
  $(this).html(tocplus.visibility_hide);
90
+ if ( $.cookie ) $.cookie('tocplus_hidetoc', null, { path: '/' });
91
  $('#toc_container').css('width', tocplus.width);
92
+ $('ul.toc_list').show('fast');
93
  }
 
94
  });
95
  }
96
 
jquery.cookie.min.js → jquery.c.min.js RENAMED
File without changes
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: table of contents, indexes, toc, sitemap, cms, options, list, page listing, category listing
5
  Requires at least: 3.0
6
  Tested up to: 3.3
7
- Stable tag: 1108.2
8
 
9
  A powerful yet user friendly plugin that automatically creates a table of contents. Can also output a sitemap listing all pages and categories.
10
 
@@ -63,6 +63,14 @@ When parameters are left out, they will fallback to the default settings.
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
 
 
 
66
  = 1108.2 =
67
  * Released: 26 August 2011
68
  * New: visibility option to show/hide the table of contents. This option is enabled by default so if you don't want it, turn it off in the options. Thanks to [Wafflecone](http://dublue.com/plugins/toc/#comment-123) and [Mike](http://dublue.com/plugins/toc/comment-page-1/#comment-160) for the suggestion.
4
  Tags: table of contents, indexes, toc, sitemap, cms, options, list, page listing, category listing
5
  Requires at least: 3.0
6
  Tested up to: 3.3
7
+ Stable tag: 1109
8
 
9
  A powerful yet user friendly plugin that automatically creates a table of contents. Can also output a sitemap listing all pages and categories.
10
 
63
 
64
  == Changelog ==
65
 
66
+ = 1109 =
67
+ * Released: 12 September 2011
68
+ * Adjusted hide action for a smoother transition.
69
+ * Apply custom link and hover colours (when selected) to show/hide link in the title.
70
+ * Renamed jquery.cookie.min.js to jquery.c.min.js to overcome false positive with [mod_security](https://www.modsecurity.org/tracker/browse/CORERULES-29). Mod_security would block requests to this file which would break the ability to save a user's show/hide preference. In some cases, it has also broken other javascript functionality. Additionally, a better graceful non disruptive fallback is now in place to prevent possible repeat. Thanks goes to Shonie for helping debug the issue.
71
+ * Moved 'visibility option' into 'heading text'.
72
+ * Fixed: restored smooth scroll effect for Internet Explorer since 1108.2 introduced 'pathname' checks.
73
+
74
  = 1108.2 =
75
  * Released: 26 August 2011
76
  * New: visibility option to show/hide the table of contents. This option is enabled by default so if you don't want it, turn it off in the options. Thanks to [Wafflecone](http://dublue.com/plugins/toc/#comment-123) and [Mike](http://dublue.com/plugins/toc/comment-page-1/#comment-160) for the suggestion.
screen.css CHANGED
@@ -45,7 +45,7 @@
45
  font-weight: normal;
46
  font-size: 90%;
47
  }
48
- #toc_container ul.toc_list {
49
  margin-top: 1em;
50
  }
51
  .toc_wrap_left {
45
  font-weight: normal;
46
  font-size: 90%;
47
  }
48
+ #toc_container p.toc_title + ul.toc_list {
49
  margin-top: 1em;
50
  }
51
  .toc_wrap_left {
toc.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://dublue.com/plugins/toc/
5
  Description: A powerful yet user friendly plugin that automatically creates a table of contents. Can also output a sitemap listing all pages and categories.
6
  Author: Michael Tran
7
  Author URI: http://dublue.com/
8
- Version: 1108.2
9
  License: GPL2
10
  */
11
 
@@ -33,7 +33,7 @@ GPL licenced Oxygen icon used for the colour wheel - http://www.iconfinder.com/s
33
  FOR CONSIDERATION:
34
  - back to top links
35
  - sitemap
36
- - exclude pages/categories
37
  - support other taxonomies
38
  - advanced options
39
  - highlight target css
@@ -80,7 +80,7 @@ if ( !class_exists( 'toc' ) ) :
80
  $defaults = array( // default options
81
  'fragment_prefix' => 'i',
82
  'position' => TOC_POSITION_BEFORE_FIRST_HEADING,
83
- 'start' => TOC_MIN_START,
84
  'show_heading_text' => true,
85
  'heading_text' => 'Contents',
86
  'auto_insert_post_types' => array('page'),
@@ -256,7 +256,7 @@ if ( !class_exists( 'toc' ) ) :
256
  {
257
  wp_register_style( 'toc-screen', $this->path . '/screen.css' );
258
  wp_register_script( 'smooth-scroll', $this->path . '/jquery.smooth-scroll.min.js', array('jquery') );
259
- wp_register_script( 'cookie', $this->path . '/jquery.cookie.min.js', array('jquery') );
260
  wp_register_script( 'toc-front', $this->path . '/front.js', array('jquery') );
261
  }
262
 
@@ -290,7 +290,7 @@ if ( !class_exists( 'toc' ) ) :
290
  {
291
  wp_enqueue_style( 'farbtastic' );
292
  wp_enqueue_script( 'farbtastic' );
293
- wp_enqueue_script ( 'jquery' );
294
  wp_enqueue_script( 'toc_admin_script' );
295
  wp_enqueue_style( 'toc_admin_style' );
296
  }
@@ -460,29 +460,25 @@ if ( !class_exists( 'toc' ) ) :
460
  <input type="checkbox" value="1" id="show_heading_text" name="show_heading_text"<?php if ( $this->options['show_heading_text'] ) echo ' checked="checked"'; ?> /><label for="show_heading_text"> <?php _e('Show title on top of the table of contents', 'toc+'); ?></label><br />
461
  <div class="more_toc_options<?php if ( !$this->options['show_heading_text'] ) echo ' disabled'; ?>">
462
  <input type="text" class="regular-text" value="<?php echo htmlentities( $this->options['heading_text'], ENT_COMPAT, 'UTF-8' ); ?>" id="heading_text" name="heading_text" />
463
- <span class="description"><label for="heading_text"><?php _e('Eg: Contents, Table of Contents, Page Contents', 'toc+'); ?></label></span>
464
- </div>
465
- </td>
466
- </tr>
467
- <tr>
468
- <th><label for="visibility"><?php _e('Enable visibility option', 'toc+'); ?></label></th>
469
- <td>
470
- <input type="checkbox" value="1" id="visibility" name="visibility"<?php if ( $this->options['visibility'] ) echo ' checked="checked"'; ?> /><label for="visibility"> <?php _e( 'Allow the user to toggle the visibility of the table of contents', 'toc+'); ?></label><br />
471
- <div class="more_toc_options<?php if ( !$this->options['visibility'] ) echo ' disabled'; ?>">
472
- <table class="more_toc_options_table">
473
- <tbody>
474
- <tr>
475
- <th><label for="visibility_show"><?php _e('Show text', 'toc+'); ?></label></th>
476
- <td><input type="text" class="" value="<?php echo htmlentities( $this->options['visibility_show'], ENT_COMPAT, 'UTF-8' ); ?>" id="visibility_show" name="visibility_show" />
477
- <span class="description"><label for="visibility_show"><?php _e('Eg: show', 'toc+'); ?></label></span></td>
478
- </tr>
479
- <tr>
480
- <th><label for="visibility_hide"><?php _e('Hide text', 'toc+'); ?></label></th>
481
- <td><input type="text" class="" value="<?php echo htmlentities( $this->options['visibility_hide'], ENT_COMPAT, 'UTF-8' ); ?>" id="visibility_hide" name="visibility_hide" />
482
- <span class="description"><label for="visibility_hide"><?php _e('Eg: hide', 'toc+'); ?></label></span></td>
483
- </tr>
484
- </tbody>
485
- </table>
486
  </div>
487
  </td>
488
  </tr>
@@ -743,6 +739,10 @@ if ( !class_exists( 'toc' ) ) :
743
  <p>This normally occurs when there is a CSS clear directive in or around the heading specified by the theme author. This directive tells the user agent to reset the previous wrapping specifications.</p>
744
  <p>You can adjust your theme's CSS or try moving the table of contents position to the top of the page. If you didn't build your theme, I'd highly suggest you try the <a href="http://wordpress.org/extend/plugins/safecss/">Custom CSS plugin</a> if you wish to make CSS changes.</p>
745
 
 
 
 
 
746
  <h3>What's with the version numbers?</h3>
747
  <p>I like Ubuntu, especially the server product and highly recommend it for Linux deployments. I also like their versioning scheme and have adopted it. All versions are in a YYMM format (year month) of when the release was made.</p>
748
 
@@ -796,6 +796,7 @@ div#toc_container p.toc_title {
796
  endif;
797
 
798
  if ( $this->options['custom_links_colour'] != TOC_DEFAULT_LINKS_COLOUR ) : ?>
 
799
  div#toc_container ul.toc_list a {
800
  color: <?php echo $this->options['custom_links_colour']; ?>;
801
  }
@@ -803,6 +804,7 @@ div#toc_container ul.toc_list a {
803
  endif;
804
 
805
  if ( $this->options['custom_links_hover_colour'] != TOC_DEFAULT_LINKS_HOVER_COLOUR ) : ?>
 
806
  div#toc_container ul.toc_list a:hover {
807
  color: <?php echo $this->options['custom_links_hover_colour']; ?>;
808
  }
@@ -810,6 +812,7 @@ div#toc_container ul.toc_list a:hover {
810
  endif;
811
 
812
  if ( $this->options['custom_links_visited_colour'] != TOC_DEFAULT_LINKS_VISITED_COLOUR ) : ?>
 
813
  div#toc_container ul.toc_list a:visited {
814
  color: <?php echo $this->options['custom_links_visited_colour']; ?>;
815
  }
@@ -829,7 +832,7 @@ div#toc_container ul.toc_list a:visited {
829
  {
830
  if ( $this->options['smooth_scroll'] ) wp_enqueue_script( 'smooth-scroll' );
831
  wp_enqueue_script( 'toc-front' );
832
- if ( $this->options['visibility'] ) {
833
  $width = ( $this->options['width'] != 'User defined' ) ? $this->options['width'] : $this->options['width_custom'] . $this->options['width_custom_units'];
834
  wp_enqueue_script( 'cookie' );
835
  wp_localize_script(
5
  Description: A powerful yet user friendly plugin that automatically creates a table of contents. Can also output a sitemap listing all pages and categories.
6
  Author: Michael Tran
7
  Author URI: http://dublue.com/
8
+ Version: 1109
9
  License: GPL2
10
  */
11
 
33
  FOR CONSIDERATION:
34
  - back to top links
35
  - sitemap
36
+ - easier exclude pages/categories
37
  - support other taxonomies
38
  - advanced options
39
  - highlight target css
80
  $defaults = array( // default options
81
  'fragment_prefix' => 'i',
82
  'position' => TOC_POSITION_BEFORE_FIRST_HEADING,
83
+ 'start' => 4,
84
  'show_heading_text' => true,
85
  'heading_text' => 'Contents',
86
  'auto_insert_post_types' => array('page'),
256
  {
257
  wp_register_style( 'toc-screen', $this->path . '/screen.css' );
258
  wp_register_script( 'smooth-scroll', $this->path . '/jquery.smooth-scroll.min.js', array('jquery') );
259
+ wp_register_script( 'cookie', $this->path . '/jquery.c.min.js', array('jquery') );
260
  wp_register_script( 'toc-front', $this->path . '/front.js', array('jquery') );
261
  }
262
 
290
  {
291
  wp_enqueue_style( 'farbtastic' );
292
  wp_enqueue_script( 'farbtastic' );
293
+ wp_enqueue_script( 'jquery' );
294
  wp_enqueue_script( 'toc_admin_script' );
295
  wp_enqueue_style( 'toc_admin_style' );
296
  }
460
  <input type="checkbox" value="1" id="show_heading_text" name="show_heading_text"<?php if ( $this->options['show_heading_text'] ) echo ' checked="checked"'; ?> /><label for="show_heading_text"> <?php _e('Show title on top of the table of contents', 'toc+'); ?></label><br />
461
  <div class="more_toc_options<?php if ( !$this->options['show_heading_text'] ) echo ' disabled'; ?>">
462
  <input type="text" class="regular-text" value="<?php echo htmlentities( $this->options['heading_text'], ENT_COMPAT, 'UTF-8' ); ?>" id="heading_text" name="heading_text" />
463
+ <span class="description"><label for="heading_text"><?php _e('Eg: Contents, Table of Contents, Page Contents', 'toc+'); ?></label></span><br /><br />
464
+
465
+ <input type="checkbox" value="1" id="visibility" name="visibility"<?php if ( $this->options['visibility'] ) echo ' checked="checked"'; ?> /><label for="visibility"> <?php _e( 'Allow the user to toggle the visibility of the table of contents', 'toc+'); ?></label><br />
466
+ <div class="more_toc_options<?php if ( !$this->options['visibility'] ) echo ' disabled'; ?>">
467
+ <table class="more_toc_options_table">
468
+ <tbody>
469
+ <tr>
470
+ <th><label for="visibility_show"><?php _e('Show text', 'toc+'); ?></label></th>
471
+ <td><input type="text" class="" value="<?php echo htmlentities( $this->options['visibility_show'], ENT_COMPAT, 'UTF-8' ); ?>" id="visibility_show" name="visibility_show" />
472
+ <span class="description"><label for="visibility_show"><?php _e('Eg: show', 'toc+'); ?></label></span></td>
473
+ </tr>
474
+ <tr>
475
+ <th><label for="visibility_hide"><?php _e('Hide text', 'toc+'); ?></label></th>
476
+ <td><input type="text" class="" value="<?php echo htmlentities( $this->options['visibility_hide'], ENT_COMPAT, 'UTF-8' ); ?>" id="visibility_hide" name="visibility_hide" />
477
+ <span class="description"><label for="visibility_hide"><?php _e('Eg: hide', 'toc+'); ?></label></span></td>
478
+ </tr>
479
+ </tbody>
480
+ </table>
481
+ </div>
 
 
 
 
482
  </div>
483
  </td>
484
  </tr>
739
  <p>This normally occurs when there is a CSS clear directive in or around the heading specified by the theme author. This directive tells the user agent to reset the previous wrapping specifications.</p>
740
  <p>You can adjust your theme's CSS or try moving the table of contents position to the top of the page. If you didn't build your theme, I'd highly suggest you try the <a href="http://wordpress.org/extend/plugins/safecss/">Custom CSS plugin</a> if you wish to make CSS changes.</p>
741
 
742
+ <h3>The sitemap uses a strange font disimilar to the rest of the site</h3>
743
+ <p>No extra styles are created for the sitemap, instead it inherits any styles you used when adding the shortcode. If you copy and pasted, you probably also copied the 'code' tags surrounding it so remove them if this is the case.</p>
744
+ <p>In most cases, try to have the shortcode on its own line with nothing before or after the square brackets.</p>
745
+
746
  <h3>What's with the version numbers?</h3>
747
  <p>I like Ubuntu, especially the server product and highly recommend it for Linux deployments. I also like their versioning scheme and have adopted it. All versions are in a YYMM format (year month) of when the release was made.</p>
748
 
796
  endif;
797
 
798
  if ( $this->options['custom_links_colour'] != TOC_DEFAULT_LINKS_COLOUR ) : ?>
799
+ div#toc_container p.toc_title a,
800
  div#toc_container ul.toc_list a {
801
  color: <?php echo $this->options['custom_links_colour']; ?>;
802
  }
804
  endif;
805
 
806
  if ( $this->options['custom_links_hover_colour'] != TOC_DEFAULT_LINKS_HOVER_COLOUR ) : ?>
807
+ div#toc_container p.toc_title a:hover,
808
  div#toc_container ul.toc_list a:hover {
809
  color: <?php echo $this->options['custom_links_hover_colour']; ?>;
810
  }
812
  endif;
813
 
814
  if ( $this->options['custom_links_visited_colour'] != TOC_DEFAULT_LINKS_VISITED_COLOUR ) : ?>
815
+ div#toc_container p.toc_title a:visited,
816
  div#toc_container ul.toc_list a:visited {
817
  color: <?php echo $this->options['custom_links_visited_colour']; ?>;
818
  }
832
  {
833
  if ( $this->options['smooth_scroll'] ) wp_enqueue_script( 'smooth-scroll' );
834
  wp_enqueue_script( 'toc-front' );
835
+ if ( $this->options['show_heading_text'] && $this->options['visibility'] ) {
836
  $width = ( $this->options['width'] != 'User defined' ) ? $this->options['width'] : $this->options['width_custom'] . $this->options['width_custom_units'];
837
  wp_enqueue_script( 'cookie' );
838
  wp_localize_script(