release 0.0.5

This commit is contained in:
Dolphin Wood
2015-05-29 17:15:38 +08:00
parent 0409e96331
commit 35190dcbc1
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "jquery-toc",
"version": "0.0.4",
"version": "0.0.5",
"homepage": "https://github.com/idiotWu/jQuery-TOC",
"authors": [
"Dolphin Wood <dolphin.w.e@gmail.com>"
+1 -1
View File
@@ -3,7 +3,7 @@
* Table of Contents Generator Plugin for (non-)jQuery
*
* @author Dolphin Wood <dolphin.w.e@gmail.com>
* @version 0.0.4
* @version 0.0.5
* Copyright 2015. MIT licensed.
*/
!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):n(jQuery)}(function(n){"use strict";var e=function(n){if("string"!=typeof n)return 0;var e=n.match(/\d/g);return e?Math.min.apply(null,e):1},t=function(e,t){for(;t--;)e=n("<ol/>").appendTo(e),t&&(e=n("<li/>").appendTo(e));return e},r=function(n,e){for(;e--;)n=n.parent();return n},o=function(n,e){return function(t,r,o){var i=t.text(),a=e+"-"+o;r.text(i);var c=t[0],f=r[0],u=n?a:c.id||a;u=encodeURIComponent(u),c.id=u,f.href="#"+u}},i=function(i){var a=i.selector,c=i.scope,f=n("<ol/>"),u=f,h=null,p=e(a),s=o(i.overwrite,i.prefix);return n(c).find(a).each(function(o,i){var a=e(i.tagName),c=a-p;c>0&&(u=t(h,c)),0>c&&(u=r(u,2*-c)),u.length||(u=f);var l=n("<li/>"),d=n("<a/>");s(n(i),d,o),l.append(d).appendTo(u),h=l,p=a}),f};n.fn.initTOC=function(e){var t={selector:"h1, h2, h3, h4, h5, h6",scope:"body",overwrite:!1,prefix:"toc"};e=n.extend(t,e);var r=e.selector;if("string"!=typeof r)throw new TypeError("selector must be a string");if(!r.match(/^(?:h[1-6],?\s*)+$/g))throw new TypeError("selector must contains only h1-6");n(this).append(i(e));var o=location.hash;return o&&setTimeout(function(){location.hash="",location.hash=o},0),n(this)}});
+1 -1
View File
@@ -3,7 +3,7 @@
* Table of Contents Generator Plugin for (non-)jQuery
*
* @author Dolphin Wood <dolphin.w.e@gmail.com>
* @version 0.0.4
* @version 0.0.5
* Copyright 2015. MIT licensed.
*/
!function(e){"use strict";var t=function(e,t){for(var n in t)t.hasOwnProperty(n)&&t[n]&&(e[n]=t[n]);return e},n=function(e,t){var n=[],r=document.querySelectorAll(t);return Array.prototype.forEach.call(r,function(t){var r=t.querySelectorAll(e);n=n.concat(Array.prototype.slice.call(r))}),n},r=function(e){if("string"!=typeof e)return 0;var t=e.match(/\d/g);return t?Math.min.apply(null,t):1},o=function(e,t){for(;t--;)e=e.appendChild(document.createElement("ol")),t&&(e=e.appendChild(document.createElement("li")));return e},c=function(e,t){for(;t--;)e=e.parentElement;return e},i=function(e,t){return function(n,r,o){var c=n.textContent,i=t+"-"+o;r.textContent=c;var a=e?i:n.id||i;a=encodeURIComponent(a),n.id=a,r.href="#"+a}},a=function(e){var t=e.selector,a=e.scope,u=document.createElement("ol"),l=u,f=null,h=i(e.overwrite,e.prefix);return n(t,a).reduce(function(e,t,n){var i=r(t.tagName),a=i-e;a>0&&(l=o(f,a)),0>a&&(l=c(l,1-a)),l=l||u;var p=document.createElement("li"),d=document.createElement("a");return h(t,d,n),l.appendChild(p).appendChild(d),f=p,i},r(t)),u},u=function(e){var n={selector:"h1, h2, h3, h4, h5, h6",scope:"body",overwrite:!1,prefix:"toc"};e=t(n,e);var r=e.selector;if("string"!=typeof r)throw new TypeError("selector must be a string");if(!r.match(/^(?:h[1-6],?\s*)+$/g))throw new TypeError("selector must contains only h1-6");var o=location.hash;return o&&setTimeout(function(){location.hash="",location.hash=o},0),a(e)};"function"==typeof define&&define.amd?define(function(){return u}):e.initTOC=u}(window);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "jQuery-TOC",
"version": "0.0.4",
"version": "0.0.5",
"description": "Table of Contents Generator Plugin for (non-)jQuery",
"main": "./dist/toc.min.js",
"copyright": "2015",