Skip to content

Commit 0d4bc7e

Browse files
committed
better preview
1 parent 4f05766 commit 0d4bc7e

1 file changed

Lines changed: 75 additions & 14 deletions

File tree

src/_templates/preview.html

Lines changed: 75 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,65 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html>
3-
<header>
4-
<meta charset="utf-8">
5-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
6-
<script>
7-
$(document).ready(function(){
8-
$("#previewBtn").click(function(){
9-
var markdown = $("#markdownInput").val();
10-
var URL = "https://us-central1-cp-algorithms.cloudfunctions.net/convert-markdown";
11-
$.post(URL, {"markdown": markdown}, function(data) {
12-
$("#previewArea").html(data);
3+
<head>
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
5+
<meta charset="UTF-8">
6+
<base href="&baseurl&"/>
7+
<title>&title& - Competitive Programming Algorithms</title>
8+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
9+
<script src="./js/common.js"></script>
10+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
11+
<script>
12+
MathJax.Hub.Config({
13+
tex2jax: {
14+
inlineMath: [['$','$'], ['\\(','\\)']],
15+
processEscapes: true
16+
}
17+
});
18+
</script>
19+
<link rel="stylesheet" href="./css/common.css"/>
20+
21+
<!-- highlightjs for code highlighting -->
22+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/styles/xcode.min.css">
23+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/highlight.min.js"></script>
24+
<script>hljs.initHighlightingOnLoad();</script>
25+
<!-- end highlightjs -->
26+
<meta name="google-site-verification" content="qSnbeMPNVgZ3kIpGVsPIAPIvEdwYSg583kPdwgJtFO8" />
27+
<meta name="yandex-verification" content="315535a6d9f1c0bd" />
28+
<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+
}
45+
});
1346
});
1447
});
15-
});
16-
</script>
17-
</header>
48+
</script>
49+
</head>
1850
<body>
51+
<div id="container">
52+
<div id="navbar">
53+
<span id="title">
54+
<a href="./index.html">CP-Algorithms</a>
55+
</span>
56+
<span id="menu">
57+
<a href="&history&" title="Changes History">Page Authors</a>
58+
</span>
59+
<span id="search" style="display:inline-block;width:200px;float:right;margin-top:7px;margin-right:20px;">
60+
<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>
61+
</span>
62+
</div>
1963

2064
<h1>Preview:</h1>
2165

@@ -31,5 +75,22 @@ <h1>Preview:</h1>
3175
&text&
3276
</div>
3377

78+
79+
<div id="footer">
80+
(c) 2014-&year& translation by <a href="http://github.com/e-maxx-eng">http://github.com/e-maxx-eng</a>
81+
</div>
82+
</div>
83+
84+
<script>
85+
if (/e\-maxx\-eng|cp\-algorithms/.test(location.href)) {
86+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
87+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
88+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
89+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
90+
91+
ga('create', 'UA-85220282-1', 'auto');
92+
ga('send', 'pageview');
93+
}
94+
</script>
3495
</body>
3596
</html>

0 commit comments

Comments
 (0)