Plugin Directory

Changeset 1903719


Ignore:
Timestamp:
07/04/2018 04:31:49 AM (8 years ago)
Author:
ejointjp
Message:

v0.3.1

Location:
wp-tocjs/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-tocjs/trunk/assets/js/toc.js

    r1903715 r1903719  
    1 !function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(module,exports){(function(){!function($){let numberSuffix;$.fn.toc=function(options){return options=$.extend({exclude:".toc-exclude",heading:"h2, h3",include:null,menu:".toc",number:!0,title:"Table of Contents",titleElement:"h2"},options),this.each(function(){const headings=options.heading.split(",");if(options.title){const e="<"+options.titleElement+' class="toc-heading"> '+options.title+" </"+options.titleElement+">";$(options.menu).prepend(e)}let $target;$(options.menu).append('<ul class="toc-list">'),$target=options.include?$(this).find(options.include):$(this).find(options.heading).not(options.exclude).not(".toc-heading");const headingsLength=headings.length;let i,j,ref;for(i=j=1,ref=headingsLength+1;1<=ref?j<=ref:j>=ref;i=1<=ref?++j:--j)eval("counter_"+i+" = 0");return $target.each(function(){let childLevelNum,classname,id,k,l,levelNum,number,ref1,ref2,span,results=[],html=$(this).html();const elem=$(this).prop("tagName").toLowerCase();for(i=k=0,ref1=headingsLength;0<=ref1?k<=ref1:k>=ref1;i=0<=ref1?++k:--k)if(levelNum=i+1,childLevelNum=levelNum+1,elem===$.trim(headings[i])){for(eval("counter_"+levelNum+"++"),eval("counter_"+childLevelNum+" = 0"),i=l=1,ref2=headingsLength+1;1<=ref2?l<=ref2:l>=ref2;i=1<=ref2?++l:--l)1===i?number=eval("counter_"+i):number+=numberSuffix(eval("counter_"+i)),id="toc-item-"+number,classname="toc-item toc-item-"+levelNum;$(this).attr("data-tocjs-id",id).attr("data-tocjs-number",number),options.number&&(html=number+". "+html,$(this).html(html)),span='<span id="'+id+'"></span>',$(this).before(span),console.log($(this)),console.log(span);const text='<li class="'+classname+'"> <a href="#'+id+'">'+html+"</a> </li>";results.push($(".toc-list").append(text))}else results.push(void 0);return results})})},numberSuffix=function(e){return 0!==e?"-"+e:""}}(jQuery)}).call(this)}]);
     1!function(t){"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("jquery"),window,document):t(jQuery,window,document)}(function(g,t,e,i){var v=function(t,e){return t=e+". "+t};g.fn.tocjs=function(f){return f=g.extend({excludes:"toc-exclude",headingNumber:!0,headings:"h2, h3",includes:"",min:4,output:".toc",title:"Contents",titleElement:"h2",tocNumber:!0},f),this.each(function(){var t,e,l,u,i,d,h=[0],p=!1,m=[];t=g("<div>"),e=f.headings.replace(/\s/g,""),(l=e.split(",")).sort(),u=f.excludes.replace(/\./g,"").replace(/,/g," ").replace(/\s+/," ");var n=g.trim(f.includes);if(f.title){var o=g("<"+f.titleElement+">",{class:"toc-heading",text:f.title});t.prepend(o)}if(i=g("<ul>",{class:"toc-list"}),(n?g(this).find(n):g(this).find(e).not(".toc-heading")).each(function(){var t,e,i,n,o,r,a=g(this).prop("tagName").toLowerCase(),s=g(this).html();for(t=0;t<l.length;t++)if(a===l[t]){if(!1!==p&&p<t)return;if(p=!1,g(this).hasClass(u))return void(p=t);for(h[t]++,t!==l.length-1&&(h[t+1]=0),e=0;e<h.length;e++)0===e?o=h[e]:o+=0<(r=h[e])?"-"+r:"";if(n="toc-item-"+o,i="toc-item toc-item-"+(t+1),g(this).attr("data-tocjs-id",n).attr("data-tocjs-number",o).before('<span id="'+n+'"></span>'),f.headingNumber){var c=v(s,o);g(this).html(c)}f.tocNumber&&(s=v(s,o)),d=m.push('<li class="'+i+'"><a href="#'+n+'">'+s+"</a></li>")}}),d>=f.min){i.append(m),t.append(i);var r=t.html();g(f.output).append(r)}})}});
  • wp-tocjs/trunk/readme.txt

    r1903715 r1903719  
    55Requires at least: 4.0
    66Tested up to: 4.9.6
    7 Stable tag: 0.3.0
     7Stable tag: 0.3.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5555== Changelog ==
    5656
     57= 0.3.1 =
     58
     59* Bug fix.
     60
    5761= 0.3.0 =
    5862
     
    6973
    7074== Upgrade notice ==
     75
     76= 0.3.1 =
     77* There is a bug in JavaScript and TOC can not be displayed. Please update it promptly.
  • wp-tocjs/trunk/wp-tocjs.php

    r1903715 r1903719  
    44Plugin URI: http://e-joint.jp/works/wp-tocjs/
    55Description: A WordPress plugin that makes Table of Contents automatically.
    6 Version: 0.3.0
     6Version: 0.3.1
    77Author: e-JOINT.jp
    88Author URI: http://e-joint.jp
Note: See TracChangeset for help on using the changeset viewer.