/artissime/html/js/artissime.js
JavaScript | 235 lines | 184 code | 30 blank | 21 comment | 23 complexity | 67d345533590868bd9515c8c45ea2824 MD5 | raw file
Possible License(s): GPL-2.0
- /*******************************************************************************
- jquery.mb.components
- Copyright (c) 2001-2010. Matteo Bicocchi (Pupunzi); Open lab srl, Firenze - Italy
- email: info@pupunzi.com
- site: http://pupunzi.com
- Licences: MIT, GPL
- ******************************************************************************/
- (function($){
- $.fn.mbCloseBox=function(t,c){
- $(this).css({height: $(this).outerHeight(), minHeight: "0px"});
- $(this).slideUp(t,c);
- };
- $.fn.mbOpenBox=function(t,c){
- $(this).css({height: $(this).outerHeight(), minHeight: "0px"});
- $(this).slideDown(t,c);
- };
- $.fn.mbEqualizeCols = function(){
- var height = 0;
- return this.css("height","auto").each(function(){
- height = Math.max( height, $(this).outerHeight() );
- }).css("minHeight", height);
- };
- $.fn.buildSubMenu=function(options){
- this.options={
- menuVoces:"subMenu",
- elements:"a",
- alwaysOpen:false
- };
- $.extend (this.options, options);
- var submenu=this;
- var el=$(this).find(this.options.elements);
- var menuvoices=$("#"+this.options.menuVoces);
- submenu.actualMenu=false;
- //menuvoices.children().css({position:"absolute",display:"block", height:"100%", width:"100%"}).hide();
- var menuSel=false;
- var subMenuSel=false;
- el.each(function(){
- if ($.metadata){
- $.metadata.setType("class");
- var menu= $(this).metadata().menu;
- menuSel=$(this).metadata().isSel && !menuSel?$(this):menuSel;
- }
- buildSubMenuCat($("#"+menu).find("a"));
- if(menuSel)
- subMenuSel=menuSel.find(".sel");
- $("#"+menu).hoverIntent(function(){
- if (menu!= submenu.actualMenu) $("#"+menu).fadeOut("slow");
- $(document).stopTime("closeSubMenu");
- },function(){
- $(document).oneTime(1000, "closeSubMenu",function(){
- el.removeClass("sel");
- if(!menuSel) menuvoices.slideUp(500);
- menuvoices.children().hide();
- if(menuSel)
- onMenuSel(menuSel,subMenuSel);
- });
- });
- $(this).hoverIntent(function(){
- $(document).stopTime("closeSubMenu");
- el.removeClass("sel");
- $(this).addClass("sel");
- if (menu!= submenu.actualMenu){
- submenu.actualMenu=menu;
- menuvoices.children().hide();
- }
- $("#"+menu).fadeIn(500);
- menuvoices.show();
- },function(){
- $(document).oneTime(1000, "closeSubMenu",function(){
- // if (submenu.actualMenu==menu) {return;}
- el.removeClass("sel");
- if(!menuSel) menuvoices.slideUp(500);
- menuvoices.children().hide();
- submenu.actualMenu=false;
- if(menuSel)
- onMenuSel(menuSel,subMenuSel);
- });
- });
- });
- function onMenuSel(menuSel, submenuSel){
- if(menuSel){
- var openedMenu=menuSel.metadata().menu;
- $("#"+openedMenu).fadeIn(500);
- menuvoices.show();
- submenu.actualMenu=openedMenu;
- menuSel.addClass("sel");
- }
- if(submenuSel){
- submenuSel.addClass("sel");
- }
- }
- function buildSubMenuCat(ele){
- ele.each(function(){
- $(this).mouseover(function(){$("#submenuCat").remove();});
- if ($.metadata){
- $.metadata.setType("class");
- var menuUrl= $(this).metadata().subMenuCat?$(this).metadata().subMenuCat:false;
- var menuData= $(this).metadata().data?$(this).metadata().data:false;
- }
- if(menuUrl){
- var subVoice=$(this);
- subVoice.hover (
- function(){
- $(document).stopTime("closeSubMenu");
- $(document).stopTime("closeSubMenuCat");
- $("#submenuCat").remove();
- var color=subVoice.css("background-color");
- if(!subVoice.hasClass("sel")){
- subVoice.addClass("sel");
- }else{
- subVoice.attr("actual",true);
- }
- var cat=$("<div/>").attr("id","submenuCat").hide();
- color="#333";
- cat.css({position:"absolute", top:subVoice.offset().top+31, left:subVoice.offset().left, backgroundColor:color});
- $("body").append(cat);
- cat.load(menuUrl,menuData,function(){$(this).slideDown("fast");});
- cat.hover(
- function(){
- subVoice.addClass("menuSel");
- setTimeout(function(){$(document).stopTime("closeSubMenu");},300);
- $(document).stopTime("closeSubMenuCat");
- },
- function(){
- cat.remove();
- // if(subVoice.attr("actual")!="true")
- subVoice.removeClass("menuSel");
- $(document).oneTime(1000, "closeSubMenu",function(){
- el.removeClass("sel");
- if(!menuSel) menuvoices.slideUp(500);
- menuvoices.children().hide();
- submenu.actualMenu=false;
- if(menuSel)
- onMenuSel(menuSel,subMenuSel);
- });
- }
- );
- },
- function(){
- if(subVoice.attr("actual")!="true") subVoice.removeClass("sel");
- $(document).oneTime(50, "closeSubMenuCat",function(){
- $("#submenuCat").remove();});
- });
- }
- });
- }
- onMenuSel(menuSel,subMenuSel);
- };
- })(jQuery);
- function changeHeader(additionalLogo,cleanHeader, littleHeaderUrl, defaultHeaderUrl){
- if (additionalLogo){
- if (!cleanHeader) $("#header").css({background:"url("+littleHeaderUrl+")"});
- }else{
- $("#header_baseline").css({left:18, top:58});
- $("#additionalLogotype").remove();
- $("#header").css({background:"url("+defaultHeaderUrl+")"});
- }
- }
- $.blockUI.defaults.overlayCSS = {};
- $.blockUI.defaults.css = {};
- $(function(){
- $(".spectacles.label").html("Spect");
- $(".museum.label").html("Mus?¨e");
- $(".public.label").html("Publique");
- $(".travel.label").html("S?jours");
- /*
- Submenu
- */
- $("#navMenu").buildSubMenu();
- /* Highlights */
- $(".highlightHover").hoverIntent(
- function(){
- $(this).addClass("selected");
- if($.browser.msie) $(this).find(".elementHover").show();
- else
- $(this).find(".elementHover").fadeIn("fast");
- },
- function(){
- $(this).removeClass("selected");
- if($.browser.msie) $(this).find(".elementHover").hide();
- else
- $(this).find(".elementHover").fadeOut("fast");
- }
- ).click(function(){
- var url= $(this).find("a.eventUrl").attr("href");
- if (url) self.location.href=url;
- else
- alert("url not found");
- });
- $(".highlightHover div").css({position:"relative"});
- $(".highlightHover").prepend("<div class='elementHover'><\/div>");
- // Form datepicker
- $("input.date").datepick();
- /*
- just show the show_more box the first time this user get the site.
- */
- if ($.cookie('ARTISSIME_SHOW_MORE_BOX')!="not"){
- setTimeout(function(){$('#show_more').mbOpenBox('slow','');$('#services_btn').hide();},2000);
- /*
- * Set cookie for show_more box
- */
- var options = { expires: 1 };
- $.cookie('ARTISSIME_SHOW_MORE_BOX', "not", options);
- }
- });