web/assets/libs/jquery.colorbox/1.6.0/index.js

(开头部分) 11KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

define("jquery.colorbox/1.6.0/index",["jquery"],function(t){var e=t("jquery");!function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=E.length,i=(z+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?W.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in x[0]&&!x[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),x.focus())}function c(t){c.str!==t&&(x.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){z=0,e&&e!==!1&&"nofollow"!==e?(E=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),z=E.index(O.el),-1===z&&(E=E.add(O.el),z=E.length-1)):E=t(O.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),O=new r(i,o),g(O.get("rel")),!U){U=$=!0,c(O.get("className")),x.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),_=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),q=I.outerHeight(!0),N=I.outerWidth(!0);var h=a(O.get("initialWidth"),"x"),s=a(O.get("initialHeight"),"y"),l=O.get("maxWidth"),f=O.get("maxHeight");O.w=(l!==!1?Math.min(h,a(l,"x")):h)-N-D,O.h=(f!==!1?Math.min(s,a(f,"y")):s)-q-_,I.css({width:"",height:O.h}),Q.position(),u(ee),O.get("onOpen"),B.add(M).hide(),x.focus(),O.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),O.get("returnFocus")&&ae.one(re,function(){t(O.el).focus()})}var p=parseFloat(O.get("opacity"));v.css({opacity:p===p?p:"",cursor:O.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),O.get("closeButton")?j.html(O.get("close")).appendTo(b):j.appendTo("<div/>"),w()}}function p(){x||(V=!1,W=t(i),x=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),S=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),y=n(se,"Wrapper"),b=n(se,"Content").append(M=n(se,"Title"),F=n(se,"Current"),P=t('<button type="button"/>').attr({id:Z+"Previous"}),K=t('<button type="button"/>').attr({id:Z+"Next"}),R=n("button","Slideshow"),S),j=t('<button type="button"/>').attr({id:Z+"Close"}),y.append(n(se).append(n(se,"TopLeft"),T=n(se,"TopCenter"),n(se,"TopRight")),n(se,!1,"clear:left").append(C=n(se,"MiddleLeft"),b,H=n(se,"MiddleRight")),n(se,!1,"clear:left").append(n(se,"BottomLeft"),k=n(se,"BottomCenter"),n(se,"BottomRight"))).find("div div").css({"float":"left"}),L=n(se,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),B=K.add(P).add(F).add(R)),e.body&&!x.parent().length&&t(e.body).append(v,x.append(y,L))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),f(this))}return x?(V||(V=!0,K.click(function(){Q.next()}),P.click(function(){Q.prev()}),j.click(function(){Q.close()}),v.click(function(){O.get("overlayClose")&&Q.close()}),t(e).bind("keydown."+Z,function(t){var e=t.keyCode;U&&O.get("escKey")&&27===e&&(t.preventDefault(),Q.close()),U&&O.get("arrowKey")&&E[1]&&!t.altKey&&(37===e?(t.preventDefault(),P.click()):39===e&&(t.preventDefault(),K.click()))}),t.isFunction(t.fn.on)?t(e).on("click."+Z,"."+te,i):t("."+te).live("click."+Z,i)),!0):!1}function w(){var e,o,r,h=Q.prep,d=++le;if($=!0,A=!1,u(he),u(ie),O.get("onLoad"),O.h=O.get("height")?a(O.get("height"),"y")-q-_:O.get("innerHeight")&&a(O.get("innerHeight"),"y"),O.w=O.get("width")?a(O.get("width"),"x")-N-D:O.get("innerWidth")&&a(O.get("innerWidth"),"x"),O.mw=O.w,O.mh=O.h,O.get("maxWidth")&&(O.mw=a(O.get("maxWidth"),"x")-N-D,O.mw=O.w&&O.w<O.mw?O.w:O.mw),O.get("maxHeight")&&(O.mh=a(O.get("maxHeight"),"y")-q-_,O.mh=O.h&&O.h<O.mh?O.h:O.mh),e=O.get("href"),J=setTimeout(function(){S.show()},100),O.get("inline")){var c=t(e);r=t("<div>").hide().insertBefore(c),ae.one(he,function(){r.replaceWith(c)}),h(c)}else O.get("iframe")?h(" "):O.get("html")?h(O.get("html")):s(O,e)?(e=l(O,e),A=O.get("createImg"),t(A).addClass(Z+"Photo").bind("error",function(){h(n(se,"Error").html(O.get("imgError")))}).one("load",function(){d===le&&setTimeout(function(){var t;O.get("retinaImage")&&i.devicePixelRatio>1&&(A.height=A.height/i.devicePixelRatio,A.width=A.width/i.devicePixelRatio),O.get("scalePhotos")&&(o=function(){A.height-=A.height*t,A.width-=A.width*t},O.mw&&A.width>O.mw&&(t=(A.width-O.mw)/A.width,o()),O.mh&&A.height>O.mh&&(t=(A.height-O.mh)/A.height,o())),O.h&&(A.style.marginTop=Math.max(O.mh-A.height,0)/2+"px"),E[1]&&(O.get("loop")||E[z+1])&&(A.style.cursor="pointer",A.onclick=function(){Q.next()}),A.style.width=A.width+"px",A.style.height=A.height+"px",h(A)},1)}),A.src=e):e&&L.load(e,O.get("data"),function(e,i){d===le&&h("error"===i?n(se,"Error").html(O.get("xhrError")):t(this).contents())})}var v,x,y,b,T,C,H,k,E,W,I,L,S,M,F,R,K,P,j,B,O,_,D,q,N,z,A,U,$,G,J,Q,V,X={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title},createImg:function(){var e=new Image,i=t(this).data("cbox-img-attrs");return"object"==typeof i&&t.each(i,function(t,i){e[t]=i}),e},createIframe:function(){var i=e.createElement("iframe"),n=t(this).data("cbox-iframe-attrs");return"object"==typeof n&&t.each(n,function(t,e){i[t]=e}),"frameBorder"in i&&(i.frameBorder=0),"allowTransparency"in i&&(i.allowTransparency="true"),i.name=(new Date).getTime(),i.allowFullScreen=!0,i}},Y="colorbox",Z="cbox",te=Z+"Element",ee=Z+"_open",ie=Z+"_load",ne=Z+"_complete",oe=Z+"_cleanup",re=Z+"_closed",he=Z+"_purge",ae=t("<a/>"),se="div",le=0,de={},ce=function(){function t(){clearTimeout(h)}function e(){(O.get("loop")||E[z+1])&&(t(),h=setTimeout(Q.next,O.get("slideshowSpeed")))}function i(){R.html(O.get("slideshowStop")).unbind(s).one(s,n),ae.bind(ne,e).bind(ie,t),x.removeClass(a+"off").addClass(a+"on")}function n(){t(),ae.unbind(ne,e).unbind(ie,t),R.html(O.get("slideshowStart")).unbind(s).one(s,function(){Q.next(),i()}),x.removeClass(a+"on").addClass(a+"off")}function o(){r=!1,R.hide(),t(),ae.unbind(ne,e).unbind(ie,t),x.removeClass(a+"off "+a+"on")}var r,h,a=Z+"Slideshow_",s="click."+Z;return function(){r?O.get("slideshow")||(ae.unbind(oe,o),o()):O.get("slideshow")&&E[1]&&(r=!0,ae.one(oe,o),O.get("slideshowAuto")?i():n(),R.show())}}();t[Y]||(t(p),Q=t.fn[Y]=t[Y]=function(e,i){var n,o=this;return e=e||{},t.isFunction(o)&&(o=t("<a/>"),e.open=!0),o[0]?(p(),m()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,Y)||{};t.data(this,Y,t.extend(i,e))}).addClass(te),n=new r(o[0],e),n.get("open")&&f(o[0])),o):o},Q.position=function(e,i){function n(){T[0].style.width=k[0].style.width=b[0].style.width=parseInt(x[0].style.width,10)-D+"px",b[0].style.height=C[0].style.height=H[0].style.height=parseInt(x[0].style.height,10)-_+"px"}var r,h,s,l=0,d=0,c=x.offset();if(W.unbind("resize."+Z),x.css({top:-9e4,left:-9e4}),h=W.scrollTop(),s=W.scrollLeft(),O.get("fixed")?(c.top-=h,c.left-=s,x.css({position:"fixed"})):(l=h,d=s,x.css({position:"absolute"})),d+=O.get("right")!==!1?Math.max(W.width()-O.w-N-D-a(O.get("right"),"x"),0):O.get("left")!==!1?a(O.get("left"),"x"):Math.round(Math.max(W.width()-O.w-N-D,0)/2),l+=O.get("bottom")!==!1?Math.max(o()-O.h-q-_-a(O.get("bottom"),"y"),0):O.get("top")!==!1?a(O.get("top"),"y"):Math.round(Math.max(o()-O.h-q-_,0)/2),x.css({top:c.top,left:c.left,visibility:"visible"}),y[0].style.width=y[0].style.height="9999px",r={width:O.w+N+D,height:O.h+q+_,top:l,left:d},e){var g=0;t.each(r,function(t){return r[t]!==de[t]?void(g=e):void 0}),e=g}de=r,e||x.css(r),x.dequeue().animate(r,{duration:e||0,complete:function(){n(),$=!1,y[0].style.width=O.w+N+D+"px",y[0].style.height=O.h+q+_+"px",O.get("reposition")&&setTimeout(function(){W.bind("resize."+Z,Q.position)},1),t.isFunction(i)&&i()},step:n})},Q.resize=function(t){var e;U&&(t=t||{},t.width&&(O.w=a(t.width,"x")-N-D),t.innerWidth&&(O.w=a(t.innerWidth,"x")),I.css({width:O.w}),t.height&&(O.h=a(t.height,"y")-q-_),t.innerHeight&&(O.h=a(t.innerHeight,"y")),t.innerHeight||t.height||(e=I.scrollTop(),I.css({height:"auto"}),O.h=I.height()),I.css({height:O.h}),e&&I.scrollTop(e),Q.position("none"===O.get("transition")?0:O.get("speed")))},Q.prep=function(i){function o(){return O.w=O.w||I.width(),O.w=O.mw&&O.mw<O.w?O.mw:O.w,O.w}function a(){return O.h=O.h||I.height(),O.h=O.mh&&O.mh<O.h?O.mh:O.h,O.h}if(U){var d,g="none"===O.get("transition")?0:O.get("speed");I.remove(),I=n(se,"LoadedContent").append(i),I.hide().appendTo(L.show()).css({width:o(),overflow:O.get("scrolling")?"auto":"hidden"}).css({height:a()}).prependTo(b),L.hide(),t(A).css({"float":"none"}),c(O.get("className")),d=function(){function i(){t.support.opacity===!1&&x[0].style.removeAttribute("filter")}var n,o,a=E.length;U&&(o=function(){clearTimeout(J),S.hide(),u(ne),O.get("onComplete")},M.html(O.get("title")).show(),I.show(),a>1?("string"==typeof O.get("current")&&F.html(O.get("current").replace("{current}",z+1).replace("{total}",a)).show(),K[O.get("loop")||a-1>z?"show":"hide"]().html(O.get("next")),P[O.get("loop")||z?"show":"hide"]().html(O.get("previous")),ce(),O.get("preloading")&&t.each([h(-1),h(1)],function(){var i,n=E[this],o=new r(n,t.data(n,Y)),h=o.get("href");h&&s(o,h)&&(h=l(o,h),i=e.createElement("img"),i.src=h)})):B.hide(),O.get("iframe")?(n=O.get("createIframe"),O.get("scrolling")||(n.scrolling="no"),t(n).attr({src:O.get("href"),"class":Z+"Iframe"}).one("load",o).appendTo(I),ae.one(he,function(){n.src="//about:blank"}),O.get("fastIframe")&&t(n).trigger("load")):o(),"fade"===O.get("transition")?x.fadeTo(g,1,i):i())},"fade"===O.get("transition")?x.fadeTo(g,0,function(){Q.position(0,d)}):Q.position(g,d)}},Q.next=function(){!$&&E[1]&&(O.get("loop")||E[z+1])&&(z=h(1),f(E[z]))},Q.prev=function(){!$&&E[1]&&(O.get("loop")||z)&&(z=h(-1),f(E[z]))},Q.close=function(){U&&!G&&(G=!0,U=!1,u(oe),O.get("onCleanup"),W.unbind("."+Z),v.fadeTo(O.get("fadeOut")||0,0),x.stop().fadeTo(O.get("fadeOut")||0,0,function(){x.hide(),v.hide(),u(he),I.remove(),setTimeout(function(){G=!1,u(re),O.get("onClosed")},1)}))},Q.remove=function(){x&&(x.stop(),t[Y].close(),x.stop(!1,!0).remove(),v.remove(),G=!1,x=null,t("."+te).removeData(Y).removeClass(te),t(e).unbind("click."+Z).unbind("keydown."+Z))},Q.element=function(){return t(O.el)},Q.settings=X)}(e,document,window),e.extend(e.colorbox.settings,{current:"\u5f53\u524d\u56fe\u50cf {current} \u603b\u5171 {total}",previous:"\u524d\u4e00\u9875",next:"\u540e\u4e00\u9875",close:"\u5173\u95ed",xhrError:"\u6b64\u5185\u5bb9\u65e0\u6cd5\u52a0\u8f7d",imgError:"\u6b64\u56fe\u7247\u65e0\u6cd5\u52a0\u8f7d",slideshowStart:"\u5f00\u59cb\u64ad\u653e\u5e7b\u706f\u7247",slideshowStop:"\u505c\u6b62\u64ad\u653e\u5e7b\u706f\u7247"})});

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。