/* ------------------------------------------------------------------------ Project: The Social Required: jquery, gelesocial.js Copyright: 2011 - Gruppo editoriale L'Espresso spa Developers: M. Viganò, F. Zanchetta, G. Bottini, L. Convalle, E. Sabellico, E. Matteoli, L. "saibal" Forti ------------------------------------------------------------------------- */ if(!RenderSocial) RenderSocial = {} RenderSocial.statusBar = { cookieName: "status_bar_visible" //,noFixed: ['iPad','iPhone','iPod', 'Android'] ,initStatusBar: function(){ html = ''+ '
'+ ''+ ''; this.statusBar = jQuery(html); this.statusBar.find("."+RenderSocial.TOOLBAR_SHOWHIDE_CLASS).click(function(){ RenderSocial.statusBar.toggleStatusBarVisibility(); return false; }); var visible = this.getCookie(); this.setStatusBarVisibility(visible); jQuery("body").append(this.statusBar); RenderSocial.statusBar.initMenu(); this.cookieListener = { onCookieSet: function(name, value){ /* if(name==$.neodata.LOCALI_COOKIE_NAME){ $.neodata.statusbar.edizioniLocaliFELogged(); $.neodata.statusbar.edizioniLocaliBELogged(); } else */ if(name==$.neodata.KEYWORDS_COOKIE_NAME){ $.neodata.statusbar.neodataSuggestFELogged(); $.neodata.statusbar.neodataSuggestBELogged(); }else if(name==$.bookmark.COOKIE_NAME){ $.neodata.statusbar.neodataSuggestBELogged(); } } ,onCookieDeleted: function(name){ this.onCookieSet(name); } } GeleSocial.addCookieListener(this.cookieListener); /*if(jQuery.grep(RenderSocial.statusBar.noFixed, function(e,i){ return navigator.platform.indexOf(e)>=0; }).length > 0){ var toolbar = jQuery("#" + RenderSocial.TOOLBAR_SOCIAL_ID); toolbar.addClass("no-fixed"); var endPositioning = function(eventTime){ //if(eventTime != RenderSocial.statusBar.__lastEvent) return; toolbar.css('display','block'); var toolbarHeight = toolbar.outerHeight(); var top = $(document).scrollTop(); var height = window.innerHeight ? window.innerHeight : $(window).height(); toolbar.css({"top": (top + height - toolbarHeight) + "px"}); } var startPositioning = function(){ //var eventTime = new Date(); //RenderSocial.statusBar.__lastEvent = eventTime; toolbar.css('display','none'); //setTimeout(function(){positionToolbar1(eventTime)}, 200); //return true; } //positionToolbar1(); jQuery(document).bind('touchstart gesturestart', startPositioning); jQuery(document).bind('touchend gestureend orientationchange', endPositioning); }*/ //nascosta per il momento perchè dava un errore //http://redmine.kataweb.it/issues/236 if(RenderSocial.BREAKING_NEWS && false){ $.ajax({ url: RenderSocial.BREAKING_NEWS, success: function(ultimora){ var html = ""+ultimora+""; RenderSocial.statusBar.statusBar.find("#"+RenderSocial.BREAKING_NEWS_ID).html(html); $("#"+RenderSocial.BREAKING_NEWS_ID).show(); } }); } } ,getCookie: function(){ if(GeleSocial.isLogged()){ var ret = GeleSocial.getBoxCookie(this.cookieName); if(ret && ret.params) ret = ret.params; else ret = null; } else { var ret = GeleSocial.getCookie(this.cookieName); } if(ret) return ret=="true"; else return true; } ,setCookie: function(value){ if(GeleSocial.isLogged()){ return GeleSocial.setBoxCookie(this.cookieName, {"params": value.toString()}); } else { return GeleSocial.setCookie(this.cookieName, value.toString(), 30, RenderSocial.COOKIE_DOMAIN, "/"); //return jQuery.cookie(this.cookieName, value.toString(), { expires: 30 }); } } ,toggleStatusBarVisibility: function(n){ if(window.console) window.console.log("toggleStatusBarVisibility:"+n); this.setStatusBarVisibility(!this.visible); this.setCookie(this.visible); } ,setStatusBarVisibility: function(visible,noAnimation){ if(window.console) window.console.log("visible:"+visible); if(GeleSocial.utils.isNull(noAnimation)) noAnimation=false; if(visible){ if(window.console) window.console.log("visible:"+visible); //mostro if(window.console) window.console.log("mostro"); if(noAnimation){ this.statusBar.find('.'+RenderSocial.STATUS_BAR_CLASS).css({ bottom: '0' }); this.statusBar.find("."+RenderSocial.SHOWHIDE_OFF_CLASS).css({ bottom: '-50px' }); }else { this.statusBar.find('.'+RenderSocial.STATUS_BAR_CLASS).animate({ bottom: '0' }, 500); this.statusBar.find("."+RenderSocial.SHOWHIDE_OFF_CLASS).animate({ bottom: '-50px' }, 300); } } else { //nascondo if(window.console) window.console.log("nascondo"); this.hideAllPopups(); if(noAnimation){ this.statusBar.find("."+RenderSocial.STATUS_BAR_CLASS).css({ bottom: '-50px' }); this.statusBar.find('.'+RenderSocial.SHOWHIDE_OFF_CLASS).css({ bottom: '0' }); }else { this.statusBar.find("."+RenderSocial.STATUS_BAR_CLASS).animate({ bottom: '-50px' }, 300); this.statusBar.find('.'+RenderSocial.SHOWHIDE_OFF_CLASS).animate({ bottom: '0' }, 500); } } this.visible = visible; //temporary promo campaign RenderSocial.statusBar._toggle_promo_box(); if(window.console) window.console.log("this.visible:"+this.visible); } ,renderUserAccess: function(){ var statusBar = this.statusBar; var name = GeleSocial.getUserNick(); var img = GeleSocial.getUserThumb(); var userHtml = '' + ""+ ""+ name+""; userHtml += "Logout"; statusBar.find("#"+RenderSocial.USER_ACCESS_ID).html(userHtml); } ,renderLogged: function(){ this.initStatusBar(); this.renderUserAccess(); //edizioniLocaliHtml //$.neodata.statusbar.edizioniLocaliFELogged(); //neodataSuggest $.neodata.statusbar.neodataSuggestFELogged(); //fbActivity $.neodata.statusbar.facebookRecommendationsFE(); $("."+RenderSocial.STATUS_BAR_CLASS).addClass("logged"); //init temporary promo campaign RenderSocial.statusBar._init_promo_box(".access-logout"); } ,setPopupVisible: function(name, visible){ if(visible) this.popupVisible = name; else delete this.popupVisible; var code_id = "#"+$("#"+name).children(RenderSocial.TOOLBAR_SOCIAL_CONTAINER_CLASS).attr("id"); $(RenderSocial.TOOLBAR_SOCIAL_CONTAINER_CLASS).not(code_id).hide("fast"); if(visible){ /* if(name == $.neodata.LOCALI_FE_BOX){ if(GeleSocial.isLogged()) $.neodata.statusbar.edizioniLocaliBELogged(); else $.neodata.statusbar.edizioniLocaliBENotLogged(); }else */ if(name == $.neodata.NEODATA_KEYWORDS_FE_BOX || name == $.neodata.NEODATA_PERTE_FE_BOX){ if(GeleSocial.isLogged()){ if(name == $.neodata.NEODATA_KEYWORDS_FE_BOX){ $("."+$.neodata.NEODATA_BALOON_CLASS).hide(); } $.neodata.statusbar.neodataSuggestBELogged(); }else $.neodata.statusbar.neodataSuggestBENotLogged(); }else if(name == $.neodata.FACEBOOK_FE_BOX){ if(GeleSocial.isLogged()) $.neodata.statusbar.facebookRecommendationsBELogged(); else $.neodata.statusbar.facebookRecommendationsBENotLogged(); } if(GeleSocial.isLogged()){ if(name == $.neodata.NEODATA_KEYWORDS_FE_BOX){ $("."+$.neodata.NEODATA_BALOON_CLASS).hide(); } else { $("."+$.neodata.NEODATA_BALOON_CLASS).show(); } } $(code_id).show("fast"); } else{ if(name == $.neodata.NEODATA_KEYWORDS_FE_BOX){ if(GeleSocial.isLogged()) $("."+$.neodata.NEODATA_BALOON_CLASS).show(); } $(code_id).hide("fast"); } } ,hideAllPopups: function(){ if(this.popupVisible){ $(RenderSocial.TOOLBAR_SOCIAL_CONTAINER_CLASS).hide("fast"); delete this.popupVisible; if(GeleSocial.isLogged()) $("."+$.neodata.NEODATA_BALOON_CLASS).show(); } } ,initMenu: function(){ var _this = this; $('.toolbar-boxes').click(function(){ var code_id = $(this).attr('id'); _this.setPopupVisible(code_id, code_id!=_this.popupVisible); }); $('.'+$.neodata.SB_BOXES_CLOSE_CLASS).live('click',function(){ RenderSocial.statusBar.hideAllPopups(); }); } ,renderNotLogged: function(){ this.initStatusBar(); //edizioniLocaliHtml //$.neodata.statusbar.edizioniLocaliFENotLogged(); //neodataSuggest $.neodata.statusbar.neodataSuggestFENotLogged(); //fbActivity $.neodata.statusbar.facebookRecommendationsFE(); $("."+RenderSocial.STATUS_BAR_CLASS).addClass("not-logged"); //var claim = GeleSocial.getCookie('status_bar_claim'); var claim = true; var txt = '