summaryrefslogtreecommitdiff
path: root/public/js/cover.js
blob: 9bca3a1eefa4361e09064305da49d9bda02a31da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
var options = {
    valueNames: ['id', 'text', 'timestamp', 'fromNow', 'time', 'tags', 'pinned'],
    item: '<li class="col-xs-12 col-sm-6 col-md-6 col-lg-4">\
            <span class="id" style="display:none;"></span>\
            <a href="#">\
                <div class="item">\
					<div class="ui-history-pin fa fa-thumb-tack fa-fw"></div>\
                    <div class="ui-history-close fa fa-close fa-fw" data-toggle="modal" data-target=".delete-modal"></div>\
                    <div class="content">\
                        <h4 class="text"></h4>\
                        <p>\
                            <i><i class="fa fa-clock-o"></i> visited </i><i class="fromNow"></i>\
                            <br>\
                            <i class="timestamp" style="display:none;"></i>\
                            <i class="time"></i>\
                        </p>\
                        <p class="tags"></p>\
                    </div>\
                </div>\
            </a>\
           </li>'
};
var historyList = new List('history', options);

migrateHistoryFromTempCallback = pageInit;
loginStateChangeEvent = pageInit;
pageInit();

function pageInit() {
    checkIfAuth(
        function (data) {
            $('.ui-signin').hide();
            $('.ui-or').hide();
            $('.ui-welcome').show();
            $('.ui-name').html(data.name);
            $('.ui-signout').show();
            $(".ui-history").click();
            parseServerToHistory(historyList, parseHistoryCallback);
        },
        function () {
            $('.ui-signin').slideDown();
            $('.ui-or').slideDown();
            $('.ui-welcome').hide();
            $('.ui-name').html('');
            $('.ui-signout').hide();
            parseStorageToHistory(historyList, parseHistoryCallback);
        }
    );
}

$(".masthead-nav li").click(function () {
    $(this).siblings().removeClass("active");
    $(this).addClass("active");
});

$(".ui-home").click(function () {
    $(".section").hide();
    $("#home").fadeIn();
});

$(".ui-history").click(function () {
    $(".section").hide();
    $("#history").fadeIn();
});

$(".ui-releasenotes").click(function () {
    $(".section").hide();
    $("#releasenotes").fadeIn();
});

function checkHistoryList() {
    if ($("#history-list").children().length > 0) {
        $(".ui-nohistory").hide();
        $(".ui-import-from-browser").hide();
    } else if ($("#history-list").children().length == 0) {
        $(".ui-nohistory").slideDown();
        getStorageHistory(function (data) {
            if (data && data.length > 0 && getLoginState() && historyList.items.length == 0) {
                $(".ui-import-from-browser").slideDown();
            }
        });
    }
}

function parseHistoryCallback(list, notehistory) {
    checkHistoryList();
	//sort by pinned then timestamp
	list.sort('', {
        sortFunction: function (a, b) {
			var notea = a.values();
            var noteb = b.values();
			if (notea.pinned && !noteb.pinned) {
                return -1;
            } else if (!notea.pinned && noteb.pinned) {
                return 1;
            } else {
				if (notea.timestamp > noteb.timestamp) {
                	return -1;
				} else if (notea.timestamp < noteb.timestamp) {
					return 1;
				} else {
					return 0;
				}
			}
		}
	});
    var filtertags = [];
    $(".item").each(function (key, value) {
        var a = $(this).closest("a");
        var pin = $(this).find(".ui-history-pin");
        var id = a.siblings("span").html();
        var tagsEl = $(this).find(".tags");
        var item = historyList.get('id', id);
        if (item.length > 0 && item[0]) {
            var values = item[0].values();
			//parse pinned
			if (values.pinned) {
				pin.addClass('active');
			} else {
				pin.removeClass('active');
			}
            //parse link to element a
            a.attr('href', serverurl + '/' + values.id);
            //parse tags
            if (values.tags) {
                var tags = values.tags;
                if (tags.length > 0) {
                    var labels = [];
                    for (var j = 0; j < tags.length; j++) {
                        //push info filtertags if not found
                        var found = false;
                        if (filtertags.indexOf(tags[j]) != -1)
                            found = true;
                        if (!found)
                            filtertags.push(tags[j]);
                        //push into the item label
                        labels.push("<span class='label label-default'>" + tags[j] + "</span>");
                    }
                    tagsEl.html(labels.join(' '));
                }
            }
        }
    });
    $(".ui-history-close").click(function (e) {
        e.preventDefault();
        var id = $(this).closest("a").siblings("span").html();
        var value = list.get('id', id)[0].values();
        $('.ui-delete-modal-msg').text('Do you really want to delete below history?');
        $('.ui-delete-modal-item').html('<i class="fa fa-file-text"></i> ' + value.text + '<br><i class="fa fa-clock-o"></i> ' + value.time);
        clearHistory = false;
        deleteId = id;
    });
	$(".ui-history-pin").click(function (e) {
        e.preventDefault();
		var $this = $(this);
        var id = $this.closest("a").siblings("span").html();
		var item = list.get('id', id)[0];
        var values = item.values();
		var pinned = values.pinned;
        if (!values.pinned) {
			pinned = true;
			item._values.pinned = true;
		} else {
			pinned = false;
			item._values.pinned = false;
		}
		getHistory(function (notehistory) {
			for(var i = 0; i < notehistory.length; i++) {
				if (notehistory[i].id == id) {
					notehistory[i].pinned = pinned;
					break;
				}
			}
            saveHistory(notehistory);
            if (pinned)
				$this.addClass('active');
			else
				$this.removeClass('active');
        });
    });
    buildTagsFilter(filtertags);
}

