diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-08-06 18:21:20 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-08-06 18:21:20 +0200 |
commit | a993b534d5666f861b595a426522f25326e0ff29 (patch) | |
tree | 99740553862133d168b195938d8b4ca3d0f9428e | |
parent | c35e897dab0541ff17120a242c4434b646993de9 (diff) | |
download | bugzilla-triage-a993b534d5666f861b595a426522f25326e0ff29.tar.gz |
Get back Next shortcut (I have no idea where it got lost).
Also made jslintable.
-rw-r--r-- | data/lib/jumpNextBug.js | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/data/lib/jumpNextBug.js b/data/lib/jumpNextBug.js index b777fe8..f21f76a 100644 --- a/data/lib/jumpNextBug.js +++ b/data/lib/jumpNextBug.js @@ -1,12 +1,13 @@ // Released under the MIT/X11 license // http://www.opensource.org/licenses/mit-license.php -"use strict"; +/*global isInList */ (function createRelationElements() { - var relation = {}; + "use strict"; + var relation = {}, key = null; var linkLabels = [ "First", "Last", "Prev", "Next" - ]; + ]; var labelToRelation = { "First" : { rel : "start" @@ -21,29 +22,32 @@ rel : "next" } }; + var nextRE = new RegExp("Next", "i"); function createLinkRel(rel, href) { var newLinkElement = document.createElement("link"); newLinkElement.setAttribute("rel", rel); newLinkElement.setAttribute("href", href); document.getElementsByTagName("head")[0] - .appendChild(newLinkElement); + .appendChild(newLinkElement); } var aNavigElements = document .querySelectorAll("#bugzilla-body .navigation a"); - Array.forEach(aNavigElements, function(elem) { + Array.forEach(aNavigElements, function (elem) { var labelText = elem.textContent.trim(); if (isInList(labelText, linkLabels)) { labelToRelation[labelText].href = elem - .getAttribute("href"); + .getAttribute("href"); + + if (nextRE.test(labelText)) { + elem.setAttribute("accesskey", "n"); + elem.innerHTML = "<u>N</u>ext"; + } } - ; }); - console.myDebug("labelToRelation = " - + labelToRelation.toSource()); - for ( var key in labelToRelation) { + for (key in labelToRelation) { if (labelToRelation.hasOwnProperty(key)) { relation = labelToRelation[key]; if (relation.href) { @@ -51,4 +55,4 @@ } } } -})(); +}()); |