diff --git a/chrome/content/pref.js b/chrome/content/pref.js index ba5e842..5620227 100644 --- a/chrome/content/pref.js +++ b/chrome/content/pref.js @@ -1,5 +1,63 @@ // This needs: chrome://global/content/nsUserSettings.js +// compat taken from http://qiita.com/sayamada/items/d6d26a3c2e9613854019 +var nsPreferences = { + orgPrefs: Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefService) + .getBranch(""), + copyUnicharPref: function(key, defaultVal) { + if (defaultVal === undefined) { + defaultVal = ""; + } + var val = undefined; + try { + val = this.orgPrefs.getComplexValue(key, Components.interfaces.nsISupportsString).data; + } catch (e) { + console.log(e); + } + if (val !== undefined && val !== "") { + return val; + } else { + return defaultVal; + } + }, + setUnicharPref: function(key, val) { + var str = Components.classes["@mozilla.org/supports-string;1"] + .createInstance(Components.interfaces.nsISupportsString); + str.data = val; + this.orgPrefs.setComplexValue(key, Components.interfaces.nsISupportsString, str); + }, + getBoolPref: function(key, defaultVal) { + try { + var tmpVal = this.orgPrefs.getBoolPref(key); + if (tmpVal || tmpVal === "true") { + return true; + } else { + return false; + } + } catch (e) { + return defaultVal; + } + }, + setBoolPref: function(key, val) { + if (val || val === "true") { + this.orgPrefs.setBoolPref(key, true); + } else { + this.orgPrefs.setBoolPref(key, false); + } + }, + getIntPref: function(key, defaultVal) { + try { + return this.orgPrefs.getIntPref(key); + } catch (e) { + return defaultVal; + } + }, + setIntPref: function(key, val) { + this.orgPrefs.setIntPref(key, val); + } +}; + //----------------------------------------------------------------------------- var strbundle; function getLocaleString(aName) diff --git a/install.rdf b/install.rdf index d357c1d..86b0d16 100644 --- a/install.rdf +++ b/install.rdf @@ -6,20 +6,19 @@ {11d1a081-b8c3-4002-af38-6ad3e899fdfa} - External Editor + External Editor with TB52 compatibility 2 - 1.0.0 + 1.0.1-unofficial Alexandre Feblot - http://globs.org/ - https://harris.hostingzoom.com/~b2v/alex/update.rdf + http://github.com/snipsnipsnip/exteditor/releases/ chrome://exteditor/content/exteditor.png {3550f703-e582-4d05-9a08-453d09bdfdc6} - 3.1 - 9.0.* + 52 + 52