mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-08-30 14:48:54 +00:00
docs: added size comparison of empty.html from prerelease and latest release
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
created: 20260714055110474
|
||||
modified: 20260714055129225
|
||||
tags:
|
||||
title: TiddlyWiki Pre-release Size Comparison
|
||||
|
||||
|
||||
\function bytes.to.mib(size) [abs[]divide[1048576]fixed[2]addsuffix[ MiB]]
|
||||
\function bytes.to.kib(size) [abs[]divide[1024]fixed[2]addsuffix[ KiB]]
|
||||
\function format.file.size(size) [<size>abs[]compare:number:gteq[1048576]bytes.to.mib<size>] :else[<size>abs[]compare:number:gteq[1024]bytes.to.kib<size>] :else[<size>addsuffix[ bytes]]
|
||||
|
||||
|
||||
\procedure get-wiki-filesize(filepath)
|
||||
\procedure completion-get-json()
|
||||
<!-- Success -->
|
||||
<$list filter="[<status>compare:number:gteq[200]compare:number:lteq[299]]" variable="ignore">
|
||||
<$action-log msg="completed" size={{{ [<data>jsonget[size]] }}}/>
|
||||
<$action-setfield $tiddler=`$:/temp/file-size-comparison/$(filepath)$` text={{{ [<data>jsonget[size]] }}} />
|
||||
</$list>
|
||||
\end completion-get-json
|
||||
|
||||
<$action-sendmessage
|
||||
$message="tm-http-request"
|
||||
url=`https://api.github.com/repos/TiddlyWiki/tiddlywiki.com-gh-pages/contents/$(filepath)$?ref=master`
|
||||
method="GET"
|
||||
oncompletion=<<completion-get-json>>
|
||||
var-filepath=<<filepath>>
|
||||
/>
|
||||
\end get-wiki-filesize
|
||||
|
||||
\procedure get-wiki-filesizes()
|
||||
<$list filter="empty.html prerelease/empty.html" variable="filepath">
|
||||
<$action-log />
|
||||
<<$transclude $variable="get-wiki-filesize" filepath=<<filepath>> >>
|
||||
|
||||
</$list>
|
||||
\end get-wiki-filesizes
|
||||
|
||||
|
||||
<%if [[$:/temp/file-size-comparison/empty.html]is[tiddler]] [[$:/temp/file-size-comparison/prerelease/empty.html]is[tiddler]] :and[count[]match[2]]%>
|
||||
<$let delta={{{ [{$:/temp/file-size-comparison/empty.html}subtract{$:/temp/file-size-comparison/prerelease/empty.html}] }}}
|
||||
message={{{ [<delta>sign[]match[-1]then[Size increased]] :else[<delta>sign[]match[1]then[Size decreased]] :else[[Size has not changed]] }}}
|
||||
>
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="158" height="20" role="img" style.zoom="1.5" aria-label="<$text text=<<message>>/>: <$text text={{{ [format.file.size<delta>] }}} /> bytes">
|
||||
<title><$text text=<<message>>/>: <$text text={{{ [format.file.size<delta>] }}} /></title>
|
||||
<filter id="blur">
|
||||
<feGaussianBlur stdDeviation="16"/>
|
||||
</filter>
|
||||
<linearGradient id="s" x2="0" y2="100%">
|
||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||
<stop offset="1" stop-opacity=".1"/>
|
||||
</linearGradient>
|
||||
<clipPath id="r">
|
||||
<rect width="158" height="20" rx="3"/>
|
||||
</clipPath>
|
||||
<g clip-path="url(#r)">
|
||||
<rect width="93" height="20" fill="#555"/>
|
||||
<rect x="93" width="65" height="20" fill="#67ac09"/>
|
||||
<rect width="158" height="20" fill="url(#s)"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110">
|
||||
<g transform="scale(.1)">
|
||||
<g aria-hidden="true" fill="#010101">
|
||||
<text x="475" y="150" fill-opacity=".8" filter="url(#blur)" textLength="830"><$text text=<<message>>/></text>
|
||||
<text x="475" y="150" fill-opacity=".3" textLength="830"><$text text=<<message>>/></text>
|
||||
</g>
|
||||
<text x="475" y="140" textLength="830"><$text text=<<message>>/></text>
|
||||
</g>
|
||||
<g transform="scale(.1)">
|
||||
<g aria-hidden="true" fill="#010101">
|
||||
<text x="1245" y="150" fill-opacity=".8" filter="url(#blur)" textLength="550"><$text text={{{ [format.file.size<delta>] }}} /></text>
|
||||
<text x="1245" y="150" fill-opacity=".3" textLength="550"><$text text={{{ [format.file.size<delta>] }}} /></text>
|
||||
</g>
|
||||
<text x="1245" y="140" textLength="550"><$text text={{{ [format.file.size<delta>] }}} /></text>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
; Pre-release empty.html
|
||||
: <$text text={{{ [{$:/temp/file-size-comparison/prerelease/empty.html}] }}} /> bytes
|
||||
; <$text text={{{ [tag[ReleaseNotes]sort[released]last[]] }}} /> empty.html
|
||||
: <$text text={{{ [{$:/temp/file-size-comparison/empty.html}] }}} /> bytes
|
||||
|
||||
---
|
||||
|
||||
</$let>
|
||||
<%else %>
|
||||
<$button actions=<<get-wiki-filesizes>> class="tc-btn-big-green">
|
||||
Compare size of empty.html
|
||||
</$button>
|
||||
<%endif%>
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ The pre-release is also available as an [[empty wiki|https://tiddlywiki.com/prer
|
||||
|
||||
</div>
|
||||
|
||||
{{ TiddlyWiki Pre-release Size Comparison }}
|
||||
|
||||
<$list filter="[tag[ReleaseNotes]!has[released]!sort[created]]">
|
||||
<div class="tc-titlebar">
|
||||
<h2 class="tc-title"><$text text=<<currentTiddler>>/></h2>
|
||||
|
||||
Reference in New Issue
Block a user