diff options
-rw-r--r-- | HACKING | 30 | ||||
-rw-r--r-- | data/lib/bugzillaDOMFunctions.js | 2 | ||||
-rw-r--r-- | data/lib/bzpage.js | 11 | ||||
-rw-r--r-- | data/lib/skip-bug.js | 1 | ||||
-rw-r--r-- | data/tweaks/bug-page-mod.js | 2 | ||||
-rw-r--r-- | lib/libbugzilla.js | 2 | ||||
-rw-r--r-- | lib/main.js | 1 | ||||
-rw-r--r-- | lib/xmlrpc.js | 2 |
8 files changed, 14 insertions, 37 deletions
@@ -1,22 +1,10 @@ First attempt to create coding guidelines ----------------------------------------- -1) Generally formatting style should be roughly similar to Java style - (similar to K&R), so that function looks like this: +1) Generally formatting style should follow Mozilla JavaScript Style Guide + (https://developer.mozilla.org/en/JavaScript_style_guide). - function Foo (bar, baz) { - if (bar) { - console.log("bar!"); - return baz / 2; - } else { - console.log("no bar!"); - return baz * 2; - } - } - -2) Indentation is 4 spaces, no TABs - -3) Generally I would like to follow formatting and other advice by jslint +2) Generally I would like to follow formatting and other advice by jslint (http://www.jslint.com/). However, I don't want to be bound by sometimes eccentric opinions of Douglas Crockford, more I care about checking for missing semicolons, bad spacing, etc. However, in order to make @@ -27,7 +15,7 @@ First attempt to create coding guidelines It follows that let and other non-ECMAScript construcsts shouldn't be used or at least sparingly and only in the time of dire need. -4) Object literals should be used for pure data objects only. Instead of +3) Object literals should be used for pure data objects only. Instead of var Foo.prototype = { bar: function bar () { @@ -51,17 +39,15 @@ First attempt to create coding guidelines The latter is in my opinion more readable and works better in editors I use (gedit, scribes, and eclipse). -5) Use plain Javascript only. This is not multi-platform (meaning mult-browser) - script so no Javascript libraries (e.g., jQuery, Dojo, etc.) should be +4) Use plain JavaScript only. This is not multi-platform (meaning mult-browser) + script so no JavaScript libraries (e.g., jQuery, Dojo, etc.) should be used. On the other hand, we don't have to bound ourselves to compatibility - with anything else than platforms Jetpack runs on ... which is currently - (for -prototype) FF 3.5 and for Jetpack-SDK it will be probably even - higher when it is going to be actually released. So, instead of + with anything else than platforms Add-on SDK runs on. So, instead of hopeless non-standard constructs of jQuery, element.querySelector (with standard CSS3 selector, which is NOT the same as what's used in jQuery; see http://www.w3.org/TR/2009/PR-css3-selectors-20091215/) and other - advanced Javascript functions can be used. + advanced JavaScript functions can be used. Any other items could be added after discussion and when a need to decide some pressing issue happens. diff --git a/data/lib/bugzillaDOMFunctions.js b/data/lib/bugzillaDOMFunctions.js index be30a3e..ae4b01d 100644 --- a/data/lib/bugzillaDOMFunctions.js +++ b/data/lib/bugzillaDOMFunctions.js @@ -198,7 +198,7 @@ function createNewButton (location, after, cmdObj) { // protection against double-firings if (document.getElementById(newId)) { - console.log("Element with id " + newId + " already exists!"); + console.warning("Element with id " + newId + " already exists!"); return ; } diff --git a/data/lib/bzpage.js b/data/lib/bzpage.js index e44f3f4..9d83e15 100644 --- a/data/lib/bzpage.js +++ b/data/lib/bzpage.js @@ -337,7 +337,7 @@ function setConfigurationButton () { * */ function completeInit() { - // FIXME: add flags, and priority or others bits. + // TODO: add flags, and priority or others bits. var things = { attachments: new AttachList(document), comments: new CommentList(document) @@ -358,13 +358,13 @@ function completeInit() { function startup() { // First, preflight check ... if we are not logged in, there // is nothing we can do. - console.log("startup: Starting!"); + myDebug("startup: Starting!"); var logoutLink = Array.some(document.links, function (x) { return x.search === "?logout=1" ; }); if (logoutLink) { if (document.getElementById("brElementPlace_location")) { - console.error("Hit multiple firing protection!") + console.error("Hit multiple firing protection!"); return null; // This should just finish whole content script without // doing any harm to anybody. } @@ -396,11 +396,6 @@ function startup() { extBugsHeadline.setAttribute("id", "external_bugs_headline"); } - // TODO Probably could be ignored ... used only once on line 973 of - // rhbzpage.js - // if (parseAbrtBacktraces && this.RE.Abrt.test(getSummary())) { - // title = document.getElementById("short_desc_nonedit_display").textContent; - // So, now we know we are logged in, so we can get to // the real work. setConfigurationButton(); diff --git a/data/lib/skip-bug.js b/data/lib/skip-bug.js index 4b4cd34..5597b35 100644 --- a/data/lib/skip-bug.js +++ b/data/lib/skip-bug.js @@ -15,5 +15,4 @@ function reloadPage() { } } -console.log("asdasd"); reloadPage(); diff --git a/data/tweaks/bug-page-mod.js b/data/tweaks/bug-page-mod.js index d3551a3..d9a1719 100644 --- a/data/tweaks/bug-page-mod.js +++ b/data/tweaks/bug-page-mod.js @@ -271,7 +271,7 @@ function displayCommentActions (comment, historyItem) { } function processHistoryItem(objects, itemRaw) { - console.log("processHistoryItem: itemRaw = " + itemRaw.toSource()); + myDebug("processHistoryItem: itemRaw = " + itemRaw.toSource()); return ; // FIXME just to get rid of this unfinished and unanalyzed function diff --git a/lib/libbugzilla.js b/lib/libbugzilla.js index acb81e8..2829ecb 100644 --- a/lib/libbugzilla.js +++ b/lib/libbugzilla.js @@ -104,7 +104,7 @@ function getPassword(login, domain, callback) { url: domain, realm: BTSPassRealm, onComplete: function onComplete(credList) { - console.log("found credList = " + credList); + debug("found credList = " + credList); var credential = []; if (credList) { credential = credList[0]; diff --git a/lib/main.js b/lib/main.js index 18429c5..49cffd0 100644 --- a/lib/main.js +++ b/lib/main.js @@ -115,7 +115,6 @@ var contentScriptLibraries = [ ]; libbz.initialize(function(config) { - console.log("config.configData.bugPageMatch = " + config.configData.bugPageMatch); pageMod.PageMod({ include : config.configData.bugPageMatch, contentScriptWhen : 'ready', diff --git a/lib/xmlrpc.js b/lib/xmlrpc.js index c369e52..54dcd72 100644 --- a/lib/xmlrpc.js +++ b/lib/xmlrpc.js @@ -52,7 +52,6 @@ var leadingZero = exports.leadingZero = function leadingZero(n) { var dateToISO8601 = exports.dateToISO8601 = function dateToISO8601( date) { // wow I hate working with the Date object - console.log("date = " + date); var year = date.getYear(); var month = leadingZero(date.getMonth()); var day = leadingZero(date.getDate()); @@ -61,7 +60,6 @@ var dateToISO8601 = exports.dateToISO8601 = function dateToISO8601( + leadingZero(date.getSeconds()); var converted = year + month + day + "T" + time; - console.log("date = " + converted); return converted; }; |