From ac624dcd4a88ad635c696b5fcda0f628e277f6b8 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Sun, 15 Nov 2009 23:40:43 +0100 Subject: * Query for text is working, * Closing upstream is working * Get rid off swapXGLMainToCCListHandler * small cleanups --- bugzillaBugTriage.js | 61 +++++++++++++++++----------------------------------- 1 file changed, 20 insertions(+), 41 deletions(-) (limited to 'bugzillaBugTriage.js') diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js index ce6bb51..210d41c 100644 --- a/bugzillaBugTriage.js +++ b/bugzillaBugTriage.js @@ -4,13 +4,14 @@ jetpack.future.import("pageMods"); jetpack.future.import("storage.simple"); jetpack.future.import("selection"); +jetpack.future.import("clipboard"); var RHColor = "#9E292B"; var FedoraColor = "#002867"; var RawhideColor = "#007700"; // or "green" var RHITColor = "#660066"; var SalmonPink = "#FFE0B0"; -var ReporterColorHex = "#FFFFA6"; +var ReporterColor = "#FFFFA6"; var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi"; var myConfig = jetpack.storage.simple; var badMIMEArray = ["application/octet-stream","text/x-log"]; @@ -193,7 +194,7 @@ bzPage.prototype.hasKeyword = function (str) { /* Bugzilla functions.*/ /** - * Set background color of all comments made by reporter in ReporterColorHex color + * Set background color of all comments made by reporter in ReporterColor color * */ bzPage.prototype.checkComments = function () { @@ -201,7 +202,7 @@ bzPage.prototype.checkComments = function () { $("#comments .bz_comment", this.doc).each(function (i) { var email = $(".vcard a", this).text(); if (new RegExp(reporter).test(email)) { - $(this).css("background-color", ReporterColorHex); + $(this).css("background-color", ReporterColor); } }); }; @@ -469,23 +470,21 @@ bzPage.prototype.queryInNewTab = function(text,component,product) { url += "&long_desc_type=substring&long_desc="+ text.replace(" ","%20"); } console.log("queryInNewTab: url = " + url); - jetpack.tabs.contentWindow.open(url); + jetpack.tabs.open(url); } /** + * Get the text to search for and prepare other things for the real executive + * function this.queryInNewTab, and run it. */ bzPage.prototype.queryForSelection = function() { -// var text = $.trim(jetpack.tabs.current.contentWindow.getSelection().toString); -// var text = $.trim(jetpack.selection.text); - var text=""; -// if (text.length < 1) { -// console.log("current clipbpard flavors = " + -// jetpack.clipboard.getCurrentFlavors()); -// text = jetpack.clipboard.get(); -// }; -// if (text.length > 0) { -// queryInNewTab(text, this.component); -// } + var text = $.trim(jetpack.selection.text); + if (text.length < 1) { + text = jetpack.clipboard.get(); + }; + if (text.length > 0) { + this.queryInNewTab(text, this.component); + } } /** @@ -685,32 +684,11 @@ bzPage.prototype.addClosingUpstream = function() { } } -/** - * Currently we don't use this function - * @param evt event send from DOM (not used) - * @return none - */ -bzPage.prototype.swapXGLMainToCCListHandler = function(evt) { - /** Remove mcepl@redhat.com from CC list and put there - * xgl-maint@redhat.com - */ - - myAddrIndex = CCList.indexOf(login); - if (!isInList(this.maintCCAddr, CCList)) { - $("#newcc",this.doc).text(this.maintCCAddr); - } - if (isInList(login, CCList)) { - var selBox = $("#cc").get(); - selBox[myAddrIndex].selected = true; - $("#removecc").attr("checked","checked"); - } - evt.stopPropagation(); - evt.preventDefault(); -} - -/** Insert row of buttons before the marked element +/** Insert a row of buttons before the marked element + * * @param anchor element before which the row of buttons will be inserted * @param array array of data for buttons to be generated + * @return none */ bzPage.prototype.generateToolBar = function(anchor,array) { for (var i=0; i