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 | |
parent | 0f33ced7ef3e2729c5e31733990dd7c60e0720ad (diff) | |
download | bugzilla-triage-ba9bd8b38bb04421dbc4fa045b02a6f320d817d6.tar.gz |
Attempts to make the script work on bugs.eclipse.org.
Diffstat (limited to 'data')
-rw-r--r-- | data/lib/bugzillaDOMFunctions.js | 25 | ||||
-rw-r--r-- | data/lib/util.js | 1 | ||||
-rw-r--r-- | data/rhlib/rhbzpage.js | 13 |
3 files changed, 28 insertions, 11 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+/); diff --git a/data/lib/util.js b/data/lib/util.js index 2782f0c..5b2372e 100644 --- a/data/lib/util.js +++ b/data/lib/util.js @@ -4,7 +4,6 @@ // http://www.opensource.org/licenses/mit-license.php "use strict"; // ============================================================== - /** * parse URL to get its parts. * diff --git a/data/rhlib/rhbzpage.js b/data/rhlib/rhbzpage.js index eb10238..f8c7ca7 100644 --- a/data/rhlib/rhbzpage.js +++ b/data/rhlib/rhbzpage.js @@ -489,8 +489,11 @@ function RHBZinit(things) { }, false); // Uncheck "set default assignee" when the assignee is changed by other means - document.getElementById("assigned_to").addEventListener("change", - function() { - changeAssignee(null); - }, false); -} + var assAnchor = document.getElementById("assigned_to"); + if (assAnchor) { + assAnchor.addEventListener("change", + function() { + changeAssignee(null); + }, false); + }; +}; |