1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
cowyo/templates/view.tmpl

114 lines
3.6 KiB
Cheetah
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<title>{{ .Title }}</title>
2016-02-07 19:05:38 +03:00
{{ template "header" }}
<link rel="stylesheet" type="text/css" href="/static/css/view.css">
2016-02-07 21:21:24 +03:00
<link rel="stylesheet" type="text/css" href="/static/css/katex.min.css">
<script src="/static/js/katex.min.js"></script>
2016-02-11 05:16:54 +03:00
<style>
a.deleteable {
cursor: pointer;
}
</style>
</head>
<body>
2016-02-07 19:05:38 +03:00
<!-- Fixed navbar -->
<nav class="navbar navbar-default navbar-fixed-bottom">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">{{ .Title }}</a>
2016-02-07 19:05:38 +03:00
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
2016-02-11 00:40:21 +03:00
<li><a href="/{{ .Title }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit</a></li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" class="active"><span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> View <span class="caret"></span></a>
2016-02-10 02:44:00 +03:00
<ul class="dropdown-menu">
2016-02-14 16:01:28 +03:00
<li class="dropdown-header">Time edited: {{ .TotalTime }}</li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Other versions</li>
2016-02-10 02:44:00 +03:00
<li><a href="/{{ .Title }}/view?version=0">First</a></li>
{{ range .Versions }}
<li><a href="/{{ $.Title }}/view?version={{ .VersionNum }}">{{ .VersionDate }}</a></li>
{{ end }}
<li><a href="/{{ .Title }}/view">Current</a></li>
</ul>
</li>
2016-02-11 00:40:21 +03:00
<li><a href="/{{ .Title }}/list"><span class="glyphicon glyphicon-align-left" aria-hidden="true"></span> List</a></li>
<li><a href="/about/view"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> About</a></li>
2016-02-07 19:05:38 +03:00
</ul>
</div>
<!--/.nav-collapse -->
</div>
</nav>
<div class="yue">
{{ .Body }}
</div>
2016-02-07 21:21:24 +03:00
<script>
$( document ).ready(function() {
2016-02-07 21:38:39 +03:00
var texi = document.getElementsByClassName("texi");
Array.prototype.forEach.call(texi, function(el) {
2016-02-07 21:49:46 +03:00
katex.render(el.getAttribute("data-expr"), el, { displayMode: false });
2016-02-07 21:38:39 +03:00
});
var texp = document.getElementsByClassName("texp");
Array.prototype.forEach.call(texp, function(el) {
2016-02-07 21:49:46 +03:00
katex.render(el.getAttribute("data-expr"), el, { displayMode: true });
2016-02-07 21:21:24 +03:00
});
});
$(document).keydown(function(e){
if( e.which === 69 && e.ctrlKey && e.shiftKey ){
console.log('control + shift + e');
window.location = "/{{ .Title }}";
}
});
2016-02-07 21:21:24 +03:00
2016-02-11 04:43:51 +03:00
$(document).keydown(function(e){
if( e.which === 76 && e.ctrlKey && e.shiftKey ){
console.log('control + shift + l');
window.location = "/{{ .Title }}/list";
}
});
2016-02-11 05:16:54 +03:00
{{ if .AdminKey }}
$('.deleteable').click(function(event) {
event.preventDefault();
var deleteName = $(this).attr('id')
var href = $(this).attr('href')
console.log(deleteName)
$.ajax({
url: "/deletepage" + '?' + $.param({
"DeleteName": deleteName,
"AdminKey": "{{ .AdminKey }}"
}),
type: 'DELETE',
success: function() {
window.location.reload(true);
}
});
});
{{ end }}
2016-02-07 21:21:24 +03:00
</script>
</body>
</html>