diff options
author | Matěj Cepl <mcepl@redhat.com> | 2012-04-11 01:03:00 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2012-04-11 01:03:00 +0200 |
commit | ba9bd8b38bb04421dbc4fa045b02a6f320d817d6 (patch) | |
tree | 8e9af1d43b81796c154fe6e15fc48721d9d16e42 /data/lib/bugzillaDOMFunctions.js | |
parent | 0f33ced7ef3e2729c5e31733990dd7c60e0720ad (diff) | |
download | bugzilla-triage-ba9bd8b38bb04421dbc4fa045b02a6f320d817d6.tar.gz |
Attempts to make the script work on bugs.eclipse.org.
Diffstat (limited to 'data/lib/bugzillaDOMFunctions.js')
-rw-r--r-- | data/lib/bugzillaDOMFunctions.js | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/data/lib/bugzillaDOMFunctions.js b/data/lib/bugzillaDOMFunctions.js index aedf131..5c9423e 100644 --- a/data/lib/bugzillaDOMFunctions.js +++ b/data/lib/bugzillaDOMFunctions.js @@ -187,8 +187,9 @@ function getOptionTableCell(tableId, label) { * @return none */ function createNewButton (location, after, cmdObj) { + var newId = ""; try { - var newId = cmdObj.name.toLowerCase().replace(/[^a-z0-9]+/,"","g") + "_btn"; + newId = cmdObj.name.toLowerCase().replace(/[^a-z0-9]+/,"","g") + "_btn"; } catch (e) { console.error("createNewButton : e = " + e + "\ncreateNewButton : cmdObj.toSource() = " + @@ -355,7 +356,21 @@ function getAttachments () { * @return String with the login name of the currently logged-in user */ function getLogin () { - var lastLIElement = document.querySelector("#header ul.links li:last-of-type"); + var lastElemArr = ""; + var LIElementsArr = document.querySelectorAll("#header ul.links li"); + // This should never be null + console.log("LIElementsArr = " + LIElementsArr); + if (LIElementsArr.length > 0) { + lastElemArr = Array.filter(LIElementsArr, function(el) { + console.log("el = " + el.toSource()); + return (el.textContent.indexOf("Log") !== -1); + }); + } + console.log("lastElemArr = " + lastElemArr.toSource()); + var lastLIElement = ""; + if (lastElemArr) { + lastLIElement = lastElemArr.pop(); + } var loginArr = lastLIElement.textContent.split("\n"); var loginStr = loginArr[loginArr.length - 1].trim(); return loginStr; @@ -439,8 +454,8 @@ function killNodes(doc, target, remove) { } catch (e if e instanceof TypeError) { console.error("Cannot remove: " + elem[0]); - } - } + }; + }; } /** @@ -489,7 +504,7 @@ function getBugzillaName(URLhostname, bzLabelNames) { function parseBZCommentDate(dateString) { var tZone = { "EDT": 4, - "EST": 5 + "EST": 5, }; var dateArr = dateString.trim().split(/\s+/); |