Updated for 50.2, added new Date() around vis.moment date declarations in order to parse negative dates more consistently. Added a negative date example to examples with the required 6-zeros format for the year.

This commit is contained in:
Quentin Le Caignec 2022-04-16 12:42:25 +02:00
parent 1faad92d34
commit 09c9849292
8 changed files with 157 additions and 104 deletions

View File

@ -1,17 +1,17 @@
{ {
"formatVersion": 1, "formatVersion": 1,
"appVersion": "0.48.3", "appVersion": "0.50.2",
"files": [ "files": [
{ {
"isClone": false, "isClone": false,
"noteId": "lwGnQ5Iexrw6", "noteId": "5q2Y9uLQgV6m",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6" "5q2Y9uLQgV6m"
], ],
"title": "Timeline Widget", "title": "Timeline Widget",
"notePosition": 90, "notePosition": 170,
"prefix": null, "prefix": null,
"isExpanded": false, "isExpanded": true,
"type": "render", "type": "render",
"mime": "text/html", "mime": "text/html",
"attributes": [ "attributes": [
@ -27,164 +27,164 @@
"name": "iconClass", "name": "iconClass",
"value": "bx bxs-calendar", "value": "bx bxs-calendar",
"isInheritable": false, "isInheritable": false,
"position": 30 "position": 20
}, },
{ {
"type": "label", "type": "label",
"name": "label:timeline_start", "name": "label:timeline_start",
"value": "promoted,single,text", "value": "promoted,single,text",
"isInheritable": false, "isInheritable": false,
"position": 40 "position": 30
}, },
{ {
"type": "label", "type": "label",
"name": "label:timeline_end", "name": "label:timeline_end",
"value": "promoted,single,text", "value": "promoted,single,text",
"isInheritable": false, "isInheritable": false,
"position": 50 "position": 40
}, },
{ {
"type": "label", "type": "label",
"name": "label:timeline_present", "name": "label:timeline_present",
"value": "promoted,single,text", "value": "promoted,single,text",
"isInheritable": false, "isInheritable": false,
"position": 60 "position": 50
}, },
{ {
"type": "label", "type": "label",
"name": "timeline_start", "name": "timeline_start",
"value": "2020-01-01", "value": "2020-01-01",
"isInheritable": false, "isInheritable": false,
"position": 70 "position": 60
}, },
{ {
"type": "label", "type": "label",
"name": "timeline_end", "name": "timeline_end",
"value": "2050-01-01", "value": "2050-01-01",
"isInheritable": false, "isInheritable": false,
"position": 80 "position": 70
}, },
{ {
"type": "label", "type": "label",
"name": "timeline_present", "name": "timeline_present",
"value": "2021-02-02:02:00", "value": "2021-02-02:02:00",
"isInheritable": false, "isInheritable": false,
"position": 90 "position": 80
}, },
{ {
"type": "label", "type": "label",
"name": "label:event_label_start", "name": "label:event_label_start",
"value": "single,text", "value": "single,text",
"isInheritable": false, "isInheritable": false,
"position": 100 "position": 90
}, },
{ {
"type": "label", "type": "label",
"name": "label:event_label_end", "name": "label:event_label_end",
"value": "single,text", "value": "single,text",
"isInheritable": false, "isInheritable": false,
"position": 110 "position": 100
}, },
{ {
"type": "label", "type": "label",
"name": "event_label_start", "name": "event_label_start",
"value": "event_start", "value": "event_start",
"isInheritable": false, "isInheritable": false,
"position": 120 "position": 110
}, },
{ {
"type": "label", "type": "label",
"name": "event_label_end", "name": "event_label_end",
"value": "event_end", "value": "event_end",
"isInheritable": false, "isInheritable": false,
"position": 130 "position": 120
}, },
{ {
"type": "label", "type": "label",
"name": "label:person_label_start", "name": "label:person_label_start",
"value": "single,text", "value": "single,text",
"isInheritable": false, "isInheritable": false,
"position": 140 "position": 130
}, },
{ {
"type": "label", "type": "label",
"name": "label:person_label_end", "name": "label:person_label_end",
"value": "single,text", "value": "single,text",
"isInheritable": false, "isInheritable": false,
"position": 150 "position": 140
}, },
{ {
"type": "label", "type": "label",
"name": "person_label_end", "name": "person_label_end",
"value": "person_end", "value": "person_end",
"isInheritable": false, "isInheritable": false,
"position": 160 "position": 150
}, },
{ {
"type": "label", "type": "label",
"name": "person_label_start", "name": "person_label_start",
"value": "person_start", "value": "person_start",
"isInheritable": false, "isInheritable": false,
"position": 170 "position": 160
}, },
{ {
"type": "label", "type": "label",
"name": "event_type_list", "name": "event_type_list",
"value": "first,1,First,white;second,2,Second,royalblue,false;third,3,Third,orange;forcedInto,4,Forced Into,blueviolet,false,null,third;background,8,Background,null,false,background,second", "value": "first,1,First,white;second,2,Second,royalblue,false;third,3,Third,orange;forcedInto,4,Forced Into,blueviolet,false,null,third;background,8,Background,null,false,background,second",
"isInheritable": false, "isInheritable": false,
"position": 180 "position": 170
}, },
{ {
"type": "label", "type": "label",
"name": "label:event_type_list", "name": "label:event_type_list",
"value": "multi,text", "value": "multi,text",
"isInheritable": false, "isInheritable": false,
"position": 190 "position": 180
}, },
{ {
"type": "label", "type": "label",
"name": "event_label_type", "name": "event_label_type",
"value": "event_type", "value": "event_type",
"isInheritable": false, "isInheritable": false,
"position": 200 "position": 190
}, },
{ {
"type": "label", "type": "label",
"name": "label:event_label_type", "name": "label:event_label_type",
"value": "single,text", "value": "single,text",
"isInheritable": false, "isInheritable": false,
"position": 210 "position": 200
}, },
{ {
"type": "label", "type": "label",
"name": "label:event_type_default", "name": "label:event_type_default",
"value": "single,text", "value": "single,text",
"isInheritable": false, "isInheritable": false,
"position": 220 "position": 210
}, },
{ {
"type": "label", "type": "label",
"name": "event_type_default", "name": "event_type_default",
"value": "first", "value": "first",
"isInheritable": false, "isInheritable": false,
"position": 230 "position": 220
}, },
{ {
"type": "relation", "type": "relation",
"name": "renderNote", "name": "renderNote",
"value": "4SydRjaa28kb", "value": "owGHJpVfoMk7",
"isInheritable": false, "isInheritable": false,
"position": 20 "position": 230
} }
], ],
"dirFileName": "Timeline Widget", "dirFileName": "Timeline Widget",
"children": [ "children": [
{ {
"isClone": false, "isClone": false,
"noteId": "4SydRjaa28kb", "noteId": "owGHJpVfoMk7",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"4SydRjaa28kb" "owGHJpVfoMk7"
], ],
"title": "render.html", "title": "render.html",
"notePosition": 5, "notePosition": 5,
@ -206,11 +206,11 @@
"children": [ "children": [
{ {
"isClone": false, "isClone": false,
"noteId": "3JNjK3Mj9cbK", "noteId": "Co1Bo6KOsRFI",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"4SydRjaa28kb", "owGHJpVfoMk7",
"3JNjK3Mj9cbK" "Co1Bo6KOsRFI"
], ],
"title": "script.js", "title": "script.js",
"notePosition": 153, "notePosition": 153,
@ -224,12 +224,12 @@
"children": [ "children": [
{ {
"isClone": false, "isClone": false,
"noteId": "4xkHYDkkVx4Y", "noteId": "fIoG1AZXTw80",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"4SydRjaa28kb", "owGHJpVfoMk7",
"3JNjK3Mj9cbK", "Co1Bo6KOsRFI",
"4xkHYDkkVx4Y" "fIoG1AZXTw80"
], ],
"title": "moment.min.js", "title": "moment.min.js",
"notePosition": 123, "notePosition": 123,
@ -250,12 +250,12 @@
}, },
{ {
"isClone": false, "isClone": false,
"noteId": "HuO9AqA6zKc7", "noteId": "K6rLvl9hfGlp",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"4SydRjaa28kb", "owGHJpVfoMk7",
"3JNjK3Mj9cbK", "Co1Bo6KOsRFI",
"HuO9AqA6zKc7" "K6rLvl9hfGlp"
], ],
"title": "vis.min.js", "title": "vis.min.js",
"notePosition": 133, "notePosition": 133,
@ -276,12 +276,12 @@
}, },
{ {
"isClone": false, "isClone": false,
"noteId": "EmzNytW4VGal", "noteId": "stL69XIUJhOD",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"4SydRjaa28kb", "owGHJpVfoMk7",
"3JNjK3Mj9cbK", "Co1Bo6KOsRFI",
"EmzNytW4VGal" "stL69XIUJhOD"
], ],
"title": "vis-timeline-graph2d.min.js", "title": "vis-timeline-graph2d.min.js",
"notePosition": 143, "notePosition": 143,
@ -302,12 +302,12 @@
}, },
{ {
"isClone": false, "isClone": false,
"noteId": "TllSZh8VukbM", "noteId": "WNuWYqiCdKjk",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"4SydRjaa28kb", "owGHJpVfoMk7",
"3JNjK3Mj9cbK", "Co1Bo6KOsRFI",
"TllSZh8VukbM" "WNuWYqiCdKjk"
], ],
"title": "vis.min.css", "title": "vis.min.css",
"notePosition": 153, "notePosition": 153,
@ -335,12 +335,12 @@
}, },
{ {
"isClone": false, "isClone": false,
"noteId": "0roaKuiSkbtN", "noteId": "TWOQh4G2Pste",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"4SydRjaa28kb", "owGHJpVfoMk7",
"3JNjK3Mj9cbK", "Co1Bo6KOsRFI",
"0roaKuiSkbtN" "TWOQh4G2Pste"
], ],
"title": "vis-timeline-graph2d.min.css", "title": "vis-timeline-graph2d.min.css",
"notePosition": 163, "notePosition": 163,
@ -372,10 +372,10 @@
}, },
{ {
"isClone": false, "isClone": false,
"noteId": "DO4mSxFMbfXb", "noteId": "wPT8qTjFpz6T",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"DO4mSxFMbfXb" "wPT8qTjFpz6T"
], ],
"title": "button.js", "title": "button.js",
"notePosition": 15, "notePosition": 15,
@ -387,7 +387,7 @@
{ {
"type": "relation", "type": "relation",
"name": "targetNote", "name": "targetNote",
"value": "lwGnQ5Iexrw6", "value": "5q2Y9uLQgV6m",
"isInheritable": false, "isInheritable": false,
"position": 10 "position": 10
}, },
@ -410,15 +410,15 @@
}, },
{ {
"isClone": false, "isClone": false,
"noteId": "QjfHRpX49lxd", "noteId": "0dX6pnbdJFZR",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"QjfHRpX49lxd" "0dX6pnbdJFZR"
], ],
"title": "EXAMPLES", "title": "EXAMPLES",
"notePosition": 25, "notePosition": 25,
"prefix": null, "prefix": null,
"isExpanded": false, "isExpanded": true,
"type": "text", "type": "text",
"mime": "text/html", "mime": "text/html",
"attributes": [], "attributes": [],
@ -427,11 +427,11 @@
"children": [ "children": [
{ {
"isClone": false, "isClone": false,
"noteId": "irJeEjjPt7T4", "noteId": "sc0kXqTeotUd",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"QjfHRpX49lxd", "0dX6pnbdJFZR",
"irJeEjjPt7T4" "sc0kXqTeotUd"
], ],
"title": "This event is in First", "title": "This event is in First",
"notePosition": 0, "notePosition": 0,
@ -460,11 +460,11 @@
}, },
{ {
"isClone": false, "isClone": false,
"noteId": "c1PdUC1Ak7Nh", "noteId": "V4iM06Ag2G1s",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"QjfHRpX49lxd", "0dX6pnbdJFZR",
"c1PdUC1Ak7Nh" "V4iM06Ag2G1s"
], ],
"title": "This event is in Second and this group is not visible by default", "title": "This event is in Second and this group is not visible by default",
"notePosition": 1, "notePosition": 1,
@ -493,11 +493,11 @@
}, },
{ {
"isClone": false, "isClone": false,
"noteId": "HAaciZ3iN25V", "noteId": "LdNQdWW15h5b",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"QjfHRpX49lxd", "0dX6pnbdJFZR",
"HAaciZ3iN25V" "LdNQdWW15h5b"
], ],
"title": "This event is in Third and has an end date", "title": "This event is in Third and has an end date",
"notePosition": 2, "notePosition": 2,
@ -533,11 +533,11 @@
}, },
{ {
"isClone": false, "isClone": false,
"noteId": "WQdcXc7QtPz3", "noteId": "uf9JCNKpRXOa",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"QjfHRpX49lxd", "0dX6pnbdJFZR",
"WQdcXc7QtPz3" "uf9JCNKpRXOa"
], ],
"title": "This event is in a seperate group then inserted into \"Third\"", "title": "This event is in a seperate group then inserted into \"Third\"",
"notePosition": 3, "notePosition": 3,
@ -566,11 +566,11 @@
}, },
{ {
"isClone": false, "isClone": false,
"noteId": "tYrgBTjurENE", "noteId": "aEhqeZYNLllK",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"QjfHRpX49lxd", "0dX6pnbdJFZR",
"tYrgBTjurENE" "aEhqeZYNLllK"
], ],
"title": "This event is in Third", "title": "This event is in Third",
"notePosition": 3, "notePosition": 3,
@ -599,11 +599,11 @@
}, },
{ {
"isClone": false, "isClone": false,
"noteId": "C0VeJ0npwoEC", "noteId": "S9WPFrDxPNDg",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"QjfHRpX49lxd", "0dX6pnbdJFZR",
"C0VeJ0npwoEC" "S9WPFrDxPNDg"
], ],
"title": "This is a background event then inserted into \"Second\"", "title": "This is a background event then inserted into \"Second\"",
"notePosition": 4, "notePosition": 4,
@ -639,11 +639,11 @@
}, },
{ {
"isClone": false, "isClone": false,
"noteId": "5KePb9QfyuQq", "noteId": "gQcqlSuFMqDf",
"notePath": [ "notePath": [
"lwGnQ5Iexrw6", "5q2Y9uLQgV6m",
"QjfHRpX49lxd", "0dX6pnbdJFZR",
"5KePb9QfyuQq" "gQcqlSuFMqDf"
], ],
"title": "This is a person note generating birth/death events", "title": "This is a person note generating birth/death events",
"notePosition": 14, "notePosition": 14,
@ -669,6 +669,38 @@
], ],
"format": "html", "format": "html",
"dataFileName": "This is a person note generati.html" "dataFileName": "This is a person note generati.html"
},
{
"isClone": false,
"noteId": "NQl0RP7nWIL2",
"notePath": [
"5q2Y9uLQgV6m",
"0dX6pnbdJFZR",
"NQl0RP7nWIL2"
],
"title": "This event is a negative date",
"notePosition": 4,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "label",
"name": "event_start",
"value": "-000100-02-05",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "event_type",
"value": "third",
"isInheritable": false,
"position": 20
}
],
"format": "html",
"dataFileName": "This event is a negative date.html"
} }
] ]
} }

