Fix #16
This commit is contained in:
parent
3b2197f6e1
commit
0ddec7c937
@ -13,7 +13,7 @@
|
||||
|
||||
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery.autosize-min.js"></script>
|
||||
<script type="text/javascript" src="js/markdown.js"></script>
|
||||
<script type="text/javascript" src="js/marked.min.js"></script>
|
||||
<script type="text/javascript" src="js/main.js"></script>
|
||||
|
||||
<title>Markdown Live Preview</title>
|
||||
|
@ -7,10 +7,14 @@ $(function() {
|
||||
|
||||
var isEdited = false;
|
||||
|
||||
//$('#markdown').val(example);
|
||||
let convert = () => {
|
||||
let html = marked($('#markdown').val());
|
||||
$('#output').html(html);
|
||||
}
|
||||
|
||||
$('#markdown').bind('keyup', function() {
|
||||
isEdited = true;
|
||||
$('#output').html(markdown.toHTML($('#markdown').val()));
|
||||
convert();
|
||||
$('#output a').each(function(index, element) {
|
||||
var href = element.getAttribute('href');
|
||||
if (RegExp('^javascript', 'i').test(href)) {
|
||||
@ -19,40 +23,6 @@ $(function() {
|
||||
});
|
||||
});
|
||||
|
||||
//menu
|
||||
var menuItems = $('#menu a');
|
||||
menuItems.click(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
menuItems.removeClass('active');
|
||||
var sender = $(event.currentTarget);
|
||||
sender.addClass('active');
|
||||
|
||||
$('#content .mode').hide();
|
||||
var menuId = sender.data('menuId');
|
||||
currentMode = menuId;
|
||||
$('#' + menuId).show();
|
||||
$(window).scrollTop(scrollTops[currentMode]);
|
||||
|
||||
});
|
||||
|
||||
//reference
|
||||
$("table#reference tr td:odd").each(function(index, element) {
|
||||
var self = $(element);
|
||||
if (self.html() === "") {
|
||||
self.html(markdown.toHTML(self.siblings().html()));
|
||||
}
|
||||
});
|
||||
|
||||
//clear
|
||||
$('#clearButton').click(function(event) {
|
||||
event.preventDefault();
|
||||
if (window.confirm('Are you sure you want to delete?')) {
|
||||
$('#markdown').val('');
|
||||
$('#output').html('');
|
||||
}
|
||||
});
|
||||
|
||||
//autoresize
|
||||
$('textarea').autosize();
|
||||
|
||||
@ -63,5 +33,5 @@ $(function() {
|
||||
}
|
||||
});
|
||||
|
||||
$('#output').html(markdown.toHTML($('#markdown').val()));
|
||||
convert();
|
||||
});
|
||||
|
File diff suppressed because it is too large
Load Diff
6
public/js/marked.min.js
vendored
Normal file
6
public/js/marked.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user