From 3bd1ff7676b1b309b9fcf2592906639d5a2bfbd9 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 1 Feb 2012 18:15:29 -0500 Subject: [PATCH 1/2] Fix broken annotations --- chrome/content/zotero/xpcom/annotate.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/xpcom/annotate.js b/chrome/content/zotero/xpcom/annotate.js index 5d84b5fbb..4736bb4cc 100644 --- a/chrome/content/zotero/xpcom/annotate.js +++ b/chrome/content/zotero/xpcom/annotate.js @@ -389,7 +389,7 @@ Zotero.Annotate.Path.prototype.fromNode = function(node, offset) { } if(!node) throw "Annotate: Path() resolved text offset inappropriately"; - while(node && !node === this._document) { + while(node && node !== this._document) { var number = 1; var sibling = node.previousSibling; while(sibling) { @@ -731,10 +731,18 @@ Zotero.Annotations.prototype.save = function() { // save annotations for each(var annotation in this.annotations) { - annotation.save(); + // Don't drop all annotations if one is broken (due to ~3.0 glitch) + try { + annotation.save(); + } + catch(e) { + Zotero.debug(e); + continue; + } } Zotero.DB.commitTransaction(); } catch(e) { + Zotero.debug(e); Zotero.DB.rollbackTransaction(); throw(e); } @@ -1387,7 +1395,7 @@ Zotero.Highlight.prototype.unhighlight = function(container, offset, path, mode) // loop through, removing nodes var node = span.firstChild; - while(span.firstChild && !span.firstChild === textNode) { + while(span.firstChild && span.firstChild !== textNode) { parentNode.insertBefore(span.removeChild(span.firstChild), span); } } else if(mode == 2) { @@ -1437,23 +1445,23 @@ Zotero.Highlight.prototype._highlight = function() { var onlyOneNode = startNode === endNode; - if(!onlyOneNode && !startNode === ancestor && !endNode === ancestor) { + if(!onlyOneNode && startNode !== ancestor && endNode !== ancestor) { // highlight nodes after start node in the DOM hierarchy not at ancestor level - while(startNode.parentNode && !startNode.parentNode === ancestor) { + while(startNode.parentNode && startNode.parentNode !== ancestor) { if(startNode.nextSibling) { this._highlightSpaceBetween(startNode.nextSibling, startNode.parentNode.lastChild); } startNode = startNode.parentNode } // highlight nodes after end node in the DOM hierarchy not at ancestor level - while(endNode.parentNode && !endNode.parentNode === ancestor) { + while(endNode.parentNode && endNode.parentNode !== ancestor) { if(endNode.previousSibling) { this._highlightSpaceBetween(endNode.parentNode.firstChild, endNode.previousSibling); } endNode = endNode.parentNode } // highlight nodes between start node and end node at ancestor level - if(!startNode === endNode.previousSibling) { + if(startNode !== endNode.previousSibling) { this._highlightSpaceBetween(startNode.nextSibling, endNode.previousSibling); } } From ebfae117fd139685ac7f3560f499d6dc4dbc051d Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 1 Feb 2012 18:18:38 -0500 Subject: [PATCH 2/2] Remove "classic" part of QuickFormat first-run guidance --- chrome/locale/en-US/zotero/zotero.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index a73988036..53bcbc171 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -759,4 +759,4 @@ connector.standaloneOpen = Your database cannot be accessed because Zotero Sta firstRunGuidance.saveIcon = Zotero can recognize a reference on this page. Click this icon in the address bar to save the reference to your Zotero library. firstRunGuidance.authorMenu = Zotero lets you specify editors and translators, too. You can turn an author into an editor or translator by selecting from this menu. -firstRunGuidance.quickFormat = Type a title or author to search for a reference. After you've made your selection, click the bubble to add page numbers, prefixes, or suffixes.\n\nIf you prefer the "classic" add citation dialog, you can revert to it in the Zotero preferences. \ No newline at end of file +firstRunGuidance.quickFormat = Type a title or author to search for a reference. After you've made your selection, click the bubble to add page numbers, prefixes, or suffixes. \ No newline at end of file