forgejo/public/js/index.js

2 lines
60 KiB
JavaScript
Raw Normal View History

!function(e){var t={};function a(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=t,a.d=function(e,t,i){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(i,n,function(t){return e[t]}.bind(null,n));return i},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=0)}([function(e,t,a){a(1),e.exports=a(2)},function(e,t){function a(e){return jQuery("<div />").text(e).html()}var i,n,o,r,s;function c(e){var t=e.find(".tabular.menu");t.find(".item").tab(),t.find('.item[data-tab="'.concat(t.data("preview"),'"]')).click((function(){var a=$(this);$.post(a.data("url"),{_csrf:i,mode:"gfm",context:a.data("context"),text:e.find('.tab.segment[data-tab="'.concat(t.data("write"),'"] textarea')).val()},(function(a){var i=e.find('.tab.segment[data-tab="'.concat(t.data("preview"),'"]'));i.html(a),emojify.run(i[0]),$("pre code",i[0]).each((function(){hljs.highlightBlock(this)}))}))})),w()}function l(){var e,t;0!==$(".edit.form").length&&(!function(e){var t=e.find(".tabular.menu");t.find(".item").tab();var a=t.find('.item[data-tab="'.concat(t.data("preview"),'"]'));a.length&&(o=a.data("preview-file-modes").split(","),a.click((function(){var a=$(this);$.post(a.data("url"),{_csrf:i,mode:"gfm",context:a.data("context"),text:e.find('.tab.segment[data-tab="'.concat(t.data("write"),'"] textarea')).val()},(function(a){var i=e.find('.tab.segment[data-tab="'.concat(t.data("preview"),'"]'));i.html(a),emojify.run(i[0]),$("pre code",i[0]).each((function(){hljs.highlightBlock(this)}))}))})))}($(".edit.form")),e=$(".edit.form"),(t=e.find(".tabular.menu")).find(".item").tab(),t.find('.item[data-tab="'.concat(t.data("diff"),'"]')).click((function(){var a=$(this);$.post(a.data("url"),{_csrf:i,context:a.data("context"),content:e.find('.tab.segment[data-tab="'.concat(t.data("write"),'"] textarea')).val()},(function(a){var i=e.find('.tab.segment[data-tab="'.concat(t.data("diff"),'"]'));i.html(a),emojify.run(i[0])}))})))}function d(e,t,a,n){return new Promise((function(o){$.ajax({type:"POST",url:e,data:{_csrf:i,action:t,issue_ids:a,id:n},success:o})}))}function u(){window.location.reload()}function h(e){e.each((function(){var e=this;e.addEventListener("paste",(function(t){!function(e,t){if(e.clipboardData){var a=e.clipboardData.items;if(void 0!==a)for(var i=0;i<a.length;i++)if(-1!==a[i].type.indexOf("image")){var n=a[i].getAsFile();"function"==typeof t&&(e.preventDefault(),e.stopPropagation(),t(n))}}}(t,(function(t){var a=t.name.substr(0,t.name.lastIndexOf("."));!function(e,t){if(e.selectionStart||0===e.selectionStart){var a=e.selectionStart,i=e.selectionEnd;e.value=e.value.substring(0,a)+t+e.value.substring(i,e.value.length),e.selectionStart=a+t.length,e.selectionEnd=a+t.length}else e.value+=t}(e,"![".concat(a,"]()")),function(e,t){var a=new XMLHttpRequest;a.onload=function(){200===a.status&&t(a.responseText)},a.open("post","".concat(n,"/attachments"),!0),a.setRequestHeader("X-Csrf-Token",i);var o=new FormData;o.append("file",e,e.name),a.send(o)}(t,(function(t){var i=JSON.parse(t);!function(e,t,a){if(e.selectionStart||0===e.selectionStart){var i=e.selectionStart,n=e.selectionEnd;e.value=e.value.replace(t,a),e.selectionStart=i+a.length-t.length,e.selectionEnd=n+a.length-t.length}else e.value=e.value.replace(t,a)}(e,"![".concat(a,"]()"),"![".concat(a,"](").concat(n,"/attachments/").concat(i.uuid,")"));var o=$('<input id="'.concat(i.uuid,'" name="files" type="hidden">')).val(i.uuid);$(".files").append(o)}))}))}),!1)}))}function f(){
//# sourceMappingURL=index.js.map