mirror of
https://github.com/zotero/zotero.git
synced 2026-08-28 05:25:31 +00:00
Remove old citation dialogs (#5177)
- removed quickFormat, insertNoteDialog, and addCitationDialog .xhtml and .js files, since all of them are now replaced with new citationDialog - removed quickFormat and insertNote strings from en-US localization files - replaced all mentions of quickFormat in comments and variables of integration.js and editorInstance.js with citationDialog - removed big-sur-specific styling for quickFormat Closes #5046
This commit is contained in:
parent
b8ec6eb75e
commit
f1244d824c
16 changed files with 19 additions and 3676 deletions
|
|
@ -7,7 +7,6 @@ content zotero-platform chrome/content/zotero-platform/unix/ os=FreeBSD
|
|||
content zotero-platform chrome/content/zotero-platform/unix/ os=OpenBSD
|
||||
|
||||
content zotero-platform-version chrome/content/zotero-platform/default-version/
|
||||
content zotero-platform-version chrome/content/zotero-platform/mac-big-sur/ os=Darwin osversion>=11
|
||||
|
||||
resource zotero resource/
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
/* Quick Format dialog, which is based on window corners, which are different on Big Sur */
|
||||
#quick-format-iframe {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
|
@ -1,876 +0,0 @@
|
|||
/*
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
Copyright © 2009 Center for History and New Media
|
||||
George Mason University, Fairfax, Virginia, USA
|
||||
http://zotero.org
|
||||
|
||||
This file is part of Zotero.
|
||||
|
||||
Zotero is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Zotero is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
import { getCSSItemTypeIcon } from 'components/icons';
|
||||
|
||||
|
||||
window.isPristine = true;
|
||||
|
||||
var Zotero_Citation_Dialog = new function () {
|
||||
// Array value [0] is property name.
|
||||
// Array value [1] is default value of property.
|
||||
var _preserveData = {
|
||||
"prefix":["value", ""],
|
||||
"suffix":["value", ""],
|
||||
"label":["selectedIndex", 0],
|
||||
"locator":["value", ""],
|
||||
"suppress-author":["checked", false]
|
||||
};
|
||||
|
||||
var _accepted = false;
|
||||
var _itemData = new Object();
|
||||
var _multipleSourcesOn = false;
|
||||
var _lastSelected = null;
|
||||
var _previewShown = false;
|
||||
var _suppressNextTreeSelect = false;
|
||||
var _suppressNextListSelect = false;
|
||||
var _customHTML = false;
|
||||
var _locatorIndexArray = {};
|
||||
var _locatorNameArray = {};
|
||||
var _autoRegeneratePref;
|
||||
var _acceptButton;
|
||||
var _multipleSourceButton;
|
||||
var _sortCheckbox;
|
||||
var _citationList;
|
||||
var _originalHTML;
|
||||
var _editor;
|
||||
var serial_number;
|
||||
var io;
|
||||
|
||||
this.toggleMultipleSources = toggleMultipleSources;
|
||||
this.toggleEditor = toggleEditor;
|
||||
this.treeItemSelected = treeItemSelected;
|
||||
this.listItemSelected = listItemSelected;
|
||||
this.up = up;
|
||||
this.down = down;
|
||||
this.remove = remove;
|
||||
this.setSortToggle = setSortToggle;
|
||||
this.confirmRegenerate = confirmRegenerate;
|
||||
this.accept = accept;
|
||||
this.cancel = cancel;
|
||||
|
||||
/*
|
||||
* initialize add citation dialog
|
||||
*/
|
||||
this.load = Zotero.Promise.coroutine(function* () {
|
||||
// make sure we are visible
|
||||
window.setTimeout(async function () {
|
||||
let screenX = window.screenX, screenY = window.screenY, i = 5;
|
||||
while (!screenX && i--) {
|
||||
await new Promise(resolve => window.requestAnimationFrame(resolve));
|
||||
screenX = window.screenX;
|
||||
screenY = window.screenY;
|
||||
}
|
||||
var xRange = [window.screen.availLeft, window.screen.left + window.screen.width - window.outerWidth];
|
||||
var yRange = [window.screen.availTop, window.screen.top + window.screen.height - window.outerHeight];
|
||||
if(screenX < xRange[0] || screenX > xRange[1] || screenY < yRange[0] || screenY > yRange[1]) {
|
||||
var targetX = Math.max(Math.min(screenX, xRange[1]), xRange[0]);
|
||||
var targetY = Math.max(Math.min(screenY, yRange[1]), yRange[0]);
|
||||
Zotero.debug(`Moving window to ${targetX}, ${targetY}`);
|
||||
window.moveTo(targetX, targetY);
|
||||
}
|
||||
}, 0);
|
||||
|
||||
|
||||
io = window.arguments[0].wrappedJSObject;
|
||||
|
||||
// find accept button
|
||||
_acceptButton = document.querySelector('dialog').getButton("accept");
|
||||
_multipleSourceButton = document.querySelector('dialog').getButton("extra1");
|
||||
_multipleSourceButton.label = Zotero.getString("citation.multipleSources")
|
||||
document.querySelector('dialog').getButton("extra2").label = Zotero.getString("citation.showEditor");
|
||||
_autoRegeneratePref = Zotero.Prefs.get("integration.autoRegenerate");
|
||||
_citationList = document.getElementById("item-list");
|
||||
|
||||
window.addEventListener('dialogaccept', () => Zotero_Citation_Dialog.accept());
|
||||
window.addEventListener('dialogcancel', () => Zotero_Citation_Dialog.cancel());
|
||||
window.addEventListener('dialogextra1', () => Zotero_Citation_Dialog.toggleMultipleSources());
|
||||
window.addEventListener('dialogextra2', () => Zotero_Citation_Dialog.toggleEditor());
|
||||
|
||||
// Manipulated by _addItem(). Discriminates between cite instances
|
||||
// based on the same item in the same citation. Internal throwaway variable,
|
||||
// reset each time _multipleSourcesOn is set to true.
|
||||
serial_number = 0;
|
||||
|
||||
// if a style with sortable citations, present checkbox
|
||||
if(io.sortable) {
|
||||
_sortCheckbox = document.getElementById("keepSorted");
|
||||
_sortCheckbox.hidden = false;
|
||||
_sortCheckbox.checked = !io.citation.properties.unsorted;
|
||||
}
|
||||
|
||||
// load locators
|
||||
var locators = Zotero.Cite.labels;
|
||||
var menu = document.getElementById("label");
|
||||
var label_list = document.getElementById("locator-type-popup");
|
||||
var i = 0;
|
||||
var pageLocatorIndex;
|
||||
for(var value in locators) {
|
||||
var locator = locators[value];
|
||||
let locatorLabel = Zotero.Cite.getLocatorString(locator);
|
||||
// add to list of labels
|
||||
var child = document.createXULElement("menuitem");
|
||||
child.setAttribute("value", value);
|
||||
child.setAttribute("label", locatorLabel);
|
||||
label_list.appendChild(child);
|
||||
// add to array
|
||||
_locatorIndexArray[locator] = i;
|
||||
_locatorNameArray[i] = locator;
|
||||
if (locator == 'page') {
|
||||
pageLocatorIndex = i;
|
||||
_preserveData.label[1] = i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
menu.selectedIndex = pageLocatorIndex;
|
||||
|
||||
if (!io.itemTreeID) {
|
||||
io.itemTreeID = "add-citation-select-item-dialog";
|
||||
}
|
||||
|
||||
// load (from selectItemsDialog.js)
|
||||
yield doLoad();
|
||||
|
||||
// if we already have a citation, load data from it
|
||||
_editor = document.querySelector('#editor').contentWindow.editor;
|
||||
if(io.citation.citationItems.length) {
|
||||
if(io.citation.citationItems.length === 1) {
|
||||
// single citation
|
||||
toggleMultipleSources(false);
|
||||
_suppressNextTreeSelect = true;
|
||||
|
||||
// DEBUG: When editing a citation before the library data has been loaded (i.e., in
|
||||
// Firefox before the pane has been opened), this is the citation id, not the item id,
|
||||
// and this fails. It works on subsequent attempts. Since this won't happen in
|
||||
// Standalone, we can ignore.
|
||||
var id = io.citation.citationItems[0].id;
|
||||
let selected = yield collectionsView.selectItem(id);
|
||||
|
||||
for(var box in _preserveData) {
|
||||
var property = _preserveData[box][0];
|
||||
if(io.citation.citationItems[0][box]) {
|
||||
if(box === "label") {
|
||||
document.getElementById(box)[property] = _locatorIndexArray[io.citation.citationItems[0][box]];
|
||||
} else {
|
||||
document.getElementById(box)[property] = io.citation.citationItems[0][box];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// multiple citations
|
||||
toggleMultipleSources(true);
|
||||
var _itemData = {};
|
||||
// There is a little thrashing here, with repeated writes and
|
||||
// overwrites of node content. But sticking to the same
|
||||
// workflow for all updates (node -> array -> io.citation) makes
|
||||
// debugging a little less painful.
|
||||
for(var i=0; i<io.citation.citationItems.length; i++) {
|
||||
var item = Zotero.Items.get(io.citation.citationItems[i].id);
|
||||
if(item) {
|
||||
var itemNode = _addItem(item);
|
||||
var itemDataID = itemNode.getAttribute("value");
|
||||
_itemData[itemDataID] = {};
|
||||
for(var box in _preserveData) {
|
||||
var domBox = document.getElementById(box);
|
||||
var property = _preserveData[box][0];
|
||||
if("undefined" !== typeof io.citation.citationItems[i][box]) {
|
||||
if(box === "label") {
|
||||
domBox[property] = _locatorIndexArray[io.citation.citationItems[i][box]];
|
||||
} else {
|
||||
domBox[property] = io.citation.citationItems[i][box];
|
||||
}
|
||||
} else {
|
||||
domBox[property] = _preserveData[box][1];
|
||||
}
|
||||
}
|
||||
_itemSelected(itemDataID, true);
|
||||
}
|
||||
}
|
||||
for (var box in _preserveData) {
|
||||
document.getElementById(box).disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// show user-editable edited citation
|
||||
if(io.citation.properties.custom) {
|
||||
toggleEditor(io.citation.properties.custom);
|
||||
delete io.citation.properties.custom;
|
||||
}
|
||||
|
||||
_updateAccept();
|
||||
} else {
|
||||
toggleMultipleSources(false);
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* turn on/off multiple sources item list
|
||||
*/
|
||||
function toggleMultipleSources(mode) {
|
||||
if (mode === false || mode === true) {
|
||||
_multipleSourcesOn = !mode;
|
||||
}
|
||||
_multipleSourcesOn = !_multipleSourcesOn;
|
||||
var popup = document.defaultView;
|
||||
var dialog = document.documentElement;
|
||||
if (dialog.getAttribute("height") == 1) {
|
||||
popup.sizeToContent();
|
||||
}
|
||||
if(_multipleSourcesOn) {
|
||||
_multipleSourceButton.label = Zotero.getString("citation.singleSource");
|
||||
document.getElementById("multiple-sources").setAttribute("hidden", false);
|
||||
if(dialog.getAttribute("width") <= 600) {
|
||||
popup.resizeTo(750, dialog.getAttribute("height"));
|
||||
}
|
||||
//popup.moveBy((600 - 750)/2, 0);
|
||||
|
||||
serial_number = 0;
|
||||
|
||||
|
||||
// The mode is forced only when run from load(), in which case
|
||||
// the adding of items is done separately.
|
||||
if (mode !== true) {
|
||||
this.add(true);
|
||||
}
|
||||
} else {
|
||||
_multipleSourceButton.label = Zotero.getString("citation.multipleSources");
|
||||
document.getElementById("multiple-sources").setAttribute("hidden", true);
|
||||
//popup.resizeTo(600, dialog.getAttribute("height"));
|
||||
//popup.moveBy((750 - 600)/2, 0);
|
||||
|
||||
// enable all fields
|
||||
for(var box in _preserveData) {
|
||||
document.getElementById(box).disabled = false;
|
||||
}
|
||||
|
||||
var itemID = false;
|
||||
if (_citationList.selectedIndex > -1) {
|
||||
var itemDataID = _citationList.getSelectedItem(0).getAttribute("value");
|
||||
itemID = itemDataID.slice(0, itemDataID.indexOf(":"));
|
||||
}
|
||||
|
||||
// delete item list
|
||||
_itemData = new Object();
|
||||
|
||||
// delete all items
|
||||
_clearCitationList();
|
||||
|
||||
// refresh
|
||||
if (itemID) {
|
||||
collectionsView.selectItem(itemID);
|
||||
}
|
||||
_updateAccept();
|
||||
_updatePreview();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* called when an item in the item selection tree is clicked
|
||||
*/
|
||||
function treeItemSelected() {
|
||||
if(_suppressNextTreeSelect) {
|
||||
_suppressNextTreeSelect = false;
|
||||
_updateAccept();
|
||||
return;
|
||||
}
|
||||
var items = itemsView.getSelectedItems(true); // treeview from xpcom/itemTreeView.js
|
||||
var itemID = (items.length ? items[0] : false);
|
||||
|
||||
if(_multipleSourcesOn) {
|
||||
// We can safely use itemID here, because none of these operations
|
||||
// affect selected items; this is all about the tree and navigation.
|
||||
|
||||
// turn off highlight in selected item list
|
||||
_suppressNextListSelect = true;
|
||||
document.getElementById("item-list").selectedIndex = -1;
|
||||
|
||||
// disable all fields
|
||||
|
||||
for(var box in _preserveData) {
|
||||
document.getElementById(box).disabled = true;
|
||||
}
|
||||
|
||||
// disable adding nothing
|
||||
document.getElementById("add").disabled = !itemID;
|
||||
document.getElementById("remove").disabled = true;
|
||||
document.getElementById("up").disabled = true;
|
||||
document.getElementById("down").disabled = true;
|
||||
} else {
|
||||
for(var box in _preserveData) {
|
||||
document.getElementById(box).disabled = !itemID;
|
||||
}
|
||||
_updateAccept();
|
||||
_updatePreview();
|
||||
window.isPristine = false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* called when an item in the selected items list is clicked
|
||||
*/
|
||||
function listItemSelected() {
|
||||
if(_suppressNextListSelect) {
|
||||
_suppressNextListSelect = false;
|
||||
_updateAccept();
|
||||
return;
|
||||
}
|
||||
var selectedListItem = _citationList.getSelectedItem(0);
|
||||
var selectedListIndex = _citationList.selectedIndex;
|
||||
var itemDataID = (selectedListItem ? selectedListItem.getAttribute("value") : false);
|
||||
_itemSelected(itemDataID);
|
||||
// turn off highlight in item tree
|
||||
_suppressNextTreeSelect = true;
|
||||
itemsView.selection.clearSelection();
|
||||
document.getElementById("remove").disabled = !itemDataID;
|
||||
document.getElementById("add").disabled = true;
|
||||
_configListPosition(!itemDataID, selectedListIndex);
|
||||
}
|
||||
|
||||
function _configListPosition(flag, selectedListIndex) {
|
||||
if (selectedListIndex > 0) {
|
||||
document.getElementById("up").disabled = flag;
|
||||
} else {
|
||||
document.getElementById("up").disabled = true;
|
||||
}
|
||||
if (-1 < selectedListIndex && selectedListIndex < (_citationList.getRowCount() - 1)) {
|
||||
document.getElementById("down").disabled = flag;
|
||||
} else {
|
||||
document.getElementById("down").disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
function _move(direction) {
|
||||
// automatically uncheck sorted checkbox if user is rearranging citation
|
||||
if(_sortCheckbox && _sortCheckbox.checked) {
|
||||
_sortCheckbox.checked = false;
|
||||
setSortToggle();
|
||||
}
|
||||
|
||||
var insertBeforeItem;
|
||||
var selectedListItem = _citationList.getSelectedItem(0);
|
||||
var selectedListIndex = _citationList.selectedIndex;
|
||||
var itemDataID = selectedListItem.getAttribute("value");
|
||||
if (direction === -1) {
|
||||
insertBeforeItem = selectedListItem.previousSibling;
|
||||
} else {
|
||||
insertBeforeItem = selectedListItem.nextSibling.nextSibling;
|
||||
}
|
||||
var listItem = _citationList.removeChild(selectedListItem);
|
||||
_citationList.insertBefore(listItem, insertBeforeItem);
|
||||
_citationList.selectedIndex = (selectedListIndex + direction);
|
||||
_itemSelected(itemDataID);
|
||||
_updatePreview();
|
||||
_configListPosition(false, (selectedListIndex + direction));
|
||||
window.isPristine = false;
|
||||
}
|
||||
|
||||
function up() {
|
||||
_move(-1);
|
||||
}
|
||||
|
||||
function down() {
|
||||
_move(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds an item to the multipleSources list
|
||||
*/
|
||||
this.add = Zotero.Promise.coroutine(function* (first_item) {
|
||||
var pos, len;
|
||||
var items = itemsView.getSelectedItems(); // treeview from xpcom/itemTreeView.js
|
||||
window.isPristine = false;
|
||||
|
||||
if (!items.length) {
|
||||
yield sortCitation();
|
||||
_updateAccept();
|
||||
_updatePreview();
|
||||
return;
|
||||
}
|
||||
|
||||
// Add to selection list and generate a new itemDataID for this cite.
|
||||
for (let item of items) {
|
||||
var selectionNode = _addItem(item);
|
||||
var itemDataID = selectionNode.getAttribute("value");
|
||||
document.getElementById("add").disabled = !itemDataID;
|
||||
}
|
||||
|
||||
// Save existing locator and affix field content, if any.
|
||||
if (first_item) {
|
||||
_itemSelected(itemDataID, true);
|
||||
} else {
|
||||
_itemSelected();
|
||||
// set to defaults
|
||||
for(var box in _preserveData) {
|
||||
var property = _preserveData[box][0];
|
||||
var default_value = _preserveData[box][1];
|
||||
document.getElementById(box)[property] = default_value;
|
||||
}
|
||||
// Save default locator and affix element values to this multi-item.
|
||||
_itemSelected(itemDataID, true);
|
||||
}
|
||||
|
||||
for(var box in _preserveData) {
|
||||
document.getElementById(box).disabled = true;
|
||||
}
|
||||
|
||||
_citationList.ensureElementIsVisible(selectionNode);
|
||||
|
||||
// allow user to press OK
|
||||
selectionNode = yield sortCitation(selectionNode);
|
||||
_citationList.selectItem(selectionNode);
|
||||
_updateAccept();
|
||||
_updatePreview();
|
||||
});
|
||||
|
||||
/*
|
||||
* Deletes a citation from the multipleSources list
|
||||
*/
|
||||
function remove() {
|
||||
var selectedListItem = _citationList.getSelectedItem(0);
|
||||
var selectedListIndex = _citationList.selectedIndex;
|
||||
var itemDataID = selectedListItem.getAttribute("value");
|
||||
|
||||
// remove from _itemData
|
||||
delete _itemData[itemDataID];
|
||||
_itemData[itemDataID] = undefined;
|
||||
_lastSelected = null;
|
||||
|
||||
// remove from list
|
||||
_citationList.removeChild(selectedListItem);
|
||||
|
||||
if (selectedListIndex >= _citationList.getRowCount()) {
|
||||
selectedListIndex = _citationList.getRowCount() - 1;
|
||||
}
|
||||
_citationList.selectedIndex = selectedListIndex;
|
||||
|
||||
_updateAccept();
|
||||
_updatePreview();
|
||||
window.isPristine = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sorts preview citations, if preview is open.
|
||||
*/
|
||||
this.citationSortUnsort = Zotero.Promise.coroutine(function* () {
|
||||
setSortToggle();
|
||||
yield sortCitation();
|
||||
_updatePreview();
|
||||
});
|
||||
|
||||
/*
|
||||
* Sets the current sort toggle state persistently on the citation.
|
||||
*/
|
||||
function setSortToggle() {
|
||||
if(!_sortCheckbox) return;
|
||||
if(!_sortCheckbox.checked) {
|
||||
io.citation.properties.unsorted = true;
|
||||
} else {
|
||||
io.citation.properties.unsorted = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sorts the list of citations
|
||||
*/
|
||||
var sortCitation = Zotero.Promise.coroutine(function* (scrollToItem) {
|
||||
if(!_sortCheckbox) return scrollToItem;
|
||||
if(!_sortCheckbox.checked) {
|
||||
io.citation.properties.unsorted = true;
|
||||
return scrollToItem;
|
||||
}
|
||||
var scrollToItemID = false;
|
||||
if (scrollToItem) {
|
||||
scrollToItemID = scrollToItem.getAttribute("value");
|
||||
}
|
||||
_getCitation();
|
||||
|
||||
// delete all existing items from list
|
||||
_clearCitationList();
|
||||
|
||||
// run preview function to re-sort, if it hasn't already been
|
||||
// run
|
||||
yield io.sort();
|
||||
|
||||
// add items back to list
|
||||
scrollToItem = null;
|
||||
for(var i=0; i<io.citation.sortedItems.length; i++) {
|
||||
var itemID = io.citation.sortedItems[i][0].id;
|
||||
var itemDataID = io.citation.sortedItems[i][1].tmpItemDataID;
|
||||
var item = Zotero.Items.get(itemID);
|
||||
// Don't increment serial_number, and use the
|
||||
// existing itemDataID stored on the item in sortedItems
|
||||
var itemNode = _addItem(item, itemDataID);
|
||||
if(itemDataID == scrollToItemID) _citationList.selectedIndex = i;
|
||||
if(scrollToItemID && itemDataID == scrollToItemID) scrollToItem = itemNode;
|
||||
}
|
||||
|
||||
if(scrollToItem) _citationList.ensureElementIsVisible(scrollToItem);
|
||||
return scrollToItem;
|
||||
});
|
||||
|
||||
/*
|
||||
* Ask whether to modify the preview
|
||||
*/
|
||||
function confirmRegenerate(focusShifted) {
|
||||
if(_editor.getContent() == _originalHTML || _originalHTML === undefined) {
|
||||
// no changes; just update without asking
|
||||
_updatePreview();
|
||||
return;
|
||||
}
|
||||
|
||||
if(_autoRegeneratePref == -1) {
|
||||
if(focusShifted) { // only ask after onchange event; oninput is too
|
||||
// frequent for this to be worthwhile
|
||||
var promptService = Services.prompt;
|
||||
|
||||
var saveBehavior = { value: false };
|
||||
var regenerate = promptService.confirmEx(
|
||||
this.window,
|
||||
Zotero.getString('integration.regenerate.title'),
|
||||
Zotero.getString('integration.regenerate.body'),
|
||||
promptService.STD_YES_NO_BUTTONS,
|
||||
null, null, null,
|
||||
Zotero.getString('integration.regenerate.saveBehavior'),
|
||||
saveBehavior
|
||||
);
|
||||
|
||||
if(saveBehavior.value) {
|
||||
_autoRegeneratePref = (regenerate == 0 ? 1 : 0);
|
||||
Zotero.Prefs.set("integration.autoRegenerate", _autoRegeneratePref);
|
||||
}
|
||||
|
||||
if(regenerate == 0) {
|
||||
_updatePreview();
|
||||
}
|
||||
}
|
||||
} else if(_autoRegeneratePref == 1) {
|
||||
_updatePreview();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Shows the edit pane
|
||||
*/
|
||||
function toggleEditor(text) {
|
||||
var warning = document.getElementById('zotero-editor-warning');
|
||||
var editor = document.getElementById('editor');
|
||||
warning.hidden = _previewShown;
|
||||
editor.hidden = _previewShown;
|
||||
_previewShown = !_previewShown;
|
||||
|
||||
if(_previewShown) {
|
||||
document.querySelector('dialog').getButton("extra2").label = Zotero.getString("citation.hideEditor");
|
||||
if (!text && _customHTML) {
|
||||
text = _customHTML;
|
||||
}
|
||||
if(text) {
|
||||
io.preview().then(function(preview) {
|
||||
_originalHTML = preview;
|
||||
_editor.setContent(text, true);
|
||||
}).done();
|
||||
} else {
|
||||
_updatePreview();
|
||||
}
|
||||
} else {
|
||||
_customHTML = _editor.getContent(true);
|
||||
document.querySelector('dialog').getButton("extra2").label = Zotero.getString("citation.showEditor");
|
||||
}
|
||||
// To resize virtualized-tables
|
||||
window.dispatchEvent(new Event('resize'));
|
||||
}
|
||||
|
||||
/*
|
||||
* called when accept button is clicked
|
||||
*/
|
||||
function accept() {
|
||||
if(_accepted) return true;
|
||||
|
||||
_getCitation();
|
||||
var isCustom = _previewShown && io.citation.citationItems.length // if a citation is selected
|
||||
&& _originalHTML
|
||||
&& _editor.getContent(true) != _originalHTML // and citation has been edited
|
||||
|
||||
if(isCustom) {
|
||||
var citation = _editor.getContent(true);
|
||||
if(Zotero.Utilities.trim(citation) == "") {
|
||||
var promptService = Services.prompt;
|
||||
var insert = promptService.confirm(window,
|
||||
Zotero.getString("integration.emptyCitationWarning.title"),
|
||||
Zotero.getString("integration.emptyCitationWarning.body"));
|
||||
if(!insert) return false;
|
||||
}
|
||||
io.citation.properties.custom = citation;
|
||||
}
|
||||
|
||||
if (io.citation.citationItems.length) {
|
||||
for (let item of io.citation.citationItems) {
|
||||
if (Zotero.Retractions.isRetracted({ id: parseInt(item.id) })) {
|
||||
if (Zotero.Retractions.shouldShowCitationWarning({ id: parseInt(item.id) })) {
|
||||
var ps = Services.prompt;
|
||||
var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING
|
||||
+ ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL
|
||||
+ ps.BUTTON_POS_2 * ps.BUTTON_TITLE_IS_STRING;
|
||||
var checkbox = { value: false };
|
||||
var result = ps.confirmEx(null,
|
||||
Zotero.getString('general.warning'),
|
||||
Zotero.getString('retraction.citeWarning.text1') + '\n\n'
|
||||
+ Zotero.getString('retraction.citeWarning.text2'),
|
||||
buttonFlags,
|
||||
Zotero.getString('general.continue'),
|
||||
null,
|
||||
Zotero.getString('pane.items.showItemInLibrary'),
|
||||
Zotero.getString('retraction.citationWarning.dontWarn'), checkbox);
|
||||
if (result > 0) {
|
||||
if (result == 2) {
|
||||
_showItemInLibrary(parseInt(item.id));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (checkbox.value) {
|
||||
Zotero.Retractions.disableCitationWarningsForItem({ id: parseInt(item.id) });
|
||||
}
|
||||
}
|
||||
item.ignoreRetraction = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
io.accept();
|
||||
_accepted = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* called when cancel button is clicked
|
||||
*/
|
||||
function cancel() {
|
||||
if(_accepted) return true;
|
||||
io.cancel();
|
||||
_accepted = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Updates the contents of the preview pane
|
||||
*/
|
||||
function _updatePreview() {
|
||||
if(_previewShown) {
|
||||
_getCitation();
|
||||
|
||||
_editor.setEnabled(io.citation.citationItems.length);
|
||||
if (io.citation.citationItems.length) {
|
||||
io.preview().then((preview) => {
|
||||
_editor.setContent(preview, true);
|
||||
|
||||
_originalHTML = _editor.getContent(true);
|
||||
});
|
||||
} else {
|
||||
_editor.setContent("");
|
||||
_originalHTML = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Controls whether the accept (OK) button should be enabled
|
||||
*/
|
||||
function _updateAccept() {
|
||||
if(_multipleSourcesOn) {
|
||||
_acceptButton.disabled = !_citationList.getRowCount();
|
||||
// To prevent accidental data loss, do not allow change to
|
||||
// single citation mode if multiple items are in selection
|
||||
// list.
|
||||
if (_citationList.getRowCount() > 1) {
|
||||
_multipleSourceButton.disabled = true;
|
||||
} else {
|
||||
_multipleSourceButton.disabled = false;
|
||||
}
|
||||
} else {
|
||||
collectionsView.onLoad.addListener(Zotero.Promise.coroutine(function* () {
|
||||
if (itemsView) {
|
||||
yield itemsView.waitForLoad();
|
||||
_acceptButton.disabled = !itemsView.getSelectedItems().length;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* called when an item is selected; if itemDataID is false, disables fields; if
|
||||
* itemDataID is undefined, only updates _itemData array
|
||||
*
|
||||
* Note: This function no longer disables fields. That operation is
|
||||
* now performed separately by explicit code.
|
||||
*/
|
||||
function _itemSelected(itemDataID, forceSave) {
|
||||
|
||||
if (forceSave) {
|
||||
_lastSelected = itemDataID;
|
||||
}
|
||||
|
||||
if(_lastSelected && !_itemData[_lastSelected]) {
|
||||
_itemData[_lastSelected] = new Object();
|
||||
}
|
||||
|
||||
for(var box in _preserveData) {
|
||||
var domBox = document.getElementById(box);
|
||||
var property = _preserveData[box][0];
|
||||
|
||||
// save property
|
||||
if(_lastSelected) {
|
||||
if(property == "label") {
|
||||
_itemData[_lastSelected][box] = _locatorNameArray[domBox.selectedIndex];
|
||||
} else {
|
||||
_itemData[_lastSelected][box] = domBox[property];
|
||||
}
|
||||
}
|
||||
// restore previous property
|
||||
if(itemDataID) {
|
||||
domBox.disabled = false;
|
||||
if(_itemData[itemDataID] && _itemData[itemDataID][box] !== undefined) {
|
||||
if(property == "label") {
|
||||
domBox[property] = _locatorIndexArray[_itemData[itemDataID][box]];
|
||||
} else {
|
||||
domBox[property] = _itemData[itemDataID][box];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(itemDataID !== undefined) _lastSelected = itemDataID;
|
||||
}
|
||||
|
||||
/*
|
||||
* updates io.citation to reflect selected items
|
||||
*/
|
||||
function _getCitation() {
|
||||
var key;
|
||||
io.citation.citationItems = new Array();
|
||||
|
||||
// use to map selectedIndexes back to page/paragraph/line
|
||||
var locatorTypeElements = document.getElementById("label").getElementsByTagName("menuitem");
|
||||
if(_multipleSourcesOn) {
|
||||
_itemSelected(); // store locator info
|
||||
var listLength = _citationList.getRowCount();
|
||||
if(listLength) {
|
||||
// generate citationItems
|
||||
for(var i=0; i<listLength; i++) {
|
||||
var itemDataID = _citationList.getItemAtIndex(i).getAttribute("value");
|
||||
var citationItem = {};
|
||||
for (key in _itemData[itemDataID]) {
|
||||
// label is special everywhere
|
||||
if (key === "label") {
|
||||
citationItem.label = _locatorNameArray[_itemData[itemDataID].label];
|
||||
} else if (_itemData[itemDataID][key]) {
|
||||
citationItem[key] = _itemData[itemDataID][key];
|
||||
}
|
||||
}
|
||||
citationItem["tmpItemDataID"] = itemDataID;
|
||||
var itemID = itemDataID.slice(0, itemDataID.indexOf(":"));
|
||||
citationItem.id = itemID;
|
||||
io.citation.citationItems.push(citationItem);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var items = itemsView.getSelectedItems(true); // treeview from xpcom/itemTreeView.js
|
||||
|
||||
if(items.length) {
|
||||
var citationItem = {};
|
||||
citationItem.id = items[0];
|
||||
for(var box in _preserveData) {
|
||||
var property = _preserveData[box][0];
|
||||
if(box == "label") {
|
||||
citationItem[box] = _locatorNameArray[document.getElementById(box).selectedIndex];
|
||||
} else {
|
||||
var prop = document.getElementById(box)[property];
|
||||
if(prop !== "" && prop !== false) citationItem[box] = prop;
|
||||
}
|
||||
}
|
||||
|
||||
if(!citationItem["locator"]) {
|
||||
delete citationItem["locator"];
|
||||
delete citationItem["label"];
|
||||
}
|
||||
|
||||
io.citation.citationItems = [citationItem];
|
||||
} else {
|
||||
io.citation.citationItems = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Add an item to the item list (multiple sources only)
|
||||
*/
|
||||
function _addItem(item, forceID) {
|
||||
var itemNode = document.createXULElement("richlistitem");
|
||||
|
||||
var itemDataID;
|
||||
if (!forceID) {
|
||||
serial_number += 1;
|
||||
itemDataID = item.id + ":" + serial_number;
|
||||
} else {
|
||||
itemDataID = forceID;
|
||||
}
|
||||
|
||||
itemNode.setAttribute("value", itemDataID);
|
||||
let image = getCSSItemTypeIcon(item.getItemTypeIconName());
|
||||
itemNode.append(image);
|
||||
itemNode.setAttribute("class", "listitem-iconic");
|
||||
itemNode.append(item.getDisplayTitle());
|
||||
_citationList.appendChild(itemNode);
|
||||
return itemNode;
|
||||
}
|
||||
|
||||
/*
|
||||
* Removes all items from the multiple sources list
|
||||
*/
|
||||
function _clearCitationList() {
|
||||
while(_citationList.firstChild) _citationList.removeChild(_citationList.firstChild);
|
||||
}
|
||||
|
||||
async function _showItemInLibrary(id) {
|
||||
var pane = Zotero.getActiveZoteroPane();
|
||||
// Open main window if it's not open (Mac)
|
||||
if (!pane) {
|
||||
let win = Zotero.openMainWindow();
|
||||
await new Zotero.Promise((resolve) => {
|
||||
let onOpen = function () {
|
||||
win.removeEventListener('load', onOpen);
|
||||
resolve();
|
||||
};
|
||||
win.addEventListener('load', onOpen);
|
||||
});
|
||||
pane = win.ZoteroPane;
|
||||
}
|
||||
pane.selectItem(id);
|
||||
|
||||
// Pull window to foreground
|
||||
Zotero.Utilities.Internal.activate(pane.document.defaultView);
|
||||
}
|
||||
}
|
||||
|
||||
window.cancel = Zotero_Citation_Dialog.cancel;
|
||||
|
|
@ -1,129 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
Copyright © 2009 Center for History and New Media
|
||||
George Mason University, Fairfax, Virginia, USA
|
||||
http://zotero.org
|
||||
|
||||
This file is part of Zotero.
|
||||
|
||||
Zotero is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Zotero is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***** END LICENSE BLOCK *****
|
||||
-->
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/dialog.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://zotero/skin/zotero.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/zotero.css"?>
|
||||
<?xml-stylesheet href="chrome://zotero/skin/integration.css" type="text/css"?>
|
||||
<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd">
|
||||
|
||||
<window
|
||||
id="add-citation-dialog"
|
||||
class="contain-richlistbox"
|
||||
windowtype="zotero:item-selector"
|
||||
orient="vertical"
|
||||
title="&zotero.integration.addEditCitation.title;"
|
||||
onload="Zotero_Citation_Dialog.load();"
|
||||
onunload="doUnload();"
|
||||
onclose="Zotero_Citation_Dialog.cancel();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
persist="screenX screenY width height">
|
||||
<dialog
|
||||
id="zotero-add-citation-dialog"
|
||||
buttons="extra1,extra2,accept,cancel">
|
||||
|
||||
<script>
|
||||
|
||||
Services.scriptloader.loadSubScript("chrome://zotero/content/include.js", this);
|
||||
|
||||
// Custom elements
|
||||
Services.scriptloader.loadSubScript("chrome://zotero/content/customElements.js", this);
|
||||
|
||||
Services.scriptloader.loadSubScript("chrome://zotero/content/selectItemsDialog.js", this);
|
||||
Services.scriptloader.loadSubScript("chrome://zotero/content/integration/addCitationDialog.js", this);
|
||||
</script>
|
||||
|
||||
|
||||
<vbox id="zotero-select-items-container" flex="1">
|
||||
<hbox flex="1">
|
||||
<vbox align="stretch" flex="1" style="min-width: 500px">
|
||||
<hbox align="center" pack="end">
|
||||
<quick-search-textbox id="zotero-tb-search" timeout="250" oncommand="onSearch()" dir="reverse"/>
|
||||
</hbox>
|
||||
<hbox flex="1" style="margin-top: 5px">
|
||||
<vbox id="zotero-collections-tree-container" class="virtualized-table-container" style="min-width: 200px; min-height: 100%;">
|
||||
<html:div id="zotero-collections-tree"></html:div>
|
||||
</vbox>
|
||||
|
||||
<hbox id="zotero-items-pane-content" class="virtualized-table-container" flex="1" style="width: 100%; min-height: 100%;">
|
||||
<html:div id="zotero-items-tree"></html:div>
|
||||
</hbox>
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
||||
<hbox hidden="true" id="multiple-sources" align="stretch">
|
||||
<vbox align="center" pack="center" id="citation-buttons">
|
||||
<toolbarbutton id="up" oncommand="Zotero_Citation_Dialog.up()" disabled="true"/>
|
||||
<toolbarbutton id="add" oncommand="Zotero_Citation_Dialog.add()" disabled="true"/>
|
||||
<toolbarbutton id="remove" oncommand="Zotero_Citation_Dialog.remove()" disabled="true"/>
|
||||
<toolbarbutton id="down" oncommand="Zotero_Citation_Dialog.down()" disabled="true"/>
|
||||
</vbox>
|
||||
<vbox align="left">
|
||||
<checkbox id="keepSorted" hidden="true" checked="false" oncommand="Zotero_Citation_Dialog.citationSortUnsort()" label="&zotero.citation.keepSorted.label;" native="true"/>
|
||||
<richlistbox id="item-list" flex="1" align="stretch" seltype="single" style="width: 250px;"
|
||||
onselect="Zotero_Citation_Dialog.listItemSelected();"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</hbox>
|
||||
|
||||
<hbox align="stretch" style="margin-top: 8px">
|
||||
<vbox flex="1">
|
||||
<hbox align="center">
|
||||
<label value="&zotero.citation.prefix.label;" control="prefix"/>
|
||||
<html:input type="text" class="fix" id="prefix" tabindex="0"
|
||||
oninput="Zotero_Citation_Dialog.confirmRegenerate(false)"
|
||||
onchange="Zotero_Citation_Dialog.confirmRegenerate(true)"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<label value="&zotero.citation.suffix.label;" control="suffix"/>
|
||||
<html:input type="text" class="fix" id="suffix" tabindex="0"
|
||||
oninput="Zotero_Citation_Dialog.confirmRegenerate(false)"
|
||||
onchange="Zotero_Citation_Dialog.confirmRegenerate(true)"/>
|
||||
</hbox>
|
||||
<spacer flex="1"/>
|
||||
</vbox>
|
||||
<separator flex="4"/>
|
||||
<vbox flex="1">
|
||||
<hbox align="stretch">
|
||||
<menulist onchange="Zotero_Citation_Dialog.confirmRegenerate(true)" id="label" tabindex="0" native="true" data-l10n-id="quickformat-locator-type">
|
||||
<menupopup id="locator-type-popup"/>
|
||||
</menulist>
|
||||
<label id="locator-input-label" data-l10n-id="quickformat-locator-value" hidden="true"></label>
|
||||
<html:input aria-labelledby="label locator-input-label" oninput="Zotero_Citation_Dialog.confirmRegenerate(false)" onchange="Zotero_Citation_Dialog.confirmRegenerate(true)" id="locator" tabindex="0"/>
|
||||
</hbox>
|
||||
<separator style="height: 2px" flex="1"/>
|
||||
<checkbox oncommand="Zotero_Citation_Dialog.confirmRegenerate(true)" id="suppress-author" label="&zotero.citation.suppressAuthor.label;" tabindex="0" native="true"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
|
||||
<iframe id="editor" src="simpleEditor.html" hidden="true" flex="1" type="content" remote="false" maychangeremoteness="false"/>
|
||||
<description id="zotero-editor-warning" style="margin: 9px 1px 0" hidden="true">&zotero.citation.editorWarning.label;</description>
|
||||
</vbox>
|
||||
</dialog>
|
||||
</window>
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
Copyright © 2021 Center for History and New Media
|
||||
George Mason University, Fairfax, Virginia, USA
|
||||
http://zotero.org
|
||||
|
||||
This file is part of Zotero.
|
||||
|
||||
Zotero is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Zotero is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
var defaultBubbleizeSelected = Zotero_QuickFormat._bubbleizeSelected;
|
||||
Zotero_QuickFormat.citingNotes = true;
|
||||
Zotero_QuickFormat._bubbleizeSelected = async function () {
|
||||
await defaultBubbleizeSelected();
|
||||
await Zotero_QuickFormat.accept();
|
||||
}
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
Copyright © 2021 Center for History and New Media
|
||||
George Mason University, Fairfax, Virginia, USA
|
||||
http://zotero.org
|
||||
|
||||
This file is part of Zotero.
|
||||
|
||||
Zotero is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Zotero is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***** END LICENSE BLOCK *****
|
||||
-->
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/browser.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://zotero-platform/content/zotero.css"?>
|
||||
<?xml-stylesheet href="chrome://zotero/skin/integration.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://zotero-platform/content/integration.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://zotero-platform-version/content/style.css" type="text/css"?>
|
||||
<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd">
|
||||
|
||||
<window
|
||||
id="insert-note-dialog"
|
||||
class="citation-dialog note-dialog"
|
||||
orient="vertical"
|
||||
title="&zotero.integration.quickFormatDialog.title;"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
persist="screenX screenY"
|
||||
onkeypress="Zotero_QuickFormat.onWindowKeyPress(event)"
|
||||
onunload="Zotero_QuickFormat.onUnload()"
|
||||
drawintitlebar-platforms="win,mac"
|
||||
no-titlebar-icon="true">
|
||||
|
||||
<script src="../include.js"/>
|
||||
<script src="../titlebar.js" type="text/javascript"/>
|
||||
<script src="quickFormat.js" type="text/javascript"/>
|
||||
<script src="insertNoteDialog.js" type="text/javascript"/>
|
||||
|
||||
<linkset>
|
||||
<html:link rel="localization" href="zotero.ftl"/>
|
||||
</linkset>
|
||||
|
||||
<box orient="horizontal" class="citation-dialog entry">
|
||||
<hbox class="citation-dialog main" flex="1" align="start">
|
||||
<hbox flex="1">
|
||||
<html:div flex="1" spellcheck="false" class="citation-dialog editor insert-note" role="application"></html:div>
|
||||
<vbox class="citation-dialog icons end">
|
||||
<image class="icon zotero-spinner-16"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</hbox>
|
||||
<hbox class="citation-dialog progress-container" hidden="true">
|
||||
<html:progress class="citation-dialog progress-meter downloadProgress" style="display: none" max="100"/>
|
||||
</hbox>
|
||||
</box>
|
||||
<panel class="citation-dialog reference-panel" noautofocus="true" norestorefocus="true"
|
||||
height="0" width="0" flip="none">
|
||||
<richlistbox class="citation-dialog reference-list" flex="1"/>
|
||||
</panel>
|
||||
<html:div id="input-description" class="aria-hidden" role="tooltip" data-l10n-id="insert-note-aria-input"></html:div>
|
||||
<html:div id="item-description" class="aria-hidden" role="tooltip" data-l10n-id="insert-note-aria-item"></html:div>
|
||||
</window>
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,124 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
Copyright © 2011 Center for History and New Media
|
||||
George Mason University, Fairfax, Virginia, USA
|
||||
http://zotero.org
|
||||
|
||||
This file is part of Zotero.
|
||||
|
||||
Zotero is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Zotero is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***** END LICENSE BLOCK *****
|
||||
-->
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/browser.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://zotero-platform/content/zotero.css"?>
|
||||
<?xml-stylesheet href="chrome://zotero/skin/integration.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://zotero-platform/content/integration.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://zotero-platform-version/content/style.css" type="text/css"?>
|
||||
<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd">
|
||||
|
||||
<window
|
||||
id="quick-format-dialog"
|
||||
class="citation-dialog"
|
||||
orient="vertical"
|
||||
title="&zotero.integration.quickFormatDialog.title;"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
persist="screenX screenY"
|
||||
onkeypress="Zotero_QuickFormat.onWindowKeyPress(event)"
|
||||
onunload="Zotero_QuickFormat.onUnload()"
|
||||
drawintitlebar-platforms="win,mac"
|
||||
no-titlebar-icon="true"
|
||||
style="width: 800px;">
|
||||
<script src="../include.js"/>
|
||||
<script src="../titlebar.js" type="text/javascript"/>
|
||||
<script src="quickFormat.js" type="text/javascript"/>
|
||||
|
||||
<linkset>
|
||||
<html:link rel="localization" href="zotero.ftl"/>
|
||||
</linkset>
|
||||
|
||||
<box orient="horizontal" class="citation-dialog entry">
|
||||
<hbox class="citation-dialog main" flex="1" align="start">
|
||||
<hbox flex="1">
|
||||
<vbox class="citation-dialog icons start">
|
||||
<toolbarbutton id="zotero-icon" data-l10n-id="quickformat-citation-options" type="menu" tabindex="0" disabled="true">
|
||||
<menupopup>
|
||||
<menuitem id="keep-sorted" label="&zotero.citation.keepSorted.label;"
|
||||
oncommand="Zotero_QuickFormat.onKeepSortedCommand()" type="checkbox"
|
||||
hidden="true"/>
|
||||
<menuitem id="show-editor" label="&zotero.integration.showEditor.label;"
|
||||
oncommand="Zotero_QuickFormat.onShowEditorCommand()" type="checkbox"
|
||||
hidden="true"/>
|
||||
<menuitem id="classic-view" label="&zotero.integration.classicView.label;"
|
||||
oncommand="Zotero_QuickFormat.onClassicViewCommand()"/>
|
||||
</menupopup>
|
||||
</toolbarbutton>
|
||||
</vbox>
|
||||
<html:div flex="1" spellcheck="false" class="citation-dialog editor" role="application"></html:div>
|
||||
<vbox class="citation-dialog icons end">
|
||||
<image class="icon zotero-spinner-16"/>
|
||||
<toolbarbutton class="icon accept-button" onclick="Zotero_QuickFormat.accept()" data-l10n-id="quickformat-accept"></toolbarbutton>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</hbox>
|
||||
<hbox class="citation-dialog progress-container" hidden="true">
|
||||
<html:progress class="citation-dialog progress-meter downloadProgress" max="100"/>
|
||||
</hbox>
|
||||
</box>
|
||||
<html:div id="bubble-description" class="aria-hidden" role="tooltip" data-l10n-id="quickformat-aria-bubble"></html:div>
|
||||
<html:div id="input-description" class="aria-hidden" role="tooltip" data-l10n-id="quickformat-aria-input"></html:div>
|
||||
<html:div id="item-description" class="aria-hidden" role="tooltip" data-l10n-id="quickformat-aria-item"></html:div>
|
||||
<panel class="citation-dialog reference-panel" noautofocus="true" norestorefocus="true"
|
||||
height="0" width="0" flip="none" type="arrow">
|
||||
<richlistbox class="citation-dialog reference-list" flex="1" seltype="multiple"/>
|
||||
</panel>
|
||||
<panel id="citation-properties" type="arrow" orient="vertical"
|
||||
onkeydown="Zotero_QuickFormat.onPanelKeyPress(event)"
|
||||
onpopuphidden="Zotero_QuickFormat.onItemPopoverClosed(event)"
|
||||
role="dialog">
|
||||
<vbox flex="1">
|
||||
<description id="citation-properties-title" tabindex="1"/>
|
||||
<description id="citation-properties-info" tabindex="2"/>
|
||||
</vbox>
|
||||
<html:div id="citation-properties-grid">
|
||||
<menulist id="locator-label" tabindex="3"
|
||||
oncommand="Zotero_QuickFormat.onCitationPropertiesChanged(event)" native="true">
|
||||
<menupopup id="locator-label-popup" onpopuphidden="Zotero_QuickFormat.ignoreEvent(event)"/>
|
||||
</menulist>
|
||||
<html:input type="text" aria-labelledby="locator-label" tabindex="4" id="locator"
|
||||
oninput="window.setTimeout(function(event) { Zotero_QuickFormat.onCitationPropertiesChanged(event) }, 0)"/>
|
||||
<label id="prefix-label" value="&zotero.citation.prefix.label;"/>
|
||||
<html:input type="text" aria-labelledby="prefix-label" tabindex="5" class="citation-textbox" id="prefix" flex="1"
|
||||
oninput="window.setTimeout(function(event) { Zotero_QuickFormat.onCitationPropertiesChanged(event) }, 0)"/>
|
||||
<label id="suffix-label" value="&zotero.citation.suffix.label;"/>
|
||||
<html:input type="text" aria-labelledby="suffix-label" tabindex="6" class="citation-textbox" id="suffix" flex="1"
|
||||
oninput="window.setTimeout(function(event) { Zotero_QuickFormat.onCitationPropertiesChanged(event) }, 0)"/>
|
||||
<html:div>
|
||||
<checkbox type="checkbox" id="suppress-author" native="true" tabindex="7"
|
||||
oncommand="Zotero_QuickFormat.onCitationPropertiesChanged(event)"
|
||||
label="&zotero.citation.suppressAuthor.label;"/>
|
||||
</html:div>
|
||||
</html:div>
|
||||
<vbox flex="1" align="center">
|
||||
<button id="citation-properties-library-link" tabindex="8" onclick="Zotero_QuickFormat.showInLibrary()"/>
|
||||
</vbox>
|
||||
</panel>
|
||||
<guidance-panel class="citation-dialog guidance" about="quickFormat"
|
||||
for="zotero-icon" x="26"/>
|
||||
</window>
|
||||
|
|
@ -66,7 +66,7 @@ class EditorInstance {
|
|||
this._state = options.state;
|
||||
this._disableSaving = false;
|
||||
this._subscriptions = [];
|
||||
this._quickFormatWindow = null;
|
||||
this._citationDialogWindow = null;
|
||||
this._citationItemsList = [];
|
||||
this._initPromise = new Promise((resolve, reject) => {
|
||||
this._resolveInitPromise = resolve;
|
||||
|
|
@ -205,9 +205,9 @@ class EditorInstance {
|
|||
|
||||
async uninit() {
|
||||
this._prefObserverIDs.forEach(id => Zotero.Prefs.unregisterObserver(id));
|
||||
if (this._quickFormatWindow) {
|
||||
this._quickFormatWindow.close();
|
||||
this._quickFormatWindow = null;
|
||||
if (this._citationDialogWindow) {
|
||||
this._citationDialogWindow.close();
|
||||
this._citationDialogWindow = null;
|
||||
}
|
||||
this._iframeWindow.removeEventListener('message', this._messageHandler);
|
||||
this.saveSync();
|
||||
|
|
@ -628,7 +628,7 @@ class EditorInstance {
|
|||
}
|
||||
}
|
||||
let libraryID = this._item.libraryID;
|
||||
this._openQuickFormatDialog(nodeID, citation, [libraryID], openedEmpty);
|
||||
this._openCitationDialog(nodeID, citation, [libraryID], openedEmpty);
|
||||
return;
|
||||
}
|
||||
case 'importImages': {
|
||||
|
|
@ -1038,14 +1038,13 @@ class EditorInstance {
|
|||
});
|
||||
}
|
||||
|
||||
// TODO: Allow only one quickFormat dialog
|
||||
async _openQuickFormatDialog(nodeID, citationData, filterLibraryIDs, openedEmpty) {
|
||||
async _openCitationDialog(nodeID, citationData, filterLibraryIDs, openedEmpty) {
|
||||
await Zotero.Styles.init();
|
||||
let that = this;
|
||||
let win;
|
||||
|
||||
/**
|
||||
* Citation editing functions and properties accessible to quickFormat.js and addCitationDialog.js
|
||||
* Citation editing functions and properties accessible to citationDialog.js
|
||||
*/
|
||||
let CI = function (citation) {
|
||||
this.citation = citation;
|
||||
|
|
@ -1059,10 +1058,10 @@ class EditorInstance {
|
|||
CI.prototype = {
|
||||
|
||||
/**
|
||||
* 1) Provide `quickFormat` dialog with items created from
|
||||
* 1) Provide citation dialog with items created from
|
||||
* `itemData`, without dealing with `Zotero.Integration.sessions`
|
||||
*
|
||||
* 2) Allow to pick already cited item from `quickFormat` dropdown
|
||||
* 2) Allow to pick already cited item from citation dialog
|
||||
*
|
||||
* @param citationItem
|
||||
* @returns {Zotero.Item|undefined}
|
||||
|
|
@ -1072,7 +1071,7 @@ class EditorInstance {
|
|||
let citedItem = typeof citationItem.id === 'string'
|
||||
&& this.citedItems[parseInt(citationItem.id.split('cited:')[1])];
|
||||
|
||||
// Return cited item picked in `quickFormat` dropdown
|
||||
// Return cited item picked in citation dialog
|
||||
if (citedItem) {
|
||||
return citedItem.item;
|
||||
}
|
||||
|
|
@ -1179,7 +1178,7 @@ class EditorInstance {
|
|||
let item = new Zotero.Item();
|
||||
Zotero.Utilities.itemFromCSLJSON(item, citationItem.itemData);
|
||||
// This is the only way to pass our custom id for already cited
|
||||
// items, without modifying `quickFormat` dialog too much.
|
||||
// items, without modifying citationDialog.js too much.
|
||||
// Must not contain `/`
|
||||
item.cslItemID = 'cited:' + items.length;
|
||||
items.push({ item, citationItem });
|
||||
|
|
@ -1244,9 +1243,9 @@ class EditorInstance {
|
|||
}
|
||||
};
|
||||
|
||||
if (that._quickFormatWindow) {
|
||||
that._quickFormatWindow.close();
|
||||
that._quickFormatWindow = null;
|
||||
if (that._citationDialogWindow) {
|
||||
that._citationDialogWindow.close();
|
||||
that._citationDialogWindow = null;
|
||||
}
|
||||
|
||||
let citation = new Citation();
|
||||
|
|
@ -1267,7 +1266,7 @@ class EditorInstance {
|
|||
mode += ",alwaysRaised";
|
||||
}
|
||||
|
||||
win = that._quickFormatWindow = Components.classes['@mozilla.org/embedcomp/window-watcher;1']
|
||||
win = that._citationDialogWindow = Components.classes['@mozilla.org/embedcomp/window-watcher;1']
|
||||
.getService(Components.interfaces.nsIWindowWatcher)
|
||||
.openWindow(null, 'chrome://zotero/content/integration/citationDialog.xhtml', '', mode, {
|
||||
wrappedJSObject: io
|
||||
|
|
@ -1630,7 +1629,7 @@ class EditorInstanceUtilities {
|
|||
}
|
||||
|
||||
/**
|
||||
* Build citation item preview string (based on _buildBubbleString in quickFormat.js)
|
||||
* Build citation item preview string (based on buildBubbleString in citationDialog/helpers.js)
|
||||
* TODO: Try to avoid duplicating this code here and inside note-editor
|
||||
*/
|
||||
_formatCitationItemPreview(citationItem) {
|
||||
|
|
|
|||
|
|
@ -1719,7 +1719,7 @@ Zotero.Integration.Session.prototype._insertItemsIntoDocument = async function (
|
|||
};
|
||||
|
||||
/**
|
||||
* Citation editing functions and propertiesaccessible to quickFormat.js and addCitationDialog.js
|
||||
* Citation editing functions and propertiesaccessible to citationDialog.js
|
||||
*/
|
||||
Zotero.Integration.CitationEditInterface = function(items, sortable, fieldIndexPromise,
|
||||
citationsByItemIDPromise, previewFn){
|
||||
|
|
@ -1729,7 +1729,7 @@ Zotero.Integration.CitationEditInterface = function(items, sortable, fieldIndexP
|
|||
this._fieldIndexPromise = fieldIndexPromise;
|
||||
this._citationsByItemIDPromise = citationsByItemIDPromise;
|
||||
|
||||
// Not available in quickFormat.js if this unspecified
|
||||
// Not available in citationDialog.js if this unspecified
|
||||
this.wrappedJSObject = this;
|
||||
|
||||
this._acceptDeferred = Zotero.Promise.defer();
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ integration-editBibliography-wrapper =
|
|||
.aria-description = { -integration-editBibliography-include-uncited }
|
||||
{ -integration-editBibliography-exclude-cited }
|
||||
{ -integration-editBibliography-edit-reference }
|
||||
integration-quickFormatDialog-window =
|
||||
.title = { -app-name } - Quick Format Citation
|
||||
integration-citationDialog = Citation Dialog
|
||||
integration-citationDialog-section-open = Open Documents ({ $count })
|
||||
integration-citationDialog-section-selected = Selected Items ({ $count }/{ $total })
|
||||
|
|
|
|||
|
|
@ -118,7 +118,6 @@
|
|||
|
||||
<!ENTITY zotero.preferences.prefpane.cite "Cite">
|
||||
<!ENTITY zotero.preferences.cite.wordProcessors "Word Processors">
|
||||
<!ENTITY zotero.preferences.cite.wordProcessors.useClassicAddCitationDialog "Use classic Add Citation dialog">
|
||||
<!ENTITY zotero.preferences.styleEditor "Style Editor">
|
||||
<!ENTITY zotero.preferences.stylePreview "Style Preview">
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@
|
|||
<!ENTITY zotero.integration.docPrefs.title "Document Preferences">
|
||||
<!ENTITY zotero.integration.addEditCitation.title "Add/Edit Citation">
|
||||
<!ENTITY zotero.integration.editBibliography.title "Edit Bibliography">
|
||||
<!ENTITY zotero.integration.quickFormatDialog.title "Quick Format Citation">
|
||||
|
||||
<!ENTITY zotero.progress.title "Progress">
|
||||
|
||||
|
|
|
|||
|
|
@ -585,25 +585,6 @@ toggle-preview =
|
|||
*[unknown] Toggle
|
||||
} Attachment Preview
|
||||
|
||||
quickformat-general-instructions = Use Left/Right Arrow to navigate the items of this citation. {
|
||||
$dialogMenu ->
|
||||
[active] Press Shift-Tab to focus the dialog's menu.
|
||||
*[other] { "" }
|
||||
} Press { return-or-enter } to save edits to this citation. Press Escape to discard the changes and close the dialog.
|
||||
|
||||
quickformat-aria-bubble = This item is included in the citation. Press space bar to customize the item. { quickformat-general-instructions }
|
||||
quickformat-aria-input = Type to search for an item to include in this citation. Press Tab to navigate the list of search results. { quickformat-general-instructions }
|
||||
quickformat-aria-item = Press { return-or-enter } to add this item to the citation. Press Tab to go back to the search field.
|
||||
quickformat-accept =
|
||||
.tooltiptext = Save edits to this citation
|
||||
quickformat-locator-type =
|
||||
.aria-label = Locator type
|
||||
quickformat-locator-value = Locator
|
||||
quickformat-citation-options =
|
||||
.tooltiptext = Show citation options
|
||||
|
||||
insert-note-aria-input = Type to search for a note. Press Tab to navigate the list of results. Press Escape to close the dialog.
|
||||
insert-note-aria-item = Press { return-or-enter } to select this note. Press Tab to go back to the search field. Press Escape to close the dialog.
|
||||
quicksearch-mode =
|
||||
.aria-label = Quick Search mode
|
||||
quicksearch-input =
|
||||
|
|
@ -667,12 +648,6 @@ architecture-warning-action = Download 64-bit { -app-name }
|
|||
architecture-x64-on-arm64-message = { -app-name } is running in emulated mode. A native version of { -app-name } will run more efficiently.
|
||||
architecture-x64-on-arm64-action = Download { -app-name } for ARM64
|
||||
|
||||
first-run-guidance-quickFormat = Type a title, author, and/or year to search for a reference.
|
||||
|
||||
After you’ve made your selection, click the bubble or select it via the keyboard and press ↓/Space to show citation options such as page number, prefix, and suffix.
|
||||
|
||||
You can also add a page number directly by including it with your search terms or typing it after the bubble and pressing { return-or-enter }.
|
||||
|
||||
first-run-guidance-authorMenu = { -app-name } lets you specify editors and translators too. You can turn an author into an editor or translator by selecting from this menu.
|
||||
|
||||
advanced-search-remove-btn =
|
||||
|
|
|
|||
|
|
@ -1228,8 +1228,6 @@ standalone.updateMessage = A recommended update is available, but you do not h
|
|||
connector.name = %S Connector
|
||||
connector.error.title = Zotero Connector Error
|
||||
|
||||
firstRunGuidance.quickFormat = Type a title or author to search for a reference.\n\nAfter you've made your selection, click the bubble or press Ctrl-\u2193 to add page numbers, prefixes, or suffixes. You can also include a page number along with your search terms to add it directly.\n\nYou can edit citations directly in the word processor document.
|
||||
firstRunGuidance.quickFormatMac = Type a title or author to search for a reference.\n\nAfter you've made your selection, click the bubble or press Cmd-\u2193 to add page numbers, prefixes, or suffixes. You can also include a page number along with your search terms to add it directly.\n\nYou can edit citations directly in the word processor document.
|
||||
firstRunGuidance.toolbarButton.new = Click the ‘Z’ button to open Zotero, or use the %S keyboard shortcut.
|
||||
firstRunGuidance.toolbarButton.upgrade = The Zotero icon can now be found in the Firefox toolbar. Click the icon to open Zotero, or use the %S keyboard shortcut.
|
||||
firstRunGuidance.saveButton = Click this button to save any web page to your Zotero library. On some pages, Zotero will be able to save full details, including author and date.
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ describe("Zotero.Integration", function () {
|
|||
displayAlertStub.resolves(0);
|
||||
yield execCommand('addEditCitation', docID);
|
||||
assert.isTrue(displayAlertStub.calledOnce);
|
||||
// Prefs to select a new style and quickFormat
|
||||
// Prefs to select a new style
|
||||
assert.isTrue(displayDialogStub.calledTwice);
|
||||
assert.isNotOk(Zotero.Styles.get(style.styleID));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue