aboutsummaryrefslogtreecommitdiffstats
path: root/data/lib
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-04-19 00:17:40 +0200
committerMatěj Cepl <mcepl@redhat.com>2011-06-05 14:45:52 +0200
commit3371681e2fd62add63543f6229d5339698460d28 (patch)
treed412799975d3080ecd12e1847d0aa7cd811ffe78 /data/lib
parentf13035316562baa2716344e75a0506328d8a8ef6 (diff)
downloadbugzilla-triage-3371681e2fd62add63543f6229d5339698460d28.tar.gz
Add a comment to follow key shortcut for Next bug.
Diffstat (limited to 'data/lib')
-rw-r--r--data/lib/jumpNextBug.js54
1 files changed, 12 insertions, 42 deletions
diff --git a/data/lib/jumpNextBug.js b/data/lib/jumpNextBug.js
index 2e097a3..348c776 100644
--- a/data/lib/jumpNextBug.js
+++ b/data/lib/jumpNextBug.js
@@ -2,46 +2,16 @@
// http://www.opensource.org/licenses/mit-license.php
"use strict";
-(function createRelationElements() {
- var relation = {};
- var linkLabels = ["First", "Last", "Prev", "Next"];
- var labelToRelation = {
- "First": {
- rel: "start"
- },
- "Last": {
- rel: "last"
- },
- "Prev": {
- rel: "prev"
- },
- "Next": {
- rel: "next"
- }
- };
+var nextElement = {};
+var nextRE = new RegExp("Next");
- function createLinkRel (rel, href) {
- var newLinkElement = document.createElement("link");
- newLinkElement.setAttribute("rel", rel);
- newLinkElement.setAttribute("href", href);
- document.getElementsByTagName("head")[0].
- appendChild(newLinkElement);
- }
-
- var aNavigElements = document.querySelectorAll("#bugzilla-body .navigation a");
- Array.forEach(aNavigElements, function(elem) {
- var labelText = elem.textContent.trim();
- if (isInList(labelText, linkLabels)) {
- labelToRelation[labelText].href = elem.getAttribute("href");
- };
- });
-
- for (var key in labelToRelation) {
- if (labelToRelation.hasOwnProperty(key)) {
- relation = labelToRelation[key];
- if (relation.href) {
- createLinkRel(relation.rel, relation.href);
- }
- }
- }
-})();
+var aNavigElements = document.querySelectorAll("#bugzilla-body .navigation a");
+var filteredElements = Array.filter(aNavigElements, function(elem) {
+ return nextRE.test(elem.textContent);
+});
+console.log("filteredElements.length = " + filteredElements.length);
+if (filteredElements.length > 0) {
+ nextElement = filteredElements[0];
+ nextElement.setAttribute("accesskey", "n");
+ nextElement.innerHTML = "<u>N</u>ext";
+}