function monthPath(e){var t=e.getMonth(),a=e.getFullYear(),r=8,n=t>=r?a:a-1,s=new Date(n,11,31),i=new Date(n,r,1),l=parseInt(cal_week(i)),o=parseInt(cal_week(s))-l;6==cal_day(s)&&(o+=1);var p=new Date(e.getFullYear(),e.getMonth()+1,0),c=parseInt(cal_day(e)),d=parseInt(cal_day(p)),u=parseInt(cal_week(e)),m=parseInt(cal_week(p));return t>=r?(u-=l,m-=l):(u+=o,m+=o),"M"+(u+1)*cellSize+","+c*cellSize+"H"+u*cellSize+"V"+7*cellSize+"H"+m*cellSize+"V"+(d+1)*cellSize+"H"+(m+1)*cellSize+"V0H"+(u+1)*cellSize+"Z"}function normalizeGregDate(e){var t="0000"+e[0],a="00"+e[1],r="00"+e[2];return t.substr(t.length-4)+"-"+a.substr(a.length-2)+"-"+r.substr(r.length-2)}function clear_page(){$("#jahr_stat").empty(),$("#info_container").empty();var e=d3.selectAll("svg").remove()}function display_person_data(e){SALSAH.ApiGet("properties/"+e,function(t){$("#prid_"+e).replaceWith(t.properties["hdm:full_name"].values[0].val)})}function display_work_data(e){SALSAH.ApiGet("properties/"+e,function(t){$("#wrid_"+e).replaceWith(t.properties["hdm:worktitle"].values[0].val)})}function getUrlParameter(e){for(var t=window.location.search.substring(1),a=t.split("&"),r,n=0;n0&&properties.indexOf("hdm:source_info")>-1&&(t=e.properties["hdm:source_info"].values[0].val),SALSAH.ApiGet("properties/"+r,function(e){if(properties=Object.keys(e.properties),properties.length>0){$("#info_container").append('
');var a=e.properties,n='';properties.indexOf("hdm:worktitle")>-1&&(n+='');for(var s=["hdm:genre","hdm:acts"],i=0;i-1&&(n+='")}properties.indexOf("hdm:with_music")>-1&&(n+='");for(var s=["hdm:composer","hdm:librettist","hdm:actor","hdm:prinzipal"],i=0;i-1){var o=a[l].values[0].val;n+='',display_person_data(o)}}if(properties.indexOf("hdm:link")>-1){var p=a["hdm:link"].values[0].val;n+='"}t!==t!==""&&(n+='"),n+="

'+a["hdm:worktitle"].values[0].val+'

'+a[l].label+''+a[l].values[0].val+"
'+a["hdm:with_music"].label+"
'+a[l].label+'
'+a["hdm:link"].label+''+p+"
Quellenangabe'+t+"
",$("#rid_"+r).append(n)}})})}function sequence(e){var t={top:20,right:440,bottom:0,left:40},a=960-t.right,r=40-t.top-t.bottom,n=160,s=d3.select("body").append("svg").attr("width",a+t.left+t.right).attr("height",r+t.top+t.bottom).style("margin","1em 0 1em "+-t.left+"px"),i=s.append("g").attr("transform","translate("+t.left+","+t.top+")"),l=i.selectAll(".node").data(e).enter().append("g").attr("class",function(e){return(e.type||"")+" node"}).attr("transform",function(e,t){return"translate("+t*n+",0)"});l.append("text").attr("x",6).attr("dy",".32em").text(function(e){return e.name}).each(function(e){e.width=e.name?this.getComputedTextLength()+12:0}),l.insert("rect","text").attr("ry",6).attr("rx",6).attr("y",-10).attr("height",20).attr("width",function(e){return e.width});var o=i.selectAll(".link").data(d3.range(e.length-1)).enter().insert("g",".node").attr("class",function(t){return(e[t+1].type?"to-"+e[t+1].type+" ":" ")+(e[t].type?"from-"+e[t].type+" ":" ")+" link"});return o.append("path").attr("d",function(t){return"M"+(t*n+e[t].width)+",0H"+((t+1)*n-11)}),o.append("text").attr("x",function(t){return(t+.5)*n+e[t].width/2}).attr("y",-6).style("text-anchor","middle").text(function(t){return e[t].link}),s}function truncate(e,t,a){return e.length>t&&(e=e.substring(0,t+1),e=e.substring(0,Math.min(e.length,e.lastIndexOf(" "))),e+=a),e}function statistics_init(e,t){return;var a={top:100,right:200,bottom:0,left:20},r=800,n=850,s=d3.scale.category20c(),l=d3.scale.linear().range([0,r]),o=d3.svg.axis().scale(l).orient("top"),c=d3.format("0000");o.tickFormat(c);var d=d3.select("body").append("svg").attr("width",r+a.left+a.right).attr("height",n+a.top+a.bottom).style("margin-left",a.left+"px").append("g").attr("transform","translate("+a.left+","+a.top+")");d3.json("",function(a){l.domain([e,t]);var n=d3.scale.linear().domain([e,t]).range([0,r]);d.append("g").attr("class","x axis").attr("transform","translate(0,0)").call(o),first_year=e,last_year=t,SALSAH.ApiGet("search",{searchtype:"extended",filter_by_restype:"hdm:performance",property_id:["hdm:date","hdm:date","hdm:work"],compop:["GT_EQ","LT_EQ","EXISTS"],searchval:[first_year+"-10-01",last_year+"-09-31"]},function(e){var t={},a={},l=[],o=0,c=e.nhits;a=e,statistics={},partitions=["operette","oper","schauspiel","lustspiel","drama","komoedie","posse","schwank","misc"];for(p in partitions)for(partition=partitions[p],statistics[partition]={},year=first_year;year<=last_year;year+=1)statistics[partition][year]=0;werk_mappings={};for(i in e.subjects){var u=e.subjects[i],m=u.value[0].resid;void 0==werk_mappings[m]?(werk_mappings[m]="-",SALSAH.ApiGet("resources/"+m,function(e){var t=e.props,i=Object.keys(t);if(void 0!==t["hdm:genre"].values?genre=t["hdm:genre"].values[0].toLowerCase():genre="",genre.indexOf("operette")>-1?werk_mappings[e.resdata.res_id]="operette":genre.indexOf("oper")>-1||genre.indexOf("opéra")>-1?werk_mappings[e.resdata.res_id]="oper":genre.indexOf("schauspiel")>-1?werk_mappings[e.resdata.res_id]="schauspiel":genre.indexOf("lustspiel")>-1?werk_mappings[e.resdata.res_id]="lustspiel":genre.indexOf("drama")>-1||genre.indexOf("drame")>-1?werk_mappings[e.resdata.res_id]="drama":genre.indexOf("komödie")>-1||genre.indexOf("comédie")>-1?werk_mappings[e.resdata.res_id]="komoedie":genre.indexOf("posse")>-1||genre.indexOf("vaudeville")>-1?werk_mappings[e.resdata.res_id]="posse":genre.indexOf("schwank")>-1?werk_mappings[e.resdata.res_id]="posse":werk_mappings[e.resdata.res_id]="misc",c-=1,0==c){for(p in a.subjects)performance=a.subjects[p],werk_id=performance.value[0].resid,dt=normalizeGregDate(SALSAH.jd_to_gregorian(performance.value[1].dateval1)),year=parseInt(dt.substring(0,4)),statistics[werk_mappings[werk_id]][year]+=1;e=[],global_max=0;for(p in partitions){for(total=0,local_max=0,partition=partitions[p],element={name:partition,performances:[]},cur_stat=statistics[partition],year=first_year;year<=last_year;year+=1)value=statistics[partition][year],value>0&&(total+=value,element.performances.push([year,value]),value>local_max&&(local_max=value,value>global_max&&(global_max=value)));element.total=total,element.max=local_max,e.push(element)}for(var l=0;la.max&&(a.max=f)}}if(a.max>u&&(u=a.max),c-=1,0==c)for(var h=0;h0){var t=0;element=l[0];for(i in e.subjects)subject=e.subjects[i],season=subject.value[1],9==season.length&&(value=parseInt(subject.value[3]),element.performances.push([season,value]),value>element.max&&(element.max=value,t=value),element.total+=value);for(var a=0;a