Overhaul Scaffold (#2293)

This commit is contained in:
Abe Jellinek 2021-12-28 17:32:56 -08:00 committed by Dan Stillman
parent a7cf689df2
commit 5409ae3313
24 changed files with 1936 additions and 1013 deletions

View file

@ -47,6 +47,10 @@ var Scaffold_Load = new function() {
.sort((a, b) => a.label.localeCompare(b.label)); .sort((a, b) => a.label.localeCompare(b.label));
translators["Import Translators"] = (yield translatorProvider.getAllForType("import")) translators["Import Translators"] = (yield translatorProvider.getAllForType("import"))
.sort((a, b) => a.label.localeCompare(b.label)); .sort((a, b) => a.label.localeCompare(b.label));
translators["Export Translators"] = (yield translatorProvider.getAllForType("export"))
.sort((a, b) => a.label.localeCompare(b.label));
translators["Search Translators"] = (yield translatorProvider.getAllForType("search"))
.sort((a, b) => a.label.localeCompare(b.label));
for (set in translators) { for (set in translators) {
// Make a separator // Make a separator

View file

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Monaco</title>
<style type="text/css">
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
</style>
</head>
<body>
<div id="container" style="width: 100%; height: 100%"></div>
<script src="resource://zotero/vs/loader.js"></script>
<script>
var container = document.getElementById('container');
var editor, globalEditor;
require.config({ paths: { vs: 'resource://zotero/vs' } });
let proxy = URL.createObjectURL(
new Blob(
[`
self.MonacoEnvironment = {
baseUrl: 'resource://zotero/'
};
importScripts('resource://zotero/vs/base/worker/workerMain.js');
`],
{ type: "text/javascript" }
)
);
window.MonacoEnvironment = { getWorkerUrl: () => proxy };
require(['vs/editor/editor.main'], function () {
globalEditor = monaco;
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
target: monaco.languages.typescript.ScriptTarget.ES6,
allowNonTsExtensions: true // needed for peeking definitions from in-memory models to work
});
editor = monaco.editor.create(container, {
theme: 'vs-dark',
language: 'javascript',
scrollBeyondLastLine: false,
minimap: { enabled: false }
});
window.onresize = function () {
editor.layout();
};
});
</script>
</body>
</html>

File diff suppressed because it is too large Load diff

View file

@ -25,12 +25,26 @@
--> -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://scaffold/skin/scaffold.css" type="text/css"?> <?xml-stylesheet href="chrome://scaffold/skin/scaffold.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/overlay.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero-platform/content/overlay.css" type="text/css"?> <?xml-stylesheet href="chrome://zotero-platform/content/overlay.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero-platform-version/content/style.css"?> <?xml-stylesheet href="chrome://zotero-platform-version/content/style.css"?>
<?xml-stylesheet href="chrome://zotero-platform/content/zotero-react-client.css"?>
<!DOCTYPE window SYSTEM "chrome://scaffold/locale/scaffold.dtd"> <?xul-overlay href="chrome://zotero/content/containers/containers.xul"?>
<?xul-overlay href="chrome://zotero/content/standalone/editMenuOverlay.xul"?>
<?xul-overlay href="chrome://zotero-platform/content/standalone/menuOverlay.xul"?>
<window id="scaffold" width="600" height="600" minheight="600" persist="screenX screenY width height" <!DOCTYPE window [
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd"> %globalDTD;
<!ENTITY % textcontextDTD SYSTEM "chrome://global/locale/textcontext.dtd" > %textcontextDTD;
<!ENTITY % standaloneDTD SYSTEM "chrome://zotero/locale/standalone.dtd" > %standaloneDTD;
<!ENTITY % editMenuOverlayDTD SYSTEM "chrome://zotero/locale/mozilla/editMenuOverlay.dtd" > %editMenuOverlayDTD;
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" > %brandDTD;
<!ENTITY % zoteroDTD SYSTEM "chrome://zotero/locale/zotero.dtd"> %zoteroDTD;
<!ENTITY % scaffoldDTD SYSTEM "chrome://scaffold/locale/scaffold.dtd"> %scaffoldDTD;
]>
<window id="scaffold" width="800" height="600" minheight="600" persist="screenX screenY width height"
title="Scaffold" title="Scaffold"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="chrome://zotero/content/include.js"/> <script src="chrome://zotero/content/include.js"/>
@ -38,21 +52,62 @@
<script src="translators.js"/> <script src="translators.js"/>
<script src="scaffold.js"/> <script src="scaffold.js"/>
<script src="chrome://global/content/globalOverlay.js"/>
<script src="chrome://global/content/contentAreaUtils.js"/>
<commandset id="mainCommandSet">
<command id="cmd_quitApplication" oncommand="goQuitApplication();"/>
<command id="cmd_close" oncommand="window.close();"/>
<command id="cmd_undo" oncommand="Scaffold.trigger('undo', 'cmd_undo')"/>
<command id="cmd_redo" oncommand="Scaffold.trigger('redo', 'cmd_redo')"/>
<command id="cmd_find" oncommand="Scaffold.trigger('actions.find', 'cmd_find')"/>
<command id="cmd_selectAll" oncommand="Scaffold.trigger('editor.selectAll', 'cmd_selectAll')"/>
<command id="cmd_new" oncommand="Scaffold.newTranslator()"/>
<command id="cmd_load" oncommand="Scaffold.load()" disabled="true"/>
<command id="cmd_run_translator_or_tests" oncommand="Scaffold.runTranslatorOrTests()"/>
<command id="cmd_run_detect" oncommand="Scaffold.run('detect')"/>
<command id="cmd_save" oncommand="Scaffold.save()"/>
<command id="cmd_save_to_zotero" oncommand="Scaffold.save(true)"/>
<command id="cmd_increase_font_size" oncommand="Scaffold.increaseFontSize()"/>
<command id="cmd_decrease_font_size" oncommand="Scaffold.decreaseFontSize()"/>
<command id="cmd_restore_font_size" oncommand="Scaffold.setFontSize(11)"/>
<commandset id="editMenuCommands"/>
</commandset>
<keyset> <keyset>
<key id="run-do-web" modifiers="accel" key="R" oncommand="Scaffold.runTranslatorOrTests()"/> <key id="new" modifiers="accel" key="N" command="cmd_new"/>
<key id="detect-web" modifiers="accel" key="T" oncommand="Scaffold.run('detect')"/> <key id="load" modifiers="accel" key="O" command="cmd_load"/>
<key id="save" modifiers="accel" key="S" oncommand="Scaffold.save()"/> <key id="run-do-web" modifiers="accel" key="R" command="cmd_run_translator_or_tests"/>
<key id="increase-font-size" modifiers="accel" key="+" oncommand="Scaffold.increaseFontSize()"/> <key id="detect-web" modifiers="accel" key="T" command="cmd_run_detect"/>
<key id="increase-font-size" modifiers="accel" key="=" oncommand="Scaffold.increaseFontSize()"/> <key id="save" modifiers="accel" key="S" command="cmd_save"/>
<key id="decrease-font-size" modifiers="accel" key="-" oncommand="Scaffold.decreaseFontSize()"/> <key id="save-to-zotero" modifiers="accel alt" key="S" command="cmd_save"/>
<key id="restore-font-size" modifiers="accel" key="0" oncommand="Scaffold.setFontSize(11)"/> <key id="increase-font-size" modifiers="accel" key="+" command="cmd_increase_font_size"/>
<key id="increase-font-size" modifiers="accel" key="=" command="cmd_increase_font_size"/>
<key id="decrease-font-size" modifiers="accel" key="-" command="cmd_decrease_font_size"/>
<key id="restore-font-size" modifiers="accel" key="0" command="cmd_restore_font_size"/>
<key modifiers="accel" key="1" oncommand="Scaffold.showTabNumbered(1)"/>
<key modifiers="accel" key="2" oncommand="Scaffold.showTabNumbered(2)"/>
<key modifiers="accel" key="3" oncommand="Scaffold.showTabNumbered(3)"/>
<key modifiers="accel" key="4" oncommand="Scaffold.showTabNumbered(4)"/>
<key modifiers="accel" key="5" oncommand="Scaffold.showTabNumbered(5)"/>
<key modifiers="accel" key="6" oncommand="Scaffold.showTabNumbered(6)"/>
<key modifiers="accel" key="7" oncommand="Scaffold.showTabNumbered(7)"/>
<key modifiers="accel" key="8" oncommand="Scaffold.showTabNumbered(8)"/>
<key modifiers="accel" key="9" oncommand="Scaffold.showTabNumbered(9)"/>
</keyset> </keyset>
<keyset id="editMenuKeys"/>
<popupset> <popupset>
<menupopup id="testing-context-menue"> <menupopup id="testing-context-menue">
<menuitem label="&scaffold.testing.edit.import;" tooltiptext="Edit the input data for the current test" oncommand="Scaffold.editImportFromTest()"/>
<menuitem label="&scaffold.testing.copyToClipboard;" tooltiptext="Copy the URL or data for the current test to the clipboard" oncommand="Scaffold.copyToClipboard()"/> <menuitem label="&scaffold.testing.copyToClipboard;" tooltiptext="Copy the URL or data for the current test to the clipboard" oncommand="Scaffold.copyToClipboard()"/>
<menu label="&scaffold.testing.openUrl;"> <menuitem id="testing_editImport" label="&scaffold.testing.edit;" tooltiptext="Edit the input data for the current test" oncommand="Scaffold.editImportFromTest()"/>
<menu id="testing_openURL" label="&scaffold.testing.openUrl;">
<menupopup> <menupopup>
<menuitem label="&scaffold.testing.openUrl.internally;" tooltiptext="Open the URL for the current test in the Scaffold browser" oncommand="Scaffold.openURL(false)"/> <menuitem label="&scaffold.testing.openUrl.internally;" tooltiptext="Open the URL for the current test in the Scaffold browser" oncommand="Scaffold.openURL(false)"/>
<menuitem label="&scaffold.testing.openUrl.externally;" tooltiptext="Open the URL for the current test in your default browser" oncommand="Scaffold.openURL(true)"/> <menuitem label="&scaffold.testing.openUrl.externally;" tooltiptext="Open the URL for the current test in your default browser" oncommand="Scaffold.openURL(true)"/>
@ -61,10 +116,95 @@
</menupopup> </menupopup>
</popupset> </popupset>
<broadcasterset>
<broadcaster id="code-tab-only" disabled="true"/>
<broadcaster id="validate-tests"/>
</broadcasterset>
<vbox flex="1" id="scaffold-pane"> <vbox flex="1" id="scaffold-pane">
<menubar id="mb"> <menubar id="mb">
<menu id="mb-help" label="&scaffold.menu.help;"> <menu id="mb-file" label="&fileMenu.label;" accesskey="&fileMenu.accesskey;">
<menupopup id="mb-file-popup">
<menuitem id="mb-file-new" label="&scaffold.menu.new;" key="new" command="cmd_new"/>
<menuitem id="mb-file-load" label="&scaffold.menu.open;" key="load" command="cmd_load"/>
<menuitem id="mb-file-setTranslatorsDirectory" label="&scaffold.menu.setTranslatorsDirectory;" oncommand="Scaffold.promptForTranslatorsDirectory()"/>
<menuseparator/>
<menuitem id="mb-file-save" label="&scaffold.toolbar.save.label;" key="save" command="cmd_save"/>
<menuitem id="mb-file-saveToZotero" label="&scaffold.toolbar.saveToZotero.label;" key="save-to-zotero" command="cmd_save_to_zotero"/>
<menuseparator/>
<menuitem id="mb-file-runDetect" label="&scaffold.menu.runDetect;" key="detect-web" command="cmd_run_detect"/>
<menuitem id="mb-file-runDo" label="&scaffold.menu.runDo;" key="run-do-web" command="cmd_run_translator_or_tests"/>
<menuseparator/>
<menuitem id="menu_close" label="&closeCmd.label;" key="key_close" accesskey="&closeCmd.accesskey;" command="cmd_close"/>
</menupopup>
</menu>
<menu id="menu_edit">
<menupopup id="menu_EditPopup">
<menuitem id="menu_undo" command="cmd_undo"/>
<menuitem id="menu_redo" command="cmd_redo"/>
<menuseparator/>
<menuitem id="menu_cut"/>
<menuitem id="menu_copy"/>
<menuitem id="menu_paste"/>
<menuitem id="menu_delete"/>
<menuseparator class="menu-type-library"/>
<menuitem id="menu_selectAll" class="menu-type-library" command="cmd_selectAll"/>
<menuseparator class="menu-type-library"/>
<menuitem id="menu_find" class="menu-type-library" command="cmd_find"/>
</menupopup>
</menu>
<menu id="mb-view" label="&viewMenu.label;">
<menupopup id="mb-view-popup">
<menu id="mb-font-size-fields" label="&fontSize.label;">
<menupopup id="mb-help-fields-popup">
<menuitem id="mb-view-biggerFont" label="&zotero.general.bigger;" key="increase-font-size" command="cmd_increase_font_size"/>
<menuitem id="mb-view-smallerFont" label="&zotero.general.smaller;" key="decrease-font-size" command="cmd_decrease_font_size"/>
<menuseparator/>
<menuitem id="mb-view-restoreFont" label="&zotero.general.reset;" key="restore-font-size" command="restore-font-size"/>
</menupopup>
</menu>
</menupopup>
</menu>
<menu id="toolsMenu" label="&toolsMenu.label;" accesskey="&toolsMenu.accesskey;">
<menupopup id="menu_ToolsPopup">
<menu id="menu_template"
label="&scaffold.menu.template;"
observes="code-tab-only">
<menupopup>
<menuitem label="&scaffold.toolbar.template.newWeb.label;" oncommand="Scaffold.addTemplate('newWeb')"/>
<menu label="&scaffold.toolbar.template.scrape.label;">
<menupopup id="menu_template_scrapePopup">
<menuitem id="tb-template-scrape-em" label="Embedded Metadata" oncommand="Scaffold.addTemplate('scrapeEM')"/>
<menuitem id="tb-template-scrape-ris" label="RIS" oncommand="Scaffold.addTemplate('scrapeRIS')"/>
<menuitem id="tb-template-scrape-bibtex" label="BibTeX" oncommand="Scaffold.addTemplate('scrapeBibTeX')"/>
<menuitem id="tb-template-scrape-marc" label="MARC" oncommand="Scaffold.addTemplate('scrapeMARC')"/>
</menupopup>
</menu>
</menupopup>
</menu>
<menuseparator/>
<menu id="linter-menu"
label="&scaffold.menu.linter;"
onpopupshowing="Scaffold.populateLinterMenu()">
<menupopup>
<menuitem id="menu_eslintStatus" disabled="true"/>
<menuitem id="menu_toggleESLint" oncommand="Scaffold.toggleESLint()"/>
</menupopup>
</menu>
</menupopup>
</menu>
<menu id="windowMenu"
label="&windowMenu.label;"
onpopupshowing="macWindowMenuDidShow();"
onpopuphidden="macWindowMenuDidHide();">
</menu>
<menu id="helpMenu" label="&helpMenu.label;" accesskey="&helpMenu.accesskey;">
<menupopup id="mb-help-popup"> <menupopup id="mb-help-popup">
<menuitem id="mb-help-types" label="&scaffold.toolbar.template.itemTypes.label;" oncommand="Scaffold.addTemplate('templateAllTypes')"/> <menuitem id="mb-help-types" label="&scaffold.toolbar.template.itemTypes.label;" oncommand="Scaffold.addTemplate('templateAllTypes')"/>
<menu id="mb-help-fields" label="&scaffold.toolbar.template.newItem.label;"> <menu id="mb-help-fields" label="&scaffold.toolbar.template.newItem.label;">
@ -82,111 +222,24 @@
</menu> </menu>
</menupopup> </menupopup>
</menu> </menu>
<menuitem id="mb-help-shortcuts" label="&scaffold.toolbar.help.shortcuts;" oncommand="Scaffold.addTemplate('shortcuts')"/>
</menupopup> </menupopup>
</menu> </menu>
</menubar> </menubar>
<toolbar id="tb" align="center"> <toolbar id="zotero-toolbar" class="toolbar toolbar-primary">
<toolbarbutton id="tb-load" tooltiptext="&scaffold.toolbar.load.label;" oncommand="Scaffold.load()" /> <hbox id="scaffold-toolbar" align="center">
<toolbarbutton id="tb-save" tooltiptext="&scaffold.toolbar.save.label;" oncommand="Scaffold.save()" /> <toolbarbutton id="tb-load" tooltiptext="&scaffold.toolbar.load.label;" command="cmd_load" class="zotero-tb-button" />
<toolbarbutton id="tb-saveToZotero" tooltiptext="&scaffold.toolbar.saveToZotero.label;" oncommand="Scaffold.save(true)" /> <toolbarbutton id="tb-save" tooltiptext="&scaffold.toolbar.save.label;" oncommand="Scaffold.save()" class="zotero-tb-button" />
<toolbarbutton id="tb-saveToZotero" tooltiptext="&scaffold.toolbar.saveToZotero.label;" oncommand="Scaffold.save(true)" class="zotero-tb-button" />
<toolbarseparator/> <toolbarseparator/>
<toolbarbutton id="tb-detectWeb" tooltiptext="&scaffold.toolbar.detectWeb.label;" oncommand="Scaffold.run('detectWeb')" /> <toolbarbutton id="tb-detect" tooltiptext="&scaffold.toolbar.detect.label;" oncommand="Scaffold.run('detect')" class="zotero-tb-button" />
<toolbarbutton id="tb-doWeb" tooltiptext="&scaffold.toolbar.doWeb.label;" oncommand="Scaffold.run('doWeb')" /> <toolbarbutton id="tb-do" tooltiptext="&scaffold.toolbar.do.label;" oncommand="Scaffold.run('do')" class="zotero-tb-button" />
<toolbarseparator/> <toolbarseparator/>
<toolbarbutton id="tb-detectImport" tooltiptext="&scaffold.toolbar.detectImport.label;" oncommand="Scaffold.run('detectImport')" /> <toolbarbutton id="tb-template" observes="code-tab-only" tooltiptext="&scaffold.toolbar.template.label;" class="zotero-tb-button" type="menu">
<toolbarbutton id="tb-doImport" tooltiptext="&scaffold.toolbar.doImport.label;" oncommand="Scaffold.run('doImport')" /> <menupopup>
<toolbarseparator/> <menuitem label="&scaffold.toolbar.template.newWeb.label;" oncommand="Scaffold.addTemplate('newWeb')"/>
<toolbarbutton id="tb-setTranslatorsDir" tooltiptext="&scaffold.toolbar.setTranslatorsDir.label;" oncommand="Scaffold.promptForTranslatorsDirectory()" /> <menu label="&scaffold.toolbar.template.scrape.label;">
</toolbar> <menupopup id="menu_template_scrapePopup">
<hbox flex="1">
<tabbox id="left-tabbox" flex="1" width="300">
<tabs id="tabs" onselect="Scaffold.handleTabSelect(event)">
<tab id="tab-metadata" label="&scaffold.tabs.metadata.label;"/>
<tab id="tab-code" label="&scaffold.tabs.code.label;"/>
<tab id="tab-import" label="&scaffold.tabs.import.label;"/>
<tab id="tab-tests" label="&scaffold.tabs.tests.label;"/>
<tab id="tab-testing" label="&scaffold.tabs.testing.label;"/>
<tab id="tab-browser" label="Browser"/>
</tabs>
<tabpanels flex="1">
<tabpanel flex="1" id="tabpanel-metadata">
<vbox flex="1">
<hbox>
<label class="label-metadata" value="&scaffold.metadata.translatorID.label;" control="textbox-translatorID"/>
<textbox id="textbox-translatorID" flex="1"/>
<button label="&scaffold.metadata.translatorID.generate;" oncommand="Scaffold.generateTranslatorID()"/>
</hbox>
<hbox>
<label class="label-metadata" value="&scaffold.metadata.label.label;" control="textbox-label"/>
<textbox id="textbox-label" flex="1" value="&scaffold.metadata.label.default;"/>
</hbox>
<hbox>
<label class="label-metadata" value="&scaffold.metadata.creator.label;" control="textbox-creator"/>
<textbox id="textbox-creator" flex="1"/>
</hbox>
<hbox>
<label class="label-metadata" value="&scaffold.metadata.target.label;" control="textbox-target"/>
<textbox id="textbox-target" flex="1"/>
<button label="&scaffold.metadata.target.testRegex;" oncommand="Scaffold.logTargetRegex()"/>
</hbox>
<hbox style="display:none">
<label class="label-metadata" value="&scaffold.metadata.targetAll.label;" control="textbox-target-all"/>
<textbox id="textbox-target-all" flex="1"/>
</hbox>
<hbox>
<label class="label-metadata" value="&scaffold.metadata.configOptions.label;" control="textbox-configOptions"/>
<textbox id="textbox-configOptions" flex="1"/>
</hbox>
<hbox>
<label class="label-metadata" value="&scaffold.metadata.displayOptions.label;" control="textbox-displayOptions"/>
<textbox id="textbox-displayOptions" flex="1"/>
</hbox>
<hbox>
<label class="label-metadata" value="&scaffold.metadata.minVersion.label;" control="textbox-minVersion"/>
<textbox id="textbox-minVersion" flex="1" value="3.0"/>
<label class="label-metadata" value="&scaffold.metadata.maxVersion.label;" control="textbox-maxVersion"/>
<textbox id="textbox-maxVersion" flex="1"/>
<label class="label-metadata" value="&scaffold.metadata.priority.label;" control="textbox-priority"/>
<textbox id="textbox-priority" flex="1" value="&scaffold.metadata.priority.default;"/>
</hbox>
<hbox style="display:none">
<label class="label-metadata" value="&scaffold.metadata.hiddenPrefs.label;" control="textbox-hidden-prefs"/>
<textbox id="textbox-hidden-prefs" flex="1"/>
</hbox>
<grid flex="1">
<columns>
<column flex="2"/>
<column flex="1"/>
</columns>
<rows><row><groupbox>
<caption label="&scaffold.metadata.translatorType.label;"/>
<checkbox id="checkbox-import" label="&scaffold.metadata.translatorType.import;"/>
<checkbox id="checkbox-export" label="&scaffold.metadata.translatorType.export;"/>
<checkbox id="checkbox-web" label="&scaffold.metadata.translatorType.web;" checked="true"/>
<checkbox id="checkbox-search" label="&scaffold.metadata.translatorType.search;"/>
</groupbox>
<groupbox>
<caption label="&scaffold.metadata.browserSupport.label;"/>
<checkbox id="checkbox-gecko" label="&scaffold.metadata.browserSupport.gecko;" checked="true"/>
<checkbox id="checkbox-chrome" label="&scaffold.metadata.browserSupport.chrome;" checked="true"/>
<checkbox id="checkbox-safari" label="&scaffold.metadata.browserSupport.safari;" checked="true"/>
<checkbox id="checkbox-ie" label="&scaffold.metadata.browserSupport.ie;" checked="true"/>
<checkbox id="checkbox-bookmarklet" label="&scaffold.metadata.browserSupport.bookmarklet;" checked="true"/>
<checkbox id="checkbox-server" label="&scaffold.metadata.browserSupport.server;" checked="true"/>
</groupbox></row></rows>
</grid>
</vbox>
</tabpanel>
<tabpanel flex="1" id="tabpanel-code">
<vbox flex="1">
<hbox id="editor-toolbar" align="center">
<toolbarbutton id="tb-template" tooltiptext="&scaffold.toolbar.template.label;" type="menu">
<menupopup id="tb-template-popup">
<menuitem id="tb-template-new-web-add" label="&scaffold.toolbar.template.newWeb.label;" oncommand="Scaffold.addTemplate('newWeb')"/>
<menu id="tb-template-scrape-add" label="&scaffold.toolbar.template.scrape.label;">
<menupopup id="tb-template-scrape-popup">
<menuitem id="tb-template-scrape-em" label="Embedded Metadata" oncommand="Scaffold.addTemplate('scrapeEM')"/> <menuitem id="tb-template-scrape-em" label="Embedded Metadata" oncommand="Scaffold.addTemplate('scrapeEM')"/>
<menuitem id="tb-template-scrape-ris" label="RIS" oncommand="Scaffold.addTemplate('scrapeRIS')"/> <menuitem id="tb-template-scrape-ris" label="RIS" oncommand="Scaffold.addTemplate('scrapeRIS')"/>
<menuitem id="tb-template-scrape-bibtex" label="BibTeX" oncommand="Scaffold.addTemplate('scrapeBibTeX')"/> <menuitem id="tb-template-scrape-bibtex" label="BibTeX" oncommand="Scaffold.addTemplate('scrapeBibTeX')"/>
@ -196,49 +249,125 @@
</menupopup> </menupopup>
</toolbarbutton> </toolbarbutton>
</hbox> </hbox>
<iframe src="chrome://zotero/content/ace/ace.html" id="editor-code" flex="1"/> </toolbar>
<hbox id="editor-external-box" align="center"> <hbox flex="1">
<checkbox id="checkbox-editor-external"/> <tabbox id="left-tabbox" flex="2" width="300">
<label class="label-metadata" value="&scaffold.editor.external.label;" control="checkbox-editor-external"/> <tabs id="tabs" onselect="Scaffold.handleTabSelect(event)">
<tab id="tab-metadata" label="&scaffold.tabs.metadata.label;"/>
<tab id="tab-code" label="&scaffold.tabs.code.label;"/>
<tab id="tab-tests" label="&scaffold.tabs.tests.label;"/>
<tab id="tab-browser" label="Browser"/>
<tab id="tab-import" label="&scaffold.tabs.import.label;"/>
</tabs>
<tabpanels flex="1">
<tabpanel flex="1" id="tabpanel-metadata">
<grid flex="1">
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row align="center">
<label class="label-metadata" value="&scaffold.metadata.translatorID.label;" control="textbox-translatorID"/>
<hbox>
<textbox id="textbox-translatorID" flex="1"/>
<button label="&scaffold.metadata.translatorID.generate;" oncommand="Scaffold.generateTranslatorID()"/>
</hbox> </hbox>
</row>
<row align="center">
<label class="label-metadata" value="&scaffold.metadata.label.label;" control="textbox-label"/>
<textbox id="textbox-label" flex="1" value="&scaffold.metadata.label.default;"/>
</row>
<row align="center">
<label class="label-metadata" value="&scaffold.metadata.creator.label;" control="textbox-creator"/>
<textbox id="textbox-creator" flex="1"/>
</row>
<row align="center">
<label class="label-metadata" value="&scaffold.metadata.target.label;" control="textbox-target"/>
<hbox>
<textbox id="textbox-target" flex="1"/>
<button label="&scaffold.metadata.target.testRegex;" oncommand="Scaffold.logTargetRegex()"/>
</hbox>
</row>
<row align="center">
<label class="label-metadata" value="&scaffold.metadata.targetAll.label;" control="textbox-target-all" style="display: none"/>
<textbox id="textbox-target-all" flex="1" style="display: none"/>
</row>
<row align="center">
<label class="label-metadata" value="&scaffold.metadata.configOptions.label;" control="textbox-configOptions"/>
<textbox id="textbox-configOptions" flex="1"/>
</row>
<row align="center">
<label class="label-metadata" value="&scaffold.metadata.displayOptions.label;" control="textbox-displayOptions"/>
<textbox id="textbox-displayOptions" flex="1"/>
</row>
<row align="center">
<label class="label-metadata" value="&scaffold.metadata.minVersion.label;" control="textbox-minVersion"/>
<hbox>
<textbox id="textbox-minVersion" flex="1" value="5.0"/>
<label class="label-metadata" value="&scaffold.metadata.priority.label;" control="textbox-priority"/>
<textbox id="textbox-priority" flex="1" value="&scaffold.metadata.priority.default;"/>
</hbox>
</row>
<row align="center">
<label class="label-metadata" value="&scaffold.metadata.hiddenPrefs.label;" control="textbox-hidden-prefs" style="display: none"/>
<textbox id="textbox-hidden-prefs" flex="1" style="display: none"/>
</row>
<row align="center">
<label class="label-metadata" value="&scaffold.metadata.translatorType.label;"/>
<hbox id="checkboxes-translatorType">
<checkbox id="checkbox-import" label="&scaffold.metadata.translatorType.import;"/>
<checkbox id="checkbox-export" label="&scaffold.metadata.translatorType.export;"/>
<checkbox id="checkbox-web" label="&scaffold.metadata.translatorType.web;" checked="true"/>
<checkbox id="checkbox-search" label="&scaffold.metadata.translatorType.search;"/>
</hbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel flex="1" id="tabpanel-code">
<vbox flex="1">
<iframe src="monaco/monaco.html" id="editor-code" flex="1" onmousedown="this.focus()"/>
</vbox> </vbox>
</tabpanel> </tabpanel>
<tabpanel flex="1" id="tabpanel-import">
<iframe src="chrome://zotero/content/ace/ace.html" id="editor-import" flex="1"/>
</tabpanel>
<tabpanel flex="1" id="tabpanel-tests"> <tabpanel flex="1" id="tabpanel-tests">
<iframe src="chrome://zotero/content/ace/ace.html" id="editor-tests" flex="1"/> <vbox flex="1">
</tabpanel> <vbox flex="1">
<tabpanel flex="1" id="tabpanel-testing"> <hbox flex="1" context="testing-context-menue">
<keyset> <keyset>
<key id="key-delete-tests" keycode="VK_BACK" oncommand="Scaffold.deleteSelectedTests()"/> <key id="key-delete-tests" observes="validate-tests" keycode="VK_BACK" oncommand="Scaffold.deleteSelectedTests()"/>
</keyset> </keyset>
<vbox flex="1"><hbox><description>&scaffold.testing.description;</description></hbox> <listbox id="testing-listbox" observes="validate-tests" flex="1" seltype="multiple" onselect="Scaffold.handleTestSelect(event)">
<hbox flex="1" context="testing-context-menue">
<listbox id="testing-listbox" flex="1" seltype="multiple">
<listhead> <listhead>
<listheader label="&scaffold.testing.input.label;"/> <listheader label="&scaffold.testing.input.label;"/>
<listheader label="&scaffold.testing.status.label;"/> <listheader label="&scaffold.testing.status.label;"/>
</listhead> </listhead>
<listcols> <listcols>
<listcol flex="1"/> <listcol flex="1"/>
<listcol/> <listcol class="listcol-testMessage"/>
</listcols> </listcols>
</listbox> </listbox>
</hbox> </hbox>
<hbox> <hbox>
<button label="&scaffold.testing.populate;" tooltiptext="Load test definitions from the current translator" oncommand="Scaffold.populateTests()"/> <button observes="validate-tests" label="&scaffold.testing.delete;" tooltiptext="Delete the selected tests" oncommand="Scaffold.deleteSelectedTests()"/>
<button label="&scaffold.testing.save;" tooltiptext="Save the above test definitions into the current translator, and save the translator" oncommand="Scaffold.saveTests()"/> <button observes="validate-tests" label="&scaffold.testing.run;" tooltiptext="Run the selected tests" oncommand="Scaffold.runSelectedTests()"/>
<button label="&scaffold.testing.delete;" tooltiptext="Delete the selected tests" oncommand="Scaffold.deleteSelectedTests()"/> <button observes="validate-tests" label="&scaffold.testing.update;" tooltiptext="Run the selected tests and update the translator" oncommand="Scaffold.updateSelectedTests()"/>
<button label="&scaffold.testing.run;" tooltiptext="Run the selected tests" oncommand="Scaffold.runSelectedTests()"/>
</hbox>
<hbox>
<button label="&scaffold.testing.update;" tooltiptext="Update a test to match current item" oncommand="Scaffold.updateSelectedTests()"/>
<button label="&scaffold.testing.new;" tooltiptext="Create a new test from the current page" oncommand="Scaffold.newTestFromCurrent('web')" />
<button label="&scaffold.testing.new.import;" tooltiptext="Create a new test from the current import" oncommand="Scaffold.newTestFromCurrent('import')" />
</hbox> </hbox>
</vbox> </vbox>
<splitter resizeafter="farthest"/>
<iframe src="monaco/monaco.html" id="editor-tests" flex="2" onmousedown="this.focus()"/>
</vbox>
</tabpanel> </tabpanel>
<tabpanel> <tabpanel>
<vbox flex="1"> <vbox flex="1">
@ -247,14 +376,24 @@
<menulist id="browser-url" editable="true" flex="1"> <menulist id="browser-url" editable="true" flex="1">
<menupopup></menupopup> <menupopup></menupopup>
</menulist> </menulist>
<button observes="validate-tests" label="&scaffold.testing.create.web;" tooltiptext="Create a new test from the current page" oncommand="Scaffold.saveTestFromCurrent('web')"/>
</hbox> </hbox>
<browser src="about:blank" type="content" flex="1"></browser> <browser id="browser" src="about:blank" type="content" flex="1"></browser>
</vbox>
</tabpanel>
<tabpanel flex="1" id="tabpanel-import">
<vbox flex="1">
<hbox align="right">
<button observes="validate-tests" label="&scaffold.testing.create.import;" tooltiptext="Create a new test from the current import data" oncommand="Scaffold.saveTestFromCurrent('import')" />
<button observes="validate-tests" label="&scaffold.testing.create.search;" tooltiptext="Create a new test from the current search data" oncommand="Scaffold.saveTestFromCurrent('search')" />
</hbox>
<iframe src="monaco/monaco.html" id="editor-import" flex="1" onmousedown="this.focus()"/>
</vbox> </vbox>
</tabpanel> </tabpanel>
</tabpanels> </tabpanels>
</tabbox> </tabbox>
<splitter resizeafter="farthest" oncommand="Scaffold.onResize();" /> <splitter resizeafter="farthest" />
<vbox id="right-pane" flex="1"> <vbox id="right-pane" flex="1">

View file

@ -1,7 +1,7 @@
/* /*
***** BEGIN LICENSE BLOCK ***** ***** BEGIN LICENSE BLOCK *****
Copyright © 2021 YOUR_NAME <- TODO Copyright © 2022 YOUR_NAME <- TODO
This file is part of Zotero. This file is part of Zotero.
@ -22,13 +22,13 @@
*/ */
function detectWeb(doc, url) { async function detectWeb(doc, url) {
// TODO: adjust the logic here // TODO: adjust the logic here
if (url.includes('/article/')) { if ($$CURSOR$$url.includes('/article/')) {
return "newspaperArticle"; return 'newspaperArticle';
} }
else if (getSearchResults(doc, true)) { else if (getSearchResults(doc, true)) {
return "multiple"; return 'multiple';
} }
return false; return false;
} }
@ -51,13 +51,17 @@ function getSearchResults(doc, checkOnly) {
return found ? items : false; return found ? items : false;
} }
function doWeb(doc, url) { async function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") { if (await detectWeb(doc, url) == 'multiple') {
Zotero.selectItems(getSearchResults(doc, false), function (items) { let items = await Zotero.selectItems(getSearchResults(doc, false));
if (items) ZU.processDocuments(Object.keys(items), scrape); if (items) {
}); await Promise.all(
Object.keys(items)
.map(url => requestDocument(url).then(doc => scrape(doc, url)))
);
}
} }
else { else {
scrape(doc, url); await scrape(doc, url);
} }
} }

