1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-25 23:03:15 +00:00

Introduce refresh button and revert home button

Now the home button behaves as it did in 5.0.13, and the new refresh
button does a full page refresh.
This commit is contained in:
Jermolene 2014-08-19 12:12:36 +01:00
parent 074cbf2606
commit 920e11e792
8 changed files with 46 additions and 6 deletions

View File

@ -0,0 +1,8 @@
title: $:/core/images/refresh-button
tags: $:/tags/Image
<svg class="tw-image-refresh-button tw-image-button" width="22pt" height="22pt" viewBox="0 0 128 128">
<g fill-rule="evenodd">
<path d="M106.369002,39.4325143 C116.529932,60.3119371 112.939592,86.1974934 95.5979797,103.539105 C73.7286194,125.408466 38.2713806,125.408466 16.4020203,103.539105 C-5.46734008,81.6697449 -5.46734008,46.2125061 16.4020203,24.3431458 C19.5262146,21.2189514 24.5915344,21.2189514 27.7157288,24.3431458 C30.8399231,27.4673401 30.8399231,32.5326599 27.7157288,35.6568542 C12.0947571,51.2778259 12.0947571,76.6044251 27.7157288,92.2253967 C43.3367004,107.846368 68.6632996,107.846368 84.2842712,92.2253967 C97.71993,78.7897379 99.5995262,58.1740623 89.9230597,42.729491 L83.4844861,54.9932839 C81.4307001,58.9052072 76.5945372,60.4115251 72.682614,58.3577391 C68.7706907,56.3039532 67.2643728,51.4677903 69.3181587,47.555867 L84.4354914,18.7613158 C86.4966389,14.8353707 91.3577499,13.3347805 95.273202,15.415792 L124.145886,30.7612457 C128.047354,32.8348248 129.52915,37.6785572 127.455571,41.5800249 C125.381992,45.4814927 120.53826,46.9632892 116.636792,44.8897102 L106.369002,39.4325143 Z M98.1470904,27.0648707 C97.9798954,26.8741582 97.811187,26.6843098 97.6409651,26.4953413 L98.6018187,26.1987327 L98.1470904,27.0648707 Z"></path>
</g>
</svg>

View File

@ -31,7 +31,7 @@ Import/Hint: Import files
Info/Caption: info
Info/Hint: Show information for this tiddler
Home/Caption: home
Home/Hint: Refresh the page and open the home tiddlers
Home/Hint: Open the default tiddlers
Language/Caption: language
Language/Hint: Choose the user interface language
NewTiddler/Caption: new tiddler
@ -42,6 +42,8 @@ Permalink/Caption: permalink
Permalink/Hint: Set browser address bar to a direct link to this tiddler
Permaview/Caption: permaview
Permaview/Hint: Set browser address bar to a direct link to all the tiddlers in this story
Refresh/Caption: refresh
Refresh/Hint: Perform a full refresh of the wiki
Save/Caption: save
Save/Hint: Save this tiddler
SaveWiki/Caption: save changes

View File

@ -49,10 +49,17 @@ exports.startup = function() {
openStartupTiddlers({defaultToCurrentStory: true});
}
},false)
// Listen for the tw-refresh message
$tw.rootWidget.addEventListener("tw-refresh",function(event) {
window.location.hash = "";
window.location.reload(true);
});
// Listen for the tw-home message
$tw.rootWidget.addEventListener("tw-home",function(event) {
window.location.hash = "";
window.location.reload(true);
var storyFilter = $tw.wiki.getTiddlerText(DEFAULT_TIDDLERS_TITLE),
storyList = $tw.wiki.filterTiddlers(storyFilter);
$tw.wiki.addTiddler({title: DEFAULT_STORY_TITLE, text: "", list: storyList},$tw.wiki.getModificationFields());
});
// Listen for the tw-permalink message
$tw.rootWidget.addEventListener("tw-permalink",function(event) {

View File

@ -0,0 +1,13 @@
title: $:/core/ui/Buttons/refresh
tags: $:/tags/PageControls
caption: {{$:/core/images/refresh-button}} {{$:/language/Buttons/Refresh/Caption}}
description: {{$:/language/Buttons/Refresh/Hint}}
<$button message="tw-refresh" title={{$:/language/Buttons/Refresh/Hint}} aria-label={{$:/language/Buttons/Refresh/Caption}} class=<<tw-config-toolbar-class>>>
<$list filter="[<tw-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/refresh-button}}
</$list>
<$list filter="[<tw-config-toolbar-text>prefix[yes]]">
<$text text={{$:/language/Buttons/Refresh/Caption}}/>
</$list>
</$button>

View File

@ -4,6 +4,7 @@ core/ui/Buttons/close-all: hide
core/ui/Buttons/encryption: hide
core/ui/Buttons/full-screen: hide
core/ui/Buttons/home: hide
core/ui/Buttons/refresh: hide
core/ui/Buttons/import: hide
core/ui/Buttons/language: hide
core/ui/Buttons/tag-manager: hide

View File

@ -1,2 +1,2 @@
title: $:/tags/PageControls
list: [[$:/core/ui/Buttons/home]] [[$:/core/ui/Buttons/close-all]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/new-tiddler]] [[$:/core/ui/Buttons/import]] [[$:/core/ui/Buttons/control-panel]] [[$:/core/ui/Buttons/tag-manager]] [[$:/core/ui/Buttons/language]] [[$:/core/ui/Buttons/theme]] [[$:/core/ui/Buttons/storyview]] [[$:/core/ui/Buttons/encryption]] [[$:/core/ui/Buttons/full-screen]] [[$:/core/ui/Buttons/save-wiki]] [[$:/core/ui/Buttons/more-page-actions]]
list: [[$:/core/ui/Buttons/home]] [[$:/core/ui/Buttons/close-all]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/new-tiddler]] [[$:/core/ui/Buttons/import]] [[$:/core/ui/Buttons/control-panel]] [[$:/core/ui/Buttons/tag-manager]] [[$:/core/ui/Buttons/language]] [[$:/core/ui/Buttons/theme]] [[$:/core/ui/Buttons/storyview]] [[$:/core/ui/Buttons/encryption]] [[$:/core/ui/Buttons/full-screen]] [[$:/core/ui/Buttons/save-wiki]] [[$:/core/ui/Buttons/refresh]] [[$:/core/ui/Buttons/more-page-actions]]

View File

@ -1,9 +1,9 @@
created: 20140312223013470
modified: 20140729223134387
created: 20140819110529062
modified: 20140819110529062
tags: message
title: WidgetMessage: tw-home
type: text/vnd.tiddlywiki
The `tw-home` message refreshes the current page by removing any [[permalink|PermaLinks]] from the browser address bar, causing the re-display of the [[$:/DefaultTiddlers]], and re-initialisation of any plugin tiddlers. It does not require any properties on the `event` object.
The `tw-home` message closes any open tiddlers and re-opens the default tiddlers set in [[$:/DefaultTiddlers]]. It also remove any [[permalink|PermaLinks]] from the browser address bar. It does not require any properties on the `event` object.
The home message is usually generated with the ButtonWidget and is handled by the core.

View File

@ -0,0 +1,9 @@
created: 20140819110529062
modified: 20140819110529062
tags: message
title: WidgetMessage: tw-refresh
type: text/vnd.tiddlywiki
The `tw-refresh` message refreshes the current page by removing any [[permalink|PermaLinks]] from the browser address bar, causing the re-display of the [[$:/DefaultTiddlers]], and re-initialisation of any plugin tiddlers. It does not require any properties on the `event` object.
The refresh message is usually generated with the ButtonWidget and is handled by the core.