Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f3ccdc

Browse files
committed
enable mathjax
1 parent 0d4bc7e commit 0f3ccdc

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/_templates/preview.html

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,27 @@
2626
<meta name="google-site-verification" content="qSnbeMPNVgZ3kIpGVsPIAPIvEdwYSg583kPdwgJtFO8" />
2727
<meta name="yandex-verification" content="315535a6d9f1c0bd" />
2828
<script>
29-
$(document).ready(function(){
30-
$("#previewBtn").click(function(){
31-
var markdown = $("#markdownInput").val();
32-
var URL = "https://us-central1-cp-algorithms.cloudfunctions.net/convert-markdown";
33-
var data = {"markdown": markdown};
34-
console.log("Test1");
35-
console.log(JSON.stringify(data));
36-
console.log("Test2");
37-
$.ajax({
38-
url: URL,
39-
contentType: "application/json",
40-
method: 'POST',
41-
data: JSON.stringify(data),
42-
success: function(data) {
43-
$("#previewArea").html(data);
44-
}
29+
function sleep (time) {
30+
return new Promise((resolve) => setTimeout(resolve, time));
31+
}
32+
33+
$(document).ready(function(){
34+
$("#previewBtn").click(function(){
35+
var markdown = $("#markdownInput").val();
36+
var URL = "https://us-central1-cp-algorithms.cloudfunctions.net/convert-markdown";
37+
var data = {"markdown": markdown};
38+
$.ajax({
39+
url: URL,
40+
contentType: "application/json",
41+
method: 'POST',
42+
data: JSON.stringify(data),
43+
success: function(data) { $("#previewArea").html(data); }
44+
});
45+
sleep(500).then(() => {
46+
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
47+
});
4548
});
4649
});
47-
});
4850
</script>
4951
</head>
5052
<body>
@@ -53,9 +55,6 @@
5355
<span id="title">
5456
<a href="./index.html">CP-Algorithms</a>
5557
</span>
56-
<span id="menu">
57-
<a href="&history&" title="Changes History">Page Authors</a>
58-
</span>
5958
<span id="search" style="display:inline-block;width:200px;float:right;margin-top:7px;margin-right:20px;">
6059
<div class="ya-site-form ya-site-form_inited_no" data-bem="{&quot;action&quot;:&quot;https://cp-algorithms.com/search-results.html&quot;,&quot;arrow&quot;:false,&quot;bg&quot;:&quot;transparent&quot;,&quot;fontsize&quot;:12,&quot;fg&quot;:&quot;#000000&quot;,&quot;language&quot;:&quot;en&quot;,&quot;logo&quot;:&quot;rb&quot;,&quot;publicname&quot;:&quot;Yandex Site Search #2490798&quot;,&quot;suggest&quot;:true,&quot;target&quot;:&quot;_self&quot;,&quot;tld&quot;:&quot;com&quot;,&quot;type&quot;:3,&quot;usebigdictionary&quot;:true,&quot;searchid&quot;:2490798,&quot;input_fg&quot;:&quot;#000000&quot;,&quot;input_bg&quot;:&quot;#ffffff&quot;,&quot;input_fontStyle&quot;:&quot;normal&quot;,&quot;input_fontWeight&quot;:&quot;normal&quot;,&quot;input_placeholder&quot;:null,&quot;input_placeholderColor&quot;:&quot;#000000&quot;,&quot;input_borderColor&quot;:&quot;#7f9db9&quot;}"><form action="https://yandex.com/search/site/" method="get" target="_self" accept-charset="utf-8"><input type="hidden" name="searchid" value="2490798"/><input type="hidden" name="l10n" value="en"/><input type="hidden" name="reqenc" value=""/><input type="search" name="text" value=""/><input type="submit" value="Search"/></form></div><style type="text/css">.ya-page_js_yes .ya-site-form_inited_no { display: none; }</style><script type="text/javascript">(function(w,d,c){var s=d.createElement('script'),h=d.getElementsByTagName('script')[0],e=d.documentElement;if((' '+e.className+' ').indexOf(' ya-page_js_yes ')===-1){e.className+=' ya-page_js_yes';}s.type='text/javascript';s.async=true;s.charset='utf-8';s.src=(d.location.protocol==='https:'?'https:':'http:')+'//site.yandex.net/v2.0/js/all.js';h.parentNode.insertBefore(s,h);(w[c]||(w[c]=[])).push(function(){Ya.Site.Form.init()})})(window,document,'yandex_site_callbacks');</script>
6160
</span>
@@ -74,6 +73,7 @@ <h1>Preview:</h1>
7473
<div id="previewArea">
7574
&text&
7675
</div>
76+
<br/>
7777

7878

7979
<div id="footer">

0 commit comments

Comments
 (0)