Files
DzzOffice/static/dzzthumb/jquery.dzzthumb.js

9 lines
7.4 KiB
JavaScript
Raw Normal View History

/*
* @copyright Leyun internet Technology(Shanghai)Co.,Ltd
* @license http://www.dzzoffice.com/licenses/license.txt
* @package DzzOffice
* @link http://www.dzzoffice.com
* @author zyx(zyx@dzz.cc)
<img src="" data-original="" data-download="">
*/
!function(e){e.fn.dzzthumb=function(t){var i={root:e("body"),selector:"img[data-original]",container:e("body"),allowdownload:1},n=e.extend(i,t),o=0,r=0;$imgs=e(this),$imgs.off("click.dzzthumb").on("click.dzzthumb",function(){var e=this;return $imgs.each(function(t){this.src==e.src&&(r=t)}),p(),u(),!1});var a,d,s,l,p=function(){jQuery("html,body").addClass("dzzthumb_body"),document.getElementById("MsgContainer")?jQuery("#MsgContainer").empty().show():jQuery('<div id="MsgContainer" style=" background: url(dzz/images/b.gif); z-index:99999;width:100%;height:100%;margin:0;padding:0; right: 0px; bottom: 0px;position: fixed; top:0px; left: 0px;"></div>').appendTo(n.container);var t="";t+='<div id="preview_Container" style="position:absolute;width:100%;height:100%;top:0px;left:0px;bottom:0px;right:0px;display:none;z-index:10000">',t+='<div id="preview-box" class="preview-box">',t+='\t<div class="preview-handle" style="z-index: 118;"><b data_title="ESC'+__lang.logout+'" btn="close" class="pr-close">ESC'+__lang.logout+"</b></div>",t+='\t<div id="btn_hand" class="preview-panel" style="z-index: 117;">',t+='\t\t<ul id="contents-panel" style="right:55px;" class="contents-panel">',t+='\t\t\t<li btn="rotate" ><i class="pr-rotate"></i><b>'+__lang.rotation+"</b></li>",n.allowdownload&&(t+='\t\t\t<li class="hidden-xs" btn="download" ><i class="pr-download"></i><b>'+__lang.download+"</b></li>"),t+='\t\t\t<li btn="newwindow" ><i class="pr-newwindow"></i><b>'+__lang.look_artwork+"</b></li>",t+="\t\t</ul>",t+='\t\t<div id="file_name" class="previewer-filename hidden-xs"></div>',t+="\t</div>",t+='\t<div id="con" class="preview-contents">',t+='\t\t<div class="pr-btn-switch">',t+='\t\t\t<b data_title="'+__lang.keyboard+"“←”"+__lang.key_on+'" btn="prev" class="pr-btn-prev" style="z-index: 116;" >'+__lang.on_a+"</b>",t+='\t\t\t<b data_title="'+__lang.keyboard+"“→”"+__lang.key_under+'" btn="next" class="pr-btn-next" style="z-index: 116;">'+__lang.under_a+"</b>",t+="\t\t</div>",t+='\t\t<div id="pre_loading" style="display: none;" class="previewer-loading">'+__lang.loading_in+"</div>",t+='\t\t<div id="previewer-photo" class="previewer-photo" style="overflow: visible; z-index: 114; display: none; left: 0px; top: 40px;background-color: rgba(0,0,0,.5);"></div>',t+="\t</div>",t+="</div>",t+='<div id="prev-tips" class="prev-tips" >'+__lang.keyboard+"“←”"+__lang.key_on+"</div>",t+='<div id="next-tips" class="next-tips">'+__lang.keyboard+"“→”"+__lang.key_under+"</div>",t+='<div id="close-tips" class="esc-tips">ESC'+__lang.logout+"</div>",t+='<div id="popup-hint" style="z-index: 999999999; top: 50%; left:50%;margin-left:-86px; display:none;" class="popup-hint">',t+='\t<i rel="type" class="hint-icon hint-inf-m"></i>',t+='\t<em class="sl"><b></b></em>',t+='\t<span rel="con">'+__lang.has_last_picture1+"</span>",t+='\t<em class="sr"><b></b></em>',t+="</div>",t+="</div>",jQuery(t).appendTo("#MsgContainer"),jQuery("#preview_Container").css({height:"100%",width:"100%"}).show(),jQuery("#preview-box b").on("mouseenter",function(){var e=jQuery(this).attr("btn");jQuery("#"+e+"-tips").show()}),jQuery("#preview-box b").on("mouseleave",function(){var e=jQuery(this).attr("btn");jQuery("#"+e+"-tips").hide()}),jQuery(document).on("keyup.dzzthumb",function(e){var t;switch(""!=e.which?t=e.which:""!=e.charCode?t=e.charCode:""!=e.keyCode&&(t=e.keyCode),t){case 27:jQuery(document).off(".dzzthumb"),jQuery("#MsgContainer").empty().hide();break;case 37:0==r?(jQuery("#popup-hint").find("span").html(__lang.has_last_picture),jQuery("#popup-hint").show(),window.setTimeout(function(){jQuery("#popup-hint").hide()},3e3)):(r-=1,u());break;case 39:r==$imgs.length-1?(jQuery("#popup-hint").find("span").html(__lang.has_last_picture1),jQuery("#popup-hint").show(),window.setTimeout(function(){jQuery("#popup-hint").hide()},3e3)):(r+=1,u())}}),jQuery("#previewer-photo").on("click.dzzthumb",function(){jQuery(document).off(".dzzthumb"),jQuery("#MsgContainer").empty().hide(),jQuery("html,body").removeClass("dzzthumb_body")}),jQuery("#MsgContainer [btn],#previewer-photo").on(