commit db6ec2b160b6f80bfb70d3c06a53a98be85d9405
parent 370fa78048293e3921ab01c766eb716f6571fd2d
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 28 May 2014 14:31:58 -0400
Persist single position/size for all note windows
Previously, position/size was persisted for each item's note
individually, but that meant that there was no default position/size for
the note window and an entry was created in localstore.rdf for
every note opened in a new window. There's also a good chance people had
no idea what was going on.
Diffstat:
3 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/chrome/content/zotero/note.js b/chrome/content/zotero/note.js
@@ -34,17 +34,12 @@ function onLoad() {
// Set font size from pref
Zotero.setFontSize(noteEditor);
- var params = [];
- var b = document.location.href.substr(document.location.href.indexOf('?')+1).split('&');
- for(var i = 0; i < b.length; i++)
- {
- var mid = b[i].indexOf('=');
-
- params[b[i].substr(0,mid)] = b[i].substr(mid+1);
+ if (window.arguments) {
+ var io = window.arguments[0];
}
- var itemID = params.id;
- var collectionID = params.coll;
- var parentItemID = params.p;
+ var itemID = io.itemID;
+ var collectionID = io.collectionID;
+ var parentItemID = io.parentItemID;
if (itemID) {
var ref = Zotero.Items.get(itemID);
diff --git a/chrome/content/zotero/note.xul b/chrome/content/zotero/note.xul
@@ -11,6 +11,7 @@
height="350"
title="&zotero.items.menu.attach.note;"
persist="screenX screenY width height"
+ windowtype="zotero:note"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="include.js"/>
diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js
@@ -3012,7 +3012,7 @@ var ZoteroPane = new function()
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
- var e = wm.getEnumerator('');
+ var e = wm.getEnumerator('zotero:note');
while (e.hasMoreElements()) {
var w = e.getNext();
if (w.name == name) {
@@ -3022,10 +3022,8 @@ var ZoteroPane = new function()
}
}
- window.open('chrome://zotero/content/note.xul?v=1'
- + (itemID ? '&id=' + itemID : '') + (col ? '&coll=' + col : '')
- + (parentItemID ? '&p=' + parentItemID : ''),
- name, 'chrome,resizable,centerscreen');
+ var io = { itemID: itemID, collectionID: col, parentItemID: parentItemID };
+ window.openDialog('chrome://zotero/content/note.xul', name, 'chrome,resizable,centerscreen', io);
}