mirror of
https://github.com/Luzifer/ots.git
synced 2024-12-23 22:29:35 -05:00
1 line
2.8 KiB
JavaScript
1 line
2.8 KiB
JavaScript
|
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";var r=null;function o(){var e=$("#formCreateSecret").find("textarea").val();return r=Math.random().toString(36).substring(2),e=GibberishAES.enc(e,r),$.ajax("api/create",{method:"post",data:{secret:e},dataType:"json",statusCode:{201:l,400:s,500:s,404:function(){l({secret_id:"foobar"})}}}),!1}function i(){$("#notfound").show()}function c(){0!==window.location.hash.length&&($("#cardNewSecret").hide(),$("#cardSecretURL").hide(),$("#notfound").hide(),$("#somethingwrong").hide(),$("#cardReadSecretPre").show())}function a(){$("#formCreateSecret").bind("submit",o),$("#newSecret, .navbar-brand").bind("click",d),$(window).bind("hashchange",c),$("#revealSecret").bind("click",u),$("textarea").each(function(e,t){var n=function(){t.style.height=t.scrollHeight+"px"},r=function(){window.setTimeout(n,0)};t.setAttribute("style","height: #{this.scrollHeight}px; min-height: #{this.scrollHeight}px; overflow-y:hidden;"),$(t).on("change",n).on("cut",r).on("paste",r).on("drop",r).on("keydown",r)})}function d(){location.href=location.href.split("#")[0]}function u(){var e=window.location.hash,t=(e=decodeURIComponent(e)).split("|");2===t.length&&(e=t[0],r=t[1]);var n=e.substring(1);$.ajax("api/get/"+n,{dataType:"json",statusCode:{404:i,200:f}})}function l(e){var t=e.secret_id;null!==r&&(t=t+"|"+r);var n=location.href.split("#")[0]+"#"+t;$("#cardNewSecret").hide(),$("#cardReadSecretPre").hide(),$("#cardSecretURL").show(),$("#cardSecretURL").find("input").val(n),$("#cardSecretURL").find("input").focus(),$("#cardSecretURL").find("input").select(),r=null}function f(e){var t=e.secret;null!==r&&(t=GibberishAES.dec(t,r)),$("#cardNewSecret").hide(),$("#cardSecretURL").hide(),$("#notfound").hide(),$("#somethingwrong").hide(),$("#cardReadSecretPre").hide(),$("#cardReadSecret").show(),$("#cardReadSecret").find("textarea").val(t),$("#cardReadSecret").find("textarea").trigger("change")}function s(){$("#somethingwrong").show()}$(function(){a(),c()})}]);
|