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,
"appVersion": "0.48.3",
"appVersion": "0.50.2",
"files": [
{
"isClone": false,
"noteId": "lwGnQ5Iexrw6",
"noteId": "5q2Y9uLQgV6m",
"notePath": [
"lwGnQ5Iexrw6"
"5q2Y9uLQgV6m"
],
"title": "Timeline Widget",
"notePosition": 90,
"notePosition": 170,
"prefix": null,
"isExpanded": false,
"isExpanded": true,
"type": "render",
"mime": "text/html",
"attributes": [
@ -27,164 +27,164 @@
"name": "iconClass",
"value": "bx bxs-calendar",
"isInheritable": false,
"position": 30
"position": 20
},
{
"type": "label",
"name": "label:timeline_start",
"value": "promoted,single,text",
"isInheritable": false,
"position": 40
"position": 30
},
{
"type": "label",
"name": "label:timeline_end",
"value": "promoted,single,text",
"isInheritable": false,
"position": 50
"position": 40
},
{
"type": "label",
"name": "label:timeline_present",
"value": "promoted,single,text",
"isInheritable": false,
"position": 60
"position": 50
},
{
"type": "label",
"name": "timeline_start",
"value": "2020-01-01",
"isInheritable": false,
"position": 70
"position": 60
},
{
"type": "label",
"name": "timeline_end",
"value": "2050-01-01",
"isInheritable": false,
"position": 80
"position": 70
},
{
"type": "label",
"name": "timeline_present",
"value": "2021-02-02:02:00",
"isInheritable": false,
"position": 90
"position": 80
},
{
"type": "label",
"name": "label:event_label_start",
"value": "single,text",
"isInheritable": false,
"position": 100
"position": 90
},
{
"type": "label",
"name": "label:event_label_end",
"value": "single,text",
"isInheritable": false,
"position": 110
"position": 100
},
{
"type": "label",
"name": "event_label_start",
"value": "event_start",
"isInheritable": false,
"position": 120
"position": 110
},
{
"type": "label",
"name": "event_label_end",
"value": "event_end",
"isInheritable": false,
"position": 130
"position": 120
},
{
"type": "label",
"name": "label:person_label_start",
"value": "single,text",
"isInheritable": false,
"position": 140
"position": 130
},
{
"type": "label",
"name": "label:person_label_end",
"value": "single,text",
"isInheritable": false,
"position": 150
"position": 140
},
{
"type": "label",
"name": "person_label_end",
"value": "person_end",
"isInheritable": false,
"position": 160
"position": 150
},
{
"type": "label",
"name": "person_label_start",
"value": "person_start",
"isInheritable": false,
"position": 170
"position": 160
},
{
"type": "label",
"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",
"isInheritable": false,
"position": 180
"position": 170
},
{
"type": "label",
"name": "label:event_type_list",
"value": "multi,text",
"isInheritable": false,
"position": 190
"position": 180
},
{
"type": "label",
"name": "event_label_type",
"value": "event_type",
"isInheritable": false,
"position": 200
"position": 190
},
{
"type": "label",
"name": "label:event_label_type",
"value": "single,text",
"isInheritable": false,
"position": 210
"position": 200
},
{
"type": "label",
"name": "label:event_type_default",
"value": "single,text",
"isInheritable": false,
"position": 220
"position": 210
},
{
"type": "label",
"name": "event_type_default",
"value": "first",
"isInheritable": false,
"position": 230
"position": 220
},
{
"type": "relation",
"name": "renderNote",
"value": "4SydRjaa28kb",
"value": "owGHJpVfoMk7",
"isInheritable": false,
"position": 20
"position": 230
}
],
"dirFileName": "Timeline Widget",
"children": [
{
"isClone": false,
"noteId": "4SydRjaa28kb",
"noteId": "owGHJpVfoMk7",
"notePath": [
"lwGnQ5Iexrw6",
"4SydRjaa28kb"
"5q2Y9uLQgV6m",
"owGHJpVfoMk7"
],
"title": "render.html",
"notePosition": 5,
@ -206,11 +206,11 @@
"children": [
{
"isClone": false,
"noteId": "3JNjK3Mj9cbK",
"noteId": "Co1Bo6KOsRFI",
"notePath": [
"lwGnQ5Iexrw6",
"4SydRjaa28kb",
"3JNjK3Mj9cbK"
"5q2Y9uLQgV6m",
"owGHJpVfoMk7",
"Co1Bo6KOsRFI"
],
"title": "script.js",
"notePosition": 153,
@ -224,12 +224,12 @@
"children": [
{
"isClone": false,
"noteId": "4xkHYDkkVx4Y",
"noteId": "fIoG1AZXTw80",
"notePath": [
"lwGnQ5Iexrw6",
"4SydRjaa28kb",
"3JNjK3Mj9cbK",
"4xkHYDkkVx4Y"
"5q2Y9uLQgV6m",
"owGHJpVfoMk7",
"Co1Bo6KOsRFI",
"fIoG1AZXTw80"
],
"title": "moment.min.js",
"notePosition": 123,
@ -250,12 +250,12 @@
},
{
"isClone": false,
"noteId": "HuO9AqA6zKc7",
"noteId": "K6rLvl9hfGlp",
"notePath": [
"lwGnQ5Iexrw6",
"4SydRjaa28kb",
"3JNjK3Mj9cbK",
"HuO9AqA6zKc7"
"5q2Y9uLQgV6m",
"owGHJpVfoMk7",
"Co1Bo6KOsRFI",
"K6rLvl9hfGlp"
],
"title": "vis.min.js",
"notePosition": 133,
@ -276,12 +276,12 @@
},
{
"isClone": false,
"noteId": "EmzNytW4VGal",
"noteId": "stL69XIUJhOD",
"notePath": [
"lwGnQ5Iexrw6",
"4SydRjaa28kb",
"3JNjK3Mj9cbK",
"EmzNytW4VGal"
"5q2Y9uLQgV6m",
"owGHJpVfoMk7",
"Co1Bo6KOsRFI",
"stL69XIUJhOD"
],
"title": "vis-timeline-graph2d.min.js",
"notePosition": 143,
@ -302,12 +302,12 @@
},
{
"isClone": false,
"noteId": "TllSZh8VukbM",
"noteId": "WNuWYqiCdKjk",
"notePath": [
"lwGnQ5Iexrw6",
"4SydRjaa28kb",
"3JNjK3Mj9cbK",
"TllSZh8VukbM"
"5q2Y9uLQgV6m",
"owGHJpVfoMk7",
"Co1Bo6KOsRFI",
"WNuWYqiCdKjk"
],
"title": "vis.min.css",
"notePosition": 153,
@ -335,12 +335,12 @@
},
{
"isClone": false,
"noteId": "0roaKuiSkbtN",
"noteId": "TWOQh4G2Pste",
"notePath": [
"lwGnQ5Iexrw6",
"4SydRjaa28kb",
"3JNjK3Mj9cbK",
"0roaKuiSkbtN"
"5q2Y9uLQgV6m",
"owGHJpVfoMk7",
"Co1Bo6KOsRFI",
"TWOQh4G2Pste"
],
"title": "vis-timeline-graph2d.min.css",
"notePosition": 163,
@ -372,10 +372,10 @@
},
{
"isClone": false,
"noteId": "DO4mSxFMbfXb",
"noteId": "wPT8qTjFpz6T",
"notePath": [
"lwGnQ5Iexrw6",
"DO4mSxFMbfXb"
"5q2Y9uLQgV6m",
"wPT8qTjFpz6T"
],
"title": "button.js",
"notePosition": 15,
@ -387,7 +387,7 @@
{
"type": "relation",
"name": "targetNote",
"value": "lwGnQ5Iexrw6",
"value": "5q2Y9uLQgV6m",
"isInheritable": false,
"position": 10
},
@ -410,15 +410,15 @@
},
{
"isClone": false,
"noteId": "QjfHRpX49lxd",
"noteId": "0dX6pnbdJFZR",
"notePath": [
"lwGnQ5Iexrw6",
"QjfHRpX49lxd"
"5q2Y9uLQgV6m",
"0dX6pnbdJFZR"
],
"title": "EXAMPLES",
"notePosition": 25,
"prefix": null,
"isExpanded": false,
"isExpanded": true,
"type": "text",
"mime": "text/html",
"attributes": [],
@ -427,11 +427,11 @@
"children": [
{
"isClone": false,
"noteId": "irJeEjjPt7T4",
"noteId": "sc0kXqTeotUd",
"notePath": [
"lwGnQ5Iexrw6",
"QjfHRpX49lxd",
"irJeEjjPt7T4"
"5q2Y9uLQgV6m",
"0dX6pnbdJFZR",
"sc0kXqTeotUd"
],
"title": "This event is in First",
"notePosition": 0,
@ -460,11 +460,11 @@
},
{
"isClone": false,
"noteId": "c1PdUC1Ak7Nh",
"noteId": "V4iM06Ag2G1s",
"notePath": [
"lwGnQ5Iexrw6",
"QjfHRpX49lxd",
"c1PdUC1Ak7Nh"
"5q2Y9uLQgV6m",
"0dX6pnbdJFZR",
"V4iM06Ag2G1s"
],
"title": "This event is in Second and this group is not visible by default",
"notePosition": 1,
@ -493,11 +493,11 @@
},
{
"isClone": false,
"noteId": "HAaciZ3iN25V",
"noteId": "LdNQdWW15h5b",
"notePath": [
"lwGnQ5Iexrw6",
"QjfHRpX49lxd",
"HAaciZ3iN25V"
"5q2Y9uLQgV6m",
"0dX6pnbdJFZR",
"LdNQdWW15h5b"
],
"title": "This event is in Third and has an end date",
"notePosition": 2,
@ -533,11 +533,11 @@
},
{
"isClone": false,
"noteId": "WQdcXc7QtPz3",
"noteId": "uf9JCNKpRXOa",
"notePath": [
"lwGnQ5Iexrw6",
"QjfHRpX49lxd",
"WQdcXc7QtPz3"
"5q2Y9uLQgV6m",
"0dX6pnbdJFZR",
"uf9JCNKpRXOa"
],
"title": "This event is in a seperate group then inserted into \"Third\"",
"notePosition": 3,
@ -566,11 +566,11 @@
},
{
"isClone": false,
"noteId": "tYrgBTjurENE",
"noteId": "aEhqeZYNLllK",
"notePath": [
"lwGnQ5Iexrw6",
"QjfHRpX49lxd",
"tYrgBTjurENE"
"5q2Y9uLQgV6m",
"0dX6pnbdJFZR",
"aEhqeZYNLllK"
],
"title": "This event is in Third",
"notePosition": 3,
@ -599,11 +599,11 @@
},
{
"isClone": false,
"noteId": "C0VeJ0npwoEC",
"noteId": "S9WPFrDxPNDg",
"notePath": [
"lwGnQ5Iexrw6",
"QjfHRpX49lxd",
"C0VeJ0npwoEC"
"5q2Y9uLQgV6m",
"0dX6pnbdJFZR",
"S9WPFrDxPNDg"
],
"title": "This is a background event then inserted into \"Second\"",
"notePosition": 4,
@ -639,11 +639,11 @@
},
{
"isClone": false,
"noteId": "5KePb9QfyuQq",
"noteId": "gQcqlSuFMqDf",
"notePath": [
"lwGnQ5Iexrw6",
"QjfHRpX49lxd",
"5KePb9QfyuQq"
"5q2Y9uLQgV6m",
"0dX6pnbdJFZR",
"gQcqlSuFMqDf"
],
"title": "This is a person note generating birth/death events",
"notePosition": 14,
@ -669,6 +669,38 @@
],
"format": "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 event_content = events[i].content;
note_link[0].firstChild.innerText = event_content;
var event_start = vis.moment(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_start = vis.moment(new Date(events[i].start), 'YYYY-MM-DD-hh:mm:ss');
var event_end = events[i].end ? vis.moment(new Date(events[i].end), 'YYYY-MM-DD-hh:mm:ss') : null;
// set event group
var event_group = events[i].group
? (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
widget as the tag marking events to be fetched.</p>
<p>This event has the “event_type” label of value “first”, sorting it into
the corresponding group with id “first” defined in “event_type_list” attribute
<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>

View File

@ -10,8 +10,6 @@
<body class="ck-content">
<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
widget as the tag marking events to be fetched.</p>
<p>This event has the “event_type” label of value “forcedInto”, sorting it

View File

@ -10,8 +10,6 @@
<body class="ck-content">
<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
widget as the tag marking events to be fetched.</p>
<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"
target="detail">This is a person note generating birth/death events</a>
</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>
</li>
</ul>