mirror of
https://gitlab.com/octtspacc/OcttKB
synced 2025-02-01 23:26:46 +01:00
OcttKB Cross-Repo Sync (HTML to Raw)
This commit is contained in:
parent
091ea33e87
commit
35eb8cb93e
@ -0,0 +1,16 @@
|
||||
created: 20171230164920491
|
||||
modified: 20171230165117169
|
||||
tags:
|
||||
title: $:/plugins/ebalster/condition/changelog
|
||||
|
||||
!!Version 0.1.1 — December 30, 2017
|
||||
|
||||
* Fix an error when refreshing the condition widget.
|
||||
* Fix "match" attribute not working as expected.
|
||||
|
||||
|
||||
!!Version 0.1.0 — December 29, 2017
|
||||
|
||||
* Initial implementation.
|
||||
* Includes $if, $else, $else-if
|
||||
* Common code in condition.js
|
@ -0,0 +1,28 @@
|
||||
caption: license
|
||||
created: 20171230044445712
|
||||
modified: 20171230044506791
|
||||
revision: 0
|
||||
tags:
|
||||
title: $:/plugins/ebalster/condition/license
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
!!The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Evan Balster
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -0,0 +1,94 @@
|
||||
caption: readme
|
||||
created: 20171230044517252
|
||||
modified: 20171230052355854
|
||||
revision: 0
|
||||
tags:
|
||||
title: $:/plugins/ebalster/condition/readme
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The ''Condition'' plugin for TiddlyWiki, version {{$:/plugins/ebalster/condition!!version}}, by Evan Balster.
|
||||
|
||||
This plugin defines widgets that will either show or hide their contents depending on a condition.
|
||||
|
||||
Unlike the closely-related reveal widget, condition widgets do //not// retain their content, and do not support animation or popups. Conditions may be based on variables, macros or filtered attributes. It can also be used with the [[Formula Plugin]].
|
||||
|
||||
|
||||
!!Truthiness
|
||||
|
||||
Truthiness is a simple rule for whether a value triggers an "if" widget or not. Values are "truthy" if they do not match any of the "falsy" values below:
|
||||
|
||||
* The number `0`, including any decimal point.
|
||||
* `false`
|
||||
* `undefined`
|
||||
* `null`
|
||||
* Blank (no text)
|
||||
|
||||
This matching is case-insensitive, and any whitespace before or after the value will be ignored.
|
||||
|
||||
|
||||
!!If Widget
|
||||
|
||||
The `$if` widget will show its content based on whether a value is "truthy", or matches another value.
|
||||
|
||||
|Attribute|Meaning|h
|
||||
|value|''Required.'' Content is shown if `value` is truthy.|
|
||||
|match|Optional. If present, `value` and `match` must equal //exactly// for content to be shown. (Truthiness doesn't matter.)|
|
||||
|not|Inverts the condition, so the value will be shown if it would be hidden and vice versa.|
|
||||
|
||||
For example,
|
||||
|
||||
```
|
||||
<$if not value={{$:/StoryList}}>
|
||||
No tiddlers are open right now!
|
||||
</$if>
|
||||
```
|
||||
|
||||
|
||||
!!Else Widget
|
||||
|
||||
The `$else` widget has no attributes. It must be placed after one of the conditional widgets listed below, and will only show its contents if the preceding widget is //not// showing its content.
|
||||
|
||||
|After...|Show contents when...|h
|
||||
|`$if`<br/>`$else-if`|None of the previous if-conditions was true.|
|
||||
|`$list`|The list is empty. `$else` can be used instead of emptyMessage.|
|
||||
|`$reveal`|The contents of the reveal widget are hidden.|
|
||||
|`$else`|An else after an else will //never// be shown.|
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
<$if value={{{[tag[Note]]}}}>
|
||||
!!My notes:
|
||||
<$list filter="[tag[Note]]">
|
||||
- {{!!title}}
|
||||
</$list>
|
||||
</$if>
|
||||
<$else>
|
||||
!!I don't have any notes...
|
||||
</$else>
|
||||
```
|
||||
|
||||
Note that the else widget can't have any blank lines between it and the preceding widget.
|
||||
|
||||
|
||||
!!Else-If Widget
|
||||
|
||||
The `$else-if` widget is a combination of the `$else` and `$if` widgets, and has the same attributes as the `$if` widget. Its content will only be displayed if the previous widget is //not// showing its content //and// the `$if`-condition is true.
|
||||
|
||||
`$else-if` widgets can be used to perform a "chain" of tests, showing some text based on the first condition that passes (or fails). For example:
|
||||
|
||||
```
|
||||
Something approaches...
|
||||
|
||||
<$if value={{!!animal}} match=cat> Meow! </$if>
|
||||
<$else-if value={{!!animal}} match=dog> Bark! </$else-if>
|
||||
<$else-if value={{!!animal}} match=bird> Tweet! </$else-if>
|
||||
<$else> This isn't like any animal you've seen before. </$else>
|
||||
```
|
||||
|
||||
|
||||
!!Help & Support
|
||||
|
||||
This plugin is a work in progress; seek help with it on the TiddlyWiki Google Group: https://groups.google.com/forum/#!forum/tiddlywiki
|
||||
|
||||
Or E-mail me directly: [[evan@imitone.com|mailto://evan@imitone.com]]
|
@ -0,0 +1,15 @@
|
||||
created: 20171230044112191
|
||||
modified: 20171230165309317
|
||||
revision: 0
|
||||
tags:
|
||||
title: $:/plugins/ebalster/condition/repack
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
Repacking command (use this in the browser console to repack the plugin)
|
||||
|
||||
<pre><code>$tw.utils.repackPlugin("$:/plugins/ebalster/condition", (= "[" & textjoin(",",
|
||||
TRUE,
|
||||
[prefix[$:/plugins/ebalster/condition/]addprefix["]addsuffix["]]) & "]" =));
|
||||
</code></pre>
|
||||
|
||||
Version: <$edit-text tiddler="$:/plugins/ebalster/condition" field="version" />
|
@ -0,0 +1,163 @@
|
||||
/*\
|
||||
title: $:/plugins/ebalster/condition/widgets/condition.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Base class for condition widgets.
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var ConditionWidget = function(parseTreeNode,options) {
|
||||
if(arguments.length > 0) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
ConditionWidget.prototype = new Widget();
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
ConditionWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.computeAttributes();
|
||||
this.execute();
|
||||
this.rerender(parent,nextSibling);
|
||||
};
|
||||
|
||||
ConditionWidget.prototype.rerender = function(parent,nextSibling) {
|
||||
this.removeChildDomNodes();
|
||||
if (this.conditionError) {
|
||||
// Show an error.
|
||||
var parseTreeNodes = [{type: "element", tag: "span", attributes: {
|
||||
"class": {type: "string", value: "tc-error"}
|
||||
}, children: [
|
||||
{type: "text", text: this.conditionError}
|
||||
]}];
|
||||
this.makeChildWidgets(parseTreeNodes);
|
||||
}
|
||||
else if (this.isOpen) {
|
||||
// Construct and render the child widgets.
|
||||
this.makeChildWidgets(this.parseTreeNode.children);
|
||||
}
|
||||
else {
|
||||
// Destroy the child widgets.
|
||||
this.children = [];
|
||||
}
|
||||
this.renderChildren(parent,nextSibling);
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget (default behavior)
|
||||
*/
|
||||
ConditionWidget.prototype.execute = function() {
|
||||
this.executeIf("$condition");
|
||||
};
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
ConditionWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var currentlyOpen = this.isOpen;
|
||||
var changedAttributes = this.computeAttributes();
|
||||
this.execute();
|
||||
if(this.isOpen !== currentlyOpen) {
|
||||
var nextSibling = this.findNextSiblingDomNode();
|
||||
this.rerender(this.parentDomNode,nextSibling);
|
||||
return true;
|
||||
}
|
||||
return this.refreshChildren(changedTiddlers);
|
||||
};
|
||||
|
||||
/*
|
||||
Utility: Is a value "truthy"?
|
||||
*/
|
||||
ConditionWidget.prototype.valueIsTruthy = function(value) {
|
||||
// It's truthy if it's not falsy, ie, undefined, false, blank or zero.
|
||||
return !(/^\s*(undefined|false|null|0+|0*\.0+|0+\.0*|)\s*$/i.test(value));
|
||||
};
|
||||
|
||||
/*
|
||||
Utility: Find a preceding non-text widget for an "else" widget.
|
||||
*/
|
||||
ConditionWidget.prototype.findPrecedingConditionWidget = function() {
|
||||
var siblings = (this.parentWidget ? this.parentWidget.children : null);
|
||||
var sibling;
|
||||
if (siblings) {
|
||||
for (var i = siblings.indexOf(this)-1; i >= 0; --i) {
|
||||
sibling = siblings[i];
|
||||
if (sibling.parseTreeNode.type == "text") continue;
|
||||
if (sibling.isOpen != null || sibling.list != null) return sibling;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/*
|
||||
Utility: Test if another widget triggers an "else"; ie, false conditions, closed reveals, empty lists.
|
||||
*/
|
||||
ConditionWidget.prototype.widgetTriggersElse = function(widget) {
|
||||
// Condition widgets
|
||||
if (widget.triggerElse != null) return widget.triggerElse;
|
||||
// Reveal widget
|
||||
if (widget.isOpen != null) return !widget.isOpen;
|
||||
// List widget
|
||||
if (widget.list != null) return (widget.list instanceof Array) && widget.list.length == 0;
|
||||
};
|
||||
|
||||
/*
|
||||
Utility: Execute as an "else" condition, computing isOpen and conditionError accordingly.
|
||||
*/
|
||||
ConditionWidget.prototype.executeElse = function(widgetName) {
|
||||
this.isOpen = false;
|
||||
this.conditionError = null;
|
||||
this.triggerElse = false;
|
||||
var predicate = this.findPrecedingConditionWidget();
|
||||
if (!predicate) {
|
||||
this.conditionError = (widgetName||"$else") + " widget must follow $if, $else-if, $reveal or $list.";
|
||||
return;
|
||||
}
|
||||
this.isOpen = this.widgetTriggersElse(predicate);
|
||||
};
|
||||
|
||||
/*
|
||||
Utility: Execute as an "if" condition, computing isOpen and conditionError accordingly.
|
||||
*/
|
||||
ConditionWidget.prototype.executeIf = function(widgetName) {
|
||||
this.isOpen = false;
|
||||
this.conditionError = null;
|
||||
this.triggerElse = false;
|
||||
// Re-check our "if" condition.
|
||||
var value = this.getAttribute("value");
|
||||
var match = this.getAttribute("match");
|
||||
if (value == null) {
|
||||
this.conditionError = (widgetName||"$condition") + " widget requires a 'value' attribute.";
|
||||
return;
|
||||
}
|
||||
else if (match == null) {
|
||||
// Open if the value is truthy.
|
||||
this.isOpen = this.valueIsTruthy(value);
|
||||
}
|
||||
else {
|
||||
this.isOpen = (value == match);
|
||||
}
|
||||
if (this.getAttribute("not")) {
|
||||
this.isOpen = !this.isOpen;
|
||||
}
|
||||
this.triggerElse = !this.isOpen;
|
||||
};
|
||||
|
||||
exports.condition = ConditionWidget;
|
||||
|
||||
})();
|
@ -0,0 +1,8 @@
|
||||
created: 20171230024342810
|
||||
description: As the $vars widget, but each attribute is interpreted as a formula.
|
||||
modified: 20171230024403999
|
||||
module-type: widget
|
||||
revision: 0
|
||||
tags:
|
||||
title: $:/plugins/ebalster/condition/widgets/condition.js
|
||||
type: application/javascript
|
@ -0,0 +1,36 @@
|
||||
/*\
|
||||
title: $:/plugins/ebalster/condition/widgets/if.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
If-condition widget
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var ConditionWidget = require("$:/plugins/ebalster/condition/widgets/condition.js").condition;
|
||||
|
||||
var ElifWidget = function(parseTreeNode,options) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
ElifWidget.prototype = new ConditionWidget();
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
ElifWidget.prototype.execute = function() {
|
||||
this.executeElse("$else-if");
|
||||
if (this.isOpen) this.executeIf("$if");
|
||||
};
|
||||
|
||||
exports["else-if"] = ElifWidget;
|
||||
|
||||
})();
|
@ -0,0 +1,8 @@
|
||||
created: 20171230040903429
|
||||
description: As the $vars widget, but each attribute is interpreted as a formula.
|
||||
modified: 20171230040911552
|
||||
module-type: widget
|
||||
revision: 0
|
||||
tags:
|
||||
title: $:/plugins/ebalster/condition/widgets/elif.js
|
||||
type: application/javascript
|
@ -0,0 +1,36 @@
|
||||
/*\
|
||||
title: $:/plugins/ebalster/condition/widgets/if.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
If-condition widget
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var ConditionWidget = require("$:/plugins/ebalster/condition/widgets/condition.js").condition;
|
||||
|
||||
var ElseWidget = function(parseTreeNode,options) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
ElseWidget.prototype = new ConditionWidget();
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
ElseWidget.prototype.execute = function() {
|
||||
// Execute as an else condition.
|
||||
this.executeElse("$else");
|
||||
};
|
||||
|
||||
exports.else = ElseWidget;
|
||||
|
||||
})();
|
@ -0,0 +1,8 @@
|
||||
created: 20171230025320439
|
||||
description: As the $vars widget, but each attribute is interpreted as a formula.
|
||||
modified: 20171230025331858
|
||||
module-type: widget
|
||||
revision: 0
|
||||
tags:
|
||||
title: $:/plugins/ebalster/condition/widgets/else.js
|
||||
type: application/javascript
|
@ -0,0 +1,35 @@
|
||||
/*\
|
||||
title: $:/plugins/ebalster/condition/widgets/if.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
If-condition widget
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var ConditionWidget = require("$:/plugins/ebalster/condition/widgets/condition.js").condition;
|
||||
|
||||
var IfWidget = function(parseTreeNode,options) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
IfWidget.prototype = new ConditionWidget();
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
IfWidget.prototype.execute = function() {
|
||||
this.executeIf("$if");
|
||||
};
|
||||
|
||||
exports.if = IfWidget;
|
||||
|
||||
})();
|
@ -0,0 +1,8 @@
|
||||
created: 20171230002741585
|
||||
description: As the $vars widget, but each attribute is interpreted as a formula.
|
||||
modified: 20171230004310622
|
||||
module-type: widget
|
||||
revision: 0
|
||||
tags:
|
||||
title: $:/plugins/ebalster/condition/widgets/if.js
|
||||
type: application/javascript
|
12
Wiki-OcttKB/plugins/condition/plugin.info
Normal file
12
Wiki-OcttKB/plugins/condition/plugin.info
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"bag": "default",
|
||||
"revision": "0",
|
||||
"version": "0.1.2",
|
||||
"title": "$:/plugins/ebalster/condition",
|
||||
"tags": "",
|
||||
"plugin-type": "plugin",
|
||||
"modified": "20171230165413285",
|
||||
"list": "readme license changelog",
|
||||
"dependents": "",
|
||||
"created": "20171230044033218"
|
||||
}
|
@ -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;
|
@ -0,0 +1,3 @@
|
||||
description:
|
||||
title: $:/addon/bookprogress.js
|
||||
type: application/javascript
|
7
Wiki-OcttKB/plugins/echarts-addons/$__addon_clock.js
Normal file
7
Wiki-OcttKB/plugins/echarts-addons/$__addon_clock.js
Normal 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;
|
@ -0,0 +1,4 @@
|
||||
description: clock with echarts
|
||||
module-type: echarts-component
|
||||
title: $:/addon/clock.js
|
||||
type: application/javascript
|
10
Wiki-OcttKB/plugins/echarts-addons/$__addon_sevenday.js
Normal file
10
Wiki-OcttKB/plugins/echarts-addons/$__addon_sevenday.js
Normal 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;
|
@ -0,0 +1,4 @@
|
||||
description: 折线图
|
||||
module-type: echarts-component
|
||||
title: $:/addon/sevenday.js
|
||||
type: application/javascript
|
10
Wiki-OcttKB/plugins/echarts-addons/$__addon_tagpie.js
Normal file
10
Wiki-OcttKB/plugins/echarts-addons/$__addon_tagpie.js
Normal 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;
|
@ -0,0 +1,4 @@
|
||||
description: tag pie on tiddlywiki
|
||||
module-type: echarts-component
|
||||
title: $:/addon/tagpie.js
|
||||
type: application/javascript
|
@ -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 />
|
@ -0,0 +1,2 @@
|
||||
title: $:/plugins/oeyoews/echarts-addons/readme
|
||||
type: text/markdown
|
18
Wiki-OcttKB/plugins/echarts-addons/plugin.info
Normal file
18
Wiki-OcttKB/plugins/echarts-addons/plugin.info
Normal 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"
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
created: 20230109220804304
|
||||
creator: Octt
|
||||
modified: 20230208171053772
|
||||
modified: 20240129095852920
|
||||
modifier: Octt
|
||||
tags: OcttKB $:/i18n:en
|
||||
title: OcttKB/Data
|
||||
@ -17,7 +17,15 @@ Are these useless? ''Yes!'' But they are so pretty...
|
||||
<$echarts $tiddler="$:/plugins/Gk0Wk/echarts/addons/GitHubHeatMap.js" $width="100%" $height="100%" />
|
||||
</div>
|
||||
|
||||
<br /><hr /><br />
|
||||
<br/><hr/><br/>
|
||||
|
||||
<div class="my-8">
|
||||
<div class="dark:hidden">
|
||||
<$echarts $tiddler="$:/addon/sevenday.js" $theme='light' days=60 title="最近文章数量"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br/><hr/><br/>
|
||||
|
||||
<div class="NoSelect PIP-Select">
|
||||
<!--
|
||||
@ -35,10 +43,10 @@ Are these useless? ''Yes!'' But they are so pretty...
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
|
||||
<br /><hr /><br />
|
||||
<br/><hr/><br/>
|
||||
|
||||
<$echarts $tiddler="$:/plugins/Gk0Wk/echarts/addons/TagCloud.js" />
|
||||
|
||||
<br /><hr /><br />
|
||||
<br/><hr/><br/>
|
||||
|
||||
I still have to put a lot of stuff here... see [[OcttKB/WIP]]
|
@ -1,7 +1,8 @@
|
||||
created: 20230111153852789
|
||||
creator: Octt
|
||||
modified: 20230225112624871
|
||||
modified: 20240129112714041
|
||||
modifier: Octt
|
||||
page-cover: https://source.unsplash.com/random?2048
|
||||
tags: Puzzle $:/i18n:en Game Generic Libre $:/Games
|
||||
title: 2048
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
created: 20230817233331840
|
||||
creator: Octt
|
||||
modified: 20230817233610503
|
||||
modifier: Octt
|
||||
tags: $:/Apps
|
||||
title: $:/Apps/BBCodeAssembler
|
75
Wiki-OcttKB/tiddlers/System/Apps/_MagicBox.tid
Normal file
75
Wiki-OcttKB/tiddlers/System/Apps/_MagicBox.tid
Normal file
@ -0,0 +1,75 @@
|
||||
created: 20240129095948486
|
||||
creator: Octt
|
||||
modified: 20240129125736163
|
||||
modifier: Octt
|
||||
tags: $:/Apps
|
||||
title: $:/Apps/MagicBox
|
||||
|
||||
\define SearchResults(fields)
|
||||
<$list filter="[!is[system]search:$fields${$:/temp/MagicBox!!.input}sort[title]limit[150]]">
|
||||
<div class=`MagicBoxResult ${[{$:/temp/MagicBox!!.type}]}$` style=`background-image: url("${[{!!page-cover}]}$");`>
|
||||
<$link to={{!!title}}>
|
||||
<h3>
|
||||
<$link to={{!!title}}/>
|
||||
</h3>
|
||||
<$if value={{$:/temp/MagicBox!!.context}}>
|
||||
<$context term={{$:/temp/MagicBox!!.input}}/>
|
||||
</$if>
|
||||
</$link>
|
||||
</div>
|
||||
</$list>
|
||||
\end
|
||||
|
||||
<div>
|
||||
<$edit-text tiddler="$:/temp/MagicBox" field=".input" placeholder="Search..."/>
|
||||
<$checkbox tiddler="$:/temp/MagicBox" field=".context" checked="1">Context</$checkbox>
|
||||
<!--<$edit-text tiddler="$:/temp/MagicBox" field=".type" placeholder="Display Type"/>-->
|
||||
<$checkbox tiddler="$:/temp/MagicBox" field=".type" checked="grid">Fixed Grid</$checkbox>
|
||||
<$range tiddler="$:/temp/MagicBox" field=".width" min="33" max="49"/>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.MagicBoxResult {
|
||||
margin: 8px;
|
||||
display: inline-block;
|
||||
background-color: lightgray;
|
||||
background-size: cover;
|
||||
aspect-ratio: 16/9;
|
||||
max-width: calc({{$:/temp/MagicBox!!.width}}% - 16px);
|
||||
}
|
||||
.MagicBoxResult.grid {
|
||||
width: calc(33% - 16px);
|
||||
}
|
||||
.MagicBoxResult h3 {
|
||||
margin-top: 25%;
|
||||
padding: 8px;
|
||||
background-color: rgba(255, 255, 255, 0.75);
|
||||
text-align: center;
|
||||
}
|
||||
.MagicBoxResult pre {
|
||||
color: initial;
|
||||
max-height: 10em;
|
||||
overflow-y: auto;
|
||||
margin: 0;
|
||||
top: 1em;
|
||||
position: relative;
|
||||
}
|
||||
.MagicBoxResult > a {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.MagicBoxResult > a:after {
|
||||
content: "" !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<$if value={{{ [{$:/temp/MagicBox!!.input}split[]count[]compare:integer:gteq[3]then[1]] }}}>
|
||||
Title or Caption matches:
|
||||
<br/><<SearchResults "title,caption">>
|
||||
|
||||
<div><br/><hr/><br/></div>
|
||||
|
||||
Tags or Text matches:
|
||||
<br/><<SearchResults "tags,text">>
|
||||
</$if>
|
@ -1,6 +1,6 @@
|
||||
created: 20230108190740128
|
||||
creator: Octt
|
||||
modified: 20240127214256070
|
||||
modified: 20240129121756874
|
||||
modifier: Octt
|
||||
tags: $:/tags/Stylesheet
|
||||
title: $:/Styles/Main
|
||||
@ -26,6 +26,11 @@ html, body {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
div.commandpalette {
|
||||
min-width: 75vw;
|
||||
max-width: 100vw;
|
||||
}
|
||||
|
||||
/* Override the font used for icon display by the the <$:/plugins/Gk0Wk/notionpage-covericon> plugin, and then also apply it to the :after of .tc-tiddlylink anchors, for consistency.
|
||||
We override adding a "sans-serif" to the start due to a spacing bug (?) */
|
||||
.gk0wk-notionpagebg-icon1,
|
||||
|
@ -1,5 +1,5 @@
|
||||
created: 20240129010956583
|
||||
created: 20240129130848548
|
||||
current-tiddler: GettingStarted
|
||||
modified: 20240129010956583
|
||||
modified: 20240129130848548
|
||||
title: $:/HistoryList
|
||||
type: application/json
|
@ -3,4 +3,4 @@ title: $:/Import
|
||||
|
||||
The following tiddlers were imported:
|
||||
|
||||
# [[$:/plugins/oeyoews/commandpalette/icon]]
|
||||
# [[$:/plugins/ebalster/condition]]
|
@ -1,2 +1,6 @@
|
||||
created: 20240129112639085
|
||||
creator: Octt
|
||||
list:
|
||||
modified: 20240129125711061
|
||||
modifier: Octt
|
||||
title: $:/StoryList
|
@ -0,0 +1,12 @@
|
||||
caption: Context
|
||||
created: 20240129101557058
|
||||
creator: Octt
|
||||
modified: 20240129101627850
|
||||
modifier: Octt
|
||||
tags: $:/tags/SearchResults
|
||||
title: $:/plugins/danielo515/ContextPlugin/visualizer
|
||||
|
||||
<$list filter="[!is[system]search{$:/temp/search}sort[title]limit[150]]"><!-- Brought down to 150 from the original 250 to attempt to reduce lag on mobile -->
|
||||
{{!!title||$:/core/ui/ListItemTemplate}}
|
||||
<$context term={{$:/temp/search}} />
|
||||
</$list>
|
@ -1,6 +1,6 @@
|
||||
created: 20220920140732083
|
||||
creator: Octt
|
||||
modified: 20240129005620170
|
||||
modified: 20240129100429521
|
||||
modifier: Octt
|
||||
title: $:/state/showeditpreview
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
created: 20220920090533937
|
||||
creator: Octt
|
||||
modified: 20231110114944899
|
||||
modified: 20240129120246880
|
||||
modifier: Octt
|
||||
title: $:/state/tab--1963855381
|
||||
|
||||
$:/core/ui/ControlPanel/Palette
|
||||
$:/core/ui/ControlPanel/Toolbars
|
@ -1,7 +1,7 @@
|
||||
created: 20220920090405977
|
||||
creator: Octt
|
||||
modified: 20240129010805185
|
||||
modified: 20240129120243906
|
||||
modifier: Octt
|
||||
title: $:/state/tab-1749438307
|
||||
|
||||
$:/core/ui/ControlPanel/Plugins
|
||||
$:/core/ui/ControlPanel/Appearance
|
@ -0,0 +1,7 @@
|
||||
created: 20240129095343238
|
||||
creator: Octt
|
||||
modified: 20240129095343238
|
||||
modifier: Octt
|
||||
title: $:/state/plugin-info--274784486-$:/plugins/oeyoews/echarts-addons---173507521
|
||||
|
||||
contents
|
@ -1,7 +0,0 @@
|
||||
created: 20240128234400100
|
||||
creator: Octt
|
||||
modified: 20240129005448654
|
||||
modifier: Octt
|
||||
title: $:/state/search-list/selected-item--1546365138
|
||||
|
||||
TiddlyWiki/TipsAndTricks-primaryList
|
@ -1,6 +1,6 @@
|
||||
created: 20220920092307479
|
||||
creator: Octt
|
||||
modified: 20240129010410225
|
||||
modified: 20240129122104626
|
||||
modifier: Octt
|
||||
title: $:/state/tab/sidebar--595412856
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
created: 20220920114638764
|
||||
creator: Octt
|
||||
modified: 20230128224606306
|
||||
modified: 20240129120304646
|
||||
modifier: Octt
|
||||
title: $:/state/tabs/controlpanel/toolbars-1345989671
|
||||
|
||||
$:/core/ui/ControlPanel/Toolbars/PageControls
|
||||
$:/core/ui/ControlPanel/Toolbars/EditorToolbar
|
@ -1,6 +1,6 @@
|
||||
created: 20230817233312379
|
||||
creator: Octt
|
||||
modified: 20231107154741134
|
||||
modified: 20240129125712407
|
||||
modifier: Octt
|
||||
title: $:/state/toc/$:/ToC-$:/Apps--1697730578
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
created: 20230111091048227
|
||||
creator: Octt
|
||||
modified: 20231107223047754
|
||||
modified: 20240129092940714
|
||||
modifier: Octt
|
||||
title: $:/state/tree/$:/Styles/View/
|
||||
|
||||
show
|
||||
hide
|
Loading…
x
Reference in New Issue
Block a user