script.min.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. (function($){Drupal.behaviors.init_theme={};Drupal.behaviors.init_theme.attach=function(context){$('#messages-and-help > div.messages:not(.processed)').addClass('processed').each(function(){if($('a',this).size()||$(this).is('.error')||$(this).is('.warning')||$(this).text().length>100){$(this).prepend("<span class='close'>X</span>");$('span.close',this).click(function(){$(this).parent().slideUp('fast');});}
  2. else{$(this).animate({opacity:1},5000,'linear',function(){$(this).slideUp('fast');});}});};Drupal.behaviors.materio={};Drupal.behaviors.materio.attach=function(context){};MaterioBaseTheme=function(){var _settings=Drupal.settings,_themeSettings=_settings.materiobasetheme,_strings=_themeSettings.strings,_History=window.History,_this=this,_$body=$('body'),_$content=$('#content'),_jsp,_$tooltip=$('<div id="tooltip" class="op-hidden">').appendTo('body'),_$homeUtilities,_$homeBlockDidactique,_hoverHomeDidactique=false,_homeTimeInterval,_touch=$('html').is('.touch'),_statePushed=false,position={x:null,y:null},translate3d_content=0,_isLoggedIn=!$('body').is('.not-logged-in'),_isFrontNotLogged=$('body').is('.front.not-logged-in'),_isFrontHomeV2=_$body.is('.home-v2'),_skrollr,_isMembershipForm=$('body').is('.page-node-11186'),_isBreveMateriauNodePage=_themeSettings.page_callback=='node_page_view'&&(_themeSettings.node_type=='materiau'||_themeSettings.node_type=='breve'),_resizeTimer,_max_480=function(){return(viewport().width<479);},_480_768=function(){return(!_max_480()&&_max_768());},_max_768=function(){return(viewport().width<767);},_768_980=function(){return(!_max_768()&&_max_980());},_max_980=function(){return(viewport().width<979);},_980_1200=function(){return(!_max_980()&&_max_1200());},_max_1200=function(){return(viewport().width<1199);},_previewIsOpen=false,_viewmodes={bookmark:50,cardsmall:100,cardmedium:210,cardbig:425,cardfull:850};var v1,v2,v3,v4,v5;function init(){trace('init MaterioBaseTheme');checkIE();initHistoryNav();if(_isFrontHomeV2)
  3. initHomeV2();if(_isMembershipForm)
  4. initMembershipForm();initForms();if(!_isFrontHomeV2)
  5. initLayout();initInfinitScroller();initEvents();initKeyboardShortcuts();initViewmodes();if(_isBreveMateriauNodePage)
  6. $.event.trigger({type:'resultschanged',container:'#content>.inner-content'});setTimeout(function(){$.event.trigger({type:'theme-ready'});},100);};function checkIE(){if($('.oldie body').size()&&!readCookie('oldie_checked')){setTimeout(function(){createCookie('oldie_checked',1);alert('Afin de profiter pleinement des fonctionalités de materio.com, nous vous invitons a mettre a jour votre navigateur dans ça denière version. Celui ci n\'étant pas compatible avec les technologie employer par materio.com, vous risquer de rencontrer des difficulter de navigation.');},4000);}};function initHistoryNav(){trace("initHistoryNav _History",_History);var state=_History.getState();_History.Adapter.bind(window,'statechange',onHistoryStateChange);$(document).bind('new-history-page',onNewHistoryPage);};function onNewHistoryPage(event){trace('theme :: onNewHistoryPage',event);var title=event.title.replace(/<(?:.|\n)*?>/gm,'')+' | '+_strings.site_name;_statePushed=true;_History.pushState({content:event.content,pagetitle:event.title},title,event.path);};function onHistoryStateChange(event){trace('theme :: onHistoryStateChange',event);var state=_History.getState();_History.log('statechange:',state.data,state.title,state.url);$.event.trigger({type:'record-stat',path:state.url});$('input[name=location]','#feedback-form').attr('value',state.url);$.event.trigger({type:'materio-page-title-refresh-block',title:state.data.pagetitle});if(!_statePushed){_statePushed=false;$('.inner-content',_$content).html(state.data.content);$.event.trigger('history-state-change');}};function initHome(){$('img.lazy','#block-materio-didactique-materio-didactique-home').each(function(){var $img=$(this);$img.attr('src',$img.attr('data-original'));});if(_max_768()){initHomeDidactiqueMobile();}else{initHomeDidactiqueDesktop();}};function initHomeDidactiqueMobile(){_$homeBlockDidactique=$('#block-materio-didactique-materio-didactique-home');$('.node-didactique',_$homeBlockDidactique).find('.field-name-title-field').bind('click',clickOnHomeDidactiqueTitle);};function clickOnHomeDidactiqueTitle(e){var $node=$(this).parent('.node-didactique');if($node.is('.opened')){$node.removeClass('opened');}else{$('.node-didactique',_$homeBlockDidactique).removeClass('opened');$node.addClass('opened');$('html,body').animate({scrollTop:$node.offset().top-$('#header').h()});}};function initHomeDidactiqueDesktop(){_$homeUtilities=$('#utilities');_$homeBlockDidactique=$('#block-materio-didactique-materio-didactique-home').append('<div class="slides"/>').append('<div class="tabs"/>').bind('mouseenter',function(event){_hoverHomeDidactique=true;}).bind('mouseleave',function(event){_hoverHomeDidactique=false;});$('.node-didactique',_$homeBlockDidactique).each(function(index){if(index){$(this).addClass('op-hidden');}else{$(this).addClass('op-visible');}
  7. $('.field-name-title-field',this).clone().addClass(index?'':'active').click(function(event){$(this).addClass('active').siblings().removeClass('active');_$homeBlockDidactique.find('.node-didactique').removeClass('op-visible').addClass('op-hidden').eq(index).removeClass('op-hidden').addClass('op-visible');}).appendTo($('.tabs',_$homeBlockDidactique));}).appendTo($('.slides',_$homeBlockDidactique));if(!_touch){$(document).bind('scroll',function(event){if($(window).scrollTop()==0){if(_$homeUtilities.is('.closed')){_$homeUtilities.removeClass('closed');launchHomeDidactiqueInterval();initLayout();}}else{if(!_$homeUtilities.is('.closed')){_$homeUtilities.addClass('closed');clearInterval(_homeTimeInterval);initLayout();}}});}
  8. $(document).bind('cbox_complete',function(){clearInterval(_homeTimeInterval);}).bind('cbox_closed',function(){launchHomeDidactiqueInterval();});$('.side.oops a').click(function(event){event.preventDefault();window.location.href=$(this).attr('href');return false;});};function launchHomeDidactiqueInterval(){_homeTimeInterval=setInterval(function(){if(!_hoverHomeDidactique){var $next=$('.tabs .active',_$homeBlockDidactique).next();if(!$next.length)
  9. $next=$('.tabs .active',_$homeBlockDidactique).siblings().eq(0);$next.trigger('click');}},15000);};function initHomeV2(){initCards('#home-v2 .panel-pane.news-panel .panel-col-first .views-row');$('.panel-pane.showroom .group-content-wrapper','#home-v2').attr('data-400-center-top','transform:translateX(-43em);opacity:0;').attr('data-100-center-center','transform[quadratic]:translateX(0em);opacity[quadratic]:1;').attr('data-top-bottom','transform[quadratic]:translateX(10em);');$('.panel-pane.showroom .field-name-field-bandeau img','#home-v2').attr('data-400-bottom-top','transform:translateY(-20em);').attr('data-100-top-bottom','transform:translateY(5em);');$('.panel-pane.bdd .group-content-wrapper','#home-v2').attr('data-400-center-top','transform:translateX(40em);opacity:0;').attr('data-100-center-center','transform[quadratic]:translateX(0em);opacity[quadratic]:1;');$('.panel-pane.bdd .field-name-field-bandeau img','#home-v2').attr('data-400-bottom-top','transform:translateX(0em);').attr('data-100-top-bottom','transform[quadratic]:translateX(-40em);');$('.panel-pane.news-panel .center-wrapper .panel-panel','#home-v2').each(function(i,e){$(this).attr('data-anchor-target',"#news-pane").attr('data--'+(i+1)*75+'-bottom-top','transform:translateY(20em);opacity:0;').attr('data-center-top','transform[quadratic]:translateY(0em);opacity:1;');});$('.panel-pane.formations .group-content-wrapper','#home-v2').attr('data-50-bottom-top','transform:translateX(20em);opacity:0;').attr('data-center-top','transform[quadratic]:translateX(0em);opacity:1;');$('.panel-pane.services .group-content-wrapper','#home-v2').attr('data-50-bottom-top','transform:translateX(20em);opacity:0;').attr('data-center-top','transform[quadratic]:translateX(0em);opacity:1;');$('.panel-pane.publication .views-row','#home-v2').each(function(i,e){$(this).attr('data--'+i*100+'-bottom-top','opacity:0;').attr('data-'+i*50+'-center-center','opacity:1;');});_skrollr=skrollr.init({skrollrBody:"root"});};function initLayout(){if(!_max_768()){var height=$('#header').h()+$('#tasks').h();if(!_max_480()&&!_touch){height+=$('#utilities').h()+15;}
  10. if(!$('html').is(".ie8")){$('#container').animate({'padding-top':height},300);}}};function initInfinitScroller(){$.event.trigger({type:'init-scroller-pager',pager:$('ul.pager','#content')});$(document).bind('scroll',function(event){checkInfinitScroller();});};function checkInfinitScroller(){if($(window).scrollTop()+$(window).height()>getDocHeight()-200){infinitScrollPager();}};function infinitScrollPager(){if($('ul.pager','#content').length){var $nextpage=$('ul.pager .pager-current','#content').next(),href=$('a',$nextpage).attr('href');if(href){$.event.trigger({type:'record-stat',path:href});$.event.trigger({type:'load-scroller-pager',href:href});}}};function initEvents(){$(document).bind('init-layout',initLayout).bind('loading-content',onLoadingContent).bind('loaded-content',onLoadedContent).bind('resultschanged',onResultsChanged).bind('resultscompleted',onResultsCompleted).bind('mybookmarks-block-updated',onMybookmarksBlockUpdate).bind('mylists-block-builded',onMyListsBlockBuilded).bind('mylists-block-updated',onMyListsBlockUpdate).bind('flagGlobalAfterLinkUpdate',onAfterFlaging).bind('record-stat',onRecordStat).bind('view-mode-changed',onViewModeChanged).bind('ajax-register-block-loaded',onAjaxRegisterBlockLoaded);$(window).bind('resize',onResizeWindow);initFlagsEvent();$('#block-user-login h2, #block-menu-menu-top-menu h2').bind('click',function(event){event.preventDefault();$(this).parent('.block').toggleClass('hovered');$('.hovered').not($(this).parent('.block')).removeClass('hovered');return false;});$('#block-materio-search-api-materio-search-api-viewmode .viewmode-link').bind('vm-clicked-active',function(event){$(this).parents('.block').toggleClass('hovered');$('.hovered').not($(this).parents('.block')).removeClass('hovered');});$('#block-materio-search-api-materio-search-api-viewmode .viewmode-link').bind('vm-clicked',function(event){$(this).parents('.block').removeClass('hovered');$('.hovered').not($(this).parents('.block')).removeClass('hovered');});};function onLoadingContent(event){_$content.addClass('faded');$('#materio-search-api-search-form').addClass('loading');};function onLoadedContent(event){_$content.removeClass('faded');$('#materio-search-api-search-form').removeClass('loading');};function onResultsChanged(event){$(document).scrollTop(0);focusCard($('#content .search-results, #content .actuality-items').children('.node:first-child'));onResultsCompleted(event);};function onResultsCompleted(event){checkInfinitScroller();if(event.container!=undefined){setTimeout(function(){initCards(event.container);setUpGrid(event.container);},100);}};function initCards(container){trace('theme :: initCards',container);var $container=$(container);$container.children('.node:not(.listened)').bind('mouseenter focused mousemove click mouseleave',onCardEventDispatcher).each(function(i){protectFigures(this);if(_isLoggedIn){if(!$container.is('.modal-content')){initPreview(this);}else{if(!$(this).is(":first-child")){var $closebtn=$('<section><i class="icon-remove"></i></section>');$closebtn.bind('click',function(){$(this).parents('.node-materiau').remove();});$('nav.nav',this).append($closebtn);}}}}).addClass('listened');};function setUpGrid(container){var $card,top,old_top,col=0,line=0;$(container).children('.node').each(function(i){$card=$(this);top=$card.offset().top;if(old_top!=top){line++;old_top=top;col=0;}
  11. col++;$card.attr('column',col).attr('line',line);});};function onViewModeChanged(event){if(_isBreveMateriauNodePage){$.event.trigger('loading-content');var url=_settings.basePath+_settings.pathPrefix+'materio_search_api_ajax/node/'+_themeSettings.node_nid;$.getJSON(url,function(json){$.event.trigger('loaded-content');$('#content>.inner-content').html(json.node);$.event.trigger({type:'resultschanged',container:'#content>.inner-content'});});}};function onCardEventDispatcher(event){var vmode=event.currentTarget.className.match(/vm-([a-z|A-Z]+)/);var cf='on_'+event.type+'_card';var f='on_'+event.type+'_'+vmode[1];if(typeof _this[cf]=='function')
  12. _this[cf].call(this,event);if(typeof _this[f]=='function')
  13. _this[f].call(this,event);};MaterioBaseTheme.prototype.on_mousemove_card=function(event){focusCard($(this));};MaterioBaseTheme.prototype.on_mouseenter_cardsmall=function(event){showLazyLoadedImages(event.currentTarget);};MaterioBaseTheme.prototype.on_focused_cardsmall=function(event){v1=$(this);v2=v1.offset();_$tooltip.html($('.group-header',this).clone().addClass('smallcard')).css({top:v2.top,left:v2.left+5+($(this).w())}).removeClass('op-hidden').addClass('op-visible');};MaterioBaseTheme.prototype.on_mousemove_cardsmall=function(event){horiHoverImagesSwitcher(event);_$tooltip.css({top:event.pageY-_$tooltip.h()-5,left:event.pageX+5+($(this).w()-event.layerX)});};MaterioBaseTheme.prototype.on_mouseleave_cardsmall=function(event){$('.images img.op-visible',this).removeClass('op-visible').addClass('op-hidden').eq(0).removeClass('op-hidden').addClass('op-visible');if($(this).is('.focused'))
  14. _$tooltip.removeClass('op-visible').addClass('op-hidden');};MaterioBaseTheme.prototype.on_mouseenter_cardmedium=function(event){showLazyLoadedImages(event.currentTarget);$card=$(event.currentTarget);if(!$('.columnized',$card).size()&&!$('body').is('.role-7','role-2')){var ch=$card.h()-$('.group-header',$card).h()-30;columnsPage($('.field-name-field-description, .field-name-body',$card),210,ch);$('.group-side-4',$card).wrapInner('<div class="column-wrapper">').find('.field-item').addClass('dontsplit');columnsPage($('.group-side-4 .column-wrapper',$card),210,ch);}
  15. prepareAssociatedMaterials(event.currentTarget);};MaterioBaseTheme.prototype.on_mousemove_cardmedium=function(event){horiHoverImagesSwitcher(event);};MaterioBaseTheme.prototype.on_click_cardmedium=function(event){if(!$(event.target).is('.flag')&&!$(event.target).parent().is('.flag'))
  16. sideSwitcher(event);};MaterioBaseTheme.prototype.on_mouseleave_cardmedium=function(event){v1=$('.side.op-visible');if(v1.is('.oops','.upgrade')||$('.upgrade',v1).size()){sideSwitcher(event,0);}};MaterioBaseTheme.prototype.on_mouseenter_cardbig=function(event){showLazyLoadedImages(event.currentTarget);if(!$('.columnized',event.currentTarget).size()){columnsPage($('.field-name-field-description, .field-name-body',event.currentTarget),425,270);$('.group-4',event.currentTarget).wrapInner('<div class="column-wrapper">').find('.field-item').addClass('dontsplit');columnsPage($('.group-4 .column-wrapper',event.currentTarget),425,270);}
  17. prepareAssociatedMaterials(event.currentTarget);};MaterioBaseTheme.prototype.on_mousemove_cardbig=function(event){horiHoverImagesSwitcher(event);};MaterioBaseTheme.prototype.on_click_cardbig=function(event){sideSwitcher(event);};MaterioBaseTheme.prototype.on_mouseleave_cardbig=function(event){if($('.side.op-visible').is('.oops')||$('.side.op-visible').is('.upgrade')){sideSwitcher(event,0);}};MaterioBaseTheme.prototype.on_mouseenter_cardfull=function(event){showLazyLoadedImages(event.currentTarget);prepareAssociatedMaterials(event.currentTarget);};MaterioBaseTheme.prototype.on_mousemove_cardfull=function(event){horiHoverImagesSwitcher(event);};function horiHoverImagesSwitcher(event){var $curtar=$(event.currentTarget);var layerX=(event.offsetX||event.pageX-$(event.target).offset().left);if(layerX&&$curtar.is('.image-ready')){var $imgs=$('.group-images figure',event.currentTarget);if($(event.target).parents('.group-images').length){var imgw=$imgs.eq(0).w(),rapport=imgw/$imgs.length,mx=layerX>imgw?imgw-1:layerX,rapport_pos=Math.floor(mx/rapport);rapport_pos=rapport_pos<0?0:(rapport_pos>($imgs.length-1)?$imgs.length-1:rapport_pos);if(!$imgs.eq(rapport_pos).is('.op-visible')){$.event.trigger({type:'record-stat',categorie:'Card event',action:'image slide switch',label:rapport_pos});$imgs.removeClass('op-visible').addClass('op-hidden').eq(rapport_pos).removeClass('op-hidden').addClass('op-visible');}}else{$imgs.removeClass('op-visible').addClass('op-hidden');$imgs.eq(0).removeClass('op-hidden').addClass('op-visible');}}};function protectFigures(context){context=context==null?'body':context;$('figure:not(.protected)',context).append('<img class="blank" src="'+_settings.basePath+_themeSettings.themePath+'/img/blank.gif" />').addClass('protected').bind("contextmenu",function(e){alert("Cette image est soumise au droit d'auteur.");return false;});};function initPreview(node){$('nav.nav',node).append($('<section class="preview"><i class="fi-eye"></i></section>').bind('click',onClickPreviewCardBtn));};function onClickPreviewCardBtn(event){event.preventDefault();previewCard($(this).parents('.node'));return false;};function previewCard($card){var matches=$card.attr('class').match(/\bnode-(\d+)\b/);var viewmode=false;var cur_vm=getCurrentViewmode();for(var vm in _viewmodes)
  18. if(vm!=cur_vm&&_viewmodes[vm]>_viewmodes[cur_vm]&&_viewmodes[vm]<$(window).width())
  19. viewmode=vm;if(typeof matches[1]!==undefined&&viewmode){$.event.trigger('loading-content');$.getJSON(_settings.basePath+_settings.pathPrefix+'materio_search_api_ajax/node/'+matches[1],{viewmode:viewmode},function(json){$.event.trigger('loaded-content');previewLoaded(json);});}};function previewLoaded(json){var $modal=$('<div>').addClass('modal-content').append(json.node);var $modal_wrapper=$('.modal-wrapper');if(!$modal_wrapper.size())
  20. $modal_wrapper=$('<div>').addClass('modal-wrapper').append($('<div>').addClass('modal-bg')).appendTo('body');$modal_wrapper.append($modal).bind('click',function(event){_previewIsOpen=false;$(this).remove();});$modal.bind('click',function(event){event.stopPropagation();});_previewIsOpen=true;initCards('.modal-content');$.event.trigger({type:'previewloaded',container:'.modal-content'});};function moveGridFocus(event,side){var $old_focused=$('#content .search-results, #content .actuality-items').children('.node.focused').first();var $new_focused;switch(side){case'r':$new_focused=$old_focused.next();break;case'l':$new_focused=$old_focused.prev();break;case'u':case'd':var dir=side=="d"?1:-1;var column=$old_focused.attr('column');while(($new_focused==undefined||!$new_focused.size())&&column>0){$new_focused=$('.node[column='+column+'][line='+(parseInt($old_focused.attr('line'))+dir)+']');column--;}
  21. break;}
  22. focusCard($new_focused);docScrollTo($new_focused);};function focusCard($card){if(!$card.size()||$card.is('.focused')||$card.parents('.modal-content').size())
  23. return;$('#content .search-results, #content .actuality-items').children('.node.focused').removeClass('focused');$card.addClass('focused');if(_previewIsOpen){previewCard($card);}
  24. $card.trigger('focused');};function showLazyLoadedImages(context){var $this=$(context);if(!$this.is('.lazy-processed')){$this.addClass('lazy-processed').find('img.lazy').each(function(index){var $img=$(this);$img.attr('src',$img.attr('data-original')).removeAttr('data-original');});setTimeout(function(){$this.addClass('image-ready');},300);}};function prepareAssociatedMaterials(card){$('.field-name-field-materiau-ref a:not(.prepared)',card).addClass("prepared").bind('click',onClickAssociatedMaterial);};function onClickAssociatedMaterial(event){event.preventDefault();var $this=$(this);var nid=$this.attr('href').match(/^\/(fr|en)\/node\/(\d+)$/)[2];var $prt=$this.parents('.node-materiau');if($prt.parent().is('.modal-content')){$prt.parent().find('.node-'+nid+'.associated').remove();loadAssociatedNode($prt,nid);}else{var $n=$prt.nextUntil('.node-materiau:not(.associated)').filter('.node-'+nid);if($n.size()){focusCard($n);}else{loadAssociatedNode($prt,nid);}}
  25. return false;};function loadAssociatedNode($prt,nid){var viewmode=$prt.attr('class').match(/vm-([^\s]+)/);$.event.trigger('loading-content');var url=_settings.basePath+_settings.pathPrefix+'materio_search_api_ajax/node/'+nid;$.getJSON(url,{viewmode:viewmode[1]},function(json){$.event.trigger('loaded-content');displayAssociated($prt,$(json.node));$.event.trigger({type:'resultscompleted',container:'#content .actuality-items, #content .search-results'});});};function displayAssociated($prt,$n){$n.addClass('associated').addClass('just-added');$prt.after($n);initCards($prt.parent());(function($n){setTimeout(function(){$n.removeClass('just-added');focusCard($n);},100);}($n));};function sideSwitcher(event,delta){var $sides=$('.side',event.currentTarget);if($sides.length>1){if(typeof delta=='undefined'){var delta=0;$sides.each(function(i){if($(this).is('.op-visible')){delta=i+1;return false;}});delta=delta==0?1:(delta==$sides.length?0:delta);}
  26. $.event.trigger({type:'record-stat',categorie:'Card event',action:'side switch',label:delta});$sides.addClass('op-hidden').removeClass('op-visible').eq(delta).removeClass('op-hidden').addClass('op-visible');}};function columnsPage($elmt,cw,ch){var cls=Math.ceil($elmt.h()/ch);$elmt.addClass('columnized').width(cw*cls).columnize({width:cw,height:ch,lastNeverTallest:true});if(cls>1){$elmt.find('.column').each(function(index){var $this=$(this);if(!$this.find('*').length){$this.prev().addClass('last');$this.remove();return true;}});$elmt.find('.column').each(function(index){var $this=$(this);if(!$this.is('.first'))
  27. $this.children('*:first-child').prepend('<span cw="'+cw+'" col="'+(index-1)+'" class="column-switcher prev-column">‹</span> ...');if(!$this.is('.last'))
  28. $this.children('*:last-child').append('... <span cw="'+cw+'" col="'+(index+1)+'" class="column-switcher next-column">›</span>');});$('.column-switcher',$elmt).bind('click',onColumnSwitcherClick);}};function onColumnSwitcherClick(event){event.preventDefault();var $this=$(event.currentTarget),$columnized=$this.parents('.columnized');$.event.trigger({type:'record-stat',categorie:'Card event',action:'column switch',label:$this.attr('col')});$columnized.css({marginLeft:-1*$this.attr('cw')*$this.attr('col')+'px'});return false;}
  29. function initViewmodes(){checkViewmodesResponsive();};function checkViewmodesResponsive(){if(_480_768()){if($('.viewmode-link.active').is('.viewmode-cardfull')){$('.viewmode-cardbig').trigger('click');}}else if(_max_480()){if($('.viewmode-link.active').is('.viewmode-cardbig, .viewmode-cardfull')){$('.viewmode-cardmedium').trigger('click');}}};function getCurrentViewmode(){for(var vm in _viewmodes)
  30. if($('.viewmode-link.active.viewmode-'+vm).size())
  31. return vm;};function initFlagsEvent(){$('.bookmarks, .mylists .flaged').children('.node:not(.listened)').bind('mouseenter mousemove click mouseleave',onCardEventDispatcher).addClass('listened');};function onAfterFlaging(event){var $target=$(event.link).parents('article.node');if(event.flagStatus=='flag'){$target.addClass('flaged');}else if(event.flagStatus=='unflag'){if($('.flag-lists-entity-links a.unflag-action',$target).length==0)
  32. $target.removeClass('flaged');}};function onMybookmarksBlockUpdate(event){initFlagsEvent();initLayout();};function onClickList(event){var $link=$(event.currentTarget).addClass('active'),name=$link.attr('name'),$block=$link.parents('.block'),$flaged=$('.flaged.'+name,$block).addClass('active');$link.siblings().removeClass('active');$flaged.siblings().removeClass('active');createCookie('materiomyflaglistsopened',name,1);$flaged.parents('.mylists').height($flaged.h());initLayout();};function onMyListsBlockUpdate(event){initFlagsEvent();initLayout();};function onMyListsBlockBuilded(event){showLazyLoadedImages(event.block);};MaterioBaseTheme.prototype.on_mouseenter_bookmark=function(event){_$tooltip.html($('.group-header',this).clone()).css({top:event.pageY-_$tooltip.h()-5,left:event.pageX+5+($(this).w()-event.layerX)}).removeClass('op-hidden').addClass('op-visible');};MaterioBaseTheme.prototype.on_mousemove_bookmark=function(event){_$tooltip.css({top:event.pageY-_$tooltip.h()-5,left:event.pageX+5+($(this).w()-event.layerX)});};MaterioBaseTheme.prototype.on_mouseleave_bookmark=function(event){$('.images img.op-visible',this).removeClass('op-visible').addClass('op-hidden').eq(0).removeClass('op-hidden').addClass('op-visible');_$tooltip.removeClass('op-visible').addClass('op-hidden');};function initKeyboardShortcuts(){$(document).bind('keydown','Shift+:',shortcut_focusSearchField).bind('keydown','/',shortcut_focusSearchField).bind('keydown','Alt+1',shortcut_viewmodeSmall).bind('keydown','Alt+2',shortcut_viewmodeMedium).bind('keydown','Alt+3',shortcut_viewmodeBig).bind('keydown','Alt+4',shortcut_viewmodeFull).bind('keydown','space',shortcut_togglePreview).bind('keydown','esc',shortcut_closeModaleContent).bind('keydown','up',shortcut_onUpArrow).bind('keydown','right',shortcut_onRightArrow).bind('keydown','down',shortcut_onDownArrow).bind('keydown','left',shortcut_onLeftArrow);};function shortcut_focusSearchField(e){if($('#edit-searchfield').size()){var stat_event={type:'record-stat',categorie:'Shortcuts'};stat_event.action='slash';stat_event.label='Focus on search text field';$.event.trigger(stat_event);$('#edit-searchfield').focus();e.stopPropagation();e.preventDefault();return false;}};function shortcut_viewmodeSmall(e){if($('a.viewmode-link.viewmode-cardsmall').size()){var stat_event={type:'record-stat',categorie:'Shortcuts'};stat_event.action='Alt+1';stat_event.label='Change view mode : card small';$.event.trigger(stat_event);$('a.viewmode-link.viewmode-cardsmall').click();return false;}};function shortcut_viewmodeMedium(e){if($('a.viewmode-link.viewmode-cardmedium').size()){var stat_event={type:'record-stat',categorie:'Shortcuts'};stat_event.action='Alt+2';stat_event.label='Change view mode : card medium';$.event.trigger(stat_event);$('a.viewmode-link.viewmode-cardmedium').click();return false;}};function shortcut_viewmodeBig(e){if($('a.viewmode-link.viewmode-cardbig').size()){var stat_event={type:'record-stat',categorie:'Shortcuts'};stat_event.action='Alt+3';stat_event.label='Change view mode : card big';$.event.trigger(stat_event);$('a.viewmode-link.viewmode-cardbig').click();return false;}};function shortcut_viewmodeFull(e){if($('a.viewmode-link.viewmode-cardfull').size()){var stat_event={type:'record-stat',categorie:'Shortcuts'};stat_event.action='Alt+4';stat_event.label='Change view mode : card full';$.event.trigger(stat_event);$('a.viewmode-link.viewmode-cardfull').click();return false;}};function shortcut_togglePreview(e){$.event.trigger({type:'record-stat',categorie:'Shortcuts',action:'Space',label:'Space toggle preview'});if(_previewIsOpen){if($('body>.modal-wrapper').size()){$('body>.modal-wrapper').click();_previewIsOpen=false;return false;}}else{previewCard($('#content .search-results, #content .actuality-items').children('.node.focused:first'));}};function shortcut_closeModaleContent(e){if($('body>.modal-wrapper').size()){$.event.trigger({type:'record-stat',categorie:'Shortcuts',action:'Esc',label:'Esc from modal content'});$('body>.modal-wrapper').click();_previewIsOpen=false;return false;}};function shortcut_onUpArrow(e){moveGridFocus(e,'u');};function shortcut_onRightArrow(e){moveGridFocus(e,'r');};function shortcut_onDownArrow(e){moveGridFocus(e,'d');};function shortcut_onLeftArrow(e){moveGridFocus(e,"l");};function onResizeWindow(e){clearInterval(_resizeTimer);_resizeTimer=setTimeout(function(){initLayout();checkViewmodesResponsive();setUpGrid("#content .actuality-items, #content .search-results");},200);};function initMembershipForm(){switch(window.location.hash){case'#a':$('#edit-submitted-column-left-membership-options-1').attr('checked','checked');break;case'#b':$('#edit-submitted-column-left-membership-options-2').attr('checked','checked');break;case'#c':$('#edit-submitted-column-left-membership-options-3').attr('checked','checked');break;}
  33. $('#webform-component-column-left--membership-options').change(function(event){if($('input[type="radio"]:checked',this).is('#edit-submitted-column-left-membership-options-3')){$('#webform-component-column-right--collaborators').show();}else{$('#webform-component-column-right--collaborators').hide();}
  34. $('div.form-item.selected',this).removeClass('selected');$('input[type="radio"]:checked',this).parents('div.form-item').addClass('selected');}).trigger('change');};$.fn.h=function(){if(this.css('height')==undefined)
  35. return 0;return parseInt(this.css('height'))+parseInt(this.css('padding-top'))+parseInt(this.css('padding-bottom'));};$.fn.w=function(){if(this.css('width')==undefined)
  36. return 0;return parseInt(this.css('width'))+parseInt(this.css('padding-left'))+parseInt(this.css('padding-right'));};function getDocHeight(){var D=document;return Math.max(Math.max(D.body.scrollHeight,D.documentElement.scrollHeight),Math.max(D.body.offsetHeight,D.documentElement.offsetHeight),Math.max(D.body.clientHeight,D.documentElement.clientHeight));};function viewport(){var e=window,a='inner';if(!('innerWidth'in window)){a='client';e=document.documentElement||document.body;}
  37. return{width:e[a+'Width'],height:e[a+'Height']};};function initForms(){$('#edit-searchfield:not(.processed)').bind('focus',function(event){var $this=$(this);if($this.val()==$this.attr('default'))
  38. $this.val('');}).bind('focusout',function(event){var $this=$(this);if($this.val()=="")
  39. $this.val($this.attr('default'));}).addClass('processed');hideLabelsFromRegisterForm();};function hideLabelsFromRegisterForm(){var $this,id,label,description;$('input.form-text','#block-user-login, #block-materio-user-user-register, .pane-materio-user-user-register, #block-materio-user-user-createaccount').each(function(i){$this=$(this);id=$this.attr('id');label=$('label[for='+id+']').hide().text();description=$this.parent().find('.description').hide().text();if($this.attr('placeholder')=='')
  40. $this.attr('placeholder',label);$this.attr('title',description);});};function onAjaxRegisterBlockLoaded(event){hideLabelsFromRegisterForm();};function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
  41. else var expires="";document.cookie=name+"="+value+expires+"; path=/";};function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
  42. return null;};function eraseCookie(name){createCookie(name,"",-1);};function onRecordStat(event){if(typeof _gaq!=='undefined'){if(event.path){_gaq.push(['_trackPageview',event.path]);}else{_gaq.push(['_trackEvent',event.categorie,event.action,event.label,event.value]);}}};function docScrollTo($e){if($e.size())
  43. $('html,body').animate({scrollTop:$e.offset().top-$(window).height()*0.5+$e.height()*0.5},500);};init();};$(document).ready(function(){var materiobasetheme=new MaterioBaseTheme();});Drupal.behaviors.feedbackForm={attach:function(context){$('#block-feedback-form',context).once('feedback',function(){var $block=$(this);$block.find('span.feedback-link').prepend('<span id="feedback-form-toggle">feedback</span> ').css('cursor','pointer').toggle(function(){Drupal.feedbackFormToggle($block,false);},function(){Drupal.feedbackFormToggle($block,true);});$block.find('form').hide();$block.show();});}};Drupal.feedbackFormToggle=function($block,enable){$block.find('form').slideToggle('medium');if(enable){$('#feedback-form-toggle',$block).html('feedback');}
  44. else{$('#feedback-form-toggle',$block).html('feedback (close)');}};})(jQuery);