xref: /webtrees/public/js/webtrees.min.js (revision 1792ff1cf1956b41f3e3c853cfb279a803a71ed2)
1"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,a){return t&&_defineProperties(e.prototype,t),a&&_defineProperties(e,a),e}function expand_layer(e){return $("#"+e+"_img").toggleClass("icon-plus icon-minus"),$("#"+e).slideToggle("fast"),$("#"+e+"-alt").toggle(),!1}var pastefield;function valid_date(e,t){var a=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"],n=e.value,o=n.split("("),i="";o.length>1&&(n=o[0],i=o[1]),(n=(n=(n=(n=(n=n.toUpperCase()).replace(/\s+/," ")).replace(/(^\s)|(\s$)/,"")).replace(/(\d)([A-Z])/,"$1 $2")).replace(/([A-Z])(\d)/,"$1 $2")).match(/^Q ([1-4]) (\d\d\d\d)$/)&&(n="BET "+a[3*RegExp.$1-3]+" "+RegExp.$2+" AND "+a[3*RegExp.$1-1]+" "+RegExp.$2),n.match(/^(@#DHIJRI@|HIJRI)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(n="@#DHIJRI@"+RegExp.$2+["MUHAR","SAFAR","RABIA","RABIT","JUMAA","JUMAT","RAJAB","SHAAB","RAMAD","SHAWW","DHUAQ","DHUAH"][parseInt(RegExp.$3,10)-1]+RegExp.$4),n.match(/^(@#DJALALI@|JALALI)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(n="@#DJALALI@"+RegExp.$2+["FARVA","ORDIB","KHORD","TIR","MORDA","SHAHR","MEHR","ABAN","AZAR","DEY","BAHMA","ESFAN"][parseInt(RegExp.$3,10)-1]+RegExp.$4),n.match(/^(@#DHEBREW@|HEBREW)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(n="@#DHEBREW@"+RegExp.$2+["TSH","CSH","KSL","TVT","SHV","ADR","ADS","NSN","IYR","SVN","TMZ","AAV","ELL"][parseInt(RegExp.$3,10)-1]+RegExp.$4),n.match(/^(@#DFRENCH R@|FRENCH)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(n="@#DFRENCH R@"+RegExp.$2+["VEND","BRUM","FRIM","NIVO","PLUV","VENT","GERM","FLOR","PRAI","MESS","THER","FRUC","COMP"][parseInt(RegExp.$3,10)-1]+RegExp.$4);if(/^([^\d]*)(\d+)[^\d](\d+)[^\d](\d+)$/i.exec(n)){var s=RegExp.$1,r=parseInt(RegExp.$2,10),l=parseInt(RegExp.$3,10),c=parseInt(RegExp.$4,10),d=(new Date).getFullYear(),u=d%100,p=d-u;"DMY"===t&&r<=31&&l<=12||r>13&&r<=31&&l<=12&&c>31?n=s+r+" "+a[l-1]+" "+(c>=100?c:c<=u?c+p:c+p-100):"MDY"===t&&r<=12&&l<=31||l>13&&l<=31&&r<=12&&c>31?n=s+l+" "+a[r-1]+" "+(c>=100?c:c<=u?c+p:c+p-100):("YMD"===t&&l<=12&&c<=31||c>13&&c<=31&&l<=12&&r>31)&&(n=s+c+" "+a[l-1]+" "+(r>=100?r:r<=u?r+p:r+p-100))}n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=n.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)/,"JAN")).replace(/(FEBRUARY)/,"FEB")).replace(/(MARCH)/,"MAR")).replace(/(APRIL)/,"APR")).replace(/(MAY)/,"MAY")).replace(/(JUNE)/,"JUN")).replace(/(JULY)/,"JUL")).replace(/(AUGUST)/,"AUG")).replace(/(SEPTEMBER)/,"SEP")).replace(/(OCTOBER)/,"OCT")).replace(/(NOVEMBER)/,"NOV")).replace(/(DECEMBER)/,"DEC")).replace(/(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)\.? (\d\d?)[, ]+(\d\d\d\d)/,"$2 $1 $3")).replace(/(^| )(\d [A-Z]{3,5} \d{4})/,"$10$2"),i&&(n=n+" ("+i),e.value!==n&&(e.value=n)}!function(e){var t=document.documentElement.lang,a={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.detectScript=function(e){for(var t in a)if(e.match(a[t]))return t;return"Latn"},e.buildNameFromParts=function(a,o,i,s,r,l){var c="Han"===e.detectScript(a+o+i+o+s+r),d=c?"":" ",u=c||-1!==["hu","jp","ko","vi","zh-Hans","zh-Hant"].indexOf(t),p=-1!==["is"].indexOf(t)?"":"/";a=n(a),o=n(o.replace(",",d)),i=n(i),s=function(e,a){return"pl"===t&&"F"===a?e.replace(/ski$/,"ska").replace(/cki$/,"cka").replace(/dzki$/,"dzka").replace(/żki$/,"żka"):e}(n(s.replace(",",d)),l),r=n(r);var h=n(i+d+s);return n(a+d+(u?p+h+p+d+o:o+d+p+h+p)+d+r)},e.pasteAtCursor=function(e,t){if(null!==e){var a=e.selectionStart+t.length,n=e.value.substring(0,e.selectionStart),o=e.value.substring(e.selectionEnd);e.value=n+t+o,e.setSelectionRange(a,a),e.focus()}}}(window.webtrees=window.webtrees||{});var monthLabels=[];monthLabels[1]="January",monthLabels[2]="February",monthLabels[3]="March",monthLabels[4]="April",monthLabels[5]="May",monthLabels[6]="June",monthLabels[7]="July",monthLabels[8]="August",monthLabels[9]="September",monthLabels[10]="October",monthLabels[11]="November",monthLabels[12]="December";var monthShort=[];monthShort[1]="JAN",monthShort[2]="FEB",monthShort[3]="MAR",monthShort[4]="APR",monthShort[5]="MAY",monthShort[6]="JUN",monthShort[7]="JUL",monthShort[8]="AUG",monthShort[9]="SEP",monthShort[10]="OCT",monthShort[11]="NOV",monthShort[12]="DEC";var daysOfWeek=[];daysOfWeek[0]="S",daysOfWeek[1]="M",daysOfWeek[2]="T",daysOfWeek[3]="W",daysOfWeek[4]="T",daysOfWeek[5]="F",daysOfWeek[6]="S";var weekStart=0;function cal_setMonthNames(e,t,a,n,o,i,s,r,l,c,d,u){monthLabels[1]=e,monthLabels[2]=t,monthLabels[3]=a,monthLabels[4]=n,monthLabels[5]=o,monthLabels[6]=i,monthLabels[7]=s,monthLabels[8]=r,monthLabels[9]=l,monthLabels[10]=c,monthLabels[11]=d,monthLabels[12]=u}function cal_setDayHeaders(e,t,a,n,o,i,s){daysOfWeek[0]=e,daysOfWeek[1]=t,daysOfWeek[2]=a,daysOfWeek[3]=n,daysOfWeek[4]=o,daysOfWeek[5]=i,daysOfWeek[6]=s}function cal_setWeekStart(e){e>=0&&e<7&&(weekStart=e)}function calendarWidget(e,t){var a=document.getElementById(e),n=document.getElementById(t);if("visible"===a.style.visibility)return a.style.visibility="hidden",!1;if("show"===a.style.visibility)return a.style.visibility="hide",!1;var o;return o=/((\d+ (JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC) )?\d+)/i.exec(n.value)?new Date(RegExp.$1):new Date,a.innerHTML=cal_generateSelectorContent(t,e,o),"hidden"===a.style.visibility?(a.style.visibility="visible",!1):"hide"===a.style.visibility&&(a.style.visibility="show",!1)}function cal_generateSelectorContent(e,t,a){var n,o,i='<table border="1"><tr>';for(i+='<td><select class="form-control" id="'+e+'_daySelect" onchange="return cal_updateCalendar(\''+e+"', '"+t+"');\">",n=1;n<32;n++)i+='<option value="'+n+'"',a.getDate()===n&&(i+=' selected="selected"'),i+=">"+n+"</option>";for(i+="</select></td>",i+='<td><select class="form-control" id="'+e+'_monSelect" onchange="return cal_updateCalendar(\''+e+"', '"+t+"');\">",n=1;n<13;n++)i+='<option value="'+n+'"',a.getMonth()+1===n&&(i+=' selected="selected"'),i+=">"+monthLabels[n]+"</option>";for(i+="</select></td>",i+='<td><input class="form-control" type="text" id="'+e+'_yearInput" size="5" value="'+a.getFullYear()+'" onchange="return cal_updateCalendar(\''+e+"', '"+t+"');\" /></td></tr>",i+='<tr><td colspan="3">',i+='<table width="100%">',i+="<tr>",o=weekStart,n=0;n<7;n++)i+="<td ",i+='class="descriptionbox"',i+=">",i+=daysOfWeek[o],i+="</td>",++o>6&&(o=0);i+="</tr>";var s=new Date(a.getFullYear(),a.getMonth(),1),r=s.getDay();r-=weekStart;for(s=s.getTime()-864e5*r+432e5,s=new Date(s),o=0;o<6;o++){for(i+="<tr>",n=0;n<7;n++){i+="<td ",s.getMonth()===a.getMonth()?s.getDate()===a.getDate()?i+='class="descriptionbox"':i+='class="optionbox"':i+='style="background-color:#EAEAEA; border: solid #AAAAAA 1px;"',i+='><a href="#" onclick="return cal_dateClicked(\''+e+"', '"+t+"', "+s.getFullYear()+", "+s.getMonth()+", "+s.getDate()+');">',i+=s.getDate(),i+="</a></td>";var l=s.getTime()+864e5;s=new Date(l)}i+="</tr>"}return i+="</table>",i+="</td></tr>",i+="</table>"}function cal_setDateField(e,t,a,n){var o=document.getElementById(e);return!!o&&(n<10&&(n="0"+n),o.value=n+" "+monthShort[a+1]+" "+t,!1)}function cal_updateCalendar(e,t){var a=document.getElementById(e+"_daySelect");if(!a)return!1;var n=document.getElementById(e+"_monSelect");if(!n)return!1;var o=document.getElementById(e+"_yearInput");if(!o)return!1;var i=parseInt(n.options[n.selectedIndex].value,10);i-=1;var s=new Date(o.value,i,a.options[a.selectedIndex].value);cal_setDateField(e,s.getFullYear(),s.getMonth(),s.getDate());var r=document.getElementById(t);return r?(r.innerHTML=cal_generateSelectorContent(e,t,s),!1):(alert("no dateDiv "+t),!1)}function cal_dateClicked(e,t,a,n,o){return cal_setDateField(e,a,n,o),calendarWidget(t,e),!1}function openerpasteid(e){window.opener.paste_id&&window.opener.paste_id(e),window.close()}function paste_id(e){pastefield.value=e}function pastename(e){nameElement&&(nameElement.innerHTML=e),remElement&&(remElement.style.display="block")}function paste_char(e){document.selection?(pastefield.focus(),document.selection.createRange().text=e):pastefield.selectionStart||0===pastefield.selectionStart?(pastefield.value=pastefield.value.substring(0,pastefield.selectionStart)+e+pastefield.value.substring(pastefield.selectionEnd,pastefield.value.length),pastefield.selectionStart=pastefield.selectionEnd=pastefield.selectionStart+e.length):pastefield.value+=e,"NPFX"!==pastefield.id&&"GIVN"!==pastefield.id&&"SPFX"!==pastefield.id&&"SURN"!==pastefield.id&&"NSFX"!==pastefield.id||updatewholename()}function persistent_toggle(e){var t=document.getElementById(e),a="state-of-"+e;"true"===localStorage.getItem(a)&&$(t).click(),$(t).on("change",function(){localStorage.setItem(a,t.checked)})}function valid_lati_long(e,t,a){var n=e.value.toUpperCase();(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=n.replace(/(^\s*)|(\s*$)/g,"")).replace(/ /g,":")).replace(/\+/g,"")).replace(/-/g,a)).replace(/,/g,".")).replace(/\u00b0/g,":")).replace(/\u0027/g,":")).replace(/^([0-9]+):([0-9]+):([0-9.]+)(.*)/g,function(e,t,a,n,o){var i=parseFloat(t);return i+=a/60,i+=n/3600,o+(i=Math.round(1e4*i)/1e4)})).replace(/^([0-9]+):([0-9]+)(.*)/g,function(e,t,a,n){var o=parseFloat(t);return o+=a/60,n+(o=Math.round(1e4*o)/1e4)})).replace(/(.*)([N|S|E|W]+)$/g,"$2$1"))&&n.charAt(0)!==a&&n.charAt(0)!==t&&(n=t+n),e.value=n}function autocomplete(e){$(e).each(function(){var e=this;$(this).typeahead(null,{display:"value",limit:0,source:new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("value"),queryTokenizer:Bloodhound.tokenizers.whitespace,remote:{url:this.dataset.autocompleteUrl,replace:function(t,a){if(e.dataset.autocompleteExtra){var n=$(document.querySelector(e.dataset.autocompleteExtra)).val();return t.replace("QUERY",a)+"&extra="+encodeURIComponent(n)}return t.replace("QUERY",a)},wildcard:"QUERY"}})})})}function insertTextAtCursor(e,t){var a=e.scrollTop,n=e.selectionStart,o=e.value.substring(0,n),i=e.value.substring(e.selectionEnd,e.value.length);e.value=o+t+i,e.selectionStart=n+t.length,e.selectionEnd=e.selectionStart,e.focus(),e.scrollTop=a}$.ajaxSetup({headers:{"X-CSRF-TOKEN":$("meta[name=csrf]").attr("content")}}),$(function(){$("[data-ajax-url]").each(function(){$(this).load($(this).data("ajaxUrl"))}),autocomplete("input[data-autocomplete-url]");var e,t=document.documentElement.lang;$("select.select2").select2({language:{"zh-Hans":"zh-CN","zh-Hant":"zh-TW"}[t]||t,width:"100%",escapeMarkup:function(e){return e}}),$("select.select2:not([multiple])").on("select2:unselect",function(e){$(e.delegateTarget).html('<option value="" selected></option>')}),$.fn.dataTableExt.oSort["text-asc"]=function(e,t){return e.localeCompare(t,document.documentElement.lang,{sensitivity:"base"})},$.fn.dataTableExt.oSort["text-desc"]=function(e,t){return t.localeCompare(e,document.documentElement.lang,{sensitivity:"base"})},$("table.datatables").each(function(){$(this).DataTable(),$(this).removeClass("d-none")}),document.querySelectorAll("[data-toggle=button][data-persist]").forEach(function(e){"T"===localStorage.getItem("state-of-"+e.dataset.persist)&&e.click(),e.addEventListener("click",function(e){localStorage.setItem("state-of-"+e.target.dataset.persist,e.target.classList.contains("active")?"F":"T")})}),$(".wt-osk-trigger").click(function(){(e=document.getElementById($(this).data("id"))).focus(),$(".wt-osk").show()}),$(".wt-osk-script-button").change(function(){$(".wt-osk-script").prop("hidden",!0),$(".wt-osk-script-"+$(this).data("script")).prop("hidden",!1)}),$(".wt-osk-shift-button").click(function(){document.querySelector(".wt-osk-keys").classList.toggle("shifted")}),$(".wt-osk-keys").on("click",".wt-osk-key",function(){var t=$(this).contents().get(0).nodeValue,a=$(".wt-osk-shift-button").hasClass("active"),n=$("sup",this)[0];a&&void 0!==n&&(t=n.innerText),webtrees.pasteAtCursor(e,t),!1===$(".wt-osk-pin-button").hasClass("active")&&$(".wt-osk").hide()}),$(".wt-osk-close").on("click",function(){$(".wt-osk").hide()})}),document.addEventListener("click",function(e){var t=e.target.closest("a");if(null!==t)if("confirm"in t.dataset&&!confirm(t.dataset.confirm))e.preventDefault();else if("postUrl"in t.dataset){var a=new XMLHttpRequest,n=document.querySelector("meta[name=csrf]").content;a.open("POST",t.dataset.postUrl,!0),a.setRequestHeader("X-CSRF-TOKEN",n),a.onreadystatechange=function(){a.readyState===a.DONE&&document.location.reload()},a.send(),e.preventDefault()}});var GOOGLE_CHARTS_LIB="https://www.gstatic.com/charts/loader.js",Statistics=function(){function e(){return _classCallCheck(this,e),e.instance||(e.instance=this,this.callbacks=[],this.initialized=!1,this.loading=!1),e.instance}return _createClass(e,[{key:"init",value:function(e){if(!this.loading&&!this.initialized){var t=this;Promise.all([this.load(GOOGLE_CHARTS_LIB)]).then(function(){google.charts.load("current",{packages:["corechart","geochart","bar"],language:e,mapsApiKey:""}),google.charts.setOnLoadCallback(function(){t.callbacks.forEach(function(e){e()})}),t.initialized=!0}).catch(function(e){console.log(e)})}}},{key:"load",value:function(e){if(!this.loading)return this.loading=!0,new Promise(function(t,a){var n=document.createElement("script");n.async=!0,n.onload=function(){t(e)},n.onerror=function(){a(e)},n.src=e,document.body.appendChild(n)})}},{key:"addCallback",value:function(e){this.initialized?google.charts.setOnLoadCallback(e):this.callbacks.push(e),$(window).resize(function(){e()})}},{key:"drawChart",value:function(e,t,a,n){var o=google.visualization.arrayToDataTable(a);new google.visualization.ChartWrapper({chartType:t,dataTable:o,options:n,containerId:e}).draw()}},{key:"drawPieChart",value:function(e,t,a){a=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:[]},a),this.drawChart(e,"PieChart",t,a)}},{key:"drawColumnChart",value:function(e,t,a){a=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"},a),this.drawChart(e,"ColumnChart",t,a)}},{key:"drawComboChart",value:function(e,t,a){a=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"},a),this.drawChart(e,"ComboChart",t,a)}},{key:"drawGeoChart",value:function(e,t,a){a=Object.assign({title:"",subtitle:"",height:"100%",width:"100%"},a),this.drawChart(e,"GeoChart",t,a)}}]),e}(),statistics=new Statistics;function TreeViewHandler(e,t){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"===readCookie("compact")&&a.compact(),function(e){e.fn.drags=function(t){return this.css("cursor","move").on("mousedown",function(t){var n=e(this),o=n.outerHeight(),i=n.outerWidth(),s=n.offset().top+o-t.pageY,r=n.offset().left+i-t.pageX;n.addClass("draggable"),e(document).on("mousemove",function(t){e(".draggable").offset({top:t.pageY+s-o,left:t.pageX+r-i}).on("mouseup",function(){n.removeClass("draggable")})}).on("mouseup",function(){n.removeClass("draggable"),a.updateTree()}),t.preventDefault()})}}(jQuery),a.treeview.drags(),a.toolbox.find("#tvbCompact").each(function(e,t){t.onclick=function(){a.compact()}}),a.toolbox.find("#tvbAllPartners").each(function(e,t){t.onclick=function(){createCookie("allPartners","true"===readCookie("allPartners")?"false":"true",a.cookieDays),document.location=document.location}}),a.toolbox.find("#tvbOpen").each(function(e,t){var n=$(t,a.toolbox);t.onclick=function(){n.addClass("tvPressed"),a.setLoading();var e=jQuery.Event("click");a.treeview.find(".tv_box:not(.boxExpanded)").each(function(t,n){var o=$(n,a.treeview).offset();o.left>=a.leftMin&&o.left<=a.leftMax&&o.top>=a.topMin&&o.top<=a.topMax&&a.expandBox(n,e)}),n.removeClass("tvPressed"),a.setComplete()}}),a.toolbox.find("#tvbClose").each(function(e,t){var n=$(t,a.toolbox);t.onclick=function(){n.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")}),n.removeClass("tvPressed"),a.setComplete()}}),a.centerOnRoot()}function createCookie(e,t,a){if(a){var n=new Date;n.setTime(n.getTime()+24*a*60*60*1e3),document.cookie=e+"="+t+"; expires="+n.toGMTString()+"; path=/"}else document.cookie=e+"="+t+"; path=/"}function readCookie(e){for(var t=e+"=",a=document.cookie.split(";"),n=0;n<a.length;n++){for(var o=a[n];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return null}TreeViewHandler.prototype.setLoading=function(){this.treeview.css("cursor","wait"),this.loadingImage.css("display","block")},TreeViewHandler.prototype.setComplete=function(){this.treeview.css("cursor","move"),this.loadingImage.css("display","none")},TreeViewHandler.prototype.getSize=function(){var e=this,t=e.container.parent(),a=t.offset();e.leftMin=a.left,e.leftMax=e.leftMin+t.innerWidth(),e.topMin=a.top,e.topMax=e.topMin+t.innerHeight()},TreeViewHandler.prototype.updateTree=function(e,t){var a=this,n=[],o=[];return this.getSize(),a.treeview.find("td[abbr]").each(function(e,t){var i=(t=$(t,a.treeview)).offset();i.left>=a.leftMin&&i.left<=a.leftMax&&i.top>=a.topMin&&i.top<=a.topMax&&(n.push(t.attr("abbr")),o.push(t))}),n.length>0?(a.updating=!0,a.setLoading(),jQuery.ajax({url:a.ajaxPersons,dataType:"json",data:"q="+n.join(";"),success:function(e){for(var t=o.length,n=($(".rootPerson",this.treeview).offset().left,0);n<t;n++)o[n].removeAttr("abbr").html(e[n]);a.getSize()},complete:function(){a.treeview.find("td[abbr]").length&&a.updateTree(e,t),a.auto_box_width&&a.treeview.find(".tv_box").css("width","auto"),a.updating=!0,e&&a.centerOnRoot(),t&&t.removeClass("tvPressed"),a.setComplete(),a.updating=!1},timeout:function(){t&&t.removeClass("tvPressed"),a.updating=!1,a.setComplete()}})):(t&&t.removeClass("tvPressed"),a.setComplete()),!1},TreeViewHandler.prototype.compact=function(){var e=this,t=$("#tvbCompact",e.toolbox);if(e.setLoading(),e.auto_box_width){var a=e.boxWidth*(e.zoom/100)+"px",n=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",n),e.auto_box_width=!1,readCookie("compact")&&createCookie("compact",!1,e.cookieDays),t.removeClass("tvPressed")}else e.treeview.find(".tv_box").css("width","auto"),e.auto_box_width=!0,readCookie("compact")||createCookie("compact",!0,e.cookieDays),e.updating||e.updateTree(),t.addClass("tvPressed");return e.setComplete(),!1},TreeViewHandler.prototype.centerOnRoot=function(){this.loadingImage.css("display","block");var e=this.container,t=e.innerWidth()/2;if(isNaN(t))return!1;e.innerHeight(),$(".rootPerson",this.treeview);return this.updating||this.setComplete(),!1},TreeViewHandler.prototype.expandBox=function(e,t){if($(t.target).hasClass("tv_link"))return!1;var a,n,o=(e=$(e,this.treeview)).parent(),i=e.attr("abbr"),s=this;if(o.hasClass("detailsLoaded"))n=o.find(".collapsedContent"),a=o.find(".tv_box:not(.collapsedContent)");else{a=e,n=e.clone(),o.append(n.addClass("collapsedContent").css("display","none"));var r=this.loadingImage.find("img").clone().addClass("tv_box_loading").css("display","block");e.prepend(r),s.updating=!0,s.setLoading(),e.load(s.ajaxDetails+"&pid="+encodeURIComponent(i),function(){"function"==typeof CB_Init&&CB_Init(),e.css("width",s.boxExpandedWidth*(s.zoom/100)+"px"),r.remove(),o.addClass("detailsLoaded"),s.setComplete(),s.updating=!1})}return e.hasClass("boxExpanded")?(a.css("display","none"),n.css("display","block"),e.removeClass("boxExpanded")):(a.css("display","block"),n.css("display","none"),a.addClass("boxExpanded")),this.getSize(),!1};
2