UNPKG

butterfly-halo-theme

Version:
1 lines 2.88 kB
(()=>{"use strict";function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var t=function(){function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this.tagList()}for(var e,o=t,r=[{key:"tagList",value:function(){var a,i,t=$(".tags-list > .tags-list-item");t.length&&(a=t.length-1,i=[],t.each(function(t,e){var o=Number(e.getAttribute("data-postCount")||0),r=parseFloat((1.5+o/a*1).toFixed(2)),n="rgb("+Math.floor(201*Math.random())+", "+Math.floor(201*Math.random())+", "+Math.floor(201*Math.random())+")";e.style.fontSize=r+"em",e.style.color=n,i.push([e.innerText,o])}),t=i.sort(function(t,e){return e[1]-t[1]}),this.drawChart(10<=t.length?t.slice(0,10):t))}},{key:"drawChart",value:function(t){window.drawEchartsDom=document.querySelector(".tags .tags-chart"),drawEchartsDom&&(window.drawEchartsOption={color:"null",backgroundColor:"",title:{text:"Top 10 标签统计图📌",x:"center"},dataset:[{dimensions:["name","count"],source:t},{transform:{type:"sort",config:{dimension:"count",order:"desc"}}}],tooltip:{},xAxis:{type:"category"},yAxis:{name:"文章篇数",type:"value",splitLine:{show:!1},axisTick:{show:!1},axisLine:{show:!0}},series:{name:"标签统计",type:"bar",encode:{x:"name",y:"count"},datasetIndex:1,itemStyle:{color:new window.echarts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:"#83bff6"},{offset:.5,color:"#188df0"},{offset:1,color:"#188df0"}])},emphasis:{itemStyle:{color:new window.echarts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:"#2378f7"},{offset:.7,color:"#2378f7"},{offset:1,color:"#83bff6"}])}},markPoint:{symbolSize:45,data:[{type:"max",itemStyle:{color:"#425aef"},name:"最大值"},{type:"min",itemStyle:{color:"#425aef"},name:"最小值"}]},markLine:{itemStyle:{color:"#425aef"},data:[{type:"average",name:"平均值"}]}}},function(t,e){var o,r,e=1<arguments.length&&void 0!==e?e:0;null!=(o=window)&&o.drawEchartsDom&&(r=window.echarts.init(window.drawEchartsDom,t),1===e&&(r.dispose(),r=window.echarts.init(window.drawEchartsDom,t)),r.setOption(window.drawEchartsOption),window.addEventListener("resize",function(){return r.resize()}))}(dataTheme))}}],n=o.prototype,a=r,i=0;i<a.length;i++){var s=a[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(n,(e=function(t){if("object"!==c(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return String(t);e=e.call(t,"string");if("object"!==c(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}(s.key),"symbol"===c(e)?e:String(e)),s)}return Object.defineProperty(o,"prototype",{writable:!1}),t}();document.addEventListener("DOMContentLoaded",function(){return window.TagsClass=new t})})();