View file

@ -1,21 +1,20 @@
function scrape(doc, url) { async function scrape(doc, url) {
// TODO adjust the url building // TODO adjust the url building
var m = url.match(/FId=([\w\d]+)&/); let m = url.match(/FId=([\w\d]+)&/);
if (m) { if (m) {
// e.g. http://www.fachportal-paedagogik.de/fis_bildung/suche/fis_ausg.html?FId=A18196&lart=BibTeX&Speichern=Speichern&senden_an=+E-Mail-Adresse // e.g. http://www.fachportal-paedagogik.de/fis_bildung/suche/fis_ausg.html?FId=A18196&lart=BibTeX&Speichern=Speichern&senden_an=+E-Mail-Adresse
var bibUrl = "/fis_bildung/suche/fis_ausg.html?FId=" + m[1] + "&lart=BibTeX"; let bibUrl = '/fis_bildung/suche/fis_ausg.html?FId=' + m[1] + '&lart=BibTeX';
ZU.doGet(bibUrl, function (text) { let bibText = await requestText(bibUrl);
var translator = Zotero.loadTranslator("import"); let translator = Zotero.loadTranslator("import");
translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4"); translator.setTranslator('9cb70025-a888-4a29-a210-93ec52da40d4');
translator.setString(text); translator.setString(bibText);
translator.setHandler("itemDone", function (obj, item) { translator.setHandler('itemDone', (_obj, item) => {
item.attachments.push({ item.attachments.push({
title: "Snapshot", title: 'Snapshot',
document: doc document: doc
}); });
item.complete(); item.complete();
}); });
translator.translate(); await translator.translate();
});
} }
} }

