From 544bcf0e80123fb9eff614f87d79cf8798c156d9 Mon Sep 17 00:00:00 2001 From: Greg Franko Date: Sun, 18 Aug 2013 23:03:20 -0400 Subject: [PATCH] Releasing Tocify v1.7.0 --- README.markdown | 5 ++ package.json | 2 +- src/javascripts/jquery.tocify.js | 81 ++++++++++++++++-------- src/javascripts/jquery.tocify.min.js | 4 +- src/stylesheets/Tocify/jquery.tocify.css | 16 ++--- 5 files changed, 69 insertions(+), 39 deletions(-) diff --git a/README.markdown b/README.markdown index db88aa4..c3fd475 100644 --- a/README.markdown +++ b/README.markdown @@ -54,6 +54,11 @@ If you find that you need a feature that Tocify does not currently support, eith ##Change Log +`1.7.0` - August 13, 2013 + +- Improved the CSS class naming convention and implementation +- Improved the CSS handling if no TOC items are found + `1.6.0` - July 24, 2013 - Updated the **scrollTo** option to accept a function [#33](https://github.com/gfranko/jquery.tocify.js/issues/33) diff --git a/package.json b/package.json index ee1eabd..f738316 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "jquery.tocify", "title": "jquery Tocify", "description": "A jQuery plugin that creates a dynamic table of contents", - "version": "1.6.0", + "version": "1.7.0", "homepage": "http://gregfranko.com/jquery.tocify.js/", "author": { "name": "Greg Franko", diff --git a/src/javascripts/jquery.tocify.js b/src/javascripts/jquery.tocify.js index 6ceb272..1428248 100644 --- a/src/javascripts/jquery.tocify.js +++ b/src/javascripts/jquery.tocify.js @@ -1,4 +1,4 @@ -/* jquery Tocify - v1.6.0 - 2013-07-24 +/* jquery Tocify - v1.7.0 - 2013-07-24 * http://www.gregfranko.com/jquery.tocify.js/ * Copyright (c) 2013 Greg Franko; Licensed MIT */ @@ -19,11 +19,26 @@ // ECMAScript 5 Strict Mode: [John Resig Blog Post](http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/) "use strict"; + var tocClassName = "tocify", + tocClass = "." + tocClassName, + tocFocusClassName = "tocify-focus", + tocHoverClassName = "tocify-hover", + hideTocClassName = "tocify-hide", + hideTocClass = "." + hideTocClassName, + headerClassName = "tocify-header", + headerClass = "." + headerClassName, + subheaderClassName = "tocify-subheader", + subheaderClass = "." + subheaderClassName, + itemClassName = "tocify-item", + itemClass = "." + itemClassName, + extendPageClassName = "tocify-extend-page", + extendPageClass = "." + extendPageClassName; + // Calling the jQueryUI Widget Factory Method $.widget("toc.tocify", { //Plugin version - version: "1.6.0", + version: "1.7.0", // These options will be used as defaults options: { @@ -210,6 +225,16 @@ } + if(!firstElem.length) { + + self.element.addClass(hideTocClassName); + + return; + + } + + self.element.addClass(tocClassName); + // Loops through each top level selector firstElem.each(function(index) { @@ -220,8 +245,8 @@ // Creates an unordered list HTML element and adds a dynamic ID and standard class name ul = $("