OcttKB Cross-Repo Sync (HTML to Raw)

This commit is contained in:
2024-01-29 13:08:55 +00:00
parent 091ea33e87
commit 35eb8cb93e
42 changed files with 690 additions and 33 deletions

View File

@ -0,0 +1,9 @@
/*\
title: $:/addon/bookprogress.js
type: application/javascript
description:
// module-type: echarts-component
\*/
new $tw.Story;const e={onUpdate(e,t,o){const{title:r,filter:s="[tags[]!prefix[$:/]]",sort:i="descend",width:l=2,radius:a=10,toolbox:d="hide",doughnut:n,focusSelf:f,legend:u}=o,h=[];$tw.wiki.filterTiddlers(s).slice(0,50).sort().forEach((e=>h.push((e=>({name:e,value:$tw.wiki.filterTiddlers(`[tag[${e}]!has[draft.of]]`).length}))(e))));const c=h.length>10?0:l,p=h.length>10?5:a,g={title:{text:r,subtext:"",left:"left",top:"top"},toolbox:{show:"show"===d,left:0,bottom:0,feature:{dataView:{show:!0,readOnly:!1},restore:{},saveAsImage:{}}},tooltip:{trigger:"item",formatter:function(e){const{name:t,value:o,percent:r}=e;return o?`${t} 标签 有 ${o} 个条目 (${r}%)`:`${t} 条目`}},legend:{show:"yes"===u,orient:"vertical",right:10,top:20,bottom:20,type:"scroll"},series:[{name:"Tag",type:"pie",radius:"yes"===n?["40%","70%"]:"50%",center:"yes"===u?["40%","50%"]:"50%",data:h,itemStyle:{borderRadius:p,borderWidth:c,borderColor:"#fff"},emphasis:{focus:"yes"===f?"self":"",itemStyle:{}}}]};h.sort((function(e,t){return"descend"===i?t.value-e.value:e.value-t.value})),e.setOption(g)},shouldUpdate:(e,t)=>!!Object.keys(t).filter((e=>"$:/info/darkmode"===e||!e.startsWith("$:/")&&!e.startsWith("Draft of"))).length};module.exports=e;

View File

@ -0,0 +1,3 @@
description:
title: $:/addon/bookprogress.js
type: application/javascript

View File

@ -0,0 +1,7 @@
/*\
title: $:/addon/clock.js
module-type: echarts-component
type: application/javascript
description: clock with echarts
\*/
const e={onUpdate(e){option={title:{text:"",top:"top",left:"center"},series:[{name:"hour",type:"gauge",startAngle:90,endAngle:-270,min:0,max:12,splitNumber:12,clockwise:!0,axisLine:{lineStyle:{width:8,color:[[1,"rgba(0,0,0,0.7)"]],shadowColor:"rgba(0, 0, 0, 0.5)",shadowBlur:15}},splitLine:{lineStyle:{shadowColor:"rgba(0, 0, 0, 0.3)",shadowBlur:3,shadowOffsetX:1,shadowOffsetY:2}},axisLabel:{fontSize:16,distance:15,formatter:function(e){return 0===e?"":e+""}},pointer:{icon:"path://M2.9,0.7L2.9,0.7c1.4,0,2.6,1.2,2.6,2.6v115c0,1.4-1.2,2.6-2.6,2.6l0,0c-1.4,0-2.6-1.2-2.6-2.6V3.3C0.3,1.9,1.4,0.7,2.9,0.7z",width:6,length:"55%",offsetCenter:[0,"8%"],itemStyle:{color:"#C0911F",shadowColor:"rgba(0, 0, 0, 0.3)",shadowBlur:8,shadowOffsetX:2,shadowOffsetY:4}},detail:{show:!1},title:{offsetCenter:[0,"30%"]},data:[{value:0}]},{name:"minute",type:"gauge",startAngle:90,endAngle:-270,min:0,max:60,clockwise:!0,axisLine:{show:!1},splitLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},pointer:{icon:"path://M2.9,0.7L2.9,0.7c1.4,0,2.6,1.2,2.6,2.6v115c0,1.4-1.2,2.6-2.6,2.6l0,0c-1.4,0-2.6-1.2-2.6-2.6V3.3C0.3,1.9,1.4,0.7,2.9,0.7z",width:4,length:"70%",offsetCenter:[0,"8%"],itemStyle:{color:"#C0911F",shadowColor:"rgba(0, 0, 0, 0.3)",shadowBlur:8,shadowOffsetX:2,shadowOffsetY:4}},anchor:{show:!0,size:20,showAbove:!1,itemStyle:{borderWidth:8,borderColor:"#C0911F",shadowColor:"rgba(0, 0, 0, 0.3)",shadowBlur:8,shadowOffsetX:2,shadowOffsetY:4}},detail:{show:!1},title:{offsetCenter:["0%","-40%"]},data:[{value:0}]},{name:"second",type:"gauge",startAngle:90,endAngle:-270,min:0,max:60,animationEasingUpdate:"bounceOut",clockwise:!0,axisLine:{show:!1},splitLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},pointer:{icon:"path://M2.9,0.7L2.9,0.7c1.4,0,2.6,1.2,2.6,2.6v115c0,1.4-1.2,2.6-2.6,2.6l0,0c-1.4,0-2.6-1.2-2.6-2.6V3.3C0.3,1.9,1.4,0.7,2.9,0.7z",width:2,length:"85%",offsetCenter:[0,"8%"],itemStyle:{color:"#C0911F",shadowColor:"rgba(0, 0, 0, 0.3)",shadowBlur:8,shadowOffsetX:2,shadowOffsetY:4}},anchor:{show:!0,size:15,showAbove:!0,itemStyle:{color:"#C0911F",shadowColor:"rgba(0, 0, 0, 0.3)",shadowBlur:8,shadowOffsetX:2,shadowOffsetY:4}},detail:{show:!1},title:{offsetCenter:["0%","-40%"]},data:[{value:0}]}]},setInterval((function(){var t=new Date,o=t.getSeconds(),a=t.getMinutes()+o/60,s=t.getHours()%12+a/60;option.animationDurationUpdate=300,e.setOption({series:[{name:"hour",animation:0!==s,data:[{value:s}]},{name:"minute",animation:0!==a,data:[{value:a}]},{animation:0!==o,name:"second",data:[{value:o}]}]})}),1e3),e.setOption(option)},shouldUpdate:()=>!1};module.exports=e;

