jumpserver/apps/static/plugins/elfinder/extras/quicklook.googledocs.min.js

1 line
1.5 KiB
JavaScript
Executable File

!function(n,e){"function"==typeof define&&define.amd?define(["elfinder"],e):"undefined"!=typeof exports?module.exports=e(require("elfinder")):e(n.elFinder)}(this,function(n){"use strict";try{n.prototype.commands.quicklook.plugins||(n.prototype.commands.quicklook.plugins=[]),n.prototype.commands.quicklook.plugins.push(function(n){var e=n.fm,o=n.preview;o.on("update",function(i){var t,l,r=(n.window,i.file);0===r.mime.indexOf("application/vnd.google-apps.")&&("1"==r.url&&(o.hide(),$('<div class="elfinder-quicklook-info-data"><button class="elfinder-info-button">'+e.i18n("getLink")+"</button></div>").appendTo(n.info.find(".elfinder-quicklook-info")).on("click",function(){$(this).html('<span class="elfinder-info-spinner">'),e.request({data:{cmd:"url",target:r.hash},preventDefault:!0}).always(function(){o.show(),$(this).html("")}).done(function(i){var t=e.file(r.hash);n.value.url=t.url=i.url||"",n.value.url&&o.trigger($.Event("update",{file:n.value}))})})),""!==r.url&&"1"!=r.url&&(i.stopImmediatePropagation(),o.one("change",function(){l.remove(),t.off("load").remove()}),l=$('<div class="elfinder-quicklook-info-data">'+e.i18n("nowLoading")+'<span class="elfinder-info-spinner"></div>').appendTo(n.info.find(".elfinder-quicklook-info")),t=$('<iframe class="elfinder-quicklook-preview-iframe"/>').css("background-color","transparent").appendTo(o).on("load",function(){n.hideinfo(),l.remove(),$(this).css("background-color","#fff").show()}).attr("src",e.url(r.hash))))})})}catch(e){}});