diff options
author | Matěj Cepl <mcepl@redhat.com> | 2010-06-18 00:51:50 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2010-06-18 00:51:50 +0200 |
commit | cb3869dce7f2cb179240ac6e0653cbfd94e4d0e8 (patch) | |
tree | 414a344f606971652336b83c19b53a51b6c50642 /lib/logger.js | |
parent | a22c903e5e641fb6ed0efb03acae12fa90d86d04 (diff) | |
download | bugzilla-triage-cb3869dce7f2cb179240ac6e0653cbfd94e4d0e8.tar.gz |
Write HACKING document with coding guidelines and actually fix the
code to follow it.
Diffstat (limited to 'lib/logger.js')
-rw-r--r-- | lib/logger.js | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/logger.js b/lib/logger.js index b817056..ad7f4e9 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -14,21 +14,21 @@ var Logger = exports.Logger = function Logger(store, abbsMap) { }; Logger.prototype.addLogRecord = function(that) { - let rec = {}; + var rec = {}; rec.date = new Date(); rec.url = that.doc.location.toString(); rec.title = that.title; - let comment = jetpack.tabs.focused.contentWindow.prompt( + var comment = jetpack.tabs.focused.contentWindow.prompt( "Enter comments for this comment"); if (comment && comment.length > 0) { comment = comment.trim(); rec.comment = comment; - let recKey = utilMod.getISODate(rec.date) + "+" + var recKey = utilMod.getISODate(rec.date) + "+" + urlMod.parse(rec.url).host + "+" + that.bugNo; console.log("rec = " + rec.toSource()); - let clearLogAElem = that.doc.getElementById("clearLogs"); + var clearLogAElem = that.doc.getElementById("clearLogs"); if (clearLogAElem.style.color != this.FullLogsColor) { clearLogAElem.style.color = this.FullLogsColor; clearLogAElem.style.fontWeight = "bolder"; @@ -51,12 +51,12 @@ Logger.prototype.getBugzillaAbbr = function(url) { } Logger.prototype.timeSheetRecordsPrinter = function(body, records) { - let that = this; - let commentBugRE = new RegExp("[bB]ug\\s+([0-9]+)","g"); + var that = this; + var commentBugRE = new RegExp("[bB]ug\\s+([0-9]+)","g"); // sort the records into temporary array - let tmpArr = []; + var tmpArr = []; - for ( let i in records) { + for ( var i in records) { if (records.hasOwnProperty(i)) { tmpArr.push( [ i, records[i] ]); } @@ -65,21 +65,21 @@ Logger.prototype.timeSheetRecordsPrinter = function(body, records) { return a[0] > b[0] ? 1 : -1; }); - let currentDay = ""; + var currentDay = ""; // now print the array tmpArr.forEach(function(rec) { - let x = rec[1]; - let dayStr = utilMod.getISODate(x.date); - let host = urlMod.parse(x.url).host; - let BZName = that.getBugzillaAbbr(x.url); - let bugNo = utilMod.getBugNo(x.url); + var x = rec[1]; + var dayStr = utilMod.getISODate(x.date); + var host = urlMod.parse(x.url).host; + var BZName = that.getBugzillaAbbr(x.url); + var bugNo = utilMod.getBugNo(x.url); if (dayStr != currentDay) { currentDay = dayStr; body.innerHTML += "<hr/><p><strong>" + currentDay + "</strong></p>"; } // replace "bug ####" with a hyperlink to the current bugzilla - let comment = x.comment.replace(commentBugRE, + var comment = x.comment.replace(commentBugRE, "<a href='http://"+host+"/show_bug.cgi?id=$1'>$&</a>"); body.innerHTML += "<p><em><a href='" + x.url @@ -95,12 +95,12 @@ Logger.prototype.timeSheetRecordsPrinter = function(body, records) { * */ Logger.prototype.createBlankPage = function (ttl, bodyBuildCB) { - let title = ttl || "Yet another untitled page"; - let that = this; + var title = ttl || "Yet another untitled page"; + var that = this; - let logTab = jetpack.tabs.open("about:blank"); + var logTab = jetpack.tabs.open("about:blank"); jetpack.tabs.onReady(function() { - let otherDoc = logTab.contentDocument; + var otherDoc = logTab.contentDocument; otherDoc.title = title; otherDoc.body.innerHTML = "<h1>" + title + "</h1>"; bodyBuildCB.call(that, otherDoc.body); @@ -109,6 +109,6 @@ Logger.prototype.createBlankPage = function (ttl, bodyBuildCB) { }; Logger.prototype.generateTimeSheet = function(body) { - let doc = body.ownerDocument; + var doc = body.ownerDocument; this.timeSheetRecordsPrinter(body, this.store); }; |