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

Skip to content

Commit ed2ae0a

Browse files
committed
final fixes for preview page
1 parent 0f3ccdc commit ed2ae0a

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/_templates/preview.html

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,18 @@
2626
<meta name="google-site-verification" content="qSnbeMPNVgZ3kIpGVsPIAPIvEdwYSg583kPdwgJtFO8" />
2727
<meta name="yandex-verification" content="315535a6d9f1c0bd" />
2828
<script>
29-
function sleep (time) {
30-
return new Promise((resolve) => setTimeout(resolve, time));
31-
}
32-
3329
$(document).ready(function(){
3430
$("#previewBtn").click(function(){
3531
var markdown = $("#markdownInput").val();
3632
var URL = "https://us-central1-cp-algorithms.cloudfunctions.net/convert-markdown";
3733
var data = {"markdown": markdown};
34+
var refresh_script = `<scr` + `ipt>MathJax.Hub.Queue(["Typeset", MathJax.Hub]);</scr` + `ipt>`;
3835
$.ajax({
3936
url: URL,
4037
contentType: "application/json",
4138
method: 'POST',
4239
data: JSON.stringify(data),
43-
success: function(data) { $("#previewArea").html(data); }
44-
});
45-
sleep(500).then(() => {
46-
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
40+
success: function(data) { $("#previewArea").html(data + "\n" + refresh_script); }
4741
});
4842
});
4943
});
@@ -60,13 +54,16 @@
6054
</span>
6155
</div>
6256

63-
<h1>Preview:</h1>
57+
<center>
58+
<h1>Test your page in Markdown format</h1>
6459

6560
<form>
66-
<textarea id="markdownInput" rows="8" cols="80"></textarea>
61+
<textarea style="width:90%;height:400px;" id="markdownInput" placeholder="paste your text here..."></textarea>
62+
<br/>
6763
<br/>
6864
<button type='button' id="previewBtn">Preview</button>
6965
</form>
66+
</center>
7067
<br/>
7168
<hr/>
7269

src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,4 @@ and adding new articles to the collection.*
228228

229229
---
230230

231-
[Information for contributors](./contrib.html) and [Test-Your-Page form](./test.php)
231+
[Information for contributors](./contrib.html) and [Test-Your-Page form](./preview.html)

0 commit comments

Comments
 (0)