View file

@ -1,21 +1,20 @@
function scrape(doc, url) { async function scrape(doc, url) {
var translator = Zotero.loadTranslator('web'); let translator = Zotero.loadTranslator('web');
// Embedded Metadata // Embedded Metadata
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
// translator.setDocument(doc); translator.setDocument(doc);
translator.setHandler('itemDone', function (obj, item) { translator.setHandler('itemDone', (_obj, item) => {
// TODO adjust if needed: // TODO adjust if needed:
item.section = "News"; item.section = 'News';
item.complete(); item.complete();
}); });
translator.getTranslatorObject(function (trans) { let em = await translator.getTranslatorObject();
trans.itemType = "newspaperArticle"; em.itemType = 'newspaperArticle';
// TODO map additional meta tags here, or delete completely // TODO map additional meta tags here, or delete completely
trans.addCustomFields({ em.addCustomFields({
'twitter:description': 'abstractNote' 'twitter:description': 'abstractNote'
}); });
trans.doWeb(doc, url); await em.doWeb(doc, url);
});
} }

View file

@ -1,36 +1,35 @@
function scrape(doc, url) { async function scrape(doc, url) {
// TODO adjust the selector for the lines here // TODO adjust the selector for the lines here
var lines = doc.querySelectorAll('#cntPlcPortal_grdMrc tr'); let lines = doc.querySelectorAll('table#marcData tr');
// call MARC translator let translator = Zotero.loadTranslator('import');
var translator = Zotero.loadTranslator("import"); translator.setTranslator('a6ee60df-1ddc-4aae-bb25-45e0537be973'); // MARC
translator.setTranslator("a6ee60df-1ddc-4aae-bb25-45e0537be973"); let MARC = await translator.getTranslatorObject();
translator.getTranslatorObject(function (marc) {
var record = new marc.record(); let record = new MARC.Record();
var newItem = new Zotero.Item(); let item = new Zotero.Item();
// ignore the table headings in lines[0] // ignore the table headings in lines[0]
record.leader = text(lines[1], 'td', 4); record.leader = text(lines[1], 'td', 4);
var fieldTag, indicators, fieldContent; let fieldTag;
for (let line of Array.from(lines).slice(2)) { for (let line of Array.from(lines).slice(2)) {
// multiple lines with same fieldTag do not repeat the tag // multiple lines with same fieldTag do not repeat the tag
// i.e. in these cases we will just take same value as before // i.e. in these cases we will just take same value as before
if (text(line, 'td', 0).trim().length > 0) { if (text(line, 'td', 0)) {
fieldTag = text(line, 'td', 0); fieldTag = text(line, 'td', 0);
} }
indicators = text(line, 'td', 1) + text(line, 'td', 2); let indicators = text(line, 'td', 1) + text(line, 'td', 2);
fieldContent = ''; let fieldContent = '';
if (text(line, 'td', 3).trim().length > 0) { if (text(line, 'td', 3)) {
fieldContent = marc.subfieldDelimiter + text(line, 'td', 3); fieldContent = MARC.subfieldDelimiter + text(line, 'td', 3);
} }
fieldContent += text(line, 'td', 4); fieldContent += text(line, 'td', 4);
record.addField(fieldTag, indicators, fieldContent); record.addField(fieldTag, indicators, fieldContent);
} }
record.translate(newItem); record.translate(item);
// possibly clean newItem further here // possibly clean item further here
newItem.complete(); item.complete();
});
} }

