scratch

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 37  →  ?path2? @ 38
/quickload/text.html
@@ -64,14 +64,13 @@
<i class="glyphicon glyphicon-globe"></i>
</button>
</span>
<input id="URL" type="text" class="form-control" readonly>
<span class="input-group-btn">
<button id="copy-url" class="btn btn-default" type="button" data-clipboard-target="#URL"><img class="clippy" src="img/clipboard/clippy.svg" width="13" alt="Copy to Clipboard"></button>
</span>
<input id="URL" type="text" class="form-control" readonly>
 
</div>
</div>
<form id="nick-form" data-toggle="validator" role="form">
<form id="nick-form" role="form">
<div class="form-group has-feedback">
<div class="input-group">
<span class="input-group-btn">
@@ -80,9 +79,14 @@
</button>
</span>
<span class="input-group-btn">
<button id="reset" class="btn btn-default" type="button">
<i class="glyphicon glyphicon-retweet"></i>
</button>
</span>
<input id="nick" type="text" class="form-control" pattern="^[A-Za-z0-9]{32}$" maxlength="32">
<span class="input-group-btn">
<button id="copy-nick" class="btn btn-default" type="button" data-clipboard-target="#nick"><img class="clippy" src="img/clipboard/clippy.svg" width="13" alt="Copy to Clipboard"></button>
</span>
<input id="nick" type="text" class="form-control" pattern="^[A-Za-z0-9]{32}$" maxlength="32" minlength="32" data-error="The fingerprint is malformed." required>
</div>
</div>
</form>
@@ -118,9 +122,15 @@
<script src="js/validator/validator.min.js"></script>
<script>
$(document).ready(() => {
// Attach the form validator.
$('#nick-form').validator({
focus: false
});
// Get the fingerprint.
new Fingerprint2().get((result, components) => {
// Set the nick as a cookie.
const fingerprint = result;
var nick = Cookies.get('nick');
if(!nick || nick.length !== 32)
Cookies.set('nick', result, { path: '' });
@@ -218,6 +228,53 @@
$('#trumbowyg').show();
});
});
$('#nick-form').submit((e) => {
e.preventDefault();
nick = $('#nick').val();
if(!nick || nick.length != 32)
return;
Cookies.set('nick', nick, { path: '' });
// Retrieve the contents of the shared file.
$.post('share-text.php',
{
timestamp: window.performance.now(),
fingerprint: nick,
action: 'LOAD'
}).done((data) => {;
$('#trumbowyg')
.trumbowyg('html', data);
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
}).fail(() => {
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
});
});
$('#reset').click(() => {
Cookies.set('nick', fingerprint, { path: '' });
$('#nick').val(fingerprint);
result = nick;
// Retrieve the contents of the shared file.
$.post('share-text.php',
{
timestamp: window.performance.now(),
fingerprint: fingerprint,
action: 'LOAD'
}).done((data) => {;
$('#trumbowyg')
.trumbowyg('html', data);
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
}).fail(() => {
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
});
});
});
});