//auto update item fromNow every minutes
setInterval(updateItemFromNow, 60000);

function updateItemFromNow() {
    var items = $('.item').toArray();
    for (var i = 0; i < items.length; i++) {
        var item = $(items[i]);
        var timestamp = parseInt(item.find('.timestamp').text());
        item.find('.fromNow').text(moment(timestamp).fromNow());
    }
}

var clearHistory = false;
var deleteId = null;

function deleteHistory() {
    if (clearHistory) {
        saveHistory([]);
        historyList.clear();
        checkHistoryList();
        deleteId = null;
    } else {
        if (!deleteId) return;
        getHistory(function (notehistory) {
            var newnotehistory = removeHistory(deleteId, notehistory);
            saveHistory(newnotehistory);
            historyList.remove('id', deleteId);
            checkHistoryList();
            deleteId = null;
        });
    }
    $('.delete-modal').modal('hide');
    clearHistory = false;
}

$(".ui-delete-modal-confirm").click(function () {
    deleteHistory();
});

$(".ui-import-from-browser").click(function () {
    saveStorageHistoryToServer(function () {
        parseStorageToHistory(historyList, parseHistoryCallback);
    });
});

$(".ui-save-history").click(function () {
    getHistory(function (data) {
        var history = JSON.stringify(data);
        var blob = new Blob([history], {
            type: "application/json;charset=utf-8"
        });
        saveAs(blob, 'hackmd_history_' + moment().format('YYYYMMDDHHmmss'));
    });
});

$(".ui-open-history").bind("change", function (e) {
    var files = e.target.files || e.dataTransfer.files;
    var file = files[0];
    var reader = new FileReader();
    reader.onload = function () {
        var notehistory = JSON.parse(reader.result);
        //console.log(notehistory);
        if (!reader.result) return;
        getHistory(function (data) {
            var mergedata = data.concat(notehistory);
            mergedata = clearDuplicatedHistory(mergedata);
            saveHistory(mergedata);
            parseHistory(historyList, parseHistoryCallback);
        });
        $(".ui-open-history").replaceWith($(".ui-open-history").val('').clone(true));
    };
    reader.readAsText(file);
});

$(".ui-clear-history").click(function () {
    $('.ui-delete-modal-msg').text('Do you really want to clear all history?');
    $('.ui-delete-modal-item').html('There is no turning back.');
    clearHistory = true;
    deleteId = null;
});

$(".ui-refresh-history").click(function () {
    resetCheckAuth();
    historyList.clear();
    parseHistory(historyList, parseHistoryCallback);
});

$(".ui-logout").click(function () {
    clearLoginState();
    location.href = '/logout';
});

var filtertags = [];
$(".ui-use-tags").select2({
    placeholder: 'Use tags...',
    multiple: true,
    data: function () {
        return {
            results: filtertags
        };
    }
});
$('.select2-input').css('width', 'inherit');
buildTagsFilter([]);

function buildTagsFilter(tags) {
    for (var i = 0; i < tags.length; i++)
        tags[i] = {
            id: i,
            text: tags[i]
        };
    filtertags = tags;
}
$(".ui-use-tags").on('change', function () {
    var tags = [];
    var data = $(this).select2('data');
    for (var i = 0; i < data.length; i++)
        tags.push(data[i].text);
    if (tags.length > 0) {
        historyList.filter(function (item) {
            var values = item.values();
            if (!values.tags) return false;
            var found = false;
            for (var i = 0; i < tags.length; i++) {
                if (values.tags.indexOf(tags[i]) != -1) {
                    found = true;
                    break;
                }
            }
            return found;
        });
    } else {
        historyList.filter();
    }
    checkHistoryList();
});