View File

@ -0,0 +1,4 @@
description: clock with echarts
module-type: echarts-component
title: $:/addon/clock.js
type: application/javascript

View File

@ -0,0 +1,10 @@
/*\
title: $:/addon/sevenday.js
module-type: echarts-component
type: application/javascript
description: 折线图
\*/
const e=(e,t="created")=>$tw.wiki.filterTiddlers(`[sameday:${t}[${e}]!is[system]!has[draft.of]]`).length,t=e=>new Date(`${e.substr(0,4)}-${e.substr(4,2)}-${e.substr(6,2)}`),a={title:"最近文章动态",opacity:.8,xLegend:"日期",yLegend:"文章数量",lineWidth:0,symbolSize:0},o={onUpdate(o,i,s){const{days:r,date:d,title:n=a.title,subtitle:l="",disableClick:c="no"}=s,f=function(e,a=7){const o=e?t(e):new Date,i=[];for(let e=0;e<a;e++){const e=o.getFullYear(),t=String(o.getMonth()+1).padStart(2,"0"),a=String(o.getDate()).padStart(2,"0");i.unshift(e+t+a),o.setDate(o.getDate()-1)}return i}(d,r),m=[],h=[];f.forEach((t=>m.push(e(t)))),f.forEach((t=>h.push(e(t,"modified"))));const y={title:{text:n,subtext:l,left:"center",top:"bottom"},legend:{data:["created","modified"]},toolbox:{feature:{restore:{}}},tooltip:{trigger:"item",
// type: 'cross',
formatter:function(e){const{name:a,value:o,seriesName:i}=e,s=t(a).toLocaleDateString();return"created"===i?o?`${s} 新增了 ${o} 篇文章`:`${s} 没有新增文章`:o?`${s} 更新了 ${o} 篇文章`:`${s} 没有文章更新`}},xAxis:{boundaryGap:!0,type:"category",data:f,name:a.xLegend},yAxis:{type:"value",name:a.yLegend},animationDuration:2e3,series:[{name:"created",data:m,type:"line",showSymbol:!1,symbolSize:a.symbolSize,stack:"Total",lineStyle:{width:a.lineWidth},endLabel:{show:!0,formatter:"{a}",distance:20},areaStyle:{opacity:a.opacity,color:new echarts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:"rgb(55, 162, 255)"},{offset:1,color:"rgb(116, 21, 219)"}])},emphasis:{focus:"series",itemStyle:{scale:1.5,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}},smooth:!0},{name:"modified",data:h,lineStyle:{width:a.lineWidth},symbolSize:a.symbolSize,stack:"Total",type:"line",showSymbol:!1,endLabel:{show:!0,formatter:"{a}",distance:20},areaStyle:{opacity:a.opacity,color:new echarts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:"rgb(128, 255, 165)"},{offset:1,color:"rgb(1, 191, 236)"}])},emphasis:{focus:"series",itemStyle:{scale:1.25,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}},smooth:!0}]};o.setOption(y),o.on("dblclick","series",(function(e){const{name:t,value:a,seriesName:o}=e,i=new $tw.Story,s=`[sameday:${o}[${t}]!is[system]!has[draft.of]]`;a&&($tw.rootWidget.invokeActionString('<$action-setfield $tiddler="$:/temp/advancedsearch" text="""'+s+'"""/><$action-setfield $tiddler="$:/temp/advancedsearch/input" text="""'+s+'"""/><$action-setfield $tiddler="$:/temp/advancedsearch/refresh" text="yes"/><$action-setfield $tiddler="$:/state/tab--1498284803" text="$:/core/ui/AdvancedSearch/Filter"/>'),i.navigateTiddler("$:/AdvancedSearch"))}))},shouldUpdate:()=>!1};module.exports=o;

