From 2a624a0b60bd33760085631b4d56c11e9e1442c2 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 19 Dec 2016 12:25:36 +0100 Subject: [PATCH] add example usage for cryptget.js --- www/read/index.html | 35 +++++++++++++++++++++++++++++++++++ www/read/main.js | 23 +++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 www/read/index.html create mode 100644 www/read/main.js diff --git a/www/read/index.html b/www/read/index.html new file mode 100644 index 000000000..32f6f5a06 --- /dev/null +++ b/www/read/index.html @@ -0,0 +1,35 @@ + + + + + + + + + + + + + +

+
diff --git a/www/read/main.js b/www/read/main.js
new file mode 100644
index 000000000..4a8d36eeb
--- /dev/null
+++ b/www/read/main.js
@@ -0,0 +1,23 @@
+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); }
+        console.log(doc);
+        $dest.text(doc);
+    };
+
+    $('#get').click(function () {
+        var val = $target.val();
+        if (!val.trim()) { return; }
+        Crypt.get(val, useDoc);
+    });
+
+    if (window.location.hash) { Crypt.get(void 0, useDoc); }
+});