/* ------------------------------------------------------------------------ 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 = '' + ""+ "