Author: echatellier Date: 2013-04-02 15:17:29 +0200 (Tue, 02 Apr 2013) New Revision: 194 Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/194 Log: Update colorbox and make molecule image cliquable in color box Modified: trunk/cantharella.web/src/main/webapp/colorbox/colorbox.css trunk/cantharella.web/src/main/webapp/colorbox/jquery.colorbox-min.js trunk/cantharella.web/src/main/webapp/js/molviewer.js Modified: trunk/cantharella.web/src/main/webapp/colorbox/colorbox.css =================================================================== --- trunk/cantharella.web/src/main/webapp/colorbox/colorbox.css 2013-04-02 09:57:53 UTC (rev 193) +++ trunk/cantharella.web/src/main/webapp/colorbox/colorbox.css 2013-04-02 13:17:29 UTC (rev 194) @@ -1,5 +1,5 @@ /* %%Ignore-License - ColorBox Core Style: + Colorbox Core Style: The following CSS is consistent between example themes and should not be altered. */ #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} @@ -16,7 +16,7 @@ /* User Style: - Change the following styles to modify the appearance of ColorBox. They are + Change the following styles to modify the appearance of Colorbox. They are ordered & tabbed in a way that represents the nesting of the generated HTML. */ #cboxOverlay{background:#000;} Modified: trunk/cantharella.web/src/main/webapp/colorbox/jquery.colorbox-min.js =================================================================== --- trunk/cantharella.web/src/main/webapp/colorbox/jquery.colorbox-min.js 2013-04-02 09:57:53 UTC (rev 193) +++ trunk/cantharella.web/src/main/webapp/colorbox/jquery.colorbox-min.js 2013-04-02 13:17:29 UTC (rev 194) @@ -1,6 +1,6 @@ /*! %%Ignore-License - jQuery ColorBox v1.4.3 - 2013-02-18 + jQuery Colorbox v1.4.8 - 2013-04-02 (c) 2013 Jack Moore - jacklmoore.com/colorbox license: http://www.opensource.org/licenses/mit-license.php */ -(function(e,t,i){function o(i,o,n){var r=t.createElement(i);return o&&(r.id=Y+o),n&&(r.style.cssText=n),e(r)}function n(e){var t=T.length,i=(A+e)%t;return 0>i?t+i:i}function r(e,t){return Math.round((/%/.test(e)?("x"===t?k.width():k.height())/100:1)*parseInt(e,10))}function h(e,t){return e.photo||e.photoRegex.test(t)}function l(e,t){return e.retinaUrl&&i.devicePixelRatio>1?t.replace(e.photoRegex,e.retinaSuffix):t}function s(e){"contains"in w[0]&&!w[0].contains(e.target)&&(e.stopPropagation(),w.focus())}function a(){var t,i=e.data(N,V);null==i?(K=e.extend({},J),console&&console.log&&console.log("Error: cboxElement missing settings object")):K=e.extend({},i);for(t in K)e.isFunction(K[t])&&"on"!==t.slice(0,2)&&(K[t]=K[t].call(N));K.rel=K.rel||N.rel||e(N).data("rel")||"nofollow",K.href=K.href||e(N).attr("href"),K.title=K.title||N.title,"string"==typeof K.href&&(K.href=e.trim(K.href))}function d(i,o){e(t).trigger(i),at.trigger(i),e.isFunction(o)&&o.call(N)}function c(){var e,t,i,o,n,r=Y+"Slideshow_",h="click."+Y;K.slideshow&&T[1]?(t=function(){clearTimeout(e)},i=function(){(K.loop||T[A+1])&&(e=setTimeout(G.next,K.slideshowSpeed))},o=function(){M.html(K.slideshowStop).unbind(h).one(h,n),at.bind(it,i).bind(tt,t).bind(ot,n),w.removeClass(r+"off").addClass(r+"on")},n=function(){t(),at.unbind(it,i).unbind(tt,t).unbind(ot,n),M.html(K.slideshowStart).unbind(h).one(h,function(){G.next(),o()}),w.removeClass(r+"on").addClass(r+"off")},K.slideshowAuto?o():n()):w.removeClass(r+"off "+r+"on")}function u(i){U||(N=i,a(),T=e(N),A=0,"nofollow"!==K.rel&&(T=e("."+Z).filter(function(){var t,i=e.data(this,V);return i&&(t=e(this).data("rel")||i.rel||this.rel),t===K.rel}),A=T.index(N),-1===A&&(T=T.add(N),A=T.length-1)),m.css({opacity:parseFloat(K.opacity),cursor:K.overlayClose?"pointer":"auto",visibility:"visible"}).show(),j||(j=q=!0,w.css({visibility:"hidden",display:"block"}),E=o(dt,"LoadedContent","width:0; height:0; overflow:hidden").appendTo(v),_=x.height()+C.height()+v.outerHeight(!0)-v.height(),z=y.width()+b.width()+v.outerWidth(!0)-v.width(),D=E.outerHeight(!0),B=E.outerWidth(!0),K.w=r(K.initialWidth,"x"),K.h=r(K.initialHeight,"y"),G.position(),lt&&k.bind("resize."+st+" scroll."+st,function(){m.css({width:k.width(),height:k.height(),top:k.scrollTop(),left:k.scrollLeft()})}).trigger("resize."+st),c(),d(et,K.onOpen),P.add(W).hide(),R.html(K.close).show(),w.focus(),t.addEventListener&&(t.addEventListener("focus",s,!0),at.one(nt,function(){t.removeEventListener("focus",s,!0)})),K.returnFocus&&at.one(nt,function(){e(N).focus()})),G.load(!0))}function f(){!w&&t.body&&(X=!1,k=e(i),w=o(dt).attr({id:V,"class":ht?Y+(lt?"IE6":"IE"):"",role:"dialog",tabindex:"-1"}).hide(),m=o(dt,"Overlay",lt?"position:absolute":"").hide(),L=o(dt,"LoadingOverlay").add(o(dt,"LoadingGraphic")),g=o(dt,"Wrapper"),v=o(dt,"Content").append(W=o(dt,"Title"),H=o(dt,"Current"),F=o("button","Previous"),S=o("button","Next"),M=o("button","Slideshow"),L,R=o("button","Close")),g.append(o(dt).append(o(dt,"TopLeft"),x=o(dt,"TopCenter"),o(dt,"TopRight")),o(dt,!1,"clear:left").append(y=o(dt,"MiddleLeft"),v,b=o(dt,"MiddleRight")),o(dt,!1,"clear:left").append(o(dt,"BottomLeft"),C=o(dt,"BottomCenter"),o(dt,"BottomRight"))).find("div div").css({"float":"left"}),I=o(dt,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),P=S.add(F).add(H).add(M),e(t.body).append(m,w.append(g,I)))}function p(){function i(e){e.which>1||e.shiftKey||e.altKey||e.metaKey||(e.preventDefault(),u(this))}return w?(X||(X=!0,S.click(function(){G.next()}),F.click(function(){G.prev()}),R.click(function(){G.close()}),m.click(function(){K.overlayClose&&G.close()}),e(t).bind("keydown."+Y,function(e){var t=e.keyCode;j&&K.escKey&&27===t&&(e.preventDefault(),G.close()),j&&K.arrowKey&&T[1]&&!e.altKey&&(37===t?(e.preventDefault(),F.click()):39===t&&(e.preventDefault(),S.click()))}),e.isFunction(e.fn.on)?e(t).on("click."+Y,"."+Z,i):e("."+Z).live("click."+Y,i)),!0):!1}var m,w,g,v,x,y,b,C,T,k,E,I,L,W,H,M,S,F,R,P,K,_,z,D,B,N,A,O,j,q,U,$,G,Q,X,J={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,className:!1,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.",open:!1,returnFocus:!0,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)((#|\?).*)?$/i,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0},V="colorbox",Y="cbox",Z=Y+"Element",et=Y+"_open",tt=Y+"_load",it=Y+"_complete",ot=Y+"_cleanup",nt=Y+"_closed",rt=Y+"_purge",ht=!e.support.leadingWhitespace,lt=ht&&!i.XMLHttpRequest,st=Y+"_IE6",at=e({}),dt="div";e.colorbox||(e(f),G=e.fn[V]=e[V]=function(t,i){var o=this;if(t=t||{},f(),p()){if(e.isFunction(o))o=e("<a/>"),t.open=!0;else if(!o[0])return o;i&&(t.onComplete=i),o.each(function(){e.data(this,V,e.extend({},e.data(this,V)||J,t))}).addClass(Z),(e.isFunction(t.open)&&t.open.call(o)||t.open)&&u(o[0])}return o},G.position=function(e,t){function i(e){x[0].style.width=C[0].style.width=v[0].style.width=parseInt(e.style.width,10)-z+"px",v[0].style.height=y[0].style.height=b[0].style.height=parseInt(e.style.height,10)-_+"px"}var o,n,h,l=0,s=0,a=w.offset();k.unbind("resize."+Y),w.css({top:-9e4,left:-9e4}),n=k.scrollTop(),h=k.scrollLeft(),K.fixed&&!lt?(a.top-=n,a.left-=h,w.css({position:"fixed"})):(l=n,s=h,w.css({position:"absolute"})),s+=K.right!==!1?Math.max(k.width()-K.w-B-z-r(K.right,"x"),0):K.left!==!1?r(K.left,"x"):Math.round(Math.max(k.width()-K.w-B-z,0)/2),l+=K.bottom!==!1?Math.max(k.height()-K.h-D-_-r(K.bottom,"y"),0):K.top!==!1?r(K.top,"y"):Math.round(Math.max(k.height()-K.h-D-_,0)/2),w.css({top:a.top,left:a.left,visibility:"visible"}),e=w.width()===K.w+B&&w.height()===K.h+D?0:e||0,g[0].style.width=g[0].style.height="9999px",o={width:K.w+B+z,height:K.h+D+_,top:l,left:s},0===e&&w.css(o),w.dequeue().animate(o,{duration:e,complete:function(){i(this),q=!1,g[0].style.width=K.w+B+z+"px",g[0].style.height=K.h+D+_+"px",K.reposition&&setTimeout(function(){k.bind("resize."+Y,G.position)},1),t&&t()},step:function(){i(this)}})},G.resize=function(e){j&&(e=e||{},e.width&&(K.w=r(e.width,"x")-B-z),e.innerWidth&&(K.w=r(e.innerWidth,"x")),E.css({width:K.w}),e.height&&(K.h=r(e.height,"y")-D-_),e.innerHeight&&(K.h=r(e.innerHeight,"y")),e.innerHeight||e.height||(E.css({height:"auto"}),K.h=E.height()),E.css({height:K.h}),G.position("none"===K.transition?0:K.speed))},G.prep=function(t){function i(){return K.w=K.w||E.width(),K.w=K.mw&&K.mw<K.w?K.mw:K.w,K.w}function r(){return K.h=K.h||E.height(),K.h=K.mh&&K.mh<K.h?K.mh:K.h,K.h}if(j){var s,a="none"===K.transition?0:K.speed;E.empty().remove(),E=o(dt,"LoadedContent").append(t),E.hide().appendTo(I.show()).css({width:i(),overflow:K.scrolling?"auto":"hidden"}).css({height:r()}).prependTo(v),I.hide(),e(O).css({"float":"none"}),s=function(){function t(){ht&&w[0].style.removeAttribute("filter")}var i,r,s=T.length,c="frameBorder",u="allowTransparency";j&&(r=function(){clearTimeout($),L.hide(),d(it,K.onComplete)},ht&&O&&E.fadeIn(100),W.html(K.title).add(E).show(),s>1?("string"==typeof K.current&&H.html(K.current.replace("{current}",A+1).replace("{total}",s)).show(),S[K.loop||s-1>A?"show":"hide"]().html(K.next),F[K.loop||A?"show":"hide"]().html(K.previous),K.slideshow&&M.show(),K.preloading&&e.each([n(-1),n(1)],function(){var t,i,o=T[this],n=e.data(o,V);n&&n.href?(t=n.href,e.isFunction(t)&&(t=t.call(o))):t=e(o).attr("href"),t&&h(n,t)&&(t=l(n,t),i=new Image,i.src=t)})):P.hide(),K.iframe?(i=o("iframe")[0],c in i&&(i[c]=0),u in i&&(i[u]="true"),K.scrolling||(i.scrolling="no"),e(i).attr({src:K.href,name:(new Date).getTime(),"class":Y+"Iframe",allowFullScreen:!0,webkitAllowFullScreen:!0,mozallowfullscreen:!0}).one("load",r).appendTo(E),at.one(rt,function(){i.src="//about:blank"}),K.fastIframe&&e(i).trigger("load")):r(),"fade"===K.transition?w.fadeTo(a,1,t):t())},"fade"===K.transition?w.fadeTo(a,0,function(){G.position(0,s)}):G.position(a,s)}},G.load=function(t){var n,s,c,u=G.prep;q=!0,O=!1,N=T[A],t||a(),Q&&w.add(m).removeClass(Q),K.className&&w.add(m).addClass(K.className),Q=K.className,d(rt),d(tt,K.onLoad),K.h=K.height?r(K.height,"y")-D-_:K.innerHeight&&r(K.innerHeight,"y"),K.w=K.width?r(K.width,"x")-B-z:K.innerWidth&&r(K.innerWidth,"x"),K.mw=K.w,K.mh=K.h,K.maxWidth&&(K.mw=r(K.maxWidth,"x")-B-z,K.mw=K.w&&K.w<K.mw?K.w:K.mw),K.maxHeight&&(K.mh=r(K.maxHeight,"y")-D-_,K.mh=K.h&&K.h<K.mh?K.h:K.mh),n=K.href,$=setTimeout(function(){L.show()},100),K.inline?(c=o(dt).hide().insertBefore(e(n)[0]),at.one(rt,function(){c.replaceWith(E.children())}),u(e(n))):K.iframe?u(" "):K.html?u(K.html):h(K,n)?(n=l(K,n),e(O=new Image).addClass(Y+"Photo").bind("error",function(){K.title=!1,u(o(dt,"Error").html(K.imgError))}).one("load",function(){var e;K.retinaImage&&i.devicePixelRatio>1&&(O.height=O.height/i.devicePixelRatio,O.width=O.width/i.devicePixelRatio),K.scalePhotos&&(s=function(){O.height-=O.height*e,O.width-=O.width*e},K.mw&&O.width>K.mw&&(e=(O.width-K.mw)/O.width,s()),K.mh&&O.height>K.mh&&(e=(O.height-K.mh)/O.height,s())),K.h&&(O.style.marginTop=Math.max(K.mh-O.height,0)/2+"px"),T[1]&&(K.loop||T[A+1])&&(O.style.cursor="pointer",O.onclick=function(){G.next()}),ht&&(O.style.msInterpolationMode="bicubic"),setTimeout(function(){u(O)},1)}),setTimeout(function(){O.src=n},1)):n&&I.load(n,K.data,function(t,i){u("error"===i?o(dt,"Error").html(K.xhrError):e(this).contents())})},G.next=function(){!q&&T[1]&&(K.loop||T[A+1])&&(A=n(1),G.load())},G.prev=function(){!q&&T[1]&&(K.loop||A)&&(A=n(-1),G.load())},G.close=function(){j&&!U&&(U=!0,j=!1,d(ot,K.onCleanup),k.unbind("."+Y+" ."+st),m.fadeTo(200,0),w.stop().fadeTo(300,0,function(){w.add(m).css({opacity:1,cursor:"auto"}).hide(),d(rt),E.empty().remove(),setTimeout(function(){U=!1,d(nt,K.onClosed)},1)}))},G.remove=function(){e([]).add(w).add(m).remove(),w=null,e("."+Z).removeData(V).removeClass(Z),e(t).unbind("click."+Y)},G.element=function(){return e(N)},G.settings=J)})(jQuery,document,window); \ No newline at end of file +(function(e,t,i){function o(i,o,n){var r=t.createElement(i);return o&&(r.id=et+o),n&&(r.style.cssText=n),e(r)}function n(){return i.innerHeight?i.innerHeight:e(i).height()}function r(e){var t=H.length,i=(j+e)%t;return 0>i?t+i:i}function h(e,t){return Math.round((/%/.test(e)?("x"===t?W.width():n())/100:1)*parseInt(e,10))}function l(e,t){return e.photo||e.photoRegex.test(t)}function s(e,t){return e.retinaUrl&&i.devicePixelRatio>1?t.replace(e.photoRegex,e.retinaSuffix):t}function a(e){"contains"in v[0]&&!v[0].contains(e.target)&&(e.stopPropagation(),v.focus())}function d(){var t,i=e.data(O,Z);null==i?(D=e.extend({},Y),console&&console.log&&console.log("Error: cboxElement missing settings object")):D=e.extend({},i);for(t in D)e.isFunction(D[t])&&"on"!==t.slice(0,2)&&(D[t]=D[t].call(O));D.rel=D.rel||O.rel||e(O).data("rel")||"nofollow",D.href=D.href||e(O).attr("href"),D.title=D.title||O.title,"string"==typeof D.href&&(D.href=e.trim(D.href))}function c(i,o){e(t).trigger(i),at.trigger(i),e.isFunction(o)&&o.call(O)}function u(){var e,t,i,o,n,r=et+"Slideshow_",h="click."+et;D.slideshow&&H[1]?(t=function(){clearTimeout(e)},i=function(){(D.loop||H[j+1])&&(e=setTimeout(J.next,D.slideshowSpeed))},o=function(){M.html(D.slideshowStop).unbind(h).one(h,n),at.bind(nt,i).bind(ot,t).bind(rt,n),v.removeClass(r+"off").addClass(r+"on")},n=function(){t(),at.unbind(nt,i).unbind(ot,t).unbind(rt,n),M.html(D.slideshowStart).unbind(h).one(h,function(){J.next(),o()}),v.removeClass(r+"on").addClass(r+"off")},D.slideshowAuto?o():n()):v.removeClass(r+"off "+r+"on")}function f(i){G||(O=i,d(),H=e(O),j=0,"nofollow"!==D.rel&&(H=e("."+tt).filter(function(){var t,i=e.data(this,Z);return i&&(t=e(this).data("rel")||i.rel||this.rel),t===D.rel}),j=H.index(O),-1===j&&(H=H.add(O),j=H.length-1)),g.css({opacity:parseFloat(D.opacity),cursor:D.overlayClose?"pointer":"auto",visibility:"visible"}).show(),V&&v.add(g).removeClass(V),D.className&&v.add(g).addClass(D.className),V=D.className,K.html(D.close).show(),$||($=q=!0,v.css({visibility:"hidden",display:"block"}),E=o(dt,"LoadedContent","width:0; height:0; overflow:hidden").appendTo(y),B=b.height()+k.height()+y.outerHeight(!0),N=C.width()+T.width()+y.outerWidth(!0),z=E.outerHeight(!0),A=E.outerWidth(!0),D.w=h(D.initialWidth,"x"),D.h=h(D.initialHeight,"y"),J.position(),u(),c(it,D.onOpen),_.add(S).hide(),v.focus(),t.addEventListener&&(t.addEventListener("focus",a,!0),at.one(ht,function(){t.removeEventListener("focus",a,!0)})),D.returnFocus&&at.one(ht,function(){e(O).focus()})),w())}function p(){!v&&t.body&&(X=!1,W=e(i),v=o(dt).attr({id:Z,"class":st?et+"IE":"",role:"dialog",tabindex:"-1"}).hide(),g=o(dt,"Overlay").hide(),L=o(dt,"LoadingOverlay").add(o(dt,"LoadingGraphic")),x=o(dt,"Wrapper"),y=o(dt,"Content").append(S=o(dt,"Title"),F=o(dt,"Current"),P=o("button","Previous"),R=o("button","Next"),M=o("button","Slideshow"),L,K=o("button","Close")),x.append(o(dt).append(o(dt,"TopLeft"),b=o(dt,"TopCenter"),o(dt,"TopRight")),o(dt,!1,"clear:left").append(C=o(dt,"MiddleLeft"),y,T=o(dt,"MiddleRight")),o(dt,!1,"clear:left").append(o(dt,"BottomLeft"),k=o(dt,"BottomCenter"),o(dt,"BottomRight"))).find("div div").css({"float":"left"}),I=o(dt,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),_=R.add(P).add(F).add(M),e(t.body).append(g,v.append(x,I)))}function m(){function i(e){e.which>1||e.shiftKey||e.altKey||e.metaKey||e.control||(e.preventDefault(),f(this))}return v?(X||(X=!0,R.click(function(){J.next()}),P.click(function(){J.prev()}),K.click(function(){J.close()}),g.click(function(){D.overlayClose&&J.close()}),e(t).bind("keydown."+et,function(e){var t=e.keyCode;$&&D.escKey&&27===t&&(e.preventDefault(),J.close()),$&&D.arrowKey&&H[1]&&!e.altKey&&(37===t?(e.preventDefault(),P.click()):39===t&&(e.preventDefault(),R.click()))}),e.isFunction(e.fn.on)?e(t).on("click."+et,"."+tt,i):e("."+tt).live("click."+et,i)),!0):!1}function w(){var t,n,r,a=J.prep,u=++ct;q=!0,U=!1,O=H[j],d(),c(lt),c(ot,D.onLoad),D.h=D.height?h(D.height,"y")-z-B:D.innerHeight&&h(D.innerHeight,"y"),D.w=D.width?h(D.width,"x")-A-N:D.innerWidth&&h(D.innerWidth,"x"),D.mw=D.w,D.mh=D.h,D.maxWidth&&(D.mw=h(D.maxWidth,"x")-A-N,D.mw=D.w&&D.w<D.mw?D.w:D.mw),D.maxHeight&&(D.mh=h(D.maxHeight,"y")-z-B,D.mh=D.h&&D.h<D.mh?D.h:D.mh),t=D.href,Q=setTimeout(function(){L.show()},100),D.inline?(r=o(dt).hide().insertBefore(e(t)[0]),at.one(lt,function(){r.replaceWith(E.children())}),a(e(t))):D.iframe?a(" "):D.html?a(D.html):l(D,t)?(t=s(D,t),e(U=new Image).addClass(et+"Photo").bind("error",function(){D.title=!1,a(o(dt,"Error").html(D.imgError))}).one("load",function(){var e;u===ct&&(D.retinaImage&&i.devicePixelRatio>1&&(U.height=U.height/i.devicePixelRatio,U.width=U.width/i.devicePixelRatio),D.scalePhotos&&(n=function(){U.height-=U.height*e,U.width-=U.width*e},D.mw&&U.width>D.mw&&(e=(U.width-D.mw)/U.width,n()),D.mh&&U.height>D.mh&&(e=(U.height-D.mh)/U.height,n())),D.h&&(U.style.marginTop=Math.max(D.mh-U.height,0)/2+"px"),H[1]&&(D.loop||H[j+1])&&(U.style.cursor="pointer",U.onclick=function(){J.next()}),st&&(U.style.msInterpolationMode="bicubic"),setTimeout(function(){a(U)},1))}),setTimeout(function(){U.src=t},1)):t&&I.load(t,D.data,function(t,i){u===ct&&a("error"===i?o(dt,"Error").html(D.xhrError):e(this).contents())})}var g,v,x,y,b,C,T,k,H,W,E,I,L,S,F,M,R,P,K,_,D,B,N,z,A,O,j,U,$,q,G,Q,J,V,X,Y={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,className:!1,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.",open:!1,returnFocus:!0,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)((#|\?).*)?$/i,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0},Z="colorbox",et="cbox",tt=et+"Element",it=et+"_open",ot=et+"_load",nt=et+"_complete",rt=et+"_cleanup",ht=et+"_closed",lt=et+"_purge",st=!e.support.leadingWhitespace,at=e("<a/>"),dt="div",ct=0;e.colorbox||(e(p),J=e.fn[Z]=e[Z]=function(t,i){var o=this;if(t=t||{},p(),m()){if(e.isFunction(o))o=e("<a/>"),t.open=!0;else if(!o[0])return o;i&&(t.onComplete=i),o.each(function(){e.data(this,Z,e.extend({},e.data(this,Z)||Y,t))}).addClass(tt),(e.isFunction(t.open)&&t.open.call(o)||t.open)&&f(o[0])}return o},J.position=function(e,t){function i(e){b[0].style.width=k[0].style.width=y[0].style.width=parseInt(e.style.width,10)-N+"px",y[0].style.height=C[0].style.height=T[0].style.height=parseInt(e.style.height,10)-B+"px"}var o,r,l,s=0,a=0,d=v.offset();W.unbind("resize."+et),v.css({top:-9e4,left:-9e4}),r=W.scrollTop(),l=W.scrollLeft(),D.fixed?(d.top-=r,d.left-=l,v.css({position:"fixed"})):(s=r,a=l,v.css({position:"absolute"})),a+=D.right!==!1?Math.max(W.width()-D.w-A-N-h(D.right,"x"),0):D.left!==!1?h(D.left,"x"):Math.round(Math.max(W.width()-D.w-A-N,0)/2),s+=D.bottom!==!1?Math.max(n()-D.h-z-B-h(D.bottom,"y"),0):D.top!==!1?h(D.top,"y"):Math.round(Math.max(n()-D.h-z-B,0)/2),v.css({top:d.top,left:d.left,visibility:"visible"}),e=v.width()===D.w+A&&v.height()===D.h+z?0:e||0,x[0].style.width=x[0].style.height="9999px",o={width:D.w+A+N,height:D.h+z+B,top:s,left:a},0===e&&v.css(o),v.dequeue().animate(o,{duration:e,complete:function(){i(this),q=!1,x[0].style.width=D.w+A+N+"px",x[0].style.height=D.h+z+B+"px",D.reposition&&setTimeout(function(){W.bind("resize."+et,J.position)},1),t&&t()},step:function(){i(this)}})},J.resize=function(e){$&&(e=e||{},e.width&&(D.w=h(e.width,"x")-A-N),e.innerWidth&&(D.w=h(e.innerWidth,"x")),E.css({width:D.w}),e.height&&(D.h=h(e.height,"y")-z-B),e.innerHeight&&(D.h=h(e.innerHeight,"y")),e.innerHeight||e.height||(E.css({height:"auto"}),D.h=E.height()),E.css({height:D.h}),J.position("none"===D.transition?0:D.speed))},J.prep=function(t){function i(){return D.w=D.w||E.width(),D.w=D.mw&&D.mw<D.w?D.mw:D.w,D.w}function n(){return D.h=D.h||E.height(),D.h=D.mh&&D.mh<D.h?D.mh:D.h,D.h}if($){var h,a="none"===D.transition?0:D.speed;E.empty().remove(),E=o(dt,"LoadedContent").append(t),E.hide().appendTo(I.show()).css({width:i(),overflow:D.scrolling?"auto":"hidden"}).css({height:n()}).prependTo(y),I.hide(),e(U).css({"float":"none"}),h=function(){function t(){st&&v[0].style.removeAttribute("filter")}var i,n,h=H.length,d="frameBorder",u="allowTransparency";$&&(n=function(){clearTimeout(Q),L.hide(),c(nt,D.onComplete)},st&&U&&E.fadeIn(100),S.html(D.title).add(E).show(),h>1?("string"==typeof D.current&&F.html(D.current.replace("{current}",j+1).replace("{total}",h)).show(),R[D.loop||h-1>j?"show":"hide"]().html(D.next),P[D.loop||j?"show":"hide"]().html(D.previous),D.slideshow&&M.show(),D.preloading&&e.each([r(-1),r(1)],function(){var t,i,o=H[this],n=e.data(o,Z);n&&n.href?(t=n.href,e.isFunction(t)&&(t=t.call(o))):t=e(o).attr("href"),t&&l(n,t)&&(t=s(n,t),i=new Image,i.src=t)})):_.hide(),D.iframe?(i=o("iframe")[0],d in i&&(i[d]=0),u in i&&(i[u]="true"),D.scrolling||(i.scrolling="no"),e(i).attr({src:D.href,name:(new Date).getTime(),"class":et+"Iframe",allowFullScreen:!0,webkitAllowFullScreen:!0,mozallowfullscreen:!0}).one("load",n).appendTo(E),at.one(lt,function(){i.src="//about:blank"}),D.fastIframe&&e(i).trigger("load")):n(),"fade"===D.transition?v.fadeTo(a,1,t):t())},"fade"===D.transition?v.fadeTo(a,0,function(){J.position(0,h)}):J.position(a,h)}},J.next=function(){!q&&H[1]&&(D.loop||H[j+1])&&(j=r(1),f(H[j]))},J.prev=function(){!q&&H[1]&&(D.loop||j)&&(j=r(-1),f(H[j]))},J.close=function(){$&&!G&&(G=!0,$=!1,c(rt,D.onCleanup),W.unbind("."+et),g.fadeTo(200,0),v.stop().fadeTo(300,0,function(){v.add(g).css({opacity:1,cursor:"auto"}).hide(),c(lt),E.empty().remove(),setTimeout(function(){G=!1,c(ht,D.onClosed)},1)}))},J.remove=function(){v&&(v.stop(),e.colorbox.close(),v.stop().remove(),g.remove(),G=!1,v=null,e("."+tt).removeData(Z).removeClass(tt),e(t).unbind("click."+et))},J.element=function(){return e(O)},J.settings=Y)})(jQuery,document,window); \ No newline at end of file Modified: trunk/cantharella.web/src/main/webapp/js/molviewer.js =================================================================== --- trunk/cantharella.web/src/main/webapp/js/molviewer.js 2013-04-02 09:57:53 UTC (rev 193) +++ trunk/cantharella.web/src/main/webapp/js/molviewer.js 2013-04-02 13:17:29 UTC (rev 194) @@ -52,9 +52,18 @@ // forcer l'existance du tag' var formulaString = $(formulaTag).attr('formula').substring(1); var id = $(formulaTag).attr('id'); - $(formulaTag).replaceWith("<canvas id='"+id+"'/>"); + $(formulaTag).replaceWith("<a download='molecule'><canvas id='"+id+"'/></a>"); addChemCanvas(id, formulaString, 100, 100); + + // add download link + var dataUrl = document.getElementById(id).toDataURL("image/png"); + $('#' + id).parent().attr('href', dataUrl); + + // link to colorbox + $('#' + id).parent().colorbox({ + photo: true + }); }); }
participants (1)
-
echatellier@users.forge.codelutin.com