-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
DEPENDANT ON BUG #1
Refactor font addons, so they have identical code with different configuration files and/or font files.
Suggestion form AMO reviewers:
The easiest thing to do, I think, would be to have a JSON configuration file like the following:
{
fonts: [
"Tharlon-Regular.ttf"
]
}And then load it with something like the following:
const XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1");
var baseURI = Services.io.newURI(__SCRIPT_URI_SPEC__.replace(/boostrap\.js$/, ""), null, null)
var xhr = XMLHttpRequest();
xhr.open("GET", baseURI.spec + "config.json", false);
xhr.send();
var config = JSON.parse(XHR.responseText);
for (let font of config.fonts) {
let file = Services.io.newURI("defaults/" + font, null, baseURI)
.QueryInterface(Ci.nsIFileURL).file;
file.copyTo(fontdir, file.leafName);
}And so forth.
Reactions are currently unavailable