View File

@ -0,0 +1,4 @@
description: 折线图
module-type: echarts-component
title: $:/addon/sevenday.js
type: application/javascript

View File

@ -0,0 +1,10 @@
/*\
title: $:/addon/tagpie.js
module-type: echarts-component
type: application/javascript
description: tag pie on tiddlywiki
\*/
const e=new $tw.Story,t=t=>{const o=t.name;$tw.wiki.tiddlerExists(o)?
// parentWidget.dispatchEvent( { type: 'tm-navigate', navigateTo: title } )
e.navigateTiddler(o):console.log(o+" not found")},o={onUpdate(e,o,s){const{title:r,filter:i="[tags[]!prefix[$:/]]",sort:l="descend",width:a=2,radius:n=10,toolbox:d="hide",doughnut:f,focusSelf:u,legend:c}=s,h=[];$tw.wiki.filterTiddlers(i).slice(0,50).sort().forEach((e=>h.push((e=>({name:e,value:$tw.wiki.filterTiddlers(`[tag[${e}]!has[draft.of]]`).length}))(e))));const g=h.length>10?0:a,p=h.length>10?5:n,m={title:{text:r,subtext:"",left:"left",top:"top"},toolbox:{show:"show"===d,left:0,bottom:0,feature:{dataView:{show:!0,readOnly:!1},restore:{},saveAsImage:{}}},tooltip:{trigger:"item",formatter:function(e){const{name:t,value:o,percent:s}=e;return o?`${t} 标签 有 ${o} 个条目 (${s}%)`:`${t} 条目`}},legend:{show:"yes"===c,orient:"vertical",right:10,top:20,bottom:20,type:"scroll"},series:[{name:"Tag",type:"pie",radius:"yes"===f?["40%","70%"]:"50%",center:"yes"===c?["40%","50%"]:"50%",data:h,itemStyle:{borderRadius:p,borderWidth:g,borderColor:"#fff"},emphasis:{focus:"yes"===u?"self":"",itemStyle:{}}}]};h.sort((function(e,t){return"descend"===l?t.value-e.value:e.value-t.value})),e.setOption(m),e.on("click","series",t)},shouldUpdate:(e,t)=>!!Object.keys(t).filter((e=>"$:/info/darkmode"===e||!e.startsWith("$:/")&&!e.startsWith("Draft of"))).length};module.exports=o;

View File

@ -0,0 +1,4 @@
description: tag pie on tiddlywiki
module-type: echarts-component
title: $:/addon/tagpie.js
type: application/javascript

View File

@ -0,0 +1,20 @@
<$badge icon="echarts" />
[img[https://i.imgur.com/9BEZnR3.png]]
[img[https://i.imgur.com/myoq7V4.png]]
[img[https://i.imgur.com/Zz1Qe8i.png]]
> 目前支持 clockc, tagpie, sevenday, 三种 addon
* 将 echarts 的 addons 独立出来,使用 js 编写,不依赖外部环境,即使在 tw 里面也能快速修改,方便用户修改
## Usage
> coming ...
## TODO
* update tooltip style to fix darkmode
* support qrcode field to show current tiddler url qrcode
<$qrcode type=url />

View File

@ -0,0 +1,2 @@
title: $:/plugins/oeyoews/echarts-addons/readme
type: text/markdown

View File

@ -0,0 +1,18 @@
{
"created": "20240129095432732",
"creator": "Octt",
"version": "0.0.2",
"title": "$:/plugins/oeyoews/echarts-addons",
"plugin-type": "plugin",
"name": "Echarts Addons",
"description": "Addons",
"author": "oeyoews",
"meta#disabled": "yes",
"parent-plugin": "$:/plugins/Gk0Wk/echarts",
"list": "readme",
"dependents": "",
"revision": "0",
"bag": "default",
"modified": "20240129095443682",
"modifier": "Octt"
}