kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Add new button to temporarily suspend timestamps
Useful when you want to make an edit but preserve the modification date/time.print-window-tiddler
rodzic
b3273bcbda
commit
d1121787c0
|
@ -0,0 +1,12 @@
|
|||
title: $:/core/images/timestamp-off
|
||||
tags: $:/tags/Image
|
||||
|
||||
<svg class="tc-image-timestamp-off tc-image-button" width="22pt" height="22pt" viewBox="0 0 128 128">
|
||||
<g fill-rule="evenodd">
|
||||
<path d="M2.15888296,13.318619 C-0.776179834,17.1278804 -0.406327781,21.4952226 2.16492475,26.7239514 C3.03014373,28.4834034 4.11067113,30.3160542 5.76880745,32.9198703 C6.06825521,33.3901011 6.37999986,33.8757196 6.80079264,34.5284016 C6.76601596,34.4744603 7.61863348,35.7959131 7.86014952,36.1711903 C8.7298731,37.5226015 9.3778481,38.5442055 10.0105989,39.5687001 C15.7952743,48.9347394 18.6230774,56.3058609 18.6230774,64.4749703 C18.6230774,72.500144 15.8019203,79.6588889 9.99187965,88.7880893 C9.00662207,90.3362048 5.58191554,95.5042936 5.69198351,95.3359387 C4.0173746,97.8973439 2.91465531,99.7299992 2.03902082,101.494431 C-0.54589514,106.703119 -0.85744931,111.14799 2.17511861,115.033652 C15.6698244,132.324563 50.6500225,132.339908 63.7096595,114.972891 C66.6590341,111.050742 66.1759868,106.635843 63.3937955,101.470135 C62.4605168,99.7373126 61.3048993,97.9424842 59.5384863,95.4009144 C59.2199064,94.9425317 58.8884714,94.4694576 58.4412271,93.8338047 C58.4799469,93.8888358 57.5728195,92.6005573 57.3163203,92.2353532 C56.3937123,90.9217413 55.7065963,89.9290991 55.0358011,88.9339338 C48.8570757,79.7674208 45.8504072,72.5470842 45.8504072,64.4749703 C45.8504072,56.3172642 48.8607515,48.9964358 55.0486263,39.6723638 C55.7186544,38.6627457 56.4041233,37.6566223 57.3279151,36.3199194 C57.580302,35.9547221 58.4514551,34.6972774 58.4518255,34.6967424 C58.8971366,34.0534266 59.2292056,33.5716261 59.5478274,33.1056054 C61.3093879,30.5291226 62.4637534,28.7069412 63.3948717,26.9513568 C66.1606863,21.73653 66.6440275,17.3108601 63.7253614,13.3794581 C50.5445718,-4.37487949 15.9068774,-4.52416945 2.15888296,13.318619 Z M8.9184414,18.5269065 C19.2237961,5.15213654 47.0786606,5.27219221 56.8737707,18.4660673 C57.3769652,19.1438633 57.2474271,20.3299673 55.8562144,22.9530403 C55.1101813,24.3596542 54.0987123,25.9562717 52.503549,28.2893796 C52.1959012,28.7393495 51.8722335,29.2089606 51.4354669,29.8399327 C51.4375683,29.8368968 50.5635889,31.098421 50.3078957,31.4684025 C49.3562822,32.8453625 48.6434803,33.8916051 47.9385585,34.953802 C40.9063087,45.5502032 37.3170674,54.278846 37.3170674,64.4749703 C37.3170674,74.6097584 40.917247,83.2553769 47.9598514,93.7035065 C48.6665804,94.7519818 49.3819339,95.7854174 50.3332359,97.1398838 C50.5932152,97.5100431 51.5036485,98.8030165 51.4622611,98.744194 C51.9008717,99.3675761 52.2238456,99.8285731 52.53131,100.270962 C54.1274739,102.567573 55.1371743,104.135772 55.880835,105.516531 C57.2563976,108.070544 57.3792078,109.19299 56.8894726,109.844252 C47.2294255,122.690413 18.9657471,122.678014 8.90220575,109.783491 C8.31821016,109.035211 8.39963564,107.873533 9.68284231,105.28783 C10.3736591,103.895812 11.3298349,102.306704 12.834329,100.005499 C12.6859947,100.232384 16.1555589,94.9966022 17.1909336,93.3697387 C23.7935819,82.9951297 27.1564172,74.4618651 27.1564172,64.4749703 C27.1564172,54.3925513 23.8127304,45.6766963 17.2708275,35.0846205 C16.6054244,34.0072582 15.9317417,32.945123 15.0358935,31.5531185 C14.7912045,31.172911 13.9355879,29.8468101 13.9727929,29.9045179 C13.5598963,29.2640833 13.2558887,28.7905172 12.9666018,28.3362422 C11.4640021,25.9766695 10.516422,24.3695067 9.82246396,22.9583197 C8.53123666,20.3325654 8.43180838,19.1584815 8.9184414,18.5269065 Z M32.7994632,63.9999336 C32.907638,52.9923692 36.7813241,43.6682014 44.1302604,32.5946075 C44.8526291,31.5061212 45.5790976,30.439819 46.5446218,29.0427304 C46.8019683,28.6703568 47.6773607,27.4067929 47.6740234,27.4116142 C48.1065178,26.7868139 48.4259849,26.3232975 48.7281457,25.881353 C50.2401104,23.6699326 51.1801312,22.1860971 51.8336216,20.9539684 C52.041961,20.5611532 52.2043528,20.2245697 52.3263781,19.9488385 C43.7720017,10.4362146 21.8977958,10.3575171 12.9415615,20.069191 C13.0542538,20.3454242 13.2045779,20.6823219 13.3979694,21.0755902 C14.006297,22.3126448 14.8874034,23.8070636 16.3122348,26.0445146 C16.5964412,26.4908116 16.8965803,26.9583516 17.3055289,27.5926624 C17.2671098,27.5330713 18.1242259,28.8614964 18.3705013,29.2441689 C19.2794118,30.6564702 19.9659484,31.7388709 20.6476777,32.8426671 C27.4686959,43.886662 31.0655735,53.1656526 31.1675904,63.9999337 L32.7994607,63.9999337 L32.7994632,63.9999336 Z"></path>
|
||||
<g transform="translate(48.000000, 48.000000) scale(1.25)">
|
||||
<circle fill="#FFFFFF" cx="32" cy="32" r="32"></circle>
|
||||
<path d="M32.3125116,26.6556573 L23.8272482,18.170394 C22.2690672,16.6122129 19.7324731,16.6082788 18.1703759,18.1703759 C16.6114573,19.7292945 16.6082868,22.2651411 18.170394,23.8272482 L26.6556573,32.3125116 L18.170394,40.7977749 C16.6122129,42.3559559 16.6082788,44.89255 18.1703759,46.4546472 C19.7292945,48.0135658 22.2651411,48.0167363 23.8272482,46.4546291 L32.3125116,37.9693658 L40.7977749,46.4546291 C42.3559559,48.0128102 44.89255,48.0167443 46.4546472,46.4546472 C48.0135658,44.8957286 48.0167363,42.359882 46.4546291,40.7977749 L37.9693658,32.3125116 L46.4546291,23.8272482 C48.0128102,22.2690672 48.0167443,19.7324731 46.4546472,18.1703759 C44.8957286,16.6114573 42.359882,16.6082868 40.7977749,18.170394 L32.3125116,26.6556573 Z M32,58 C46.3594035,58 58,46.3594035 58,32 C58,17.6405965 46.3594035,6 32,6 C17.6405965,6 6,17.6405965 6,32 C6,46.3594035 17.6405965,58 32,58 Z" fill="#FF4848"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
|
@ -0,0 +1,12 @@
|
|||
title: $:/core/images/timestamp-on
|
||||
tags: $:/tags/Image
|
||||
|
||||
<svg class="tc-image-timestamp-on tc-image-button" width="22pt" height="22pt" viewBox="0 0 128 128">
|
||||
<g fill-rule="evenodd">
|
||||
<path d="M3.15888296,13.318619 C0.223820166,17.1278804 0.593672219,21.4952226 3.16492475,26.7239514 C4.03014373,28.4834034 5.11067113,30.3160542 6.76880745,32.9198703 C7.06825521,33.3901011 7.37999986,33.8757196 7.80079264,34.5284016 C7.76601596,34.4744603 8.61863348,35.7959131 8.86014952,36.1711903 C9.7298731,37.5226015 10.3778481,38.5442055 11.0105989,39.5687001 C16.7952743,48.9347394 19.6230774,56.3058609 19.6230774,64.4749703 C19.6230774,72.500144 16.8019203,79.6588889 10.9918797,88.7880893 C10.0066221,90.3362048 6.58191554,95.5042936 6.69198351,95.3359387 C5.0173746,97.8973439 3.91465531,99.7299992 3.03902082,101.494431 C0.45410486,106.703119 0.14255069,111.14799 3.17511861,115.033652 C16.6698244,132.324563 51.6500225,132.339908 64.7096595,114.972891 C67.6590341,111.050742 67.1759868,106.635843 64.3937955,101.470135 C63.4605168,99.7373126 62.3048993,97.9424842 60.5384863,95.4009144 C60.2199064,94.9425317 59.8884714,94.4694576 59.4412271,93.8338047 C59.4799469,93.8888358 58.5728195,92.6005573 58.3163203,92.2353532 C57.3937123,90.9217413 56.7065963,89.9290991 56.0358011,88.9339338 C49.8570757,79.7674208 46.8504072,72.5470842 46.8504072,64.4749703 C46.8504072,56.3172642 49.8607515,48.9964358 56.0486263,39.6723638 C56.7186544,38.6627457 57.4041233,37.6566223 58.3279151,36.3199194 C58.580302,35.9547221 59.4514551,34.6972774 59.4518255,34.6967424 C59.8971366,34.0534266 60.2292056,33.5716261 60.5478274,33.1056054 C62.3093879,30.5291226 63.4637534,28.7069412 64.3948717,26.9513568 C67.1606863,21.73653 67.6440275,17.3108601 64.7253614,13.3794581 C51.5445718,-4.37487949 16.9068774,-4.52416945 3.15888296,13.318619 Z M9.9184414,18.5269065 C20.2237961,5.15213654 48.0786606,5.27219221 57.8737707,18.4660673 C58.3769652,19.1438633 58.2474271,20.3299673 56.8562144,22.9530403 C56.1101813,24.3596542 55.0987123,25.9562717 53.503549,28.2893796 C53.1959012,28.7393495 52.8722335,29.2089606 52.4354669,29.8399327 C52.4375683,29.8368968 51.5635889,31.098421 51.3078957,31.4684025 C50.3562822,32.8453625 49.6434803,33.8916051 48.9385585,34.953802 C41.9063087,45.5502032 38.3170674,54.278846 38.3170674,64.4749703 C38.3170674,74.6097584 41.917247,83.2553769 48.9598514,93.7035065 C49.6665804,94.7519818 50.3819339,95.7854174 51.3332359,97.1398838 C51.5932152,97.5100431 52.5036485,98.8030165 52.4622611,98.744194 C52.9008717,99.3675761 53.2238456,99.8285731 53.53131,100.270962 C55.1274739,102.567573 56.1371743,104.135772 56.880835,105.516531 C58.2563976,108.070544 58.3792078,109.19299 57.8894726,109.844252 C48.2294255,122.690413 19.9657471,122.678014 9.90220575,109.783491 C9.31821016,109.035211 9.39963564,107.873533 10.6828423,105.28783 C11.3736591,103.895812 12.3298349,102.306704 13.834329,100.005499 C13.6859947,100.232384 17.1555589,94.9966022 18.1909336,93.3697387 C24.7935819,82.9951297 28.1564172,74.4618651 28.1564172,64.4749703 C28.1564172,54.3925513 24.8127304,45.6766963 18.2708275,35.0846205 C17.6054244,34.0072582 16.9317417,32.945123 16.0358935,31.5531185 C15.7912045,31.172911 14.9355879,29.8468101 14.9727929,29.9045179 C14.5598963,29.2640833 14.2558887,28.7905172 13.9666018,28.3362422 C12.4640021,25.9766695 11.516422,24.3695067 10.822464,22.9583197 C9.53123666,20.3325654 9.43180838,19.1584815 9.9184414,18.5269065 Z M33.7994632,63.9999336 C33.907638,52.9923692 37.7813241,43.6682014 45.1302604,32.5946075 C45.8526291,31.5061212 46.5790976,30.439819 47.5446218,29.0427304 C47.8019683,28.6703568 48.6773607,27.4067929 48.6740234,27.4116142 C49.1065178,26.7868139 49.4259849,26.3232975 49.7281457,25.881353 C51.2401104,23.6699326 52.1801312,22.1860971 52.8336216,20.9539684 C53.041961,20.5611532 53.2043528,20.2245697 53.3263781,19.9488385 C44.7720017,10.4362146 22.8977958,10.3575171 13.9415615,20.069191 C14.0542538,20.3454242 14.2045779,20.6823219 14.3979694,21.0755902 C15.006297,22.3126448 15.8874034,23.8070636 17.3122348,26.0445146 C17.5964412,26.4908116 17.8965803,26.9583516 18.3055289,27.5926624 C18.2671098,27.5330713 19.1242259,28.8614964 19.3705013,29.2441689 C20.2794118,30.6564702 20.9659484,31.7388709 21.6476777,32.8426671 C28.4686959,43.886662 32.0655735,53.1656526 32.1675904,63.9999337 L33.7994607,63.9999337 L33.7994632,63.9999336 Z"></path>
|
||||
<g transform="translate(48.000000, 48.000000) scale(1.25)">
|
||||
<circle fill="#FFFFFF" cx="32" cy="32" r="32"></circle>
|
||||
<path d="M32,58 C46.3594035,58 58,46.3594035 58,32 C58,17.6405965 46.3594035,6 32,6 C17.6405965,6 6,17.6405965 6,32 C6,46.3594035 17.6405965,58 32,58 Z M21.9693252,49.2119659 C22.0684627,49.3385849 22.1763171,49.4605883 22.2928932,49.5771645 C23.0571791,50.3414503 24.0562808,50.7317944 25.0603293,50.7470736 C26.1178906,50.7740098 27.1843207,50.3842218 27.991378,49.5771645 C28.1079003,49.4606422 28.2157322,49.3386633 28.3148696,49.2120423 L50.5771464,26.9497655 C52.1353275,25.3915845 52.1392616,22.8549904 50.5771645,21.2928932 C49.0182459,19.7339746 46.4823993,19.7308041 44.9202922,21.2929113 L25.1421356,41.0710678 L19.5055522,35.4344843 C17.9451356,33.8740677 15.4113396,33.8729317 13.8492424,35.4350288 C12.2903238,36.9939475 12.2869015,39.5295421 13.8486979,41.0913386 L21.9693252,49.2119659 L21.9693252,49.2119659 Z" fill="#24DF1E"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
|
@ -92,6 +92,12 @@ ShowSideBar/Caption: show sidebar
|
|||
ShowSideBar/Hint: Show sidebar
|
||||
TagManager/Caption: tag manager
|
||||
TagManager/Hint: Open tag manager
|
||||
Timestamp/Caption: timestamps
|
||||
Timestamp/Hint: Choose whether modifications update timestamps
|
||||
Timestamp/On/Caption: timestamps are on
|
||||
Timestamp/On/Hint: Update timestamps when tiddlers are modified
|
||||
Timestamp/Off/Caption: timestamps are off
|
||||
Timestamp/Off/Hint: Don't update timestamps when tiddlers are modified
|
||||
Theme/Caption: theme
|
||||
Theme/Hint: Choose the display theme
|
||||
Bold/Caption: bold
|
||||
|
|
|
@ -24,7 +24,8 @@ Adds the following properties to the wiki object:
|
|||
|
||||
var widget = require("$:/core/modules/widgets/widget.js");
|
||||
|
||||
var USER_NAME_TITLE = "$:/status/UserName";
|
||||
var USER_NAME_TITLE = "$:/status/UserName",
|
||||
TIMESTAMP_DISABLE_TITLE = "$:/config/TimestampDisable";
|
||||
|
||||
/*
|
||||
Get the value of a text reference. Text references can have any of these forms:
|
||||
|
@ -231,27 +232,35 @@ exports.importTiddler = function(tiddler) {
|
|||
Return a hashmap of the fields that should be set when a tiddler is created
|
||||
*/
|
||||
exports.getCreationFields = function() {
|
||||
var fields = {
|
||||
created: new Date()
|
||||
},
|
||||
creator = this.getTiddlerText(USER_NAME_TITLE);
|
||||
if(creator) {
|
||||
fields.creator = creator;
|
||||
if(this.getTiddlerText(TIMESTAMP_DISABLE_TITLE,"").toLowerCase() !== "yes") {
|
||||
var fields = {
|
||||
created: new Date()
|
||||
},
|
||||
creator = this.getTiddlerText(USER_NAME_TITLE);
|
||||
if(creator) {
|
||||
fields.creator = creator;
|
||||
}
|
||||
return fields;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
return fields;
|
||||
};
|
||||
|
||||
/*
|
||||
Return a hashmap of the fields that should be set when a tiddler is modified
|
||||
*/
|
||||
exports.getModificationFields = function() {
|
||||
var fields = Object.create(null),
|
||||
modifier = this.getTiddlerText(USER_NAME_TITLE);
|
||||
fields.modified = new Date();
|
||||
if(modifier) {
|
||||
fields.modifier = modifier;
|
||||
if(this.getTiddlerText(TIMESTAMP_DISABLE_TITLE,"").toLowerCase() !== "yes") {
|
||||
var fields = Object.create(null),
|
||||
modifier = this.getTiddlerText(USER_NAME_TITLE);
|
||||
fields.modified = new Date();
|
||||
if(modifier) {
|
||||
fields.modifier = modifier;
|
||||
}
|
||||
return fields;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
return fields;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
title: $:/core/ui/Buttons/timestamp
|
||||
tags: $:/tags/PageControls
|
||||
caption: {{$:/core/images/timestamp-on}} {{$:/language/Buttons/Timestamp/Caption}}
|
||||
description: {{$:/language/Buttons/Timestamp/Hint}}
|
||||
|
||||
<$reveal type="nomatch" state="$:/config/TimestampDisable" text="yes">
|
||||
<$button tooltip={{$:/language/Buttons/Timestamp/On/Hint}} aria-label={{$:/language/Buttons/Timestamp/On/Caption}} class=<<tv-config-toolbar-class>>>
|
||||
<$action-setfield $tiddler="$:/config/TimestampDisable" $value="yes"/>
|
||||
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
|
||||
{{$:/core/images/timestamp-on}}
|
||||
</$list>
|
||||
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
|
||||
<span class="tc-btn-text"><$text text={{$:/language/Buttons/Timestamp/On/Caption}}/></span>
|
||||
</$list>
|
||||
</$button>
|
||||
</$reveal>
|
||||
<$reveal type="match" state="$:/config/TimestampDisable" text="yes">
|
||||
<$button tooltip={{$:/language/Buttons/Timestamp/Off/Hint}} aria-label={{$:/language/Buttons/Timestamp/Off/Caption}} class=<<tv-config-toolbar-class>>>
|
||||
<$action-setfield $tiddler="$:/config/TimestampDisable" $value="no"/>
|
||||
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
|
||||
{{$:/core/images/timestamp-off}}
|
||||
</$list>
|
||||
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
|
||||
<span class="tc-btn-text"><$text text={{$:/language/Buttons/Timestamp/Off/Caption}}/></span>
|
||||
</$list>
|
||||
</$button>
|
||||
</$reveal>
|
|
@ -18,5 +18,6 @@ core/ui/Buttons/palette: hide
|
|||
core/ui/Buttons/permaview: hide
|
||||
core/ui/Buttons/print: hide
|
||||
core/ui/Buttons/storyview: hide
|
||||
core/ui/Buttons/timestamp: hide
|
||||
core/ui/Buttons/theme: hide
|
||||
core/ui/Buttons/unfold-all: hide
|
||||
|
|
Ładowanie…
Reference in New Issue