www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit e57658c5e239df566620dcdab0659ab56c97f3e5
parent 2ebb9ddaf10f91626771e49de4b7b3097141f3ae
Author: Simon Kornblith <simon@simonster.com>
Date:   Sun,  4 Dec 2011 13:20:11 -0500

Merge branch '3.0'

Diffstat:
Mchrome/content/zotero/bindings/attachmentbox.xml | 4++--
Mchrome/content/zotero/bindings/noteeditor.xml | 8++++++--
Mchrome/content/zotero/bindings/styled-textbox.xml | 1+
Mchrome/content/zotero/integration/quickFormat.js | 12+++---------
Mchrome/content/zotero/xpcom/annotate.js | 28++++++++++++++--------------
5 files changed, 26 insertions(+), 27 deletions(-)

diff --git a/chrome/content/zotero/bindings/attachmentbox.xml b/chrome/content/zotero/bindings/attachmentbox.xml @@ -297,7 +297,7 @@ } // Note editor - var noteEditor = this._id('note-editor'); + var noteEditor = this._id('attachment-note-editor'); if (this.displayNote) { if (this.displayNoteIfEmpty || this.item.getNote() != '') { Zotero.debug("setting links on top"); @@ -542,7 +542,7 @@ </rows> </grid> - <zoteronoteeditor id="note-editor" notitle="1" flex="1"/> + <zoteronoteeditor id="attachment-note-editor" notitle="1" flex="1"/> <button id="select-button" hidden="true"/> </vbox> diff --git a/chrome/content/zotero/bindings/noteeditor.xml b/chrome/content/zotero/bindings/noteeditor.xml @@ -216,9 +216,13 @@ <method name="save"> <body> <![CDATA[ - var noteField = this._id('noteField'); + if (this._mode == 'view') { + Zotero.debug("Not saving read-only note"); + return; + } // Update note + var noteField = this._id('noteField'); if (this.item) { // If note is reselected automatically after save // from external note window, don't overwrite content @@ -493,7 +497,7 @@ </method> </implementation> <content> - <xul:vbox id="note-editor" xbl:inherits="flex"> + <xul:vbox xbl:inherits="flex"> <xul:grid> <xul:columns> <xul:column/> diff --git a/chrome/content/zotero/bindings/styled-textbox.xml b/chrome/content/zotero/bindings/styled-textbox.xml @@ -103,6 +103,7 @@ this._constructed = true; + // Don't load if a value hasn't yet been set if (this._loadOnConstruct) { this._load(); } diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js @@ -162,7 +162,7 @@ var Zotero_QuickFormat = new function () { var str = _getEditorContent(); var haveConditions = false; - const specifiedLocatorRe = /(?:,? *(pp|p)(?:\. *| +)|:)([0-9\-]+) *$/; + const specifiedLocatorRe = /^(?:,? *(pp|p)(?:\. *| +)|:)([0-9\-]+) *$/; const yearPageLocatorRe = /,? *([0-9]+) *((B[. ]*C[. ]*|B[. ]*)|[AC][. ]*|A[. ]*D[. ]*|C[. ]*E[. ]*)?,? *(?:([0-9\-]+))?$/i; const creatorSplitRe = /(?:,| *(?:and|\&)) +/; const charRe = /[\w\u007F-\uFFFF]/; @@ -230,22 +230,16 @@ var Zotero_QuickFormat = new function () { str = str.substr(0, m.index)+str.substring(m.index+m[0].length); } + if(year) str += " "+year; var s = new Zotero.Search(); str = str.replace(" & ", " ", "g").replace(" and ", " ", "g"); if(charRe.test(str)) { Zotero.debug("QuickFormat: QuickSearch: "+str); - s.addCondition("quicksearch-titlesAndCreators", "contains", str); + s.addCondition("quicksearch-titleCreatorYear", "contains", str); s.addCondition("itemType", "isNot", "attachment"); haveConditions = true; } - - if(year) { - Zotero.debug("QuickFormat: Year: "+year); - s.addCondition("date", "isAfter", (year-1)+"-12-31 23:59:59"); - s.addCondition("date", "isBefore", (year)+"-12-31 23:59:59"); - haveConditions = true; - } } var ids = (haveConditions ? s.search() : []); diff --git a/chrome/content/zotero/xpcom/annotate.js b/chrome/content/zotero/xpcom/annotate.js @@ -262,7 +262,7 @@ Zotero.Annotate = new function() { function _seen(node,array) { var seen = false; for (n in array) { - if (node.isSameNode(array[n])) { + if (node === array[n]) { var seen = true; } } @@ -389,7 +389,7 @@ Zotero.Annotate.Path.prototype.fromNode = function(node, offset) { } if(!node) throw "Annotate: Path() resolved text offset inappropriately"; - while(node && !node.isSameNode(this._document)) { + while(node && !node === this._document) { var number = 1; var sibling = node.previousSibling; while(sibling) { @@ -1378,7 +1378,7 @@ Zotero.Highlight.prototype.unhighlight = function(container, offset, path, mode) if(!span) continue; var parentNode = span.parentNode; - if(mode != 0 && span.isSameNode(container.parentNode) && offset != 0) { + if(mode != 0 && span === container.parentNode && offset != 0) { if(mode == 1) { // split text node var textNode = container.splitText(offset); @@ -1387,7 +1387,7 @@ Zotero.Highlight.prototype.unhighlight = function(container, offset, path, mode) // loop through, removing nodes var node = span.firstChild; - while(span.firstChild && !span.firstChild.isSameNode(textNode)) { + while(span.firstChild && !span.firstChild === textNode) { parentNode.insertBefore(span.removeChild(span.firstChild), span); } } else if(mode == 2) { @@ -1435,25 +1435,25 @@ Zotero.Highlight.prototype._highlight = function() { var ancestor = this.range.commonAncestorContainer; - var onlyOneNode = startNode.isSameNode(endNode); + var onlyOneNode = startNode === endNode; - if(!onlyOneNode && !startNode.isSameNode(ancestor) && !endNode.isSameNode(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.isSameNode(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.isSameNode(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.isSameNode(endNode.previousSibling)) { + if(!startNode === endNode.previousSibling) { this._highlightSpaceBetween(startNode.nextSibling, endNode.previousSibling); } } @@ -1531,10 +1531,10 @@ Zotero.Highlight.prototype._highlightTextNode = function(textNode) { // look for span in this.spans and delete it if it's there var span = previousSiblingHighlighted ? previousSibling : nextSibling; for(var i=0; i<this.spans.length; i++) { - if(parent.isSameNode(this.spans[i])) { + if(parent === this.spans[i]) { this.spans.splice(i, 1); i--; - } else if(span.isSameNode(this.spans[i])) { + } else if(span === this.spans[i]) { saveSpan = false; } } @@ -1546,14 +1546,14 @@ Zotero.Highlight.prototype._highlightTextNode = function(textNode) { var span = previousSibling; for(var i=0; i<this.spans.length; i++) { - if(span.isSameNode(this.spans[i])) saveSpan = false; + if(span === this.spans[i]) saveSpan = false; } } else if(nextSiblingHighlighted) { nextSibling.insertBefore(parent.removeChild(textNode), nextSibling.firstChild); var span = nextSibling; for(var i=0; i<this.spans.length; i++) { - if(span.isSameNode(this.spans[i])) saveSpan = false; + if(span === this.spans[i]) saveSpan = false; } } else { var previousSibling = textNode.previousSibling; @@ -1607,7 +1607,7 @@ Zotero.Highlight.prototype._highlightSpaceBetween = function(start, end) { } // do this in the middle, after we're finished with node but before we add any spans - if(node.isSameNode(end)) { + if(node === end) { node = false; } else { node = node.nextSibling;