You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
881 B
JavaScript
36 lines
881 B
JavaScript
8 years ago
|
define([
|
||
|
'/common/cryptget.js',
|
||
|
'/bower_components/jquery/dist/jquery.min.js',
|
||
|
], function (Crypt) {
|
||
|
var $ = window.jQuery;
|
||
|
|
||
|
var $target = $('#target');
|
||
|
var $dest = $('#dest');
|
||
|
|
||
|
var useDoc = function (err, doc) {
|
||
|
if (err) { return console.error(err); }
|
||
8 years ago
|
//console.log(doc);
|
||
|
$('#putter').val(doc);
|
||
8 years ago
|
};
|
||
|
|
||
|
$('#get').click(function () {
|
||
|
var val = $target.val();
|
||
|
if (!val.trim()) { return; }
|
||
|
Crypt.get(val, useDoc);
|
||
|
});
|
||
|
|
||
8 years ago
|
$('#put').click(function () {
|
||
|
var hash = $target.val().trim();
|
||
|
Crypt.put(hash, $('#putter').val(), function (e) {
|
||
|
if (e) { console.error(e); }
|
||
|
$('#get').click();
|
||
|
});
|
||
|
});
|
||
|
|
||
|
$('#open').click(function () {
|
||
|
window.open('/code/#' + $target.val());
|
||
|
});
|
||
|
|
||
8 years ago
|
if (window.location.hash) { Crypt.get(void 0, useDoc); }
|
||
|
});
|