xref: /webtrees/public/js/webtrees.min.js (revision 1b9f6db3c2a6b5428c9477b2e6dfc53228476699)
1"use strict";var pastefield,webtrees=function(){var e=document.documentElement.lang;function t(e){return e.replace(/\s+/g," ").trim()}function o(e){return e.match(/[\u3400-\u9FCC]/)?"cjk":e.match(/[\u0370-\u03FF]/)?"greek":e.match(/[\u0400-\u04FF]/)?"cyrillic":e.match(/[\u0590-\u05FF]/)?"hebrew":e.match(/[\u0600-\u06FF]/)?"arabic":"latin"}return{buildNameFromParts:function(a,n,i,r,l,s){var d="cjk"===o(a+n+i+n+r+l),c=d?"":" ",u=d||-1!==["hu","jp","ko","vi","zh-Hans","zh-Hant"].indexOf(e),p=-1!==["is"].indexOf(e)?"":"/";a=t(a),n=t(n.replace(",",c)),i=t(i),r=function(t,o){return"pl"===e&&"F"===o?t.replace(/ski$/,"ska").replace(/cki$/,"cka").replace(/dzki$/,"dzka").replace(/żki$/,"żka"):t}(t(r.replace(",",c)),s),l=t(l);var h=t(i+c+r);return t(a+c+(u?p+h+p+c+n:n+c+p+h+p)+c+l)},detectScript:o}}();function expand_layer(e){return $("#"+e+"_img").toggleClass("icon-plus icon-minus"),$("#"+e).slideToggle("fast"),$("#"+e+"-alt").toggle(),!1}function accept_changes(e,t){return $.post("index.php?route=accept-changes",{xref:e,ged:t},function(){document.location.reload()}),!1}function reject_changes(e,t){return $.post("index.php?route=reject-changes",{xref:e,ged:t},function(){document.location.reload()}),!1}function delete_record(e,t){return $.post("index.php?route=delete-record",{xref:e,ged:t},function(){document.location.reload()}),!1}function delete_fact(e,t,o,a){return confirm(e)&&$.post("index.php?route=delete-fact",{xref:o,fact_id:a,ged:t},function(){document.location.reload()}),!1}function copy_fact(e,t,o){return $.post("index.php?route=copy-fact",{xref:t,fact_id:o,ged:e},function(){document.location.reload()}),!1}function paste_fact(e,t,o){return $.post("index.php?route=paste-fact",{xref:t,fact_id:$(o).val(),ged:e},function(){document.location.reload()}),!1}function delete_user(e,t){return confirm(e)&&$.post("index.php?route=delete-user",{user_id:t},function(){document.location.reload()}),!1}function masquerade(e){return $.post("index.php?route=masquerade",{user_id:e},function(){document.location.reload()}),!1}function addmedia_links(e,t,o){return pastefield=e,insertRowToTable(t,o),!1}function valid_date(e,t){var o=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"],a=e.value,n=a.split("("),i="";n.length>1&&(a=n[0],i=n[1]),(a=(a=(a=(a=(a=a.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)$/)&&(a="BET "+o[3*RegExp.$1-3]+" "+RegExp.$2+" AND "+o[3*RegExp.$1-1]+" "+RegExp.$2),a.match(/^(@#DHIJRI@|HIJRI)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(a="@#DHIJRI@"+RegExp.$2+["MUHAR","SAFAR","RABIA","RABIT","JUMAA","JUMAT","RAJAB","SHAAB","RAMAD","SHAWW","DHUAQ","DHUAH"][parseInt(RegExp.$3,10)-1]+RegExp.$4),a.match(/^(@#DJALALI@|JALALI)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(a="@#DJALALI@"+RegExp.$2+["FARVA","ORDIB","KHORD","TIR","MORDA","SHAHR","MEHR","ABAN","AZAR","DEY","BAHMA","ESFAN"][parseInt(RegExp.$3,10)-1]+RegExp.$4),a.match(/^(@#DHEBREW@|HEBREW)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(a="@#DHEBREW@"+RegExp.$2+["TSH","CSH","KSL","TVT","SHV","ADR","ADS","NSN","IYR","SVN","TMZ","AAV","ELL"][parseInt(RegExp.$3,10)-1]+RegExp.$4),a.match(/^(@#DFRENCH R@|FRENCH)( \d?\d )(\d?\d)( \d?\d?\d?\d)$/)&&(a="@#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(a)){var r=RegExp.$1,l=parseInt(RegExp.$2,10),s=parseInt(RegExp.$3,10),d=parseInt(RegExp.$4,10),c=(new Date).getFullYear(),u=c%100,p=c-u;"DMY"===t&&l<=31&&s<=12||l>13&&l<=31&&s<=12&&d>31?a=r+l+" "+o[s-1]+" "+(d>=100?d:d<=u?d+p:d+p-100):"MDY"===t&&l<=12&&s<=31||s>13&&s<=31&&l<=12&&d>31?a=r+s+" "+o[l-1]+" "+(d>=100?d:d<=u?d+p:d+p-100):("YMD"===t&&s<=12&&d<=31||d>13&&d<=31&&s<=12&&l>31)&&(a=r+d+" "+o[s-1]+" "+(l>=100?l:l<=u?l+p:l+p-100))}a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=a.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&&(a=a+" ("+i),e.value!==a&&(e.value=a)}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,o,a,n,i,r,l,s,d,c,u){monthLabels[1]=e,monthLabels[2]=t,monthLabels[3]=o,monthLabels[4]=a,monthLabels[5]=n,monthLabels[6]=i,monthLabels[7]=r,monthLabels[8]=l,monthLabels[9]=s,monthLabels[10]=d,monthLabels[11]=c,monthLabels[12]=u}function cal_setDayHeaders(e,t,o,a,n,i,r){daysOfWeek[0]=e,daysOfWeek[1]=t,daysOfWeek[2]=o,daysOfWeek[3]=a,daysOfWeek[4]=n,daysOfWeek[5]=i,daysOfWeek[6]=r}function cal_setWeekStart(e){e>=0&&e<7&&(weekStart=e)}function calendarWidget(e,t){var o=document.getElementById(e),a=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;var n;return n=/((\d+ (JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC) )?\d+)/i.exec(a.value)?new Date(RegExp.$1):new Date,o.innerHTML=cal_generateSelectorContent(t,e,n),"hidden"===o.style.visibility?(o.style.visibility="visible",!1):"hide"===o.style.visibility&&(o.style.visibility="show",!1)}function cal_generateSelectorContent(e,t,o){var a,n,i='<table border="1"><tr>';for(i+='<td><select class="form-control" id="'+e+'_daySelect" onchange="return cal_updateCalendar(\''+e+"', '"+t+"');\">",a=1;a<32;a++)i+='<option value="'+a+'"',o.getDate()===a&&(i+=' selected="selected"'),i+=">"+a+"</option>";for(i+="</select></td>",i+='<td><select class="form-control" id="'+e+'_monSelect" onchange="return cal_updateCalendar(\''+e+"', '"+t+"');\">",a=1;a<13;a++)i+='<option value="'+a+'"',o.getMonth()+1===a&&(i+=' selected="selected"'),i+=">"+monthLabels[a]+"</option>";for(i+="</select></td>",i+='<td><input class="form-control" type="text" id="'+e+'_yearInput" size="5" value="'+o.getFullYear()+'" onchange="return cal_updateCalendar(\''+e+"', '"+t+"');\" /></td></tr>",i+='<tr><td colspan="3">',i+='<table width="100%">',i+="<tr>",n=weekStart,a=0;a<7;a++)i+="<td ",i+='class="descriptionbox"',i+=">",i+=daysOfWeek[n],i+="</td>",++n>6&&(n=0);i+="</tr>";var r=new Date(o.getFullYear(),o.getMonth(),1),l=r.getDay();l-=weekStart;for(r=r.getTime()-864e5*l+432e5,r=new Date(r),n=0;n<6;n++){for(i+="<tr>",a=0;a<7;a++){i+="<td ",r.getMonth()===o.getMonth()?r.getDate()===o.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+"', "+r.getFullYear()+", "+r.getMonth()+", "+r.getDate()+');">',i+=r.getDate(),i+="</a></td>";var s=r.getTime()+864e5;r=new Date(s)}i+="</tr>"}return i+="</table>",i+="</td></tr>",i+="</table>"}function cal_setDateField(e,t,o,a){var n=document.getElementById(e);return!!n&&(a<10&&(a="0"+a),n.value=a+" "+monthShort[o+1]+" "+t,!1)}function cal_updateCalendar(e,t){var o=document.getElementById(e+"_daySelect");if(!o)return!1;var a=document.getElementById(e+"_monSelect");if(!a)return!1;var n=document.getElementById(e+"_yearInput");if(!n)return!1;var i=parseInt(a.options[a.selectedIndex].value,10);i-=1;var r=new Date(n.value,i,o.options[o.selectedIndex].value);cal_setDateField(e,r.getFullYear(),r.getMonth(),r.getDate());var l=document.getElementById(t);return l?(l.innerHTML=cal_generateSelectorContent(e,t,r),!1):(alert("no dateDiv "+t),!1)}function cal_dateClicked(e,t,o,a,n){return cal_setDateField(e,o,a,n),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),o="state-of-"+e;"true"===localStorage.getItem(o)&&$(t).click(),$(t).on("change",function(){localStorage.setItem(o,t.checked)})}function valid_lati_long(e,t,o){var a=e.value.toUpperCase();(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=a.replace(/(^\s*)|(\s*$)/g,"")).replace(/ /g,":")).replace(/\+/g,"")).replace(/-/g,o)).replace(/,/g,".")).replace(/\u00b0/g,":")).replace(/\u0027/g,":")).replace(/^([0-9]+):([0-9]+):([0-9.]+)(.*)/g,function(e,t,o,a,n){var i=parseFloat(t);return i+=o/60,i+=a/3600,n+(i=Math.round(1e4*i)/1e4)})).replace(/^([0-9]+):([0-9]+)(.*)/g,function(e,t,o,a){var n=parseFloat(t);return n+=o/60,a+(n=Math.round(1e4*n)/1e4)})).replace(/(.*)([N|S|E|W]+)$/g,"$2$1"))&&a.charAt(0)!==o&&a.charAt(0)!==t&&(a=t+a),e.value=a}function activate_colorbox(e){$.extend($.colorbox.settings,{fixed:!0,current:"",previous:"",next:"",slideshowStart:"",slideshowStop:"",close:""}),e&&$.extend($.colorbox.settings,e),$("body").on("click","a.gallery",function(){$("a[type^=image].gallery").colorbox({photo:!0,maxWidth:"95%",maxHeight:"95%",rel:"gallery",slideshow:!0,slideshowAuto:!1,onComplete:function(){$(".cboxPhoto").unbind("click"),wheelzoom(document.querySelectorAll(".cboxPhoto"))}})})}function autocomplete(e){$(e).each(function(){var e=this;$(this).typeahead(null,{display:"value",source:new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("value"),queryTokenizer:Bloodhound.tokenizers.whitespace,remote:{url:this.dataset.autocompleteUrl,replace:function(t,o){if(e.dataset.autocompleteExtra){var a=$(document.querySelector(e.dataset.autocompleteExtra)).val();return t.replace("QUERY",o)+"&extra="+encodeURIComponent(a)}return t.replace("QUERY",o)},wildcard:"QUERY"}})})})}function insertTextAtCursor(e,t){var o=e.scrollTop,a=e.selectionStart,n=e.value.substring(0,a),i=e.value.substring(e.selectionEnd,e.value.length);e.value=n+t+i,e.selectionStart=a+t.length,e.selectionEnd=e.selectionStart,e.focus(),e.scrollTop=o}function drawPieChart(e,t,o,a,n){t=google.visualization.arrayToDataTable(t);var i={title:a,height:"100%",width:"100%",pieStartAngle:0,pieSliceText:"none",pieSliceTextStyle:{color:"#777"},pieHole:.4,legend:{alignment:"center",labeledValueText:n||"value",position:"labeled"},chartArea:{left:0,top:"5%",height:"90%",width:"100%"},tooltip:{trigger:"none",text:"both"},backgroundColor:"transparent",colors:o};new google.visualization.PieChart(document.getElementById(e)).draw(t,i)}function 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);var a=new google.visualization.ColumnChart(document.getElementById(e));t=google.visualization.arrayToDataTable(t);a.draw(t,o)}function 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);var a=new google.visualization.ComboChart(document.getElementById(e));t=google.visualization.arrayToDataTable(t);a.draw(t,o)}function drawGeoChart(e,t,o){o=Object.assign({title:"",subtitle:"",height:"100%",width:"100%"},o);var a=new google.visualization.GeoChart(document.getElementById(e));t=google.visualization.arrayToDataTable(t);a.draw(t,o)}function TreeViewHandler(e,t){var o=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.ajaxUrl="index.php?route=module&module=tree&ged="+encodeURIComponent(t)+"&instance="+e+"&action=",this.container=this.treeview.parent(),this.auto_box_width=!1,this.updating=!1,"true"===readCookie("compact")&&o.compact(),function(e){e.fn.drags=function(t){return this.css("cursor","move").on("mousedown",function(t){var a=e(this),n=a.outerHeight(),i=a.outerWidth(),r=a.offset().top+n-t.pageY,l=a.offset().left+i-t.pageX;a.addClass("draggable"),e(document).on("mousemove",function(t){e(".draggable").offset({top:t.pageY+r-n,left:t.pageX+l-i}).on("mouseup",function(){a.removeClass("draggable")})}).on("mouseup",function(){a.removeClass("draggable"),o.updateTree()}),t.preventDefault()})}}(jQuery),o.treeview.drags(),o.toolbox.find("#tvbCompact").each(function(e,t){t.onclick=function(){o.compact()}}),o.toolbox.find("#tvbAllPartners").each(function(e,t){t.onclick=function(){createCookie("allPartners","true"===readCookie("allPartners")?"false":"true",o.cookieDays),document.location=document.location}}),o.toolbox.find("#tvbOpen").each(function(e,t){var a=$(t,o.toolbox);t.onclick=function(){a.addClass("tvPressed"),o.setLoading();var e=jQuery.Event("click");o.treeview.find(".tv_box:not(.boxExpanded)").each(function(t,a){var n=$(a,o.treeview).offset();n.left>=o.leftMin&&n.left<=o.leftMax&&n.top>=o.topMin&&n.top<=o.topMax&&o.expandBox(a,e)}),a.removeClass("tvPressed"),o.setComplete()}}),o.toolbox.find("#tvbClose").each(function(e,t){var a=$(t,o.toolbox);t.onclick=function(){a.addClass("tvPressed"),o.setLoading(),o.treeview.find(".tv_box.boxExpanded").each(function(e,t){$(t).css("display","none").removeClass("boxExpanded").parent().find(".tv_box.collapsedContent").css("display","block")}),a.removeClass("tvPressed"),o.setComplete()}}),o.centerOnRoot()}function createCookie(e,t,o){if(o){var a=new Date;a.setTime(a.getTime()+24*o*60*60*1e3),document.cookie=e+"="+t+"; expires="+a.toGMTString()+"; path=/"}else document.cookie=e+"="+t+"; path=/"}function readCookie(e){for(var t=e+"=",o=document.cookie.split(";"),a=0;a<o.length;a++){for(var n=o[a];" "===n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(t))return n.substring(t.length,n.length)}return null}$.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}}),$.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")}),$(".wt-modal-create-record").on("show.bs.modal",function(e){$("form",$(this)).data("element-id",$(e.relatedTarget).data("element-id")),$("form .form-group input:first",$(this)).focus()}),$(".wt-modal-create-record form").on("submit",function(e){e.preventDefault();var t=$(this).data("element-id");$.ajax({url:"index.php",type:"POST",data:new FormData(this),async:!1,cache:!1,contentType:!1,processData:!1,success:function(e){$("#"+t).select2().empty().append(new Option(e.text,e.id)).val(e.id).trigger("change")},failure:function(e){alert(e.error_message)}}),this.reset(),$(this).closest(".wt-modal-create-record").modal("hide")}),$(".menu-language").on("click","[data-language]",function(){return $.post("index.php?route=language",{language:$(this).data("language")},function(){document.location.reload()}),!1}),$(".menu-theme").on("click","[data-theme]",function(){return $.post("index.php?route=theme",{theme:$(this).data("theme")},function(){document.location.reload()}),!1}),$(".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,o=$(".wt-osk-shift-button").hasClass("active"),a=$("sup",this)[0];if(o&&void 0!==a&&(t=a.innerText),null!==e){var n=e.selectionStart,i=e.value,r=i.substring(0,n),l=i.substring(n,i.length);e.value=r+t+l,!1===$(".wt-osk-pin-button").hasClass("active")&&$(".wt-osk").hide()}}),$(".wt-osk-close").on("click",function(){$(".wt-osk").hide()})}),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(),o=t.offset();e.leftMin=o.left,e.leftMax=e.leftMin+t.innerWidth(),e.topMin=o.top,e.topMax=e.topMin+t.innerHeight()},TreeViewHandler.prototype.updateTree=function(e,t){var o=this,a=[],n=[];return this.getSize(),o.treeview.find("td[abbr]").each(function(e,t){var i=(t=$(t,o.treeview)).offset();i.left>=o.leftMin&&i.left<=o.leftMax&&i.top>=o.topMin&&i.top<=o.topMax&&(a.push(t.attr("abbr")),n.push(t))}),a.length>0?(o.updating=!0,o.setLoading(),jQuery.ajax({url:o.ajaxUrl+"Persons",dataType:"json",data:"q="+a.join(";"),success:function(e){for(var t=n.length,a=($(".rootPerson",this.treeview).offset().left,0);a<t;a++)n[a].removeAttr("abbr").html(e[a]);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},TreeViewHandler.prototype.compact=function(){var e=this,t=$("#tvbCompact",e.toolbox);if(e.setLoading(),e.auto_box_width){var o=e.boxWidth*(e.zoom/100)+"px",a=e.boxExpandedWidth*(e.zoom/100)+"px";e.treeview.find(".tv_box:not(boxExpanded)",e.treeview).css("width",o),e.treeview.find(".boxExpanded",e.treeview).css("width",a),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 o,a,n=(e=$(e,this.treeview)).parent(),i=e.attr("abbr"),r=this;if(n.hasClass("detailsLoaded"))a=n.find(".collapsedContent"),o=n.find(".tv_box:not(.collapsedContent)");else{o=e,a=e.clone(),n.append(a.addClass("collapsedContent").css("display","none"));var l=this.loadingImage.find("img").clone().addClass("tv_box_loading").css("display","block");e.prepend(l),r.updating=!0,r.setLoading(),e.load(r.ajaxUrl+"Details&pid="+i,function(){"function"==typeof CB_Init&&CB_Init(),e.css("width",r.boxExpandedWidth*(r.zoom/100)+"px"),l.remove(),n.addClass("detailsLoaded"),r.setComplete(),r.updating=!1})}return e.hasClass("boxExpanded")?(o.css("display","none"),a.css("display","block"),e.removeClass("boxExpanded")):(o.css("display","block"),a.css("display","none"),o.addClass("boxExpanded")),this.getSize(),!1};
2