diff options
-rw-r--r-- | data/lib/rhbzpage.js | 75 | ||||
-rw-r--r-- | data/lib/util.js | 2 |
2 files changed, 33 insertions, 44 deletions
diff --git a/data/lib/rhbzpage.js b/data/lib/rhbzpage.js index 6b8ee9f..43d34c2 100644 --- a/data/lib/rhbzpage.js +++ b/data/lib/rhbzpage.js @@ -222,36 +222,7 @@ function addCheckXorgLogLink(attList) { * @return None * */ -function fillInWhiteBoard(PCIidArrObj) { - var outStr = ""; - var cardIDStr = ""; - var cardIDArr = []; - var cardName = ""; - var PCIid = (PCIidArrObj.id[0] + "," + PCIidArrObj.id[1]).toUpperCase(); - - console.myDebug("PCIidArrObj = " + PCIidArrObj.toSource()); - console.myDebug("PCIid = " + PCIid); - - // Nvidia driver provides good code in the - if (PCIidArrObj.id[0].toLowerCase() == "10de") { - // The following is wrong ... chipsetLine is String, not an array - console.myDebug("fillInWhiteBoard: chipsetLine = " + PCIidArrObj.chipsetLine); - cardName = PCIidArrObj.chipsetLine[2].replace(/\s*nvidia\s*/ig,""). - replace('"','','g'); - } - else { - try { - cardName = constantData.chipNames[PCIid][0]; - } catch (e if e instanceof TypeError) { - PCIid = PCIid.toLowerCase().replace(",",":"); - postMessage(new Message("SetClipboard", PCIid.toString())); - alert("PCI ID " + PCIid + " is not known!"); - return ; // early termination - } catch (e) { - throw e; - } - } - +function fillInWhiteBoard(cardName) { console.myDebug("fillInWhiteBoard: cardName = " + cardName); clickMouse("editme_action"); var titleElem = document.getElementById('short_desc'); @@ -278,9 +249,10 @@ function fillInChipMagic(XlogID) { */ function chipsetMagic (interestingLineArr) { // parse Xorg.0.log - var chipsetLine = ""; + var cardStr = ""; console.myDebug("interestingLineArr = " + interestingLineArr.toSource()); console.myDebug("interestingLineArr[1] = " + interestingLineArr[1]); + if (interestingLineArr.length >0) { var interestingArray = interestingLineArr[0]; if (interestingArray.length > 1) { @@ -288,19 +260,36 @@ function chipsetMagic (interestingLineArr) { // If we have Chipset line, we should parse it as well and // add to the button if (interestingLineArr.length > 1) { - chipsetLine = interestingLineArr[1]; - console.myDebug("chipsetLine = " + chipsetLine.toSource()); - } else { - chipsetLine = null; - console.myDebug("chipsetLine = " + chipsetLine); + var PCIid = (interestingPCIID[0] + "," + interestingPCIID[1]). + toUpperCase(); + // Nvidia driver provides good code in the Chipset line + if (interestingPCIID[0].toLowerCase() == "10de") { + cardStr = interestingLineArr[1][2]. + replace(/\s*nvidia\s*/ig,""). + replace('"','','g'); + } else { + try { + cardStr = constantData.chipNames[PCIid][0]; + } catch (e if e instanceof TypeError) { + PCIid = PCIid.toLowerCase().replace(",",":"); + cardStr = null; + alert("PCI ID " + PCIid + " is not known!"); + postMessage(new Message("SetClipboard", PCIid.toString())); + } catch (e) { + throw e; + } + } + } + else { + cardStr = null; + } + + if (cardStr) { + createNewButton("short_desc_nonedit_display", false, { + "name": "Fill In", + "chipMagic": cardStr, + }); } - createNewButton("short_desc_nonedit_display", false, { - "name": "Fill In", - "chipMagic": { - "id": interestingPCIID, - "chipsetLine": chipsetLine - }, - }); } } } diff --git a/data/lib/util.js b/data/lib/util.js index 5b628cf..b145d25 100644 --- a/data/lib/util.js +++ b/data/lib/util.js @@ -357,7 +357,7 @@ NotLoggedinException.prototype.toString = function () { }; // Are we debugging? -var debugFlag = false; +var debugFlag = true; console.myDebug = function myDebug(str) { if (debugFlag) { |