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

Updated for allowing coding stuff

Former-commit-id: 277e13f7c56988ad1b1245c73e4e68f561e6efee [formerly 9ae5239c3d38dbf8517430e06cb649c1e6199e8b] [formerly 11e80c32ed87388112d6856fb5dddfdc9e5ae2c9 [formerly 65501e95b9]]
Former-commit-id: fd9e8e3472aa24344c2900bb508e25f348d70770 [formerly 32e29496babb872aa95a97797c5bf82b07912660]
Former-commit-id: 42ebce812a5d08949301c0f01a8b4266cd3a13a6
This commit is contained in:
Zack Scholl
2016-03-29 11:50:06 -04:00
parent 5157aca02f
commit 2be07f5216
3 changed files with 92 additions and 22 deletions

View File

@@ -6,11 +6,7 @@
{{ template "header" }}
{{ if .Coding }}
<script src="/static/js/codemirror.js"></script>
<link rel="stylesheet" href="/static/css/codemirror.css">
<script src="/static/js/{{ .CodeType }}.js"></script>
{{ end }}
<script src="/static/js/jquery.autogrowtextarea.min.js"></script>
{{if .NoEdit}} {{else}}
@@ -30,7 +26,7 @@
.CodeMirror {
border: 1px solid #eee;
height: auto;
}
}
textarea {
@@ -58,7 +54,6 @@
@media (min-width: 1200px) {
.container {
max-width: 800px;
padding-bottom: 65px;
}
}
</style>
@@ -305,6 +300,9 @@
{{ if .Coding }}
<script src="/static/js/codemirror.js"></script>
<link rel="stylesheet" href="/static/css/codemirror.css">
<script src="/static/js/{{ .CodeType }}.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("emit_data"), {
lineNumbers: true,
@@ -318,11 +316,11 @@
}
</script>
{{ else }}
<script>
function currentText() {
return $('#emit_data').val()
}
</script>
<script>
function currentText() {
return $('#emit_data').val()
}
</script>
{{ end }}

View File

@@ -15,6 +15,43 @@ a.deleteable {
cursor: pointer;
}
</style>
{{ if .Coding }}
<style>
.CodeMirror {
border: 1px solid #eee;
height: auto;
}
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;
padding-bottom: 65px;
}
@media (min-width: 1200px) {
.container {
max-width: 800px;
}
}
</style>
{{ end }}
<script src="/static/js/sweetalert-dev.js"></script>
<link rel="stylesheet" href="/static/css/sweetalert.css">
</head>
@@ -65,6 +102,13 @@ a.deleteable {
</div>
</nav>
{{ if .Coding }}
<div>
<textarea autofocus rows={{ .NumRows }} class='auto_submit_item' id="emit_data" name="emit_data" placeholder="Start typing, it will save automatically.">{{ .CurrentText }}</textarea>
</div>
{{ else }}
<div class="yue">
{{ if .Encrypted }}
<pre>
@@ -74,6 +118,7 @@ a.deleteable {
{{ .Body }}
{{ end }}
</div>
{{ end }}
<script>
$( document ).ready(function() {
@@ -250,6 +295,23 @@ $(document).keydown(function(e){
});
{{ end }}
</script>
{{ if .Coding }}
<script src="/static/js/codemirror.js"></script>
<link rel="stylesheet" href="/static/css/codemirror.css">
<script src="/static/js/{{ .CodeType }}.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("emit_data"), {
lineNumbers: true,
mode: "{{ .CodeType }}",
matchBrackets: true,
viewportMargin: Infinity,
readOnly: true
});
editor.setSize("100%", "100%")
</script>
{{ end }}
</body>
</html>