parent
2a613258e0
commit
f0e9c8bfba
3 changed files with 50 additions and 47 deletions
9
chrome/content/scaffold/ace/ace.html
Normal file
9
chrome/content/scaffold/ace/ace.html
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<script type="text/javascript" src="chrome://scaffold/content/ace/ace.js"></script>
|
||||||
|
<script type="text/javascript" src="chrome://scaffold/content/ace/mode-javascript.js"></script>
|
||||||
|
<script type="text/javascript" src="chrome://scaffold/content/aceWrapper.js"></script>
|
||||||
|
</head>
|
||||||
|
<body id="body"></body>
|
||||||
|
</html>
|
|
@ -190,7 +190,7 @@
|
||||||
</menupopup>
|
</menupopup>
|
||||||
</toolbarbutton>
|
</toolbarbutton>
|
||||||
</hbox>
|
</hbox>
|
||||||
<iframe src="data:text/html,%3C!DOCTYPE%20html%20PUBLIC%20%22-//W3C//DTD%20XHTML%201.1//EN%22%20%22http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd%22%3E%3Chtml%20xmlns=%22http://www.w3.org/1999/xhtml%22%3E%3Chead%3E%3Cscript%20type=%22text/javascript%22%20src=%22chrome://scaffold/content/ace/ace.js%22%3E%3C/script%3E%3Cscript%20type=%22text/javascript%22%20src=%22chrome://scaffold/content/ace/mode-javascript.js%22%3E%3C/script%3E%3Cscript%20type=%22text/javascript%22%20src=%22chrome://scaffold/content/aceWrapper.js%22%3E%3C/script%3E%3C/head%3E%3Cbody%20id=%22body%22%3E%3C/body%3E%3C/html%3E" id="editor-code" flex="1"/>
|
<iframe src="chrome://scaffold/content/ace/ace.html" id="editor-code" flex="1"/>
|
||||||
<hbox id="editor-external-box" align="center">
|
<hbox id="editor-external-box" align="center">
|
||||||
<checkbox id="checkbox-editor-external"/>
|
<checkbox id="checkbox-editor-external"/>
|
||||||
<label class="label-metadata" value="&scaffold.editor.external.label;" control="checkbox-editor-external"/>
|
<label class="label-metadata" value="&scaffold.editor.external.label;" control="checkbox-editor-external"/>
|
||||||
|
@ -198,10 +198,10 @@
|
||||||
</vbox>
|
</vbox>
|
||||||
</tabpanel>
|
</tabpanel>
|
||||||
<tabpanel flex="1" id="tabpanel-import">
|
<tabpanel flex="1" id="tabpanel-import">
|
||||||
<iframe src="data:text/html,%3C!DOCTYPE%20html%20PUBLIC%20%22-//W3C//DTD%20XHTML%201.1//EN%22%20%22http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd%22%3E%3Chtml%20xmlns=%22http://www.w3.org/1999/xhtml%22%3E%3Chead%3E%3Cscript%20type=%22text/javascript%22%20src=%22chrome://scaffold/content/ace/ace.js%22%3E%3C/script%3E%3Cscript%20type=%22text/javascript%22%20src=%22chrome://scaffold/content/ace/mode-javascript.js%22%3E%3C/script%3E%3Cscript%20type=%22text/javascript%22%20src=%22chrome://scaffold/content/aceWrapper.js%22%3E%3C/script%3E%3C/head%3E%3Cbody%20id=%22body%22%3E%3C/body%3E%3C/html%3E" id="editor-import" flex="1"/>
|
<iframe src="chrome://scaffold/content/ace/ace.html" id="editor-import" flex="1"/>
|
||||||
</tabpanel>
|
</tabpanel>
|
||||||
<tabpanel flex="1" id="tabpanel-tests">
|
<tabpanel flex="1" id="tabpanel-tests">
|
||||||
<iframe src="data:text/html,%3C!DOCTYPE%20html%20PUBLIC%20%22-//W3C//DTD%20XHTML%201.1//EN%22%20%22http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd%22%3E%3Chtml%20xmlns=%22http://www.w3.org/1999/xhtml%22%3E%3Chead%3E%3Cscript%20type=%22text/javascript%22%20src=%22chrome://scaffold/content/ace/ace.js%22%3E%3C/script%3E%3Cscript%20type=%22text/javascript%22%20src=%22chrome://scaffold/content/ace/mode-javascript.js%22%3E%3C/script%3E%3Cscript%20type=%22text/javascript%22%20src=%22chrome://scaffold/content/aceWrapper.js%22%3E%3C/script%3E%3C/head%3E%3Cbody%20id=%22body%22%3E%3C/body%3E%3C/html%3E" id="editor-tests" flex="1"/>
|
<iframe src="chrome://scaffold/content/ace/ace.html" id="editor-tests" flex="1"/>
|
||||||
</tabpanel>
|
</tabpanel>
|
||||||
<tabpanel flex="1" id="tabpanel-testing">
|
<tabpanel flex="1" id="tabpanel-testing">
|
||||||
<vbox flex="1"><hbox><description>&scaffold.testing.description;</description></hbox>
|
<vbox flex="1"><hbox><description>&scaffold.testing.description;</description></hbox>
|
||||||
|
|
|
@ -22,52 +22,46 @@ var Scaffold_Translators = {
|
||||||
var dir = this.getDirectory();
|
var dir = this.getDirectory();
|
||||||
var numLoaded = 0;
|
var numLoaded = 0;
|
||||||
var deletedTranslators = new Set(this._translatorFiles.keys());
|
var deletedTranslators = new Set(this._translatorFiles.keys());
|
||||||
await Zotero.File.iterateDirectory(dir, function* (iterator) {
|
await Zotero.File.iterateDirectory(dir, async function (entry) {
|
||||||
while (true) {
|
if (entry.isDir || entry.name.startsWith('.') || !entry.name.endsWith('.js')) {
|
||||||
let entries = yield iterator.nextBatch(50);
|
return;
|
||||||
if (!entries.length) break;
|
}
|
||||||
for (let entry of entries) {
|
|
||||||
if (entry.isDir || entry.name.startsWith('.') || !entry.name.endsWith('.js')) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
deletedTranslators.delete(entry.name);
|
deletedTranslators.delete(entry.name);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let fmtime;
|
let fmtime;
|
||||||
if ('winLastWriteDate' in entry) {
|
if ('winLastWriteDate' in entry) {
|
||||||
fmtime = entry.winLastWriteDate.getTime();
|
fmtime = entry.winLastWriteDate.getTime();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fmtime = (yield OS.File.stat(entry.path)).lastModificationDate.getTime();
|
fmtime = (await OS.File.stat(entry.path)).lastModificationDate.getTime();
|
||||||
}
|
}
|
||||||
let translatorID = this._translatorFiles.get(entry.name);
|
let translatorID = this._translatorFiles.get(entry.name);
|
||||||
let loadFile = true;
|
let loadFile = true;
|
||||||
// If translator is already loaded, see if mtime has changed
|
// If translator is already loaded, see if mtime has changed
|
||||||
if (translatorID) {
|
if (translatorID) {
|
||||||
let mtime = this._translators.get(translatorID).mtime;
|
let mtime = this._translators.get(translatorID).mtime;
|
||||||
if (mtime == fmtime) {
|
if (mtime == fmtime) {
|
||||||
loadFile = false;
|
loadFile = false;
|
||||||
}
|
|
||||||
}
|
|
||||||
if (loadFile) {
|
|
||||||
let translator = yield Zotero.Translators.loadFromFile(entry.path);
|
|
||||||
this._translators.set(
|
|
||||||
translator.translatorID,
|
|
||||||
{
|
|
||||||
translator,
|
|
||||||
filename: entry.name,
|
|
||||||
mtime: fmtime,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
this._translatorFiles.set(entry.name, translator.translatorID);
|
|
||||||
numLoaded++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
Zotero.logError(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (loadFile) {
|
||||||
|
let translator = await Zotero.Translators.loadFromFile(entry.path);
|
||||||
|
this._translators.set(
|
||||||
|
translator.translatorID,
|
||||||
|
{
|
||||||
|
translator,
|
||||||
|
filename: entry.name,
|
||||||
|
mtime: fmtime,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this._translatorFiles.set(entry.name, translator.translatorID);
|
||||||
|
numLoaded++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
Zotero.logError(e);
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue