diff options
Diffstat (limited to 'data/lib/bugzillaDOMFunctions.js')
-rw-r--r-- | data/lib/bugzillaDOMFunctions.js | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/data/lib/bugzillaDOMFunctions.js b/data/lib/bugzillaDOMFunctions.js index 8f74288..aedf131 100644 --- a/data/lib/bugzillaDOMFunctions.js +++ b/data/lib/bugzillaDOMFunctions.js @@ -147,6 +147,32 @@ function getDefaultBugzillaMaintainer (component) { } /** + * dd + * + * @return Element with the href attribute containng the information + */ +function getOptionTableCell(tableId, label) { + var cleanLabelRE = new RegExp("^\\s*([^.:]*):?\\s*$"); + label = label.trim().replace(cleanLabelRE,"$1").toLowerCase(); + + var rows = document.getElementById(tableId).getElementsByTagName("tr"); + var ourLine = Array.filter(rows, function(row) { + var curLabelElems = row.getElementsByTagName("td"); + if (curLabelElems.length > 0) { + var curLabel = curLabelElems[0].textContent.toLowerCase(); + curLabel = curLabel.replace(cleanLabelRE,"$1"); + return (curLabel === label); // maybe this could be a RE match instead + } + }); + + if (ourLine.length > 0) { + return ourLine[0].getElementsByTagName("td")[1]. + getElementsByTagName("a")[0]; + } + return null; +} + +/** * Generic function to add new button to the page. Actually copies new button * from the old one (in order to have the same look-and-feel, etc. * @@ -408,7 +434,6 @@ function killNodes(doc, target, remove) { // removing its members. for(var i = 0, ii = victimElements.length; i < ii; i++) { elem = victimElements[i]; - console.myDebug("Killing element " + elem[0]); try { elem[1].parentNode.removeChild(elem[1]); } @@ -456,3 +481,23 @@ function getBugzillaName(URLhostname, bzLabelNames) { } return bugzillaID; } + +/** + * + * original 2011-03-30 15:49:27 EDT + */ +function parseBZCommentDate(dateString) { + var tZone = { + "EDT": 4, + "EST": 5 + }; + + var dateArr = dateString.trim().split(/\s+/); + var timeZoneOffset = tZone[dateArr[2]] - + ((new Date()).getTimezoneOffset())/60; + var dArr = dateArr[0].split("-"); + var tArr = dateArr[1].split(":"); + var dayObj = new Date(+dArr[0],+dArr[1]-1,+dArr[2], + +tArr[0]+timeZoneOffset,+tArr[1],+tArr[2],0); + return dayObj; +}; |