X-Git-Url: https://git.donarmstrong.com/?p=dactyl.git;a=blobdiff_plain;f=common%2Fmodules%2Fprefs.jsm;h=b0fdd176d6c80352de3b6722e6a95ca1515cc157;hp=3f865b61b959c901cd7dff5a3d41319e5e254b14;hb=8b6fcae7eaa413bc62d645d2d0c99835c47265e6;hpb=5ebd29f56d17f62011cdd596b1d351947ee534ff diff --git a/common/modules/prefs.jsm b/common/modules/prefs.jsm index 3f865b6..b0fdd17 100644 --- a/common/modules/prefs.jsm +++ b/common/modules/prefs.jsm @@ -1,20 +1,20 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. -/* use strict */ +"use strict"; try { -Components.utils.import("resource://dactyl/bootstrap.jsm"); defineModule("prefs", { exports: ["Prefs", "localPrefs", "prefs"], require: ["services", "util"] -}, this); +}); -this.lazyRequire("messages", ["_"]); +lazyRequire("messages", ["_"]); +lazyRequire("template", ["template"]); var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), { ORIGINAL: "extensions.dactyl.original.", @@ -111,10 +111,11 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]) switch (type) { case Ci.nsIPrefBranch.PREF_STRING: let value = this.branch.getComplexValue(name, Ci.nsISupportsString).data; - // try in case it's a localized string (will throw an exception if not) - if (!this.branch.prefIsLocked(name) && !this.branch.prefHasUserValue(name) && - RegExp("chrome://.+/locale/.+\\.properties").test(value)) - value = this.branch.getComplexValue(name, Ci.nsIPrefLocalizedString).data; + try { + if (/^[a-z0-9-]+:/i.test(value)) + value = this.branch.getComplexValue(name, Ci.nsIPrefLocalizedString).data; + } + catch (e) {} return value; case Ci.nsIPrefBranch.PREF_INT: return this.branch.getIntPref(name); @@ -404,7 +405,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]) let option = { isDefault: !userValue, default: this.defaults.get(pref, null), - value: <>={template.highlight(value, true, 100)}, + value: ["", "=", template.highlight(value, true, 100)], name: pref, pre: "\u00a0\u00a0" // Unicode nonbreaking space. };