1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 15:48:00 +01:00

Play with semi-transparent hints.

This commit is contained in:
Kris Maglione
2011-01-05 17:31:04 -05:00
parent f289de2887
commit 663a398112
2 changed files with 23 additions and 18 deletions

View File

@@ -364,13 +364,17 @@ var Hints = Module("hints", {
* @param {number} oldId The currently active hint. * @param {number} oldId The currently active hint.
*/ */
_showActiveHint: function _showActiveHint(newId, oldId) { _showActiveHint: function _showActiveHint(newId, oldId) {
let oldElem = this._validHints[oldId - 1]; let oldHint = this._validHints[oldId - 1];
if (oldElem) if (oldHint) {
this._setClass(oldElem, false); this._setClass(oldHint.elem, false);
oldHint.span.removeAttribute("active");
}
let newElem = this._validHints[newId - 1]; let newHint = this._validHints[newId - 1];
if (newElem) if (newHint) {
this._setClass(newElem, true); this._setClass(newHint.elem, true);
newHint.span.setAttribute("active", "true");
}
}, },
/** /**
@@ -453,7 +457,7 @@ var Hints = Module("hints", {
hint.imgSpan.setAttribute("number", str); hint.imgSpan.setAttribute("number", str);
else else
this._setClass(hint.elem, activeHint == hintnum); this._setClass(hint.elem, activeHint == hintnum);
this._validHints.push(hint.elem); this._validHints.push(hint);
hintnum++; hintnum++;
} }
} }
@@ -518,9 +522,9 @@ var Hints = Module("hints", {
} }
if (!followFirst) { if (!followFirst) {
let firstHref = this._validHints[0].getAttribute("href") || null; let firstHref = this._validHints[0].elem.getAttribute("href") || null;
if (firstHref) { if (firstHref) {
if (this._validHints.some(function (e) e.getAttribute("href") != firstHref)) if (this._validHints.some(function (h) h.elem.getAttribute("href") != firstHref))
return; return;
} }
else if (this._validHints.length > 1) else if (this._validHints.length > 1)
@@ -529,7 +533,7 @@ var Hints = Module("hints", {
let timeout = followFirst || events.feedingKeys ? 0 : 500; let timeout = followFirst || events.feedingKeys ? 0 : 500;
let activeIndex = (this._hintNumber ? this._hintNumber - 1 : 0); let activeIndex = (this._hintNumber ? this._hintNumber - 1 : 0);
let elem = this._validHints[activeIndex]; let elem = this._validHints[activeIndex].elem;
let top = this._top; let top = this._top;
if (this._continue) if (this._continue)
@@ -539,8 +543,8 @@ var Hints = Module("hints", {
let n = 5; let n = 5;
(function next() { (function next() {
let hinted = n || this._validHints.some(function (e) e === elem); let hinted = n || this._validHints.some(function (h) h.elem === elem);
this._setClass(elem, n ? n % 2 : !hinted ? null : this._validHints[Math.max(0, this._hintNumber-1)] === elem); this._setClass(elem, n ? n % 2 : !hinted ? null : this._validHints[Math.max(0, this._hintNumber-1)].elem === elem);
if (n--) if (n--)
this.timeout(next, 50); this.timeout(next, 50);
}).call(this); }).call(this);

View File

@@ -429,14 +429,15 @@ var ConfigBase = Class("ConfigBase", {
Hint;;* { Hint;;* {
font: bold 10px "Droid Sans Mono", monospace !important; font: bold 10px "Droid Sans Mono", monospace !important;
padding: 0 1px; padding: 0 1px;
border: 1px solid black; border: 1px solid rgba(0, 0, 0, .5);
background: #fff8e7; background: rgba(255, 248, 231, .8);
color: black; color: black;
} }
Hint::after;;* content: attr(text) !important; Hint[active];;* background: rgba(255, 253, 208, .8);
HintElem;;* background-color: yellow !important; color: black !important; Hint::after;;* content: attr(text) !important;
HintActive;;* background-color: #88FF00 !important; color: black !important; HintElem;;* background-color: yellow !important; color: black !important;
HintImage;;* opacity: .5 !important; HintActive;;* background-color: #88FF00 !important; color: black !important;
HintImage;;* opacity: .5 !important;
// </css> // </css>
]]></>, /&#x0d;/g, "\n")), ]]></>, /&#x0d;/g, "\n")),