scratch

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 30  →  ?path2? @ 31
/quickload/text.html
@@ -10,6 +10,9 @@
<link rel="icon" href="favicon.ico">
 
<title>Quickload</title>
<!-- Polyfill -->
<!-- <script src="js/polyfill/polyfill.min.js"></script> -->
 
<!-- Bootstrap core CSS -->
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet">
@@ -49,7 +52,21 @@
<li class="active"><a href="#">Text</a></li>
</ul>
<div id="trumbowyg" style="height: 334px; display: none; font-family: monospace;">
<div class="panel panel-default">
<div class="panel-heading">
<div class="input-group">
<input id="URL" type="text" class="form-control" readonly>
<span class="input-group-btn">
<button id="save" class="btn btn-default" type="button">
<i class="glyphicon glyphicon-globe"></i>
</button>
</span>
</div>
</div>
<div class="panel-body" id="uploadpanel">
<div id="trumbowyg" style="height: 334px; display: none; font-family: monospace;">
</div>
</div>
</div>
 
</div> <!-- /container -->
@@ -69,6 +86,7 @@
<script src="js/trumbowyg/trumbowyg.min.js"></script>
<script>
$(document).ready(() => {
// Load the editor.
$('#trumbowyg').trumbowyg({
autogrow: true,
disabled: true
@@ -82,6 +100,8 @@
$('#trumbowyg').trumbowyg('enable');
});
});
// Retrieve the contents of the shared file.
$.get('share-text.php').done((data) => {
$('#trumbowyg')
.trumbowyg('html', data);
@@ -91,6 +111,34 @@
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
});
$('#save').click(() => {
$('#editor').trumbowyg('disable');
var formData = new FormData();
formData.append('file', new Blob(
[
$('#trumbowyg').trumbowyg('html')
]
),
'.html'
);
$.ajax({
url: 'upload-files.php',
type: 'POST',
data: formData,
cache: false,
processData: false,
contentType: false
}).done((data) => {
$('#URL').val(data);
$('#trumbowyg').trumbowyg('enable');
}).fail(() => {
alert('failed');
$('#trumbowyg').trumbowyg('enable');
});
});
});
</script>
</body>