(function ($) { Drupal.behaviors.initModalFormsLogin = { attach: function (context, settings) { $("a[href*='/user/login'], a[href*='?q=user/login']", context).once('init-modal-forms-login', function () { this.href = this.href.replace(/user\/login/,'modal_forms/nojs/login'); }).addClass('ctools-use-modal ctools-modal-modal-popup-small'); } }; })(jQuery); ; (function ($) { /** * A progressbar object. Initialized with the given id. Must be inserted into * the DOM afterwards through progressBar.element. * * method is the function which will perform the HTTP request to get the * progress bar state. Either "GET" or "POST". * * e.g. pb = new progressBar('myProgressBar'); * some_element.appendChild(pb.element); */ Drupal.progressBar = function (id, updateCallback, method, errorCallback) { var pb = this; this.id = id; this.method = method || 'GET'; this.updateCallback = updateCallback; this.errorCallback = errorCallback; // The WAI-ARIA setting aria-live="polite" will announce changes after users // have completed their current activity and not interrupt the screen reader. this.element = $('
').attr('id', id); this.element.html('
' + '
' + '
 
'); }; /** * Set the percentage and status message for the progressbar. */ Drupal.progressBar.prototype.setProgress = function (percentage, message) { if (percentage >= 0 && percentage <= 100) { $('div.filled', this.element).css('width', percentage + '%'); $('div.percentage', this.element).html(percentage + '%'); } $('div.message', this.element).html(message); if (this.updateCallback) { this.updateCallback(percentage, message, this); } }; /** * Start monitoring progress via Ajax. */ Drupal.progressBar.prototype.startMonitoring = function (uri, delay) { this.delay = delay; this.uri = uri; this.sendPing(); }; /** * Stop monitoring progress via Ajax. */ Drupal.progressBar.prototype.stopMonitoring = function () { clearTimeout(this.timer); // This allows monitoring to be stopped from within the callback. this.uri = null; }; /** * Request progress data from server. */ Drupal.progressBar.prototype.sendPing = function () { if (this.timer) { clearTimeout(this.timer); } if (this.uri) { var pb = this; // When doing a post request, you need non-null data. Otherwise a // HTTP 411 or HTTP 406 (with Apache mod_security) error may result. $.ajax({ type: this.method, url: this.uri, data: '', dataType: 'json', success: function (progress) { // Display errors. if (progress.status == 0) { pb.displayError(progress.data); return; } // Update display. pb.setProgress(progress.percentage, progress.message); // Schedule next timer. pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay); }, error: function (xmlhttp) { pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri)); } }); } }; /** * Display errors on the page. */ Drupal.progressBar.prototype.displayError = function (string) { var error = $('
').html(string); $(this.element).before(error).hide(); if (this.errorCallback) { this.errorCallback(this); } }; })(jQuery); ; /** * @file * * Implement a modal form. * * @see modal.inc for documentation. * * This javascript relies on the CTools ajax responder. */ (function ($) { // Make sure our objects are defined. Drupal.CTools = Drupal.CTools || {}; Drupal.CTools.Modal = Drupal.CTools.Modal || {}; /** * Display the modal * * @todo -- document the settings. */ Drupal.CTools.Modal.show = function(choice) { var opts = {}; if (choice && typeof choice == 'string' && Drupal.settings[choice]) { // This notation guarantees we are actually copying it. $.extend(true, opts, Drupal.settings[choice]); } else if (choice) { $.extend(true, opts, choice); } var defaults = { modalTheme: 'CToolsModalDialog', throbberTheme: 'CToolsModalThrobber', animation: 'show', animationSpeed: 'fast', modalSize: { type: 'scale', width: .8, height: .8, addWidth: 0, addHeight: 0, // How much to remove from the inner content to make space for the // theming. contentRight: 25, contentBottom: 45 }, modalOptions: { opacity: .55, background: '#fff' }, modalClass: 'default' }; var settings = {}; $.extend(true, settings, defaults, Drupal.settings.CToolsModal, opts); if (Drupal.CTools.Modal.currentSettings && Drupal.CTools.Modal.currentSettings != settings) { Drupal.CTools.Modal.modal.remove(); Drupal.CTools.Modal.modal = null; } Drupal.CTools.Modal.currentSettings = settings; var resize = function(e) { // When creating the modal, it actually exists only in a theoretical // place that is not in the DOM. But once the modal exists, it is in the // DOM so the context must be set appropriately. var context = e ? document : Drupal.CTools.Modal.modal; if (Drupal.CTools.Modal.currentSettings.modalSize.type == 'scale') { var width = $(window).width() * Drupal.CTools.Modal.currentSettings.modalSize.width; var height = $(window).height() * Drupal.CTools.Modal.currentSettings.modalSize.height; } else { var width = Drupal.CTools.Modal.currentSettings.modalSize.width; var height = Drupal.CTools.Modal.currentSettings.modalSize.height; } // Use the additionol pixels for creating the width and height. $('div.ctools-modal-content', context).css({ 'width': width + Drupal.CTools.Modal.currentSettings.modalSize.addWidth + 'px', 'height': height + Drupal.CTools.Modal.currentSettings.modalSize.addHeight + 'px' }); $('div.ctools-modal-content .modal-content', context).css({ 'width': (width - Drupal.CTools.Modal.currentSettings.modalSize.contentRight) + 'px', 'height': (height - Drupal.CTools.Modal.currentSettings.modalSize.contentBottom) + 'px' }); } if (!Drupal.CTools.Modal.modal) { Drupal.CTools.Modal.modal = $(Drupal.theme(settings.modalTheme)); if (settings.modalSize.type == 'scale') { $(window).bind('resize', resize); } } resize(); $('span.modal-title', Drupal.CTools.Modal.modal).html(Drupal.CTools.Modal.currentSettings.loadingText); Drupal.CTools.Modal.modalContent(Drupal.CTools.Modal.modal, settings.modalOptions, settings.animation, settings.animationSpeed, settings.modalClass); $('#modalContent .modal-content').html(Drupal.theme(settings.throbberTheme)).addClass('ctools-modal-loading'); // Position autocomplete results based on the scroll position of the modal. $('#modalContent .modal-content').delegate('input.form-autocomplete', 'keyup', function() { $('#autocomplete').css('top', $(this).position().top + $(this).outerHeight() + $(this).offsetParent().filter('#modal-content').scrollTop()); }); }; /** * Hide the modal */ Drupal.CTools.Modal.dismiss = function() { if (Drupal.CTools.Modal.modal) { Drupal.CTools.Modal.unmodalContent(Drupal.CTools.Modal.modal); } }; /** * Provide the HTML to create the modal dialog. */ Drupal.theme.prototype.CToolsModalDialog = function () { var html = '' html += '
' html += '
' // panels-modal-content html += ' '; html += ' '; html += '
'; html += '
'; return html; } /** * Provide the HTML to create the throbber. */ Drupal.theme.prototype.CToolsModalThrobber = function () { var html = ''; html += ' '; return html; }; /** * Figure out what settings string to use to display a modal. */ Drupal.CTools.Modal.getSettings = function (object) { var match = $(object).attr('class').match(/ctools-modal-(\S+)/); if (match) { return match[1]; } } /** * Click function for modals that can be cached. */ Drupal.CTools.Modal.clickAjaxCacheLink = function () { Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this)); return Drupal.CTools.AJAX.clickAJAXCacheLink.apply(this); }; /** * Handler to prepare the modal for the response */ Drupal.CTools.Modal.clickAjaxLink = function () { Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this)); return false; }; /** * Submit responder to do an AJAX submit on all modal forms. */ Drupal.CTools.Modal.submitAjaxForm = function(e) { var $form = $(this); var url = $form.attr('action'); setTimeout(function() { Drupal.CTools.AJAX.ajaxSubmit($form, url); }, 1); return false; } /** * Bind links that will open modals to the appropriate function. */ Drupal.behaviors.ZZCToolsModal = { attach: function(context) { // Bind links // Note that doing so in this order means that the two classes can be // used together safely. /* * @todo remimplement the warm caching feature $('a.ctools-use-modal-cache', context).once('ctools-use-modal', function() { $(this).click(Drupal.CTools.Modal.clickAjaxCacheLink); Drupal.CTools.AJAX.warmCache.apply(this); }); */ $('area.ctools-use-modal, a.ctools-use-modal', context).once('ctools-use-modal', function() { var $this = $(this); $this.click(Drupal.CTools.Modal.clickAjaxLink); // Create a drupal ajax object var element_settings = {}; if ($this.attr('href')) { element_settings.url = $this.attr('href'); element_settings.event = 'click'; element_settings.progress = { type: 'throbber' }; } var base = $this.attr('href'); Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); }); // Bind buttons $('input.ctools-use-modal, button.ctools-use-modal', context).once('ctools-use-modal', function() { var $this = $(this); $this.click(Drupal.CTools.Modal.clickAjaxLink); var button = this; var element_settings = {}; // AJAX submits specified in this manner automatically submit to the // normal form action. element_settings.url = Drupal.CTools.Modal.findURL(this); if (element_settings.url == '') { element_settings.url = $(this).closest('form').attr('action'); } element_settings.event = 'click'; element_settings.setClick = true; var base = $this.attr('id'); Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); // Make sure changes to settings are reflected in the URL. $('.' + $(button).attr('id') + '-url').change(function() { Drupal.ajax[base].options.url = Drupal.CTools.Modal.findURL(button); }); }); // Bind our custom event to the form submit $('#modal-content form', context).once('ctools-use-modal', function() { var $this = $(this); var element_settings = {}; element_settings.url = $this.attr('action'); element_settings.event = 'submit'; element_settings.progress = { 'type': 'throbber' } var base = $this.attr('id'); Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); Drupal.ajax[base].form = $this; $('input[type=submit], button', this).click(function(event) { Drupal.ajax[base].element = this; this.form.clk = this; // Stop autocomplete from submitting. if (Drupal.autocompleteSubmit && !Drupal.autocompleteSubmit()) { return false; } // An empty event means we were triggered via .click() and // in jquery 1.4 this won't trigger a submit. if (event.bubbles == undefined) { $(this.form).trigger('submit'); return false; } }); }); // Bind a click handler to allow elements with the 'ctools-close-modal' // class to close the modal. $('.ctools-close-modal', context).once('ctools-close-modal') .click(function() { Drupal.CTools.Modal.dismiss(); return false; }); } }; // The following are implementations of AJAX responder commands. /** * AJAX responder command to place HTML within the modal. */ Drupal.CTools.Modal.modal_display = function(ajax, response, status) { if ($('#modalContent').length == 0) { Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(ajax.element)); } $('#modal-title').html(response.title); // Simulate an actual page load by scrolling to the top after adding the // content. This is helpful for allowing users to see error messages at the // top of a form, etc. $('#modal-content').html(response.output).scrollTop(0); // Attach behaviors within a modal dialog. var settings = response.settings || ajax.settings || Drupal.settings; Drupal.attachBehaviors('#modalContent', settings); if ($('#modal-content').hasClass('ctools-modal-loading')) { $('#modal-content').removeClass('ctools-modal-loading'); } else { // If the modal was already shown, and we are simply replacing its // content, then focus on the first focusable element in the modal. // (When first showing the modal, focus will be placed on the close // button by the show() function called above.) $('#modal-content :focusable:first').focus(); } } /** * AJAX responder command to dismiss the modal. */ Drupal.CTools.Modal.modal_dismiss = function(command) { Drupal.CTools.Modal.dismiss(); $('link.ctools-temporary-css').remove(); } /** * Display loading */ //Drupal.CTools.AJAX.commands.modal_loading = function(command) { Drupal.CTools.Modal.modal_loading = function(command) { Drupal.CTools.Modal.modal_display({ output: Drupal.theme(Drupal.CTools.Modal.currentSettings.throbberTheme), title: Drupal.CTools.Modal.currentSettings.loadingText }); } /** * Find a URL for an AJAX button. * * The URL for this gadget will be composed of the values of items by * taking the ID of this item and adding -url and looking for that * class. They need to be in the form in order since we will * concat them all together using '/'. */ Drupal.CTools.Modal.findURL = function(item) { var url = ''; var url_class = '.' + $(item).attr('id') + '-url'; $(url_class).each( function() { var $this = $(this); if (url && $this.val()) { url += '/'; } url += $this.val(); }); return url; }; /** * modalContent * @param content string to display in the content box * @param css obj of css attributes * @param animation (fadeIn, slideDown, show) * @param speed (valid animation speeds slow, medium, fast or # in ms) * @param modalClass class added to div#modalContent */ Drupal.CTools.Modal.modalContent = function(content, css, animation, speed, modalClass) { // If our animation isn't set, make it just show/pop if (!animation) { animation = 'show'; } else { // If our animation isn't "fadeIn" or "slideDown" then it always is show if (animation != 'fadeIn' && animation != 'slideDown') { animation = 'show'; } } if (!speed) { speed = 'fast'; } // Build our base attributes and allow them to be overriden css = jQuery.extend({ position: 'absolute', left: '0px', margin: '0px', background: '#000', opacity: '.55' }, css); // Add opacity handling for IE. css.filter = 'alpha(opacity=' + (100 * css.opacity) + ')'; content.hide(); // If we already have modalContent, remove it. if ($('#modalBackdrop').length) $('#modalBackdrop').remove(); if ($('#modalContent').length) $('#modalContent').remove(); // position code lifted from http://www.quirksmode.org/viewport/compatibility.html if (self.pageYOffset) { // all except Explorer var wt = self.pageYOffset; } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict var wt = document.documentElement.scrollTop; } else if (document.body) { // all other Explorers var wt = document.body.scrollTop; } // Get our dimensions // Get the docHeight and (ugly hack) add 50 pixels to make sure we dont have a *visible* border below our div var docHeight = $(document).height() + 50; var docWidth = $(document).width(); var winHeight = $(window).height(); var winWidth = $(window).width(); if( docHeight < winHeight ) docHeight = winHeight; // Create our divs $('body').append(''); // Get a list of the tabbable elements in the modal content. var getTabbableElements = function () { var tabbableElements = $('#modalContent :tabbable'), radioButtons = tabbableElements.filter('input[type="radio"]'); // The list of tabbable elements from jQuery is *almost* right. The // exception is with groups of radio buttons. The list from jQuery will // include all radio buttons, when in fact, only the selected radio button // is tabbable, and if no radio buttons in a group are selected, then only // the first is tabbable. if (radioButtons.length > 0) { // First, build up an index of which groups have an item selected or not. var anySelected = {}; radioButtons.each(function () { var name = this.name; if (typeof anySelected[name] === 'undefined') { anySelected[name] = radioButtons.filter('input[name="' + name + '"]:checked').length !== 0; } }); // Next filter out the radio buttons that aren't really tabbable. var found = {}; tabbableElements = tabbableElements.filter(function () { var keep = true; if (this.type == 'radio') { if (anySelected[this.name]) { // Only keep the selected one. keep = this.checked; } else { // Only keep the first one. if (found[this.name]) { keep = false; } found[this.name] = true; } } return keep; }); } return tabbableElements.get(); }; // Keyboard and focus event handler ensures only modal elements gain focus. modalEventHandler = function( event ) { target = null; if ( event ) { //Mozilla target = event.target; } else { //IE event = window.event; target = event.srcElement; } var parents = $(target).parents().get(); for (var i = 0; i < parents.length; ++i) { var position = $(parents[i]).css('position'); if (position == 'absolute' || position == 'fixed') { return true; } } if ($(target).is('#modalContent, body') || $(target).filter('*:visible').parents('#modalContent').length) { // Allow the event only if target is a visible child node // of #modalContent. return true; } else { getTabbableElements()[0].focus(); } event.preventDefault(); }; $('body').bind( 'focus', modalEventHandler ); $('body').bind( 'keypress', modalEventHandler ); // Keypress handler Ensures you can only TAB to elements within the modal. // Based on the psuedo-code from WAI-ARIA 1.0 Authoring Practices section // 3.3.1 "Trapping Focus". modalTabTrapHandler = function (evt) { // We only care about the TAB key. if (evt.which != 9) { return true; } var tabbableElements = getTabbableElements(), firstTabbableElement = tabbableElements[0], lastTabbableElement = tabbableElements[tabbableElements.length - 1], singleTabbableElement = firstTabbableElement == lastTabbableElement, node = evt.target; // If this is the first element and the user wants to go backwards, then // jump to the last element. if (node == firstTabbableElement && evt.shiftKey) { if (!singleTabbableElement) { lastTabbableElement.focus(); } return false; } // If this is the last element and the user wants to go forwards, then // jump to the first element. else if (node == lastTabbableElement && !evt.shiftKey) { if (!singleTabbableElement) { firstTabbableElement.focus(); } return false; } // If this element isn't in the dialog at all, then jump to the first // or last element to get the user into the game. else if ($.inArray(node, tabbableElements) == -1) { // Make sure the node isn't in another modal (ie. WYSIWYG modal). var parents = $(node).parents().get(); for (var i = 0; i < parents.length; ++i) { var position = $(parents[i]).css('position'); if (position == 'absolute' || position == 'fixed') { return true; } } if (evt.shiftKey) { lastTabbableElement.focus(); } else { firstTabbableElement.focus(); } } }; $('body').bind('keydown', modalTabTrapHandler); // Create our content div, get the dimensions, and hide it var modalContent = $('#modalContent').css('top','-1000px'); var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2); var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); $('#modalBackdrop').css(css).css('top', 0).css('height', docHeight + 'px').css('width', docWidth + 'px').show(); modalContent.css({top: mdcTop + 'px', left: mdcLeft + 'px'}).hide()[animation](speed); // Bind a click for closing the modalContent modalContentClose = function(){close(); return false;}; $('.close').bind('click', modalContentClose); // Bind a keypress on escape for closing the modalContent modalEventEscapeCloseHandler = function(event) { if (event.keyCode == 27) { close(); return false; } }; $(document).bind('keydown', modalEventEscapeCloseHandler); // Per WAI-ARIA 1.0 Authoring Practices, initial focus should be on the // close button, but we should save the original focus to restore it after // the dialog is closed. var oldFocus = document.activeElement; $('.close').focus(); // Close the open modal content and backdrop function close() { // Unbind the events $(window).unbind('resize', modalContentResize); $('body').unbind( 'focus', modalEventHandler); $('body').unbind( 'keypress', modalEventHandler ); $('body').unbind( 'keydown', modalTabTrapHandler ); $('.close').unbind('click', modalContentClose); $('body').unbind('keypress', modalEventEscapeCloseHandler); $(document).trigger('CToolsDetachBehaviors', $('#modalContent')); // Set our animation parameters and use them if ( animation == 'fadeIn' ) animation = 'fadeOut'; if ( animation == 'slideDown' ) animation = 'slideUp'; if ( animation == 'show' ) animation = 'hide'; // Close the content modalContent.hide()[animation](speed); // Remove the content $('#modalContent').remove(); $('#modalBackdrop').remove(); // Restore focus to where it was before opening the dialog $(oldFocus).focus(); }; // Move and resize the modalBackdrop and modalContent on window resize. modalContentResize = function(){ // Reset the backdrop height/width to get accurate document size. $('#modalBackdrop').css('height', '').css('width', ''); // Position code lifted from: // http://www.quirksmode.org/viewport/compatibility.html if (self.pageYOffset) { // all except Explorer var wt = self.pageYOffset; } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict var wt = document.documentElement.scrollTop; } else if (document.body) { // all other Explorers var wt = document.body.scrollTop; } // Get our heights var docHeight = $(document).height(); var docWidth = $(document).width(); var winHeight = $(window).height(); var winWidth = $(window).width(); if( docHeight < winHeight ) docHeight = winHeight; // Get where we should move content to var modalContent = $('#modalContent'); var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2); var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); // Apply the changes $('#modalBackdrop').css('height', docHeight + 'px').css('width', docWidth + 'px').show(); modalContent.css('top', mdcTop + 'px').css('left', mdcLeft + 'px').show(); }; $(window).bind('resize', modalContentResize); }; /** * unmodalContent * @param content (The jQuery object to remove) * @param animation (fadeOut, slideUp, show) * @param speed (valid animation speeds slow, medium, fast or # in ms) */ Drupal.CTools.Modal.unmodalContent = function(content, animation, speed) { // If our animation isn't set, make it just show/pop if (!animation) { var animation = 'show'; } else { // If our animation isn't "fade" then it always is show if (( animation != 'fadeOut' ) && ( animation != 'slideUp')) animation = 'show'; } // Set a speed if we dont have one if ( !speed ) var speed = 'fast'; // Unbind the events we bound $(window).unbind('resize', modalContentResize); $('body').unbind('focus', modalEventHandler); $('body').unbind('keypress', modalEventHandler); $('body').unbind( 'keydown', modalTabTrapHandler ); $('.close').unbind('click', modalContentClose); $('body').unbind('keypress', modalEventEscapeCloseHandler); $(document).trigger('CToolsDetachBehaviors', $('#modalContent')); // jQuery magic loop through the instances and run the animations or removal. content.each(function(){ if ( animation == 'fade' ) { $('#modalContent').fadeOut(speed, function() { $('#modalBackdrop').fadeOut(speed, function() { $(this).remove(); }); $(this).remove(); }); } else { if ( animation == 'slide' ) { $('#modalContent').slideUp(speed,function() { $('#modalBackdrop').slideUp(speed, function() { $(this).remove(); }); $(this).remove(); }); } else { $('#modalContent').remove(); $('#modalBackdrop').remove(); } } }); }; $(function() { Drupal.ajax.prototype.commands.modal_display = Drupal.CTools.Modal.modal_display; Drupal.ajax.prototype.commands.modal_dismiss = Drupal.CTools.Modal.modal_dismiss; }); })(jQuery); ; /** * Provide the HTML to create the modal dialog. */ Drupal.theme.prototype.ModalFormsPopup = function () { var html = ''; html += '
'; html += ' '; html += '
'; return html; } ; "function"!==typeof Object.create&&(Object.create=function(f){function g(){}g.prototype=f;return new g}); (function(f,g,k){var l={init:function(a,b){this.$elem=f(b);this.options=f.extend({},f.fn.owlCarousel.options,this.$elem.data(),a);this.userOptions=a;this.loadContent()},loadContent:function(){function a(a){var d,e="";if("function"===typeof b.options.jsonSuccess)b.options.jsonSuccess.apply(this,[a]);else{for(d in a.owl)a.owl.hasOwnProperty(d)&&(e+=a.owl[d].item);b.$elem.html(e)}b.logIn()}var b=this,e;"function"===typeof b.options.beforeInit&&b.options.beforeInit.apply(this,[b.$elem]);"string"===typeof b.options.jsonPath? (e=b.options.jsonPath,f.getJSON(e,a)):b.logIn()},logIn:function(){this.$elem.data("owl-originalStyles",this.$elem.attr("style"));this.$elem.data("owl-originalClasses",this.$elem.attr("class"));this.$elem.css({opacity:0});this.orignalItems=this.options.items;this.checkBrowser();this.wrapperWidth=0;this.checkVisible=null;this.setVars()},setVars:function(){if(0===this.$elem.children().length)return!1;this.baseClass();this.eventTypes();this.$userItems=this.$elem.children();this.itemsAmount=this.$userItems.length; this.wrapItems();this.$owlItems=this.$elem.find(".owl-item");this.$owlWrapper=this.$elem.find(".owl-wrapper");this.playDirection="next";this.prevItem=0;this.prevArr=[0];this.currentItem=0;this.customEvents();this.onStartup()},onStartup:function(){this.updateItems();this.calculateAll();this.buildControls();this.updateControls();this.response();this.moveEvents();this.stopOnHover();this.owlStatus();!1!==this.options.transitionStyle&&this.transitionTypes(this.options.transitionStyle);!0===this.options.autoPlay&& (this.options.autoPlay=5E3);this.play();this.$elem.find(".owl-wrapper").css("display","block");this.$elem.is(":visible")?this.$elem.css("opacity",1):this.watchVisibility();this.onstartup=!1;this.eachMoveUpdate();"function"===typeof this.options.afterInit&&this.options.afterInit.apply(this,[this.$elem])},eachMoveUpdate:function(){!0===this.options.lazyLoad&&this.lazyLoad();!0===this.options.autoHeight&&this.autoHeight();this.onVisibleItems();"function"===typeof this.options.afterAction&&this.options.afterAction.apply(this, [this.$elem])},updateVars:function(){"function"===typeof this.options.beforeUpdate&&this.options.beforeUpdate.apply(this,[this.$elem]);this.watchVisibility();this.updateItems();this.calculateAll();this.updatePosition();this.updateControls();this.eachMoveUpdate();"function"===typeof this.options.afterUpdate&&this.options.afterUpdate.apply(this,[this.$elem])},reload:function(){var a=this;g.setTimeout(function(){a.updateVars()},0)},watchVisibility:function(){var a=this;if(!1===a.$elem.is(":visible"))a.$elem.css({opacity:0}), g.clearInterval(a.autoPlayInterval),g.clearInterval(a.checkVisible);else return!1;a.checkVisible=g.setInterval(function(){a.$elem.is(":visible")&&(a.reload(),a.$elem.animate({opacity:1},200),g.clearInterval(a.checkVisible))},500)},wrapItems:function(){this.$userItems.wrapAll('
').wrap('
');this.$elem.find(".owl-wrapper").wrap('
');this.wrapperOuter=this.$elem.find(".owl-wrapper-outer");this.$elem.css("display","block")}, baseClass:function(){var a=this.$elem.hasClass(this.options.baseClass),b=this.$elem.hasClass(this.options.theme);a||this.$elem.addClass(this.options.baseClass);b||this.$elem.addClass(this.options.theme)},updateItems:function(){var a,b;if(!1===this.options.responsive)return!1;if(!0===this.options.singleItem)return this.options.items=this.orignalItems=1,this.options.itemsCustom=!1,this.options.itemsDesktop=!1,this.options.itemsDesktopSmall=!1,this.options.itemsTablet=!1,this.options.itemsTabletSmall= !1,this.options.itemsMobile=!1;a=f(this.options.responsiveBaseWidth).width();a>(this.options.itemsDesktop[0]||this.orignalItems)&&(this.options.items=this.orignalItems);if(!1!==this.options.itemsCustom)for(this.options.itemsCustom.sort(function(a,b){return a[0]-b[0]}),b=0;bthis.itemsAmount&& !0===this.options.itemsScaleUp&&(this.options.items=this.itemsAmount)},response:function(){var a=this,b,e;if(!0!==a.options.responsive)return!1;e=f(g).width();a.resizer=function(){f(g).width()!==e&&(!1!==a.options.autoPlay&&g.clearInterval(a.autoPlayInterval),g.clearTimeout(b),b=g.setTimeout(function(){e=f(g).width();a.updateVars()},a.options.responsiveRefreshRate))};f(g).resize(a.resizer)},updatePosition:function(){this.jumpTo(this.currentItem);!1!==this.options.autoPlay&&this.checkAp()},appendItemsSizes:function(){var a= this,b=0,e=a.itemsAmount-a.options.items;a.$owlItems.each(function(c){var d=f(this);d.css({width:a.itemWidth}).data("owl-item",Number(c));if(0===c%a.options.items||c===e)c>e||(b+=1);d.data("owl-roundPages",b)})},appendWrapperSizes:function(){this.$owlWrapper.css({width:this.$owlItems.length*this.itemWidth*2,left:0});this.appendItemsSizes()},calculateAll:function(){this.calculateWidth();this.appendWrapperSizes();this.loops();this.max()},calculateWidth:function(){this.itemWidth=Math.round(this.$elem.width()/ this.options.items)},max:function(){var a=-1*(this.itemsAmount*this.itemWidth-this.options.items*this.itemWidth);this.options.items>this.itemsAmount?this.maximumPixels=a=this.maximumItem=0:(this.maximumItem=this.itemsAmount-this.options.items,this.maximumPixels=a);return a},min:function(){return 0},loops:function(){var a=0,b=0,e,c;this.positionsInArray=[0];this.pagesInArray=[];for(e=0;e').toggleClass("clickable",!this.browser.isTouch).appendTo(this.$elem);!0===this.options.pagination&&this.buildPagination();!0===this.options.navigation&&this.buildButtons()},buildButtons:function(){var a=this,b=f('
');a.owlControls.append(b);a.buttonPrev= f("
",{"class":"owl-prev",html:a.options.navigationText[0]||""});a.buttonNext=f("
",{"class":"owl-next",html:a.options.navigationText[1]||""});b.append(a.buttonPrev).append(a.buttonNext);b.on("touchstart.owlControls mousedown.owlControls",'div[class^="owl"]',function(a){a.preventDefault()});b.on("touchend.owlControls mouseup.owlControls",'div[class^="owl"]',function(b){b.preventDefault();f(this).hasClass("owl-next")?a.next():a.prev()})},buildPagination:function(){var a=this;a.paginationWrapper= f('
');a.owlControls.append(a.paginationWrapper);a.paginationWrapper.on("touchend.owlControls mouseup.owlControls",".owl-page",function(b){b.preventDefault();Number(f(this).data("owl-page"))!==a.currentItem&&a.goTo(Number(f(this).data("owl-page")),!0)})},updatePagination:function(){var a,b,e,c,d,g;if(!1===this.options.pagination)return!1;this.paginationWrapper.html("");a=0;b=this.itemsAmount-this.itemsAmount%this.options.items;for(c=0;c",{"class":"owl-page"}),g=f("",{text:!0===this.options.paginationNumbers?a:"","class":!0===this.options.paginationNumbers?"owl-numbers":""}),d.append(g),d.data("owl-page",b===c?e:c),d.data("owl-roundPages",a),this.paginationWrapper.append(d));this.checkPagination()},checkPagination:function(){var a=this;if(!1===a.options.pagination)return!1;a.paginationWrapper.find(".owl-page").each(function(){f(this).data("owl-roundPages")=== f(a.$owlItems[a.currentItem]).data("owl-roundPages")&&(a.paginationWrapper.find(".owl-page").removeClass("active"),f(this).addClass("active"))})},checkNavigation:function(){if(!1===this.options.navigation)return!1;!1===this.options.rewindNav&&(0===this.currentItem&&0===this.maximumItem?(this.buttonPrev.addClass("disabled"),this.buttonNext.addClass("disabled")):0===this.currentItem&&0!==this.maximumItem?(this.buttonPrev.addClass("disabled"),this.buttonNext.removeClass("disabled")):this.currentItem=== this.maximumItem?(this.buttonPrev.removeClass("disabled"),this.buttonNext.addClass("disabled")):0!==this.currentItem&&this.currentItem!==this.maximumItem&&(this.buttonPrev.removeClass("disabled"),this.buttonNext.removeClass("disabled")))},updateControls:function(){this.updatePagination();this.checkNavigation();this.owlControls&&(this.options.items>=this.itemsAmount?this.owlControls.hide():this.owlControls.show())},destroyControls:function(){this.owlControls&&this.owlControls.remove()},next:function(a){if(this.isTransition)return!1; this.currentItem+=!0===this.options.scrollPerPage?this.options.items:1;if(this.currentItem>this.maximumItem+(!0===this.options.scrollPerPage?this.options.items-1:0))if(!0===this.options.rewindNav)this.currentItem=0,a="rewind";else return this.currentItem=this.maximumItem,!1;this.goTo(this.currentItem,a)},prev:function(a){if(this.isTransition)return!1;this.currentItem=!0===this.options.scrollPerPage&&0this.currentItem)if(!0===this.options.rewindNav)this.currentItem=this.maximumItem,a="rewind";else return this.currentItem=0,!1;this.goTo(this.currentItem,a)},goTo:function(a,b,e){var c=this;if(c.isTransition)return!1;"function"===typeof c.options.beforeMove&&c.options.beforeMove.apply(this,[c.$elem]);a>=c.maximumItem?a=c.maximumItem:0>=a&&(a=0);c.currentItem=c.owl.currentItem=a;if(!1!==c.options.transitionStyle&&"drag"!==e&&1===c.options.items&&!0===c.browser.support3d)return c.swapSpeed(0), !0===c.browser.support3d?c.transition3d(c.positionsInArray[a]):c.css2slide(c.positionsInArray[a],1),c.afterGo(),c.singleItemTransition(),!1;a=c.positionsInArray[a];!0===c.browser.support3d?(c.isCss3Finish=!1,!0===b?(c.swapSpeed("paginationSpeed"),g.setTimeout(function(){c.isCss3Finish=!0},c.options.paginationSpeed)):"rewind"===b?(c.swapSpeed(c.options.rewindSpeed),g.setTimeout(function(){c.isCss3Finish=!0},c.options.rewindSpeed)):(c.swapSpeed("slideSpeed"),g.setTimeout(function(){c.isCss3Finish=!0}, c.options.slideSpeed)),c.transition3d(a)):!0===b?c.css2slide(a,c.options.paginationSpeed):"rewind"===b?c.css2slide(a,c.options.rewindSpeed):c.css2slide(a,c.options.slideSpeed);c.afterGo()},jumpTo:function(a){"function"===typeof this.options.beforeMove&&this.options.beforeMove.apply(this,[this.$elem]);a>=this.maximumItem||-1===a?a=this.maximumItem:0>=a&&(a=0);this.swapSpeed(0);!0===this.browser.support3d?this.transition3d(this.positionsInArray[a]):this.css2slide(this.positionsInArray[a],1);this.currentItem= this.owl.currentItem=a;this.afterGo()},afterGo:function(){this.prevArr.push(this.currentItem);this.prevItem=this.owl.prevItem=this.prevArr[this.prevArr.length-2];this.prevArr.shift(0);this.prevItem!==this.currentItem&&(this.checkPagination(),this.checkNavigation(),this.eachMoveUpdate(),!1!==this.options.autoPlay&&this.checkAp());"function"===typeof this.options.afterMove&&this.prevItem!==this.currentItem&&this.options.afterMove.apply(this,[this.$elem])},stop:function(){this.apStatus="stop";g.clearInterval(this.autoPlayInterval)}, checkAp:function(){"stop"!==this.apStatus&&this.play()},play:function(){var a=this;a.apStatus="play";if(!1===a.options.autoPlay)return!1;g.clearInterval(a.autoPlayInterval);a.autoPlayInterval=g.setInterval(function(){a.next(!0)},a.options.autoPlay)},swapSpeed:function(a){"slideSpeed"===a?this.$owlWrapper.css(this.addCssSpeed(this.options.slideSpeed)):"paginationSpeed"===a?this.$owlWrapper.css(this.addCssSpeed(this.options.paginationSpeed)):"string"!==typeof a&&this.$owlWrapper.css(this.addCssSpeed(a))}, addCssSpeed:function(a){return{"-webkit-transition":"all "+a+"ms ease","-moz-transition":"all "+a+"ms ease","-o-transition":"all "+a+"ms ease",transition:"all "+a+"ms ease"}},removeTransition:function(){return{"-webkit-transition":"","-moz-transition":"","-o-transition":"",transition:""}},doTranslate:function(a){return{"-webkit-transform":"translate3d("+a+"px, 0px, 0px)","-moz-transform":"translate3d("+a+"px, 0px, 0px)","-o-transform":"translate3d("+a+"px, 0px, 0px)","-ms-transform":"translate3d("+ a+"px, 0px, 0px)",transform:"translate3d("+a+"px, 0px,0px)"}},transition3d:function(a){this.$owlWrapper.css(this.doTranslate(a))},css2move:function(a){this.$owlWrapper.css({left:a})},css2slide:function(a,b){var e=this;e.isCssFinish=!1;e.$owlWrapper.stop(!0,!0).animate({left:a},{duration:b||e.options.slideSpeed,complete:function(){e.isCssFinish=!0}})},checkBrowser:function(){var a=k.createElement("div");a.style.cssText=" -moz-transform:translate3d(0px, 0px, 0px); -ms-transform:translate3d(0px, 0px, 0px); -o-transform:translate3d(0px, 0px, 0px); -webkit-transform:translate3d(0px, 0px, 0px); transform:translate3d(0px, 0px, 0px)"; a=a.style.cssText.match(/translate3d\(0px, 0px, 0px\)/g);this.browser={support3d:null!==a&&1===a.length,isTouch:"ontouchstart"in g||g.navigator.msMaxTouchPoints}},moveEvents:function(){if(!1!==this.options.mouseDrag||!1!==this.options.touchDrag)this.gestures(),this.disabledEvents()},eventTypes:function(){var a=["s","e","x"];this.ev_types={};!0===this.options.mouseDrag&&!0===this.options.touchDrag?a=["touchstart.owl mousedown.owl","touchmove.owl mousemove.owl","touchend.owl touchcancel.owl mouseup.owl"]: !1===this.options.mouseDrag&&!0===this.options.touchDrag?a=["touchstart.owl","touchmove.owl","touchend.owl touchcancel.owl"]:!0===this.options.mouseDrag&&!1===this.options.touchDrag&&(a=["mousedown.owl","mousemove.owl","mouseup.owl"]);this.ev_types.start=a[0];this.ev_types.move=a[1];this.ev_types.end=a[2]},disabledEvents:function(){this.$elem.on("dragstart.owl",function(a){a.preventDefault()});this.$elem.on("mousedown.disableTextSelect",function(a){return f(a.target).is("input, textarea, select, option")})}, gestures:function(){function a(a){if(void 0!==a.touches)return{x:a.touches[0].pageX,y:a.touches[0].pageY};if(void 0===a.touches){if(void 0!==a.pageX)return{x:a.pageX,y:a.pageY};if(void 0===a.pageX)return{x:a.clientX,y:a.clientY}}}function b(a){"on"===a?(f(k).on(d.ev_types.move,e),f(k).on(d.ev_types.end,c)):"off"===a&&(f(k).off(d.ev_types.move),f(k).off(d.ev_types.end))}function e(b){b=b.originalEvent||b||g.event;d.newPosX=a(b).x-h.offsetX;d.newPosY=a(b).y-h.offsetY;d.newRelativeX=d.newPosX-h.relativePos; "function"===typeof d.options.startDragging&&!0!==h.dragging&&0!==d.newRelativeX&&(h.dragging=!0,d.options.startDragging.apply(d,[d.$elem]));(8d.newRelativeX)&&!0===d.browser.isTouch&&(void 0!==b.preventDefault?b.preventDefault():b.returnValue=!1,h.sliding=!0);(10d.newPosY)&&!1===h.sliding&&f(k).off("touchmove.owl");d.newPosX=Math.max(Math.min(d.newPosX,d.newRelativeX/5),d.maximumPixels+d.newRelativeX/5);!0===d.browser.support3d?d.transition3d(d.newPosX):d.css2move(d.newPosX)} function c(a){a=a.originalEvent||a||g.event;var c;a.target=a.target||a.srcElement;h.dragging=!1;!0!==d.browser.isTouch&&d.$owlWrapper.removeClass("grabbing");d.dragDirection=0>d.newRelativeX?d.owl.dragDirection="left":d.owl.dragDirection="right";0!==d.newRelativeX&&(c=d.getNewPosition(),d.goTo(c,!1,"drag"),h.targetElement===a.target&&!0!==d.browser.isTouch&&(f(a.target).on("click.disable",function(a){a.stopImmediatePropagation();a.stopPropagation();a.preventDefault();f(a.target).off("click.disable")}), a=f._data(a.target,"events").click,c=a.pop(),a.splice(0,0,c)));b("off")}var d=this,h={offsetX:0,offsetY:0,baseElWidth:0,relativePos:0,position:null,minSwipe:null,maxSwipe:null,sliding:null,dargging:null,targetElement:null};d.isCssFinish=!0;d.$elem.on(d.ev_types.start,".owl-wrapper",function(c){c=c.originalEvent||c||g.event;var e;if(3===c.which)return!1;if(!(d.itemsAmount<=d.options.items)){if(!1===d.isCssFinish&&!d.options.dragBeforeAnimFinish||!1===d.isCss3Finish&&!d.options.dragBeforeAnimFinish)return!1; !1!==d.options.autoPlay&&g.clearInterval(d.autoPlayInterval);!0===d.browser.isTouch||d.$owlWrapper.hasClass("grabbing")||d.$owlWrapper.addClass("grabbing");d.newPosX=0;d.newRelativeX=0;f(this).css(d.removeTransition());e=f(this).position();h.relativePos=e.left;h.offsetX=a(c).x-e.left;h.offsetY=a(c).y-e.top;b("on");h.sliding=!1;h.targetElement=c.target||c.srcElement}})},getNewPosition:function(){var a=this.closestItem();a>this.maximumItem?a=this.currentItem=this.maximumItem:0<=this.newPosX&&(this.currentItem= a=0);return a},closestItem:function(){var a=this,b=!0===a.options.scrollPerPage?a.pagesInArray:a.positionsInArray,e=a.newPosX,c=null;f.each(b,function(d,g){e-a.itemWidth/20>b[d+1]&&e-a.itemWidth/20(b[d+1]||b[d]-a.itemWidth)&&"right"===a.moveDirection()&&(!0===a.options.scrollPerPage?(c=b[d+1]||b[b.length-1],a.currentItem=f.inArray(c,a.positionsInArray)): (c=b[d+1],a.currentItem=d+1))});return a.currentItem},moveDirection:function(){var a;0>this.newRelativeX?(a="right",this.playDirection="next"):(a="left",this.playDirection="prev");return a},customEvents:function(){var a=this;a.$elem.on("owl.next",function(){a.next()});a.$elem.on("owl.prev",function(){a.prev()});a.$elem.on("owl.play",function(b,e){a.options.autoPlay=e;a.play();a.hoverStatus="play"});a.$elem.on("owl.stop",function(){a.stop();a.hoverStatus="stop"});a.$elem.on("owl.goTo",function(b,e){a.goTo(e)}); a.$elem.on("owl.jumpTo",function(b,e){a.jumpTo(e)})},stopOnHover:function(){var a=this;!0===a.options.stopOnHover&&!0!==a.browser.isTouch&&!1!==a.options.autoPlay&&(a.$elem.on("mouseover",function(){a.stop()}),a.$elem.on("mouseout",function(){"stop"!==a.hoverStatus&&a.play()}))},lazyLoad:function(){var a,b,e,c,d;if(!1===this.options.lazyLoad)return!1;for(a=0;a=this.currentItem:!0)&&e=f?g.setTimeout(c,100):e()}var d=this,f=0,k;"DIV"===b.prop("tagName")?(b.css("background-image","url("+b.data("src")+")"),k=!0):b[0].src=b.data("src");c()},autoHeight:function(){function a(){var a=f(e.$owlItems[e.currentItem]).height();e.wrapperOuter.css("height",a+"px");e.wrapperOuter.hasClass("autoHeight")||g.setTimeout(function(){e.wrapperOuter.addClass("autoHeight")},0)}function b(){d+=1;e.completeImg(c.get(0))?a():100>=d?g.setTimeout(b, 100):e.wrapperOuter.css("height","")}var e=this,c=f(e.$owlItems[e.currentItem]).find("img"),d;void 0!==c.get(0)?(d=0,b()):a()},completeImg:function(a){return!a.complete||"undefined"!==typeof a.naturalWidth&&0===a.naturalWidth?!1:!0},onVisibleItems:function(){var a;!0===this.options.addClassActive&&this.$owlItems.removeClass("active");this.visibleItems=[];for(a=this.currentItem;a=this.$userItems.length||-1===e?this.$userItems.eq(-1).after(a):this.$userItems.eq(e).before(a);this.setVars()},removeItem:function(a){if(0===this.$elem.children().length)return!1;a=void 0===a||-1===a?-1:a;this.unWrap();this.$userItems.eq(a).remove();this.setVars()}};f.fn.owlCarousel=function(a){return this.each(function(){if(!0=== f(this).data("owl-init"))return!1;f(this).data("owl-init",!0);var b=Object.create(l);b.init(a,this);f.data(this,"owlCarousel",b)})};f.fn.owlCarousel.options={items:5,itemsCustom:!1,itemsDesktop:[1199,4],itemsDesktopSmall:[979,3],itemsTablet:[768,2],itemsTabletSmall:!1,itemsMobile:[479,1],singleItem:!1,itemsScaleUp:!1,slideSpeed:200,paginationSpeed:800,rewindSpeed:1E3,autoPlay:!1,stopOnHover:!1,navigation:!1,navigationText:["prev","next"],rewindNav:!0,scrollPerPage:!1,pagination:!0,paginationNumbers:!1, responsive:!0,responsiveRefreshRate:200,responsiveBaseWidth:g,baseClass:"owl-carousel",theme:"owl-theme",lazyLoad:!1,lazyFollow:!0,lazyEffect:"fade",autoHeight:!1,jsonPath:!1,jsonSuccess:!1,dragBeforeAnimFinish:!0,mouseDrag:!0,touchDrag:!0,addClassActive:!1,transitionStyle:!1,beforeUpdate:!1,afterUpdate:!1,beforeInit:!1,afterInit:!1,beforeMove:!1,afterMove:!1,afterAction:!1,startDragging:!1,afterLazyLoad:!1}})(jQuery,window,document);; (function($){Drupal.behaviors.verticalTabs={attach:function(context){$(".vertical-tabs-panes",context).once("vertical-tabs",function(){var focusID=$(":hidden.vertical-tabs-active-tab",this).val();var tab_focus;var $fieldsets=$("> fieldset",this);if($fieldsets.length==0)return;var tab_list=$('
    ');$(this).wrap('
    ').before(tab_list);$fieldsets.each(function(){var vertical_tab=new Drupal.verticalTab({title:$("> legend",this).text(), fieldset:$(this)});tab_list.append(vertical_tab.item);$(this).removeClass("collapsible collapsed").addClass("vertical-tabs-pane").data("verticalTab",vertical_tab);if(this.id==focusID)tab_focus=$(this)});$("> li:first",tab_list).addClass("first");$("> li:last",tab_list).addClass("last");if(!tab_focus)if(window.location.hash&&$(this).find(window.location.hash).length)tab_focus=$(this).find(window.location.hash).closest(".vertical-tabs-pane");else tab_focus=$("> .vertical-tabs-pane:first",this);if(tab_focus.length)tab_focus.data("verticalTab").focus()})}}; Drupal.verticalTab=function(settings){var self=this;$.extend(this,settings,Drupal.theme("verticalTab",settings));this.link.click(function(){self.focus();return false});this.link.keydown(function(event){if(event.keyCode==13){self.focus();$("fieldset.vertical-tabs-pane :input:visible:enabled:first").focus();return false}});this.fieldset.bind("summaryUpdated",function(){self.updateSummary()}).trigger("summaryUpdated")};Drupal.verticalTab.prototype={focus:function(){this.fieldset.siblings("fieldset.vertical-tabs-pane").each(function(){var tab= $(this).data("verticalTab");tab.fieldset.hide();tab.item.removeClass("selected")}).end().show().siblings(":hidden.vertical-tabs-active-tab").val(this.fieldset.attr("id"));this.item.addClass("selected");$("#active-vertical-tab").remove();this.link.append(''+Drupal.t("(active tab)")+"")},updateSummary:function(){this.summary.html(this.fieldset.drupalGetSummary())},tabShow:function(){this.item.show();this.item.closest(".vertical-tabs").show(); this.item.parent().children(".vertical-tab-button").removeClass("first").filter(":visible:first").addClass("first");this.fieldset.removeClass("vertical-tab-hidden").show();this.focus();return this},tabHide:function(){this.item.hide();this.item.parent().children(".vertical-tab-button").removeClass("first").filter(":visible:first").addClass("first");this.fieldset.addClass("vertical-tab-hidden").hide();var $firstTab=this.fieldset.siblings(".vertical-tabs-pane:not(.vertical-tab-hidden):first");if($firstTab.length)$firstTab.data("verticalTab").focus(); else this.item.closest(".vertical-tabs").hide();return this}};Drupal.theme.prototype.verticalTab=function(settings){var tab={};tab.item=$('
  • ').append(tab.link=$('').append(tab.title=$("").text(settings.title)).append(tab.summary=$('')));return tab}})(jQuery);; Drupal.TBMegaMenu = Drupal.TBMegaMenu || {}; (function ($) { Drupal.TBMegaMenu.oldWindowWidth = 0; Drupal.TBMegaMenu.displayedMenuMobile = false; Drupal.TBMegaMenu.supportedScreens = [980]; Drupal.TBMegaMenu.menuResponsive = function () { var windowWidth = window.innerWidth ? window.innerWidth : $(window).width(); var navCollapse = $('.tb-megamenu').children('.nav-collapse'); if (windowWidth < Drupal.TBMegaMenu.supportedScreens[0]) { navCollapse.addClass('collapse'); if (Drupal.TBMegaMenu.displayedMenuMobile) { navCollapse.css({height: 'auto', overflow: 'visible'}); } else { navCollapse.css({height: 0, overflow: 'hidden'}); } } else { // If width of window is greater than 980 (supported screen). navCollapse.removeClass('collapse'); if (navCollapse.height() <= 0) { navCollapse.css({height: 'auto', overflow: 'visible'}); } } }; Drupal.behaviors.tbMegaMenuAction = { attach: function(context) { $('.tb-megamenu-button', context).once('menuIstance', function () { var This = this; $(This).click(function() { if(parseInt($(this).parent().children('.nav-collapse').height())) { $(this).parent().children('.nav-collapse').css({height: 0, overflow: 'hidden'}); Drupal.TBMegaMenu.displayedMenuMobile = false; } else { $(this).parent().children('.nav-collapse').css({height: 'auto', overflow: 'visible'}); Drupal.TBMegaMenu.displayedMenuMobile = true; } }); }); var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion); if(!isTouch){ $(document).ready(function($){ var mm_duration = 0; $('.tb-megamenu').each (function(){ if ($(this).data('duration')) { mm_duration = $(this).data('duration'); } }); var mm_timeout = mm_duration ? 100 + mm_duration : 500; $('.nav > li, li.mega').hover(function(event) { var $this = $(this); if ($this.hasClass ('mega')) { $this.addClass ('animating'); clearTimeout ($this.data('animatingTimeout')); $this.data('animatingTimeout', setTimeout(function(){$this.removeClass ('animating')}, mm_timeout)); clearTimeout ($this.data('hoverTimeout')); $this.data('hoverTimeout', setTimeout(function(){$this.addClass ('open')}, 100)); } else { clearTimeout ($this.data('hoverTimeout')); $this.data('hoverTimeout', setTimeout(function(){$this.addClass ('open')}, 100)); } }, function(event) { var $this = $(this); if ($this.hasClass ('mega')) { $this.addClass ('animating'); clearTimeout ($this.data('animatingTimeout')); $this.data('animatingTimeout', setTimeout(function(){$this.removeClass ('animating')}, mm_timeout)); clearTimeout ($this.data('hoverTimeout')); $this.data('hoverTimeout', setTimeout(function(){$this.removeClass ('open')}, 100)); } else { clearTimeout ($this.data('hoverTimeout')); $this.data('hoverTimeout', setTimeout(function(){$this.removeClass ('open')}, 100)); } }); }); } $(window).resize(function() { var windowWidth = window.innerWidth ? window.innerWidth : $(window).width(); if(windowWidth != Drupal.TBMegaMenu.oldWindowWidth){ Drupal.TBMegaMenu.oldWindowWidth = windowWidth; Drupal.TBMegaMenu.menuResponsive(); } }); }, } })(jQuery); ; Drupal.TBMegaMenu = Drupal.TBMegaMenu || {}; (function ($) { Drupal.TBMegaMenu.createTouchMenu = function(items) { items.children('a').each( function() { var $item = $(this); var tbitem = $(this).parent(); $item.click( function(event){ if ($item.hasClass('tb-megamenu-clicked')) { var $uri = $item.attr('href'); window.location.href = $uri; } else { event.preventDefault(); $item.addClass('tb-megamenu-clicked'); if(!tbitem.hasClass('open')){ tbitem.addClass('open'); } } }).closest('li').mouseleave( function(){ $item.removeClass('tb-megamenu-clicked'); tbitem.removeClass('open'); }); }); /* items.children('a').children('span.caret').each( function() { var $item = $(this).parent(); $item.click(function(event){ tbitem = $item.parent(); if ($item.hasClass('tb-megamenu-clicked')) { Drupal.TBMegaMenu.eventStopPropagation(event); if(tbitem.hasClass('open')){ tbitem.removeClass('open'); $item.removeClass('tb-megamenu-clicked'); } } else { Drupal.TBMegaMenu.eventStopPropagation(event); $item.addClass('tb-megamenu-clicked'); if(!tbitem.hasClass('open')){ tbitem.addClass('open'); $item.removeClass('tb-megamenu-clicked'); } } }); }); */ } Drupal.TBMegaMenu.eventStopPropagation = function(event) { if (event.stopPropagation) { event.stopPropagation(); } else if (window.event) { window.event.cancelBubble = true; } } Drupal.behaviors.tbMegaMenuTouchAction = { attach: function(context) { var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion); if(isTouch){ $('html').addClass('touch'); Drupal.TBMegaMenu.createTouchMenu($('.tb-megamenu ul.nav li.mega').has('.dropdown-menu')); } } } })(jQuery); ;