/(function($){ Drupal.behaviors.block_carousel = { attach: function (context, settings) { if ($('.page-node .owl-carousel-rte').length) { $('.owl-carousel-rte').owlCarousel({ pagination: false, navigation: true, // Show next and prev buttons slideSpeed: 300, paginationSpeed: 400, singleItem: true, // "singleItem:true" is a shortcut for: // items : 1, // itemsDesktop : false, // itemsDesktopSmall : false, // itemsTablet: false, itemsMobile: false }); } } }; })(jQuery); ;/*})'"*/ ;/*})'"*/ /** * @file better_exposed_filters.js * * Provides some client-side functionality for the Better Exposed Filters module */ (function ($) { Drupal.behaviors.betterExposedFilters = { attach: function(context) { // Add highlight class to checked checkboxes for better theming $('.bef-tree input[type=checkbox], .bef-checkboxes input[type=checkbox]') // Highlight newly selected checkboxes .change(function() { _bef_highlight(this, context); }) .filter(':checked').closest('.form-item', context).addClass('highlight') ; } }; Drupal.behaviors.betterExposedFiltersSelectAllNone = { attach: function(context) { /* * Add Select all/none links to specified checkboxes */ var selected = $('.form-checkboxes.bef-select-all-none:not(.bef-processed)'); if (selected.length) { var selAll = Drupal.t('Select All'); var selNone = Drupal.t('Select None'); // Set up a prototype link and event handlers var link = $(''+ selAll +'') link.click(function(event) { // Don't actually follow the link... event.preventDefault(); event.stopPropagation(); if (selAll == $(this).text()) { // Select all the checkboxes $(this) .html(selNone) .siblings('.bef-checkboxes, .bef-tree') .find('.form-item input:checkbox').each(function() { $(this).attr('checked', true); _bef_highlight(this, context); }) .end() // attr() doesn't trigger a change event, so we do it ourselves. But just on // one checkbox otherwise we have many spinning cursors .find('input[type=checkbox]:first').change() ; } else { // Unselect all the checkboxes $(this) .html(selAll) .siblings('.bef-checkboxes, .bef-tree') .find('.form-item input:checkbox').each(function() { $(this).attr('checked', false); _bef_highlight(this, context); }) .end() // attr() doesn't trigger a change event, so we do it ourselves. But just on // one checkbox otherwise we have many spinning cursors .find('input[type=checkbox]:first').change() ; } }); // Add link to the page for each set of checkboxes. selected .addClass('bef-processed') .each(function(index) { // Clone the link prototype and insert into the DOM var newLink = link.clone(true); newLink.insertBefore($('.bef-checkboxes, .bef-tree', this)); // If all checkboxes are already checked by default then switch to Select None if ($('input:checkbox:checked', this).length == $('input:checkbox', this).length) { newLink.click(); } }) ; } // Check for and initialize datepickers var befSettings = Drupal.settings.better_exposed_filters; if (befSettings && befSettings.datepicker && befSettings.datepicker_options && $.fn.datepicker) { var opt = []; $.each(befSettings.datepicker_options, function(key, val) { if (key && val) { opt[key] = JSON.parse(val); } }); $('.bef-datepicker').datepicker(opt); } } // attach: function() { }; // Drupal.behaviors.better_exposed_filters = { Drupal.behaviors.betterExposedFiltersAllNoneNested = { attach:function (context, settings) { $('.form-checkboxes.bef-select-all-none-nested li').has('ul').once('bef-all-none-nested', function () { $(this) // To respect term depth, check/uncheck child term checkboxes. .find('input.form-checkboxes:first') .click(function() { var checkedParent = $(this).attr('checked'); if (!checkedParent) { // Uncheck all children if parent is unchecked. $(this).parents('li:first').find('ul input.form-checkboxes').removeAttr('checked'); } else { // Check all children if parent is checked. $(this).parents('li:first').find('ul input.form-checkboxes').attr('checked', $(this).attr('checked')); } }) .end() // When a child term is checked or unchecked, set the parent term's // status. .find('ul input.form-checkboxes') .click(function() { var checked = $(this).attr('checked'); // Determine the number of unchecked sibling checkboxes. var ct = $(this).parents('ul:first').find('input.form-checkboxes:not(:checked)').size(); // If the child term is unchecked, uncheck the parent. if (!checked) { // Uncheck parent if any of the childres is unchecked. $(this).parents('li:first').parents('li:first').find('input.form-checkboxes:first').removeAttr('checked'); } // If all sibling terms are checked, check the parent. if (!ct) { // Check the parent if all the children are checked. $(this).parents('li:first').parents('li:first').find('input.form-checkboxes:first').attr('checked', checked); } }); }); } }; Drupal.behaviors.better_exposed_filters_slider = { attach: function(context, settings) { var befSettings = settings.better_exposed_filters; if (befSettings && befSettings.slider && befSettings.slider_options) { $.each(befSettings.slider_options, function(i, sliderOptions) { var containing_parent = "#" + sliderOptions.viewId + " #edit-" + sliderOptions.id + "-wrapper .views-widget"; var $filter = $(containing_parent); // If the filter is placed in a secondary fieldset, we may not have // the usual wrapper element. if (!$filter.length) { containing_parent = "#" + sliderOptions.viewId + " .bef-slider-wrapper"; $filter = $(containing_parent); } // Only make one slider per filter. $filter.once('slider-filter', function() { var $input = $(this).find('input[type=text]'); // This is a "between" or "not between" filter with two values. if ($input.length == 2) { var $min = $input.parent().find('input#edit-' + sliderOptions.id + '-min'), $max = $input.parent().find('input#edit-' + sliderOptions.id + '-max'), default_min, default_max; if (!$min.length || !$max.length) { return; } // Get the default values. // We use slider min & max if there are no defaults. default_min = parseFloat(($min.val() == '') ? sliderOptions.min : $min.val(), 10); default_max = parseFloat(($max.val() == '') ? sliderOptions.max : $max.val(), 10); // Set the element value in case we are using the slider min & max. $min.val(default_min); $max.val(default_max); $min.parents(containing_parent).after( $('
').slider({ range: true, min: parseFloat(sliderOptions.min, 10), max: parseFloat(sliderOptions.max, 10), step: parseFloat(sliderOptions.step, 10), animate: sliderOptions.animate ? sliderOptions.animate : false, orientation: sliderOptions.orientation, values: [default_min, default_max], // Update the textfields as the sliders are moved slide: function (event, ui) { $min.val(ui.values[0]); $max.val(ui.values[1]); }, // This fires when the value is set programmatically or the // stop event fires. // This takes care of the case that a user enters a value // into the text field that is not a valid step of the slider. // In that case the slider will go to the nearest step and // this change event will update the text area. change: function (event, ui) { $min.val(ui.values[0]); $max.val(ui.values[1]); }, // Attach stop listeners. stop: function(event, ui) { // Click the auto submit button. $(this).parents('form').find('.ctools-auto-submit-click').click(); } }) ); // Update the slider when the fields are updated. $min.blur(function() { befUpdateSlider($(this), 0, sliderOptions); }); $max.blur(function() { befUpdateSlider($(this), 1, sliderOptions); }); } // This is single value filter. else if ($input.length == 1) { if ($input.attr('id') != 'edit-' + sliderOptions.id) { return; } // Get the default value. We use slider min if there is no default. var default_value = parseFloat(($input.val() == '') ? sliderOptions.min : $input.val(), 10); // Set the element value in case we are using the slider min. $input.val(default_value); $input.parents(containing_parent).after( $('
').slider({ min: parseFloat(sliderOptions.min, 10), max: parseFloat(sliderOptions.max, 10), step: parseFloat(sliderOptions.step, 10), animate: sliderOptions.animate ? sliderOptions.animate : false, orientation: sliderOptions.orientation, value: default_value, // Update the textfields as the sliders are moved. slide: function (event, ui) { $input.val(ui.value); }, // This fires when the value is set programmatically or the // stop event fires. // This takes care of the case that a user enters a value // into the text field that is not a valid step of the slider. // In that case the slider will go to the nearest step and // this change event will update the text area. change: function (event, ui) { $input.val(ui.value); }, // Attach stop listeners. stop: function(event, ui) { // Click the auto submit button. $(this).parents('form').find('.ctools-auto-submit-click').click(); } }) ); // Update the slider when the field is updated. $input.blur(function() { befUpdateSlider($(this), null, sliderOptions); }); } else { return; } }) }); } } }; // This is only needed to provide ajax functionality Drupal.behaviors.better_exposed_filters_select_as_links = { attach: function(context, settings) { $('.bef-select-as-links', context).once(function() { var $element = $(this); // Check if ajax submission is enabled. If it's not enabled then we // don't need to attach our custom submission handling, because the // links are already properly built. // First check if any ajax views are contained in the current page. if (typeof settings.views == 'undefined' || typeof settings.views.ajaxViews == 'undefined') { return; } // Now check that the view for which the current filter block is used, // is part of the configured ajax views. var $uses_ajax = false; $.each(settings.views.ajaxViews, function(i, item) { var $view_name = item.view_name.replace(/_/g, '-'); var $view_display_id = item.view_display_id.replace(/_/g, '-'); var $id = 'views-exposed-form-' + $view_name + '-' + $view_display_id; var $form_id = $element.parents('form').attr('id'); if ($form_id == $id) { $uses_ajax = true; return; } }); // If no ajax is used for form submission, we quit here. if (!$uses_ajax) { return; } // Attach selection toggle and form submit on click to each link. $(this).find('a').click(function(event) { var $wrapper = $(this).parents('.bef-select-as-links'); var $options = $wrapper.find('select option'); // We have to prevent the page load triggered by the links. event.preventDefault(); event.stopPropagation(); // Un select if previously seleted toogle is selected. var link_text = $(this).text(); removed = ''; $($options).each(function(i) { if ($(this).attr('selected')) { if (link_text == $(this).text()) { removed = $(this).text(); $(this).removeAttr('selected'); } } }); // Set the corresponding option inside the select element as selected. $selected = $options.filter(function() { return $(this).text() == link_text && removed != link_text; }); $selected.attr('selected', 'selected'); $wrapper.find('.bef-new-value').val($selected.val()); $wrapper.find('.bef-new-value[value=""]').attr("disabled", "disabled"); $(this).addClass('active'); // Submit the form. $wrapper.parents('form').find('.views-submit-button *[type=submit]').click(); }); $('.bef-select-as-link').ready(function() { $('.bef-select-as-link').find('a').removeClass('active'); $('.bef-new-value').each(function(i, val) { id = $(this).parent().find('select').attr('id') + '-' + $(this).val(); $('#'+id).find('a').addClass('active'); }); }); }); } }; Drupal.behaviors.betterExposedFiltersRequiredFilter = { attach: function(context, settings) { // Required checkboxes should re-check all inputs if a user un-checks // them all. $('.bef-select-as-checkboxes', context).once('bef-required-filter').ajaxComplete(function (e, xhr, s) { var $element = $(this); if (typeof settings.views == 'undefined' || typeof settings.views.ajaxViews == 'undefined') { return; } // Now check that the view for which the current filter block is used, // is part of the configured ajax views. var $view_name; var $view_display_id; var $uses_ajax = false; $.each(settings.views.ajaxViews, function(i, item) { $view_name = item.view_name; $view_display_id = item.view_display_id; var $id = 'views-exposed-form-' + $view_name.replace(/_/g, '-') + '-' + $view_display_id.replace(/_/g, '-'); var $form_id = $element.parents('form').attr('id'); if ($form_id == $id) { $uses_ajax = true; return false; } }); //Check if we have any filters at all because of Views Selective Filter if($('input', this).length > 0) { var $filter_name = $('input', this).attr('name').slice(0, -2); if (Drupal.settings.better_exposed_filters.views[$view_name].displays[$view_display_id].filters[$filter_name].required && $('input:checked', this).length == 0) { $('input', this).prop('checked', true); } } }); } } /* * Helper functions */ /** * Adds/Removes the highlight class from the form-item div as appropriate */ function _bef_highlight(elem, context) { $elem = $(elem, context); $elem.attr('checked') ? $elem.closest('.form-item', context).addClass('highlight') : $elem.closest('.form-item', context).removeClass('highlight'); } /** * Update a slider when a related input element is changed. * * We don't need to check whether the new value is valid based on slider min, * max, and step because the slider will do that automatically and then we * update the textfield on the slider's change event. * * We still have to make sure that the min & max values of a range slider * don't pass each other though, however once this jQuery UI bug is fixed we * won't have to. - http://bugs.jqueryui.com/ticket/3762 * * @param $el * A jQuery object of the updated element. * @param valIndex * The index of the value for a range slider or null for a non-range slider. * @param sliderOptions * The options for the current slider. */ function befUpdateSlider($el, valIndex, sliderOptions) { var val = parseFloat($el.val(), 10), currentMin = $el.parents('div.views-widget').next('.bef-slider').slider('values', 0), currentMax = $el.parents('div.views-widget').next('.bef-slider').slider('values', 1); // If we have a range slider. if (valIndex != null) { // Make sure the min is not more than the current max value. if (valIndex == 0 && val > currentMax) { val = currentMax; } // Make sure the max is not more than the current max value. if (valIndex == 1 && val < currentMin) { val = currentMin; } // If the number is invalid, go back to the last value. if (isNaN(val)) { val = $el.parents('div.views-widget').next('.bef-slider').slider('values', valIndex); } } else { // If the number is invalid, go back to the last value. if (isNaN(val)) { val = $el.parents('div.views-widget').next('.bef-slider').slider('value'); } } // Make sure we are a number again. val = parseFloat(val, 10); // Set the slider to the new value. // The slider's change event will then update the textfield again so that // they both have the same value. if (valIndex != null) { $el.parents('div.views-widget').next('.bef-slider').slider('values', valIndex, val); } else { $el.parents('div.views-widget').next('.bef-slider').slider('value', val); } } }) (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 = $('
'); 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.progress-bar', this.element).css('width', percentage + '%'); $('div.progress-bar', this.element).attr('aria-valuenow', 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 = $('
×

Error message

').append(string); $(this.element).before(error).hide(); if (this.errorCallback) { this.errorCallback(this); } }; })(jQuery); ;/*})'"*/ ;/*})'"*/ (function ($) { "use strict"; Drupal.behaviors.entityreference_filter_dynamic = { attach: function (context, settings) { if (settings.entityreference_filter) { $.each(settings.entityreference_filter, function(form_id, filter_setting) { var form = $('#' + form_id, context); if (form.length === 0) { return; } var view = filter_setting.view; var args = filter_setting.args; var dependent_filters = filter_setting.dynamic; var elements = {}; var controlling_filters = {}; if (dependent_filters) { $.each(dependent_filters, function(i, dep_controlling_filters) { $.each(dep_controlling_filters, function(j, controlling_filter) { controlling_filters[controlling_filter] = controlling_filter; }); }); } $.each(controlling_filters, function(i, controlling_filter) { var element = form.find('[name="' + controlling_filter + '"],[name="' + controlling_filter + '[]"]'); if (element.length > 0) { elements[controlling_filter] = element; element.attr('autocomplete', 'off'); var url = settings.basePath + settings.pathPrefix + 'entityreference_filter/update/' + view + '/' + controlling_filter; element.once('entityreference_filter').change(function() { var ajax = new Drupal.ajax(false, false, {url: url}); var parentBeforeSerialize = ajax.beforeSerialize; ajax.beforeSerialize = function(element, options) { parentBeforeSerialize(element, options); options.type = 'GET'; options.data = {}; $.each(elements, function(fn, element) { var value = element.fieldValue(); if (value.length > 0) { options.data[fn] = value[0]; } }); options.data.entityreference_filter_form_id = form_id; options.data.entityreference_filter_args = args; }; ajax.eventResponse(ajax, {}); }); // Another way. //var ajax = new Drupal.ajax(false, element, {event: 'change', url: url}); //var parentBeforeSerialize = ajax.beforeSerialize; //ajax.beforeSerialize = function(element, options) { // parentBeforeSerialize(element, options); // options.type = 'GET'; // options.data = {}; // // $.each(elements, function(fn, element) { // var value = element.fieldValue(); // if (value.length > 0) { // options.data[fn] = value[0]; // } // }); // // options.data['entityreference_filter_form_id'] = form_id; // options.data['entityreference_filter_args'] = args; //}; } }); }); } } }; /** * Command to insert new content into the DOM without wrapping in extra DIV element. */ Drupal.ajax.prototype.commands.entityreference_filter_insertnowrap = function (ajax, response, status) { // Get information from the response. If it is not there, default to // our presets. var wrapper = response.selector ? $(response.selector) : $(ajax.wrapper); var method = response.method || ajax.method; var effect = ajax.getEffect(response); // We don't know what response.data contains: it might be a string of text // without HTML, so don't rely on jQuery correctly interpreting // $(response.data) as new HTML rather than a CSS selector. Also, if // response.data contains top-level text nodes, they get lost with either // $(response.data) or $('
').replaceWith(response.data). var new_content_wrapped = $('
').html(response.data); var new_content = new_content_wrapped.contents(); var settings = {}; // If removing content from the wrapper, detach behaviors first. switch (method) { case 'html': case 'replaceWith': case 'replaceAll': case 'empty': case 'remove': settings = response.settings || ajax.settings || Drupal.settings; Drupal.detachBehaviors(wrapper, settings); break; } // Add the new content to the page. wrapper[method](new_content); // Immediately hide the new content if we're using any effects. if (effect.showEffect !== 'show') { new_content.hide(); } // Determine which effect to use and what content will receive the // effect, then show the new content. if ($('.ajax-new-content', new_content).length > 0) { $('.ajax-new-content', new_content).hide(); new_content.show(); $('.ajax-new-content', new_content)[effect.showEffect](effect.showSpeed); } else if (effect.showEffect !== 'show') { new_content[effect.showEffect](effect.showSpeed); } // Attach all JavaScript behaviors to the new content, if it was successfully // added to the page, this if statement allows #ajax['wrapper'] to be // optional. if (new_content.parents('html').length > 0) { // Apply any settings from the returned JSON if available. settings = response.settings || ajax.settings || Drupal.settings; Drupal.attachBehaviors(wrapper, settings); } }; })(jQuery); ;/*})'"*/ ;/*})'"*/ (function ($) { $(document).ready(function() { // Attach mousedown, keyup, touchstart events to document only and catch // clicks on all elements. $(document.body).bind("mousedown keyup touchstart", function(event) { // Catch the closest surrounding link of a clicked element. $(event.target).closest("a,area").each(function() { if (Drupal.settings.piwik.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { // Mailto link clicked. _paq.push(["trackEvent", "Mails", "Click", this.href.substring(7)]); } }); }); // Colorbox: This event triggers when the transition has completed and the // newly loaded content has been revealed. if (Drupal.settings.piwik.trackColorbox) { $(document).bind("cbox_complete", function () { var href = $.colorbox.element().attr("href"); if (href) { _paq.push(["setCustomUrl", href]); _paq.push(["trackPageView"]); } }); } }); })(jQuery); ;/*})'"*/ ;/*})'"*/