/** * @file * A JavaScript file for the theme. * * In order for this JavaScript to be loaded on pages, see the instructions in * the README.txt next to this file. */ // JavaScript should be made compatible with libraries other than jQuery by // wrapping it with an "anonymous closure". See: // - https://drupal.org/node/1446420 // - http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth (function ($, Drupal, window, document, undefined) { // To understand behaviors, see https://drupal.org/node/756722#behaviors Drupal.behaviors.my_custom_behavior = { attach: function(context, settings) { //Show - Hide Share Mobile $(".header__mobile-wrapper .mobile-item-share").click(function (event) { var item = $(this).find(".share-web-mobile"); if(item.is(':visible')){ item.hide(); }else{ item.show(); } }); $("#user-profile-menu, #main-menu").removeClass("retarded_hover"); $("#user-profile-menu, #main-menu").hoverIntent({ over: menu_hover, out: menu_hover_out, interval: 50 }); //Show - Hide menu Mobile $("#page-wrapper .mobile-item-main-menu").click(function () { var body = $("body"); if(body.hasClass("page-wrapper-left")){ body.removeClass("page-wrapper-left"); }else{ body.addClass("page-wrapper-left"); } }); $("#page-wrapper .mobile-item-profile-menu").click(function () { var body = $("body"); if(body.hasClass("page-wrapper-right")){ body.removeClass("page-wrapper-right"); }else{ body.addClass("page-wrapper-right"); } }); //Function menu Mobile $(".page-wrapper-item .menu .menu__item.expanded a, .page-wrapper-item .menu .menu__item.expanded span").click(function () { var item_parent = $(this).parent(); var item = item_parent.find(".menu:first"); if(!item.is(':visible') && !item_parent.hasClass("leaf")){ item.show(); return false; } }); } }; function menu_hover(){ $(this).addClass("retarded_hover"); } function menu_hover_out(){ $(this).removeClass("retarded_hover"); } })(jQuery, Drupal, this, this.document); ; var Carousel = function(thumbnail_elements, background_elements, links_elements, items) { this.thumbnail_elem = jQuery(thumbnail_elements); this.background_elem = jQuery(background_elements); this.links_elem = jQuery(links_elements); this.items = items }; ;(function($) { Carousel.prototype = { active_play: 0, timeout: 5000, current_index: 0, interval: null, background_divs: new Array(), current_background_div: null, setTimeout: function(timeout) { this.timeout = timeout; return this; }, init: function() { var carousel = this; $(carousel.items).each(function(index) { with ({idx: index}) { if (idx == 0) { carousel.background_divs[idx] = carousel.background_elem.find('.background-carousel'); } else { carousel.background_divs[idx] = null; } var thumbnail_link = $('', { 'href': '#', 'title': this.title, 'alt': this.title, 'rel': idx, }).click(function (e) { carousel.change(idx) }); var thumbnail = $('
',{ 'class': 'item-thumbnail' + (idx == 0 ? ' active' : ''), 'html': thumbnail_link, }); $(carousel.links_elem).append(thumbnail); } }); return carousel; }, play: function() { var carousel = this; carousel.interval = setInterval(function () { carousel.change(carousel.current_index+1); },carousel.timeout); return carousel; }, stop: function() { var carousel = this; clearInterval(carousel.interval); return carousel; }, change: function (idx) { var carousel = this; carousel = carousel.stop(); var old_index = carousel.current_index; carousel.current_index = idx % carousel.items.length; if (carousel.background_divs[carousel.current_index] == null) { if($(window).width() > 1020){ var type_url = "url_web"; }else{ var type_url = "url_mobile"; } $('