$('.search').keyup(function () {
    checkHistoryList();
});

var source = $("#template").html();
var template = Handlebars.compile(source);
var context = {
    release: [
        {
            version: "0.3.4",
            tag: "techstars",
            date: moment("201601190022", 'YYYYMMDDhhmm').fromNow(),
            detail: [
                {
                    title: "Features",
                    item: [
                            "+ Beta Support slide mode",
                            "+ Beta Support export to PDF",
                            "+ Support TOC syntax",
                            "+ Support embed slideshare and speakerdeck",
                            "+ Support Graphviz charts",
                            "+ Support YAML metadata",
                            "+ Support private permission"
                        ]
                    },
                {
                    title: "Enhancements",
                    item: [
                            "* Support pin note in history",    
                            "* Support IE9 and above",
                            "* Support specify and continue line number in code block",
                            "* Changed all embed layout to 100% width",
                            "* Added auto detect default mode",
                            "* Support show last change note user",
                            "* Upgrade CodeMirror to 5.10.1 with some manual patches",
                            "* Improved server performance",
                            "* Support autocomplete for code block languages of charts"
                        ]
                    },
				{
                    title: "Fixes",
                    item: [
                            "* Fixed some server connection issues",
                            "* Fixed several issues cause scrollMap incorrect",
                            "* Fixed cursor animation should not apply on scroll",
                            "* Fixed a possible bug in partial update",
                            "* Fixed internal href should not link out",
                            "* Fixed dropbox saver url not correct",
                            "* Fixed mathjax might not parse properly",
                            "* Fixed sequence diagram might render multiple times"
                        ]
                    }
                ]
            },
		{
            version: "0.3.3",
            tag: "moon-festival",
            date: moment("201509271400", 'YYYYMMDDhhmm').fromNow(),
            detail: [
                {
                    title: "Features",
                    item: [
                            "+ Added status bar below editor",
                            "+ Added resizable grid in both mode",
                            "+ Added title reminder if have unread changes",
                            "+ Support todo list change in the view mode",
                            "+ Support export to HTML",
                            "+ Changed to a new theme, One Dark(modified version)"
                        ]
                    },
                {
                    title: "Enhancements",
                    item: [
                            "* Support extra tags in todo list",
                            "* Changed overall font styles",
                            "* Optimized build sync scroll map, gain lots better performance",
                            "* Support and improved print styles",
                            "* Support to use CDN",
                            "* Image and link will href to new tab ors window",
                            "* Support auto scroll to corresponding position when change mode from view to edit",
                            "* Minor UI/UX tweaks"
                        ]
                    },
				{
                    title: "Fixes",
                    item: [
                            "* Change DB schema to support long title",
                            "* Change editable permission icon to avoid misunderstanding",
                            "* Fixed some issues in OT and reconnection",
                            "* Fixed cursor menu and cursor tag are not calculate doc height properly",
                            "* Fixed scroll top might not animate",
                            "* Fixed scroll top not save and restore properly",
                            "* Fixed history might not delete or clear properly",
                            "* Fixed server might not clean client properly"
                        ]
                    }
                ]
            },
        {
            version: "0.3.2",
            tag: "typhoon",
            date: moment("201507111230", 'YYYYMMDDhhmm').fromNow(),
            detail: [
                {
                    title: "Features",
                    item: [
                            "+ Support operational transformation",
                            "+ Support show other user selections",
                            "+ Support show user profile image if available"
                        ]
                    },
                {
                    title: "Enhancements",
                    item: [
                            "* Updated editor to 5.4.0",
                            "* Change UI share to publish to avoid misleading",
                            "* Added random color in blockquote tag",
                            "* Optimized image renderer, avoid duplicated rendering",
                            "* Optimized building syncscroll map, make it faster",
                            "* Optimized SEO on publish and edit note"
                        ]
                    }
                ]
            },
        {
            version: "0.3.1",
            tag: "clearsky",
            date: moment("201506301600", 'YYYYMMDDhhmm').fromNow(),
            detail: [
                {
                    title: "Features",
                    item: [
                            "+ Added auto table of content",
                            "+ Added basic permission control",
                            "+ Added view count in share note"
                        ]
                    },
                {
                    title: "Enhancements",
                    item: [
                            "* Toolbar now will hide in single view",
                            "* History time now will auto update",
                            "* Smooth scroll on anchor changed",
                            "* Updated video style"
                        ]
                    },
                {
                    title: "Fixes",
                    item: [
                            "* Note might not clear when all users disconnect",
                            "* Blockquote tag not parsed properly",
                            "* History style not correct"
                        ]
                    }
                ]
            },
        {
            version: "0.3.0",
            tag: "sunrise",
            date: moment("201506152400", 'YYYYMMDDhhmm').fromNow(),
            detail: [
                {
                    title: "Enhancements",
                    item: [
                            "* Used short url in share notes",
                            "* Added upload image button on toolbar",
                            "* Share notes are now SEO and mobile friendly",
                            "* Updated code block style",
                            "* Newline now will cause line breaks",
                            "* Image now will link out",
                            "* Used otk to avoid race condition",
                            "* Used hash to avoid data inconsistency",
                            "* Optimized server realtime script"
                        ]
                    },
                {
                    title: "Fixes",
                    item: [
                            "* Composition input might lost or duplicated when other input involved",
                            "* Note title might not save properly",
                            "* Todo list not render properly"
                        ]
                    }
                ]
            },
        {
            version: "0.2.9",
            tag: "wildfire",
            date: moment("201505301400", 'YYYYMMDDhhmm').fromNow(),
            detail: [
                {
                    title: "Features",
                    item: [
                            "+ Support text auto complete",
                            "+ Support cursor tag and random last name",
                            "+ Support online user list",
                            "+ Support show user info in blockquote"
                        ]
                    },
                {
                    title: "Enhancements",
                    item: [
                            "* Added more code highlighting support",
                            "* Added more continue list support",
                            "* Adjust menu and history filter UI for better UX",
                            "* Adjust sync scoll animte to gain performance",
                            "* Change compression method of dynamic data",
                            "* Optimized render script"
                        ]
                    },
                {
                    title: "Fixes",
                    item: [
                            "* Access history fallback might get wrong",
                            "* Sync scroll not accurate",
                            "* Sync scroll reach bottom range too much",
                            "* Detect login state change not accurate",
                            "* Detect editor focus not accurate",
                            "* Server not handle some editor events"
                        ]
                    }
                ]
            },
        {
            version: "0.2.8",
            tag: "flame",
            date: moment("201505151200", 'YYYYMMDDhhmm').fromNow(),
            detail: [
                {
                    title: "Features",
                    item: [
                            "+ Support drag-n-drop(exclude firefox) and paste image inline",
                            "+ Support tags filter in history",
                            "+ Support sublime-like shortcut keys"
                        ]
                    },
                {
                    title: "Enhancements",
                    item: [
                            "* Adjust index description",
                            "* Adjust toolbar ui and view font",
                            "* Remove scroll sync delay and gain accuracy"
                        ]
                    },
                {
                    title: "Fixes",
                    item: [
                            "* Partial update in the front and the end might not render properly",
                            "* Server not handle some editor events"
                        ]
                    }
                ]
            },
        {
            version: "0.2.7",
            tag: "fuel",
            date: moment("201505031200", 'YYYYMMDDhhmm').fromNow(),
            detail: [
                {
                    title: "Features",
                    item: [
                            "+ Support facebook, twitter, github, dropbox login",
                            "+ Support own history"
                        ]
                    },
                {
                    title: "Enhancements",
                    item: [
                            "* Adjust history ui",
                            "* Upgrade realtime package",
                            "* Upgrade editor package, now support composition input better"
                        ]
                    },
                {
                    title: "Fixes",
                    item: [
                            "* Partial update might not render properly",
                            "* Cursor focus might not at correct position"
                        ]
                    }
                ]
            },
        {
            version: "0.2.6",
            tag: "zippo",
            date: moment("201504241600", 'YYYYMMDDhhmm').fromNow(),
            detail: [
                {
                    title: "Features",
                    item: [
                            "+ Support sync scroll",
                            "+ Support partial update"
                        ]
                    },
                {
                    title: "Enhancements",
                    item: [
                            "* Added feedback ui",
                            "* Adjust animations and delays",
                            "* Adjust editor viewportMargin for performance",
                            "* Adjust emit refresh event occasion",
                            "* Added editor fallback fonts",
                            "* Index page auto focus at history if valid"
                        ]
                    },
                {
                    title: "Fixes",
                    item: [
                            "* Server might not disconnect client properly",
                            "* Resume connection might restore wrong info"
                        ]
                    }
                ]
            },
        {
            version: "0.2.5",
            tag: "lightning",
            date: moment("201504142110", 'YYYYMMDDhhmm').fromNow(),
            detail: [
                {
                    title: "Features",
                    item: [
                            "+ Support import from dropbox and clipboard",
                            "+ Support more code highlighting",
                            "+ Support mathjax, sequence diagram and flow chart"
                        ]
                    },
                {
                    title: "Enhancements",
                    item: [
                            "* Adjust toolbar and layout style",
                            "* Adjust mobile layout style",
                            "* Adjust history layout style",
                            "* Server using heartbeat to gain accuracy of online users"
                        ]
                    },
                {
                    title: "Fixes",
                    item: [
                            "* Virtual keyboard might broken the navbar",
                            "* Adjust editor viewportMargin for preloading content"
                        ]
                    }
                ]
            },
        {
            version: "0.2.4",
            tag: "flint",
            date: moment("201504101240", 'YYYYMMDDhhmm').fromNow(),
            detail: [
                {
                    title: "Features",
                    item: [
                            "+ Support save to dropbox",
                            "+ Show other users' cursor with light color"
                        ]
                    },
                {
                    title: "Enhancements",
                    item: [
                            "* Adjust toolbar layout style for future"
                        ]
                    },
                {
                    title: "Fixes",
                    item: [
                            "* Title might not render properly",
                            "* Code border style might not show properly",
                            "* Server might not connect concurrent client properly"
                        ]
                    }
                ]
            },
        {
            version: "0.2.3",
            tag: "light",
            date: moment("201504062030", 'YYYYMMDDhhmm').fromNow(),
            detail: [
                {
                    title: "Features",
                    item: [
                            "+ Support youtube, vimeo",
                            "+ Support gist",
                            "+ Added quick link in pretty",
                            "+ Added font-smoothing style"
                        ]
                    },
                {
                    title: "Enhancements",
                    item: [
                            "* Change the rendering engine to remarkable",
                            "* Adjust view, todo list layout style for UX",
                            "+ Added responsive layout check",
                            "+ Auto reload if client version mismatch",
                            "+ Keep history stack after reconnect if nothing changed",
                            "+ Added features page"
                        ]
                    },
                {
                    title: "Fixes",
                    item: [
                            "* Closetags auto input might not have proper origin",
                            "* Autofocus on editor only if it's on desktop",
                            "+ Prevent using real script and iframe tags",
                            "* Sorting in history by time not percise"
                        ]
                    }
                ]
            },
        {
            version: "0.2.2",
            tag: "fire",
            date: moment("201503272110", 'YYYYMMDDhhmm').fromNow(),
            detail: [
                {
                    title: "Features",
                    item: [
                            "+ Support smartLists, smartypants",
                            "+ Support line number on code block",
                            "+ Support tags and search or sort history"
                        ]
                    },
                {
                    title: "Enhancements",
                    item: [
                            "+ Added delay on socket change",
                            "+ Updated markdown-body width to match github style",
                            "+ Socket changes now won't add to editor's history",
                            "* Reduce redundant server events"
                        ]
                    },
                {
                    title: "Fixes",
                    item: [
                            "* Toolbar links might get wrong",
                            "* Wrong action redirections"
                        ]
                    }
                ]
            },
        {
            version: "0.2.1",
            tag: "spark",
            date: moment("201503171340", 'YYYYMMDDhhmm').fromNow(),
            detail: [
                {
                    title: "Features",
                    item: [
                            "+ Support github-like todo-list",
                            "+ Support emoji"
                        ]
                    },
                {
                    title: "Enhancements",
                    item: [
                            "+ Added more effects on transition",
                            "+ Reduced rendering delay",
                            "+ Auto close and match brackets",
                            "+ Auto close and match tags",
                            "+ Added code fold and fold gutters",
                            "+ Added continue listing of markdown"
                        ]
                    }
                ]
            },
        {
            version: "0.2.0",
            tag: "launch-day",
            date: moment("201503142020", 'YYYYMMDDhhmm').fromNow(),
            detail: [
                {
                    title: "Features",
                    item: [
                            "+ Markdown editor",
                            "+ Preview html",
                            "+ Realtime collaborate",
                            "+ Cross-platformed",
                            "+ Recently used history"
                        ]
                    }
                ]
            }
        ]
};
var html = template(context);
$("#releasenotes").html(html);