View file

@ -1,31 +1,33 @@
function scrape(doc, url) { async function scrape(doc, url) {
var DOI = url.match(/\/(10\.[^#?]+)/)[1]; let DOI = url.match(/\/(10\.[^#?]+)/)[1];
// TODO adjust the url here // TODO adjust the URL here
var risURL = "http://citation-needed.services.springer.com/v2/references/" + DOI + "?format=refman&flavour=citation"; let risURL = `http://citation-needed.services.springer.com/v2/references/${DOI}?format=refman&flavour=citation`;
// Z.debug(risURL) // Z.debug(risURL)
// TODO adjust the url here // TODO adjust this
var pdfURL = doc.getElementById("articlePdf"); let pdfLink = doc.querySelector('#articlePDF');
// Z.debug("pdfURL: " + pdfURL); // Z.debug("pdfURL: " + pdfURL);
ZU.doGet(risURL, function (text) {
var translator = Zotero.loadTranslator("import"); let risText = await requestText(risURL);
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); let translator = Zotero.loadTranslator('import');
translator.setString(text); translator.setTranslator('32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7'); // RIS
translator.setHandler("itemDone", function (obj, item) { translator.setString(risText);
translator.setHandler('itemDone', (_obj, item) => {
// TODO tweak some of the output here // TODO tweak some of the output here
if (pdfURL) { if (pdfLink) {
item.attachments.push({ item.attachments.push({
url: pdfURL.href, url: pdfLink.href,
title: "Full Text PDF", title: 'Full Text PDF',
mimeType: "application/pdf" mimeType: 'application/pdf'
}); });
} }
item.attachments.push({ item.attachments.push({
title: "Snapshot", title: 'Snapshot',
document: doc document: doc
}); });
item.complete(); item.complete();
}); });
translator.translate(); await translator.translate();
});
} }

View file

@ -1,11 +0,0 @@
Keyboard Shortcuts
=============
Ctrl/Cmd S : Save
Ctrl/Cmd R : Run doWeb/doImport or selected tests
Ctrl/Cmd T : Run detectWeb/detectImport
Ctrl/Cmd + : Increase Font Size
Ctrl/Cmd - : Decrease Font Size
Ctrl/Cmd 0 : Restore Font Size

View file

@ -7,16 +7,16 @@ var Scaffold_Translators = {
_provider: null, _provider: null,
_translators: new Map(), _translators: new Map(),
_translatorFiles: new Map(), _translatorFiles: new Map(),
_onLoadBeginListener: null,
_onLoadCompleteListener: null,
load: Zotero.serial(async function (reload, filenames) { load: Zotero.serial(async function (reload) {
if (this._translators.size && !reload) { if (this._translators.size && !reload) {
Zotero.debug("Scaffold: Translators already loaded"); Zotero.debug("Scaffold: Translators already loaded");
return; return { numLoaded: 0, numDeleted: 0 };
} }
if (filenames) { if (this._onLoadBeginListener) this._onLoadBeginListener();
}
var t = new Date(); var t = new Date();
var dir = this.getDirectory(); var dir = this.getDirectory();
@ -77,6 +77,13 @@ var Scaffold_Translators = {
this._translators.delete(id); this._translators.delete(id);
} }
} }
if (this._onLoadCompleteListener) this._onLoadCompleteListener();
return {
numLoaded,
numDeleted: deletedTranslators.size
};
}), }),
deleteByID: async function (translatorID) { deleteByID: async function (translatorID) {
@ -94,6 +101,10 @@ var Scaffold_Translators = {
return Zotero.Prefs.get('scaffold.translatorsDir'); return Zotero.Prefs.get('scaffold.translatorsDir');
}, },
getModifiedTime: function (translatorID) {
return this._translators.get(translatorID)?.mtime;
},
getProvider: function () { getProvider: function () {
if (this._provider) { if (this._provider) {
return this._provider; return this._provider;
@ -139,5 +150,10 @@ var Scaffold_Translators = {
}.bind(this) }.bind(this)
}); });
return this._provider; return this._provider;
},
setLoadListener({ onLoadBegin, onLoadComplete }) {
this._onLoadBeginListener = onLoadBegin;
this._onLoadCompleteListener = onLoadComplete;
} }
}; };

