summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--find.php21
-rw-r--r--lifespan.php6
-rw-r--r--modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php37
-rw-r--r--timeline.php257
4 files changed, 156 insertions, 165 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/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/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;
}
}