function objectIsEmpty(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(function(e){Drupal.behaviors.init_theme={};Drupal.behaviors.init_theme.attach=function(t){e("#messages-and-help > div.messages:not(.processed)").addClass("processed").each(function(){if(e("a",this).size()||e(this).is(".error")||e(this).is(".warning")||e(this).text().length>100){e(this).prepend("X ");e("span.close",this).click(function(){e(this).parent().slideUp("fast")})}else e(this).animate({opacity:1},5e3,"linear",function(){e(this).slideUp("fast")})});!e("body").is(".front")&&!e("body").is(".node-type-performance")&&e("#main").jScrollPane({autoReinitialise:!0,hijackInternalLinks:!0});e("#block-menu-block-2 ul.menu").listnav({cookieName:"test",attribute:"nom"})};Drupal.behaviors.init_timeline={};Drupal.behaviors.init_timeline.attach=function(t){function Dt(t,n){var t=t||e("body"),n=n||!1;e.paScPlayer.stopAll();var r=e('a[rel="soundcloud"]',t);if(r.size()){r.parents(".field-item").find("span.ext").remove();r.paScPlayer({autoplay:n})}}e.paScPlayer.defaults.onDomReady=null;e.paScPlayer.defaults.loadArtworks=0;if(e("html").is(".oldie"))e("html").addClass("classic-nav");else if(e("body").is(".front")||e("body").is(".node-type-performance")){var n=e('
').appendTo(e('
').appendTo("body")).verticalcenter(),r,i,s,o,u,a={},f=[],l=[],c,h=["dot","titles","thumbnails","images"],p,d={},v=[],m={},g={},y=[],b,w="",E={intro:"layout-intro",timeline:"layout-timeline",perfnode:"layout-perfnode"},S,x=!1,T,N,C,k,L,A=Drupal.settings.basePath+Drupal.settings.pathPrefix,O=Drupal.settings.perfarttimeline.strings;function M(){if(Mt("advanced-nav")!="yes"&&Mt("classic-nav")!="yes"){e.getJSON(A+"perfart/ajax/home",function(t){console.log("data",t);n.prepend(t.front).verticalcenter();e(".nodetitle",n).hide()});var t=e('
').appendTo(n);t.append(e("
"+O.advanced_nav+" ").bind("click",function(e){Ot("advanced-nav","yes");t.hide();D()}));t.append(e("
"+O.classical_nav+" ").bind("click",function(e){Ot("classic-nav","yes");_()}))}else Mt("advanced-nav")=="yes"?D():_()}function _(){B();e("html").addClass("classic-nav")}function D(){r=e('
').appendTo(n).append("
"+O.loading_timeline+"
").append(e('
'));i=e('
').appendTo("#center");s=e('
').appendTo("#center");o=e("
").attr("id","timeline").appendTo("#center").append('
Chronologie ');u=e("
").attr("id","timeline-container").appendTo("#timeline");N=e('
').appendTo(i);C=e('
').appendTo(i);L=e('
').appendTo("body");e("body").addClass("view-mode-"+h[0]);c=new links.Timeline(document.getElementById("timeline-container"));var t={width:"100%",height:u.height()+"px",style:"dot",editable:!1,axisOnTop:!0,min:new Date("1950"),max:new Date("2020"),start:new Date("1950"),end:new Date("2020"),showCurrentTime:!1,animate:!0,animateZoom:!0,intervalMin:31536e6,showNavigation:!0,eventMargin:0,eventMarginAxis:4,mousewheel:"move",dblclick:"zoom",language:Drupal.settings.perfarttimeline.language};c.draw([],t);N.bind("click",Tt);C.bind("click",Tt);e(".close",i).bind("click",function(e){z()});e(".node-container",i).height(i.height());kt("intro");q();I();k=new Date;P()}function P(t){t=t||0;var n=A+"perfart/ajax/dates/"+t,i;t==0&&e(".progress",r).width("5%");e.getJSON(n,function(n){var s,o,u;e(".progress",r).width((t+1)*(100/Drupal.settings.perfart.effectuations_pages)+"%");for(ind in n){if(n[ind].start===undefined)continue;s=n[ind];s.start=new Date(s.start.year,s.start.month,s.start.day);typeof s.end!="undefined"&&(s.end=new Date(s.end.year,s.end.month,s.end.day));for(filterstitle in s.filters){if(d[filterstitle]===undefined){d[filterstitle]=[];v[filterstitle]=""}for(tid in s.filters[filterstitle]){m[tid]===undefined&&(m[tid]=filterstitle);s.tids===undefined&&(s.tids=[]);s.tids.push(tid);i=new RegExp("tid"+tid+";");if(v[filterstitle].search(i)!=-1)continue;v[filterstitle]+="tid"+tid+";";s.filters[filterstitle][tid].visible=!0;d[filterstitle].push(s.filters[filterstitle][tid])}}for(var c=0;c
=0;i--)if(array_indexOf(e.tids,y[i])==-1){r=!1;break}if(r){f.push(e);l.push(nid)}}Y()}function Y(){kt("timeline");c.draw(f);c.setVisibleChartRangeAuto();W()}function Z(e){var t=array_indexOf(l,e),n=f[t];c.setSelection([{row:t}]);c.setVisibleChartRange(n.start,n.start)}function et(){var t=0;for(title in d){var n=e(' '),r=e('').addClass(title).addClass("filter-"+t).appendTo(s).append('
').append('
'+Drupal.settings.perfart.strings[title]+" ").append(n).wrapInner('
').append('
'),i=e(".list ul",r);title=="peoples"?d[title].sort(tt):d[title].sort(nt);for(filter in d[title])typeof d[title][filter]["tid"]!="undefined"&&i.append(e('
').append('
'+d[title][filter].name+" "));n.bind("focus",rt).bind("keydown",it).bind("valuechanged",st);e("li",i).bind("click",ot);t++}e(".list","#filters").jScrollPane({autoReinitialise:!0})}function tt(e,t){if(typeof e=="object"){var n=e.nom?e.nom:e.name,r=t.nom?t.nom:t.name;n=n.toLowerCase().latinise();r=r.toLowerCase().latinise();if(n
r)return 1}return 0}function nt(e,t){if(typeof e=="object"){var n=e.name.toLowerCase().latinise(),r=t.name.toLowerCase().latinise();if(nr)return 1}return 0}function rt(t){var n=e(this);n.attr("value")==O.search&&e(this).attr("value","")}function it(t){var n=e(this);setTimeout(function(){n.trigger("valuechanged")},1)}function st(t){console.log("filterFiltersList",t);var n=e(this),r=n.val(),i=d[n.attr("key")],s=n.siblings(".list"),o,u;clearTimeout(b);if(r!="")b=setTimeout(function(){console.log("value = "+r);o=new RegExp(r,"i");for(key in i){u=i[key];if(u.name.search(o)==-1){if(u.visible){u.visible=!1;e("li."+u.tid,s).height(0)}}else if(!u.visible){u.visible=!0;e("li."+u.tid,s).height("auto")}}},500);else for(key in i){u=i[key];u.visible=!0;e("li."+u.tid,s).height("auto")}}function ot(t){var n=e(this);if(!n.is(".selected")){var r=e("span",n).clone(),i=r.attr("class");n.addClass("selected").parents(".filter").find(".filters-selected").append(r);r.bind("click",ut);var s=jQuery.Event("click");s.dontfilterdate=!0;e(".close-search","#search-block-form").trigger(s);y.push(i);at();G();ft()}}function ut(t){if(!e("body").is(".layout-timeline"))return;console.log("onClickRemoveFilter",t);var n=e(this),r=n.attr("class"),i=t.dontfilterdate||!1;n.parents(".filter").find(".filters-selection").find("li."+r).removeClass("selected");n.remove();setTimeout(function(){array_remove(y,r);at();ft();i||G()},5)}function at(){var t,n;e(".filter .filters-selection li:not(.selected)").each(function(){t=!0;n=e(this).attr("class");if(y.length)for(var r=y.length-1;r>=0;r--)if(array_indexOf(g[y[r]],n)==-1){t=!1;break}t?e(this).height("auto"):e(this).height(0)})}function ft(){var t=0;e(".filters-selected","#filters").each(function(n,r){t=e(r).height()>t?e(r).height():t});s.css({marginBottom:t+5+"px"})}function lt(t){var n=jQuery.Event("click");n.dontfilterdate=!0;console.log("resetFilters : click",n);e("#filters .filters-selected span").trigger(n)}function ct(){e("#search-block-form").bind("submit",function(t){var n=e(this);setTimeout(function(){var e=n.find('input[name*="search_block_form"]').val();ht(e,n)},10);return!1})}function ht(t,n){if(t!==undefined&&t!==""&&t.length>=2){t=t.replace("/"," ");n.addClass("loading");e.getJSON(Drupal.settings.basePath+Drupal.settings.pathPrefix+"perfart/search_api/",{typed:t},function(e){n.removeClass("loading");console.log("json",e);pt(e)})}}function pt(t){console.log("searchFiltreTimeline | json",t);var n;f=[];l=[];for(var n in t.results)if(typeof a[n]!="undefined"){f.push(a[n]);l.push(n)}lt(!1);Y();e(".container-inline .close-search","#search-block-form").size()||e(".container-inline","#search-block-form").append(e('').bind("click",dt))}function dt(t){console.log("resetSearch");e(t.currentTarget).remove();var n=t.dontfilterdate||!1;e("#search-block-form").find('input[name*="search_block_form"]').val("");if(n)return;f=[];l=[];for(nid in a){f.push(a[nid]);l.push(nid)}Y()}function vt(t){i.addClass("loading").children(".node");e(".node-container .node",i).hide();St();kt("perfnode");t=t.replace(/^\//,"");t=A+t;e.getJSON(t,function(e){gt(e);History.pushState({json:e,ajaxpath:t},a[e.nid].perf_title+" | "+O.site_name,A+a[e.nid].node_link);mt(a[e.nid].node_translation)})}function mt(t){mt.homeTranslationLink||(mt.homeTranslationLink=e(".language-switcher-locale-url li:not(.active) a").attr("href"));var n=t?Drupal.settings.basePath+t:mt.homeTranslationLink;e(".language-switcher-locale-url li:not(.active) a").attr("href",n)}function gt(t){Z(t.nid);var n=e(".node-container",i);i.removeClass("loading");n.find(".scroller").html(t.node_view).children(".node").children().addClass("grid-block");yt(e(".scroller>.node",n));e(".node .node-title",n).after(e(".node figure.grid_large",n));e(".node .field-type-textauthor",n).children(".field-item").jScrollPane();Dt(n);n.bind("grid_ready",Et);S=new Lt(n,{cell_w:50,cell_h:50,padding:{t:0,r:0,b:0,l:0},gouttiere:5,grille:!1,decalage:!1,latitude:0,augmentable:!0});wt(n);xt(t.nid);x=t.nid}function yt(e){array_randomize(e.children("figure")).each(function(e){bt(this,!0,e)});array_randomize(e.children().find("figure")).each(function(e){bt(this)})}function bt(t,n,r){var i=n||!1,s,o;e("img:not([path])",t).each(function(){e(this).attr("path",e(this).attr("src"))});e("img",t).attr("src","");i?r==0?s="grid_large":r<5?s="grid_medium":s="grid_small":s="grid_medium";o=e("img."+s,t);o.attr("src",o.attr("path"));e(t).css({width:o.attr("width"),height:o.attr("height")}).addClass(s);e("img:not(.blank,."+s+")",t).remove()}function wt(t){e("figure",t).bind("contextmenu",function(e){alert("Cette image est soumise au droit d'auteur.");return!1}).addClass("protected")}function Et(t){e(".node-container",i).find(".scroller").height(t.grid.maxheight);if(!T){var n=e(".node-container",i).jScrollPane({verticalGutter:5,autoReinitialise:!0});T=n.data("jsp")}}function St(){C.attr("url","");N.attr("url","")}function xt(e){var t=array_indexOf(l,e);typeof l[t-1]!="undefined"?C.attr("url",a[l[t-1]].ajax_link).show():C.hide();typeof l[t+1]!="undefined"?N.attr("url",a[l[t+1]].ajax_link).show():N.hide()}function Tt(t){var n=e(this).attr("url");n!=""&&vt(n)}function Nt(){if(x){var e=array_indexOf(l,x);vt(a[l[e+1]].ajax_link)}}function Ct(){if(x){var e=array_indexOf(l,x);vt(a[l[e-1]].ajax_link)}}function kt(t){for(key in E)e("body").removeClass(E[key]);e("body").addClass(E[t])}function Lt(t,n){function d(){f++;if(f==l){var e=jQuery.Event("grid_ready");e.grid=u;i.trigger(e)}}function v(t){var n=e(t),r=0,i=0,o=[];r=Math.ceil(n.width()/(u.settings.cell_w+u.settings.gouttiere)),i=Math.ceil(n.height()/(u.settings.cell_h+u.settings.gouttiere));o=y(r,i);if(o.length>0){var a=Math.floor((o.length-1)*.5+(-2+Math.random()*4));a=a>o.length-1?o.length-1:a<0?0:a;var f=o[a],l=f.getPos().l+i,c=f.getPos().c+r;for(var h=f.getPos().l;h=0;e--)for(var t=u.settings.columns-1;t>=0;t--)s[e][t].refresh()}function y(e,t){var n=new Array;for(var r=0;r=e&&o.getAround().bottom+1>=t){var a=!0;for(var f=1;f0){var e=s[u][o-1];e.setFreeCellsRight(f+1)}}function v(){if(u>0){var e=s[u-1][o];e.setFreeCellsBottom(l+1)}}var i=t,o=n,u=r,a=!0,f=i.settings.columns-1-n,l=i.settings.lines-1-r;if(i.settings.grille){var c="";c+=" ";c+=' '+f+" ";c+=' '+l+" ";c+="
";i.fiche.find(".grille").append(''+c+"
");var h=e(".cell-"+r+"-"+n,i.fiche.find(".grille"));h.css({position:"absolute",top:u*(i.settings.cell_h+i.settings.gouttiere)+i.settings.padding.t,left:o*(i.settings.cell_w+i.settings.gouttiere)+i.settings.padding.l,width:i.settings.cell_w,height:i.settings.cell_h,backgroundColor:"#00FF00",opacity:.6}).find("table").css({width:"100%",height:"100%"}).find("td").css({width:"30%"})}this.isFree=function(){return a};this.getPos=function(){return{c:o,l:u}};this.getAround=function(){return{right:f,bottom:l}};this.setFull=function(){a=!1;l=-1;f=-1;if(i.settings.grille){h.css({backgroundColor:"#0000FF"});e(".fb",h).html(l);e(".fr",h).html(f)}p()};this.setFreeCellsRight=function(t){if(a){f=t;i.settings.grille&&e(".fr",h).html(f);d()}};this.setFreeCellsBottom=function(t){if(a){l=t;i.settings.grille&&e(".fb",h).html(l);v()}};this.refresh=function(){a&&v()};if(typeof b.initialized=="undefined"){b.prototype.infos=function(){};b.initialized=!0}}var r={padding:{t:20,r:25,b:20,l:25},gouttiere:20,cell_w:155,cell_h:50,lines:0,columns:0,grille:!1,decalage:!1,latitude:50,augmentable:!1},i=t,s=new Array,o=new Array,u=this,a=0,f=0,l=0,c;this.fiche=i;this.settings=e.extend({},r,n);this.settings.lines=Math.floor((t.height()-this.settings.padding.t-this.settings.padding.b)/(this.settings.cell_h+this.settings.gouttiere));this.settings.columns=Math.floor((t.width()- -this.settings.padding.r-this.settings.padding.l)/(this.settings.cell_w+this.settings.gouttiere));this.maxheight=this.maxwidth=0;if(this.settings.grille){i.append('
');e(".grille",i).css({width:"100%",height:"100%",position:"relative"})}for(var h=0;h