From f90eac58576986f0b5bb568dbc394484e157949c Mon Sep 17 00:00:00 2001 From: jasplin Date: Fri, 30 Apr 2010 13:49:16 +0200 Subject: Improved link styling + prevent opening page in same window. --- src/bmweb/bmcomparatorsection.js | 13 +++++--- src/bmweb/indexsection.js | 68 +++++++++++++++++++++++++++++++++------- src/bmweb/style.css | 44 ++++++++++++++++++++++++++ 3 files changed, 109 insertions(+), 16 deletions(-) diff --git a/src/bmweb/bmcomparatorsection.js b/src/bmweb/bmcomparatorsection.js index 7877a02..daf556d 100644 --- a/src/bmweb/bmcomparatorsection.js +++ b/src/bmweb/bmcomparatorsection.js @@ -40,6 +40,8 @@ function updateShowLink() // Update link ... showLink = document.getElementById("bcShowLink"); showLink.setAttribute("href", url); + + showLink.setAttribute("target", "_blank"); // prevent page from opening in same window } function BMComparatorSection() @@ -134,11 +136,12 @@ function BMComparatorSection() section.appendChild(document.createElement("br")); // Create a link that opens a page that shows the comparison ... - showLink = section.appendChild(document.createElement("a")); - showLink.id = "bcShowLink"; - showLink.appendChild(document.createTextNode("Show")); - showLink.setAttribute("href", "dummy"); // for correct initial rendering - showLink.setAttribute("onmouseover", "updateShowLink()"); + link = section.appendChild(document.createElement("a")); + link.id = "bcShowLink"; + link.appendChild(document.createTextNode("Show")); + link.setAttribute("class", "bcLink"); + link.setAttribute("href", "dummy"); // for correct initial rendering + link.setAttribute("onmouseover", "updateShowLink()"); section.appendChild(document.createElement("br")); section.appendChild(document.createElement("br")); diff --git a/src/bmweb/indexsection.js b/src/bmweb/indexsection.js index 48c798a..c3fac25 100644 --- a/src/bmweb/indexsection.js +++ b/src/bmweb/indexsection.js @@ -21,7 +21,7 @@ ** ****************************************************************************/ -function updateEvalLink(defaultBaseTime, defaultMedianWinSize) +function updateComputeIndexLink(defaultBaseTime, defaultMedianWinSize) { // Initialize URL ... url = "http://" + location.host + "/cgi-bin/bmclientwrapper"; @@ -70,8 +70,22 @@ function updateEvalLink(defaultBaseTime, defaultMedianWinSize) url += createFilterOptionsString("-branch", getCheckedFilterValues("ixBranchFilter")); // Update link ... - evalLink = document.getElementById("ixEvalLink"); - evalLink.setAttribute("href", url); + link = document.getElementById("ixComputeIndexLink"); + link.setAttribute("href", url); + + link.setAttribute("target", "_blank"); // prevent page from opening in same window +} + +function updateComputeStatsLink(defaultBaseTime, defaultMedianWinSize) +{ + // Initialize URL ... + url = "dummy"; // 4 NOW! + + // Update link ... + link = document.getElementById("ixComputeStatsLink"); + link.setAttribute("href", url); + + link.setAttribute("target", "_blank"); // prevent page from opening in same window } function IndexSection() @@ -518,15 +532,47 @@ function IndexSection() section.appendChild(document.createElement("br")); section.appendChild(document.createElement("br")); - // Create a link that opens a page that presents the result of evaluating the index - // over time ... - evalLink = section.appendChild(document.createElement("a")); - evalLink.id = "ixEvalLink"; - evalLink.appendChild(document.createTextNode("Evaluate")); - evalLink.setAttribute("href", "dummy"); // for correct initial rendering - evalLink.setAttribute( + + // Create 'links' section ... + table = section.appendChild(document.createElement("table")); + table.setAttribute("style", "border:0px; padding:0px"); + tr = table.insertRow(0); + td = tr.insertCell(0); + td.setAttribute("style", "border:0px; padding:0px"); + linksFieldset = td.appendChild(document.createElement("fieldset")); + linksFieldset.setAttribute("style", "border:0px; padding:2px"); + + table = linksFieldset.appendChild(document.createElement("table")); + table.setAttribute("style", "border:0px; padding:0px"); + tr = table.insertRow(0); + + // ... 'compute index' link ... + td = tr.insertCell(tr.cells.length); + td.setAttribute("style", "border:0px; padding:2px"); + link = td.appendChild(document.createElement("a")); + link.id = "ixComputeIndexLink"; + link.appendChild(document.createTextNode("Compute Index")); + link.setAttribute("class", "ixLink_index"); + link.setAttribute("href", "dummy"); // for correct initial rendering + link.setAttribute( + "onmouseover", + "updateComputeIndexLink(" + + defaultBaseTime + + ", " + defaultMedianWinSize + + ")" + ); + + // ... 'compute stats' link ... + td = tr.insertCell(tr.cells.length); + td.setAttribute("style", "border:0px; padding:2px"); + link = td.appendChild(document.createElement("a")); + link.id = "ixComputeStatsLink"; + link.appendChild(document.createTextNode("Compute Stats")); + link.setAttribute("class", "ixLink_stats"); + link.setAttribute("href", "dummy"); // for correct initial rendering + link.setAttribute( "onmouseover", - "updateEvalLink(" + "updateComputeStatsLink(" + defaultBaseTime + ", " + defaultMedianWinSize + ")" diff --git a/src/bmweb/style.css b/src/bmweb/style.css index ccfd824..cda1891 100644 --- a/src/bmweb/style.css +++ b/src/bmweb/style.css @@ -86,3 +86,47 @@ td { vertical-align:top; padding:5px; font-size:11 } .count_cell { font-weight:normal; font-size:12px; text-align:right } +a.ixLink_index:link, a.ixLink_index:visited { + display:block; + font-weight:bold; + font-size:12px; + color:#ffffff; + background-color:#8f8f8f; + width:120px; + text-align:center; + padding:4px; + text-decoration:none; +} +a.ixLink_index:hover, a.ixLink_index:active { + background-color:#696969; +} + +a.ixLink_stats:link, a.ixLink_stats:visited { + display:block; + font-weight:bold; + font-size:12px; + color:#ffffff; + background-color:#c97f47; + width:120px; + text-align:center; + padding:4px; + text-decoration:none; +} +a.ixLink_stats:hover, a.ixLink_stats:active { + background-color:#a26739; +} + +a.bcLink:link, a.bcLink:visited { + display:block; + font-weight:bold; + font-size:12px; + color:#ffffff; + background-color:#8f8f8f; + width:120px; + text-align:center; + padding:4px; + text-decoration:none; +} +a.bcLink:hover, a.bcLink:active { + background-color:#696969; +} -- cgit v1.2.3