1(function ($) { 2 3Drupal.behaviors.initModalFormsLogin = { 4 attach: function (context, settings) { 5 $("a[href*='/user/login'], a[href*='?q=user/login']", context).once('init-modal-forms-login', function () { 6 this.href = this.href.replace(/user\/login/,'modal_forms/nojs/login'); 7 }).addClass('ctools-use-modal ctools-modal-modal-popup-small'); 8 } 9}; 10 11})(jQuery); 12; 13(function ($) { 14 15Drupal.behaviors.initModalFormsRegister = { 16 attach: function (context, settings) { 17 $("a[href*='/user/register'], a[href*='?q=user/register']", context).once('init-modal-forms-register', function () { 18 this.href = this.href.replace(/user\/register/,'modal_forms/nojs/register'); 19 }).addClass('ctools-use-modal ctools-modal-modal-popup-medium'); 20 } 21}; 22 23})(jQuery); 24; 25Drupal.locale = { 'pluralFormula': function ($n) { return Number((((($n%10)==1)&&(($n%100)!=11))?(0):((((($n%10)>=2)&&(($n%10)<=4))&&((($n%100)<10)||(($n%100)>=20)))?(1):2))); }, 'strings': {"":{"An AJAX HTTP error occurred.":"\u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 AJAX HTTP \u043e\u0448\u0438\u0431\u043a\u0430.","HTTP Result Code: !status":"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 HTTP: !status","An AJAX HTTP request terminated abnormally.":"HTTP \u0437\u0430\u043f\u0440\u043e\u0441 AJAX \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e.","Debugging information follows.":"\u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f.","Path: !uri":"\u041f\u0443\u0442\u044c: !uri","StatusText: !statusText":"\u0421\u0442\u0430\u0442\u0443\u0441\u0422\u0435\u043a\u0441\u0442\u043e\u043c","ResponseText: !responseText":"\u041e\u0442\u0432\u0435\u0442\u0422\u0435\u043a\u0441\u0442\u043e\u043c: !responseText","ReadyState: !readyState":"ReadyState: !readyState","Loading":"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430","(active tab)":"(\u0430\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0432\u043a\u043b\u0430\u0434\u043a\u0430)","Hide":"\u0421\u043a\u0440\u044b\u0442\u044c","Show":"\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c","Re-order rows by numerical weight instead of dragging.":"\u0423\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u043e \u0432\u0435\u0441\u0443 \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u043d\u0438\u044f.","Show row weights":"\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0435\u0441 \u0441\u0442\u0440\u043e\u043a","Hide row weights":"\u0421\u043a\u0440\u044b\u0442\u044c \u0432\u0435\u0441 \u0441\u0442\u0440\u043e\u043a","Drag to re-order":"\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043c\u043e\u0436\u043d\u043e, \u043f\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0432 \u043f\u0443\u043d\u043a\u0442 \u043c\u044b\u0448\u043a\u043e\u0439.","Changes made in this table will not be saved until the form is submitted.":"\u0421\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0435 \u0432\u0441\u0442\u0443\u043f\u044f\u0442 \u0432 \u0441\u0438\u043b\u0443, \u043f\u043e\u043a\u0430 \u0432\u044b \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u0438\u0445.","Enabled":"\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u043e","Disabled":"\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e","Hide shortcuts":"\u0421\u043a\u0440\u044b\u0442\u044c \u044f\u0440\u043b\u044b\u043a\u0438","Edit":"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c","Add":"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c","Upload":"\u0417\u0430\u043a\u0430\u0447\u0430\u0442\u044c","Configure":"\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c","Done":"\u0413\u043e\u0442\u043e\u0432\u043e","Anonymous users":"\u0410\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0435 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0438","Select all rows in this table":"\u041e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b","Deselect all rows in this table":"\u0421\u043d\u044f\u0442\u044c \u043e\u0442\u043c\u0435\u0442\u043a\u0443 \u0441\u043e \u0432\u0441\u0435\u0445 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b","Not published":"\u041d\u0435 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043e","Please wait...":"\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435...","Only files with the following extensions are allowed: %files-allowed.":"\u041f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u044f\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u044b \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u043c\u0438: %files-allowed.","By @
25name on @date":"@name, @date","By @name":"@name","Not in menu":"\u041d\u0435 \u0432 \u043c\u0435\u043d\u044e","Alias: @alias":"\u0421\u0438\u043d\u043e\u043d\u0438\u043c: @alias","No alias":"\u0421\u0438\u043d\u043e\u043d\u0438\u043c \u043d\u0435 \u0437\u0430\u0434\u0430\u043d","New revision":"\u041d\u043e\u0432\u0430\u044f \u0440\u0435\u0434\u0430\u043a\u0446\u0438\u044f","The changes to these blocks will not be saved until the \u003Cem\u003ESave blocks\u003C\/em\u003E button is clicked.":"\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0435 \u0432 \u0431\u043b\u043e\u043a\u0430\u0445 \u043d\u0435 \u0432\u0441\u0442\u0443\u043f\u044f\u0442 \u0432 \u0441\u0438\u043b\u0443 \u043f\u043e\u043a\u0430 \u0432\u044b \u043d\u0435 \u043d\u0430\u0436\u043c\u0435\u0442\u0435 \u043a\u043d\u043e\u043f\u043a\u0443 \u003Cem\u003E\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u003C\/em\u003E.","Show shortcuts":"\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448","This permission is inherited from the authenticated user role.":"\u042d\u0442\u043e \u043f\u0440\u0430\u0432\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u0440\u043e\u043b\u0438 \u00ab\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u00bb.","No revision":"\u041d\u0435\u0442 \u0440\u0435\u0434\u0430\u043a\u0446\u0438\u0438","Requires a title":"\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a","Not restricted":"\u0411\u0435\u0437 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439","Not customizable":"\u041d\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439","Restricted to certain pages":"\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446","The block cannot be placed in this region.":"\u0411\u043b\u043e\u043a \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0449\u0451\u043d \u0432 \u044d\u0442\u043e\u043c \u0440\u0435\u0433\u0438\u043e\u043d\u0435.","Customize dashboard":"\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0430\u043d\u0435\u043b\u044c","Hide summary":"\u0421\u043a\u0440\u044b\u0442\u044c \u0430\u043d\u043e\u043d\u0441","Edit summary":"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u043e\u043d\u0441","Don\u0027t display post information":"\u041d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430","@title dialog":"\u0414\u0438\u0430\u043b\u043e\u0433 @title","The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.":"\u0412\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b %filename \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u043c\u0438: %extensions.","Autocomplete popup":"\u0412\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435","Searching for matches...":"\u041f\u043e\u0438\u0441\u043a \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439...","Close":"\u0417\u0430\u043a\u0440\u044b\u0442\u044c","SKU":"\u0410\u0440\u0442\u0438\u043a\u0443\u043b","Sell price":"\u0426\u0435\u043d\u0430 \u043f\u0440\u043e\u0434\u0430\u0436\u0438","Shippable":"\u0422\u043e\u0432\u0430\u0440 \u0441 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u043e\u0439","Authenticated users":"\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438","Anonymous checkout is enabled.":"\u0410\u043d\u043e\u043d\u0438\u043c\u043d\u043e\u0435 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0430\u0437\u043e\u0432 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043e.","Anonymous checkout is disabled.":"\u0410\u043d\u043e\u043d\u0438\u043c\u043d\u043e\u0435 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0430\u0437\u043e\u0432 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e.","Not shippable":"\u041d\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439","Checkout is disabled.":"\u041e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0430\u0437\u0430 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e"}} };; 26/*! 27 Colorbox 1.6.1 28 license: MIT 29 http://www.jacklmoore.com/colorbox 30*/
vendor: 4,647 bytes, line 31
31(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=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.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 y[0]&&!y[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),y.focus())}function c(t){c.str!==t&&(y.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!$){$=q=!0,c(_.get("className")),y.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=(l!==!1?Math.min(h,a(l,"x")):h)-z-D,_.h=(f!==!1?Math.min(s,a(f,"y")):s)-N-j,I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(S).hide(),y.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("<div/>"),w()}}function p(){y||(V=!1,E=t(i),y=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),M=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),x=n(se,"Wrapper"),b=n(se,"Content").append(S=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"),M),B=t('<button type="button"/>').attr({id:Z+"Close"}),x.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;"),O=K.add(P).add(F).add(R)),e.body&&!y.parent().length&&t(e.body).append(v,y.append(x,L))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),f(this))}return y?(V||(V=!0,K.click(function(){J.next()}),P.click(function(){J.prev()}),B.click(function(){J.close()}),v.click(function(){_.get("overlayClose")&&J.close()}),t(e).bind("keydown."+Z,function(t){var e=t.keyCode;$&&_.get("escKey")&&27===e&&(t.preventDefault(),J.close()),$&&_.get("arrowKey")&&W[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=J.prep,d=++le;if(q=!0,U=!1,u(he),u(ie),_.get("onLoad"),_.h=_.get("height")?a(_.get("height"),"y")-N-j:_.get("innerHeight")&&a(_.get("innerHeight"),"y"),_.w=_.get("width")?a(_.get("width"),"x")-z-D:_.get("innerWidth")&&a(_.get("innerWidth"),"x"),_.mw=_.w,_.mh=_.h,_.get("maxWidth")&&(_.mw=a(_.get("maxWidth"),"x")-z-D,_.mw=_.w&&_.w<_.mw?_.w:_.mw),_.get("maxHeight")&&(_.mh=a(_.get("maxHeight"),"y")-N-j,_.mh=_.h&&_.h<_.mh?_.h:_.mh),e=_.get("href"),Q=setTimeout(function(){M.show()},100),_.get("inline")){var c=t(e);r=t("<div>").hide().insertBefore(c),ae.one(he,function(){r.replaceWith(c)}),h(c)}else _.get("iframe")?h(" "):_.get("html")?h(_.get("html")):s(_,e)?(e=l(_,e),U=_.get("
31createImg"),t(U).addClass(Z+"Photo").bind("error."+Z,function(){h(n(se,"Error").html(_.get("imgError")))}).one("load",function(){d===le&&setTimeout(function(){var e;_.get("retinaImage")&&i.devicePixelRatio>1&&(U.height=U.height/i.devicePixelRatio,U.width=U.width/i.devicePixelRatio),_.get("scalePhotos")&&(o=function(){U.height-=U.height*e,U.width-=U.width*e},_.mw&&U.width>_.mw&&(e=(U.width-_.mw)/U.width,o()),_.mh&&U.height>_.mh&&(e=(U.height-_.mh)/U.height,o())),_.h&&(U.style.marginTop=Math.max(_.mh-U.height,0)/2+"px"),W[1]&&(_.get("loop")||W[A+1])&&(U.style.cursor="pointer",t(U).bind("click."+Z,function(){J.next()})),U.style.width=U.width+"px",U.style.height=U.height+"px",h(U)},1)}),U.src=e):e&&L.load(e,_.get("data"),function(e,i){d===le&&h("error"===i?n(se,"Error").html(_.get("xhrError")):t(this).contents())})}var v,y,x,b,T,C,H,k,W,E,I,L,M,S,F,R,K,P,B,O,_,j,D,N,z,A,U,$,q,G,Q,J,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(){(_.get("loop")||W[A+1])&&(t(),h=setTimeout(J.next,_.get("slideshowSpeed")))}function i(){R.html(_.get("slideshowStop")).unbind(s).one(s,n),ae.bind(ne,e).bind(ie,t),y.removeClass(a+"off").addClass(a+"on")}function n(){t(),ae.unbind(ne,e).unbind(ie,t),R.html(_.get("slideshowStart")).unbind(s).one(s,function(){J.next(),i()}),y.removeClass(a+"on").addClass(a+"off")}function o(){r=!1,R.hide(),t(),ae.unbind(ne,e).unbind(ie,t),y.removeClass(a+"off "+a+"on")}var r,h,a=Z+"Slideshow_",s="click."+Z;return function(){r?_.get("slideshow")||(ae.unbind(oe,o),o()):_.get("slideshow")&&W[1]&&(r=!0,ae.one(oe,o),_.get("slideshowAuto")?i():n(),R.show())}}();t[Y]||(t(p),J=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},J.position=function(e,i){function n(){T[0].style.width=k[0].style.width=b[0].style.width=parseInt(y[0].style.width,10)-D+"px",b[0].style.height=C[0].style.height=H[0].style.height=parseInt(y[0].style.height,10)-j+"px"}var r,h,s,l=0,d=0,c=y.offset();if(E.unbind("resize."+Z),y.css({top:-9e4,left:-9e4}),h=E.scrollTop(),s=E.scrollLeft(),_.get("fixed")?(c.top-=h,c.left-=s,y.css({position:"fixed"})):(l=h,d=s,y.css({position:"absolute"})),d+=_.get("right")!==!1?Math.max(E.width()-_.w-z-D-a(_.get("right"),"x"),0):_.get("left")!==!1?a(_.get("left"),"x"):Math.round(Math.max(E.width()-_.w-z-D,0)/2),l+=_.get("bottom")!==!1?Math.max(o()-_.h-N-j-a(_.get("bottom"),"y"),0):_.get("top")!==!1?a(_.get("top"),"y"):Math.round(Math.max(o()-_.h-N-j,0)/2),y.css({top:c.top,left
31:c.left,visibility:"visible"}),x[0].style.width=x[0].style.height="9999px",r={width:_.w+z+D,height:_.h+N+j,top:l,left:d},e){var g=0;t.each(r,function(t){return r[t]!==de[t]?(g=e,void 0):void 0}),e=g}de=r,e||y.css(r),y.dequeue().animate(r,{duration:e||0,complete:function(){n(),q=!1,x[0].style.width=_.w+z+D+"px",x[0].style.height=_.h+N+j+"px",_.get("reposition")&&setTimeout(function(){E.bind("resize."+Z,J.position)},1),t.isFunction(i)&&i()},step:n})},J.resize=function(t){var e;$&&(t=t||{},t.width&&(_.w=a(t.width,"x")-z-D),t.innerWidth&&(_.w=a(t.innerWidth,"x")),I.css({width:_.w}),t.height&&(_.h=a(t.height,"y")-N-j),t.innerHeight&&(_.h=a(t.innerHeight,"y")),t.innerHeight||t.height||(e=I.scrollTop(),I.css({height:"auto"}),_.h=I.height()),I.css({height:_.h}),e&&I.scrollTop(e),J.position("none"===_.get("transition")?0:_.get("speed")))},J.prep=function(i){function o(){return _.w=_.w||I.width(),_.w=_.mw&&_.mw<_.w?_.mw:_.w,_.w}function a(){return _.h=_.h||I.height(),_.h=_.mh&&_.mh<_.h?_.mh:_.h,_.h}if($){var d,g="none"===_.get("transition")?0:_.get("speed");I.remove(),I=n(se,"LoadedContent").append(i),I.hide().appendTo(L.show()).css({width:o(),overflow:_.get("scrolling")?"auto":"hidden"}).css({height:a()}).prependTo(b),L.hide(),t(U).css({"float":"none"}),c(_.get("className")),d=function(){function i(){t.support.opacity===!1&&y[0].style.removeAttribute("filter")}var n,o,a=W.length;$&&(o=function(){clearTimeout(Q),M.hide(),u(ne),_.get("onComplete")},S.html(_.get("title")).show(),I.show(),a>1?("string"==typeof _.get("current")&&F.html(_.get("current").replace("{current}",A+1).replace("{total}",a)).show(),K[_.get("loop")||a-1>A?"show":"hide"]().html(_.get("next")),P[_.get("loop")||A?"show":"hide"]().html(_.get("previous")),ce(),_.get("preloading")&&t.each([h(-1),h(1)],function(){var i,n=W[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)})):O.hide(),_.get("iframe")?(n=_.get("createIframe"),_.get("scrolling")||(n.scrolling="no"),t(n).attr({src:_.get("href"),"class":Z+"Iframe"}).one("load",o).appendTo(I),ae.one(he,function(){n.src="//about:blank"}),_.get("fastIframe")&&t(n).trigger("load")):o(),"fade"===_.get("transition")?y.fadeTo(g,1,i):i())},"fade"===_.get("transition")?y.fadeTo(g,0,function(){J.position(0,d)}):J.position(g,d)}},J.next=function(){!q&&W[1]&&(_.get("loop")||W[A+1])&&(A=h(1),f(W[A]))},J.prev=function(){!q&&W[1]&&(_.get("loop")||A)&&(A=h(-1),f(W[A]))},J.close=function(){$&&!G&&(G=!0,$=!1,u(oe),_.get("onCleanup"),E.unbind("."+Z),v.fadeTo(_.get("fadeOut")||0,0),y.stop().fadeTo(_.get("fadeOut")||0,0,function(){y.hide(),v.hide(),u(he),I.remove(),setTimeout(function(){G=!1,u(re),_.get("onClosed")},1)}))},J.remove=function(){y&&(y.stop(),t[Y].close(),y.stop(!1,!0).remove(),v.remove(),G=!1,y=null,t("."+te).removeData(Y).removeClass(te),t(e).unbind("click."+Z).unbind("keydown."+Z))},J.element=function(){return t(_.el)},J.settings=X)})(jQuery,document,window);; 32/** 33 * @file 34 * Colorbox module init js. 35 */ 36 37(function ($) { 38 39Drupal.behaviors.initColorbox = { 40 attach: function (context, settings) { 41 if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { 42 return; 43 } 44 45 if (settings.colorbox.mobiledetect && window.matchMedia) { 46 // Disable Colorbox for small screens. 47 var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")"); 48 if (mq.matches) { 49 return; 50 } 51 } 52 53 // Use "data-colorbox-gallery" if set otherwise use "rel". 54 settings.colorbox.rel = function () { 55 if ($(this).data('colorbox-gallery')) { 56 return $(this).data('colorbox-gallery'); 57 } 58 else { 59 return $(this).attr('rel'); 60 } 61 }; 62 63 $('.colorbox', context) 64 .once('init-colorbox') 65 .colorbox(settings.colorbox); 66 67 $(context).bind('cbox_complete', function () { 68 Drupal.attachBehaviors('#cboxLoadedContent'); 69 }); 70 } 71}; 72 73})(jQuery); 74; 75/** 76 * @file 77 * Colorbox module load js. 78 */ 79(function ($) { 80 81Drupal.behaviors.initColorboxLoad = { 82 attach: function (context, settings) { 83 if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { 84 return; 85 } 86 87 if (settings.colorbox.mobiledetect && window.matchMedia) { 88 // Disable Colorbox for small screens. 89 var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")"); 90 if (mq.matches) { 91 return; 92 } 93 } 94
95 $.urlParams = function (url) { 96 var p = {}, 97 e, 98 a = /\+/g, // Regex for replacing addition symbol with a space. 99 r = /([^&=]+)=?([^&]*)/g, 100 d = function (s) { return decodeURIComponent(s.replace(a, ' ')); }, 101 q = url.split('?'); 102 while (e = r.exec(q[1])) { 103 e[1] = d(e[1]); 104 e[2] = d(e[2]); 105 switch (e[2].toLowerCase()) { 106 case 'true': 107 case 'yes': 108 e[2] = true; 109 break; 110 case 'false': 111 case 'no': 112 e[2] = false; 113 break; 114 } 115 if (e[1] == 'width') { e[1] = 'innerWidth'; } 116 if (e[1] == 'height') { e[1] = 'innerHeight'; } 117 p[e[1]] = e[2]; 118 } 119 return p; 120 }; 121 $('.colorbox-load', context) 122 .once('init-colorbox-load', function () { 123 var params = $.urlParams($(this).attr('href')); 124 $(this).colorbox($.extend({}, settings.colorbox, params)); 125 }); 126 } 127}; 128 129})(jQuery); 130; 131/** 132 * @file 133 * Colorbox module inline js. 134 */ 135 136(function ($) { 137 138Drupal.behaviors.initColorboxInline = { 139 attach: function (context, settings) { 140 if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { 141 return; 142 } 143 144 if (settings.colorbox.mobiledetect && window.matchMedia) { 145 // Disable Colorbox for small screens. 146 var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")"); 147 if (mq.matches) { 148 return; 149 } 150 } 151 152 $.urlParam = function(name, url){ 153 if (name == 'fragment') { 154 var results = new RegExp('(#[^&#]*)').exec(url); 155 } 156 else { 157 var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url); 158 } 159 if (!results) { return ''; } 160 return results[1] || ''; 161 }; 162 $('.colorbox-inline', context).once('init-colorbox-inline').colorbox({ 163 transition:settings.colorbox.transition, 164 speed:settings.colorbox.speed, 165 opacity:settings.colorbox.opacity, 166 slideshow:settings.colorbox.slideshow, 167 slideshowAuto:settings.colorbox.slideshowAuto, 168 slideshowSpeed:settings.colorbox.slideshowSpeed, 169 slideshowStart:settings.colorbox.slideshowStart, 170 slideshowStop:settings.colorbox.slideshowStop, 171 current:settings.colorbox.current, 172 previous:settings.colorbox.previous, 173 next:settings.colorbox.next, 174 close:settings.colorbox.close, 175 overlayClose:settings.colorbox.overlayClose, 176 maxWidth:settings.colorbox.maxWidth, 177 maxHeight:settings.colorbox.maxHeight, 178 innerWidth:function(){ 179 return $.urlParam('width', $(this).attr('href')); 180 }, 181 innerHeight:function(){ 182 return $.urlParam('height', $(this).attr('href')); 183 }, 184 title:function(){ 185 return decodeURIComponent($.urlParam('title', $(this).attr('href'))); 186 }, 187 iframe:function(){ 188 return $.urlParam('iframe', $(this).attr('href')); 189 }, 190 inline:function(){ 191 return $.urlParam('inline', $(this).attr('href')); 192 }, 193 href:function(){ 194 return $.urlParam('fragment', $(this).attr('href')); 195 } 196 }); 197 } 198}; 199 200})(jQuery); 201; 202/* 203 * FancyBox - jQuery Plugin 204 * Simple and fancy lightbox alternative 205 * 206 * Examples and documentation at: http://fancybox.net 207 * 208 * Copyright (c) 2008 - 2010 Janis Skarnelis 209 * 210 * Version: 1.3.1 (05/03/2010) 211 * Requires: jQuery v1.3+ 212 * 213 * Dual licensed under the MIT and GPL licenses: 214 * http://www.opensource.org/licenses/mit-license.php 215 * http://www.gnu.org/licenses/gpl.html 216 */ 217 218(function($) { 219 220 var tmp, loading, overlay, wrap, outer, inner, close, nav_left, nav_right, 221 222 selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [], 223 224 ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i, 225 226 loadingTimer, loadingFrame = 1, 227 228 start_pos, final_pos, busy = false, shadow = 20, fx = $.extend($('<div/>')[0], { prop: 0 }), titleh = 0, 229 230 isIE6 = !$.support.opacity && !window.XMLHttpRequest, 231 232 /* 233 * Private methods 234 */ 235 236 fancybox_abort = function() { 237 loading.hide(); 238 239 imgPreloader.onerror = imgPreloader.onload = null; 240
241 if (ajaxLoader) { 242 ajaxLoader.abort(); 243 } 244 245 tmp.empty(); 246 }, 247 248 fancybox_error = function() { 249 $.fancybox('<p id="fancybox_error">The requested content cannot be loaded.<br />Please try again later.</p>', { 250 'scrolling' : 'no', 251 'padding' : 20, 252 'transitionIn' : 'none', 253 'transitionOut' : 'none' 254 }); 255 }, 256 257 fancybox_get_viewport = function() { 258 return [ $(window).width(), $(window).height(), $(document).scrollLeft(), $(document).scrollTop() ]; 259 }, 260 261 fancybox_get_zoom_to = function () { 262 var view = fancybox_get_viewport(), 263 to = {}, 264 265 margin = currentOpts.margin, 266 resize = currentOpts.autoScale, 267 268 horizontal_space = (shadow + margin) * 2, 269 vertical_space = (shadow + margin) * 2, 270 double_padding = (currentOpts.padding * 2), 271 272 ratio; 273 274 if (currentOpts.width.toString().indexOf('%') > -1) { 275 to.width = ((view[0] * parseFloat(currentOpts.width)) / 100) - (shadow * 2) ; 276 resize = false; 277 278 } else { 279 to.width = currentOpts.width + double_padding; 280 } 281 282 if (currentOpts.height.toString().indexOf('%') > -1) { 283 to.height = ((view[1] * parseFloat(currentOpts.height)) / 100) - (shadow * 2); 284 resize = false; 285 286 } else { 287 to.height = currentOpts.height + double_padding; 288 } 289 290 if (resize && (to.width > (view[0] - horizontal_space) || to.height > (view[1] - vertical_space))) { 291 if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') { 292 horizontal_space += double_padding; 293 vertical_space += double_padding; 294 295 ratio = Math.min(Math.min( view[0] - horizontal_space, currentOpts.width) / currentOpts.width, Math.min( view[1] - vertical_space, currentOpts.height) / currentOpts.height); 296 297 to.width = Math.round(ratio * (to.width - double_padding)) + double_padding; 298 to.height = Math.round(ratio * (to.height - double_padding)) + double_padding; 299 300 } else { 301 to.width = Math.min(to.width, (view[0] - horizontal_space)); 302 to.height = Math.min(to.height, (view[1] - vertical_space)); 303 } 304 } 305 306 to.top = view[3] + ((view[1] - (to.height + (shadow * 2 ))) * 0.5); 307 to.left = view[2] + ((view[0] - (to.width + (shadow * 2 ))) * 0.5); 308 309 if (currentOpts.autoScale === false) { 310 to.top = Math.max(view[3] + margin, to.top); 311 to.left = Math.max(view[2] + margin, to.left); 312 } 313 314 return to; 315 }, 316 317 fancybox_format_title = function(title) { 318 if (title && title.length) { 319 switch (currentOpts.titlePosition) { 320 case 'inside': 321 return title; 322 case 'over': 323 return '<span id="fancybox-title-over">' + title + '</span>'; 324 default: 325 return '<span id="fancybox-title-wrap"><span id="fancybox-title-left"></span><span id="fancybox-title-main">' + title + '</span><span id="fancybox-title-right"></span></span>'; 326 } 327 } 328 329 return false; 330 }, 331 332 fancybox_process_title = function() { 333 var title = currentOpts.title, 334 width = final_pos.width - (currentOpts.padding * 2), 335 titlec = 'fancybox-title-' + currentOpts.titlePosition; 336 337 $('#fancybox-title').remove(); 338 339 titleh = 0; 340 341 if (currentOpts.titleShow === false) { 342 return; 343 } 344 345 title = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(title, currentArray, currentIndex, currentOpts) : fancybox_format_title(title); 346 347 if (!title || title === '') { 348 return; 349 } 350 351 $('<div id="fancybox-title" class="' + titlec + '" />').css({ 352 'width' : width, 353 'paddingLeft' : currentOpts.padding, 354 'paddingRight' : currentOpts.padding 355 }).html(title).appendTo('body'); 356 357 switch (currentOpts.titlePosition) { 358 case 'inside': 359 titleh = $("#fancybox-title").outerHeight(true) - currentOpts.padding; 360 final_pos.height += titleh; 361 break; 362 363 case 'over': 364 $('#fancybox-title').css('bottom', currentOpts.padding); 365 break; 366 367 default: 368 $('#fancybox-title').css('bottom', $("#fancybox-title").outerHeight(true) * -1); 369 break; 370 } 371 372 $('#fancybox-title').appendTo( outer ).hide(); 373 }, 374 375 fancybox_set_navigation = function() { 376 $(document).unbind('keydown.fb').bind('keydown.fb', function(e) { 377 if (e.keyCode == 27 && currentOpts.enableEscapeButton) { 378 e.preventDefault(); 379 $.fancybox.close(); 380 381 } else if (e.keyCode == 37) { 382 e.preventDefault(); 383 $.fancybox.prev(); 384 385 } else if (e.keyCode == 39) { 386 e.preventDefault(); 387 $.fancybox.next(); 388 } 389 }); 390 391 if ($.fn.mousewheel) { 392 wrap.unbind('mousewheel.fb'); 393 394 if (currentArray.length > 1) { 395 wrap.bind('mousewheel.fb', function(e, delta) { 396 e.preventDefault(); 397 398 if (busy || delta === 0) { 399 return; 400 } 401 402 if (delta > 0) { 403 $.fancybox.prev(); 404 } else { 405 $.fancybox.next(); 406 } 407 }); 408 } 409 } 410 411 if (!currentOpts.showNavArrows) { return; } 412 413 if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) { 414 nav_left.show(); 415 } 416 417 if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) { 418 nav_right.show(); 419 } 420 }, 421 422 fancybox_preload_images = function() { 423 var href, 424 objNext; 425 426 if ((currentArray.length -1) > currentIndex) { 427 href = currentArray[ currentIndex + 1 ].href; 428 429 if (typeof href !== 'undefined' && href.match(imgRegExp)) { 430 objNext = new Image(); 431 objNext.src = href; 432 } 433 } 434 435 if (currentIndex > 0) { 436 href = currentArray[ currentIndex - 1 ].href; 437 438 if (typeof href !== 'undefined' && href.match(imgRegExp)) { 439 objNext = new Image(); 440 objNext.src = href; 441 } 442 } 443 }, 444 445 _finish = function () { 446 inner.css('overflow', (currentOpts.scrolling == 'auto' ? (currentOpts.type == 'image' || currentOpts.type == 'iframe' || currentOpts.type == 'swf' ? 'hidden' : 'auto') : (currentOpts.scrolling == 'yes' ? 'auto' : 'visible'))); 447 448 if (!$.support.opacity) { 449 inner.get(0).style.removeAttribute('filter'); 450 wrap.get(0).style.removeAttribute('filter'); 451 } 452 453 $('#fancybox-title').show(); 454 455 if (currentOpts.hideOnContentClick) { 456 inner.one('click', $.fancybox.close); 457 } 458 if (currentOpts.hideOnOverlayClick) { 459 overlay.one('click', $.fancybox.close); 460 } 461 462 if (currentOpts.showCloseButton) { 463 close.show(); 464 } 465 466 fancybox_set_navigation(); 467 468 $(window).bind("resize.fb", $.fancybox.center); 469 470 if (currentOpts.centerOnScroll) { 471 $(window).bind("scroll.fb", $.fancybox.center); 472 } else { 473 $(window).unbind("scroll.fb"); 474 } 475 476 if ($.isFunction(currentOpts.onComplete)) { 477 currentOpts.onComplete(currentArray, currentIndex, currentOpts); 478 } 479 480 busy = false;
481 482 fancybox_preload_images(); 483 }, 484 485 fancybox_draw = function(pos) { 486 var width = Math.round(start_pos.width + (final_pos.width - start_pos.width) * pos), 487 height = Math.round(start_pos.height + (final_pos.height - start_pos.height) * pos), 488 489 top = Math.round(start_pos.top + (final_pos.top - start_pos.top) * pos), 490 left = Math.round(start_pos.left + (final_pos.left - start_pos.left) * pos); 491 492 wrap.css({ 493 'width' : width + 'px', 494 'height' : height + 'px', 495 'top' : top + 'px', 496 'left' : left + 'px' 497 }); 498 499 width = Math.max(width - currentOpts.padding * 2, 0); 500 height = Math.max(height - (currentOpts.padding * 2 + (titleh * pos)), 0); 501 502 inner.css({ 503 'width' : width + 'px', 504 'height' : height + 'px' 505 }); 506 507 if (typeof final_pos.opacity !== 'undefined') { 508 wrap.css('opacity', (pos < 0.5 ? 0.5 : pos)); 509 } 510 }, 511 512 fancybox_get_obj_pos = function(obj) { 513 var pos = obj.offset(); 514 515 pos.top += parseFloat( obj.css('paddingTop') ) || 0; 516 pos.left += parseFloat( obj.css('paddingLeft') ) || 0; 517 518 pos.top += parseFloat( obj.css('border-top-width') ) || 0; 519 pos.left += parseFloat( obj.css('border-left-width') ) || 0; 520 521 pos.width = obj.width(); 522 pos.height = obj.height(); 523 524 return pos; 525 }, 526 527 fancybox_get_zoom_from = function() { 528 var orig = selectedOpts.orig ? $(selectedOpts.orig) : false, 529 from = {}, 530 pos, 531 view; 532 533 if (orig && orig.length) { 534 pos = fancybox_get_obj_pos(orig); 535 536 from = { 537 width : (pos.width + (currentOpts.padding * 2)), 538 height : (pos.height + (currentOpts.padding * 2)), 539 top : (pos.top - currentOpts.padding - shadow), 540 left : (pos.left - currentOpts.padding - shadow) 541 }; 542 543 } else { 544 view = fancybox_get_viewport(); 545 546 from = { 547 width : 1, 548 height : 1, 549 top : view[3] + view[1] * 0.5, 550 left : view[2] + view[0] * 0.5 551 }; 552 } 553 554 return from; 555 }, 556 557 fancybox_show = function() { 558 loading.hide(); 559 560 if (wrap.is(":visible") && $.isFunction(currentOpts.onCleanup)) { 561 if (currentOpts.onCleanup(currentArray, currentIndex, currentOpts) === false) { 562 $.event.trigger('fancybox-cancel'); 563 564 busy = false; 565 return; 566 } 567 } 568 569 currentArray = selectedArray; 570 currentIndex = selectedIndex; 571 currentOpts = selectedOpts; 572 573 inner.get(0).scrollTop = 0; 574 inner.get(0).scrollLeft = 0; 575 576 if (currentOpts.overlayShow) { 577 if (isIE6) { 578 $('select:not(#fancybox-tmp select)').filter(function() { 579 return this.style.visibility !== 'hidden'; 580 }).css({'visibility':'hidden'}).one('fancybox-cleanup', function() { 581 this.style.visibility = 'inherit'; 582 }); 583 } 584 585 overlay.css({ 586 'background-color' : currentOpts.overlayColor, 587 'opacity' : currentOpts.overlayOpacity 588 }).unbind().show(); 589 } 590 591 final_pos = fancybox_get_zoom_to(); 592 593 fancybox_process_title(); 594 595 if (wrap.is(":visible")) { 596 $( close.add( nav_left ).add( nav_right ) ).hide(); 597 598 var pos = wrap.position(), 599 equal; 600 601 start_pos = { 602 top : pos.top , 603 left : pos.left, 604 width : wrap.width(), 605 height : wrap.height() 606 }; 607 608 equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height); 609 610 inner.fadeOut(currentOpts.changeFade, function() { 611 var finish_resizing = function() { 612 inner.html( tmp.contents() ).fadeIn(currentOpts.changeFade, _finish); 613 }; 614 615 $.event.trigger('fancybox-change'); 616 617 inner.empty().css('overflow', 'hidden'); 618 619 if (equal) { 620 inner.css({ 621 top : currentOpts.padding, 622 left : currentOpts.padding, 623 width : Math.max(final_pos.width - (currentOpts.padding * 2), 1), 624 height : Math.max(final_pos.height - (currentOpts.padding * 2) - titleh, 1) 625 }); 626 627 finish_resizing(); 628 629 } else { 630 inner.css({ 631 top : currentOpts.padding, 632 left : currentOpts.padding, 633 width : Math.max(start_pos.width - (currentOpts.padding * 2), 1), 634 height : Math.max(start_pos.height - (currentOpts.padding * 2), 1) 635 }); 636 637 fx.prop = 0; 638 639 $(fx).animate({ prop: 1 }, { 640 duration : currentOpts.changeSpeed, 641 easing : currentOpts.easingChange, 642 step : fancybox_draw, 643 complete : finish_resizing 644 }); 645 } 646 }); 647 648 return; 649 } 650 651 wrap.css('opacity', 1); 652 653 if (currentOpts.transitionIn == 'elastic') { 654 start_pos = fancybox_get_zoom_from(); 655 656 inner.css({ 657 top : currentOpts.padding, 658 left : currentOpts.padding, 659 width : Math.max(start_pos.width - (currentOpts.padding * 2), 1), 660 height : Math.max(start_pos.height - (currentOpts.padding * 2), 1) 661 }) 662 .html( tmp.contents() ); 663 664 wrap.css(start_pos).show(); 665 666 if (currentOpts.opacity) { 667 final_pos.opacity = 0; 668 } 669 670 fx.prop = 0; 671 672 $(fx).animate({ prop: 1 }, { 673 duration : currentOpts.speedIn,
674 easing : currentOpts.easingIn, 675 step : fancybox_draw, 676 complete : _finish 677 }); 678 679 } else { 680 inner.css({ 681 top : currentOpts.padding, 682 left : currentOpts.padding, 683 width : Math.max(final_pos.width - (currentOpts.padding * 2), 1), 684 height : Math.max(final_pos.height - (currentOpts.padding * 2) - titleh, 1) 685 }) 686 .html( tmp.contents() ); 687 688 wrap.css( final_pos ).fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish ); 689 } 690 }, 691 692 fancybox_process_inline = function() { 693 tmp.width( selectedOpts.width ); 694 tmp.height( selectedOpts.height ); 695 696 if (selectedOpts.width == 'auto') { 697 selectedOpts.width = tmp.width(); 698 } 699 if (selectedOpts.height == 'auto') { 700 selectedOpts.height = tmp.height(); 701 } 702 703 fancybox_show(); 704 }, 705 706 fancybox_process_image = function() { 707 busy = true; 708 709 selectedOpts.width = imgPreloader.width; 710 selectedOpts.height = imgPreloader.height; 711 712 $("<img />").attr({ 713 'id' : 'fancybox-img', 714 'src' : imgPreloader.src, 715 'alt' : selectedOpts.title 716 }).appendTo( tmp ); 717 718 fancybox_show(); 719 }, 720 721 fancybox_start = function() { 722 fancybox_abort(); 723 724 var obj = selectedArray[ selectedIndex ], 725 href, 726 type, 727 title, 728 str, 729 emb, 730 selector, 731 data; 732 733 selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox'))); 734 title = obj.title || $(obj).title || selectedOpts.title || ''; 735 736 if (obj.nodeName && !selectedOpts.orig) { 737 selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj); 738 } 739 740 if (title === '' && selectedOpts.orig) { 741 title = selectedOpts.orig.attr('alt'); 742 } 743 744 if (obj.nodeName && (/^(?:javascript|#)/i).test(obj.href)) { 745 href = selectedOpts.href || null; 746 } else { 747 href = selectedOpts.href || obj.href || null; 748 } 749 750 if (selectedOpts.type) { 751 type = selectedOpts.type; 752 753 if (!href) { 754 href = selectedOpts.content; 755 } 756 757 } else if (selectedOpts.content) { 758 type = 'html'; 759 760 } else if (href) { 761 if (href.match(imgRegExp)) { 762 type = 'image'; 763 764 } else if (href.match(swfRegExp)) { 765 type = 'swf'; 766 767 } else if ($(obj).hasClass("iframe")) { 768 type = 'iframe'; 769 770 } else if (href.match(/#/)) { 771 obj = href.substr(href.indexOf("#")); 772 773 type = $(obj).length > 0 ? 'inline' : 'ajax'; 774 } else { 775 type = 'ajax'; 776 } 777 } else { 778 type = 'inline'; 779 } 780 781 selectedOpts.type = type; 782 selectedOpts.href = href; 783 selectedOpts.title = title; 784 785 if (selectedOpts.autoDimensions && selectedOpts.type !== 'iframe' && selectedOpts.type !== 'swf') { 786 selectedOpts.width = 'auto'; 787 selectedOpts.height = 'auto'; 788 } 789 790 if (selectedOpts.modal) { 791 selectedOpts.overlayShow = true; 792 selectedOpts.hideOnOverlayClick = false; 793 selectedOpts.hideOnContentClick = false; 794 selectedOpts.enableEscapeButton = false; 795 selectedOpts.showCloseButton = false; 796 } 797 798 if ($.isFunction(selectedOpts.onStart)) { 799 if (selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts) === false) { 800 busy = false; 801 return; 802 } 803 } 804 805 tmp.css('padding', (shadow + selectedOpts.padding + selectedOpts.margin)); 806 807 $('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() { 808 $(this).replaceWith(inner.children()); 809 }); 810 811 switch (type) { 812 case 'html' : 813 tmp.html( selectedOpts.content ); 814 fancybox_process_inline(); 815 break; 816 817 case 'inline' : 818 $('<div class="fancybox-inline-tmp" />').hide().insertBefore( $(obj) ).bind('fancybox-cleanup', function() { 819 $(this).replaceWith(inner.children()); 820 }).bind('fancybox-cancel', function() { 821 $(this).replaceWith(tmp.children()); 822 }); 823 824 $(obj).appendTo(tmp); 825 826 fancybox_process_inline(); 827 break; 828 829 case 'image': 830 busy = false; 831 832 $.fancybox.showActivity(); 833 834 imgPreloader = new Image(); 835 836 imgPreloader.onerror = function() { 837 fancybox_error(); 838 }; 839 840 imgPreloader.onload = function() { 841 imgPreloader.onerror = null; 842 imgPreloader.onload = null; 843 fancybox_process_image(); 844 }; 845 846 imgPreloader.src = href; 847 848 break; 849
850 case 'swf': 851 str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>'; 852 emb = ''; 853 854 $.each(selectedOpts.swf, function(name, val) { 855 str += '<param name="' + name + '" value="' + val + '"></param>'; 856 emb += ' ' + name + '="' + val + '"'; 857 }); 858 859 str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>'; 860 861 tmp.html(str); 862 863 fancybox_process_inline(); 864 break; 865 866 case 'ajax': 867 selector = href.split('#', 2); 868 data = selectedOpts.ajax.data || {}; 869 870 if (selector.length > 1) { 871 href = selector[0]; 872 873 if (typeof data == "string") { 874 data += '&selector=' + selector[1]; 875 } else { 876 data.selector = selector[1]; 877 } 878 } 879 880 busy = false; 881 $.fancybox.showActivity(); 882 883 ajaxLoader = $.ajax($.extend(selectedOpts.ajax, { 884 url : href, 885 data : data, 886 error : fancybox_error, 887 success : function(data, textStatus, XMLHttpRequest) { 888 if (ajaxLoader.status == 200) { 889 tmp.html( data ); 890 fancybox_process_inline(); 891 } 892 } 893 })); 894 895 break; 896 897 case 'iframe' : 898 $('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" scrolling="' + selectedOpts.scrolling + '" src="' + selectedOpts.href + '"></iframe>').appendTo(tmp); 899 fancybox_show(); 900 break; 901 } 902 }, 903 904 fancybox_animate_loading = function() { 905 if (!loading.is(':visible')){ 906 clearInterval(loadingTimer); 907 return; 908 } 909 910 $('div', loading).css('top', (loadingFrame * -40) + 'px'); 911 912 loadingFrame = (loadingFrame + 1) % 12; 913 }, 914 915 fancybox_init = function() { 916 if ($("#fancybox-wrap").length) { 917 return; 918 } 919 920 $('body').append( 921 tmp = $('<div id="fancybox-tmp"></div>'), 922 loading = $('<div id="fancybox-loading"><div></div></div>'), 923 overlay = $('<div id="fancybox-overlay"></div>'), 924 wrap = $('<div id="fancybox-wrap"></div>') 925 ); 926 927 if (!$.support.opacity) { 928 wrap.addClass('fancybox-ie'); 929 loading.addClass('fancybox-ie'); 930 } 931 932 outer = $('<div id="fancybox-outer"></div>') 933 .append('<div class="fancy-bg" id="fancy-bg-n"></div><div class="fancy-bg" id="fancy-bg-ne"></div><div class="fancy-bg" id="fancy-bg-e"></div><div class="fancy-bg" id="fancy-bg-se"></div><div class="fancy-bg" id="fancy-bg-s"></div><div class="fancy-bg" id="fancy-bg-sw"></div><div class="fancy-bg" id="fancy-bg-w"></div><div class="fancy-bg" id="fancy-bg-nw"></div>') 934 .appendTo( wrap ); 935 936 outer.append( 937 inner = $('<div id="fancybox-inner"></div>'), 938 close = $('<a id="fancybox-close"></a>'), 939 940 nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'), 941 nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>') 942 ); 943 944 close.click($.fancybox.close); 945 loading.click($.fancybox.cancel); 946 947 nav_left.click(function(e) { 948 e.preventDefault(); 949 $.fancybox.prev(); 950 }); 951 952 nav_right.click(function(e) { 953 e.preventDefault(); 954 $.fancybox.next(); 955 }); 956 957 if (isIE6) { 958 overlay.get(0).style.setExpression('height', "document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'"); 959 loading.get(0).style.setExpression('top', "(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'"); 960 961 outer.prepend('<iframe id="fancybox-hide-sel-frame" src="javascript:\'\';" scrolling="no" frameborder="0" ></iframe>'); 962 } 963 }; 964 965 /* 966 * Public methods 967 */ 968 969 $.fn.fancybox = function(options) { 970 $(this) 971 .data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {}))) 972 .unbind('click.fb').bind('click.fb', function(e) { 973 e.preventDefault(); 974 975 if (busy) { 976 return; 977 } 978 979 busy = true; 980 981 $(this).blur(); 982 983 selectedArray = []; 984 selectedIndex = 0; 985 986 var rel = $(this).attr('rel') || ''; 987 988 if (!rel || rel == '' || rel === 'nofollow') { 989 selectedArray.push(this); 990 991 } else { 992 selectedArray = $("a[rel=" + rel + "], area[rel=" + rel + "]"); 993 selectedIndex = selectedArray.index( this ); 994 } 995 996 fancybox_start(); 997 998 return false;
999 }); 1000 1001 return this; 1002 }; 1003 1004 $.fancybox = function(obj) { 1005 if (busy) { 1006 return; 1007 } 1008 1009 busy = true; 1010 1011 var opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {}; 1012 1013 selectedArray = []; 1014 selectedIndex = opts.index || 0; 1015 1016 if ($.isArray(obj)) { 1017 for (var i = 0, j = obj.length; i < j; i++) { 1018 if (typeof obj[i] == 'object') { 1019 $(obj[i]).data('fancybox', $.extend({}, opts, obj[i])); 1020 } else { 1021 obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts)); 1022 } 1023 } 1024 1025 selectedArray = jQuery.merge(selectedArray, obj); 1026 1027 } else { 1028 if (typeof obj == 'object') { 1029 $(obj).data('fancybox', $.extend({}, opts, obj)); 1030 } else { 1031 obj = $({}).data('fancybox', $.extend({content : obj}, opts)); 1032 } 1033 1034 selectedArray.push(obj); 1035 } 1036 1037 if (selectedIndex > selectedArray.length || selectedIndex < 0) { 1038 selectedIndex = 0; 1039 } 1040 1041 fancybox_start(); 1042 }; 1043 1044 $.fancybox.showActivity = function() { 1045 clearInterval(loadingTimer); 1046 1047 loading.show(); 1048 loadingTimer = setInterval(fancybox_animate_loading, 66); 1049 }; 1050 1051 $.fancybox.hideActivity = function() { 1052 loading.hide(); 1053 }; 1054 1055 $.fancybox.next = function() { 1056 return $.fancybox.pos( currentIndex + 1); 1057 }; 1058 1059 $.fancybox.prev = function() { 1060 return $.fancybox.pos( currentIndex - 1); 1061 }; 1062 1063 $.fancybox.pos = function(pos) { 1064 if (busy) { 1065 return; 1066 } 1067 1068 pos = parseInt(pos, 10); 1069 1070 if (pos > -1 && currentArray.length > pos) { 1071 selectedIndex = pos; 1072 fancybox_start(); 1073 } 1074 1075 if (currentOpts.cyclic && currentArray.length > 1 && pos < 0) { 1076 selectedIndex = currentArray.length - 1; 1077 fancybox_start(); 1078 } 1079 1080 if (currentOpts.cyclic && currentArray.length > 1 && pos >= currentArray.length) { 1081 selectedIndex = 0; 1082 fancybox_start(); 1083 } 1084 1085 return; 1086 }; 1087 1088 $.fancybox.cancel = function() { 1089 if (busy) { 1090 return; 1091 } 1092 1093 busy = true; 1094 1095 $.event.trigger('fancybox-cancel'); 1096 1097 fancybox_abort(); 1098 1099 if (selectedOpts && $.isFunction(selectedOpts.onCancel)) { 1100 selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts); 1101 } 1102 1103 busy = false; 1104 }; 1105 1106 // Note: within an iframe use - parent.$.fancybox.close(); 1107 $.fancybox.close = function() { 1108 if (busy || wrap.is(':hidden')) { 1109 return; 1110 } 1111 1112 busy = true; 1113 1114 if (currentOpts && $.isFunction(currentOpts.onCleanup)) { 1115 if (currentOpts.onCleanup(currentArray, currentIndex, currentOpts) === false) { 1116 busy = false; 1117 return; 1118 } 1119 } 1120 1121 fancybox_abort(); 1122 1123 $(close.add( nav_left ).add( nav_right )).hide(); 1124 1125 $('#fancybox-title').remove(); 1126 1127 wrap.add(inner).add(overlay).unbind(); 1128 1129 $(window).unbind("resize.fb scroll.fb"); 1130 $(document).unbind('keydown.fb'); 1131 1132 function _cleanup() { 1133 overlay.fadeOut('fast'); 1134 1135 wrap.hide(); 1136 1137 $.event.trigger('fancybox-cleanup'); 1138 1139 inner.empty(); 1140 1141 if ($.isFunction(currentOpts.onClosed)) { 1142 currentOpts.onClosed(currentArray, currentIndex, currentOpts); 1143 } 1144 1145 currentArray = selectedOpts = []; 1146 currentIndex = selectedIndex = 0; 1147 currentOpts = selectedOpts = {}; 1148 1149 busy = false; 1150 } 1151 1152 inner.css('overflow', 'hidden'); 1153 1154 if (currentOpts.transitionOut == 'elastic') { 1155 start_pos = fancybox_get_zoom_from(); 1156 1157 var pos = wrap.position(); 1158 1159 final_pos = { 1160 top : pos.top , 1161 left : pos.left, 1162 width : wrap.width(), 1163 height : wrap.height() 1164 }; 1165 1166 if (currentOpts.opacity) { 1167 final_pos.opacity = 1; 1168 } 1169 1170 fx.prop = 1; 1171 1172 $(fx).animate({ prop: 0 }, { 1173 duration : currentOpts.speedOut, 1174 easing : currentOpts.easingOut, 1175 step : fancybox_draw, 1176 complete : _cleanup 1177 }); 1178 1179 } else { 1180 wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup); 1181 } 1182 }; 1183 1184 $.fancybox.resize = function() { 1185 var c, h; 1186 1187 if (busy || wrap.is(':hidden')) { 1188 return; 1189 } 1190 1191 busy = true; 1192 1193 c = inner.wrapInner("<div style='overflow:auto'></div>").children(); 1194 h = c.height(); 1195 1196 wrap.css({height: h + (currentOpts.padding * 2) + titleh}); 1197 inner.css({height: h}); 1198 1199 c.replaceWith(c.children()); 1200 1201 $.fancybox.center(); 1202 }; 1203 1204 $.fancybox.center = function() { 1205 busy = true; 1206 1207 var view = fancybox_get_viewport(), 1208 margin = currentOpts.margin, 1209 to = {}; 1210 1211 to.top = view[3] + ((view[1] - ((wrap.height() - titleh) + (shadow * 2 ))) * 0.5); 1212 to.left = view[2] + ((view[0] - (wrap.width() + (shadow * 2 ))) * 0.5); 1213 1214 to.top = Math.max(view[3] + margin, to.top); 1215 to.left = Math.max(view[2] + margin, to.left); 1216 1217 wrap.css(to); 1218 1219 busy = false;
1220 }; 1221 1222 $.fn.fancybox.defaults = { 1223 padding : 10, 1224 margin : 20, 1225 opacity : false, 1226 modal : false, 1227 cyclic : false, 1228 scrolling : 'auto', // 'auto', 'yes' or 'no' 1229 1230 width : 560, 1231 height : 340, 1232 1233 autoScale : true, 1234 autoDimensions : true, 1235 centerOnScroll : false, 1236 1237 ajax : {}, 1238 swf : { wmode: 'transparent' }, 1239 1240 hideOnOverlayClick : true, 1241 hideOnContentClick : false, 1242 1243 overlayShow : true, 1244 overlayOpacity : 0.3, 1245 overlayColor : '#666', 1246 1247 titleShow : true, 1248 titlePosition : 'outside', // 'outside', 'inside' or 'over' 1249 titleFormat : null, 1250 1251 transitionIn : 'fade', // 'elastic', 'fade' or 'none' 1252 transitionOut : 'fade', // 'elastic', 'fade' or 'none' 1253 1254 speedIn : 300, 1255 speedOut : 300, 1256 1257 changeSpeed : 300, 1258 changeFade : 'fast', 1259 1260 easingIn : 'swing', 1261 easingOut : 'swing', 1262 1263 showCloseButton : true, 1264 showNavArrows : true, 1265 enableEscapeButton : true, 1266 1267 onStart : null, 1268 onCancel : null, 1269 onComplete : null, 1270 onCleanup : null, 1271 onClosed : null 1272 }; 1273 1274 $(document).ready(function() { 1275 fancybox_init(); 1276 }); 1277 1278})(jQuery);; 1279 1280(function($) { 1281 1282/** 1283 * Initiate Fancybox using selector and options from the module's settings. 1284 */ 1285Drupal.behaviors.initFancybox = { 1286 attach : function() { 1287 var settings = Drupal.settings.fancybox; 1288 1289 if (settings && settings.selector.length) { 1290 $(settings.selector).fancybox(settings.options); 1291 } 1292 1293 $('.imagefield-fancybox').fancybox(settings.options); 1294 } 1295} 1296 1297})(jQuery);; 1298(function ($) { 1299 1300Drupal.behaviors.jquerymenu = { 1301 attach:function(context) { 1302 1303 1304 $('ul.jquerymenu .open').parents('li').removeClass('closed').addClass('open'); 1305 $('ul.jquerymenu .open').parents('li').children('span.parent').removeClass('closed').addClass('open').slideDown('700'); 1306 $('ul.jquerymenu .active').parents('li').removeClass('closed').addClass('open'); 1307 $('ul.jquerymenu .active').parents('li').children('span.parent').removeClass('closed').addClass('open'); 1308 1309 1310 // create functions for hover effects 1311 jqm_showit = function() { 1312 $(this).children('.jqm_link_edit').fadeIn(); 1313 } 1314 jqm_hideit = function() { 1315 $(this).children('.jqm_link_edit').fadeOut(); 1316 } 1317 $('ul.jquerymenu li').hover(jqm_showit, jqm_hideit); 1318 1319 jqm_mouseenter = function() { 1320 momma = $(this); 1321 if ($(momma).hasClass('closed')){ 1322 if (Drupal.settings.jquerymenu.animate === 1) { 1323 $($(this).siblings('ul').children()).hide().fadeIn('3000'); 1324 $(momma).children('ul').slideDown('700'); 1325 } 1326 $(momma).removeClass('closed').addClass('open'); 1327 $(this).removeClass('closed').addClass('open'); 1328 } 1329 } 1330 1331 jqm_mouseleave = function(){ 1332 momma = $(this); 1333 if ($(momma).hasClass('open')){ 1334 if (Drupal.settings.jquerymenu.animate === 1) { 1335 $(momma).children('ul').slideUp('700'); 1336 $($(this).siblings('ul').children()).fadeOut('3000'); 1337 } 1338 $(momma).removeClass('open').addClass('closed'); 1339 $(this).removeClass('open').addClass('closed'); 1340 } 1341 } 1342 1343 // set selector variable 1344 var selector = "li.parent span.parent"; 1345 if (Drupal.settings.jquerymenu.click_to_expand) { 1346 selector = selector + ', li.parent > a'; 1347 } 1348 1349 // if hover, change menu state 1350 if (Drupal.settings.jquerymenu.hover === 1) { 1351 $('ul.jquerymenu:not(.jquerymenu-processed)', context).addClass('jquerymenu-processed').each(function(){ 1352 $(this).find(selector).hover(jqm_mouseenter, jqm_mouseleave); 1353 }); 1354 // remove the + and - boxes 1355 $('ul.jquerymenu-processed span.parent').remove(); 1356 return false; 1357 } 1358 1359 // if not hover, change menu state on click 1360 else if (Drupal.settings.jquerymenu.hover === 0) { 1361 $('ul.jquerymenu:not(.jquerymenu-processed)', context).addClass('jquerymenu-processed').each(function(){ 1362 $(this).find(selector).click(function(){ 1363 momma = $(this).parent(); 1364 if ($(momma).hasClass('closed')){ 1365 if (Drupal.settings.jquerymenu.animate === 1) { 1366 $($(this).siblings('ul').children()).hide().fadeIn('3000'); 1367 $(momma).children('ul').slideDown('700'); 1368 } 1369 $(momma).removeClass('closed').addClass('open'); 1370 $(this).removeClass('closed').addClass('open'); 1371 return false;
1372 } 1373 else{ 1374 if (Drupal.settings.jquerymenu.animate === 1) { 1375 $(momma).children('ul').slideUp('700'); 1376 $($(this).siblings('ul').children()).fadeOut('3000'); 1377 } 1378 $(momma).removeClass('open').addClass('closed'); 1379 $(this).removeClass('open').addClass('closed'); 1380 return false; 1381 } 1382 }); 1383 }); 1384 } 1385} 1386} 1387})(jQuery);; 1388(function ($) { 1389 1390/** 1391 * A progressbar object. Initialized with the given id. Must be inserted into 1392 * the DOM afterwards through progressBar.element. 1393 * 1394 * method is the function which will perform the HTTP request to get the 1395 * progress bar state. Either "GET" or "POST". 1396 * 1397 * e.g. pb = new progressBar('myProgressBar'); 1398 * some_element.appendChild(pb.element); 1399 */ 1400Drupal.progressBar = function (id, updateCallback, method, errorCallback) { 1401 var pb = this; 1402 this.id = id; 1403 this.method = method || 'GET'; 1404 this.updateCallback = updateCallback; 1405 this.errorCallback = errorCallback; 1406 1407 // The WAI-ARIA setting aria-live="polite" will announce changes after users 1408 // have completed their current activity and not interrupt the screen reader. 1409 this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id); 1410 this.element.html('<div class="bar"><div class="filled"></div></div>' + 1411 '<div class="percentage"></div>' + 1412 '<div class="message"> </div>'); 1413}; 1414 1415/** 1416 * Set the percentage and status message for the progressbar. 1417 */ 1418Drupal.progressBar.prototype.setProgress = function (percentage, message) { 1419 if (percentage >= 0 && percentage <= 100) { 1420 $('div.filled', this.element).css('width', percentage + '%'); 1421 $('div.percentage', this.element).html(percentage + '%'); 1422 } 1423 $('div.message', this.element).html(message); 1424 if (this.updateCallback) { 1425 this.updateCallback(percentage, message, this); 1426 } 1427}; 1428 1429/** 1430 * Start monitoring progress via Ajax. 1431 */ 1432Drupal.progressBar.prototype.startMonitoring = function (uri, delay) { 1433 this.delay = delay; 1434 this.uri = uri; 1435 this.sendPing(); 1436}; 1437 1438/** 1439 * Stop monitoring progress via Ajax. 1440 */ 1441Drupal.progressBar.prototype.stopMonitoring = function () { 1442 clearTimeout(this.timer); 1443 // This allows monitoring to be stopped from within the callback. 1444 this.uri = null; 1445}; 1446 1447/** 1448 * Request progress data from server. 1449 */ 1450Drupal.progressBar.prototype.sendPing = function () { 1451 if (this.timer) { 1452 clearTimeout(this.timer); 1453 } 1454 if (this.uri) { 1455 var pb = this; 1456 // When doing a post request, you need non-null data. Otherwise a 1457 // HTTP 411 or HTTP 406 (with Apache mod_security) error may result. 1458 $.ajax({ 1459 type: this.method, 1460 url: this.uri, 1461 data: '', 1462 dataType: 'json', 1463 success: function (progress) { 1464 // Display errors. 1465 if (progress.status == 0) { 1466 pb.displayError(progress.data); 1467 return; 1468 } 1469 // Update display. 1470 pb.setProgress(progress.percentage, progress.message); 1471 // Schedule next timer. 1472 pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay); 1473 }, 1474 error: function (xmlhttp) { 1475 pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri)); 1476 } 1477 }); 1478 } 1479}; 1480 1481/** 1482 * Display errors on the page. 1483 */ 1484Drupal.progressBar.prototype.displayError = function (string) { 1485 var error = $('<div class="messages error"></div>').html(string); 1486 $(this.element).before(error).hide(); 1487 1488 if (this.errorCallback) { 1489 this.errorCallback(this); 1490 } 1491}; 1492 1493})(jQuery); 1494; 1495/** 1496 * @file 1497 * 1498 * Implement a modal form. 1499 * 1500 * @see modal.inc for documentation. 1501 * 1502 * This javascript relies on the CTools ajax responder. 1503 */ 1504 1505(function ($) { 1506 // Make sure our objects are defined. 1507 Drupal.CTools = Drupal.CTools || {}; 1508 Drupal.CTools.Modal = Drupal.CTools.Modal || {}; 1509 1510 /** 1511 * Display the modal 1512 * 1513 * @todo -- document the settings. 1514 */ 1515 Drupal.CTools.Modal.show = function(choice) { 1516 var opts = {}; 1517 1518 if (choice && typeof choice == 'string' && Drupal.settings[choice]) { 1519 // This notation guarantees we are actually copying it. 1520 $.extend(true, opts, Drupal.settings[choice]); 1521 } 1522 else if (choice) { 1523 $.extend(true, opts, choice); 1524 } 1525 1526 var defaults = { 1527 modalTheme: 'CToolsModalDialog', 1528 throbberTheme: 'CToolsModalThrobber', 1529 animation: 'show', 1530 animationSpeed: 'fast', 1531 modalSize: { 1532 type: 'scale', 1533 width: .8, 1534 height: .8, 1535 addWidth: 0, 1536 addHeight: 0, 1537 // How much to remove from the inner content to make space for the 1538 // theming. 1539 contentRight: 25, 1540 contentBottom: 45 1541 }, 1542 modalOptions: { 1543 opacity: .55, 1544 background: '#fff' 1545 }, 1546 modalClass: 'default' 1547 }; 1548 1549 var settings = {}; 1550 $.extend(true, settings, defaults, Drupal.settings.CToolsModal, opts); 1551 1552 if (Drupal.CTools.Modal.currentSettings && Drupal.CTools.Modal.currentSettings != settings) { 1553 Drupal.CTools.Modal.modal.remove(); 1554 Drupal.CTools.Modal.modal = null; 1555 } 1556 1557 Drupal.CTools.Modal.currentSettings = settings; 1558 1559 var resize = function(e) { 1560 // When creating the modal, it actually exists only in a theoretical 1561 // place that is not in the DOM. But once the modal exists, it is in the 1562 // DOM so the context must be set appropriately. 1563 var context = e ? document : Drupal.CTools.Modal.modal; 1564 1565 if (Drupal.CTools.Modal.currentSettings.modalSize.type == 'scale') { 1566 var width = $(window).width() * Drupal.CTools.Modal.currentSettings.modalSize.width; 1567 var height = $(window).height() * Drupal.CTools.Modal.currentSettings.modalSize.height; 1568 } 1569 else { 1570 var width = Drupal.CTools.Modal.currentSettings.modalSize.width; 1571 var height = Drupal.CTools.Modal.currentSettings.modalSize.height; 1572 } 1573 1574 // Use the additionol pixels for creating the width and height. 1575 $('div.ctools-modal-content', context).css({ 1576 'width': width + Drupal.CTools.Modal.currentSettings.modalSize.addWidth + 'px', 1577 'height': height + Drupal.CTools.Modal.currentSettings.modalSize.addHeight + 'px' 1578 });
1579 $('div.ctools-modal-content .modal-content', context).css({ 1580 'width': (width - Drupal.CTools.Modal.currentSettings.modalSize.contentRight) + 'px', 1581 'height': (height - Drupal.CTools.Modal.currentSettings.modalSize.contentBottom) + 'px' 1582 }); 1583 } 1584 1585 if (!Drupal.CTools.Modal.modal) { 1586 Drupal.CTools.Modal.modal = $(Drupal.theme(settings.modalTheme)); 1587 if (settings.modalSize.type == 'scale') { 1588 $(window).bind('resize', resize); 1589 } 1590 } 1591 1592 resize(); 1593 1594 $('span.modal-title', Drupal.CTools.Modal.modal).html(Drupal.CTools.Modal.currentSettings.loadingText); 1595 Drupal.CTools.Modal.modalContent(Drupal.CTools.Modal.modal, settings.modalOptions, settings.animation, settings.animationSpeed, settings.modalClass); 1596 $('#modalContent .modal-content').html(Drupal.theme(settings.throbberTheme)).addClass('ctools-modal-loading'); 1597 1598 // Position autocomplete results based on the scroll position of the modal. 1599 $('#modalContent .modal-content').delegate('input.form-autocomplete', 'keyup', function() { 1600 $('#autocomplete').css('top', $(this).position().top + $(this).outerHeight() + $(this).offsetParent().filter('#modal-content').scrollTop()); 1601 }); 1602 }; 1603 1604 /** 1605 * Hide the modal 1606 */ 1607 Drupal.CTools.Modal.dismiss = function() { 1608 if (Drupal.CTools.Modal.modal) { 1609 Drupal.CTools.Modal.unmodalContent(Drupal.CTools.Modal.modal); 1610 } 1611 }; 1612 1613 /** 1614 * Provide the HTML to create the modal dialog. 1615 */ 1616 Drupal.theme.prototype.CToolsModalDialog = function () { 1617 var html = '' 1618 html += '<div id="ctools-modal">' 1619 html += ' <div class="ctools-modal-content">' // panels-modal-content 1620 html += ' <div class="modal-header">'; 1621 html += ' <a class="close" href="#">'; 1622 html += Drupal.CTools.Modal.currentSettings.closeText + Drupal.CTools.Modal.currentSettings.closeImage; 1623 html += ' </a>'; 1624 html += ' <span id="modal-title" class="modal-title"> </span>'; 1625 html += ' </div>'; 1626 html += ' <div id="modal-content" class="modal-content">'; 1627 html += ' </div>'; 1628 html += ' </div>'; 1629 html += '</div>'; 1630 1631 return html; 1632 } 1633 1634 /** 1635 * Provide the HTML to create the throbber. 1636 */ 1637 Drupal.theme.prototype.CToolsModalThrobber = function () { 1638 var html = ''; 1639 html += '<div id="modal-throbber">'; 1640 html += ' <div class="modal-throbber-wrapper">'; 1641 html += Drupal.CTools.Modal.currentSettings.throbber; 1642 html += ' </div>'; 1643 html += '</div>'; 1644 1645 return html; 1646 }; 1647 1648 /** 1649 * Figure out what settings string to use to display a modal. 1650 */ 1651 Drupal.CTools.Modal.getSettings = function (object) { 1652 var match = $(object).attr('class').match(/ctools-modal-(\S+)/); 1653 if (match) { 1654 return match[1]; 1655 } 1656 } 1657 1658 /** 1659 * Click function for modals that can be cached. 1660 */ 1661 Drupal.CTools.Modal.clickAjaxCacheLink = function () { 1662 Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this)); 1663 return Drupal.CTools.AJAX.clickAJAXCacheLink.apply(this); 1664 }; 1665 1666 /** 1667 * Handler to prepare the modal for the response 1668 */ 1669 Drupal.CTools.Modal.clickAjaxLink = function () { 1670 Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this)); 1671 return false; 1672 }; 1673 1674 /** 1675 * Submit responder to do an AJAX submit on all modal forms. 1676 */ 1677 Drupal.CTools.Modal.submitAjaxForm = function(e) { 1678 var $form = $(this); 1679 var url = $form.attr('action'); 1680 1681 setTimeout(function() { Drupal.CTools.AJAX.ajaxSubmit($form, url); }, 1); 1682 return false; 1683 } 1684 1685 /** 1686 * Bind links that will open modals to the appropriate function. 1687 */ 1688 Drupal.behaviors.ZZCToolsModal = { 1689 attach: function(context) { 1690 // Bind links 1691 // Note that doing so in this order means that the two classes can be 1692 // used together safely. 1693 /* 1694 * @todo remimplement the warm caching feature 1695 $('a.ctools-use-modal-cache', context).once('ctools-use-modal', function() { 1696 $(this).click(Drupal.CTools.Modal.clickAjaxCacheLink); 1697 Drupal.CTools.AJAX.warmCache.apply(this); 1698 }); 1699 */ 1700 1701 $('area.ctools-use-modal, a.ctools-use-modal', context).once('ctools-use-modal', function() { 1702 var $this = $(this); 1703 $this.click(Drupal.CTools.Modal.clickAjaxLink); 1704 // Create a drupal ajax object 1705 var element_settings = {}; 1706 if ($this.attr('href')) { 1707 element_settings.url = $this.attr('href'); 1708 element_settings.event = 'click'; 1709 element_settings.progress = { type: 'throbber' }; 1710 } 1711 var base = $this.attr('href'); 1712 Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); 1713 }); 1714 1715 // Bind buttons 1716 $('input.ctools-use-modal, button.ctools-use-modal', context).once('ctools-use-modal', function() { 1717 var $this = $(this); 1718 $this.click(Drupal.CTools.Modal.clickAjaxLink); 1719 var button = this; 1720 var element_settings = {}; 1721 1722 // AJAX submits specified in this manner automatically submit to the 1723 // normal form action. 1724 element_settings.url = Drupal.CTools.Modal.findURL(this); 1725 if (element_settings.url == '') { 1726 element_settings.url = $(this).closest('form').attr('action'); 1727 } 1728 element_settings.event = 'click'; 1729 element_settings.setClick = true; 1730 1731 var base = $this.attr('id'); 1732 Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); 1733 1734 // Make sure changes to settings are reflected in the URL. 1735 $('.' + $(button).attr('id') + '-url').change(function() { 1736 Drupal.ajax[base].options.url = Drupal.CTools.Modal.findURL(button); 1737 }); 1738 }); 1739 1740 // Bind our custom event to the form submit
1741 $('#modal-content form', context).once('ctools-use-modal', function() { 1742 var $this = $(this); 1743 var element_settings = {}; 1744 1745 element_settings.url = $this.attr('action'); 1746 element_settings.event = 'submit'; 1747 element_settings.progress = { 'type': 'throbber' } 1748 var base = $this.attr('id'); 1749 1750 Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); 1751 Drupal.ajax[base].form = $this; 1752 1753 $('input[type=submit], button', this).click(function(event) { 1754 Drupal.ajax[base].element = this; 1755 this.form.clk = this; 1756 // Stop autocomplete from submitting. 1757 if (Drupal.autocompleteSubmit && !Drupal.autocompleteSubmit()) { 1758 return false; 1759 } 1760 // An empty event means we were triggered via .click() and 1761 // in jquery 1.4 this won't trigger a submit. 1762 // We also have to check jQuery version to prevent 1763 // IE8 + jQuery 1.4.4 to break on other events 1764 // bound to the submit button. 1765 if (jQuery.fn.jquery.substr(0, 3) === '1.4' && typeof event.bubbles === "undefined") { 1766 $(this.form).trigger('submit'); 1767 return false; 1768 } 1769 }); 1770 }); 1771 1772 // Bind a click handler to allow elements with the 'ctools-close-modal' 1773 // class to close the modal. 1774 $('.ctools-close-modal', context).once('ctools-close-modal') 1775 .click(function() { 1776 Drupal.CTools.Modal.dismiss(); 1777 return false; 1778 }); 1779 } 1780 }; 1781 1782 // The following are implementations of AJAX responder commands. 1783 1784 /** 1785 * AJAX responder command to place HTML within the modal. 1786 */ 1787 Drupal.CTools.Modal.modal_display = function(ajax, response, status) { 1788 if ($('#modalContent').length == 0) { 1789 Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(ajax.element)); 1790 } 1791 $('#modal-title').html(response.title); 1792 // Simulate an actual page load by scrolling to the top after adding the 1793 // content. This is helpful for allowing users to see error messages at the 1794 // top of a form, etc. 1795 $('#modal-content').html(response.output).scrollTop(0); 1796 1797 // Attach behaviors within a modal dialog. 1798 var settings = response.settings || ajax.settings || Drupal.settings; 1799 Drupal.attachBehaviors($('#modalContent'), settings); 1800 1801 if ($('#modal-content').hasClass('ctools-modal-loading')) { 1802 $('#modal-content').removeClass('ctools-modal-loading'); 1803 } 1804 else { 1805 // If the modal was already shown, and we are simply replacing its 1806 // content, then focus on the first focusable element in the modal. 1807 // (When first showing the modal, focus will be placed on the close 1808 // button by the show() function called above.) 1809 $('#modal-content :focusable:first').focus(); 1810 } 1811 } 1812 1813 /** 1814 * AJAX responder command to dismiss the modal. 1815 */ 1816 Drupal.CTools.Modal.modal_dismiss = function(command) { 1817 Drupal.CTools.Modal.dismiss(); 1818 $('link.ctools-temporary-css').remove(); 1819 } 1820 1821 /** 1822 * Display loading 1823 */ 1824 //Drupal.CTools.AJAX.commands.modal_loading = function(command) { 1825 Drupal.CTools.Modal.modal_loading = function(command) { 1826 Drupal.CTools.Modal.modal_display({ 1827 output: Drupal.theme(Drupal.CTools.Modal.currentSettings.throbberTheme), 1828 title: Drupal.CTools.Modal.currentSettings.loadingText 1829 }); 1830 } 1831 1832 /** 1833 * Find a URL for an AJAX button. 1834 * 1835 * The URL for this gadget will be composed of the values of items by 1836 * taking the ID of this item and adding -url and looking for that 1837 * class. They need to be in the form in order since we will 1838 * concat them all together using '/'. 1839 */ 1840 Drupal.CTools.Modal.findURL = function(item) { 1841 var url = ''; 1842 var url_class = '.' + $(item).attr('id') + '-url'; 1843 $(url_class).each( 1844 function() { 1845 var $this = $(this); 1846 if (url && $this.val()) { 1847 url += '/'; 1848 } 1849 url += $this.val(); 1850 }); 1851 return url; 1852 }; 1853 1854 1855 /** 1856 * modalContent 1857 * @param content string to display in the content box 1858 * @param css obj of css attributes 1859 * @param animation (fadeIn, slideDown, show) 1860 * @param speed (valid animation speeds slow, medium, fast or # in ms) 1861 * @param modalClass class added to div#modalContent 1862 */ 1863 Drupal.CTools.Modal.modalContent = function(content, css, animation, speed, modalClass) { 1864 // If our animation isn't set, make it just show/pop 1865 if (!animation) { 1866 animation = 'show'; 1867 } 1868 else { 1869 // If our animation isn't "fadeIn" or "slideDown" then it always is show 1870 if (animation != 'fadeIn' && animation != 'slideDown') { 1871 animation = 'show'; 1872 } 1873 } 1874 1875 if (!speed) { 1876 speed = 'fast'; 1877 } 1878 1879 // Build our base attributes and allow them to be overriden 1880 css = jQuery.extend({ 1881 position: 'absolute', 1882 left: '0px', 1883 margin: '0px', 1884 background: '#000', 1885 opacity: '.55' 1886 }, css); 1887 1888 // Add opacity handling for IE. 1889 css.filter = 'alpha(opacity=' + (100 * css.opacity) + ')'; 1890 content.hide(); 1891 1892 // If we already have modalContent, remove it. 1893 if ($('#modalBackdrop').length) $('#modalBackdrop').remove(); 1894 if ($('#modalContent').length) $('#modalContent').remove(); 1895 1896 // position code lifted from http://www.quirksmode.org/viewport/compatibility.html 1897 if (self.pageYOffset) { // all except Explorer 1898 var wt = self.pageYOffset; 1899 } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict 1900 var wt = document.documentElement.scrollTop; 1901 } else if (document.body) { // all other Explorers 1902 var wt = document.body.scrollTop; 1903 } 1904 1905 // Get our dimensions 1906 1907 // Get the docHeight and (ugly hack) add 50 pixels to make sure we dont have a *visible* border below our div 1908 var docHeight = $(document).height() + 50; 1909 var docWidth = $(document).width(); 1910 var winHeight = $(window).height(); 1911 var winWidth = $(window).width();
1912 if( docHeight < winHeight ) docHeight = winHeight; 1913 1914 // Create our divs 1915 $('body').append('<div id="modalBackdrop" class="backdrop-' + modalClass + '" style="z-index: 1000; display: none;"></div><div id="modalContent" class="modal-' + modalClass + '" style="z-index: 1001; position: absolute;">' + $(content).html() + '</div>'); 1916 1917 // Get a list of the tabbable elements in the modal content. 1918 var getTabbableElements = function () { 1919 var tabbableElements = $('#modalContent :tabbable'), 1920 radioButtons = tabbableElements.filter('input[type="radio"]'); 1921 1922 // The list of tabbable elements from jQuery is *almost* right. The 1923 // exception is with groups of radio buttons. The list from jQuery will 1924 // include all radio buttons, when in fact, only the selected radio button 1925 // is tabbable, and if no radio buttons in a group are selected, then only 1926 // the first is tabbable. 1927 if (radioButtons.length > 0) { 1928 // First, build up an index of which groups have an item selected or not. 1929 var anySelected = {}; 1930 radioButtons.each(function () { 1931 var name = this.name; 1932 1933 if (typeof anySelected[name] === 'undefined') { 1934 anySelected[name] = radioButtons.filter('input[name="' + name + '"]:checked').length !== 0; 1935 } 1936 }); 1937 1938 // Next filter out the radio buttons that aren't really tabbable. 1939 var found = {}; 1940 tabbableElements = tabbableElements.filter(function () { 1941 var keep = true; 1942 1943 if (this.type == 'radio') { 1944 if (anySelected[this.name]) { 1945 // Only keep the selected one. 1946 keep = this.checked; 1947 } 1948 else { 1949 // Only keep the first one. 1950 if (found[this.name]) { 1951 keep = false; 1952 } 1953 found[this.name] = true; 1954 } 1955 } 1956 1957 return keep; 1958 }); 1959 } 1960 1961 return tabbableElements.get(); 1962 }; 1963 1964 // Keyboard and focus event handler ensures only modal elements gain focus. 1965 modalEventHandler = function( event ) { 1966 target = null; 1967 if ( event ) { //Mozilla 1968 target = event.target; 1969 } else { //IE 1970 event = window.event; 1971 target = event.srcElement; 1972 } 1973 1974 var parents = $(target).parents().get(); 1975 for (var i = 0; i < parents.length; ++i) { 1976 var position = $(parents[i]).css('position'); 1977 if (position == 'absolute' || position == 'fixed') { 1978 return true; 1979 } 1980 } 1981 1982 if ($(target).is('#modalContent, body') || $(target).filter('*:visible').parents('#modalContent').length) { 1983 // Allow the event only if target is a visible child node 1984 // of #modalContent. 1985 return true; 1986 } 1987 else { 1988 getTabbableElements()[0].focus(); 1989 } 1990 1991 event.preventDefault(); 1992 }; 1993 $('body').bind( 'focus', modalEventHandler ); 1994 $('body').bind( 'keypress', modalEventHandler ); 1995 1996 // Keypress handler Ensures you can only TAB to elements within the modal. 1997 // Based on the psuedo-code from WAI-ARIA 1.0 Authoring Practices section 1998 // 3.3.1 "Trapping Focus". 1999 modalTabTrapHandler = function (evt) { 2000 // We only care about the TAB key. 2001 if (evt.which != 9) { 2002 return true; 2003 } 2004 2005 var tabbableElements = getTabbableElements(), 2006 firstTabbableElement = tabbableElements[0], 2007 lastTabbableElement = tabbableElements[tabbableElements.length - 1], 2008 singleTabbableElement = firstTabbableElement == lastTabbableElement, 2009 node = evt.target; 2010 2011 // If this is the first element and the user wants to go backwards, then 2012 // jump to the last element. 2013 if (node == firstTabbableElement && evt.shiftKey) { 2014 if (!singleTabbableElement) { 2015 lastTabbableElement.focus(); 2016 } 2017 return false; 2018 } 2019 // If this is the last element and the user wants to go forwards, then 2020 // jump to the first element. 2021 else if (node == lastTabbableElement && !evt.shiftKey) { 2022 if (!singleTabbableElement) { 2023 firstTabbableElement.focus(); 2024 } 2025 return false;
2026 } 2027 // If this element isn't in the dialog at all, then jump to the first 2028 // or last element to get the user into the game. 2029 else if ($.inArray(node, tabbableElements) == -1) { 2030 // Make sure the node isn't in another modal (ie. WYSIWYG modal). 2031 var parents = $(node).parents().get(); 2032 for (var i = 0; i < parents.length; ++i) { 2033 var position = $(parents[i]).css('position'); 2034 if (position == 'absolute' || position == 'fixed') { 2035 return true; 2036 } 2037 } 2038 2039 if (evt.shiftKey) { 2040 lastTabbableElement.focus(); 2041 } 2042 else { 2043 firstTabbableElement.focus(); 2044 } 2045 } 2046 }; 2047 $('body').bind('keydown', modalTabTrapHandler); 2048 2049 // Create our content div, get the dimensions, and hide it 2050 var modalContent = $('#modalContent').css('top','-1000px'); 2051 var $modalHeader = modalContent.find('.modal-header'); 2052 var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2); 2053 var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); 2054 $('#modalBackdrop').css(css).css('top', 0).css('height', docHeight + 'px').css('width', docWidth + 'px').show(); 2055 modalContent.css({top: mdcTop + 'px', left: mdcLeft + 'px'}).hide()[animation](speed); 2056 2057 // Bind a click for closing the modalContent 2058 modalContentClose = function(){close(); return false;}; 2059 $('.close', $modalHeader).bind('click', modalContentClose); 2060 2061 // Bind a keypress on escape for closing the modalContent 2062 modalEventEscapeCloseHandler = function(event) { 2063 if (event.keyCode == 27) { 2064 close(); 2065 return false; 2066 } 2067 }; 2068 2069 $(document).bind('keydown', modalEventEscapeCloseHandler); 2070 2071 // Per WAI-ARIA 1.0 Authoring Practices, initial focus should be on the 2072 // close button, but we should save the original focus to restore it after 2073 // the dialog is closed. 2074 var oldFocus = document.activeElement; 2075 $('.close', $modalHeader).focus(); 2076 2077 // Close the open modal content and backdrop 2078 function close() { 2079 // Unbind the events 2080 $(window).unbind('resize', modalContentResize); 2081 $('body').unbind( 'focus', modalEventHandler); 2082 $('body').unbind( 'keypress', modalEventHandler ); 2083 $('body').unbind( 'keydown', modalTabTrapHandler ); 2084 $('.close', $modalHeader).unbind('click', modalContentClose); 2085 $('body').unbind('keypress', modalEventEscapeCloseHandler); 2086 $(document).trigger('CToolsDetachBehaviors', $('#modalContent')); 2087 2088 // Set our animation parameters and use them 2089 if ( animation == 'fadeIn' ) animation = 'fadeOut'; 2090 if ( animation == 'slideDown' ) animation = 'slideUp'; 2091 if ( animation == 'show' ) animation = 'hide'; 2092 2093 // Close the content 2094 modalContent.hide()[animation](speed); 2095 2096 // Remove the content 2097 $('#modalContent').remove(); 2098 $('#modalBackdrop').remove(); 2099 2100 // Restore focus to where it was before opening the dialog 2101 $(oldFocus).focus(); 2102 }; 2103 2104 // Move and resize the modalBackdrop and modalContent on window resize. 2105 modalContentResize = function(){ 2106 2107 // Reset the backdrop height/width to get accurate document size. 2108 $('#modalBackdrop').css('height', '').css('width', ''); 2109 2110 // Position code lifted from: 2111 // http://www.quirksmode.org/viewport/compatibility.html 2112 if (self.pageYOffset) { // all except Explorer 2113 var wt = self.pageYOffset; 2114 } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict 2115 var wt = document.documentElement.scrollTop; 2116 } else if (document.body) { // all other Explorers 2117 var wt = document.body.scrollTop; 2118 } 2119 2120 // Get our heights 2121 var docHeight = $(document).height(); 2122 var docWidth = $(document).width(); 2123 var winHeight = $(window).height(); 2124 var winWidth = $(window).width(); 2125 if( docHeight < winHeight ) docHeight = winHeight; 2126 2127 // Get where we should move content to 2128 var modalContent = $('#modalContent'); 2129 var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2); 2130 var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); 2131 2132 // Apply the changes 2133 $('#modalBackdrop').css('height', docHeight + 'px').css('width', docWidth + 'px').show(); 2134 modalContent.css('top', mdcTop + 'px').css('left', mdcLeft + 'px').show(); 2135 }; 2136 $(window).bind('resize', modalContentResize); 2137 }; 2138 2139 /** 2140 * unmodalContent 2141 * @param content (The jQuery object to remove) 2142 * @param animation (fadeOut, slideUp, show) 2143 * @param speed (valid animation speeds slow, medium, fast or # in ms) 2144 */ 2145 Drupal.CTools.Modal.unmodalContent = function(content, animation, speed) 2146 { 2147 // If our animation isn't set, make it just show/pop 2148 if (!animation) { var animation = 'show'; } else { 2149 // If our animation isn't "fade" then it always is show 2150 if (( animation != 'fadeOut' ) && ( animation != 'slideUp')) animation = 'show'; 2151 } 2152 // Set a speed if we dont have one 2153 if ( !speed ) var speed = 'fast'; 2154 2155 // Unbind the events we bound 2156 $(window).unbind('resize', modalContentResize); 2157 $('body').unbind('focus', modalEventHandler); 2158 $('body').unbind('keypress', modalEventHandler); 2159 $('body').unbind( 'keydown', modalTabTrapHandler ); 2160 var $modalContent = $('#modalContent');
2161 var $modalHeader = $modalContent.find('.modal-header'); 2162 $('.close', $modalHeader).unbind('click', modalContentClose); 2163 $('body').unbind('keypress', modalEventEscapeCloseHandler); 2164 $(document).trigger('CToolsDetachBehaviors', $modalContent); 2165 2166 // jQuery magic loop through the instances and run the animations or removal. 2167 content.each(function(){ 2168 if ( animation == 'fade' ) { 2169 $('#modalContent').fadeOut(speed, function() { 2170 $('#modalBackdrop').fadeOut(speed, function() { 2171 $(this).remove(); 2172 }); 2173 $(this).remove(); 2174 }); 2175 } else { 2176 if ( animation == 'slide' ) { 2177 $('#modalContent').slideUp(speed,function() { 2178 $('#modalBackdrop').slideUp(speed, function() { 2179 $(this).remove(); 2180 }); 2181 $(this).remove(); 2182 }); 2183 } else { 2184 $('#modalContent').remove(); 2185 $('#modalBackdrop').remove(); 2186 } 2187 } 2188 }); 2189 }; 2190 2191$(function() { 2192 Drupal.ajax.prototype.commands.modal_display = Drupal.CTools.Modal.modal_display; 2193 Drupal.ajax.prototype.commands.modal_dismiss = Drupal.CTools.Modal.modal_dismiss; 2194}); 2195 2196})(jQuery); 2197; 2198/** 2199* Provide the HTML to create the modal dialog. 2200*/ 2201Drupal.theme.prototype.ModalFormsPopup = function () { 2202 var html = ''; 2203 2204 html += '<div id="ctools-modal" class="popups-box">'; 2205 html += ' <div class="ctools-modal-content modal-forms-modal-content">'; 2206 html += ' <div class="popups-container">'; 2207 html += ' <div class="modal-header popups-title">'; 2208 html += ' <span id="modal-title" class="modal-title"></span>'; 2209 html += ' <span class="popups-close close">' + Drupal.CTools.Modal.currentSettings.closeText + '</span>'; 2210 html += ' <div class="clear-block"></div>'; 2211 html += ' </div>'; 2212 html += ' <div class="modal-scroll"><div id="modal-content" class="modal-content popups-body"></div></div>'; 2213 html += ' </div>'; 2214 html += ' </div>'; 2215 html += '</div>'; 2216 2217 return html; 2218} 2219; 2220/*! 2221 * jQuery blockUI plugin 2222 * Version 2.26 (09-SEP-2009) 2223 * @requires jQuery v1.2.3 or later 2224 * 2225 * Examples at: http://malsup.com/jquery/block/ 2226 * Copyright (c) 2007-2008 M. Alsup 2227 * Dual licensed under the MIT and GPL licenses: 2228 * http://www.opensource.org/licenses/mit-license.php 2229 * http://www.gnu.org/licenses/gpl.html 2230 * 2231 * Thanks to Amir-Hossein Sobhi for some excellent contributions! 2232 */ 2233 2234;(function($) { 2235 2236if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) { 2237 alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery); 2238 return; 2239} 2240 2241$.fn._fadeIn = $.fn.fadeIn; 2242 2243// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle 2244// retarded userAgent strings on Vista) 2245var mode = document.documentMode || 0; 2246var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8); 2247var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode; 2248 2249// global $ methods for blocking/unblocking the entire page 2250$.blockUI = function(opts) { install(window, opts); }; 2251$.unblockUI = function(opts) { remove(window, opts); }; 2252 2253// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl) 2254$.growlUI = function(title, message, timeout, onClose) { 2255 var $m = $('<div class="growlUI"></div>'); 2256 if (title) $m.append('<h1>'+title+'</h1>'); 2257 if (message) $m.append('<h2>'+message+'</h2>'); 2258 if (timeout == undefined) timeout = 3000; 2259 $.blockUI({ 2260 message: $m, fadeIn: 700, fadeOut: 1000, centerY: false, 2261 timeout: timeout, showOverlay: false, 2262 onUnblock: onClose, 2263 css: $.blockUI.defaults.growlCSS 2264 }); 2265}; 2266 2267// plugin method for blocking element content 2268$.fn.block = function(opts) { 2269 return this.unblock({ fadeOut: 0 }).each(function() { 2270 if ($.css(this,'position') == 'static') 2271 this.style.position = 'relative'; 2272 if ($.browser.msie) 2273 this.style.zoom = 1; // force 'hasLayout' 2274 install(this, opts); 2275 }); 2276}; 2277 2278// plugin method for unblocking element content 2279$.fn.unblock = function(opts) { 2280 return this.each(function() { 2281 remove(this, opts); 2282 }); 2283}; 2284 2285$.blockUI.version = 2.26; // 2nd generation blocking at no extra cost! 2286 2287// override these in your code to change the default behavior and style 2288$.blockUI.defaults = { 2289 // message displayed when blocking (use null for no message) 2290 message: '<h1>Please wait...</h1>', 2291 2292 title: null, // title string; only used when theme == true 2293 draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) 2294 2295 theme: false, // set to true to use with jQuery UI themes 2296 2297 // styles for the message when blocking; if you wish to disable 2298 // these and use an external stylesheet then do this in your code: 2299 // $.blockUI.defaults.css = {}; 2300 css: { 2301 padding: 0, 2302 margin: 0, 2303 width: '30%', 2304 top: '40%', 2305 left: '35%', 2306 textAlign: 'center', 2307 color: '#000', 2308 border: '3px solid #aaa', 2309 backgroundColor:'#fff', 2310 cursor: 'wait' 2311 }, 2312 2313 // minimal style set used when themes are used 2314 themedCSS: { 2315 width: '30%', 2316 top: '40%', 2317 left: '35%' 2318 }, 2319 2320 // styles for the overlay 2321 overlayCSS: { 2322 backgroundColor: '#000', 2323 opacity: 0.6, 2324 cursor: 'wait' 2325 }, 2326 2327 // styles applied when using $.growlUI 2328 growlCSS: { 2329 width: '350px', 2330 top: '10px', 2331 left: '', 2332 right: '10px', 2333 border: 'none', 2334 padding: '5px', 2335 opacity: 0.6, 2336 cursor: 'default', 2337 color: '#fff', 2338 backgroundColor: '#000', 2339 '-webkit-border-radius': '10px', 2340 '-moz-border-radius': '10px' 2341 }, 2342 2343 // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w 2344 // (hat tip to Jorge H. N. de Vasconcelos) 2345 iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', 2346 2347 // force usage of iframe in non-IE browsers (handy for blocking applets) 2348 forceIframe: false, 2349 2350 // z-index for the blocking overlay 2351 baseZ: 1000, 2352 2353 // set these to true to have the message automatically centered 2354 centerX: true, // <-- only effects element blocking (page block controlled via css above) 2355 centerY: true, 2356 2357 // allow body element to be stetched in ie6; this makes blocking look better 2358 // on "short" pages. disable if you wish to prevent changes to the body height 2359 allowBodyStretch: true, 2360 2361 // enable if you want key and mouse events to be disabled for content that is blocked 2362 bindEvents: true, 2363 2364 // be default blockUI will supress tab navigation from leaving blocking content 2365 // (if bindEvents is true) 2366 constrainTabKey: true, 2367 2368 // fadeIn time in millis; set to 0 to disable fadeIn on block 2369 fadeIn: 200, 2370 2371 // fadeOut time in millis; set to 0 to disable fadeOut on unblock 2372 fadeOut: 400, 2373 2374 // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
2375 timeout: 0, 2376 2377 // disable if you don't want to show the overlay 2378 showOverlay: true, 2379 2380 // if true, focus will be placed in the first available input field when 2381 // page blocking 2382 focusInput: true, 2383 2384 // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) 2385 applyPlatformOpacityRules: true, 2386 2387 // callback method invoked when unblocking has completed; the callback is 2388 // passed the element that has been unblocked (which is the window object for page 2389 // blocks) and the options that were passed to the unblock call: 2390 // onUnblock(element, options) 2391 onUnblock: null, 2392 2393 // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 2394 quirksmodeOffsetHack: 4 2395}; 2396 2397// private data and functions follow... 2398 2399var pageBlock = null; 2400var pageBlockEls = []; 2401 2402function install(el, opts) { 2403 var full = (el == window); 2404 var msg = opts && opts.message !== undefined ? opts.message : undefined; 2405 opts = $.extend({}, $.blockUI.defaults, opts || {}); 2406 opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); 2407 var css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); 2408 var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); 2409 msg = msg === undefined ? opts.message : msg; 2410 2411 // remove the current block (if there is one) 2412 if (full && pageBlock) 2413 remove(window, {fadeOut:0}); 2414 2415 // if an existing element is being used as the blocking content then we capture 2416 // its current place in the DOM (and current display style) so we can restore 2417 // it when we unblock 2418 if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { 2419 var node = msg.jquery ? msg[0] : msg; 2420 var data = {}; 2421 $(el).data('blockUI.history', data); 2422 data.el = node; 2423 data.parent = node.parentNode; 2424 data.display = node.style.display; 2425 data.position = node.style.position; 2426 if (data.parent) 2427 data.parent.removeChild(node); 2428 } 2429 2430 var z = opts.baseZ; 2431 2432 // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform; 2433 // layer1 is the iframe layer which is used to supress bleed through of underlying content 2434 // layer2 is the overlay layer which has opacity and a wait cursor (by default) 2435 // layer3 is the message content that is displayed while blocking 2436 2437 var lyr1 = ($.browser.msie || opts.forceIframe) 2438 ? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>') 2439 : $('<div class="blockUI" style="display:none"></div>'); 2440 var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'); 2441 2442 var lyr3; 2443 if (opts.theme && full) { 2444 var s = '<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+z+';display:none;position:fixed">' + 2445 '<div class="ui-widget-header ui-dialog-titlebar blockTitle">'+(opts.title || ' ')+'</div>' + 2446 '<div class="ui-widget-content ui-dialog-content"></div>' + 2447 '</div>'; 2448 lyr3 = $(s); 2449 } 2450 else { 2451 lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';display:none;position:fixed"></div>') 2452 : $('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>'); 2453 } 2454 2455 // if we have a message, style it 2456 if (msg) { 2457 if (opts.theme) { 2458 lyr3.css(themedCSS); 2459 lyr3.addClass('ui-widget-content'); 2460 } 2461 else 2462 lyr3.css(css); 2463 } 2464 2465 // style the overlay 2466 if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))) 2467 lyr2.css(opts.overlayCSS); 2468 lyr2.css('position', full ? 'fixed' : 'absolute'); 2469 2470 // make iframe layer transparent in IE 2471 if ($.browser.msie || opts.forceIframe) 2472 lyr1.css('opacity',0.0); 2473 2474 $([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); 2475 2476 if (opts.theme && opts.draggable && $.fn.draggable) { 2477 lyr3.draggable({ 2478 handle: '.ui-dialog-titlebar', 2479 cancel: 'li' 2480 }); 2481 } 2482 2483 // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) 2484 var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0); 2485 if (ie6 || expr) { 2486 // give body 100% height 2487 if (full && opts.allowBodyStretch && $.boxModel) 2488 $('html,body').css('height','100%'); 2489 2490 // fix ie6 issue when blocked element has a border width 2491 if ((ie6 || !$.boxModel) && !full) { 2492 var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); 2493 var fixT = t ? '(0 - '+t+')' : 0; 2494 var fixL = l ? '(0 - '+l+')' : 0; 2495 } 2496 2497 // simulate fixed position 2498 $.each([lyr1,lyr2,lyr3], function(i,o) { 2499 var s = o[0].style; 2500 s.position = 'absolute'; 2501 if (i < 2) { 2502 full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quir
2502ksmodeOffsetHack+') + "px"') 2503 : s.setExpression('height','this.parentNode.offsetHeight + "px"'); 2504 full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"') 2505 : s.setExpression('width','this.parentNode.offsetWidth + "px"'); 2506 if (fixL) s.setExpression('left', fixL); 2507 if (fixT) s.setExpression('top', fixT); 2508 } 2509 else if (opts.centerY) { 2510 if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); 2511 s.marginTop = 0; 2512 } 2513 else if (!opts.centerY && full) { 2514 var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0; 2515 var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; 2516 s.setExpression('top',expression); 2517 } 2518 }); 2519 } 2520 2521 // show the message 2522 if (msg) { 2523 if (opts.theme) 2524 lyr3.find('.ui-widget-content').append(msg); 2525 else 2526 lyr3.append(msg); 2527 if (msg.jquery || msg.nodeType) 2528 $(msg).show(); 2529 } 2530 2531 if (($.browser.msie || opts.forceIframe) && opts.showOverlay) 2532 lyr1.show(); // opacity is zero 2533 if (opts.fadeIn) { 2534 if (opts.showOverlay) 2535 lyr2._fadeIn(opts.fadeIn); 2536 if (msg) 2537 lyr3.fadeIn(opts.fadeIn); 2538 } 2539 else { 2540 if (opts.showOverlay) 2541 lyr2.show(); 2542 if (msg) 2543 lyr3.show(); 2544 } 2545 2546 // bind key and mouse events 2547 bind(1, el, opts); 2548 2549 if (full) { 2550 pageBlock = lyr3[0]; 2551 pageBlockEls = $(':input:enabled:visible',pageBlock); 2552 if (opts.focusInput) 2553 setTimeout(focus, 20); 2554 } 2555 else 2556 center(lyr3[0], opts.centerX, opts.centerY); 2557 2558 if (opts.timeout) { 2559 // auto-unblock 2560 var to = setTimeout(function() { 2561 full ? $.unblockUI(opts) : $(el).unblock(opts); 2562 }, opts.timeout); 2563 $(el).data('blockUI.timeout', to); 2564 } 2565}; 2566 2567// remove the block 2568function remove(el, opts) { 2569 var full = (el == window); 2570 var $el = $(el); 2571 var data = $el.data('blockUI.history'); 2572 var to = $el.data('blockUI.timeout'); 2573 if (to) { 2574 clearTimeout(to); 2575 $el.removeData('blockUI.timeout'); 2576 } 2577 opts = $.extend({}, $.blockUI.defaults, opts || {}); 2578 bind(0, el, opts); // unbind events 2579 2580 var els; 2581 if (full) // crazy selector to handle odd field errors in ie6/7 2582 els = $('body').children().filter('.blockUI').add('body > .blockUI'); 2583 else 2584 els = $('.blockUI', el); 2585 2586 if (full) 2587 pageBlock = pageBlockEls = null; 2588 2589 if (opts.fadeOut) { 2590 els.fadeOut(opts.fadeOut); 2591 setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut); 2592 } 2593 else 2594 reset(els, data, opts, el); 2595}; 2596 2597// move blocking element back into the DOM where it started 2598function reset(els,data,opts,el) { 2599 els.each(function(i,o) { 2600 // remove via DOM calls so we don't lose event handlers 2601 if (this.parentNode) 2602 this.parentNode.removeChild(this); 2603 }); 2604 2605 if (data && data.el) { 2606 data.el.style.display = data.display; 2607 data.el.style.position = data.position; 2608 if (data.parent) 2609 data.parent.appendChild(data.el); 2610 $(data.el).removeData('blockUI.history'); 2611 } 2612 2613 if (typeof opts.onUnblock == 'function') 2614 opts.onUnblock(el,opts); 2615}; 2616 2617// bind/unbind the handler 2618function bind(b, el, opts) { 2619 var full = el == window, $el = $(el); 2620 2621 // don't bother unbinding if there is nothing to unbind 2622 if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) 2623 return; 2624 if (!full) 2625 $el.data('blockUI.isBlocked', b); 2626 2627 // don't bind events when overlay is not in use or if bindEvents is false 2628 if (!opts.bindEvents || (b && !opts.showOverlay)) 2629 return; 2630 2631 // bind anchors and inputs for mouse and key events 2632 var events = 'mousedown mouseup keydown keypress'; 2633 b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler); 2634 2635// former impl... 2636// var $e = $('a,:input'); 2637// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); 2638}; 2639 2640// event handler to suppress keyboard/mouse events when blocking 2641function handler(e) { 2642 // allow tab navigation (conditionally) 2643 if (e.keyCode && e.keyCode == 9) { 2644 if (pageBlock && e.data.constrainTabKey) { 2645 var els = pageBlockEls; 2646 var fwd = !e.shiftKey && e.target == els[els.length-1]; 2647 var back = e.shiftKey && e.target == els[0]; 2648 if (fwd || back) { 2649 setTimeout(function(){focus(back)},10); 2650 return false;
2651 } 2652 } 2653 } 2654 // allow events within the message content 2655 if ($(e.target).parents('div.blockMsg').length > 0) 2656 return true; 2657 2658 // allow events for content that is not being blocked 2659 return $(e.target).parents().children().filter('div.blockUI').length == 0; 2660}; 2661 2662function focus(back) { 2663 if (!pageBlockEls) 2664 return; 2665 var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; 2666 if (e) 2667 e.focus(); 2668}; 2669 2670function center(el, x, y) { 2671 var p = el.parentNode, s = el.style; 2672 var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth'); 2673 var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); 2674 if (x) s.left = l > 0 ? (l+'px') : '0'; 2675 if (y) s.top = t > 0 ? (t+'px') : '0'; 2676}; 2677 2678function sz(el, p) { 2679 return parseInt($.css(el,p))||0; 2680}; 2681 2682})(jQuery); 2683; 2684// $Id: uc_ajax_cart.js,v 1.1.2.11 2010/05/01 12:42:30 erikseifert Exp $ 2685Drupal.behaviors.ucAjaxCart = { 2686 attach: function (context, settings) { 2687 2688 if (!Drupal.uc_ajax_cart) { 2689 2690 // First initialization. 2691 2692 // Set up UC Ajax Cart namespace. 2693 Drupal.uc_ajax_cart = {}; 2694 2695 // Populate namespace. 2696 Drupal.uc_ajax_cart.cart_open_state = true; 2697 Drupal.uc_ajax_cart.cart_wrapper = jQuery('#block-uc_ajax_cart-0', context); 2698 Drupal.uc_ajax_cart.cart_pane = jQuery('#ajaxCartUpdate #cart-block-contents-ajax', context); 2699 Drupal.uc_ajax_cart.update_container = jQuery('#ajaxCartUpdate', context); 2700 Drupal.uc_ajax_cart.unblock_handler = { attach: function () { Drupal.uc_ajax_cart.blockUI_blocked -= 1;}} 2701 Drupal.uc_ajax_cart.blockUI_blocked = 0; 2702 2703 2704 // BlockUI settings. 2705 jQuery.blockUI.defaults.growlCSS.opacity = 1; 2706 jQuery.blockUI.defaults.timeout = Drupal.settings.uc_ajax_cart.TIMEOUT; 2707 jQuery.blockUI.defaults.onUnblock = Drupal.uc_ajax_cart.unblock_handler; 2708 2709 // Other one time processes. 2710 /////////////////////////// 2711 2712 // Hide update cart button if needed. 2713 jQuery('.hidden-update-bt').hide(); 2714 2715 2716 // Add open cart class because initially is opened. 2717 Drupal.uc_ajax_cart.cart_wrapper.addClass('cart-open'); 2718 2719 if (Drupal.settings.uc_ajax_cart.COLLAPSIBLE_CART) { 2720 // Check open state tracking. 2721 if (Drupal.settings.uc_ajax_cart.TRACK_CLOSED_STATE) { 2722 ajaxCartCheckCookieCartState(); 2723 } 2724 else if (Drupal.settings.uc_ajax_cart.INITIAL_CLOSED_STATE) { 2725 // Close cart block. 2726 ajaxCartCloseCart(); 2727 } 2728 } 2729 } 2730 2731 2732 // Set up ajax-cart-view-handler. 2733 jQuery('#ajax-cart-view-handler').attr('href', '#') 2734 .text(Drupal.t('Load cart content')) 2735 .click(ajaxCartUpdateBlockCart); 2736 2737 2738 2739 // Ubercart Cart links support. 2740 jQuery('a.ajax-cart-link').not('.ajax-cart-processed').each(function () { 2741 var $elem = jQuery(this); 2742 // Check for ajaxify class. 2743 if (_checkAjaxify($elem)) { 2744 $elem.bind('click', function () { 2745 ajaxCartBlockUI(Drupal.settings.uc_ajax_cart.ADD_TITLE, 2746 '<div class="messages status">' + Drupal.settings.uc_ajax_cart.ADD_MESSAGE + '</div>'); 2747 jQuery.get(Drupal.settings.uc_ajax_cart.CART_LINK_CALLBACK, 2748 { href: this.href }, 2749 ajaxCartFormSubmitted); 2750 return false; 2751 }) 2752 } 2753 }).addClass('ajax-cart-processed'); 2754 2755 // Ubercart submit. 2756 jQuery('form.ajax-cart-submit-form input.ajax-cart-submit-form-button').not('.ajax-cart-processed, #edit-update').each(function () { 2757 var $elem = jQuery(this); 2758 // Check for ajaxify class. 2759 if (_checkAjaxify($elem)) { 2760 $elem.click(function () { 2761 var form = jQuery(this).parents('form').eq(0); 2762 form.ajaxSubmit({ 2763 url : Drupal.settings.uc_ajax_cart.CALLBACK, 2764 beforeSubmit : function () { 2765 ajaxCartBlockUI(Drupal.settings.uc_ajax_cart.ADD_TITLE, 2766 '<div class="messages status">' + Drupal.settings.uc_ajax_cart.ADD_MESSAGE + '</div>')}, 2767 success : ajaxCartFormSubmitted, 2768 type : 'post', 2769 data: { 'op' : $elem.val() } 2770 }); 2771 return false; 2772 }); 2773 } 2774 }).addClass('ajax-cart-processed'); 2775 2776 2777 2778 2779 // Check for autoupdate cart block. 2780 if (jQuery('#ajaxCartUpdate').not('.ajax-cart-processed').hasClass('load-on-view')) { 2781 jQuery('#ajaxCartUpdate').addClass('ajax-cart-processed'); 2782 ajaxCartUpdateBlockCart(); 2783 } 2784 2785 2786 // Call behaviors over cart block. 2787 ajaxCartCartBlockBehaviors(); 2788 2789 // Call behaviors over cart page. 2790 ajaxCartCartPageBehaviors(); 2791} 2792} 2793 2794 2795 2796// Submits product changes using AJAX and updates cart and cart block accordingly. 2797function ajaxCartSubmit() { 2798 var button = jQuery(this); 2799 jQuery(this).parents('form').ajaxSubmit({ 2800 url: Drupal.settings.uc_ajax_cart.UPDATE_CALLBACK, 2801 success: ajaxCartFormSubmitted, 2802 beforeSubmit: function () { 2803 jQuery('#uc-cart-view-form input').attr('disabled', 'disabled'); 2804 ajaxCartBlockUI(Drupal.settings.uc_ajax_cart.ADD_TITLE, '<div class="messages status">' + Drupal.settings.uc_ajax_cart.UPDATE_MESSAGE + '</div>'); 2805 }, 2806 data: { 'op': button.val() } 2807 }); 2808 return false;
2809} 2810 2811// Triggers cart submit button. 2812function triggerCartSubmit() { 2813 jQuery('#uc-cart-view-form #edit-update').trigger('click'); 2814} 2815 2816 2817// Process behaviors for the cart from cart page. 2818function ajaxCartCartPageBehaviors(context) { 2819 2820 if (Drupal.settings.uc_ajax_cart.AJAXIFY_CART_PAGE) { 2821 2822 // Set handler for cart submit button. 2823 jQuery('#uc-cart-view-form #edit-update').not('.ajax-cart-processed').bind('click', ajaxCartSubmit) 2824 .addClass('ajax-cart-processed'); 2825 2826 // Trigger submit button when cart qty form input elements are changed. 2827 jQuery('#uc-cart-view-form .qty input').not('.ajax-cart-processed').bind('change', function (e) { 2828 triggerCartSubmit(); 2829 return false; 2830 }) 2831 .addClass('ajax-cart-processed'); 2832 2833 // Ubercart has changed remove checkboxes to buttons above Ubercart 2.4. 2834 jQuery('#uc-cart-view-form .remove input').not('.ajax-cart-processed').each(function () { 2835 var elem = jQuery(this); 2836 var is_button = false; 2837 if (elem.attr('type') != 'checkbox') { 2838 is_button = true; 2839 } 2840 elem.click(function (e) { 2841 if (is_button) { 2842 jQuery(this).parents('tr').eq(0).find('td.qty input.form-text').val('0'); 2843 } 2844 triggerCartSubmit(); 2845 return false; 2846 }); 2847 elem.addClass('ajax-cart-processed'); 2848 }); 2849 } 2850} 2851 2852 2853// Process behaviors for the cart block. 2854function ajaxCartCartBlockBehaviors(context) { 2855 // Is the cart in the receieved context? 2856 var cart_pane = jQuery('#ajaxCartUpdate #cart-block-contents-ajax'); 2857 if (cart_pane.length) { 2858 Drupal.uc_ajax_cart.cart_pane = cart_pane; 2859 2860 jQuery('#ajaxCartToggleView').not('.ajax-cart-processed').click(function () { 2861 ajaxCartToggleView(); 2862 return false; 2863 }) 2864 .addClass('ajax-cart-processed'); 2865 } 2866} 2867 2868 2869// Opens cart block. 2870// Sets cookie if track open state enabled. 2871function ajaxCartOpenCart(instantly) { 2872 if (!Drupal.uc_ajax_cart.cart_open_state) { 2873 Drupal.uc_ajax_cart.cart_open_state = true; 2874 if ((!instantly) && (Drupal.settings.uc_ajax_cart.CART_PANE_EFFECT)) { 2875 Drupal.uc_ajax_cart.cart_pane.slideDown(Drupal.settings.uc_ajax_cart.CART_PANE_EFFECT_DURATION); 2876 } 2877 else { 2878 Drupal.uc_ajax_cart.cart_pane.show(); 2879 } 2880 Drupal.uc_ajax_cart.cart_wrapper.addClass('cart-open'); 2881 2882 if (Drupal.settings.uc_ajax_cart.TRACK_CLOSED_STATE) { 2883 jQuery.cookie('ajax-cart-visible', '1', { path: '/'}); 2884 } 2885 } 2886} 2887 2888 2889// Closes cart block. 2890// Sets cookie if track open state enabled. 2891function ajaxCartCloseCart(instantly) { 2892 if (Drupal.uc_ajax_cart.cart_open_state) { 2893 Drupal.uc_ajax_cart.cart_open_state = false; 2894 if ((!instantly) && (Drupal.settings.uc_ajax_cart.CART_PANE_EFFECT)) { 2895 Drupal.uc_ajax_cart.cart_pane.slideUp(Drupal.settings.uc_ajax_cart.CART_PANE_EFFECT_DURATION); 2896 } 2897 else { 2898 Drupal.uc_ajax_cart.cart_pane.hide(); 2899 } 2900 Drupal.uc_ajax_cart.cart_wrapper.removeClass('cart-open'); 2901 2902 if (Drupal.settings.uc_ajax_cart.TRACK_CLOSED_STATE && (jQuery.cookie('ajax-cart-visible') != '0')) { 2903 jQuery.cookie('ajax-cart-visible', '0', { path: '/'}); 2904 } 2905 } 2906} 2907 2908 2909// Initialize cart page ajax update feature. 2910// Simply call behaviors for cart page with right context. 2911function ajaxCartInitCartView() { 2912 2913 // Hide update cart button if needed. 2914 jQuery('.hidden-update-bt').hide(); 2915 2916 ajaxCartCartPageBehaviors(jQuery('#cart-form-pane')); 2917} 2918 2919// Initialize cart block. 2920// Simply call behaviors for cart block with right context. 2921function ajaxCartInitCartBlock() { 2922 ajaxCartCartBlockBehaviors(Drupal.uc_ajax_cart.cart_wrapper); 2923 2924 // Cart has been loaded, so it's shown, change state accordingly. 2925 Drupal.uc_ajax_cart.cart_open_state = true; 2926 2927 if (Drupal.settings.uc_ajax_cart.COLLAPSIBLE_CART) { 2928 // Check this is the right state. 2929 if (Drupal.settings.uc_ajax_cart.TRACK_CLOSED_STATE) { 2930 ajaxCartCheckCookieCartState(); 2931 } else if (Drupal.settings.uc_ajax_cart.INITIAL_CLOSED_STATE) { 2932 ajaxCartCloseCart(true); 2933 } 2934 2935 } 2936} 2937 2938 2939// Checks open state cookie and changes cart open state accordingly. 2940function ajaxCartCheckCookieCartState() { 2941 var cookie_state = jQuery.cookie('ajax-cart-visible'); 2942 2943 if (Drupal.uc_ajax_cart.cart_open_state != cookie_state) { 2944 if (cookie_state == true) { 2945 ajaxCartOpenCart(true); 2946 } 2947 else { 2948 ajaxCartCloseCart(true); 2949 } 2950 } 2951} 2952 2953 2954// Show message using BlockUI anc configured layout. 2955function ajaxCartShowMessageProxy(title, message) { 2956 2957 if (Drupal.settings.uc_ajax_cart.HIDE_CART_OPERATIONS) { 2958 return; 2959 } 2960 2961 // Check if UI is blocked. Blocked UI implies no fader in to avoid flickering. 2962 var fadein = 0; 2963 if (!Drupal.uc_ajax_cart.blockUI_blocked) { 2964 fadein = 500; 2965 } 2966 2967 Drupal.uc_ajax_cart.blockUI_blocked += 1; 2968 if (Drupal.settings.uc_ajax_cart.BLOCK_UI == 1) { 2969 jQuery.blockUI({ message : '<h2>' + title + '</h2>' + message, fadeIn: fadein }); 2970 } 2971 else { 2972 var $m = jQuery('<div class="growlUI"></div>'); 2973 if (title) { 2974 $m.append('<h1>' + title + '</h1>'); 2975 } 2976 2977 if (message) { 2978 $m.append('<h2>' + message + '</h2>'); 2979 } 2980 2981 jQuery.blockUI({ 2982 message: $m, 2983 fadeIn: fadein, 2984 fadeOut: 700,
2985 showOverlay: false, 2986 centerY: false, 2987 css: { 2988 width: '350px', 2989 top: '10px', 2990 left: '', 2991 right: '10px', 2992 border: 'none', 2993 padding: '5px', 2994 backgroundColor: '#000', 2995 '-webkit-border-radius': '10px', 2996 '-moz-border-radius': '10px', 2997 'border-radius': '10px', 2998 color: '#fff', 2999 opacity: 1 3000 } 3001 }); 3002 } 3003} 3004 3005 3006function ajaxCartShowMessageProxyClose() { 3007 jQuery.unblockUI(); 3008} 3009 3010 3011// Toggle cart block. 3012function ajaxCartToggleView() { 3013 Drupal.uc_ajax_cart.cart_open_state ? ajaxCartCloseCart() : ajaxCartOpenCart(); 3014} 3015 3016 3017// Processes after cart form is submitted. 3018function ajaxCartFormSubmitted(e) { 3019 // Enable input elements from cart from cart page. 3020 jQuery('form.ajax-cart-submit-form input').attr('disabled', false); 3021 3022 // Update cart block. 3023 ajaxCartUpdateBlockCart(); 3024 3025 3026 ajaxCartBlockUI(Drupal.settings.uc_ajax_cart.CART_OPERATION, e); 3027 ajaxCartReloadCartView(); 3028} 3029 3030 3031function ajaxCartBlockUI(title, message) { 3032 ajaxCartShowMessageProxy(title, message); 3033} 3034 3035 3036function ajaxCartBlockUIRemove(url) { 3037 jQuery('#uc-cart-view-form input').attr('disabled', 'disabled'); 3038 ajaxCartShowMessageProxy(Drupal.settings.uc_ajax_cart.REMOVE_TITLE, Drupal.settings.uc_ajax_cart.REMOVE_MESSAGE); 3039 jQuery.post(url, ajaxCartFormSubmitted); 3040 return false; 3041} 3042 3043 3044// Loads cart block contents using ajax. 3045function ajaxCartUpdateBlockCart() { 3046 Drupal.uc_ajax_cart.update_container.load(Drupal.settings.uc_ajax_cart.SHOW_CALLBACK, '', ajaxCartInitCartBlock); 3047 return false; 3048} 3049 3050 3051// Reloads standard Ubercart cart form from cart page. 3052function ajaxCartReloadCartView() { 3053 if (jQuery('#cart-form-pane').length) { 3054 jQuery('#cart-form-pane').parent().load(Drupal.settings.uc_ajax_cart.SHOW_VIEW_CALLBACK, ajaxCartInitCartView); 3055 } 3056} 3057 3058 3059function ajaxCartUpdateCartViewUpdated(e) { 3060 ajaxCartUpdateBlockCart(); 3061 ajaxCartInitCartView(); 3062} 3063 3064 3065function ajaxCartShowMessages(e) { 3066 if (e != "") { 3067 clearTimeout(); 3068 ajaxCartShowMessageProxy('Message', e); 3069 } 3070} 3071 3072 3073/** 3074 * Checks if a add to cart input submit button element must be ajaxified. 3075 */ 3076function _checkAjaxify($elem) { 3077 var rc = true; 3078 if (Drupal.settings.uc_ajax_cart.AJAXIFY_CLASS) { 3079 rc = $elem.parents().add($elem).is('.' + Drupal.settings.uc_ajax_cart.AJAXIFY_CLASS); 3080 rc = Drupal.settings.uc_ajax_cart.AJAXIFY_CLASS_EXCLUDES ? !rc : rc; 3081 } 3082 return rc; 3083} 3084; 3085/** 3086 * Cookie plugin 3087 * 3088 * Copyright (c) 2006 Klaus Hartl (stilbuero.de) 3089 * Dual licensed under the MIT and GPL licenses: 3090 * http://www.opensource.org/licenses/mit-license.php 3091 * http://www.gnu.org/licenses/gpl.html 3092 * 3093 */ 3094 3095/** 3096 * Create a cookie with the given name and value and other optional parameters. 3097 * 3098 * @example $.cookie('the_cookie', 'the_value'); 3099 * @desc Set the value of a cookie. 3100 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); 3101 * @desc Create a cookie with all available options. 3102 * @example $.cookie('the_cookie', 'the_value'); 3103 * @desc Create a session cookie. 3104 * @example $.cookie('the_cookie', null); 3105 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain 3106 * used when the cookie was set. 3107 * 3108 * @param String name The name of the cookie. 3109 * @param String value The value of the cookie. 3110 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. 3111 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. 3112 * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. 3113 * If set to null or omitted, the cookie will be a session cookie and will not be retained 3114 * when the the browser exits. 3115 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). 3116 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). 3117 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will 3118 * require a secure protocol (like HTTPS). 3119 * @type undefined 3120 * 3121 * @name $.cookie 3122 * @cat Plugins/Cookie 3123 * @author Klaus Hartl/[email protected] 3124 */ 3125 3126/** 3127 * Get the value of a cookie with the given name. 3128 * 3129 * @example $.cookie('the_cookie'); 3130 * @desc Get the value of a cookie. 3131 * 3132 * @param String name The name of the cookie. 3133 * @return The value of the cookie.
3134 * @type String 3135 * 3136 * @name $.cookie 3137 * @cat Plugins/Cookie 3138 * @author Klaus Hartl/[email protected] 3139 */ 3140jQuery.cookie = function(name, value, options) { 3141 if (typeof value != 'undefined') { // name and value given, set cookie 3142 options = options || {}; 3143 if (value === null) { 3144 value = ''; 3145 options.expires = -1; 3146 } 3147 var expires = ''; 3148 if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { 3149 var date; 3150 if (typeof options.expires == 'number') { 3151 date = new Date(); 3152 date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); 3153 } else { 3154 date = options.expires; 3155 } 3156 expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE 3157 } 3158 // CAUTION: Needed to parenthesize options.path and options.domain 3159 // in the following expressions, otherwise they evaluate to undefined 3160 // in the packed version for some reason... 3161 var path = options.path ? '; path=' + (options.path) : ''; 3162 var domain = options.domain ? '; domain=' + (options.domain) : ''; 3163 var secure = options.secure ? '; secure' : ''; 3164 document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); 3165 } else { // only name given, get cookie 3166 var cookieValue = null; 3167 if (document.cookie && document.cookie != '') { 3168 var cookies = document.cookie.split(';'); 3169 for (var i = 0; i < cookies.length; i++) { 3170 var cookie = jQuery.trim(cookies[i]); 3171 // Does this cookie string begin with the name we want? 3172 if (cookie.substring(0, name.length + 1) == (name + '=')) { 3173 cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); 3174 break; 3175 } 3176 } 3177 } 3178 return cookieValue; 3179 } 3180};; 3181 3182/** 3183 * Plugin written by the great jqueryfordesigners.com 3184 * http://jqueryfordesigners.com/jquery-infinite-carousel/ 3185 * 3186 * Slightly addapted for our use case 3187 */ 3188(function ($) { 3189 $.fn.infiniteCarousel = function () { 3190 3191 function repeat(str, num) { 3192 return new Array( num + 1 ).join( str ); 3193 } 3194 3195 return this.each(function () { 3196 3197 var $wrapper = $('> div', this).css('overflow', 'hidden'), 3198 $slider = $wrapper.find('> ul'), 3199 $items = $slider.find('> li'), 3200 $single = $items.filter(':first'), 3201 3202 singleWidth = $single.outerWidth(), 3203 visible = Math.floor($wrapper.innerWidth() / singleWidth), // note: doesn't include padding or border 3204 currentPage = 1, 3205 pages = Math.ceil($items.length / visible); 3206 3207 3208 // 1. Pad so that 'visible' number will always be seen, otherwise create empty items 3209 if (($items.length % visible) != 0) { 3210 $slider.append(repeat('<li class="empty" />', visible - ($items.length % visible))); 3211 $items = $slider.find('> li'); 3212 } 3213 3214 // 2. Top and tail the list with 'visible' number of items, top has the last section, and tail has the first 3215 $items.filter(':first').before($items.slice(- visible).clone().addClass('cloned')); 3216 $items.filter(':last').after($items.slice(0, visible).clone().addClass('cloned')); 3217 $items = $slider.find('> li'); // reselect 3218 3219 // 3. Set the left position to the first 'real' item 3220 $wrapper.scrollLeft(singleWidth * visible); 3221 3222 // 4. paging function 3223 function gotoPage(page) { 3224 var dir = page < currentPage ? -1 : 1, 3225 n = Math.abs(currentPage - page), 3226 left = singleWidth * dir * visible * n; 3227 3228 $wrapper.filter(':not(:animated)').animate({ 3229 scrollLeft : '+=' + left 3230 }, 500, function () { 3231 if (page == 0) { 3232 $wrapper.scrollLeft(singleWidth * visible * pages); 3233 page = pages; 3234 } else if (page > pages) { 3235 $wrapper.scrollLeft(singleWidth * visible); 3236 // reset back to start position 3237 page = 1; 3238 } 3239 3240 currentPage = page; 3241 }); 3242 3243 return false;
3244 } 3245 3246 $wrapper.after('<a class="arrow back" title="'+ Drupal.t('Previous page') +'"><</a><a class="arrow forward" title="'+ Drupal.t('Next page') +'">></a>'); 3247 3248 // 5. Bind to the forward and back buttons 3249 $('a.back', this).click(function () { 3250 return gotoPage(currentPage - 1); 3251 }); 3252 3253 $('a.forward', this).click(function () { 3254 return gotoPage(currentPage + 1); 3255 }); 3256 3257 // create a public interface to move to a specific page 3258 $(this).bind('goto', function (event, page) { 3259 gotoPage(page); 3260 }); 3261 3262 // custom events to trigger next and prev pages 3263 $(this).bind('next', function () { 3264 gotoPage(currentPage + 1); 3265 }); 3266 $(this).bind('prev', function () { 3267 gotoPage(currentPage - 1); 3268 }) 3269 }); 3270 }; 3271})(jQuery); 3272; 3273(function ($) { 3274 Drupal.behaviors.galleryformatter = { 3275 attach: function (context, settings) { 3276 var $images = $('.galleryformatter img', context); 3277 var total_images = $images.length; 3278 var loaded_images = 0; 3279 $images.each(function () { 3280 var img = new Image(); 3281 img.onload = function () { 3282 loaded_images++; 3283 if (loaded_images == total_images) { 3284 $('.galleryformatter:not(.gallery-processed)', context).each(function () { 3285 Drupal.galleryformatter.prepare(this); 3286 }).addClass('gallery-processed'); 3287 } 3288 } 3289 img.src = $(this, context).attr('src'); 3290 }); 3291 } 3292 }; 3293 3294 Drupal.galleryformatter = Drupal.galleryformatter || {}; 3295 3296 // setting up the main behaviour 3297 Drupal.galleryformatter.prepare = function(el) { 3298 // var $settings = Drupal.settings.galleryformatter; 3299 $el = $(el); 3300 var $slides = $('li.gallery-slide', $el); 3301 var $slideContainer = $('div.gallery-slides', $el); 3302 3303 var $thumbs = $('.gallery-thumbs', $el); 3304 var $thumbsLi = $('li', $thumbs); 3305 var thumbWidth = $thumbsLi.filter(':first').width() + 'px'; 3306 var liWidth = $thumbsLi.outerWidth(); // includes padding 3307 var $wrapper = $('.wrapper', $el); 3308 var visibleWidth = $wrapper.outerWidth(); 3309 3310 /* 3311 * Only start the thumbs carrousel if needed 3312 */ 3313 if (($thumbsLi.size() * liWidth) > $thumbs.width()) { 3314 $('ul', $thumbs).width('99999px'); 3315 $thumbs.infiniteCarousel(); 3316 $thumbsLi = $('li', $thumbs); // we need to reselect because infiniteCarousel inserts new empty li elements if necessary 3317 // we need to reselect because infiniteCarousel inserts new empty li elements if necessary 3318 $el = $(el); 3319 $thumbsLi = $('.gallery-thumbs ul li', $el); 3320 } 3321 3322 $thumbsLi = $('li', $thumbs); // we need to reselect because infiniteCarousel inserts new empty li elements if necessary 3323 3324 $thumbsLi.each(function(){ 3325 $(this).css({ 3326 width: thumbWidth 3327 }); 3328 }); 3329 var $thumbslinks = $('a', $thumbsLi); 3330 3331 /* 3332 * @TODO: 3333 * figure out how to get this into proper functions reusing selections 3334 */ 3335 $thumbslinks.click(function(e){ 3336 $hash = $(this.hash); 3337 if(!$hash.is(':visible')){ 3338 $thumbsLi.removeClass('active'); 3339 $(this).parent().addClass('active'); 3340 $slides.filter(':visible').fadeOut('slow'); 3341 $hash.fadeIn('slow'); 3342 // set the slide container's height to allow use of portrait images 3343 $slideContainer.css("height",$hash.find('img').height()); 3344 /* 3345 * @FIXME 3346 * Need to figure out a way to update the location bar of the browser, for bookmarking etc, without making the scroll jump 3347 * window.location.hash = this.hash; solution below does update the location, but makes the scroll jump. 3348 */ 3349 // window.location.hash = this.hash; // not sure if this is the best way to do it. 3350 } 3351 e.preventDefault(); 3352 }); 3353 3354 /* 3355 * Startup behaviour (when the page first loads) 3356 */ 3357 if ($slides.length > 1) { 3358 $slides.hide(); // hide all slides 3359 } 3360 var $locationHash = window.location.hash; // if we are being deeplinked to a specific slide, capture that 3361 3362 function showFirstSlide(){ 3363 // Activate the first slide 3364 $('a', $thumbsLi.filter('.slide-0:not(".cloned")')).trigger('click'); 3365 } 3366 3367 // if we have a hash in the url 3368 if ($locationHash) { 3369 var $slideToShow = $slides.filter($locationHash); 3370 // if the hash corresponds to one of our slides 3371 if ($slideToShow.length > 0) { 3372 $slideToShow.show(); // show that slide 3373 $thumbsLi.not($(".cloned")).find("a[href="+$locationHash+"]").parent().addClass('active'); // activate that thumbnail 3374 // set the slide container's height to allow use of portrait images 3375 $slideContainer.css("height", $slideToShow.find('img').height()); 3376 } 3377 // otherwise the default 3378 else { 3379 showFirstSlide(); 3380 } 3381 } 3382 // otherwise the default 3383 else { 3384 showFirstSlide(); 3385 } 3386 3387 /* 3388 * Create a public interface to move to the next and previous images 3389 */ 3390 // Shows the previous slide and scrolls to the previous page if necessary 3391 $thumbs.bind('showPrev', function (event) { 3392 var currentScroll = $wrapper.get(0).scrollLeft; 3393 var $prevThumbLi = $thumbsLi.filter('.active').prev(':not(".cloned, .empty, .active")'); 3394 // if no results we are on the first element 3395 if(!$prevThumbLi.size()) { 3396 // select the last one 3397 $prevThumbLi = $thumbsLi.not('.empty, .cloned').filter(':last'); 3398 } 3399 var $slideToClick = $('a', $prevThumbLi); 3400 var $prevIsVisible = (($prevThumbLi.get(0).offsetLeft >= currentScroll) && ($prevThumbLi.get(0).offsetLeft <= (visibleWidth + currentScroll))); 3401 if($prevIsVisible) { 3402 $slideToClick.trigger('click'); 3403 } 3404 else { 3405 $thumbs.trigger('prev'); 3406 $slideToClick.trigger('click'); 3407 } 3408 }); 3409 // Shows the next slide and scrolls to the next page if necessary 3410 $thumbs.bind('showNext', function (event) { 3411 var currentScroll = $wrapper.get(0).scrollLeft; 3412 // this selector could be optimized perhaps, but 3413 var $nextThumbLi = $thumbsLi.filter('.active').next(':not(".cloned, .empty, .active")'); 3414 // if no results we are on the last element 3415 if(!$nextThumbLi.size()) { 3416 // select the first one 3417 $nextThumbLi = $thumbsLi.not('.empty, .cloned').filter(':first'); 3418 } 3419 3420 var $slideToClick = $('a', $nextThumbLi); 3421 var $nextIsVisible = (($nextThumbLi.get(0).offsetLeft >= currentScroll) && ($nextThumbLi.get(0).offsetLeft <= (visibleWidth + currentScroll))); 3422 if($nextIsVisible) { 3423 var $slideToClick = $('a', $nextThumbLi); 3424 $('a', $nextThumbLi).trigger('click'); 3425 } 3426 else { 3427 $thumbs.trigger('next'); 3428 $slideToClick.trigger('click'); 3429 } 3430 }); 3431 3432 $('.shownext + img', $slideContainer).click(function(){ 3433 $thumbs.trigger('showNext'); 3434 }); 3435 3436 if ($slides.length > 1) { 3437 // Setup buttons for next/prev slide 3438 $slideButtons = ('<a class="prev-slide slide-button" title="'+ Drupal.t('Previous image') +'"><</a>
3438<a class="next-slide slide-button" title="'+ Drupal.t('Next image') +'">></a>'); 3439 $('.gallery-slides', $el).append($slideButtons); 3440 // Trigger the appropiate events on click 3441 $('a.prev-slide', $el).click(function(){ 3442 $thumbs.trigger('showPrev'); 3443 }); 3444 $('a.next-slide', $el).click(function(){ 3445 $thumbs.trigger('showNext'); 3446 }); 3447 } 3448 } 3449})(jQuery); 3450; 3451/*! 3452 * jCarousel - Riding carousels with jQuery 3453 * http://sorgalla.com/jcarousel/ 3454 * 3455 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com) 3456 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 3457 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. 3458 * 3459 * Built on top of the jQuery library 3460 * http://jquery.com 3461 * 3462 * Inspired by the "Carousel Component" by Bill Scott 3463 * http://billwscott.com/carousel/ 3464 */ 3465 3466(function(c){var d={vertical:false,rtl:false,start:1,offset:1,size:null,scroll:3,visible:null,animation:"normal",easing:"swing",auto:0,wrap:null,initCallback:null,setupCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,animationStepCallback:null,buttonNextHTML:"<div></div>",buttonPrevHTML:"<div></div>",buttonNextEvent:"click",buttonPrevEvent:"click",buttonNextCallback:null,buttonPrevCallback:null,itemFallbackDimension:null},b=false;c(window).bind("load.jcarousel",function(){b=true});c.jcarousel=function(l,g){this.options=c.extend({},d,g||{});this.locked=false;this.autoStopped=false;this.container=null;this.clip=null;this.list=null;this.buttonNext=null;this.buttonPrev=null;this.buttonNextState=null;this.buttonPrevState=null;if(!g||g.rtl===undefined){this.options.rtl=(c(l).attr("dir")||c("html").attr("dir")||"").toLowerCase()=="rtl"}this.wh=!this.options.vertical?"width":"height";this.lt=!this.options.vertical?(this.options.rtl?"right":"left"):"top";var q="",n=l.className.split(" ");for(var k=0;k<n.length;k++){if(n[k].indexOf("jcarousel-skin")!=-1){c(l).removeClass(n[k]);q=n[k];break}}if(l.nodeName.toUpperCase()=="UL"||l.nodeName.toUpperCase()=="OL"){this.list=c(l);this.clip=this.list.parents(".jcarousel-clip");this.container=this.list.parents(".jcarousel-container")}else{this.container=c(l);this.list=this.container.find("ul,ol").eq(0);this.clip=this.container.find(".jcarousel-clip")}if(this.clip.size()===0){this.clip=this.list.wrap("<div></div>").parent()}if(this.container.size()===0){this.container=this.clip.wrap("<div></div>").parent()}if(q!==""&&this.container.parent()[0].className.indexOf("jcarousel-skin")==-1){this.container.wrap('<div class=" '+q+'"></div>')}this.buttonPrev=c(".jcarousel-prev",this.container);if(this.buttonPrev.size()===0&&this.options.buttonPrevHTML!==null){this.buttonPrev=c(this.options.buttonPrevHTML).appendTo(this.container)}this.buttonPrev.addClass(this.className("jcarousel-prev"));this.buttonNext=c(".jcarousel-next",this.container);if(this.buttonNext.size()===0&&this.options.buttonNextHTML!==null){this.buttonNext=c(this.options.buttonNextHTML).appendTo(this.container)}this.buttonNext.addClass(this.className("jcarousel-next"));this.clip.addClass(this.className("jcarousel-clip")).css({position:"relative"});this.list.addClass(this.className("jcarousel-list")).css({overflow:"hidden",position:"relative",top:0,margin:0,padding:0}).css((this.options.rtl?"right":"left"),0);this.container.addClass(this.className("jcarousel-container")).css({position:"relative"});if(!this.options.vertical&&this.options.rtl){this.container.addClass("jcarousel-direction-rtl").attr("dir","rtl")}var m=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;var p=this.list.children("li");var r=this;if(p.size()>0){var f=0,h=this.options.offset;p.each(function(){r.format(this,h++);f+=r.dimension(this,m)});this.list.css(this.wh,(f+100)+"px");if(!g||g.size===undefined){this.options.size=p.size()}}this.container.css("display","block");this.buttonNext.css("display","block");this.buttonPrev.css("display","block");this.funcNext=function(){r.next();return false};this.funcPrev=function(){r.prev();return false};this.funcResize=function(){if(r.resizeTimer){clearTimeout(r.resizeTimer)}r.resizeTimer=setTimeout(function(){r.reload()},100)};if(this.options.initCallback!==null){this.options.initCallback(this,"init")}if(!b&&a.isSafari()){this.buttons(false,false);
3466c(window).bind("load.jcarousel",function(){r.setup()})}else{this.setup()}};var a=c.jcarousel;a.fn=a.prototype={jcarousel:"0.2.9"};a.fn.extend=a.extend=c.extend;a.fn.extend({setup:function(){this.first=null;this.last=null;this.prevFirst=null;this.prevLast=null;this.animating=false;this.timer=null;this.resizeTimer=null;this.tail=null;this.inTail=false;if(this.locked){return}this.list.css(this.lt,this.pos(this.options.offset)+"px");var e=this.pos(this.options.start,true);this.prevFirst=this.prevLast=null;this.animate(e,false);c(window).unbind("resize.jcarousel",this.funcResize).bind("resize.jcarousel",this.funcResize);if(this.options.setupCallback!==null){this.options.setupCallback(this)}},reset:function(){this.list.empty();this.list.css(this.lt,"0px");this.list.css(this.wh,"10px");if(this.options.initCallback!==null){this.options.initCallback(this,"reset")}this.setup()},reload:function(){if(this.tail!==null&&this.inTail){this.list.css(this.lt,a.intval(this.list.css(this.lt))+this.tail)}this.tail=null;this.inTail=false;if(this.options.reloadCallback!==null){this.options.reloadCallback(this)}if(this.options.visible!==null){var g=this;var h=Math.ceil(this.clipping()/this.options.visible),f=0,e=0;this.list.children("li").each(function(j){f+=g.dimension(this,h);if(parseInt(jQuery(this).attr("jcarouselindex"))<g.first){e=f}});this.list.css(this.wh,f+"px");this.list.css(this.lt,-e+"px")}this.scroll(this.first,false)},lock:function(){this.locked=true;this.buttons()},unlock:function(){this.locked=false;this.buttons()},size:function(e){if(e!==undefined){this.options.size=e;if(!this.locked){this.buttons()}}return this.options.size},has:function(g,h){if(h===undefined||!h){h=g}if(this.options.size!==null&&h>this.options.size){h=this.options.size}for(var f=g;f<=h;f++){var k=this.get(f);if(!k.length||k.hasClass("jcarousel-item-placeholder")){return false}}return true},get:function(e){return c(">.jcarousel-item-"+e,this.list)},add:function(l,q){var m=this.get(l),h=0,g=c(q);if(m.length===0){var p,k=a.intval(l);m=this.create(l);while(true){p=this.get(--k);if(k<=0||p.length){if(k<=0){this.list.prepend(m)}else{p.after(m)}break}}}else{h=this.dimension(m)}if(g.get(0).nodeName.toUpperCase()=="LI"){m.replaceWith(g);m=g}else{m.empty().append(q)}this.format(m.removeClass(this.className("jcarousel-item-placeholder")),l);var o=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;var f=this.dimension(m,o)-h;if(l>0&&l<this.first){this.list.css(this.lt,a.intval(this.list.css(this.lt))-f+"px")}this.list.css(this.wh,a.intval(this.list.css(this.wh))+f+"px");return m},remove:function(f){var g=this.get(f);if(!g.length||(f>=this.first&&f<=this.last)){return}var h=this.dimension(g);if(f<this.first){this.list.css(this.lt,a.intval(this.list.css(this.lt))+h+"px")}g.remove();this.list.css(this.wh,a.intval(this.list.css(this.wh))-h+"px")},next:function(){if(this.tail!==null&&!this.inTail){this.scrollTail(false)}else{this.scroll(((this.options.wrap=="both"||this.options.wrap=="last")&&this.options.size!==null&&this.last==this.options.size)?1:this.first+this.options.scroll)}},prev:function(){if(this.tail!==null&&this.inTail){this.scrollTail(true)}else{this.scroll(((this.options.wrap=="both"||this.options.wrap=="first")&&this.options.size!==null&&this.first==1)?this.options.size:this.first-this.options.scroll)}},scrollTail:function(e){if(this.locked||this.animating||!this.tail){return}this.pauseAuto();var f=a.intval(this.list.css(this.lt));f=!e?f-this.tail:f+this.tail;this.inTail=!e;this.prevFirst=this.first;this.prevLast=this.last;this.animate(f)},scroll:function(f,e){if(this.locked||this.animating){return}this.pauseAuto();this.animate(this.pos(f),e)},pos:function(C,k){var n=a.intval(this.list.css(this.lt));if(this.locked||this.animating){return n}if(this.options.wrap!="circular"){C=C<1?1:(this.options.size&&C>this.options.size?this.options.size:C)}var z=this.first>C;var E=this.options.wrap!="circular"&&this.first<=1?1:this.first;var H=z?this.get(E):this.get(this.last);var B=z?E:E-1;var F=null,A=0,w=false,G=0,D;while(z?--B>=C:++B<C){F=this.get(B);w=!F.length;if(F.length===0){F=this.create(B).addClass(this.className("jcarousel-item-placeholder"));H[z?"before":"after"](F);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(B<=0||B>this.options.size)){D=this.get(this.index(B));if(D.length){F=this.add(B,D.clone(true))}}}H=F;G=this.dimension(F);if(w){A+=G}if(this.first!==null&&(this.options.wrap=="circular"||(B>=1&&(this.options.size===null||B<=this.options.size)))){n=z?n+G:n-G}}var s=this.clipping(),u=[],h=0,t=0;H=this.get(C-1);B=C;while(++h){F=this.get(B);w=!F.length;if(F.length===0){F=this.create(B).addClass(this.className("jcarousel-item-placeholder"));if(H.length===0){this.list.prepend(F)}else{H[z?"before":"after"](F)}if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(B<=0||B>this.options.size)){D=this.get(this.index(B));if(D.length){F=this.add(B,D.clone(true))}}}H=F;G=this.dimension(F);if(G===0){throw new Error("jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...")}if(this.options.wrap!="circular"&&this.options.size!==null&&B>this.options.size){u.push(F)}else{if(w){A+=G}}t+=G;if(t>=s){break}B++}for(var r=0;r<u.length;r++){u[r].remove()}if(A>0){this.list.css(this.wh,this.dimension(this.list)+A+"px");if(z){n-=A;this.list.css(this.lt,a.intval(this.list.css(this.lt))-A+"px")}}var q=C+h-1;if(this.options.wrap!="circular"&&this.options.size&&q>this.options.size){q=this.options.size}if(B>q){h=0;B=q;t=0;while(++h){F=this.get(B--);if(!F.length){break}t+=this.dimension(F);if(t>=s){break}}}var o=q-h+1;if(this.options.wrap!="circular"&&o<1){o=1}if(this.inTail&&z){n+=this.tail;this.inTail=false}this.tail=null;if(this.options.wrap!="circular"&&q==this.options.size&&(q-h+1)>=1){var y=a.intval(this.get(q).css(!this.options.vertical?"marginRight":"marginBottom"));if((t-y)>s){this.tail=t-s-y}}if(k&&C===this.options.size&&this.tail){n-=this.tail;this.inTail=true}while(C-->o){n+=this.dimension(this.get(C))}this.prevFirst=this.first;this.prevLast=this.last;this.first=o;this.last=q;return n},animate:function(i,e){if(this.locked||this.animating){return}this.animating=true;var f=this;var g=function(){f.animating=false;if(i===0){f.list.css(f.lt,0)}if(!f.autoStopped&&(f.options.wrap=="circular"||f.options.wrap=="both"||f.options.wrap=="last"||f.options.size===null||f.last<f.options.size||(f.last==f.options.size&&f.tail!==null&&!f.inTail))){f.startAuto()}f.buttons();f.notify("onAfterAnimation");if(f.options.wrap=="circular"&&f.options.size!==null){for(var k=f.prevFirst;k<=f.prevLast;k++){if(k!==null&&!(k>=f.first&&k<=f.last)&&(k<1||k>f.options.size)){f.remove(k)}}}};this.notify("onBeforeAnimation");if(!this.options.animation||e===false){this.list.css(this.lt,i+"px");g()}else{var j=!this.options.vertical?(this.options.rtl?{right:i}:{left:i}):{top:i};var h={duration:this.options.animation,easing:this.options.easing,complete:g};if(c.isFunction(this.options.animationStepCallback)){h.step=this.options.animationStepCallback}this.list.animate(j,h)}},startAuto:function(f){if(f!==undefined){this.options.auto=f}if(this.options.auto===0){return this.stopAuto()}if(this.timer!==null){return}this.autoStopped=false;var e=this;this.timer=window.setTimeout(function(){e.next()},this.options.auto*1000)},stopAuto:function(){this.pauseAuto();this.autoStopped=true},pauseAuto:function(){if(this.timer===null){return}window.clearTimeout(this.timer);this.timer=null},buttons:function(g,f){if(g==null){g=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!="first")||this.options.size===null||this.last<this.options.size);if(!this.locked&&(!this.options.wrap||this.options.wrap=="first")&&this.options.size!==null&&this.last>=this.options.size){g=this.tail!==null&&!this.inTail}}if(f==null){f=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!="last")||this.first>1);if(!this.locked&&(!this.options.wrap||this.options.wrap=="last")&&this.options.size!==null&&this.first==1){f=this.tail!==null&&this.inTail}}var e=this;if(this.buttonNext.size()>0){this.buttonNext.unbind(this.options.buttonNextEvent+".jcarousel",this.funcNext);if(g){this.buttonNext.bind(this.options.buttonNextEvent+".jcarousel",this.funcNext)}this.buttonNext[g?"removeClass":"addClass"](this.className("jcarousel-next-disabled")).attr("disabled",g?false:true);if(this.options.buttonNextCallback!==null&&this.buttonNext.data("jcarou
3466selstate")!=g){this.buttonNext.each(function(){e.options.buttonNextCallback(e,this,g)}).data("jcarouselstate",g)}}else{if(this.options.buttonNextCallback!==null&&this.buttonNextState!=g){this.options.buttonNextCallback(e,null,g)}}if(this.buttonPrev.size()>0){this.buttonPrev.unbind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev);if(f){this.buttonPrev.bind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev)}this.buttonPrev[f?"removeClass":"addClass"](this.className("jcarousel-prev-disabled")).attr("disabled",f?false:true);if(this.options.buttonPrevCallback!==null&&this.buttonPrev.data("jcarouselstate")!=f){this.buttonPrev.each(function(){e.options.buttonPrevCallback(e,this,f)}).data("jcarouselstate",f)}}else{if(this.options.buttonPrevCallback!==null&&this.buttonPrevState!=f){this.options.buttonPrevCallback(e,null,f)}}this.buttonNextState=g;this.buttonPrevState=f},notify:function(e){var f=this.prevFirst===null?"init":(this.prevFirst<this.first?"next":"prev");this.callback("itemLoadCallback",e,f);if(this.prevFirst!==this.first){this.callback("itemFirstInCallback",e,f,this.first);this.callback("itemFirstOutCallback",e,f,this.prevFirst)}if(this.prevLast!==this.last){this.callback("itemLastInCallback",e,f,this.last);this.callback("itemLastOutCallback",e,f,this.prevLast)}this.callback("itemVisibleInCallback",e,f,this.first,this.last,this.prevFirst,this.prevLast);this.callback("itemVisibleOutCallback",e,f,this.prevFirst,this.prevLast,this.first,this.last)},callback:function(j,m,e,k,h,g,f){if(this.options[j]==null||(typeof this.options[j]!="object"&&m!="onAfterAnimation")){return}var n=typeof this.options[j]=="object"?this.options[j][m]:this.options[j];if(!c.isFunction(n)){return}var o=this;if(k===undefined){n(o,e,m)}else{if(h===undefined){this.get(k).each(function(){n(o,this,k,e,m)})}else{var p=function(q){o.get(q).each(function(){n(o,this,q,e,m)})};for(var l=k;l<=h;l++){if(l!==null&&!(l>=g&&l<=f)){p(l)}}}}},create:function(e){return this.format("<li></li>",e)},format:function(k,h){k=c(k);var g=k.get(0).className.split(" ");for(var f=0;f<g.length;f++){if(g[f].indexOf("jcarousel-")!=-1){k.removeClass(g[f])}}k.addClass(this.className("jcarousel-item")).addClass(this.className("jcarousel-item-"+h)).css({"float":(this.options.rtl?"right":"left"),"list-style":"none"}).attr("jcarouselindex",h);return k},className:function(e){return e+" "+e+(!this.options.vertical?"-horizontal":"-vertical")},dimension:function(h,i){var g=c(h);if(i==null){return !this.options.vertical?((g.innerWidth()+a.intval(g.css("margin-left"))+a.intval(g.css("margin-right"))+a.intval(g.css("border-left-width"))+a.intval(g.css("border-right-width")))||a.intval(this.options.itemFallbackDimension)):((g.innerHeight()+a.intval(g.css("margin-top"))+a.intval(g.css("margin-bottom"))+a.intval(g.css("border-top-width"))+a.intval(g.css("border-bottom-width")))||a.intval(this.options.itemFallbackDimension))}else{var f=!this.options.vertical?i-a.intval(g.css("marginLeft"))-a.intval(g.css("marginRight")):i-a.intval(g.css("marginTop"))-a.intval(g.css("marginBottom"));c(g).css(this.wh,f+"px");return this.dimension(g)}},clipping:function(){return !this.options.vertical?this.clip[0].offsetWidth-a.intval(this.clip.css("borderLeftWidth"))-a.intval(this.clip.css("borderRightWidth")):this.clip[0].offsetHeight-a.intval(this.clip.css("borderTopWidth"))-a.intval(this.clip.css("borderBottomWidth"))},index:function(e,f){if(f==null){f=this.options.size}return Math.round((((e-1)/f)-Math.floor((e-1)/f))*f)+1}});a.extend({defaults:function(e){return c.extend(d,e||{})},intval:function(e){e=parseInt(e,10);return isNaN(e)?0:e},windowLoaded:function(){b=true},isSafari:function(){var g=navigator.userAgent.toLowerCase(),f=/(chrome)[ \/]([\w.]+)/.exec(g)||/(webkit)[ \/]([\w.]+)/.exec(g)||[],e=f[1]||"";return e==="webkit"}});c.fn.jcarousel=function(g){if(typeof g=="string"){var e=c(this).data("jcarousel"),f=Array.prototype.slice.call(arguments,1);return e[g].apply(e,f)}else{return this.each(function(){var h=c(this).data("jcarousel");if(h){if(g){c.extend(h.options,g)}h.reload()}
3466else{c(this).data("jcarousel",new a(this,g))}})}}})(jQuery); 3467; 3468/** 3469 * @file 3470 * Add jCarousel behaviors to the page and provide Views-support. 3471 */ 3472 3473(function($) { 3474 3475Drupal.behaviors.jcarousel = {}; 3476Drupal.behaviors.jcarousel.attach = function(context, settings) { 3477 settings = settings || Drupal.settings; 3478 3479 // If no carousels exist on this part of the page, work no further. 3480 if (!settings.jcarousel || !settings.jcarousel.carousels) { 3481 return; 3482 } 3483 3484 $("ul.jcarousel li").css("display", ""); 3485 3486 $.each(settings.jcarousel.carousels, function(key, options) { 3487 var $carousel = $(options.selector + ':not(.jcarousel-processed)', context); 3488 3489 // If this carousel has already been processed or doesn't exist, move on. 3490 if (!$carousel.length) { 3491 return; 3492 } 3493 3494 // Callbacks need to be converted from a string to an actual function. 3495 $.each(options, function(optionKey) { 3496 if (optionKey.match(/Callback$/) && typeof options[optionKey] == 'string') { 3497 var callbackFunction = window; 3498 var callbackParents = options[optionKey].split('.'); 3499 $.each(callbackParents, function(objectParent) { 3500 callbackFunction = callbackFunction[callbackParents[objectParent]]; 3501 }); 3502 options[optionKey] = callbackFunction; 3503 } 3504 }); 3505 3506 // Add standard options required for AJAX functionality. 3507 if (options.ajax && !options.itemLoadCallback) { 3508 options.itemLoadCallback = Drupal.jcarousel.ajaxLoadCallback; 3509 } 3510 3511 // If auto-scrolling, pause animation when hoving over the carousel. 3512 if (options.auto && options.autoPause && !options.initCallback) { 3513 options.initCallback = function(carousel, state) { 3514 Drupal.jcarousel.autoPauseCallback(carousel, state); 3515 }; 3516 } 3517 3518 // Add responsive behavior. 3519 if (options.responsive && !options.reloadCallback) { 3520 options.vertical = false;
3521 options.visible = null; 3522 options.reloadCallback = Drupal.jcarousel.reloadCallback; 3523 } 3524 3525 // Add navigation to the carousel if enabled. 3526 if (!options.setupCallback) { 3527 options.setupCallback = function(carousel) { 3528 Drupal.jcarousel.setupCarousel(carousel); 3529 if (options.navigation) { 3530 Drupal.jcarousel.addNavigation(carousel, options.navigation); 3531 } 3532 if (options.responsive) { 3533 carousel.reload(); 3534 } 3535 }; 3536 if (options.navigation && !options.itemVisibleInCallback) { 3537 options.itemLastInCallback = { 3538 onAfterAnimation: Drupal.jcarousel.updateNavigationActive 3539 }; 3540 } 3541 } 3542 3543 if (!options.hasOwnProperty('buttonNextHTML') && !options.hasOwnProperty('buttonPrevHTML')) { 3544 options.buttonNextHTML = Drupal.theme('jCarouselButton', 'next'); 3545 options.buttonPrevHTML = Drupal.theme('jCarouselButton', 'previous'); 3546 } 3547 3548 // Initialize the jcarousel. 3549 $carousel.addClass('jcarousel-processed').jcarousel(options); 3550 }); 3551}; 3552 3553Drupal.jcarousel = {}; 3554Drupal.jcarousel.reloadCallback = function(carousel) { 3555 // Set the clip and container to auto width so that they will fill 3556 // the available space. 3557 carousel.container.css('width', 'auto'); 3558 carousel.clip.css('width', 'auto'); 3559 var clipWidth = carousel.clip.width(); 3560 var containerExtra = carousel.container.width() - carousel.clip.outerWidth(true); 3561 // Determine the width of an item. 3562 var itemWidth = carousel.list.find('li').first().outerWidth(true); 3563 var numItems = Math.floor(carousel.clip.width() / itemWidth) || 1; 3564 // Set the new scroll number. 3565 carousel.options.scroll = numItems; 3566 var newClipWidth = numItems * itemWidth; 3567 var newContainerWidth = newClipWidth + containerExtra; 3568 // Resize the clip and container. 3569 carousel.clip.width(newClipWidth); 3570 carousel.container.width(newContainerWidth); 3571}; 3572Drupal.jcarousel.ajaxLoadCallback = function(jcarousel, state) { 3573 // Check if the requested items already exist. 3574 if (state == 'init' || jcarousel.has(jcarousel.first, jcarousel.last)) { 3575 return; 3576 } 3577 3578 var $list = jcarousel.list; 3579 var $view = $list.parents('.view:first'); 3580 var ajaxPath = Drupal.settings.jcarousel.ajaxPath; 3581 var target = $view.get(0); 3582 3583 // Find this view's settings in the Views AJAX settings. 3584 var settings; 3585 $.each(Drupal.settings.jcarousel.carousels, function(domID, carouselSettings) { 3586 if ($list.is('.' + domID)) { 3587 settings = carouselSettings['view_options']; 3588 } 3589 }); 3590 3591 // Copied from ajax_view.js: 3592 var viewData = { 'js': 1, 'first': jcarousel.first - 1, 'last': jcarousel.last }; 3593 // Construct an object using the settings defaults and then overriding 3594 // with data specific to the link. 3595 $.extend( 3596 viewData, 3597 settings 3598 ); 3599 3600 $.ajax({ 3601 url: ajaxPath, 3602 type: 'GET', 3603 data: viewData, 3604 success: function(response) { 3605 Drupal.jcarousel.ajaxResponseCallback(jcarousel, target, response); 3606 }, 3607 error: function(xhr) { 3608 Drupal.jcarousel.ajaxErrorCallback(xhr, ajaxPath); 3609 }, 3610 dataType: 'json' 3611 }); 3612 3613}; 3614 3615/** 3616 * Init callback for jCarousel. Pauses the carousel when hovering over. 3617 */ 3618Drupal.jcarousel.autoPauseCallback = function(carousel, state) { 3619 function pauseAuto() { 3620 carousel.stopAuto(); 3621 } 3622 function resumeAuto() { 3623 carousel.startAuto(); 3624 } 3625 carousel.clip.hover(pauseAuto, resumeAuto); 3626 carousel.buttonNext.hover(pauseAuto, resumeAuto); 3627 carousel.buttonPrev.hover(pauseAuto, resumeAuto); 3628}; 3629 3630/** 3631 * Setup callback for jCarousel. Calculates number of pages. 3632 */ 3633Drupal.jcarousel.setupCarousel = function(carousel) { 3634 // Determine the number of pages this carousel includes. 3635 // This only works for a positive starting point. Also, .first is 1-based 3636 // while .last is a count, so we need to reset the .first number to be 3637 // 0-based to make the math work. 3638 carousel.pageSize = carousel.last - (carousel.first - 1); 3639 3640 // jCarousel's Views integration sets "size" in the carousel options. Use that 3641 // if available, otherwise count the number of items in the carousel. 3642 var itemCount = carousel.options.size ? carousel.options.size : $(carou
3642sel.list).children('li').length; 3643 carousel.pageCount = Math.ceil(itemCount / carousel.pageSize); 3644 carousel.pageNumber = 1; 3645 3646 // Disable the previous/next arrows if there is only one page. 3647 if (carousel.options.wrap != 'circular' && carousel.pageCount == 1) { 3648 carousel.buttons(false, false); 3649 } 3650 3651 // Always remove the hard-coded display: block from the navigation. 3652 carousel.buttonNext.css('display', ''); 3653 carousel.buttonPrev.css('display', ''); 3654} 3655 3656/** 3657 * Setup callback for jCarousel. Adds the navigation to the carousel if enabled. 3658 */ 3659Drupal.jcarousel.addNavigation = function(carousel, position) { 3660 // Don't add a pager if there's only one page of results. 3661 if (carousel.pageCount <= 1) { 3662 return; 3663 } 3664 3665 // Add a class to the wrapper so it can adjust CSS. 3666 $(carousel.list).parents('.jcarousel-container:first').addClass('jcarousel-navigation-' + position); 3667 3668 var navigation = $('<ul class="jcarousel-navigation"></ul>'); 3669 3670 for (var i = 1; i <= carousel.pageCount; i++) { 3671 var pagerItem = $(Drupal.theme('jCarouselPageLink', i)); 3672 var listItem = $('<li></li>').attr('jcarousel-page', i).append(pagerItem); 3673 navigation.append(listItem); 3674 3675 // Make the first page active by default. 3676 if (i === 1) { 3677 listItem.addClass('active'); 3678 } 3679 3680 // Scroll to the correct page when a pager is clicked. 3681 pagerItem.bind('click', function() { 3682 // We scroll to the new page based on item offsets. This works with 3683 // circular carousels that do not divide items evenly, making it so that 3684 // going back or forward in pages will not skip or repeat any items. 3685 var newPageNumber = $(this).parent().attr('jcarousel-page'); 3686 var itemOffset = (newPageNumber - carousel.pageNumber) * carousel.pageSize; 3687 3688 if (itemOffset) { 3689 carousel.scroll(carousel.first + itemOffset); 3690 } 3691 3692 return false; 3693 }); 3694 } 3695 3696 $(carousel.list).parents('.jcarousel-clip:first')[position](navigation); 3697} 3698 3699/** 3700 * itemVisibleInCallback for jCarousel. Update the navigation after page change. 3701 */ 3702Drupal.jcarousel.updateNavigationActive = function(carousel, item, idx, state) { 3703 // The navigation doesn't even exist yet when this is called on init. 3704 var $listItems = $(carousel.list).parents('.jcarousel-container:first').find('.jcarousel-navigation li'); 3705 if ($listItems.length == 0) { 3706 return; 3707 } 3708 3709 // jCarousel does some very odd things with circular wraps. Items before the 3710 // first item are given negative numbers and items after the last are given 3711 // numbers beyond the total number of items. This complicated logic calculates 3712 // which page number is active based off this numbering scheme. 3713 var pageNumber = Math.ceil(idx / carousel.pageSize); 3714 if (pageNumber <= 0 || pageNumber > carousel.pageCount) { 3715 pageNumber = pageNumber % carousel.pageCount; 3716 pageNumber = pageNumber == 0 ? carousel.pageCount : pageNumber; 3717 pageNumber = pageNumber < 0 ? pageNumber + carousel.pageCount : pageNumber; 3718 } 3719 carousel.pageNumber = pageNumber; 3720 var currentPage = $listItems.get(carousel.pageNumber - 1); 3721 3722 // Set the current page to be active. 3723 $listItems.not(currentPage).removeClass('active'); 3724 $(currentPage).addClass('active'); 3725} 3726 3727/** 3728 * AJAX callback for all jCarousel-style views. 3729 */ 3730Drupal.jcarousel.ajaxResponseCallback = function(jcarousel, target, response) { 3731 if (response.debug) { 3732 alert(response.debug); 3733 } 3734 3735 var $view = $(target); 3736 var jcarousel = $view.find('ul.jcarousel').data('jcarousel'); 3737 3738 // Add items to the jCarousel. 3739 $('ul.jcarousel > li', response.display).each(function(i) { 3740 var itemNumber = this.className.replace(/.*?jcarousel-item-(\d+).*/, '$1'); 3741 jcarousel.add(itemNumber, this.innerHTML); 3742 }); 3743 3744 // Add Drupal behaviors to the content of the carousel to affect new items. 3745 Drupal.attachBehaviors(jcarousel.list.get(0)); 3746 3747 // Treat messages the same way that Views typically handles messages. 3748 if (response.messages) { 3749 // Show any messages (but first remove old ones, if there are any). 3750 $view.find('.views-messages').remove().end().prepend(response.messages); 3751 } 3752}; 3753 3754/** 3755 * Display error messages using the same mechanism as Views module. 3756 */ 3757Drupal.jcarousel.ajaxErrorCallback = function (xhr, path) { 3758 var error_text = ''; 3759 3760 if ((xhr.status == 500 && xhr.responseText) || xhr.status == 200) { 3761 error_text = xhr.responseText; 3762 3763 // Replace all < and > by < and > 3764 error_text = error_text.replace("/&(lt|gt);/g", function (m, p) { 3765 return (p == "lt")? "<" : ">"; 3766 }); 3767 3768 // Now, replace all html tags by empty spaces 3769 error_text = error_text.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi,""); 3770 3771 // Fix end lines 3772 error_text = error_text.replace(/[\n]+\s+/g,"\n"); 3773 } 3774 else if (xhr.status == 500) { 3775 error_text = xhr.status + ': ' + Drupal.t("Internal server error. Please see server or PHP logs for error information."); 3776 } 3777 else { 3778 error_text = xhr.status + ': ' + xhr.statusText; 3779 } 3780 3781 alert(Drupal.t("An error occurred at @path.\n\nError Description: @error", {'@path': path, '@error': error_text})); 3782}; 3783
3784Drupal.theme.prototype.jCarouselButton = function(type) { 3785 // Use links for buttons for accessibility. 3786 return '<a href="javascript:void(0)"></a>'; 3787}; 3788 3789Drupal.theme.prototype.jCarouselPageLink = function(pageNumber) { 3790 return '<a href="javascript:void(0)"><span>' + (pageNumber) + '</span></a>'; 3791}; 3792 3793})(jQuery); 3794;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.