forgejo/public/js/index.js

2 lines
58 KiB
JavaScript
Raw Normal View History

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