diff --git a/chrome/content/scaffold/content.js b/chrome/content/scaffold/content.js new file mode 100644 index 0000000000..c042dba1cb --- /dev/null +++ b/chrome/content/scaffold/content.js @@ -0,0 +1,15 @@ +addMessageListener('Scaffold:GetDocument', { + receiveMessage() { + dump('received document request\n') + sendAsyncMessage('Scaffold:Document', { + html: new XMLSerializer().serializeToString(content.document), + url: content.location.href + }); + } +}); + +function onLoad() { + sendAsyncMessage('Scaffold:Load', { url: content.location.href }); +} + +addEventListener('load', onLoad, true); diff --git a/chrome/content/scaffold/load.js b/chrome/content/scaffold/load.js index 62067c1455..6e1f54a277 100644 --- a/chrome/content/scaffold/load.js +++ b/chrome/content/scaffold/load.js @@ -24,12 +24,14 @@ */ var Scaffold_Load = new function() { - this.onLoad = Zotero.Promise.coroutine(function* () { + this.onLoad = async function () { + document.addEventListener('dialogaccept', () => this.accept()); + var listitem, translator, listcell, set; var listbox = document.getElementById("listbox"); listbox.addEventListener('dblclick', () => { - var translatorID = document.getElementById("listbox").selectedItem.getUserData("zotero-id"); + var translatorID = document.getElementById("listbox").selectedItem.dataset.zoteroID; if (!translatorID) return; this.accept(); window.close(); @@ -42,44 +44,48 @@ var Scaffold_Load = new function() { var url = window.arguments[0].url; var rootUrl = window.arguments[0].rootUrl url = Zotero.Proxies.proxyToProper(url); - translators["Matching Translators"] = (yield translatorProvider.getWebTranslatorsForLocation(url, rootUrl))[0]; - translators["Web Translators"] = (yield translatorProvider.getAllForType("web")) + translators["Matching Translators"] = (await translatorProvider.getWebTranslatorsForLocation(url, rootUrl))[0]; + translators["Web Translators"] = (await translatorProvider.getAllForType("web")) .sort((a, b) => a.label.localeCompare(b.label)); - translators["Import Translators"] = (yield translatorProvider.getAllForType("import")) + translators["Import Translators"] = (await translatorProvider.getAllForType("import")) .sort((a, b) => a.label.localeCompare(b.label)); - translators["Export Translators"] = (yield translatorProvider.getAllForType("export")) + translators["Export Translators"] = (await translatorProvider.getAllForType("export")) .sort((a, b) => a.label.localeCompare(b.label)); - translators["Search Translators"] = (yield translatorProvider.getAllForType("search")) + translators["Search Translators"] = (await translatorProvider.getAllForType("search")) .sort((a, b) => a.label.localeCompare(b.label)); for (set in translators) { // Make a separator - listitem = document.createElement("listitem"); + listitem = document.createXULElement("richlistitem"); listitem.setAttribute("disabled", true); - listitem.setAttribute("label", set); + // Need to set this to disable up/down keys selecting: + listitem.style.MozUserInput = 'none'; + listitem.append(set); listbox.appendChild(listitem); for (var j=0; j + - + @@ -100,10 +116,38 @@ - + - + @@ -139,19 +183,44 @@ - + - - + + - - - - - - - - + + + + + + + + + @@ -197,11 +266,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + label="&windowMenu.label;" + datasources="rdf:window-mediator" ref="NC:WindowMediatorRoot" + onpopupshowing="macWindowMenuDidShow();" + onpopuphidden="macWindowMenuDidHide();" + hidden="false"> + + + + + + + + @@ -251,88 +396,61 @@ - + - + - - - - - + + \ No newline at end of file + + diff --git a/chrome/content/zotero/standalone/standalone.js b/chrome/content/zotero/standalone/standalone.js index 1922f508d9..b0b091f71f 100644 --- a/chrome/content/zotero/standalone/standalone.js +++ b/chrome/content/zotero/standalone/standalone.js @@ -912,7 +912,7 @@ function openStyleEditor() { function openScaffold() { openWindowByType( - 'chrome://scaffold/content/scaffold.xul', + 'chrome://scaffold/content/scaffold.xhtml', 'zotero:scaffold', 'chrome,resizable' ); diff --git a/chrome/content/zotero/xpcom/cookieSandbox.js b/chrome/content/zotero/xpcom/cookieSandbox.js index 79f34daddf..ba7e151f50 100755 --- a/chrome/content/zotero/xpcom/cookieSandbox.js +++ b/chrome/content/zotero/xpcom/cookieSandbox.js @@ -164,7 +164,7 @@ Zotero.CookieSandbox.prototype = { * @param {nsIInterfaceRequestor} ir */ "attachToInterfaceRequestor": function(ir) { - Zotero.CookieSandbox.Observer.trackedInterfaceRequestors.push(Components.utils.getWeakReference(ir.QueryInterface(Components.interfaces.nsIInterfaceRequestor))); + Zotero.CookieSandbox.Observer.trackedInterfaceRequestors.push(Cu.getWeakReference(ir.getInterface(Ci.nsIInterfaceRequestor))); Zotero.CookieSandbox.Observer.trackedInterfaceRequestorSandboxes.push(this); }, diff --git a/chrome/skin/default/scaffold/scaffold.css b/chrome/skin/default/scaffold/scaffold.css index 3ce1c75c16..1c1cf58b0a 100644 --- a/chrome/skin/default/scaffold/scaffold.css +++ b/chrome/skin/default/scaffold/scaffold.css @@ -1,6 +1,3 @@ -@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); -@namespace html url("http://www.w3.org/1999/xhtml"); - #tb-new { list-style-image: url('chrome://scaffold/skin/new.png'); } @@ -53,11 +50,28 @@ list-style-image: url('chrome://scaffold/skin/add.png'); } -#tabpanel-metadata textbox { - height:2em; +#metadata-grid { + -moz-box-flex: 1; + display: grid; + align-content: start; + align-items: center; + grid-template-columns: max-content 1fr; } -#tabpanel-metadata hbox, #hbox-testFrame { +#metadata-grid > label:nth-child(2n + 1) { + justify-self: right; +} + +.button-row { + display: grid; + grid-template-columns: 1fr max-content; +} + +#tabpanel-metadata input { + height: 1.5em; +} + +#hbox-testFrame { -moz-box-align: center; } @@ -65,7 +79,7 @@ height:200px; } -listbox { +richlistbox { min-width:200px; } @@ -95,12 +109,50 @@ vbox > splitter { cursor: row-resize; } -listbox[disabled], toolbarbutton[disabled] { +/* Adapted from Mozilla common-shared.css */ +/* https://searchfox.org/mozilla-central/rev/2f5ed7b7244172d46f538051250b14fb4d8f1a5f/toolkit/themes/shared/in-content/common-shared.css */ + +select[size][multiple], +listheader, +richlistbox { + appearance: none; + margin-inline: 0; + background-color: #fff; + border: 1px solid #ccc; +} + +listheader { + padding-bottom: 1px; +} + +treecol { + appearance: none; + border: none; +} + +listheader + richlistbox { + margin-top: 0; + border-top: none; +} + +select[size][multiple] > option, +treechildren::-moz-tree-row { + padding: 0.3em; + margin: 0; + border: none; + background-image: none; +} + +richlistitem[selected] menulist:focus-visible { + outline-offset: -2px; +} + +richlistbox[disabled], toolbarbutton[disabled] { opacity: 0.6; pointer-events: none; } -dialog listbox > listitem[disabled] { +dialog richlistbox > richlistitem[disabled] { font-weight: 600; } @@ -110,12 +162,14 @@ dialog listbox > listitem[disabled] { #checkboxes-translatorType checkbox { margin-right: 10px; + display: inline-block; } #tabpanel-metadata label:first-child { text-align: right; } -.listcol-testMessage { - width: 200px; +#right-pane textarea { + margin-right: 5px; + margin-bottom: 5px; } diff --git a/chrome/skin/default/zotero/zotero.css b/chrome/skin/default/zotero/zotero.css index 0833746944..08c6de3883 100644 --- a/chrome/skin/default/zotero/zotero.css +++ b/chrome/skin/default/zotero/zotero.css @@ -111,7 +111,11 @@ zoterofilesyncstatus { richlistitem { padding: 0.2em 0.4em; +} + +richlistitem, richlistitem > * { overflow-x: hidden; + white-space: nowrap; text-overflow: ellipsis; }