aboutsummaryrefslogtreecommitdiffstats
path: root/data/lib
diff options
context:
space:
mode:
Diffstat (limited to 'data/lib')
-rw-r--r--data/lib/bugzillaDOMFunctions.js25
-rw-r--r--data/lib/util.js1
2 files changed, 20 insertions, 6 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.
*