From 95a243753614b21a165966c589780706a31ed53f Mon Sep 17 00:00:00 2001 From: Matthew Noorenberghe Date: Sun, 23 Feb 2014 00:52:37 -0800 Subject: Switch from browser detection using document.all to feature detection --- find.php | 21 +++--------- lifespan.php | 6 ++-- .../_MEDIA/media_0_inverselink.php | 37 ++++++++++++---------- 3 files changed, 29 insertions(+), 35 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(""); - } 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