View file

@ -1,27 +1,32 @@
<!ENTITY scaffold.toolbar.load.label "Load"> <!ENTITY scaffold.toolbar.new.label "New Translator">
<!ENTITY scaffold.toolbar.load.label "Open">
<!ENTITY scaffold.toolbar.save.label "Save"> <!ENTITY scaffold.toolbar.save.label "Save">
<!ENTITY scaffold.toolbar.saveToZotero.label "Save to Zotero"> <!ENTITY scaffold.toolbar.saveToZotero.label "Save to Zotero">
<!ENTITY scaffold.toolbar.template.label "Add a template"> <!ENTITY scaffold.toolbar.template.newWeb.label "Web Translator">
<!ENTITY scaffold.toolbar.template.newWeb.label "Add web translator template"> <!ENTITY scaffold.toolbar.template.scrape.label "Scrape Function Using">
<!ENTITY scaffold.toolbar.template.scrape.label "Add scrape function using…">
<!ENTITY scaffold.toolbar.export.label "Export"> <!ENTITY scaffold.toolbar.export.label "Export">
<!ENTITY scaffold.toolbar.detectWeb.label "Run detectWeb"> <!ENTITY scaffold.toolbar.detect.label "Run detect*">
<!ENTITY scaffold.toolbar.doWeb.label "Run doWeb"> <!ENTITY scaffold.toolbar.do.label "Run do*">
<!ENTITY scaffold.toolbar.detectImport.label "Run detectImport">
<!ENTITY scaffold.toolbar.doImport.label "Run doImport">
<!ENTITY scaffold.toolbar.setTranslatorsDir.label "Set translators directory"> <!ENTITY scaffold.toolbar.setTranslatorsDir.label "Set translators directory">
<!ENTITY scaffold.toolbar.template.label "Insert Template">
<!ENTITY scaffold.tabs.metadata.label "Metadata"> <!ENTITY scaffold.tabs.metadata.label "Metadata">
<!ENTITY scaffold.tabs.code.label "Code"> <!ENTITY scaffold.tabs.code.label "Code">
<!ENTITY scaffold.tabs.import.label "Import"> <!ENTITY scaffold.tabs.import.label "Test Input">
<!ENTITY scaffold.tabs.tests.label "Tests"> <!ENTITY scaffold.tabs.tests.label "Tests">
<!ENTITY scaffold.tabs.testing.label "Testing"> <!ENTITY scaffold.tabs.testing.label "Testing">
<!ENTITY scaffold.menu.help "Help"> <!ENTITY scaffold.menu.new "New Translator">
<!ENTITY scaffold.toolbar.template.itemTypes.label "List all item types"> <!ENTITY scaffold.menu.open "Open…">
<!ENTITY scaffold.toolbar.template.newItem.label "List all fields for item type"> <!ENTITY scaffold.menu.setTranslatorsDirectory "Set Translators Directory…">
<!ENTITY scaffold.menu.runDetect "Run detect*">
<!ENTITY scaffold.menu.runDo "Run Selected Tests or do*">
<!ENTITY scaffold.menu.linter "Linter">
<!ENTITY scaffold.menu.template "Insert Template">
<!ENTITY scaffold.toolbar.template.itemTypes.label "List All Item Types">
<!ENTITY scaffold.toolbar.template.newItem.label "List All Fields for Item Type">
<!ENTITY scaffold.toolbar.template.more.label "More"> <!ENTITY scaffold.toolbar.template.more.label "More">
<!ENTITY scaffold.toolbar.help.shortcuts "Keyboard Shortcuts">
<!ENTITY scaffold.tabUrl.label "URL:"> <!ENTITY scaffold.tabUrl.label "URL:">
<!ENTITY scaffold.testFrame.label "Test Frame:"> <!ENTITY scaffold.testFrame.label "Test Frame:">
@ -55,24 +60,24 @@
<!ENTITY scaffold.metadata.label.default "Untitled"> <!ENTITY scaffold.metadata.label.default "Untitled">
<!ENTITY scaffold.metadata.priority.default "100"> <!ENTITY scaffold.metadata.priority.default "100">
<!ENTITY scaffold.load.title "Load Translator"> <!ENTITY scaffold.load.title "Open Translator">
<!ENTITY scaffold.load.label.label "Label"> <!ENTITY scaffold.load.label.label "Label">
<!ENTITY scaffold.load.creator.label "Creator"> <!ENTITY scaffold.load.creator.label "Creator">
<!ENTITY scaffold.editor.external.label "Use external editor"> <!ENTITY scaffold.editor.external.label "Use external editor">
<!ENTITY scaffold.testing.description "Select a test to run">
<!ENTITY scaffold.testing.input.label "Input"> <!ENTITY scaffold.testing.input.label "Input">
<!ENTITY scaffold.testing.status.label "Status"> <!ENTITY scaffold.testing.status.label "Status">
<!ENTITY scaffold.testing.populate "Populate"> <!ENTITY scaffold.testing.populate "Populate">
<!ENTITY scaffold.testing.save "Save"> <!ENTITY scaffold.testing.save "Save">
<!ENTITY scaffold.testing.delete "Delete"> <!ENTITY scaffold.testing.delete "Delete">
<!ENTITY scaffold.testing.run "Run"> <!ENTITY scaffold.testing.run "Run">
<!ENTITY scaffold.testing.update "Update"> <!ENTITY scaffold.testing.update "Run and Update">
<!ENTITY scaffold.testing.new "New Web"> <!ENTITY scaffold.testing.create.web "Create Web Test">
<!ENTITY scaffold.testing.new.import "New Import"> <!ENTITY scaffold.testing.create.import "Create Import Test">
<!ENTITY scaffold.testing.edit.import "Edit Import"> <!ENTITY scaffold.testing.create.search "Create Search Test">
<!ENTITY scaffold.testing.copyToClipboard "Copy to Clipboard"> <!ENTITY scaffold.testing.edit "Edit Input">
<!ENTITY scaffold.testing.copyToClipboard "Copy Input to Clipboard">
<!ENTITY scaffold.testing.openUrl "Open URL"> <!ENTITY scaffold.testing.openUrl "Open URL">
<!ENTITY scaffold.testing.openUrl.internally "In Browser Tab"> <!ENTITY scaffold.testing.openUrl.internally "In Browser Tab">
<!ENTITY scaffold.testing.openUrl.externally "In External Browser"> <!ENTITY scaffold.testing.openUrl.externally "In External Browser">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 750 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 825 B

