mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 21:28:00 +01:00
Add toJSON method to lazy localized strings.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
|
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
|
||||||
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
|
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
|
||||||
// Copyright (c) 2008-2014 Kris Maglione <maglione.k@gmail.com>
|
// Copyright (c) 2008-2015 Kris Maglione <maglione.k@gmail.com>
|
||||||
//
|
//
|
||||||
// This work is licensed for reuse under an MIT license. Details are
|
// This work is licensed for reuse under an MIT license. Details are
|
||||||
// given in the LICENSE.txt file included with this file.
|
// given in the LICENSE.txt file included with this file.
|
||||||
@@ -545,7 +545,7 @@ var HintSession = Class("HintSession", CommandMode, {
|
|||||||
* hint disappears.
|
* hint disappears.
|
||||||
*/
|
*/
|
||||||
removeHints: function _removeHints(timeout) {
|
removeHints: function _removeHints(timeout) {
|
||||||
for (let { doc, start, end } of values(this.docs)) {
|
for (let { doc, start, end } of this.docs) {
|
||||||
DOM(doc.documentElement).highlight.remove("Hinting");
|
DOM(doc.documentElement).highlight.remove("Hinting");
|
||||||
// Goddamn stupid fucking Gecko 1.x security manager bullshit.
|
// Goddamn stupid fucking Gecko 1.x security manager bullshit.
|
||||||
try { delete doc.dactylLabels; } catch (e) { doc.dactylLabels = undefined; }
|
try { delete doc.dactylLabels; } catch (e) { doc.dactylLabels = undefined; }
|
||||||
@@ -590,7 +590,7 @@ var HintSession = Class("HintSession", CommandMode, {
|
|||||||
let activeHint = this.hintNumber || 1;
|
let activeHint = this.hintNumber || 1;
|
||||||
this.validHints = [];
|
this.validHints = [];
|
||||||
|
|
||||||
for (let { doc, start, end } of values(this.docs)) {
|
for (let { doc, start, end } of this.docs) {
|
||||||
DOM(doc.documentElement).highlight.add("Hinting");
|
DOM(doc.documentElement).highlight.add("Hinting");
|
||||||
let [offsetX, offsetY] = this.getContainerOffsets(doc);
|
let [offsetX, offsetY] = this.getContainerOffsets(doc);
|
||||||
|
|
||||||
@@ -649,7 +649,7 @@ var HintSession = Class("HintSession", CommandMode, {
|
|||||||
|
|
||||||
if (options["usermode"]) {
|
if (options["usermode"]) {
|
||||||
let css = [];
|
let css = [];
|
||||||
for (let hint of values(this.pageHints)) {
|
for (let hint of this.pageHints) {
|
||||||
let selector = highlight.selector("Hint") + "[number=" + JSON.stringify(hint.span.getAttribute("number")) + "]";
|
let selector = highlight.selector("Hint") + "[number=" + JSON.stringify(hint.span.getAttribute("number")) + "]";
|
||||||
let imgSpan = "[dactyl|hl=HintImage]";
|
let imgSpan = "[dactyl|hl=HintImage]";
|
||||||
css.push(selector + ":not(" + imgSpan + ") { " + hint.span.style.cssText + " }");
|
css.push(selector + ":not(" + imgSpan + ") { " + hint.span.style.cssText + " }");
|
||||||
@@ -699,7 +699,7 @@ var HintSession = Class("HintSession", CommandMode, {
|
|||||||
|
|
||||||
updateValidNumbers: function updateValidNumbers(always) {
|
updateValidNumbers: function updateValidNumbers(always) {
|
||||||
let string = this.getHintString(this.hintNumber);
|
let string = this.getHintString(this.hintNumber);
|
||||||
for (let hint of values(this.validHints))
|
for (let hint of this.validHints)
|
||||||
hint.valid = always || hint.span.getAttribute("number").startsWith(string);
|
hint.valid = always || hint.span.getAttribute("number").startsWith(string);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1111,7 +1111,7 @@ var Buffer = Module("Buffer", {
|
|||||||
|
|
||||||
// Ctrl-g single line output
|
// Ctrl-g single line output
|
||||||
if (!verbose) {
|
if (!verbose) {
|
||||||
let file = this.win.location.pathname.split("/").pop() || String(_("buffer.noName"));
|
let file = this.win.location.pathname.split("/").pop() || _("buffer.noName");
|
||||||
let title = this.win.document.title || _("buffer.noTitle");
|
let title = this.win.document.title || _("buffer.noTitle");
|
||||||
|
|
||||||
let info = template.map(
|
let info = template.map(
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ var Messages = Module("messages", {
|
|||||||
return self.get(message);
|
return self.get(message);
|
||||||
}),
|
}),
|
||||||
valueOf: function valueOf() this.message,
|
valueOf: function valueOf() this.message,
|
||||||
toString: function toString() this.message
|
toString: function toString() this.message,
|
||||||
|
toJSON: function toJSON() this.message
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user