summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--find.php21
-rw-r--r--includes/functions/functions_edit.php2
-rw-r--r--js/webtrees-1.5.2.js88
-rw-r--r--lifespan.php6
-rw-r--r--modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php37
-rw-r--r--reportengine.php2
-rw-r--r--timeline.php257
7 files changed, 203 insertions, 210 deletions
diff --git a/find.php b/find.php
index 287f66476c..f931f2c320 100644
--- a/find.php
+++ b/find.php
@@ -334,23 +334,12 @@ if ($type == "facts") {
DefaultTag.prototype= {
_newCounter:0
,view:function() {
- var row=document.createElement("tr"),cell,o;
+ var row=document.createElement("tr"),cell;
row.appendChild(cell=document.createElement("td"));
- o=null;
- if (document.all) {
- //Old IEs handle the creation of a checkbox already checked, as far as I know, only in this way
- try {
- o=document.createElement("<input type='checkbox' id='tag"+this._counter+"' "+(this.selected?"checked='checked'":"")+">");
- } catch(e) {
- o=null;
- }
- }
- if (!o) {
- o=document.createElement("input");
- o.setAttribute("id","tag"+this._counter);
- o.setAttribute("type","checkbox");
- if (this.selected) o.setAttribute("checked", "checked");
- }
+ var o = document.createElement("input");
+ o.id = "tag"+this._counter;
+ o.type = "checkbox";
+ o.checked = this.selected;
o.DefaultTag=this;
o.ParentRow=row;
o.onclick=function() {
diff --git a/includes/functions/functions_edit.php b/includes/functions/functions_edit.php
index a974e7b2dd..4a095d5268 100644
--- a/includes/functions/functions_edit.php
+++ b/includes/functions/functions_edit.php
@@ -309,7 +309,7 @@ function remove_links($gedrec, $xref) {
function print_calendar_popup($id) {
return
' <a href="#" onclick="cal_toggleDate(\'caldiv'.$id.'\', \''.$id.'\'); return false;" class="icon-button_calendar" title="'.WT_I18N::translate('Select a date').'"></a>'.
- '<div id="caldiv'.$id.'" style="position:absolute;visibility:hidden;background-color:white;layer-background-color:white; z-index: 1000;"></div>';
+ '<div id="caldiv'.$id.'" style="position:absolute;visibility:hidden;background-color:white;z-index:1000;"></div>';
}
function print_addnewmedia_link($element_id) {
diff --git a/js/webtrees-1.5.2.js b/js/webtrees-1.5.2.js
index 907156d53f..e97f0959dc 100644
--- a/js/webtrees-1.5.2.js
+++ b/js/webtrees-1.5.2.js
@@ -36,7 +36,7 @@ var fam_nav_specs='width=300,height=600,left=817,top=150,resizable=1,scrollbars=
// TODO: This function loads help_text.php twice. It should only load it once.
function helpDialog(which, mod) {
- url='help_text.php?help='+which+'&mod='+mod;
+ var url='help_text.php?help='+which+'&mod='+mod;
dialog=jQuery('<div></div>')
.load(url+' .helpcontent')
.dialog({
@@ -106,7 +106,7 @@ function modalDialogSubmitAjax(form) {
function closePopupAndReloadParent(url) {
if (parent.opener) {
- if (url == null || url == "") {
+ if (!url) {
parent.opener.location.reload();
} else {
parent.opener.location=url;
@@ -124,9 +124,9 @@ function closePopupAndReloadParent(url) {
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-3); i+=4) {
- if ((obj=document.getElementById(args[i]))!=null) {
+ if ((obj=document.getElementById(args[i])) !== null) {
if (obj.style) {
- div=obj;
+ div=obj; // unused?
obj=obj.style;
}
v=args[i+2];
@@ -140,23 +140,24 @@ function MM_showHideLayers() { //v6.0
v=(v=='show')?'visible':(v=='hide')?'hidden':v;
obj.visibility=v;
if (args[i+1]=='followmouse') {
- pobj = document.getElementById(args[i+3]);
- if (pobj!=null) {
+ var pobj = document.getElementById(args[i+3]);
+ if (pobj !== null) {
if (pobj.style.top!="auto" && args[i+3]!="relatives") {
obj.top=5+msY-parseInt(pobj.style.top)+'px';
if (textDirection=="ltr") obj.left=5+msX-parseInt(pobj.style.left)+'px';
if (textDirection=="rtl") obj.right=5+msX-parseInt(pobj.style.right)+'px';
} else {
obj.top="auto";
- pagewidth = document.documentElement.offsetWidth+document.documentElement.scrollLeft;
+ var pagewidth = document.documentElement.offsetWidth+document.documentElement.scrollLeft;
if (textDirection=="rtl") pagewidth -= document.documentElement.scrollLeft;
if (msX > pagewidth-160) msX = msX-150-pobj.offsetLeft;
- contentdiv = document.getElementById("content");
+ var contentdiv = document.getElementById("content");
msX = msX - contentdiv.offsetLeft;
if (textDirection=="ltr") obj.left=(5+msX)+'px';
obj.zIndex=1000;
}
} else {
+ var Xadjust;
if (WT_SCRIPT_NAME.indexOf("fanchart")>0) {
obj.top=(msY-20)+'px';
obj.left=(msX-20)+'px';
@@ -226,10 +227,9 @@ var show = false;
lastfamilybox="";
}
- var timeouts = new Array();
+ var timeouts = [];
function family_box_timeout(boxid) {
- tout = setTimeout("hide_family_box('"+boxid+"')", 2500);
- timeouts[boxid] = tout;
+ timeouts[boxid] = setTimeout("hide_family_box('"+boxid+"')", 2500);
}
function clear_family_box_timeout(boxid) {
@@ -792,7 +792,7 @@ function valid_date(datefield) {
// Apply leading zero to day numbers
datestr=datestr.replace(/(^| )(\d [A-Z]{3,5} \d{4})/, "$10$2");
- if (datephrase != "") {
+ if (datephrase) {
datestr=datestr+" ("+datephrase;
}
// Only update it if is has been corrected - otherwise input focus
@@ -832,7 +832,7 @@ function expandbox(boxid, bstyle) {
clength = jQuery(".compact_view").length;
});
- url = window.location.toString();
+ var url = window.location.toString();
divbox = document.getElementById("out-"+boxid);
inbox = document.getElementById("inout-"+boxid);
inbox2 = document.getElementById("inout2-"+boxid);
@@ -937,8 +937,8 @@ function expandbox(boxid, bstyle) {
}
return true;
}
-function createXMLHttp()
-{
+
+function createXMLHttp() {
if (typeof XMLHttpRequest != "undefined") {
return new XMLHttpRequest();
} else if (window.ActiveXObject) {
@@ -947,16 +947,14 @@ function createXMLHttp()
for (var i = 0; i < ARR_XMLHTTP_VERS.length; i++)
{
- try
- {
+ try {
var oXmlHttp = new ActiveXObject(ARR_XMLHTTP_VERS[i]);
return oXmlHttp;
- }
- catch (oError) {;}
+ } catch (oError) {}
}
}
throw new Error("XMLHttp object could not be created.");
-};
+}
function restorebox(boxid, bstyle) {
divbox = document.getElementById("out-"+boxid);
@@ -1007,7 +1005,7 @@ function restorebox(boxid, bstyle) {
return true;
}
-var menutimeouts = new Array();
+var menutimeouts = [];
function show_submenu(elementid, parentid, dir) {
var pagewidth = document.body.scrollWidth+document.documentElement.scrollLeft;
@@ -1032,24 +1030,23 @@ function show_submenu(elementid, parentid, dir) {
if (element.offsetWidth < maxwidth) {
element.style.width = maxwidth+"px";
}
-
+ var pelement, boxright;
if (dir=="down") {
- var pelement = document.getElementById(parentid);
+ pelement = document.getElementById(parentid);
if (pelement) {
element.style.left=pelement.style.left;
- var boxright = element.offsetLeft+element.offsetWidth+10;
+ boxright = element.offsetLeft+element.offsetWidth+10;
if (boxright > pagewidth) {
var menuleft = pagewidth-element.offsetWidth;
element.style.left = menuleft + "px";
}
}
- }
- if (dir=="right") {
- var pelement = document.getElementById(parentid);
+ } else if (dir=="right") {
+ pelement = document.getElementById(parentid);
if (pelement) {
if (textDirection=="ltr") {
var boxleft = pelement.offsetLeft+pelement.offsetWidth-40;
- var boxright = boxleft+element.offsetWidth+10;
+ boxright = boxleft+element.offsetWidth+10;
if (boxright > pagewidth) {
element.style.right = pelement.offsetLeft + "px";
} else {
@@ -1077,22 +1074,23 @@ function show_submenu(elementid, parentid, dir) {
}
function hide_submenu(elementid) {
-if (menutimeouts[elementid] != null) {
- element = document.getElementById(elementid);
+ if (typeof menutimeouts[elementid] !== "number") {
+ return;
+ }
+ var element = document.getElementById(elementid);
if (element && element.style) {
element.style.visibility='hidden';
}
clearTimeout(menutimeouts[elementid]);
menutimeouts[elementid] = null;
}
-}
function timeout_submenu(elementid) {
- if (menutimeouts[elementid] == null) {
- tout = setTimeout("hide_submenu('"+elementid+"')", 100);
- menutimeouts[elementid] = tout;
+ if (typeof menutimeouts[elementid] !== "number") {
+ menutimeouts[elementid] = setTimeout("hide_submenu('"+elementid+"')", 100);
}
}
+
function focusHandler(evt) {
var e = evt ? evt : window.event;
if (!e) return;
@@ -1107,7 +1105,9 @@ function loadHandler() {
for (i = 0; i < document.forms.length; i++)
for (j = 0; j < document.forms[i].elements.length; j++) {
if (document.forms[i].elements[j].type=="text") {
- if (document.forms[i].elements[j].onfocus==null) document.forms[i].elements[j].onfocus = focusHandler;
+ if (document.forms[i].elements[j].onfocus === null) {
+ document.forms[i].elements[j].onfocus = focusHandler;
+ }
}
}
}
@@ -1128,7 +1128,7 @@ function statusChecked(sel) {
cbox.checked = true;
}
-var monthLabels = new Array();
+var monthLabels = [];
monthLabels[1] = "January";
monthLabels[2] = "February";
monthLabels[3] = "March";
@@ -1142,7 +1142,7 @@ monthLabels[10] = "October";
monthLabels[11] = "November";
monthLabels[12] = "December";
-var monthShort = new Array();
+var monthShort = [];
monthShort[1] = "JAN";
monthShort[2] = "FEB";
monthShort[3] = "MAR";
@@ -1156,7 +1156,7 @@ monthShort[10] = "OCT";
monthShort[11] = "NOV";
monthShort[12] = "DEC";
-var daysOfWeek = new Array();
+var daysOfWeek = [];
daysOfWeek[0] = "S";
daysOfWeek[1] = "M";
daysOfWeek[2] = "T";
@@ -1214,10 +1214,11 @@ function cal_toggleDate(dateDivId, dateFieldId) {
/* Javascript calendar functions only work with precise gregorian dates "D M Y" or "Y" */
var greg_regex = /((\d+ (JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC) )?\d+)/;
+ var date;
if (greg_regex.exec(dateField.value)) {
- var date = new Date(RegExp.$1);
+ date = new Date(RegExp.$1);
} else {
- var date = new Date();
+ date = new Date();
}
dateDiv.innerHTML = cal_generateSelectorContent(dateFieldId, dateDivId, date);
@@ -1283,7 +1284,7 @@ function cal_generateSelectorContent(dateFieldId, dateDivId, date) {
content += '><a href="#" onclick="return cal_dateClicked(\''+dateFieldId+'\', \''+dateDivId+'\', '+tdate.getFullYear()+', '+tdate.getMonth()+', '+tdate.getDate()+');">';
content += tdate.getDate();
content += '</a></td>';
- datemilli = tdate.getTime() + daymilli;
+ var datemilli = tdate.getTime() + daymilli;
tdate = new Date(datemilli);
}
content += '</tr>';
@@ -1401,7 +1402,7 @@ function valid_lati_long(field, pos, neg) {
// valid LATI or LONG according to Gedcom standard
// pos (+) : N or E
// neg (-) : S or W
- txt=field.value.toUpperCase();
+ var txt=field.value.toUpperCase();
txt=txt.replace(/(^\s*)|(\s*$)/g, ''); // trim
txt=txt.replace(/ /g, ':'); // N12 34 ==> N12.34
txt=txt.replace(/\+/g, ''); // +17.1234 ==> 17.1234
@@ -1417,7 +1418,8 @@ function valid_lati_long(field, pos, neg) {
// 0.5698W ==> W0.5698
txt=txt.replace(/(.*)([N|S|E|W]+)$/g, '$2$1');
// 17.1234 ==> N17.1234
- if (txt!='' && txt.charAt(0)!=neg && txt.charAt(0)!=pos) txt=pos+txt;
+ if (txt && txt.charAt(0)!=neg && txt.charAt(0)!=pos)
+ txt=pos+txt;
field.value = txt;
}
diff --git a/lifespan.php b/lifespan.php
index cd775c4d7d..1524ac47a4 100644
--- a/lifespan.php
+++ b/lifespan.php
@@ -98,10 +98,11 @@ $controller
}
// Main function to retrieve mouse x-y pos.s
function getMouseXY(e) {
- if (IE) { // grab the x-y pos.s if browser is IE
+ var event = e || window.event;
+ if (typeof event.pageX === "undefined" || typeof event.pageY === "undefined") {
msX = event.clientX + document.documentElement.scrollLeft;
msY = event.clientY + document.documentElement.scrollTop;
- } else { // grab the x-y pos.s if browser is NS
+ } else {
msX = e.pageX;
msY = e.pageY;
}
@@ -124,7 +125,6 @@ $controller
}
}
- var IE = document.all?true:false;
document.onmousemove = getMouseXY;
document.onmouseup = releaseimage;
');
diff --git a/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php b/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php
index ec04709d2d..a6bf55a1b1 100644
--- a/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php
+++ b/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php
@@ -270,10 +270,10 @@ function insertRowToTable(pid, nam, head)
var numrows = links.rows.length;
var strRow = '';
for (var i=1; i<numrows; i++) {
- if (document.all) { // If Internet Explorer
- strRow += (strRow==''?'':', ') + links.rows[i].cells[1].innerText;
- } else {
+ if (typeof links.rows[i].cells[1].textContent !== "undefined") {
strRow += (strRow==''?'':', ') + links.rows[i].cells[1].textContent;
+ } else {
+ strRow += (strRow==''?'':', ') + links.rows[i].cells[1].innerText;
}
}
strRow += (strRow==''?'':', ');
@@ -287,8 +287,14 @@ function insertRowToTable(pid, nam, head)
// Check if id exists in "Add links" list ==========================
for (var i=0; i<tbl.tBodies[0].rows.length; i++) {
- if (tbl.tBodies[0].rows[i].myRow.one.textContent==pid) {
- rowToInsertAt = 'EXIST' ;
+ var cellText;
+ if (typeof tbl.tBodies[0].rows[i].myRow.one.textContent !== "undefined") {
+ cellText = tbl.tBodies[0].rows[i].myRow.one.textContent;
+ } else {
+ cellText = tbl.tBodies[0].rows[i].myRow.one.innerText;
+ }
+ if (cellText==pid) {
+ rowToInsertAt = 'EXIST';
} else
if (tbl.tBodies[0].rows[i].myRow && tbl.tBodies[0].rows[i].myRow.ra.getAttribute('type') == 'radio' && tbl.tBodies[0].rows[i].myRow.ra.checked) {
rowToInsertAt = i;
@@ -311,14 +317,10 @@ function removeHTMLTags(htmlString)
if (htmlString) {
var mydiv = document.createElement("div");
mydiv.innerHTML = htmlString;
- if (document.all) // IE Stuff
- {
- return mydiv.innerText;
- }
- else // Mozilla does not work with innerText
- {
+ if (typeof mydiv.textContent !== "undefined") {
return mydiv.textContent;
}
+ return mydiv.innerText;
}
}
@@ -367,8 +369,11 @@ function addRowToTable(num, pid, nam, head)
} else {
var txtInp1 = document.createElement('div');
txtInp1.setAttribute('type', 'text');
- txtInp1.innerHTML = pid; // Required for IE
- txtInp1.textContent = pid;
+ if (typeof txtInp1.textContent !== "undefined") {
+ txtInp1.textContent = pid;
+ } else {
+ txtInp1.innerText = pid;
+ }
}
txtInp1.setAttribute('id', INPUT_NAME_PREFIX + iteration + '_1');
txtInp1.style.background='transparent';
@@ -532,10 +537,10 @@ function parseAddLinks() {
var tbl = document.getElementById('addlinkQueue');
for (var i=1; i<tbl.rows.length; i++) { // start at i=1 because we need to avoid header
var tr = tbl.rows[i];
- if (document.all) { // If internet explorer
- str += (str==''?'':',') + tr.cells[1].childNodes[0].innerHTML;
- } else {
+ if (typeof tr.cells[1].childNodes[0].textContent !== "undefined") {
str += (str==''?'':',') + tr.cells[1].childNodes[0].textContent;
+ } else {
+ str += (str==''?'':',') + tr.cells[1].childNodes[0].innerHTML;
}
}
document.link.more_links.value = str;
diff --git a/reportengine.php b/reportengine.php
index 302a928137..d22d421901 100644
--- a/reportengine.php
+++ b/reportengine.php
@@ -259,7 +259,7 @@ elseif ($action=='setup') {
echo print_findsource_link($input['name']);
} elseif ($input['lookup']=='DATE') {
echo ' <a href="#" onclick="cal_toggleDate(\'div_', WT_Filter::EscapeJs($input['name']), '\', \'', WT_Filter::EscapeJs($input['name']), '\'); return false;" class="icon-button_calendar" title="', WT_I18N::translate('Select a date'), '"></a>';
- echo '<div id="div_', WT_Filter::EscapeHtml($input['name']), '" style="position:absolute;visibility:hidden;background-color:white;layer-background-color:white;"></div>';
+ echo '<div id="div_', WT_Filter::EscapeHtml($input['name']), '" style="position:absolute;visibility:hidden;background-color:white;"></div>';
}
}
echo '</td></tr>';
diff --git a/timeline.php b/timeline.php
index c7c658d4bf..259566bb88 100644
--- a/timeline.php
+++ b/timeline.php
@@ -43,6 +43,7 @@ var ob=null;
var Y=0;
var X=0;
var oldx=0;
+var oldlinew;
var personnum=0;
var type=0;
var state=0;
@@ -53,12 +54,9 @@ function ageMD(divbox, num) {
ob=divbox;
personnum=num;
type=0;
- if (N) {
- X=ob.offsetLeft;
- Y=ob.offsetTop;
- } else {
- X=ob.offsetLeft;
- Y=ob.offsetTop;
+ X=ob.offsetLeft;
+ Y=ob.offsetTop;
+ if (!N) {
oldx = event.clientX + document.documentElement.scrollLeft;
}
}
@@ -69,143 +67,142 @@ function factMD(divbox, num, mean) {
personnum=num;
boxmean = mean;
type=1;
+ oldx=ob.offsetLeft;
if (N) {
- oldx=ob.offsetLeft;
oldlinew=0;
- }
- else {
- oldx = ob.offsetLeft;
+ } else {
oldlinew = event.clientX + document.documentElement.scrollLeft;
}
}
function MM(e) {
- if (ob) {
- tldiv = document.getElementById("timeline_chart");
- if (type==0) {
- // age boxes
- newy = 0;
- newx = 0;
- if (N) {
- newy = e.pageY - tldiv.offsetTop;
- newx = e.pageX - tldiv.offsetLeft;
- if (oldx==0) oldx=newx;
- }
- else {
- newy = event.clientY + document.documentElement.scrollTop - tldiv.offsetTop;
- newx = event.clientX + document.documentElement.scrollLeft - tldiv.offsetLeft;
- }
- if ((newy >= topy-bheight/2)&&(newy<=bottomy)) newy = newy;
- else if (newy < topy-bheight/2) newy = topy-bheight/2;
- else newy = (bottomy-1);
- ob.style.top = newy+"px";
- tyear = ((newy+bheight-4 - topy) + scale)/scale + baseyear
- year = Math.floor(tyear);
- month = Math.floor((tyear*12)-(year*12));
- day = Math.floor((tyear*365)-(year*365 + month*30));
- mstamp = (year*365)+(month*30)+day;
- bdstamp = (birthyears[personnum]*365)+(birthmonths[personnum]*30)+birthdays[personnum];
- daydiff = mstamp - bdstamp;
- ba = 1;
- if (daydiff < 0 ) {
- ba = -1;
- daydiff = (bdstamp - mstamp);
- }
- yage = Math.floor(daydiff / 365);
- mage = Math.floor((daydiff-(yage*365))/30);
- dage = Math.floor(daydiff-(yage*365)-(mage*30));
- if (dage<0) mage = mage -1;
- if (dage<-30) {
- dage = 30+dage;
- }
- if (mage<0) yage = yage-1;
- if (mage<-11) {
- mage = 12+mage;
- }
- yearform = document.getElementById('yearform'+personnum);
- ageform = document.getElementById('ageform'+personnum);
- yearform.innerHTML = year+" "+month+" <?php echo utf8_substr(WT_I18N::translate('Month:'), 0, 1); ?> "+day+" <?php echo utf8_substr(WT_I18N::translate('Day:'), 0, 1); ?>";
- if (ba*yage>1 || ba*yage<-1 || ba*yage==0)
- ageform.innerHTML = (ba*yage)+" <?php echo utf8_substr(WT_I18N::translate('years'), 0, 1); ?> "+(ba*mage)+" <?php echo utf8_substr(WT_I18N::translate('Month:'), 0, 1); ?> "+(ba*dage)+" <?php echo utf8_substr(WT_I18N::translate('Day:'), 0, 1); ?>";
- else ageform.innerHTML = (ba*yage)+" <?php echo utf8_substr(WT_I18N::translate('Year:'), 0, 1); ?> "+(ba*mage)+" <?php echo utf8_substr(WT_I18N::translate('Month:'), 0, 1); ?> "+(ba*dage)+" <?php echo utf8_substr(WT_I18N::translate('Day:'), 0, 1); ?>";
- var line = document.getElementById('ageline'+personnum);
- temp = newx-oldx;
- if (textDirection=='rtl') temp = temp * -1;
- line.style.width=(line.width+temp)+"px";
- oldx=newx;
- return false;
+ if (!ob) {
+ return true;
+ }
+ var tldiv = document.getElementById("timeline_chart");
+ var newx = 0, newy = 0;
+ if (type==0) {
+ // age boxes
+ if (N) {
+ newy = e.pageY - tldiv.offsetTop;
+ newx = e.pageX - tldiv.offsetLeft;
+ if (oldx==0) oldx=newx;
+ }
+ else {
+ newy = event.clientY + document.documentElement.scrollTop - tldiv.offsetTop;
+ newx = event.clientX + document.documentElement.scrollLeft - tldiv.offsetLeft;
+ }
+ if ((newy >= topy-bheight/2)&&(newy<=bottomy)) newy = newy;
+ else if (newy < topy-bheight/2) newy = topy-bheight/2;
+ else newy = (bottomy-1);
+ ob.style.top = newy+"px";
+ var tyear = ((newy+bheight-4 - topy) + scale)/scale + baseyear;
+ var year = Math.floor(tyear);
+ var month = Math.floor((tyear*12)-(year*12));
+ var day = Math.floor((tyear*365)-(year*365 + month*30));
+ var mstamp = (year*365)+(month*30)+day;
+ var bdstamp = (birthyears[personnum]*365)+(birthmonths[personnum]*30)+birthdays[personnum];
+ var daydiff = mstamp - bdstamp;
+ var ba = 1;
+ if (daydiff < 0 ) {
+ ba = -1;
+ daydiff = (bdstamp - mstamp);
+ }
+ var yage = Math.floor(daydiff / 365);
+ var mage = Math.floor((daydiff-(yage*365))/30);
+ var dage = Math.floor(daydiff-(yage*365)-(mage*30));
+ if (dage<0) mage = mage -1;
+ if (dage<-30) {
+ dage = 30+dage;
+ }
+ if (mage<0) yage = yage-1;
+ if (mage<-11) {
+ mage = 12+mage;
+ }
+ var yearform = document.getElementById('yearform'+personnum);
+ var ageform = document.getElementById('ageform'+personnum);
+ yearform.innerHTML = year+" "+month+" <?php echo utf8_substr(WT_I18N::translate('Month:'), 0, 1); ?> "+day+" <?php echo utf8_substr(WT_I18N::translate('Day:'), 0, 1); ?>";
+ if (ba*yage>1 || ba*yage<-1 || ba*yage==0)
+ ageform.innerHTML = (ba*yage)+" <?php echo utf8_substr(WT_I18N::translate('years'), 0, 1); ?> "+(ba*mage)+" <?php echo utf8_substr(WT_I18N::translate('Month:'), 0, 1); ?> "+(ba*dage)+" <?php echo utf8_substr(WT_I18N::translate('Day:'), 0, 1); ?>";
+ else ageform.innerHTML = (ba*yage)+" <?php echo utf8_substr(WT_I18N::translate('Year:'), 0, 1); ?> "+(ba*mage)+" <?php echo utf8_substr(WT_I18N::translate('Month:'), 0, 1); ?> "+(ba*dage)+" <?php echo utf8_substr(WT_I18N::translate('Day:'), 0, 1); ?>";
+ var line = document.getElementById('ageline'+personnum);
+ var temp = newx-oldx;
+ if (textDirection=='rtl') temp = temp * -1;
+ line.style.width=(line.width+temp)+"px";
+ oldx=newx;
+ return false;
+ } else {
+ // fact boxes
+ var linewidth;
+ if (N) {
+ newy = e.pageY - tldiv.offsetTop;
+ newx = e.pageX - tldiv.offsetLeft;
+ if (oldx==0) oldx=newx;
+ linewidth = e.pageX;
} else {
- newy = 0;
- newx = 0;
- if (N) {
- newy = e.pageY - tldiv.offsetTop;
- newx = e.pageX - tldiv.offsetLeft;
- if (oldx==0) oldx=newx;
- linewidth = e.pageX;
+ newy = event.clientY + document.documentElement.scrollTop - tldiv.offsetTop;
+ newx = event.clientX + document.documentElement.scrollLeft - tldiv.offsetLeft;
+ linewidth = event.clientX + document.documentElement.scrollLeft;
+ }
+ // get diagnal line box
+ dbox = document.getElementById('dbox'+personnum);
+ var etopy, ebottomy;
+ // set up limits
+ if (boxmean-175 < topy) etopy = topy;
+ else etopy = boxmean-175;
+ if (boxmean+175 > bottomy) ebottomy = bottomy;
+ else ebottomy = boxmean+175;
+ // check if in the bounds of the limits
+ if ((newy >= etopy)&&(newy<=ebottomy)) newy = newy;
+ else if (newy < etopy) newy = etopy;
+ else if (newy >ebottomy) newy = ebottomy;
+ // calculate the change in Y position
+ var dy = newy-ob.offsetTop;
+ // check if we are above the starting point and switch the background image
+ if (newy < boxmean) {
+ if (textDirection=='ltr') {
+ dbox.style.backgroundImage = "url('<?php echo $WT_IMAGES["dline"]; ?>')";
+ dbox.style.backgroundPosition = "0% 100%";
} else {
- newy = event.clientY + document.documentElement.scrollTop - tldiv.offsetTop;
- newx = event.clientX + document.documentElement.scrollLeft - tldiv.offsetLeft;
- linewidth = event.clientX + document.documentElement.scrollLeft;
+ dbox.style.backgroundImage = "url('<?php echo $WT_IMAGES["dline2"]; ?>')";
+ dbox.style.backgroundPosition = "0% 0%";
}
- // get diagnal line box
- dbox = document.getElementById('dbox'+personnum);
- // set up limits
- if (boxmean-175 < topy) etopy = topy;
- else etopy = boxmean-175;
- if (boxmean+175 > bottomy) ebottomy = bottomy;
- else ebottomy = boxmean+175;
- // check if in the bounds of the limits
- if ((newy >= etopy)&&(newy<=ebottomy)) newy = newy;
- else if (newy < etopy) newy = etopy;
- else if (newy >ebottomy) newy = ebottomy;
- // calculate the change in Y position
- dy = newy-ob.offsetTop;
- // check if we are above the starting point and switch the background image
- if (newy < boxmean) {
- if (textDirection=='ltr') {
- dbox.style.backgroundImage = "url('<?php echo $WT_IMAGES["dline"]; ?>')";
- dbox.style.backgroundPosition = "0% 100%";
- } else {
- dbox.style.backgroundImage = "url('<?php echo $WT_IMAGES["dline2"]; ?>')";
- dbox.style.backgroundPosition = "0% 0%";
- }
- dy = (-1)*dy;
- state=1;
- dbox.style.top = (newy+bheight/3)+"px";
+ dy = (-1)*dy;
+ state=1;
+ dbox.style.top = (newy+bheight/3)+"px";
+ } else {
+ if (textDirection=='ltr') {
+ dbox.style.backgroundImage = "url('<?php echo $WT_IMAGES["dline2"]; ?>')";
+ dbox.style.backgroundPosition = "0% 0%";
} else {
- if (textDirection=='ltr') {
- dbox.style.backgroundImage = "url('<?php echo $WT_IMAGES["dline2"]; ?>')";
- dbox.style.backgroundPosition = "0% 0%";
- } else {
- dbox.style.backgroundImage = "url('<?php echo $WT_IMAGES["dline"]; ?>')";
- dbox.style.backgroundPosition = "0% 100%";
- }
-
- dbox.style.top = (boxmean+(bheight/3))+"px";
- state=0;
+ dbox.style.backgroundImage = "url('<?php echo $WT_IMAGES["dline"]; ?>')";
+ dbox.style.backgroundPosition = "0% 100%";
}
- // the new X posistion moves the same as the y position
- if (textDirection=='ltr') newx = dbox.offsetLeft+Math.abs(newy-boxmean);
- else newx = dbox.offsetRight+Math.abs(newy-boxmean);
- // set the X position of the box
- if (textDirection=='ltr') ob.style.left=newx+"px";
- else ob.style.right=newx+"px";
- // set new top positions
- ob.style.top = newy+"px";
- // get the width for the diagnal box
- newwidth = (ob.offsetLeft-dbox.offsetLeft);
- // set the width
- dbox.style.width=newwidth+"px";
- if (textDirection=='rtl') dbox.style.right = (dbox.offsetRight - newwidth) + 'px';
- dbox.style.height=newwidth+"px";
- // change the line width to the change in the mouse X position
- line = document.getElementById('boxline'+personnum);
- if (oldlinew!=0) line.width=line.width+(linewidth-oldlinew);
- oldlinew = linewidth;
- oldx=newx;
- oldstate=state;
- return false;
+
+ dbox.style.top = (boxmean+(bheight/3))+"px";
+ state=0;
}
+ // the new X posistion moves the same as the y position
+ if (textDirection=='ltr') newx = dbox.offsetLeft+Math.abs(newy-boxmean);
+ else newx = dbox.offsetRight+Math.abs(newy-boxmean);
+ // set the X position of the box
+ if (textDirection=='ltr') ob.style.left=newx+"px";
+ else ob.style.right=newx+"px";
+ // set new top positions
+ ob.style.top = newy+"px";
+ // get the width for the diagnal box
+ var newwidth = (ob.offsetLeft-dbox.offsetLeft);
+ // set the width
+ dbox.style.width=newwidth+"px";
+ if (textDirection=='rtl') dbox.style.right = (dbox.offsetRight - newwidth) + 'px';
+ dbox.style.height=newwidth+"px";
+ // change the line width to the change in the mouse X position
+ line = document.getElementById('boxline'+personnum);
+ if (oldlinew!=0) line.width=line.width+(linewidth-oldlinew);
+ oldlinew = linewidth;
+ oldx=newx;
+ oldstate=state;
+ return false;
}
}