2016-02-10 02:38:25 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>{{ .Title }}</title>
|
|
|
|
|
|
|
|
{{ template "header" }}
|
|
|
|
|
2016-03-29 18:50:06 +03:00
|
|
|
|
2016-02-10 02:38:25 +03:00
|
|
|
|
|
|
|
<script src="/static/js/jquery.autogrowtextarea.min.js"></script>
|
2016-03-14 16:42:19 +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 }}'
|
2016-02-16 00:59:32 +03:00
|
|
|
socketType = '{{ .SocketType }}'
|
2016-03-29 04:15:23 +03:00
|
|
|
|
|
|
|
|
2016-02-10 02:38:25 +03:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<style type="text/css">
|
2016-03-29 17:37:17 +03:00
|
|
|
.CodeMirror {
|
|
|
|
border: 1px solid #eee;
|
|
|
|
height: auto;
|
2016-03-29 18:50:06 +03:00
|
|
|
}
|
2016-03-29 17:37:17 +03:00
|
|
|
|
2016-02-10 02:38:25 +03:00
|
|
|
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;
|
2016-03-30 19:53:48 +03:00
|
|
|
max-width: 900px;
|
2016-02-10 02:38:25 +03:00
|
|
|
margin: 0 auto;
|
2016-03-29 17:37:17 +03:00
|
|
|
padding-bottom: 65px;
|
2016-02-10 02:38:25 +03:00
|
|
|
}
|
2016-02-14 15:50:38 +03:00
|
|
|
|
|
|
|
@media (min-width: 1200px) {
|
2016-03-14 16:42:19 +03:00
|
|
|
.container {
|
2016-03-30 19:55:49 +03:00
|
|
|
max-width: 960px;
|
2016-03-14 16:42:19 +03:00
|
|
|
}
|
2016-02-14 15:50:38 +03:00
|
|
|
}
|
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-03-29 23:21:48 +03:00
|
|
|
{{ if .Coding }}
|
|
|
|
<script src="/static/js/codemirror.js"></script>
|
|
|
|
<link rel="stylesheet" href="/static/css/codemirror.css">
|
|
|
|
<script src="/static/js/{{ .CodeType }}.js"></script>
|
|
|
|
{{ if eq .CodeType "htmlmixed" }}
|
|
|
|
<script src="/static/js/css.js"></script>
|
|
|
|
<script src="/static/js/javascript.js"></script>
|
|
|
|
<script src="/static/js/xml.js"></script>
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
2016-03-31 16:06:55 +03:00
|
|
|
|
|
|
|
{{ if eq .Suffix "txt" }}
|
|
|
|
<tag autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
|
|
|
<link href='https://fonts.googleapis.com/css?family=Ubuntu+Mono|Droid+Sans+Mono' rel='stylesheet' type='text/css'>
|
|
|
|
<style type="text/css">
|
|
|
|
textarea {
|
2016-03-31 16:26:53 +03:00
|
|
|
font: 400 16px/1.62 'Ubuntu Mono','Droid Sans Mono';
|
2016-03-31 16:06:55 +03:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
|
2016-02-10 02:38:25 +03:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
2016-02-14 15:50:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-03-29 04:15:23 +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">
|
2016-03-14 16:42:19 +03:00
|
|
|
<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-03-29 19:30:31 +03:00
|
|
|
<li class="dropdown-header">Version: #{{ .CurrentVersionNum }}</li>
|
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>
|
2016-03-14 16:42:19 +03:00
|
|
|
<li class="dropdown-header">Options</li>
|
|
|
|
<li><a href="#" class="postencrypt">Encrypt</a></li>
|
2016-03-15 04:39:09 +03:00
|
|
|
<li><a href="#" class="postlock">Lock</a></li>
|
2016-03-14 16:42:19 +03:00
|
|
|
<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>
|
2016-04-07 17:15:46 +03:00
|
|
|
|
|
|
|
<li class="dropdown">
|
|
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" class="active"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> Help <span class="caret"></span></a>
|
|
|
|
<ul class="dropdown-menu">
|
|
|
|
<li><a href="/Help/view"> Help</a></li>
|
|
|
|
<li><a href="/PrivacyPolicy/view"> Privacy Policy</a></li>
|
|
|
|
</ul>
|
|
|
|
</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-03-18 15:42:36 +03:00
|
|
|
<textarea autofocus rows={{ .NumRows }} class='auto_submit_item' id="emit_data" name="emit_data" placeholder="Start typing, it will save automatically.">{{ .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
|
|
|
|
2016-03-14 16:42:19 +03:00
|
|
|
$(document).keydown(function(e) {
|
|
|
|
if (e.which === 90 && e.ctrlKey && e.shiftKey) {
|
|
|
|
console.log('control + shift + z');
|
|
|
|
window.location = "/{{ .Title }}/view";
|
2016-02-11 04:43:51 +03:00
|
|
|
}
|
2016-02-11 02:58:58 +03:00
|
|
|
});
|
|
|
|
|
2016-03-14 16:42:19 +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 04:43:51 +03:00
|
|
|
});
|
2016-02-14 15:50:38 +03:00
|
|
|
|
|
|
|
|
2016-03-15 04:39:09 +03:00
|
|
|
$('.postencrypt').click(function(event) {
|
|
|
|
var pass1 = "";
|
|
|
|
var pass2 = "";
|
|
|
|
event.preventDefault();
|
2016-03-14 16:42:19 +03:00
|
|
|
swal({
|
|
|
|
title: "Encryption",
|
2016-03-15 04:39:09 +03:00
|
|
|
text: "Enter your passphrase:",
|
2016-03-23 02:42:18 +03:00
|
|
|
type: "input", inputType: "password",
|
2016-03-14 16:42:19 +03:00
|
|
|
showCancelButton: true,
|
|
|
|
closeOnConfirm: false,
|
|
|
|
animation: "slide-from-top",
|
|
|
|
inputPlaceholder: "Write something"
|
|
|
|
}, function(inputValue) {
|
|
|
|
if (inputValue === false) return false;
|
|
|
|
if (inputValue === "") {
|
|
|
|
swal.showInputError("You need to write something!");
|
|
|
|
return false
|
|
|
|
}
|
2016-03-15 04:39:09 +03:00
|
|
|
pass1 = inputValue;
|
|
|
|
swal({
|
|
|
|
title: "Encryption",
|
|
|
|
text: "Enter your passphrase again:",
|
2016-03-23 02:42:18 +03:00
|
|
|
type: "input", inputType: "password",
|
2016-03-15 04:39:09 +03:00
|
|
|
showCancelButton: true,
|
|
|
|
closeOnConfirm: false,
|
|
|
|
animation: "slide-from-top",
|
|
|
|
inputPlaceholder: "Write something"
|
|
|
|
}, function(inputValue) {
|
|
|
|
if (inputValue === false) return false;
|
|
|
|
if (inputValue === "") {
|
|
|
|
swal.showInputError("You need to write something!");
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
pass2 = inputValue
|
|
|
|
if (pass1 == pass2) {
|
|
|
|
swal("Encryption", "Passwords match!", "success");
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
//the url where you want to sent the userName and password to
|
|
|
|
url: '/{{ .Title }}/encrypt',
|
|
|
|
dataType: 'json',
|
|
|
|
data: JSON.stringify({
|
|
|
|
text: $('#emit_data').val(),
|
|
|
|
password: pass1
|
|
|
|
}),
|
|
|
|
success: function (data) {
|
|
|
|
if (data['success'] == true) {
|
|
|
|
swal("Encryption", "Encrypted!", "success");
|
|
|
|
window.location.href = '/{{ .Title }}/view?noprompt=1';
|
|
|
|
} else {
|
|
|
|
swal("Encryption", "Something went wrong.", "error");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
swal("Encryption", "Passwords do not match.", "error");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('.postlock').click(function(event) {
|
|
|
|
var pass1 = "";
|
|
|
|
var pass2 = "";
|
|
|
|
event.preventDefault();
|
|
|
|
swal({
|
|
|
|
title: "Locking",
|
|
|
|
text: "Enter your passphrase:",
|
2016-03-23 02:42:18 +03:00
|
|
|
type: "input", inputType: "password",
|
2016-03-15 04:39:09 +03:00
|
|
|
showCancelButton: true,
|
|
|
|
closeOnConfirm: false,
|
|
|
|
animation: "slide-from-top",
|
|
|
|
inputPlaceholder: "Write something"
|
|
|
|
}, function(inputValue) {
|
|
|
|
if (inputValue === false) return false;
|
|
|
|
if (inputValue === "") {
|
|
|
|
swal.showInputError("You need to write something!");
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
pass1 = inputValue;
|
|
|
|
swal({
|
|
|
|
title: "Locking",
|
|
|
|
text: "Enter your passphrase again:",
|
2016-03-23 02:42:18 +03:00
|
|
|
type: "input", inputType: "password",
|
2016-03-15 04:39:09 +03:00
|
|
|
showCancelButton: true,
|
|
|
|
closeOnConfirm: false,
|
|
|
|
animation: "slide-from-top",
|
|
|
|
inputPlaceholder: "Write something"
|
|
|
|
}, function(inputValue) {
|
|
|
|
if (inputValue === false) return false;
|
|
|
|
if (inputValue === "") {
|
|
|
|
swal.showInputError("You need to write something!");
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
pass2 = inputValue
|
|
|
|
if (pass1 == pass2) {
|
|
|
|
swal("Locking", "Passwords match!", "success");
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
//the url where you want to sent the userName and password to
|
|
|
|
url: '/{{ .Title }}/lock',
|
|
|
|
dataType: 'json',
|
|
|
|
data: JSON.stringify({
|
|
|
|
text: $('#emit_data').val(),
|
|
|
|
password: pass1
|
|
|
|
}),
|
|
|
|
success: function (data) {
|
|
|
|
if (data['success'] == true) {
|
|
|
|
swal("Locking", "Page locked!", "success");
|
|
|
|
window.location.href = '/{{ .Title }}/view';
|
|
|
|
} else {
|
|
|
|
swal("Locking", "Something went wrong.", "error");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2016-03-14 16:42:19 +03:00
|
|
|
} else {
|
2016-03-15 04:39:09 +03:00
|
|
|
swal("Encryption", "Passwords do not match.", "error");
|
2016-03-14 16:42:19 +03:00
|
|
|
}
|
2016-03-15 04:39:09 +03:00
|
|
|
});
|
2016-03-14 16:42:19 +03:00
|
|
|
});
|
2016-03-15 04:39:09 +03:00
|
|
|
});
|
2016-03-14 16:42:19 +03:00
|
|
|
|
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({
|
2016-03-14 16:42:19 +03:00
|
|
|
title: "Are you sure?",
|
|
|
|
text: "You will not be able to recover /{{ .Title }}!",
|
|
|
|
type: "warning",
|
|
|
|
showCancelButton: true,
|
|
|
|
confirmButtonColor: "#DD6B55",
|
|
|
|
confirmButtonText: "Yes, delete it!",
|
|
|
|
closeOnConfirm: false
|
2016-02-14 16:01:28 +03:00
|
|
|
}, 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");
|
2016-03-14 16:42:19 +03:00
|
|
|
setTimeout(function() {
|
|
|
|
window.location.reload(true);
|
|
|
|
}, 1000);
|
2016-02-14 16:01:28 +03:00
|
|
|
|
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-03-29 04:15:23 +03:00
|
|
|
|
2016-02-10 02:38:25 +03:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
2016-03-29 04:15:23 +03:00
|
|
|
{{ if .Coding }}
|
|
|
|
<script>
|
|
|
|
var editor = CodeMirror.fromTextArea(document.getElementById("emit_data"), {
|
|
|
|
lineNumbers: true,
|
2016-03-29 04:19:30 +03:00
|
|
|
mode: "{{ .CodeType }}",
|
2016-03-29 04:15:23 +03:00
|
|
|
matchBrackets: true,
|
|
|
|
viewportMargin: Infinity
|
|
|
|
});
|
|
|
|
editor.setSize("100%", "100%")
|
|
|
|
function currentText() {
|
|
|
|
return editor.getValue()
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
{{ else }}
|
2016-03-29 18:50:06 +03:00
|
|
|
<script>
|
|
|
|
function currentText() {
|
|
|
|
return $('#emit_data').val()
|
|
|
|
}
|
|
|
|
</script>
|
2016-03-29 04:15:23 +03:00
|
|
|
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-10 02:38:25 +03:00
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|