diff options
Diffstat (limited to 'data/lib')
-rw-r--r-- | data/lib/bugzillaDOMFunctions.js | 20 | ||||
-rw-r--r-- | data/lib/bzpage.js | 2 | ||||
-rw-r--r-- | data/lib/util.js | 25 |
3 files changed, 46 insertions, 1 deletions
diff --git a/data/lib/bugzillaDOMFunctions.js b/data/lib/bugzillaDOMFunctions.js index 8f74288..49afef5 100644 --- a/data/lib/bugzillaDOMFunctions.js +++ b/data/lib/bugzillaDOMFunctions.js @@ -456,3 +456,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; +}; diff --git a/data/lib/bzpage.js b/data/lib/bzpage.js index c1898eb..1be287d 100644 --- a/data/lib/bzpage.js +++ b/data/lib/bzpage.js @@ -364,6 +364,8 @@ function completeInit() { RHBZinit(attachments); } + console.log("completeInit: tweakBugzilla = " + typeof tweakBugzilla); + console.log("completeInit: config = " + config.toSource()); if (tweakBugzilla && config.verboseInlineHistory) { tweakBugzilla(attachments, constantData); } diff --git a/data/lib/util.js b/data/lib/util.js index 02cda2d..f30ddd5 100644 --- a/data/lib/util.js +++ b/data/lib/util.js @@ -68,7 +68,7 @@ function parseXMLfromString (inStuff) { * Get a bug no */ function getBugNo() { - var bugNoElem = document.forms.namedItem('changeform').getElementsByName("id")[0]; + var bugNoElem = document.forms.namedItem("changeform").elements["id"]; if (bugNoElem) { return bugNoElem.value; } else { @@ -214,6 +214,29 @@ function getISODate(dateStr) { } /** + * format Date object as ISO-8601 formatted date string + * + * @param d Date + * @return String with date formatted + * @url https://developer.mozilla.org/en/JavaScript/Reference\ + /Global_Objects/Date#Example.3a_ISO_8601_formatted_dates + * outputs something like 2009-09-28T19:03:12Z + */ +function ISODateString(d) { + function pad(n) { + return n<10 ? '0'+n : n + } + + return d.getUTCFullYear()+'-' + + pad(d.getUTCMonth()+1)+'-' + + pad(d.getUTCDate())+'T' + + pad(d.getUTCHours())+':' + + pad(d.getUTCMinutes())+':' + + pad(d.getUTCSeconds())+'Z'; +} + + +/** * Check whether an item is member of the list. Idea is just to make long if * commands slightly more readable. * |