Fix some js
This commit is contained in:
parent
6d763f2db5
commit
c2f6dba462
3 changed files with 18 additions and 1 deletions
|
@ -311,6 +311,21 @@ function populateCopyButton() {
|
|||
});
|
||||
}
|
||||
|
||||
function register_markdown_editors() {
|
||||
if (!("Markdown" in window)) {
|
||||
return;
|
||||
}
|
||||
$('textarea.wmd-input').each(function() {
|
||||
let id = this.id.substr(9); // remove prefix "wmd-input"
|
||||
var $buttonBar = $(this).prevAll('div[id^="wmd-button-bar"]').first();
|
||||
if (!$buttonBar.length || !$buttonBar.html().trim()) {
|
||||
let converter = new Markdown.Converter();
|
||||
let editor = new Markdown.Editor(converter, id);
|
||||
editor.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onWindowReady() {
|
||||
// http://stackoverflow.com/a/1060034/1090657
|
||||
var hidden = 'hidden';
|
||||
|
@ -391,6 +406,7 @@ function onWindowReady() {
|
|||
$("[data-src]iframe").each(function() {
|
||||
$(this).attr("src", $(this).attr("data-src"));
|
||||
})
|
||||
register_markdown_editors();
|
||||
}, "100");
|
||||
|
||||
$('form').submit(function (evt) {
|
||||
|
@ -414,6 +430,7 @@ function onWindowReady() {
|
|||
|
||||
$("#loading-bar").show();
|
||||
$("#loading-bar").animate({ width: "100%" }, 2000, function() {
|
||||
$(this).stop(true, true);
|
||||
$(this).hide().css({ width: 0});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
function mathjax_pagedown($) {
|
||||
$.each(window.editors, function (id, editor) {
|
||||
console.log(id);
|
||||
var preview = $('div.wmd-preview#' + id + '_wmd_preview')[0];
|
||||
editor.hooks.chain('onPreviewRefresh', function () {
|
||||
renderKatex(preview);
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
$('html, body').animate({scrollTop: 0}, 'fast');
|
||||
$('.middle-right-content').html(reload_content.first().html());
|
||||
$('#extra_js').html(bodyend_script.first().html());
|
||||
$("#loading-bar").stop(true, true);
|
||||
$("#loading-bar").hide().css({ width: 0});
|
||||
if (reload_content.hasClass("wrapper")) {
|
||||
$('.middle-right-content').addClass("wrapper");
|
||||
|
|
Loading…
Reference in a new issue