Fix "Copy as HTML" checkbox disabling in Quick Copy site editor window

This commit is contained in:
Dan Stillman 2014-08-12 21:32:53 -04:00
parent c729dc8a54
commit 38531ab172
2 changed files with 11 additions and 9 deletions

View file

@ -47,7 +47,7 @@ Zotero_Preferences.Export = {
var menulist = document.getElementById("zotero-quickCopy-menu");
menulist.setAttribute('preference', "pref-quickCopy-setting");
this.buildQuickCopyFormatDropDown(menulist, Zotero.QuickCopy.getContentType(format), format);
this.updateQuickCopyHTMLCheckbox();
this.updateQuickCopyHTMLCheckbox(document);
if (!Zotero.isStandalone) {
this.refreshQuickCopySiteList();
@ -91,7 +91,7 @@ Zotero_Preferences.Export = {
var itemNode = document.createElement("menuitem");
itemNode.setAttribute("value", val);
itemNode.setAttribute("label", style.title);
itemNode.setAttribute("oncommand", 'Zotero_Preferences.Export.updateQuickCopyHTMLCheckbox()');
itemNode.setAttribute("oncommand", 'Zotero_Preferences.Export.updateQuickCopyHTMLCheckbox(document)');
popup.appendChild(itemNode);
if (baseVal == currentFormat) {
@ -119,7 +119,7 @@ Zotero_Preferences.Export = {
var itemNode = document.createElement("menuitem");
itemNode.setAttribute("value", val);
itemNode.setAttribute("label", translators[i].label);
itemNode.setAttribute("oncommand", 'Zotero_Preferences.Export.updateQuickCopyHTMLCheckbox()');
itemNode.setAttribute("oncommand", 'Zotero_Preferences.Export.updateQuickCopyHTMLCheckbox(document)');
popup.appendChild(itemNode);
if (val == currentFormat) {
@ -133,11 +133,11 @@ Zotero_Preferences.Export = {
},
updateQuickCopyHTMLCheckbox: function () {
var format = document.getElementById('zotero-quickCopy-menu').value;
updateQuickCopyHTMLCheckbox: function (doc) {
var format = doc.getElementById('zotero-quickCopy-menu').value;
var mode, contentType;
var checkbox = document.getElementById('zotero-quickCopy-copyAsHTML');
var checkbox = doc.getElementById('zotero-quickCopy-copyAsHTML');
[mode, format] = format.split('=');
[mode, contentType] = mode.split('/');

View file

@ -39,6 +39,8 @@
<script>
<![CDATA[
var Zotero_Preferences = window.opener.Zotero_Preferences;
var Zotero_QuickCopySiteEditor = new function () {
this.onAccept = onAccept;
@ -60,7 +62,7 @@
<menulist id="zotero-quickCopy-menu"/>
<separator class="thin"/>
<checkbox id="zotero-quickCopy-copyAsHTML" label="&zotero.preferences.quickCopy.copyAsHTML;"
oncommand="window.opener.Zotero_Preferences.Export.buildQuickCopyFormatDropDown(
oncommand="Zotero_Preferences.Export.buildQuickCopyFormatDropDown(
document.getElementById('zotero-quickCopy-menu'), this.checked ? 'html' : ''
)"/>
</vbox>
@ -69,12 +71,12 @@
<![CDATA[
var io = window.arguments[0];
document.getElementById('zotero-quickCopy-domain').value = io.domain ? io.domain : '';
window.opener.Zotero_Preferences.Export.buildQuickCopyFormatDropDown(
Zotero_Preferences.Export.buildQuickCopyFormatDropDown(
document.getElementById('zotero-quickCopy-menu'),
Zotero.QuickCopy.getContentType(io.format),
io.format
);
window.opener.Zotero_Preferences.Export.updateQuickCopyHTMLCheckbox();
Zotero_Preferences.Export.updateQuickCopyHTMLCheckbox(document);
]]>
</script>
</dialog>