1
|
!function(){"use strict";!function(e){const t=document.documentElement.lang,o={Han:/[\u3400-\u9FCC]/,Grek:/[\u0370-\u03FF]/,Cyrl:/[\u0400-\u04FF]/,Hebr:/[\u0590-\u05FF]/,Arab:/[\u0600-\u06FF]/};function n(e){return e.replace(/\s+/g," ").trim()}e.httpGet=function(e){const t={method:"GET",credentials:"same-origin",referrerPolicy:"same-origin",headers:new Headers({"x-requested-with":"XMLHttpRequest"})};return fetch(e,t)},e.load=async function(e,t,o=null){const n={accept:"text/html","x-requested-with":"XMLHttpRequest"};null!==o&&(n["x-csrf-token"]=document.head.querySelector("meta[name=csrf]").getAttribute("content"));const a=await fetch(t,{body:o,method:null===o?"GET":"POST",headers:new Headers(n)}),r=(new DOMParser).parseFromString(await a.text(),"text/html"),l=Array.from(r.querySelectorAll("script"));l.forEach(e=>e.remove()),e.replaceChildren(...r.body.childNodes);for(const e of l){const t=document.createElement("script");for(const o of e.attributes)t.setAttribute(o.name,o.value);e.src?await new Promise(e=>{t.onload=e,t.onerror=e,document.body.appendChild(t)}):(t.textContent=e.textContent,document.body.appendChild(t)),t.remove()}},e.httpPost=function(e,t=""){const o=document.head.querySelector("meta[name=csrf]").getAttribute("content"),n={body:t,method:"POST",credentials:"same-origin",referrerPolicy:"same-origin",headers:new Headers({"X-CSRF-TOKEN":o,"x-requested-with":"XMLHttpRequest"})};return fetch(e,n,t)},e.detectScript=function(e){for(const t in o)if(e.match(o[t]))return t;return"Latn"},e.buildNameFromParts=function(o,a,r,l,i,s){const c="Han"===e.detectScript(o+a+r+a+l+i),d=c?"":" ",u=c||-1!==["hu","jp","ko","vi","zh-Hans","zh-Hant"].indexOf(t),p=-1!==["is"].indexOf(t)?"":"/";o=n(o),a=n(a.replace(/,/g,d)),r=n(r),l=function(e,o){return"pl"===t&&"F"===o?e.replace(/ski$/,"ska").replace(/cki$/,"cka").replace(/dzki$/,"dzka").replace(/żki$/,"żka"):e}(n(l.replace(/,/g,d)),s),i=n(i);const h=r.endsWith("'")||r.endsWith("‘")?"":" ",m=n(r+h+l);return n(o+d+(u?p+m+p+d+a:a+d+p+m+p)+d+i)},e.pasteAtCursor=function(e,t){if(null!==e){const o=e.selectionStart+t.length,n=e.value.substring(0,e.selectionStart),a=e.value.substring(e.selectionEnd);e.value=n+t+a,e.setSelectionRange(o,o),e.focus()}},e.reformatDate=function(e,t){const o=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"],n=["MUHAR","SAFAR","RABIA","RABIT","JUMAA","JUMAT","RAJAB","SHAAB","RAMAD","SHAWW","DHUAQ","DHUAH"],a=["TSH","CSH","KSL","TVT","SHV","ADR","ADS","NSN","IYR","SVN","TMZ","AAV","ELL"],r=["VEND","BRUM","FRIM","NIVO","PLUV","VENT","GERM","FLOR","PRAI","MESS","THER","FRUC","COMP"],l=["FARVA","ORDIB","KHORD","TIR","MORDA","SHAHR","MEHR","ABAN","AZAR","DEY","BAHMA","ESFAN"];let i=e.value,s=i.split("("),c="";s.length>1&&(i=s[0],c=s[1]),i=i.toUpperCase(),i=i.replace(/\s+/g," "),i=i.replace(/(^\s)|(\s$)/,""),i=i.replace(/(\d)([A-Z])/g,"$1 $2"),i=i.replace(/([A-Z])(\d)/g,"$1 $2"),i=i.replace(/^Q ([1-4]) (\d\d\d\d)$/,function(e,t,n){return"BET "+o[3*t-3]+" "+n+" AND "+o[3*t-1]+" "+n}),i=i.replace(/(@#DHIJRI@|HIJRI)( \d?\d )(\d?\d)( \d?\d?\d?\d)/,function(e,t,o,a,r){return"@#DHIJRI@"+o+n[a-1]+r}),i=i.replace(/(@#DJALALI@|JALALI)( \d?\d )(\d?\d)( \d?\d?\d?\d)/,function(e,t,o,n,a){return"@#DJALALI@"+o+l[n-1]+a}),i=i.replace(/(@#DHEBREW@|HEBREW)( \d?\d )(\d?\d)( \d?\d?\d?\d)/,function(e,t,o,n,r){return"@#HEBREW@"+o+a[n-1]+r}),i=i.replace(/(@#DFRENCH R@|FRENCH)( \d?\d )(\d?\d)( \d?\d?\d?\d)/,function(e,t,o,n,a){return"@#DFRENCH R@"+o+r[n-1]+a}),i=i.replace(/(\d\d)(\d\d)(\d\d)(\d\d)/g,function(e,t,n,a,r){return t>"12"&&a<="12"&&r<="31"?r+" "+o[a-1]+" "+t+n:t<="31"&&n<="12"&&a>"12"?t+" "+o[n-1]+" "+a+r:e}),i=i.replace(/(\d+)([ ./-])(\d+)(\2)(\d+)/g,function(e,n,a,r,l,i){n=parseInt(n,10),a=parseInt(r,10),r=parseInt(i,10);let s=(new Date).getFullYear(),c=s%100,d=s-c;return("DMY"===t||n>13&&r>31)&&n<=31&&a<=12?n+" "+o[a-1]+" "+(r>=100?r:r<=c?r+d:r+d-100):("MDY"===t||a>13&&r>31)&&n<=12&&a<=31?a+" "+o[n-1]+" "+(r>=100?r:r<=c?r+d:r+d-100):("YMD"===t||n>31)&&a<=12&&r<=31?r+" "+o[a-1]+" "+(n>=100?n:n<=c?n+d:n+d-100):e}),i=i.replace(/^[>]([\w ]+)$/,"AFT $1").replace(/^[<]([\w ]+)$/,"BEF $1").replace(/^([\w ]+)[-]$/,"FROM $1").replace(/^[-]([\w ]+)$/,"TO $1").replace(/^[~]([\w ]+)$/,"ABT $1").replace(/^[*]([\w ]+)$/,"EST $1").replace(/^[#]([\w ]+)$/,"CAL $1").replace(/^([\w ]+) ?- ?([\w ]+)$/,"BET $1 AND $2").replace(/^([\w ]+) ?~ ?([\w ]+)$/,"FROM $1 TO $2").replace(/JANUARY/g,"JAN").replace(/FEBRUARY/g,"FEB").replace(/MARCH/g,"MAR").replace(/APRIL/g,"APR").replace(/JUNE/g,"JUN").replace(/JULY/g,"JUL").replace(/AUGUST/g,"AUG").replace(/SEPTEMBER/g,"SEP").replace(/OCTOBER/,"OCT").replace(/NOVEMBER/g,"NOV").replace(/DECEMBER/g,"DEC").replace(/(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)\.? (\d\d?)[, ]+(\d\d\d\d)/g,"$2 $1 $3").replace(/(^| )(\d [A-Z]{3,5} \d{4})/g,"$10$2"),c&&(i=i+" ("+c),e.value!==i&&(e.value=i)};let a=[];a[1]="January",a[2]="February",a[3]="March",a[4]="April",a[5]="May",a[6]="June",a[7]="July",a[8]="August",a[9]="September",a[10]="October",a[11]="November",a[12]="December";let r=[];r[1]="JAN",r[2]="FEB",r[3]="MAR",r[4]="APR",r[5]="MAY",r[6]="JUN",r[7]="JUL",r[8]="AUG",r[9]="SEP",r[10]="OCT",r[11]="NOV",r[12]="DEC";let l=[];l[0]="S",l[1]="M",l[2]="T",l[3]="W",l[4]="T",l[5]="F",l[6]="S";let i=0;function s(e,t,o){let n,r,s='<table border="1"><tr>';for(s+='<td><select class="form-select" id="'+e+'_daySelect" onchange="return webtrees.calUpdateCalendar(\''+e+"', '"+t+"');\">",n=1;n<32;n++)s+='<option value="'+n+'"',o.getDate()===n&&(s+=' selected="selected"'),s+=">"+n+"</option>";for(s+="</select></td>",s+='<td><select class="form-select" id="'+e+'_monSelect" onchange="return webtrees.calUpdateCalendar(\''+e+"', '"+t+"');\">",n=1;n<13;n++)s+='<option value="'+n+'"',o.getMonth()+1===n&&(s+=' selected="selected"'),s+=">"+a[n]+"</option>";for(s+="</select></td>",s+='<td><input class="form-control" type="text" id="'+e+'_yearInput" size="5" value="'+o.getFullYear()+'" onchange="return webtrees.calUpdateCalendar(\''+e+"', '"+t+"');\" /></td></tr>",s+='<tr><td colspan="3">',s+='<table width="100%">',s+="<tr>",r=i,n=0;n<7;n++)s+="<td ",s+='class="descriptionbox"',s+=">",s+=l[r],s+="</td>",r++,r>6&&(r=0);s+="</tr>";let c=new Date(o.getFullYear(),o.getMonth(),1),d=(7+c.getDay()-i)%7,u=864e5;for(c=c.getTime()-d*u+432e5,c=new Date(c),r=0;r<6;r++){for(s+="<tr>",n=0;n<7;n++){s+="<td ",c.getMonth()===o.getMonth()?c.getDate()===o.getDate()?s+='class="descriptionbox"':s+='class="optionbox"':s+='style="background-color:#EAEAEA; border: solid #AAAAAA 1px;"',s+='><a href="#" onclick="return webtrees.calDateClicked(\''+e+"', '"+t+"', "+c.getFullYear()+", "+c.getMonth()+", "+c.getDate()+');">',s+=c.getDate(),s+="</a></td>";let n=c.getTime()+u;c=new Date(n)}s+="</tr>"}return s+="</table>",s+="</td></tr>",s+="</table>",s}function c(e,t,o,n){return document.getElementById(e).value=(n<10?"0":"")+n+" "+r[o+1]+" "+t,!1}function d(e,t,o){let n=e.value.toUpperCase();n=n.replace(/(^\s*)|(\s*$)/g,""),n=n.replace(/ /g,":"),n=n.replace(/\+/g,""),n=n.replace(/-/g,o),n=n.replace(/,/g,"."),n=n.replace(/\u00b0/g,":"),n=n.replace(/\u0027/g,":"),n=n.replace(/^([0-9]+):([0-9]+):([0-9.]+)(.*)/g,function(e,t,o,n,a){let r=parseFloat(t);return r+=o/60,r+=n/3600,r=Math.round(1e4*r)/1e4,a+r}),n=n.replace(/^([0-9]+):([0-9]+)(.*)/g,function(e,t,o,n){let a=parseFloat(t);return a+=o/60,a=Math.round(1e4*a)/1e4,n+a}),n=n.replace(/(.*)(NSEW])$/g,"$2$1"),n&&n.charAt(0)!==o&&n.charAt(0)!==t&&(n=t+n),e.value=n}e.calLocalize=function(e,t,o,n,r,s,c,d,u,p,h,m,f,g,b,w,v,y,A,x){a[1]=e,a[2]=t,a[3]=o,a[4]=n,a[5]=r,a[6]=s,a[7]=c,a[8]=d,a[9]=u,a[10]=p,a[11]=h,a[12]=m,l[0]=f,l[1]=g,l[2]=b,l[3]=w,l[4]=v,l[5]=y,l[6]=A,x>=0&&x<7&&(i=x)},e.calendarWidget=function(e,t){let o=document.getElementById(e),n=document.getElementById(t);if("visible"===o.style.visibility)return o.style.visibility="hidden",!1;if("show"===o.style.visibility)return o.style.visibility="hide",!1;let a,r=/(?:(\d*) ?(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC) )?(\d+)/i.exec(n.value);if(r){let e=r[1]||"1",t=r[2]||"JAN",o=r[3];a=new Date(e+" "+t+" "+o)}else a=new Date;return o.innerHTML=s(t,e,a),"hidden"===o.style.visibility?(o.style.visibility="visible",!1):"hide"===o.style.visibility&&(o.style.visibility="show",!1)},e.calUpdateCalendar=function(e,t){let o=document.getElementById(e+"_daySelect");if(!o)return!1;let n=document.getElementById(e+"_monSelect");if(!n)return!1;let a=document.getElementById(e+"_yearInput");if(!a)return!1;let r=parseInt(n.options[n.selectedIndex].value,10);r-=1;let l=new Date(a.value,r,o.options[o.selectedIndex].value);c(e,l.getFullYear(),l.getMonth(),l.getDate());let i=document.getElementById(t);return i?(i.innerHTML=s(e,t,l),!1):(alert("no dateDiv "+t),!1)},e.calDateClicked=function(t,o,n,a,r){return c(t,n,a,r),e.calendarWidget(o,t),!1},e.persistentToggle=function(e){const t="state-of-"+e.dataset.wtPersist,o=localStorage.getItem(t),n=e.getAttribute("aria-expanded")??e.checked.toString();null!==o&&o!==n&&e.click(),e.addEventListener("click",function(){"checkbox"===e.type&&localStorage.setItem(t,e.checked.toString()),"button"===e.type&&localStorage.setItem(t,e.getAttribute("aria-expanded"))})},e.reformatLatitude=function(e){return d(e,"N","S")},e.reformatLongitude=function(e){return d(e,"E","W")},e.autocomplete=function(e){$(e).each(function(){const e=this;$(this).typeahead(null,{display:"value",limit:10,minLength:2,source:new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("value"),queryTokenizer:Bloodhound.tokenizers.whitespace,remote:{url:this.dataset.wtAutocompleteUrl,replace:function(t,o){const n=t.indexOf("?")>0?"&":"?";if("SOUR"===e.dataset.wtAutocompleteExtra){let a=e.closest(".wt-nested-edit-fields").previousElementSibling;for(;null===a.querySelector("select");)a=a.previousElementSibling;const r=a.querySelector("select"),l=r.options[r.selectedIndex].value.replace(/@/g,"");return t+n+"query="+o+"&extra="+encodeURIComponent(l)}return t+n+"query="+o}}})})})},e.buildLeafletJsMap=function(e,t,o){const n=new L.control.zoom({zoomInTitle:t.i18n.zoomIn,zoomoutTitle:t.i18n.zoomOut}),a=L.Control.extend({options:{position:"topleft"},onAdd:()=>{const e=L.DomUtil.create("div","leaflet-bar leaflet-control leaflet-control-custom"),n=L.DomUtil.create("a","leaflet-control-reset",e);return n.href="#",n.setAttribute("aria-label",t.i18n.reset),n.title=t.i18n.reset,n.setAttribute("role","button"),n.innerHTML=t.icons.reset,n.onclick=o,e}}),r=L.Control.extend({options:{position:"topleft"},onAdd:e=>{const o=L.DomUtil.create("div","leaflet-bar leaflet-control leaflet-control-custom"),n=L.DomUtil.create("a","leaflet-control-fullscreen",o);return n.href="#",n.setAttribute("role","button"),n.dataset.wtFullscreen=".wt-fullscreen-container",n.innerHTML=t.icons.fullScreen,o}}),l=localStorage.getItem("map_default_layer");let i=null;for(let[,e]of Object.entries(t.mapProviders))for(let[,t]of Object.entries(e.children))t.layer=L.tileLayer(t.url,t),l===t.localName&&(i=t.layer),null===i&&e.default&&t.default&&(i=t.layer);return null===i&&(console.log("No default map layer defined - using the first one."),i=t.mapProviders[0].children[0].layer),L.map(e,{zoomControl:!1}).addControl(n).addControl(new r).addControl(new a).addLayer(i).addControl(L.control.layers.tree(t.mapProviders,null,{closedSymbol:t.icons.expand,openedSymbol:t.icons.collapse})).on("baselayerchange",e=>{localStorage.setItem("map_default_layer",e.layer.options.localName)})},e.initializeTomSelect=function(t){if(t.tomselect)return t.tomselect;if(t.dataset.wtUrl){let o={plugins:["dropdown_input","virtual_scroll"],maxOptions:!1,searchField:[],render:{item:(e,t)=>"<div>"+e.text+"</div>",option:(e,t)=>"<div>"+e.text+"</div>",no_results:(e,o)=>'<div class="no-results">'+t.dataset.wtI18nNoResults+"</div>"},firstUrl:e=>t.dataset.wtUrl+"&query="+encodeURIComponent(e),load:function(t,o){e.httpGet(this.getUrl(t)).then(e=>e.json()).then(e=>{null!==e.nextUrl&&this.setNextUrl(t,e.nextUrl+"&query="+encodeURIComponent(t)),o(e.data)}).catch(o)}};return t.required||o.plugins.push("clear_button"),new TomSelect(t,o)}return t.multiple?new TomSelect(t,{plugins:["caret_position","remove_button"]}):t.required?new TomSelect(t,{}):new TomSelect(t,{plugins:["clear_button"]})},e.resetTomSelect=function(e,t,o){e.clear(!0),e.clearOptions(),e.addOption({value:t,text:o}),e.refreshOptions(),e.addItem(t,!0),e.refreshItems()},e.initializeIFSRO=function(e,t){e.addEventListener("change",function(){t.querySelectorAll(".select-record").forEach(e=>e.classList.add("d-none")),t.querySelectorAll(".select-"+e.value).forEach(e=>e.classList.remove("d-none")),t.querySelectorAll(".select-record select").forEach(e=>{e.disabled=!0,e.matches(".tom-select")&&e.tomselect.disable()}),t.querySelectorAll(".select-"+e.value+" select").forEach(e=>{e.disabled=!1,e.matches(".tom-select")&&e.tomselect.enable()})})},e.createRecordModalSubmit=function(t){t.preventDefault();const o=t.target,n=document.getElementById("wt-ajax-modal"),a=n.querySelector(".modal-content"),r=document.getElementById(a.dataset.wtSelectId);e.httpPost(o.action,new FormData(o)).then(e=>e.json()).then(t=>{r&&""!==t.value?(e.resetTomSelect(r.tomselect,t.value,t.text),bootstrap.Modal.getInstance(n).hide()):a.innerHTML=t.html}).catch(e=>{a.innerHTML=e})},e.textareaPatterns=function(e){e.addEventListener("submit",function(e){e.target.querySelectorAll("textarea[data-wt-pattern]").forEach(function(t){const o=new RegExp("^"+t.dataset.wtPattern+"$");t.readOnly||""===t.value||o.test(t.value)?t.classList.remove("is-invalid"):(e.preventDefault(),e.stopPropagation(),t.classList.add("is-invalid"),t.scrollIntoView())})})},e.setColorTheme=function(e){window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.dataset.bsTheme="dark":document.documentElement.dataset.bsTheme="light"},e.watchForColorThemeChanges=function(){window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>e.setColorTheme())}}(window.webtrees=window.webtrees||{}),$.ajaxSetup({headers:{"X-CSRF-TOKEN":$("meta[name=csrf]").attr("content")}}),document.addEventListener("DOMContentLoaded",function(){let e;"auto"===document.documentElement.dataset.bsTheme&&(webtrees.setColorTheme(),webtrees.watchForColorThemeChanges()),document.querySelectorAll("[data-wt-ajax-url]").forEach(function(e){webtrees.load(e,e.dataset.wtAjaxUrl)}),webtrees.autocomplete("input[data-wt-autocomplete-url]"),document.querySelectorAll(".tom-select").forEach(e=>webtrees.initializeTomSelect(e)),document.querySelectorAll("select.tom-select:not([multiple])").forEach(function(e){e.addEventListener("clear",function(){webtrees.resetTomSelect(e.tomselect,"","")})}),DataTable.ext.oSort["text-asc"]=(e,t)=>e.localeCompare(t,document.documentElement.lang,{sensitivity:"base"}),DataTable.ext.oSort["text-desc"]=(e,t)=>t.localeCompare(e,document.documentElement.lang,{sensitivity:"base"}),document.querySelectorAll("table.datatables").forEach(function(e){new DataTable(e),e.classList.remove("d-none")}),document.querySelectorAll("[data-wt-persist]").forEach(e=>webtrees.persistentToggle(e)),$(".wt-osk-trigger").on("click",function(){e=document.getElementById(this.dataset.wtId),e.focus(),$(".wt-osk").show()}),$(".wt-osk-script-button").on("change",function(){$(".wt-osk-script").prop("hidden",!0),$(".wt-osk-script-"+this.dataset.wtOskScript).prop("hidden",!1)}),$(".wt-osk-shift-button").on("click",function(){document.querySelector(".wt-osk-keys").classList.toggle("shifted")}),$(".wt-osk-keys").on("click",".wt-osk-key",function(){let t=$(this).contents().get(0).nodeValue,o=$(".wt-osk-shift-button").hasClass("active"),n=$("sup",this)[0];o&&void 0!==n&&(t=n.innerText),webtrees.pasteAtCursor(e,t),!1===$(".wt-osk-pin-button").hasClass("active")&&$(".wt-osk").hide(),e.dispatchEvent(new Event("input"))}),$(".wt-osk-close").on("click",function(){$(".wt-osk").hide()})}),document.addEventListener("submit",function(e){"POST"===e.target.method&&(e.target.classList.contains("form-is-submitting")?e.preventDefault():e.target.classList.add("form-is-submitting"))}),document.addEventListener("click",e=>{const t=e.target.closest("a,button");if(null!==t)if(!("wtConfirm"in t.dataset)||confirm(t.dataset.wtConfirm)){if("wtPostUrl"in t.dataset&&webtrees.httpPost(t.dataset.wtPostUrl).then(()=>{"wtReloadUrl"in t.dataset?document.location=t.dataset.wtReloadUrl:document.location.reload()}).catch(e=>{alert(e)}),"wtFullscreen"in t.dataset){e.stopPropagation();const o=t.closest(t.dataset.wtFullscreen);document.fullscreenElement===o?document.exitFullscreen().catch(e=>alert(e)):o.requestFullscreen().catch(e=>alert(e))}}else e.preventDefault()})}(),function(){"use strict";class e{constructor(){return e.instance||(e.instance=this,this.callbacks=[],this.initialized=!1,this.loading=!1),e.instance}init(e){if(!this.loading&&!this.initialized){var t=this;Promise.all([this.load("https://www.gstatic.com/charts/loader.js")]).then(()=>{google.charts.load("current",{packages:["corechart","geochart","bar"],language:e,mapsApiKey:""}),google.charts.setOnLoadCallback(function(){t.callbacks.forEach(e=>{e()})}),t.initialized=!0}).catch(e=>{console.log(e)})}}load(e){if(!this.loading)return this.loading=!0,new Promise(function(t,o){const n=document.createElement("script");n.async=!0,n.onload=function(){t(e)},n.onerror=function(){o(e)},n.src=e,document.body.appendChild(n)})}addCallback(e){this.initialized?google.charts.setOnLoadCallback(e):this.callbacks.push(e),window.addEventListener("resize",function(){e()})}drawChart(e,t,o,n){const a=google.visualization.arrayToDataTable(o);new google.visualization.ChartWrapper({chartType:t,dataTable:a,options:n,containerId:e}).draw()}drawPieChart(e,t,o){o=Object.assign({title:"",height:"100%",width:"100%",pieStartAngle:0,pieSliceText:"none",pieSliceTextStyle:{color:"#777"},pieHole:.4,legend:{alignment:"center",labeledValueText:"value",position:"labeled"},chartArea:{left:0,top:"5%",height:"90%",width:"100%"},tooltip:{trigger:"none",text:"both"},backgroundColor:"transparent",colors:[]},o),this.drawChart(e,"PieChart",t,o)}drawColumnChart(e,t,o){o=Object.assign({title:"",subtitle:"",titleTextStyle:{color:"#757575",fontName:"Roboto",fontSize:"16px",bold:!1,italic:!1},height:"100%",width:"100%",vAxis:{title:""},hAxis:{title:""},legend:{position:"none"},backgroundColor:"transparent"},o),this.drawChart(e,"ColumnChart",t,o)}drawComboChart(e,t,o){o=Object.assign({title:"",subtitle:"",titleTextStyle:{color:"#757575",fontName:"Roboto",fontSize:"16px",bold:!1,italic:!1},height:"100%",width:"100%",vAxis:{title:""},hAxis:{title:""},legend:{position:"none"},seriesType:"bars",series:{2:{type:"line"}},colors:[],backgroundColor:"transparent"},o),this.drawChart(e,"ComboChart",t,o)}drawGeoChart(e,t,o){o=Object.assign({title:"",subtitle:"",height:"100%",width:"100%"},o),this.drawChart(e,"GeoChart",t,o)}}new e}(),function(){function e(e,n){var a=this;this.treeview=$("#"+e+"_in"),this.loadingImage=$("#"+e+"_loading"),this.toolbox=$("#tv_tools"),this.buttons=$(".tv_button:first",this.toolbox),this.zoom=100,this.boxWidth=180,this.boxExpandedWidth=250,this.cookieDays=3,this.ajaxDetails=document.getElementById(e+"_out").dataset.urlDetails+"&instance="+encodeURIComponent(e),this.ajaxPersons=document.getElementById(e+"_out").dataset.urlIndividuals+"&instance="+encodeURIComponent(e),this.container=this.treeview.parent(),this.auto_box_width=!1,this.updating=!1,"true"===o("compact")&&a.compact(),function(){let e,t,o=!1,n=!1;a.treeview.on("mousedown touchstart",function(o){let r="touchstart"===o.type?o.touches[0].pageX:o.pageX,l="touchstart"===o.type?o.touches[0].pageY:o.pageY;e=a.treeview.offset().left-r,t=a.treeview.offset().top-l,n=!0}),$(document).on("mousemove touchmove",function(r){if(n){r.preventDefault(),o=!0;let n="touchmove"===r.type?r.touches[0].pageX:r.pageX,l="touchmove"===r.type?r.touches[0].pageY:r.pageY;a.treeview.offset({left:n+e,top:l+t})}}),$(document).on("mouseup touchend",function(e){n=!1,o&&(e.preventDefault(),o=!1,a.updateTree())})}(),a.toolbox.find("#tvbCompact").each(function(e,t){t.onclick=function(){a.compact()}}),a.toolbox.find("#tvbAllPartners").each(function(e,n){n.onclick=function(){t("allPartners","true"===o("allPartners")?"false":"true",a.cookieDays),document.location=document.location}}),a.toolbox.find("#tvbOpen").each(function(e,t){var o=$(t,a.toolbox);t.onclick=function(){o.addClass("tvPressed"),a.setLoading();var e=jQuery.Event("click");a.treeview.find(".tv_box:not(.boxExpanded)").each(function(t,o){var n=$(o,a.treeview).offset();n.left>=a.leftMin&&n.left<=a.leftMax&&n.top>=a.topMin&&n.top<=a.topMax&&a.expandBox(o,e)}),o.removeClass("tvPressed"),a.setComplete()}}),a.toolbox.find("#tvbClose").each(function(e,t){var o=$(t,a.toolbox);t.onclick=function(){o.addClass("tvPressed"),a.setLoading(),a.treeview.find(".tv_box.boxExpanded").each(function(e,t){$(t).css("display","none").removeClass("boxExpanded").parent().find(".tv_box.collapsedContent").css("display","block")}),o.removeClass("tvPressed"),a.setComplete()}}),a.centerOnRoot()}function t(e,t,o){if(o){var n=new Date;n.setTime(n.getTime()+24*o*60*60*1e3),document.cookie=e+"="+t+"; expires="+n.toGMTString()+"; path=/"}else document.cookie=e+"="+t+"; path=/"}function o(e){for(var t=e+"=",o=document.cookie.split(";"),n=0;n<o.length;n++){for(var a=o[n];" "===a.charAt(0);)a=a.substring(1,a.length);if(0===a.indexOf(t))return a.substring(t.length,a.length)}return null}e.prototype.setLoading=function(){this.treeview.css("cursor","wait"),this.loadingImage.css("display","block")},e.prototype.setComplete=function(){this.treeview.css("cursor","move"),this.loadingImage.css("display","none")},e.prototype.getSize=function(){var e=this,t=e.container.parent(),o=t.offset();e.leftMin=o.left,e.leftMax=e.leftMin+t.innerWidth(),e.topMin=o.top,e.topMax=e.topMin+t.innerHeight()},e.prototype.updateTree=function(e,t){var o=this,n=[],a=[];return this.getSize(),o.treeview.find("td[abbr]").each(function(e,t){var r=(t=$(t,o.treeview)).offset();r.left>=o.leftMin&&r.left<=o.leftMax&&r.top>=o.topMin&&r.top<=o.topMax&&(n.push(t.attr("abbr")),a.push(t))}),n.length>0?(o.updating=!0,o.setLoading(),jQuery.ajax({url:o.ajaxPersons,dataType:"json",data:"q="+n.join(";"),success:function(e){for(var t=a.length,n=($(".rootPerson",this.treeview).offset().left,0);n<t;n++)a[n].removeAttr("abbr").html(e[n]);o.getSize()},complete:function(){o.treeview.find("td[abbr]").length&&o.updateTree(e,t),o.auto_box_width&&o.treeview.find(".tv_box").css("width","auto"),o.updating=!0,e&&o.centerOnRoot(),t&&t.removeClass("tvPressed"),o.setComplete(),o.updating=!1},timeout:function(){t&&t.removeClass("tvPressed"),o.updating=!1,o.setComplete()}})):(t&&t.removeClass("tvPressed"),o.setComplete()),!1},e.prototype.compact=function(){var e=this,n=$("#tvbCompact",e.toolbox);if(e.setLoading(),e.auto_box_width){var a=e.boxWidth*(e.zoom/100)+"px",r=e.boxExpandedWidth*(e.zoom/100)+"px";e.treeview.find(".tv_box:not(boxExpanded)",e.treeview).css("width",a),e.treeview.find(".boxExpanded",e.treeview).css("width",r),e.auto_box_width=!1,o("compact")&&t("compact",!1,e.cookieDays),n.removeClass("tvPressed")}else e.treeview.find(".tv_box").css("width","auto"),e.auto_box_width=!0,o("compact")||t("compact",!0,e.cookieDays),e.updating||e.updateTree(),n.addClass("tvPressed");return e.setComplete(),!1},e.prototype.centerOnRoot=function(){this.loadingImage.css("display","block");var e=this.container,t=e.innerWidth()/2;return Number.isNaN(t)||(e.innerHeight(),$(".rootPerson",this.treeview),this.updating||this.setComplete()),!1},e.prototype.expandBox=function(e,t){if($(t.target).hasClass("tv_link"))return!1;var o,n,a=(e=$(e,this.treeview)).parent(),r=e.attr("abbr"),l=this;if(a.hasClass("detailsLoaded"))n=a.find(".collapsedContent"),o=a.find(".tv_box:not(.collapsedContent)");else{o=e,n=e.clone(),a.append(n.addClass("collapsedContent").css("display","none"));var i=this.loadingImage.find("img").clone().addClass("tv_box_loading").css("display","block");e.prepend(i),l.updating=!0,l.setLoading(),e.load(l.ajaxDetails+"&pid="+encodeURIComponent(r),function(){"function"==typeof CB_Init&&CB_Init(),e.css("width",l.boxExpandedWidth*(l.zoom/100)+"px"),i.remove(),a.addClass("detailsLoaded"),l.setComplete(),l.updating=!1})}return e.hasClass("boxExpanded")?(o.css("display","none"),n.css("display","block"),e.removeClass("boxExpanded")):(o.css("display","block"),n.css("display","none"),o.addClass("boxExpanded")),this.getSize(),!1},window.TreeViewHandler=e}();
|