Binary file not shown.

View File

@ -99,8 +99,8 @@ async function renderTimeline() {
var note_link = await api.createNoteLink(note_id); var note_link = await api.createNoteLink(note_id);
var event_content = events[i].content; var event_content = events[i].content;
note_link[0].firstChild.innerText = event_content; note_link[0].firstChild.innerText = event_content;
var event_start = vis.moment(events[i].start, 'YYYY-MM-DD-hh:mm:ss'); var event_start = vis.moment(new Date(events[i].start), 'YYYY-MM-DD-hh:mm:ss');
var event_end = events[i].end ? vis.moment(events[i].end, 'YYYY-MM-DD-hh:mm:ss') : null; var event_end = events[i].end ? vis.moment(new Date(events[i].end), 'YYYY-MM-DD-hh:mm:ss') : null;
// set event group // set event group
var event_group = events[i].group var event_group = events[i].group
? (groups.get({filter: function (item) { return (item.id === events[i].group) }})[0] ? (groups.get({filter: function (item) { return (item.id === events[i].group) }})[0]

View File

@ -0,0 +1,22 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../style.css">
<base target="_parent">
</head>
<body class="ck-content">
<h1>This event is a negative date</h1>
<p>This event has a negative date value which requires the format [-xxxxxx-xx-xx],
with two more zeros for the year compared to normal date formats.</p>
<p>This event has the “event_start” label attribute which is defined in the
widget as the tag marking events to be fetched.</p>
<p>This event has the “event_type” label of value “third”, sorting it into
the corresponding group with id “third” defined in “event_type_list” attribute
on the widget.</p>
</body>
</html>

View File

@ -12,8 +12,8 @@
<p>This event has the “event_start” label attribute which is defined in the <p>This event has the “event_start” label attribute which is defined in the
widget as the tag marking events to be fetched.</p> widget as the tag marking events to be fetched.</p>
<p>This event has the “event_type” label of value “first”, sorting it into <p>This event has the “event_type” label of value “third”, sorting it into
the corresponding group with id “first” defined in “event_type_list” attribute the corresponding group with id “third” defined in “event_type_list” attribute
on the widget.</p> on the widget.</p>
</body> </body>

View File

@ -10,8 +10,6 @@
<body class="ck-content"> <body class="ck-content">
<h1>This event is in a seperate group then inserted into &quot;Third&quot;</h1> <h1>This event is in a seperate group then inserted into &quot;Third&quot;</h1>
<h2>This event is in a seperate group then inserted into "Third"</h2>
<p>This event has the “event_start” label attribute which is defined in the <p>This event has the “event_start” label attribute which is defined in the
widget as the tag marking events to be fetched.</p> widget as the tag marking events to be fetched.</p>
<p>This event has the “event_type” label of value “forcedInto”, sorting it <p>This event has the “event_type” label of value “forcedInto”, sorting it

View File

@ -10,8 +10,6 @@
<body class="ck-content"> <body class="ck-content">
<h1>This is a background event then inserted into &quot;Second&quot;</h1> <h1>This is a background event then inserted into &quot;Second&quot;</h1>
<h2>This is a background event then inserted into "Second"</h2>
<p>This event has the “event_start” label attribute which is defined in the <p>This event has the “event_start” label attribute which is defined in the
widget as the tag marking events to be fetched.</p> widget as the tag marking events to be fetched.</p>
<p>This event has the “event_end” label attribute which, combined with “event_start”, <p>This event has the “event_end” label attribute which, combined with “event_start”,

View File

@ -54,6 +54,9 @@
<li><a href="Timeline%20Widget/EXAMPLES/This%20is%20a%20person%20note%20generati.html" <li><a href="Timeline%20Widget/EXAMPLES/This%20is%20a%20person%20note%20generati.html"
target="detail">This is a person note generating birth/death events</a> target="detail">This is a person note generating birth/death events</a>
</li> </li>
<li><a href="Timeline%20Widget/EXAMPLES/This%20event%20is%20a%20negative%20date.html"
target="detail">This event is a negative date</a>
</li>
</ul> </ul>
</li> </li>
</ul> </ul>