View file

@ -1,74 +1,58 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml"); @namespace html url("http://www.w3.org/1999/xhtml");
toolbar { #tb-new {
height: 32px; list-style-image: url('chrome://scaffold/skin/new.png');
padding-left: 6px;
}
.toolbarbutton-text {
margin:0 2px;
}
.toolbarbutton-menu-dropmarker {
margin-right:4px;
}
.toolbarbutton-text {
margin:0;
}
.toolbarbutton-icon {
height: 16px;
}
toolbarseparator {
height: 24px;
} }
#tb-load { #tb-load {
list-style-image: url('chrome://scaffold/skin/load.png'); list-style-image: url('chrome://scaffold/skin/load.png');
} }
#tb-save { #tb-save {
list-style-image: url('chrome://scaffold/skin/save.png'); list-style-image: url('chrome://scaffold/skin/save.png');
} }
#tb-saveToZotero { #tb-saveToZotero {
list-style-image: url('chrome://scaffold/skin/saveToZotero.png'); list-style-image: url('chrome://scaffold/skin/saveToZotero.png');
} }
#tb-template { #tb-template {
list-style-image: url('chrome://scaffold/skin/add.png'); list-style-image: url('chrome://scaffold/skin/add.png');
} }
#tb-import { #tb-import {
list-style-image: url('chrome://scaffold/skin/import.png'); list-style-image: url('chrome://scaffold/skin/import.png');
} }
#tb-export { #tb-export {
list-style-image: url('chrome://scaffold/skin/export.png'); list-style-image: url('chrome://scaffold/skin/export.png');
} }
#tb-copy { #tb-copy {
list-style-image: url('chrome://scaffold/skin/copy.png'); list-style-image: url('chrome://scaffold/skin/copy.png');
} }
#tb-checkSyntax {
list-style-image: url('chrome://scaffold/skin/checkSyntax.png'); #tb-detect {
}
#tb-detectWeb {
list-style-image: url('chrome://scaffold/skin/detectWeb.png'); list-style-image: url('chrome://scaffold/skin/detectWeb.png');
} }
#tb-doWeb {
#tb-do {
list-style-image: url('chrome://scaffold/skin/doWeb.png'); list-style-image: url('chrome://scaffold/skin/doWeb.png');
} }
#tb-detectImport {
list-style-image: url('chrome://scaffold/skin/detectImport.png');
}
#tb-doImport {
list-style-image: url('chrome://scaffold/skin/doImport.png');
}
#tb-setTranslatorsDir { #tb-setTranslatorsDir {
list-style-image: url('chrome://scaffold/skin/setTranslatorsDir.png'); list-style-image: url('chrome://scaffold/skin/setTranslatorsDir.png');
} }
#tb-reference {
list-style-image: url('chrome://scaffold/skin/reference.png');
}
#tb-fields { #tb-fields {
list-style-image: url('chrome://scaffold/skin/fields.png'); list-style-image: url('chrome://scaffold/skin/fields.png');
} }
#tb-template {
list-style-image: url('chrome://scaffold/skin/add.png');
}
#tabpanel-metadata textbox { #tabpanel-metadata textbox {
height:2em; height:2em;
} }
@ -85,18 +69,44 @@ listbox {
min-width:200px; min-width:200px;
} }
#editor-toolbar { #zotero-toolbar {
border-top: .5px solid darkgray;
margin-bottom: 3px; margin-bottom: 3px;
} }
#editor-external-box { #zotero-toolbar toolbarseparator {
margin-top: 5px; height: 18px;
}
#editor-external-box label {
margin-left: 1px;
} }
browser { browser {
background: white; background: white;
} }
vbox > splitter {
cursor: row-resize;
}
listbox[disabled], toolbarbutton[disabled] {
opacity: 0.6;
pointer-events: none;
}
dialog listbox > listitem[disabled] {
font-weight: 600;
}
#left-tabbox {
margin-top: 5px;
}
#checkboxes-translatorType checkbox {
margin-right: 10px;
}
#tabpanel-metadata label:first-child {
text-align: right;
}
.listcol-testMessage {
width: 200px;
}

