diff options
Diffstat (limited to 'data/tweaks')
-rw-r--r-- | data/tweaks/addNewLinks.js | 54 | ||||
-rw-r--r-- | data/tweaks/bug-page-mod.js | 167 | ||||
-rw-r--r-- | data/tweaks/viewSource.js | 19 |
3 files changed, 82 insertions, 158 deletions
diff --git a/data/tweaks/addNewLinks.js b/data/tweaks/addNewLinks.js index 05d5ffb..5434b57 100644 --- a/data/tweaks/addNewLinks.js +++ b/data/tweaks/addNewLinks.js @@ -1,47 +1,47 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 +/******************************************************************************* + * ***** BEGIN LICENSE BLOCK Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ + * 1.1 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. * * The Original Code is Bugzilla Tweaks. * - * The Initial Developer of the Original Code is Mozilla Foundation. - * Portions created by the Initial Developer are Copyright (C) 2010 - * the Initial Developer. All Rights Reserved. + * The Initial Developer of the Original Code is Mozilla Foundation. Portions + * created by the Initial Developer are Copyright (C) 2010 the Initial + * Developer. All Rights Reserved. * - * Contributor(s): - * Johnathan Nightingale <johnath@mozilla.com> - * Ehsan Akhgari <ehsan@mozilla.com> + * Contributor(s): Johnathan Nightingale <johnath@mozilla.com> Ehsan Akhgari + * <ehsan@mozilla.com> * * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. + * either the GNU General Public License Version 2 or later (the "GPL"), or the + * GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which + * case the provisions of the GPL or the LGPL are applicable instead of those + * above. If you wish to allow use of your version of this file only under the + * terms of either the GPL or the LGPL, and not to allow others to use your + * version of this file under the terms of the MPL, indicate your decision by + * deleting the provisions above and replace them with the notice and other + * provisions required by the GPL or the LGPL. If you do not delete the + * provisions above, a recipient may use your version of this file under the + * terms of any one of the MPL, the GPL or the LGPL. * - * ***** END LICENSE BLOCK ***** */ + * ***** END LICENSE BLOCK ***** + */ function addNewLinks() { var product = document .querySelector("#field_container_product option[selected]"); - var component = document.querySelector("#component option[selected]"); + var component = document + .querySelector("#component option[selected]"); if (product) { - var label = document.getElementById('field_container_product'); + var label = document + .getElementById('field_container_product'); var url = 'enter_bug.cgi?product=' + encodeURIComponent(product.value); if (label) { diff --git a/data/tweaks/bug-page-mod.js b/data/tweaks/bug-page-mod.js index 3d5ee9b..0e3d431 100644 --- a/data/tweaks/bug-page-mod.js +++ b/data/tweaks/bug-page-mod.js @@ -53,7 +53,9 @@ function TweakOnMessageHandler(msg, nextHandler) { /** * generate XML-RPC call to collect complete history of the bug - * @param XMLRPCURL URL of the XML-RPC gateway on the particular bugzilla + * + * @param XMLRPCURL + * URL of the XML-RPC gateway on the particular bugzilla * @returns nothing * * As part of the message is name of the signal "returnedHistory" @@ -172,116 +174,36 @@ function tweakBugzilla(atts, cData) { // =================================================== function processHistory(history) { // FIXME Remove remaining code to special function ... callback -// preprocessDuplicateMarkers(document, iframe.contentDocument); - -/* -This is an example of the history we get: -{ - "version": "1.1", - "result": { - "bugs": [ - { - "history": [ - { - "when": "2011-04-04T00:19:04Z", - "who": "cebbert@redhat.com", - "changes": [ - { - "removed": "", - "added": "xgl-maint@redhat.com", - "field_name": "cc", - "field": "CC" - }, - { - "removed": "kernel", - "added": "xorg-x11-drv-ati", - "field_name": "component", - "field": "Component" - }, - { - "removed": "kernel-maint@redhat.com", - "added": "xgl-maint@redhat.com", - "field_name": "assigned_to", - "field": "AssignedTo" - } - ] - }, - { - "when": "2011-04-12T22:48:22Z", - "who": "mcepl@redhat.com", - "changes": [ - { - "attachment_id": 488889, - "removed": "application/octet-stream", - "added": "text/plain", - "field_name": "attachments.mimetype", - "field": "Attachment mime type" - } - ] - }, - { - "when": "2011-04-13T17:07:04Z", - "who": "mcepl@redhat.com", - "changes": [ - { - "removed": "", - "added": "needinfo?(suckfish@ihug.co.nz)", - "field_name": "flagtypes.name", - "field": "Flags" - } - ] - }, - { - "when": "2011-04-21T12:17:33Z", - "who": "mcepl@redhat.com", - "changes": [ - { - "removed": "xgl-maint@redhat.com", - "added": "jglisse@redhat.com", - "field_name": "assigned_to", - "field": "AssignedTo" - } - ] - }, - { - "when": "2011-04-28T22:53:58Z", - "who": "mcepl@redhat.com", - "changes": [ - { - "attachment_id": 488889, - "removed": "text/plain", - "added": "application/octet-stream", - "field_name": "attachments.mimetype", - "field": "Attachment mime type" - } - ] - }, - { - "when": "2011-04-28T22:59:18Z", - "who": "mcepl@redhat.com", - "changes": [ - { - "attachment_id": 488889, - "removed": "application/octet-stream", - "added": "text/plain", - "field_name": "attachments.mimetype", - "field": "Attachment mime type" - } - ] - } - ], - "id": 692250, - "alias": [ - - ] - } - ], - "faults": [ - - ] - } -} - */ +// preprocessDuplicateMarkers(document, iframe.contentDocument); + + /* + * This is an example of the history we get: { "version": "1.1", "result": { + * "bugs": [ { "history": [ { "when": "2011-04-04T00:19:04Z", "who": + * "cebbert@redhat.com", "changes": [ { "removed": "", "added": + * "xgl-maint@redhat.com", "field_name": "cc", "field": "CC" }, { "removed": + * "kernel", "added": "xorg-x11-drv-ati", "field_name": "component", "field": + * "Component" }, { "removed": "kernel-maint@redhat.com", "added": + * "xgl-maint@redhat.com", "field_name": "assigned_to", "field": "AssignedTo" } ] }, { + * "when": "2011-04-12T22:48:22Z", "who": "mcepl@redhat.com", "changes": [ { + * "attachment_id": 488889, "removed": "application/octet-stream", "added": + * "text/plain", "field_name": "attachments.mimetype", "field": "Attachment + * mime type" } ] }, { "when": "2011-04-13T17:07:04Z", "who": + * "mcepl@redhat.com", "changes": [ { "removed": "", "added": + * "needinfo?(suckfish@ihug.co.nz)", "field_name": "flagtypes.name", "field": + * "Flags" } ] }, { "when": "2011-04-21T12:17:33Z", "who": "mcepl@redhat.com", + * "changes": [ { "removed": "xgl-maint@redhat.com", "added": + * "jglisse@redhat.com", "field_name": "assigned_to", "field": "AssignedTo" } ] }, { + * "when": "2011-04-28T22:53:58Z", "who": "mcepl@redhat.com", "changes": [ { + * "attachment_id": 488889, "removed": "text/plain", "added": + * "application/octet-stream", "field_name": "attachments.mimetype", "field": + * "Attachment mime type" } ] }, { "when": "2011-04-28T22:59:18Z", "who": + * "mcepl@redhat.com", "changes": [ { "attachment_id": 488889, "removed": + * "application/octet-stream", "added": "text/plain", "field_name": + * "attachments.mimetype", "field": "Attachment mime type" } ] } ], "id": + * 692250, "alias": [ + * ] } ], "faults": [ + * ] } } + */ // UserNameCache var userNameCache = {}; @@ -299,12 +221,13 @@ This is an example of the history we get: } if (history) { -// console.log("processHistory: history = " + history.toSource()); +// console.log("processHistory: history = " + history.toSource()); return ; } -// var historyItems = iframe.contentDocument.querySelectorAll('#bugzilla-body tr'); -// var cmtTimes = document.querySelectorAll('.bz_comment_time'); +// var historyItems = iframe.contentDocument.querySelectorAll('#bugzilla-body +// tr'); +// var cmtTimes = document.querySelectorAll('.bz_comment_time'); // Sometimes the history will stack several changes together, // and we'll want to append the data from the Nth item to the @@ -312,19 +235,19 @@ This is an example of the history we get: var i=0, j=0, flagsFound; if (history) { Array.forEach(history, function (item) { - processHistoryItem(cmtTimes, item); + processHistoryItem(cmtTimes, item); }); } - + handleEmptyCollapsedBoxes(document); -// // Set the latest flag links if necessary -// for (var flagName in flagOccurrences) { -// flags[flagName].innerHTML = '<a href="#' + flagOccurrences[flagName] + '">' -// + flags[flagName].innerHTML + '</a>'; -// } +// // Set the latest flag links if necessary +// for (var flagName in flagOccurrences) { +// flags[flagName].innerHTML = '<a href="#' + flagOccurrences[flagName] + '">' +// + flags[flagName].innerHTML + '</a>'; +// } -// AttachmentFlagHandler.setupLinks(document); +// AttachmentFlagHandler.setupLinks(document); // END OF load event handler } diff --git a/data/tweaks/viewSource.js b/data/tweaks/viewSource.js index d2a9fd1..81e6735 100644 --- a/data/tweaks/viewSource.js +++ b/data/tweaks/viewSource.js @@ -38,9 +38,9 @@ var reAttachmentType = /,\s+([^ )]*)[;)]/; function viewAttachmentSource(attachments) { - attachments.forEach(function (att) { + attachments.forEach(function(att) { if (att.length < 1) { - return ; + return; } var typeName = att[2]; var elem = att[4]; @@ -56,14 +56,16 @@ function viewAttachmentSource(attachments) { // // https://bugzilla.mozilla.org/show_bug.cgi?id=369814#c5 has more // possible mime types for zips? - createDeadLink("viewSourceJAR_" + id, "JAR Contents", elem, - "jar:" + attachHref + "!/", [], "pipe", null, null); + createDeadLink("viewSourceJAR_" + id, "JAR Contents", + elem, "jar:" + attachHref + "!/", [], "pipe", null, + null); } else if (typeName == "application/zip" || typeName == "application/x-zip-compressed" || typeName == "application/x-xpinstall") { - createDeadLink("viewSourceZIP_" + id, "Static ZIP Contents", elem, - "jar:" + attachHref + "!/", [], "pipe", null, null); + createDeadLink("viewSourceZIP_" + id, + "Static ZIP Contents", elem, "jar:" + attachHref + + "!/", [], "pipe", null, null); } else if (typeName != "text/plain" && typeName != "patch" && // Other types that Gecko displays like text/plain @@ -77,8 +79,7 @@ function viewAttachmentSource(attachments) { typeName != "image/gif" && typeName != "image/png" && typeName != "image/jpeg") { createDeadLink("viewSourcePlain_" + id, "Source", elem, - "view-source:" + attachHref, [], "pipe", null, null); - } + "view-source:" + attachHref, [], "pipe", null, null); } - ) + }) } |