Update library
This commit is contained in:
parent
10817a04d0
commit
a13cbb754f
@ -42,7 +42,7 @@ if (typeof window == 'undefined' ||
|
||||
}
|
||||
|
||||
(function() {
|
||||
const currentRevision = 10;
|
||||
const currentRevision = 13;
|
||||
|
||||
if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {};
|
||||
|
||||
@ -103,24 +103,50 @@ if (typeof window == 'undefined' ||
|
||||
}
|
||||
},
|
||||
|
||||
getLocalizedPref : function(aPrefstring)
|
||||
{
|
||||
try {
|
||||
return this.getPref(aPrefstring, Ci.nsIPrefLocalizedString).data;
|
||||
} catch(e) {
|
||||
return this.getPref(aPrefstring);
|
||||
}
|
||||
},
|
||||
|
||||
getDefaultPref : function(aPrefstring, aInterface)
|
||||
{
|
||||
return this.getPref(aPrefstring, this.DefaultPrefs, aInterface);
|
||||
},
|
||||
|
||||
setPref : function(aPrefstring, aNewValue, aBranch)
|
||||
setPref : function(aPrefstring, aNewValue)
|
||||
{
|
||||
aBranch = aBranch || this.Prefs;
|
||||
var branch = this.Prefs;
|
||||
var interface = null;
|
||||
if (arguments.length > 2) {
|
||||
for (let i = 2; i < arguments.length; i++)
|
||||
{
|
||||
let arg = arguments[i];
|
||||
if (!arg)
|
||||
continue;
|
||||
if (arg instanceof Ci.nsIPrefBranch)
|
||||
branch = arg;
|
||||
else
|
||||
interface = arg;
|
||||
}
|
||||
}
|
||||
if (interface &&
|
||||
aNewValue instanceof Ci.nsISupports) {
|
||||
return branch.setComplexValue(aPrefstring, interface, aNewValue);
|
||||
}
|
||||
switch (typeof aNewValue)
|
||||
{
|
||||
case 'string':
|
||||
return aBranch.setCharPref(aPrefstring, unescape(encodeURIComponent(aNewValue)));
|
||||
return branch.setCharPref(aPrefstring, unescape(encodeURIComponent(aNewValue)));
|
||||
|
||||
case 'number':
|
||||
return aBranch.setIntPref(aPrefstring, parseInt(aNewValue));
|
||||
return branch.setIntPref(aPrefstring, parseInt(aNewValue));
|
||||
|
||||
default:
|
||||
return aBranch.setBoolPref(aPrefstring, !!aNewValue);
|
||||
return branch.setBoolPref(aPrefstring, !!aNewValue);
|
||||
}
|
||||
},
|
||||
|
||||
@ -145,7 +171,8 @@ if (typeof window == 'undefined' ||
|
||||
{
|
||||
var foundChildren = {};
|
||||
var possibleChildren = [];
|
||||
var actualChildren = this.getDescendant(aRoot, aBranch)
|
||||
var actualChildren = [];
|
||||
this.getDescendant(aRoot, aBranch)
|
||||
.forEach(function(aPrefstring) {
|
||||
var name = aPrefstring.replace(aRoot, '');
|
||||
if (name.charAt(0) == '.')
|
||||
|
Loading…
x
Reference in New Issue
Block a user