Merge branch '4.0' of github.com:zotero/zotero into 4.0

This commit is contained in:
Simon Kornblith 2014-05-04 19:05:24 -04:00
commit 3bfe5949d7
18 changed files with 480 additions and 247 deletions

View file

@ -125,6 +125,18 @@
this._eventHandler = function (event) {
//Zotero.debug(event.type);
switch (event.type) {
case 'keydown':
// Intercept and manually trigger redo for Cmd-Shift-Z,
// which keeps it from toggling the Zotero pane instead
if (Zotero.isMac && event.metaKey && event.shiftKey && !event.ctrlKey
&& !event.altKey && event.keyCode == 90) {
event.stopPropagation();
event.preventDefault();
self.redo();
return;
}
break;
case 'keypress':
// Ignore keypresses that don't change
// any text
@ -336,6 +348,14 @@
</body>
</method>
<method name="redo">
<body>
<![CDATA[
this._editor.undoManager.redo();
]]>
</body>
</method>
<method name="clearUndo">
<body>
<![CDATA[

View file

@ -52,13 +52,14 @@
<toolbar id="zotero-toolbar" nowindowdrag="true"/>
<vbox id="appcontent">
<zoteroguidancepanel id="zotero-toolbar-button-guidance" about="toolbarButton" for="zotero-toolbar-button" position="bottomcenter topleft" delay="2000" foregroundonly="true"/>
<!-- onmouseup shouldn't be necessary but seems to help prevent tag selector from sometimes going off the screen -->
<splitter id="zotero-splitter" resizebefore="closest" resizeafter="closest" hidden="true"
onmouseup="ZoteroPane.updateTagSelectorSize()"/>
<stack id="zotero-pane-stack" persist="savedHeight" savedHeight="300" hidden="true"/>
<zoteroguidancepanel id="zotero-toolbar-button-guidance" about="toolbarButton" for="zotero-toolbar-button" position="bottomcenter topleft" delay="2000" foregroundonly="true"/>
<!-- Annotation Toolbar -->
<toolbar id="zotero-annotate-tb" crop="end" insertbefore="content" hidden="true">
<toolbarbutton id="zotero-annotate-tb-add" tooltiptext="&zotero.annotate.toolbar.add.label;" oncommand="Zotero_Browser.toggleMode(this.id);"/>

View file

@ -32,5 +32,24 @@ Zotero_Preferences.Keys = {
// Display the appropriate modifier keys for the platform
rows[i].firstChild.nextSibling.value = Zotero.isMac ? Zotero.getString('general.keys.cmdShift') : Zotero.getString('general.keys.ctrlShift');
}
var textboxes = document.getElementById('zotero-keys-rows').getElementsByTagName('textbox');
for (let i=0; i<textboxes.length; i++) {
let textbox = textboxes[i];
textbox.value = textbox.value.toUpperCase();
// .value takes care of the initial value, and this takes care of direct pref changes
// while the window is open
textbox.setAttribute('onsyncfrompreference', 'return Zotero_Preferences.Keys.capitalizePref(this.id)');
textbox.setAttribute('oninput', 'this.value = this.value.toUpperCase()');
}
},
capitalizePref: function (id) {
var elem = document.getElementById(id);
var pref = document.getElementById(elem.getAttribute('preference'));
if (pref.value) {
return pref.value.toUpperCase();
}
}
};

View file

@ -48,6 +48,16 @@ Zotero.CollectionTreeView = function()
this._trashNotEmpty = {};
}
Zotero.CollectionTreeView.prototype = Object.create(Zotero.LibraryTreeView.prototype);
Zotero.CollectionTreeView.prototype.type = 'collection';
Object.defineProperty(Zotero.CollectionTreeView.prototype, "itemGroup", {
get: function () {
return this.getItemGroupAtRow(this.selection.currentIndex);
}
})
/*
* Called by the tree itself
*/
@ -980,8 +990,10 @@ Zotero.CollectionTreeView.prototype._hideItem = function(row)
}
/*
/**
* Returns Zotero.ItemGroup at row
*
* @deprecated Use getItemGroupAtRow()
*/
Zotero.CollectionTreeView.prototype._getItemAtRow = function(row)
{
@ -989,6 +1001,12 @@ Zotero.CollectionTreeView.prototype._getItemAtRow = function(row)
}
Zotero.CollectionTreeView.prototype.getItemGroupAtRow = function(row)
{
return this._dataItems[row][0];
}
/*
* Saves the ids of the currently selected item for later
*/
@ -1155,7 +1173,7 @@ Zotero.CollectionTreeCommandController.prototype.onEvent = function(evt)
* Start a drag using HTML 5 Drag and Drop
*/
Zotero.CollectionTreeView.prototype.onDragStart = function(event) {
var itemGroup = this._getItemAtRow(this.selection.currentIndex);
var itemGroup = this.itemGroup;
if (!itemGroup.isCollection()) {
return;
}
@ -1163,18 +1181,16 @@ Zotero.CollectionTreeView.prototype.onDragStart = function(event) {
}
/*
* Called while a drag is over the tree.
/**
* Called by treechildren.onDragOver() before setting the dropEffect,
* which is checked in libraryTreeView.canDrop()
*/
Zotero.CollectionTreeView.prototype.canDrop = function(row, orient, dragData)
{
Zotero.CollectionTreeView.prototype.canDropCheck = function (row, orient, dataTransfer) {
//Zotero.debug("Row is " + row + "; orient is " + orient);
if (!dragData || !dragData.data) {
var dragData = Zotero.DragDrop.getDragData(this);
}
var dragData = Zotero.DragDrop.getDataFromDataTransfer(dataTransfer);
if (!dragData) {
Zotero.debug("No drag data");
return false;
}
var dataType = dragData.dataType;
@ -1184,8 +1200,8 @@ Zotero.CollectionTreeView.prototype.canDrop = function(row, orient, dragData)
if (orient == 1 && row == 0 && dataType == 'zotero/collection') {
return true;
}
else if(orient == 0) //directly on a row...
{
// Directly on a row
else if (orient == 0) {
var itemGroup = this._getItemAtRow(row); //the collection we are dragging over
if (dataType == 'zotero/item' && itemGroup.isBucket()) {
@ -1331,17 +1347,21 @@ Zotero.CollectionTreeView.prototype.canDrop = function(row, orient, dragData)
/*
* Called when something's been dropped on or next to a row
*/
Zotero.CollectionTreeView.prototype.drop = function(row, orient)
Zotero.CollectionTreeView.prototype.drop = function(row, orient, dataTransfer)
{
var dragData = Zotero.DragDrop.getDragData(this);
if (!this.canDrop(row, orient, dragData)) {
if (!this.canDropCheck(row, orient, dataTransfer)) {
return false;
}
var dragData = Zotero.DragDrop.getDataFromDataTransfer(dataTransfer);
if (!dragData) {
Zotero.debug("No drag data");
return false;
}
var dropEffect = dragData.dropEffect;
var dataType = dragData.dataType;
var data = dragData.data;
var itemGroup = this._getItemAtRow(row);
var itemGroup = this.getItemGroupAtRow(row);
function copyItem (item, targetLibraryID) {
// Check if there's already a copy of this item in the library
@ -1589,6 +1609,7 @@ Zotero.CollectionTreeView.prototype.drop = function(row, orient)
var newItems = [];
var newIDs = [];
var toMove = [];
// TODO: support items coming from different sources?
if (items[0].libraryID == targetLibraryID) {
var sameLibrary = true;
@ -1604,6 +1625,7 @@ Zotero.CollectionTreeView.prototype.drop = function(row, orient)
if (sameLibrary) {
newIDs.push(item.id);
toMove.push(item.id);
}
else {
newItems.push(item);
@ -1667,6 +1689,18 @@ Zotero.CollectionTreeView.prototype.drop = function(row, orient)
collection.addItems(newIDs);
}
// If moving, remove items from source collection
if (dropEffect == 'move' && toMove.length) {
if (!sameLibrary) {
throw new Error("Cannot move items between libraries");
}
let itemGroup = Zotero.DragDrop.getDragSource();
if (!itemGroup || !itemGroup.isCollection()) {
throw new Error("Drag source must be a collection for move action");
}
itemGroup.ref.removeItems(toMove);
}
Zotero.DB.commitTransaction();
}
else if (dataType == 'text/x-moz-url' || dataType == 'application/x-moz-file') {
@ -1725,7 +1759,7 @@ Zotero.CollectionTreeView.prototype.drop = function(row, orient)
try {
Zotero.DB.beginTransaction();
if (dragData.dropEffect == 'link') {
if (dropEffect == 'link') {
var itemID = Zotero.Attachments.linkFromFile(file);
}
else {
@ -1740,7 +1774,6 @@ Zotero.CollectionTreeView.prototype.drop = function(row, orient)
}
}
}
if (parentCollectionID) {
var col = Zotero.Collections.get(parentCollectionID);
if (col) {
@ -1762,85 +1795,6 @@ Zotero.CollectionTreeView.prototype.drop = function(row, orient)
}
/*
* Called by HTML 5 Drag and Drop when dragging over the tree
*/
Zotero.CollectionTreeView.prototype.onDragEnter = function (event) {
Zotero.DragDrop.currentDataTransfer = event.dataTransfer;
return false;
}
/*
* Called by HTML 5 Drag and Drop when dragging over the tree
*/
Zotero.CollectionTreeView.prototype.onDragOver = function (event) {
Zotero.DragDrop.currentDataTransfer = event.dataTransfer;
if (event.dataTransfer.types.contains("application/x-moz-file")) {
// As of Aug. 2013 nightlies:
//
// - Setting the dropEffect only works on Linux and OS X.
//
// - Modifier keys don't show up in the drag event on OS X until the
// drop (https://bugzilla.mozilla.org/show_bug.cgi?id=911918),
// so since we can't show a correct effect, we leave it at
// the default 'move', the least misleading option, and set it
// below in onDrop().
//
// - The cursor effect gets set by the system on Windows 7 and can't
// be overridden.
if (!Zotero.isMac) {
if (event.shiftKey) {
if (event.ctrlKey) {
event.dataTransfer.dropEffect = "link";
}
else {
event.dataTransfer.dropEffect = "move";
}
}
else {
event.dataTransfer.dropEffect = "copy";
}
}
}
// Show copy symbol when dragging an item over a collection
else if (event.dataTransfer.getData("zotero/item")) {
event.dataTransfer.dropEffect = "copy";
}
return false;
}
/*
* Called by HTML 5 Drag and Drop when dropping onto the tree
*/
Zotero.CollectionTreeView.prototype.onDrop = function (event) {
if (event.dataTransfer.types.contains("application/x-moz-file")) {
if (Zotero.isMac) {
Zotero.DragDrop.currentDataTransfer = event.dataTransfer;
if (event.metaKey) {
if (event.altKey) {
event.dataTransfer.dropEffect = 'link';
}
else {
event.dataTransfer.dropEffect = 'move';
}
}
else {
event.dataTransfer.dropEffect = 'copy';
}
}
}
return false;
}
Zotero.CollectionTreeView.prototype.onDragExit = function (event) {
//Zotero.debug("Clearing drag data");
Zotero.DragDrop.currentDataTransfer = null;
}
////////////////////////////////////////////////////////////////////////////////
///

View file

@ -38,11 +38,14 @@ Zotero.ItemTreeView = function(itemGroup, sourcesOnly)
{
this.wrappedJSObject = this;
this.rowCount = 0;
this.itemGroup = itemGroup;
// Deprecated
// TODO: remove
this._itemGroup = itemGroup;
this._initialized = false;
this._skipKeypress = false;
this._itemGroup = itemGroup;
this._sourcesOnly = sourcesOnly;
this._callbacks = [];
@ -59,6 +62,8 @@ Zotero.ItemTreeView = function(itemGroup, sourcesOnly)
);
}
Zotero.ItemTreeView.prototype = Object.create(Zotero.LibraryTreeView.prototype);
Zotero.ItemTreeView.prototype.type = 'item';
Zotero.ItemTreeView.prototype.addCallback = function(callback) {
this._callbacks.push(callback);
@ -2430,6 +2435,11 @@ Zotero.ItemTreeCommandController.prototype.onEvent = function(evt)
* Start a drag using HTML 5 Drag and Drop
*/
Zotero.ItemTreeView.prototype.onDragStart = function (event) {
// See note in LibraryTreeView::_setDropEffect()
if (Zotero.isWin) {
event.dataTransfer.effectAllowed = 'move';
}
var itemIDs = this.saveSelection();
var items = Zotero.Items.get(itemIDs);
@ -2744,17 +2754,14 @@ Zotero.ItemTreeView.fileDragDataProvider.prototype = {
}
Zotero.ItemTreeView.prototype.canDrop = function(row, orient, dragData)
{
Zotero.debug("Row is " + row + "; orient is " + orient);
/**
* Called by treechildren.onDragOver() before setting the dropEffect,
* which is checked in libraryTreeView.canDrop()
*/
Zotero.ItemTreeView.prototype.canDropCheck = function (row, orient, dataTransfer) {
//Zotero.debug("Row is " + row + "; orient is " + orient);
if (row == -1 && orient == -1) {
//return true;
}
if (!dragData || !dragData.data) {
var dragData = Zotero.DragDrop.getDragData(this);
}
var dragData = Zotero.DragDrop.getDataFromDataTransfer(dataTransfer);
if (!dragData) {
Zotero.debug("No drag data");
return false;
@ -2872,18 +2879,21 @@ Zotero.ItemTreeView.prototype.canDrop = function(row, orient, dragData)
/*
* Called when something's been dropped on or next to a row
*/
Zotero.ItemTreeView.prototype.drop = function(row, orient)
{
var dragData = Zotero.DragDrop.getDragData(this);
if (!this.canDrop(row, orient, dragData)) {
Zotero.ItemTreeView.prototype.drop = function(row, orient, dataTransfer) {
if (!this.canDropCheck(row, orient, dataTransfer)) {
return false;
}
var dragData = Zotero.DragDrop.getDataFromDataTransfer(dataTransfer);
if (!dragData) {
Zotero.debug("No drag data");
return false;
}
var dropEffect = dragData.dropEffect;
var dataType = dragData.dataType;
var data = dragData.data;
var itemGroup = this._itemGroup;
var itemGroup = this.itemGroup;
var targetLibraryID = itemGroup.isWithinGroup() ? itemGroup.ref.libraryID : null;
if (dataType == 'zotero/item') {
var ids = data;
@ -2892,6 +2902,19 @@ Zotero.ItemTreeView.prototype.drop = function(row, orient)
return;
}
// TEMP: This is always false for now, since cross-library drag
// is disallowed in canDropCheck()
//
// TODO: support items coming from different sources?
if (items[0].libraryID == targetLibraryID) {
var sameLibrary = true;
}
else {
var sameLibrary = false;
}
var toMove = [];
// Dropped directly on a row
if (orient == 0) {
// Set drop target as the parent item for dragged items
@ -2929,9 +2952,24 @@ Zotero.ItemTreeView.prototype.drop = function(row, orient)
item.save()
}
itemGroup.ref.addItem(item.id);
toMove.push(item.id);
}
}
}
// If moving, remove items from source collection
if (dropEffect == 'move' && toMove.length) {
if (!sameLibrary) {
throw new Error("Cannot move items between libraries");
}
let targetItemGroup = Zotero.DragDrop.getDragSource();
if (!targetItemGroup || !targetItemGroup.isCollection()) {
throw new Error("Drag source must be a collection");
}
if (itemGroup.id != targetItemGroup.id) {
itemGroup.ref.removeItems(toMove);
}
}
}
else if (dataType == 'text/x-moz-url' || dataType == 'application/x-moz-file') {
// Disallow drop into read-only libraries
@ -3014,7 +3052,7 @@ Zotero.ItemTreeView.prototype.drop = function(row, orient)
try {
Zotero.DB.beginTransaction();
if (dragData.dropEffect == 'link') {
if (dropEffect == 'link') {
var itemID = Zotero.Attachments.linkFromFile(file, sourceItemID);
}
else {
@ -3049,79 +3087,6 @@ Zotero.ItemTreeView.prototype.drop = function(row, orient)
}
}
Zotero.ItemTreeView.prototype.onDragEnter = function (event) {
Zotero.DragDrop.currentDataTransfer = event.dataTransfer;
return false;
}
/*
* Called by HTML 5 Drag and Drop when dragging over the tree
*/
Zotero.ItemTreeView.prototype.onDragOver = function (event) {
Zotero.DragDrop.currentDataTransfer = event.dataTransfer;
if (event.dataTransfer.types.contains("application/x-moz-file")) {
// As of Aug. 2013 nightlies:
//
// - Setting the dropEffect only works on Linux and OS X.
//
// - Modifier keys don't show up in the drag event on OS X until the
// drop (https://bugzilla.mozilla.org/show_bug.cgi?id=911918),
// so since we can't show a correct effect, we leave it at
// the default 'move', the least misleading option, and set it
// below in onDrop().
//
// - The cursor effect gets set by the system on Windows 7 and can't
// be overridden.
if (!Zotero.isMac) {
if (event.shiftKey) {
if (event.ctrlKey) {
event.dataTransfer.dropEffect = "link";
}
else {
event.dataTransfer.dropEffect = "move";
}
}
else {
event.dataTransfer.dropEffect = "copy";
}
}
}
// Show copy symbol when dragging an item over a collection
else if (event.dataTransfer.getData("zotero/item")) {
event.dataTransfer.dropEffect = "copy";
}
return false;
}
/*
* Called by HTML 5 Drag and Drop when dropping onto the tree
*/
Zotero.ItemTreeView.prototype.onDrop = function (event) {
if (event.dataTransfer.types.contains("application/x-moz-file")) {
if (Zotero.isMac) {
Zotero.DragDrop.currentDataTransfer = event.dataTransfer;
if (event.metaKey) {
if (event.altKey) {
event.dataTransfer.dropEffect = 'link';
}
else {
event.dataTransfer.dropEffect = 'move';
}
}
else {
event.dataTransfer.dropEffect = 'copy';
}
}
}
return false;
}
Zotero.ItemTreeView.prototype.onDragExit = function (event) {
//Zotero.debug("Clearing drag data");
Zotero.DragDrop.currentDataTransfer = null;
}
////////////////////////////////////////////////////////////////////////////////
///

View file

@ -0,0 +1,216 @@
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2013 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 *****
*/
Zotero.LibraryTreeView = function () {};
Zotero.LibraryTreeView.prototype = {
/**
* Called while a drag is over the tree
*/
canDrop: function(row, orient, dataTransfer) {
// onDragOver() calls the view's canDropCheck() and sets the
// dropEffect, which we check here. Setting the dropEffect on the
// dataTransfer here seems to have no effect.
// ondragover doesn't have access to the orientation on its own,
// so we stuff it in Zotero.DragDrop
Zotero.DragDrop.currentOrientation = orient;
return dataTransfer.dropEffect && dataTransfer.dropEffect != "none";
},
/*
* Called by HTML 5 Drag and Drop when dragging over the tree
*/
onDragEnter: function (event) {
Zotero.DragDrop.currentDragEvent = event;
return false;
},
/**
* Called by HTML 5 Drag and Drop when dragging over the tree
*
* We use this to set the drag action, which is used by view.canDrop(),
* based on the view's canDropCheck() and modifier keys.
*/
onDragOver: function (event) {
// Prevent modifier keys from doing their normal things
event.preventDefault();
Zotero.DragDrop.currentDragEvent = event;
var target = event.target;
if (target.tagName != 'treechildren') {
return false;
}
var tree = target.parentNode;
let row = {}, col = {}, obj = {};
tree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, obj);
if (tree.id == 'zotero-collections-tree') {
var view = tree.ownerDocument.defaultView.ZoteroPane.collectionsView;
}
else if (tree.id == 'zotero-items-tree') {
var view = tree.ownerDocument.defaultView.ZoteroPane.itemsView;
}
else {
throw new Error("Invalid tree id '" + tree.id + "'");
}
if (!view.canDropCheck(row.value, Zotero.DragDrop.currentOrientation, event.dataTransfer)) {
this._setDropEffect(event, "none");
return;
}
if (event.dataTransfer.getData("zotero/item")) {
var sourceItemGroup = Zotero.DragDrop.getDragSource();
if (sourceItemGroup) {
if (this.type == 'collection') {
var targetItemGroup = Zotero.DragDrop.getDragTarget();
}
else if (this.type == 'item') {
var targetItemGroup = this.itemGroup;
}
else {
throw new Error("Invalid type '" + this.type + "'");
}
if (!targetItemGroup) {
this._setDropEffect(event, "none");
return false;
}
if (sourceItemGroup.id == targetItemGroup.id) {
// Ignore drag into the same collection
if (this.type == 'collection') {
this._setDropEffect(event, "none");
}
// If dragging from the same source, do a move
else {
this._setDropEffect(event, "move");
}
return false;
}
// If the source isn't a collection, the action has to be a copy
if (!sourceItemGroup.isCollection()) {
this._setDropEffect(event, "copy");
return false;
}
// For now, all cross-library drags are copies
if (sourceItemGroup.ref.libraryID != targetItemGroup.ref.libraryID) {
this._setDropEffect(event, "copy");
return false;
}
}
if ((Zotero.isMac && event.metaKey) || (!Zotero.isMac && event.shiftKey)) {
this._setDropEffect(event, "move");
}
else {
this._setDropEffect(event, "copy");
}
}
else if (event.dataTransfer.types.contains("application/x-moz-file")) {
// As of Aug. 2013 nightlies:
//
// - Setting the dropEffect only works on Linux and OS X.
//
// - Modifier keys don't show up in the drag event on OS X until the
// drop (https://bugzilla.mozilla.org/show_bug.cgi?id=911918),
// so since we can't show a correct effect, we leave it at
// the default 'move', the least misleading option, and set it
// below in onDrop().
//
// - The cursor effect gets set by the system on Windows 7 and can't
// be overridden.
if (!Zotero.isMac) {
if (event.shiftKey) {
if (event.ctrlKey) {
event.dataTransfer.dropEffect = "link";
}
else {
event.dataTransfer.dropEffect = "move";
}
}
else {
event.dataTransfer.dropEffect = "copy";
}
}
}
return false;
},
/*
* Called by HTML 5 Drag and Drop when dropping onto the tree
*/
onDrop: function (event) {
// See note above
if (event.dataTransfer.types.contains("application/x-moz-file")) {
if (Zotero.isMac) {
Zotero.DragDrop.currentDragEvent = event;
if (event.metaKey) {
if (event.altKey) {
event.dataTransfer.dropEffect = 'link';
}
else {
event.dataTransfer.dropEffect = 'move';
}
}
else {
event.dataTransfer.dropEffect = 'copy';
}
}
}
return false;
},
onDragExit: function (event) {
//Zotero.debug("Clearing drag data");
Zotero.DragDrop.currentDragEvent = null;
},
_setDropEffect: function (event, effect) {
// On Windows (in Fx26), Firefox uses 'move' for unmodified drags,
// and 'copy'/'link' for drags with system-default modifier keys,
// as long as the actions are allowed by the initial effectAllowed set
// in onDragStart, regardless of the effectAllowed or dropEffect set
// in onDragOver. To prevent inaccurate 'copy'/'link' cursors, we set
// effectAllowed to 'move' in onDragStart, which locks the cursor at
// 'move'. ('none' still changes the cursor, but 'copy'/'link' do not.)
//
// However, since effectAllowed is enforced, leaving it at 'move'
// would prevent our default 'copy' from working, so we also have to
// set effectAllowed here (called from onDragOver) to the same action
// as the dropEffect. This allows the dropEffect setting (which we use
// in the tree's canDrop() and drop() to determine the desired action)
// to be changed, even if the cursor doesn't reflect the new setting.
if (Zotero.isWin) {
event.dataTransfer.effectAllowed = effect;
}
event.dataTransfer.dropEffect = effect;
}
};

View file

@ -678,7 +678,10 @@ $rdf.Serializer = function () {
function escapeForXML(str) {
if(typeof str == 'undefined') return '@@@undefined@@@@';
return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
return str.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
}
function relURI(term) {

View file

@ -39,7 +39,7 @@ const ZOTERO_CONFIG = {
BOOKMARKLET_ORIGIN : 'https://www.zotero.org',
HTTP_BOOKMARKLET_ORIGIN : 'http://www.zotero.org',
BOOKMARKLET_URL: 'https://www.zotero.org/bookmarklet/',
VERSION: "4.0.20.1.SOURCE"
VERSION: "4.0.21.SOURCE"
};
// Commonly used imports accessible anywhere
@ -2420,17 +2420,17 @@ Zotero.Keys = new function() {
* Called by Zotero.init()
*/
function init() {
var actions = Zotero.Prefs.prefBranch.getChildList('keys', {}, {});
var cmds = Zotero.Prefs.prefBranch.getChildList('keys', {}, {});
// Get the key=>command mappings from the prefs
for each(var action in actions) {
var action = action.substr(5); // strips 'keys.'
for each(var cmd in cmds) {
cmd = cmd.substr(5); // strips 'keys.'
// Remove old pref
if (action == 'overrideGlobal') {
if (cmd == 'overrideGlobal') {
Zotero.Prefs.clear('keys.overrideGlobal');
continue;
}
_keys[Zotero.Prefs.get('keys.' + action)] = action;
_keys[this.getKeyForCommand(cmd)] = cmd;
}
}
@ -2453,7 +2453,7 @@ Zotero.Keys = new function() {
globalKeys.forEach(function (x) {
let keyElem = document.getElementById('key_' + x.name);
if (keyElem) {
let prefKey = Zotero.Prefs.get('keys.' + x.name);
let prefKey = this.getKeyForCommand(x.name);
// Only override the default with the pref if the <key> hasn't
// been manually changed and the pref has been
if (keyElem.getAttribute('key') == x.defaultKey
@ -2462,7 +2462,7 @@ Zotero.Keys = new function() {
keyElem.setAttribute('key', prefKey);
}
}
});
}.bind(this));
}
@ -2470,6 +2470,15 @@ Zotero.Keys = new function() {
key = key.toUpperCase();
return _keys[key] ? _keys[key] : false;
}
this.getKeyForCommand = function (cmd) {
try {
var key = Zotero.Prefs.get('keys.' + cmd);
}
catch (e) {}
return key !== undefined ? key.toUpperCase() : false;
}
}
@ -2509,14 +2518,12 @@ Zotero.VersionHeader = {
}
Zotero.DragDrop = {
currentDataTransfer: null,
currentDragEvent: null,
currentTarget: null,
currentOrientation: 0,
getDragData: function (element, firstOnly) {
var dt = this.currentDataTransfer;
if (!dt) {
Zotero.debug("Drag data not available");
return false;
}
getDataFromDataTransfer: function (dataTransfer, firstOnly) {
var dt = dataTransfer;
var dragData = {
dataType: '',
@ -2524,7 +2531,6 @@ Zotero.DragDrop = {
dropEffect: dt.dropEffect
};
var len = firstOnly ? 1 : dt.mozItemCount;
if (dt.types.contains('zotero/collection')) {
@ -2562,6 +2568,46 @@ Zotero.DragDrop = {
}
return dragData;
},
getDragSource: function () {
var dt = this.currentDragEvent.dataTransfer;
if (!dt) {
Zotero.debug("Drag data not available", 2);
return false;
}
// For items, the drag source is the ItemGroup of the parent window
// of the source tree
if (dt.types.contains("zotero/item")) {
var sourceNode = dt.mozSourceNode;
if (!sourceNode || sourceNode.tagName != 'treechildren'
|| sourceNode.parentElement.id != 'zotero-items-tree') {
return false;
}
var win = sourceNode.ownerDocument.defaultView;
return win.ZoteroPane.collectionsView.itemGroup;
}
else {
return false;
}
},
getDragTarget: function () {
var event = this.currentDragEvent;
var target = event.target;
if (target.tagName == 'treechildren') {
var tree = target.parentNode;
if (tree.id == 'zotero-collections-tree') {
let row = {}, col = {}, obj = {};
tree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, obj);
let win = tree.ownerDocument.defaultView;
return win.ZoteroPane.collectionsView.getItemGroupAtRow(row.value);
}
}
return false;
}
}

View file

@ -631,9 +631,19 @@ var ZoteroPane = new function()
try {
// Ignore Cmd-Shift-Z keystroke in text areas
if (Zotero.isMac && key == 'Z' &&
event.originalTarget.localName == 'textarea') {
Zotero.debug('Ignoring keystroke in text area');
return;
(event.originalTarget.localName == 'input'
|| event.originalTarget.localName == 'textarea')) {
try {
var isSearchBar = event.originalTarget.parentNode.parentNode.id == 'zotero-tb-search';
}
catch (e) {
Zotero.debug(e, 1);
Components.utils.reportError(e);
}
if (!isSearchBar) {
Zotero.debug('Ignoring keystroke in text field');
return;
}
}
}
catch (e) {

View file

@ -301,10 +301,6 @@
<tree id="zotero-collections-tree" hidecolumnpicker="true" context="zotero-collectionmenu"
onmouseover="ZoteroPane_Local.collectionsView.setHighlightedRows();"
onselect="ZoteroPane_Local.onCollectionSelected();"
ondragstart="if (event.target.localName == 'treechildren') { ZoteroPane_Local.collectionsView.onDragStart(event); }"
ondragenter="return ZoteroPane_Local.collectionsView.onDragEnter(event)"
ondragover="return ZoteroPane_Local.collectionsView.onDragOver(event)"
ondrop="return ZoteroPane_Local.collectionsView.onDrop(event)"
seltype="cell" flex="1">
<treecols>
<treecol
@ -313,7 +309,10 @@
primary="true"
hideheader="true"/>
</treecols>
<treechildren/>
<treechildren ondragstart="ZoteroPane_Local.collectionsView.onDragStart(event)"
ondragenter="return ZoteroPane_Local.collectionsView.onDragEnter(event)"
ondragover="return ZoteroPane_Local.collectionsView.onDragOver(event)"
ondrop="return ZoteroPane_Local.collectionsView.onDrop(event)"/>
</tree>
<splitter id="zotero-tags-splitter" onmouseup="ZoteroPane_Local.updateTagSelectorSize()" collapse="after"
zotero-persist="state">
@ -346,10 +345,6 @@
onfocus="if (ZoteroPane_Local.itemsView.rowCount &amp;&amp; !ZoteroPane_Local.itemsView.selection.count) { ZoteroPane_Local.itemsView.selection.select(0); }"
onkeydown="ZoteroPane_Local.handleKeyDown(event, this.id)"
onselect="ZoteroPane_Local.itemSelected(event)"
ondragstart="if (event.target.localName == 'treechildren') { ZoteroPane_Local.itemsView.onDragStart(event); }"
ondragenter="return ZoteroPane_Local.itemsView.onDragEnter(event)"
ondragover="return ZoteroPane_Local.itemsView.onDragOver(event)"
ondrop="return ZoteroPane_Local.itemsView.onDrop(event)"
oncommand="ZoteroPane_Local.serializePersist()"
flex="1">
<treecols id="zotero-items-columns-header">
@ -527,7 +522,10 @@
src="chrome://zotero/skin/treeitem-note-small.png"
zotero-persist="width ordinal hidden sortActive sortDirection"/>
</treecols>
<treechildren/>
<treechildren ondragstart="ZoteroPane_Local.itemsView.onDragStart(event)"
ondragenter="return ZoteroPane_Local.itemsView.onDragEnter(event)"
ondragover="return ZoteroPane_Local.itemsView.onDragOver(event)"
ondrop="return ZoteroPane_Local.itemsView.onDrop(event)"/>
</tree>
<!-- Label for displaying messages when items pane is hidden

View file

@ -4,7 +4,7 @@ general.success=Bien
general.error=Error
general.warning=Aviso
general.dontShowWarningAgain=No mostrar más este aviso.
general.browserIsOffline=%S está en modo desconectado [offline].
general.browserIsOffline=%S está en modo desconectado.
general.locate=Encontrar...
general.restartRequired=Hace falta reiniciar
general.restartRequiredForChange=%S debe reiniciarse para que se realice el cambio.
@ -963,5 +963,5 @@ firstRunGuidance.saveIcon=Zotero ha reconocido una referencia en esta página. P
firstRunGuidance.authorMenu=Zotero te permite también especificar editores y traductores. Puedes cambiar el rol de autor a editor o traductor seleccionándolo desde este menú.
firstRunGuidance.quickFormat=Escribe el título o el autor para buscar una referencia. \n\nDespués de que hayas hecho tu selección, haz clic en la burbuja o pulsa Ctrl-\u2193 para agregar números de página, prefijos o sufijos. También puedes incluir un número de página junto con tus términos de búsqueda para añadirlo directamente.\n\nPuedes editar citas directamente en el documento del procesador de textos.
firstRunGuidance.quickFormatMac=Escribe el título o el autor para buscar una referencia. \n\nDespués de que hayas hecho tu selección, haz clic en la burbuja o pulsa Cmd-\u2193 para agregar números de página, prefijos o sufijos. También puedes incluir un número de página junto con tus términos de búsqueda para añadirlo directamente.\n\nPuedes editar citas directamente en el documento del procesador de textos.
firstRunGuidance.toolbarButton.new=Click here 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.toolbarButton.new=Clic aquí para abrir Zotero o utilice el atajo de teclado %S
firstRunGuidance.toolbarButton.upgrade=El ícono Zotero ahora se encuentra en la barra de Firefox. Clic en el ícono para abrir Zotero, o use el atajo de teclado %S.

View file

@ -1,13 +1,13 @@
<!ENTITY zotero.version "versija">
<!ENTITY zotero.createdby "Sukurta:">
<!ENTITY zotero.createdby "Sukurė:">
<!ENTITY zotero.director "Direktorius:">
<!ENTITY zotero.directors "Direktoriai:">
<!ENTITY zotero.developers "Programuotojai:">
<!ENTITY zotero.alumni "Buvę studentai:">
<!ENTITY zotero.alumni "Ankstesni talkininkai:">
<!ENTITY zotero.about.localizations "Vertėjai:">
<!ENTITY zotero.about.additionalSoftware "Kitos Programos ir Standartai:">
<!ENTITY zotero.executiveProducer "Vykdomasis Prodiuseris:">
<!ENTITY zotero.thanks "Dėkojame:">
<!ENTITY zotero.about.close "Uždaryti">
<!ENTITY zotero.moreCreditsAndAcknowledgements "Papildomi Kreditai ir Padėkos">
<!ENTITY zotero.citationProcessing "Citatų ir Bibliografijos Apdorojimas">
<!ENTITY zotero.about.additionalSoftware "Kitos programos ir standartai:">
<!ENTITY zotero.executiveProducer "Pagrindinis rengėjas:">
<!ENTITY zotero.thanks "Ypač dėkojame:">
<!ENTITY zotero.about.close "Užverti">
<!ENTITY zotero.moreCreditsAndAcknowledgements "Kitos padėkos">
<!ENTITY zotero.citationProcessing "Citatų ir bibliografijos apdorojimas">

View file

@ -28,7 +28,7 @@
<!ENTITY zotero.preferences.zoteroDotOrgVersionHeader "Leisti zotero.org derinti turinį pagal dabartinę Zotero versiją">
<!ENTITY zotero.preferences.zoteroDotOrgVersionHeader.tooltip "Jei parinktis įgalinta, dabartinė Zotero versija bus automatiškai įtraukta į zotero.org HTTP užklausas.">
<!ENTITY zotero.preferences.parseRISRefer "Zotero naudoti BibTeX/RIS/Refer failų parsiuntimui">
<!ENTITY zotero.preferences.automaticSnapshots "Pagal kuriamiems naujiems įrašams automatiškai sukurti nuotraukas">
<!ENTITY zotero.preferences.automaticSnapshots "Kuriamiems naujiems įrašams automatiškai sukurti nuotraukas">
<!ENTITY zotero.preferences.downloadAssociatedFiles "Įrašant įrašus, automatiškai prisegti susijusius PDF dokumentus ir kitus failus">
<!ENTITY zotero.preferences.automaticTags "Įrašams automatiškai priskirti gaires su raktažodžiais ir temomis">
<!ENTITY zotero.preferences.trashAutoEmptyDaysPre "Automatiškai šiukšlinės šalinti įrašus, senesnius nei">
@ -39,7 +39,7 @@
<!ENTITY zotero.preferences.groups.childNotes "įrašams priklausančias pastabas">
<!ENTITY zotero.preferences.groups.childFiles "įrašams priklausančias nuotraukas ir importuotus failus">
<!ENTITY zotero.preferences.groups.childLinks "įrašams priklausančias nuorodas">
<!ENTITY zotero.preferences.groups.tags "gairės">
<!ENTITY zotero.preferences.groups.tags "gaires">
<!ENTITY zotero.preferences.openurl.caption "OpenURL">
@ -115,7 +115,7 @@
<!ENTITY zotero.preferences.cite.styles "Stiliai">
<!ENTITY zotero.preferences.cite.wordProcessors "Tekstų rengyklės">
<!ENTITY zotero.preferences.cite.wordProcessors.noWordProcessorPluginsInstalled "Nerasta įdiegtų teksto rengyklės papildinių.">
<!ENTITY zotero.preferences.cite.wordProcessors.getPlugins "Diegti papildinius į tekstų rengykles...">
<!ENTITY zotero.preferences.cite.wordProcessors.getPlugins "Papildinių diegimas į tekstų rengykles...">
<!ENTITY zotero.preferences.cite.wordProcessors.getPlugins.url "http://www.zotero.org/support/word_processor_plugin_installation_for_zotero_2.1">
<!ENTITY zotero.preferences.cite.wordProcessors.useClassicAddCitationDialog "Naudoti klasikinį citatų įdėjimo langą">

View file

@ -47,7 +47,7 @@
<!ENTITY zotero.items.itemType "Įrašo tipas">
<!ENTITY zotero.items.type_column "Tipas">
<!ENTITY zotero.items.title_column "Antraštė">
<!ENTITY zotero.items.creator_column "Kūrėjas">
<!ENTITY zotero.items.creator_column "Autorius">
<!ENTITY zotero.items.date_column "Data">
<!ENTITY zotero.items.year_column "Metai">
<!ENTITY zotero.items.publisher_column "Leidėjas">
@ -100,7 +100,7 @@
<!ENTITY zotero.toolbar.removeItem.label "Pašalinti įrašą...">
<!ENTITY zotero.toolbar.newCollection.label "Naujas rinkinys...">
<!ENTITY zotero.toolbar.newGroup "Nauja grupė...">
<!ENTITY zotero.toolbar.newSubcollection.label "Naujas kolekcija kolekcijoje...">
<!ENTITY zotero.toolbar.newSubcollection.label "Naujas poaplankis...">
<!ENTITY zotero.toolbar.newSavedSearch.label "Nauja įsiminta paieška...">
<!ENTITY zotero.toolbar.emptyTrash.label "Išvalyti šiukšlinę">
<!ENTITY zotero.toolbar.tagSelector.label "Rodyti/slėpti gairių parinkiklį">
@ -188,7 +188,7 @@
<!ENTITY zotero.citation.page "Puslapis">
<!ENTITY zotero.citation.paragraph "Pastraipa">
<!ENTITY zotero.citation.line "Eilutė">
<!ENTITY zotero.citation.suppressAuthor.label "Trumpinti autorius">
<!ENTITY zotero.citation.suppressAuthor.label "Nerodyti autoriaus">
<!ENTITY zotero.citation.prefix.label "Priešdėlis:">
<!ENTITY zotero.citation.suffix.label "Priesaga:">
<!ENTITY zotero.citation.editorWarning.label "Įspėjimas: jei pakeisite citavimą tekstų rengyklėje, jis nebebus atnaujinamas pagal jūsiškę duomenų bazę ar citavimo stilių.">
@ -225,7 +225,7 @@
<!ENTITY zotero.integration.references.label "Nuorodos bibliogafijoje">
<!ENTITY zotero.sync.button "Sinchronizuoti su Zotero serveriu">
<!ENTITY zotero.sync.button "Sinchronizavimas su Zotero serveriu">
<!ENTITY zotero.sync.error "Sinchronizavimo klaida">
<!ENTITY zotero.sync.storage.progress "Eiga:">
<!ENTITY zotero.sync.storage.downloads "Siuntiniai:">

View file

@ -116,12 +116,12 @@ dataDir.moveFilesToNewLocation=Prieš vėl atverdami %1$S, būtinai perkelkite s
dataDir.incompatibleDbVersion.title=Nesuderinama duomenų bazės versija
dataDir.incompatibleDbVersion.text=Šiuo metu pasirinktas duomenų katalogas nėra suderinamas su savarankiška Zotero programa, kuri gali dalinti savo duomenimis tik su Zotero, kuri skirta Firefox 2.1b3 ir vėlesnėms versijoms.\n\nĮdiekite Firefox programai skirtą Zotero versiją arba savarankiškai Zotero programai pasirinkite kitą duomenų katalogą.
dataDir.standaloneMigration.title=Aptikta esama Zotero biblioteka
dataDir.standaloneMigration.description=Regis Jūs pirmą kartą paleidote %1$S. Ar norėtumėte, kad %1$S importuotų nuostatas iš %2$S ir naudotų jūsų esamą duomenų katalogą?
dataDir.standaloneMigration.description=%1$S regis paleista pirmą kartą. Ar norėtumėte, kad %1$S naudotų tas pačias kaip ir %2$S, bei naudotų jos duomenų katalogą?
dataDir.standaloneMigration.multipleProfiles=%1$S dalinsis savo duomenų katalogu su paskiausiai naudotu profiliu.
dataDir.standaloneMigration.selectCustom=Savitas duomenų katalogas...
app.standalone=Savarankiška Zotero programa
app.firefox=Zotero, skirta Firefox
app.standalone=Savarankiška Zotero programa
app.firefox=„Firefox naršyklei skirta Zotero“
startupError=Klaida paleidžiant Zotero.
startupError.databaseInUse=Jūsiškė duomenų bazė šiuo metu yra naudojama. Tuo pačiu metu tik viena Zotero programa gali naudotis ta pačia duomenų baze.
@ -242,8 +242,8 @@ pane.item.duplicates.onlySameItemType=Apjungti galima tik to paties tipo įrašu
pane.item.changeType.title=Pakeisti įrašo tipą
pane.item.changeType.text=Tikrai norėtumėte pakeisti įrašo tipą?\n\nPrarasite tokius laukus:
pane.item.defaultFirstName=pirmas
pane.item.defaultLastName=paskutinis
pane.item.defaultFirstName=vardas
pane.item.defaultLastName=pavardė
pane.item.defaultFullName=visas vardas
pane.item.switchFieldMode.one=Rodyti viename lauke
pane.item.switchFieldMode.two=Rodyti dviejuose laukuose
@ -697,7 +697,7 @@ integration.cited.loading=Įkeliami cituoti įrašai...
integration.ibid=ten pat
integration.emptyCitationWarning.title=Tuščia nuoroda
integration.emptyCitationWarning.body=Naudojant dabartinį citavimo stilių, šis citavimas atrodys tuščias. Tikrai jį pridėti?
integration.openInLibrary=Atverti su %S
integration.openInLibrary=Atverti „%S“
integration.error.incompatibleVersion=Šis Zotero tekstų rengyklės papildinys ($INTEGRATION_VERSION) nesuderinamas su dabar įdiegta Zotero versija (%1$S). Įsitikinkite, ar naudojate abiejų komponentų naujausias versijas.
integration.error.incompatibleVersion2=Zotero %1$S programai reikia %2$S %3$S arba naujesnės versijos. Naujausią %2$S versiją parsisiųskite iš zotero.org.

View file

@ -52,6 +52,7 @@ const xpcomFilesAll = [
/** XPCOM files to be loaded only for local translation and DB access **/
const xpcomFilesLocal = [
'libraryTreeView',
'collectionTreeView',
'annotate',
'attachments',

View file

@ -6,7 +6,7 @@
<em:id>zotero@chnm.gmu.edu</em:id>
<em:name>Zotero</em:name>
<em:version>4.0.20.1.SOURCE</em:version>
<em:version>4.0.21.SOURCE</em:version>
<em:creator>Center for History and New Media<br/>George Mason University</em:creator>
<em:contributor>Dan Cohen</em:contributor>
<em:contributor>Sean Takats</em:contributor>

View file

@ -7,7 +7,7 @@
<RDF:Seq>
<RDF:li>
<RDF:Description>
<version>4.0.20.1.SOURCE</version>
<version>4.0.21.SOURCE</version>
<targetApplication>
<RDF:Description>
<id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</id>