View file

@ -202,3 +202,6 @@ pref("extensions.zotero.retractions.recentItems", "[]");
pref("extensions.zotero.annotations.noteTemplates.title", "<h1>{{title}}<br/>({{date}})</h1>"); pref("extensions.zotero.annotations.noteTemplates.title", "<h1>{{title}}<br/>({{date}})</h1>");
pref("extensions.zotero.annotations.noteTemplates.highlight", "<p>{{highlight quotes='true'}} {{citation}} {{comment}}</p>"); pref("extensions.zotero.annotations.noteTemplates.highlight", "<p>{{highlight quotes='true'}} {{citation}} {{comment}}</p>");
pref("extensions.zotero.annotations.noteTemplates.note", "<p>{{citation}} {{comment}}</p>"); pref("extensions.zotero.annotations.noteTemplates.note", "<p>{{citation}} {{comment}}</p>");
// Scaffold
pref("extensions.zotero.scaffold.eslint.enabled", true);

11
package-lock.json generated
View file

@ -12,6 +12,7 @@
"ace-builds": "^1.4.12", "ace-builds": "^1.4.12",
"bluebird": "^3.5.1", "bluebird": "^3.5.1",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"monaco-editor": "^0.15.6",
"prop-types": "^15.8.0", "prop-types": "^15.8.0",
"react": "^17.0.2", "react": "^17.0.2",
"react-autosuggest": "^10.1.0", "react-autosuggest": "^10.1.0",
@ -5164,6 +5165,11 @@
"node": ">= 0.6" "node": ">= 0.6"
} }
}, },
"node_modules/monaco-editor": {
"version": "0.15.6",
"resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.15.6.tgz",
"integrity": "sha512-JoU9V9k6KqT9R9Tiw1RTU8ohZ+Xnf9DMg6Ktqqw5hILumwmq7xqa/KLXw513uTUsWbhtnHoSJYYR++u3pkyxJg=="
},
"node_modules/ms": { "node_modules/ms": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
@ -11332,6 +11338,11 @@
"xtend": "^4.0.0" "xtend": "^4.0.0"
} }
}, },
"monaco-editor": {
"version": "0.15.6",
"resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.15.6.tgz",
"integrity": "sha512-JoU9V9k6KqT9R9Tiw1RTU8ohZ+Xnf9DMg6Ktqqw5hILumwmq7xqa/KLXw513uTUsWbhtnHoSJYYR++u3pkyxJg=="
},
"ms": { "ms": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",

View file

@ -19,6 +19,7 @@
"ace-builds": "^1.4.12", "ace-builds": "^1.4.12",
"bluebird": "^3.5.1", "bluebird": "^3.5.1",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"monaco-editor": "^0.15.6",
"prop-types": "^15.8.0", "prop-types": "^15.8.0",
"react": "^17.0.2", "react": "^17.0.2",
"react-autosuggest": "^10.1.0", "react-autosuggest": "^10.1.0",

1
resource/vs Symbolic link
View file

@ -0,0 +1 @@
../node_modules/monaco-editor/min/vs

View file

@ -14,7 +14,8 @@ const symlinkDirs = [
'chrome/content/zotero/xpcom/rdf', 'chrome/content/zotero/xpcom/rdf',
'chrome/content/zotero/xpcom/translate/src', 'chrome/content/zotero/xpcom/translate/src',
'styles', 'styles',
'translators' 'translators',
'resource/vs'
]; ];
// list of folders which are copied to the build folder // list of folders which are copied to the build folder