2016-02-10 02:38:25 +03:00
<!DOCTYPE html>
<html>
<head>
<title>{{ .Title }}</title>
{{ template "header" }}
<script src="/static/js/jquery.autogrowtextarea.min.js"></script>
2016-02-10 17:09:33 +03:00
{{if .NoEdit}} {{else}} <script src="/static/js/websockets.js"></script> {{end}}
2016-02-10 02:38:25 +03:00
<script>
external_ip = '{{ .ExternalIP }}'
title_name = '{{ .Title }}'
</script>
<style type="text/css">
textarea {
width: 100%;
margin: 5px 0;
padding: 10px;
border: none;
overflow: auto;
outline: none;
font-size: large;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
font-family: Tahoma, sans-serif;
}
body {
margin: 0;
background: #fff ;
max-width: 800px;
margin: 0 auto;
}
2016-02-14 15:50:38 +03:00
@media (min-width: 1200px) {
.container{
max-width: 800px;
}
}
2016-02-10 02:38:25 +03:00
</style>
2016-02-14 16:01:28 +03:00
<script src="/static/js/sweetalert-dev.js"></script>
<link rel="stylesheet" href="/static/css/sweetalert.css">
2016-02-10 02:38:25 +03:00
</head>
<body>
2016-02-14 15:50:38 +03:00
2016-02-10 02:38:25 +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>
2016-02-14 16:05:22 +03:00
<a class="navbar-brand" href="/">{{ .Title }} <span id="saveInfo" class="glyphicon" aria-hidden="true"></span></a>
2016-02-10 02:38:25 +03:00
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
2016-02-11 00:40:21 +03:00
<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-pencil" aria-hidden="true"></span> Edit <span class="caret"></span></a>
2016-02-10 02:38:25 +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:38:25 +03:00
<li><a href="/{{ .Title }}?version=0">First</a></li>
{{ range .Versions }}
<li><a href="/{{ $.Title }}?version={{ .VersionNum }}">{{ .VersionDate }}</a></li>
{{ end }}
<li><a href="/{{ .Title }}">Current</a></li>
2016-02-14 15:50:38 +03:00
<li role="separator" class="divider"></li>
<li class="dropdown-header">Options</li>
<li><a href=" #" id="{{ .Title }}" class="deleteable">Erase</a></li>
2016-02-10 02:38:25 +03:00
</ul>
</li>
2016-02-11 00:40:21 +03:00
<li><a href="/{{ .Title }}/view"><span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> View</a></li>
<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-10 02:38:25 +03:00
</ul>
</div>
<!--/.nav-collapse -->
</div>
</nav>
2016-02-14 15:50:38 +03:00
2016-02-10 02:38:25 +03:00
<form action=' #' id="emit" method="post" name="emit">
<div>
2016-02-11 00:47:02 +03:00
<textarea autofocus rows={{ .NumRows }} class='auto_submit_item' id="emit_data" name="emit_data" placeholder="Start typing, it will save automatically. Go to {{ .ExternalIP }}/{{ .Title }} to reload your note. Do not post anything private since anyone with the URL can access this note.">{{ .CurrentText }}</textarea>
2016-02-10 02:38:25 +03:00
</div>
</form>
<script>
$(document).ready(function() {
$(" #emit _data " ).autoGrow();
});
2016-02-11 02:58:58 +03:00
$(document).keydown(function(e){
2016-02-11 04:43:51 +03:00
if( e.which === 90 && e.ctrlKey && e.shiftKey ){
console.log('control + shift + z');
window.location = "/{{ .Title }}/view";
}
2016-02-11 02:58:58 +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-14 15:50:38 +03:00
$('.deleteable').click(function(event) {
event.preventDefault();
var deleteName = $(this).attr('id')
var href = $(this).attr('href')
2016-02-14 16:01:28 +03:00
swal({
title: "Are you sure?",
text: "You will not be able to recover /{{ .Title }}!",
type: "warning",
showCancelButton: true,
confirmButtonColor: " #DD 6 B55 " ,
confirmButtonText: "Yes, delete it!",
closeOnConfirm: false
}, function() {
2016-02-14 15:50:38 +03:00
$.ajax({
url: "/deletepage" + '?' + $.param({
"DeleteName": deleteName,
"AdminKey": "none"
}),
type: 'DELETE',
success: function() {
2016-02-14 16:01:28 +03:00
swal("Deleted!", "/{{ .Title }} has been deleted.", "success");
setTimeout(function(){ window.location.reload(true); }, 1000);
2016-02-14 15:50:38 +03:00
}
});
2016-02-14 16:01:28 +03:00
});
2016-02-14 15:50:38 +03:00
});
2016-02-10 02:38:25 +03:00
</script>
</body>
</html>