commit dce1298666e9cb387e8fa1e64335f6e54017a11b
parent 352a49723e896f5e0fcfc8b91ca60d4aa8684479
Author: Simon Kornblith <simon@simonster.com>
Date: Fri, 29 Jul 2011 08:00:21 +0000
Use red Z instead of search icon (this will probably become a popup menu)
Diffstat:
4 files changed, 40 insertions(+), 22 deletions(-)
diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js
@@ -24,7 +24,7 @@
*/
var Zotero_QuickFormat = new function () {
- var io, qft, qftWindow, qftDocument, qfe,
+ var io, qfs, qfi, qfiWindow, qfiDocument, qfe,
qfb, qfbHeight,
referenceBox, referenceHeight,
dragX, dragY, curLocator, curLocatorLabel,
@@ -35,14 +35,15 @@ var Zotero_QuickFormat = new function () {
* Initialize add citation dialog
*/
this.onLoad = function() {
- qft = document.getElementById("quick-format-search");
+ qfs = document.getElementById("quick-format-search");
+ qfi = document.getElementById("quick-format-iframe");
qfb = document.getElementById("quick-format-entry");
qfbHeight = qfb.scrollHeight;
referenceBox = document.getElementById("quick-format-reference-list");
- qftWindow = qft.contentWindow;
- qftDocument = qft.contentDocument;
+ qfiWindow = qfi.contentWindow;
+ qfiDocument = qfi.contentDocument;
qfb.addEventListener("keypress", _onQuickSearchKeyPress, false);
- qfe = qftDocument.getElementById("quick-format-editor");
+ qfe = qfiDocument.getElementById("quick-format-editor");
qfe.focus();
// Add labels to popup
@@ -65,8 +66,8 @@ var Zotero_QuickFormat = new function () {
io = window.arguments[0].wrappedJSObject;
if(io.citation.citationItems.length) {
// hack to get spacing right
- var evt = qftDocument.createEvent("KeyboardEvent");
- evt.initKeyEvent("keypress", true, true, qftWindow,
+ var evt = qfiDocument.createEvent("KeyboardEvent");
+ evt.initKeyEvent("keypress", true, true, qfiWindow,
0, 0, 0, 0,
0, " ".charCodeAt(0))
qfe.dispatchEvent(evt);
@@ -85,7 +86,7 @@ var Zotero_QuickFormat = new function () {
* Gets the content of the text node that the cursor is currently within
*/
function _getCurrentEditorTextNode() {
- var selection = qftWindow.getSelection();
+ var selection = qfiWindow.getSelection();
var range = selection.getRangeAt(0);
var node = range.startContainer;
@@ -171,6 +172,7 @@ var Zotero_QuickFormat = new function () {
}
var s = new Zotero.Search();
+ var haveConditions = false;
if(charRe.test(str)) {
Zotero.debug("QuickFormat: QuickSearch: "+str);
@@ -348,7 +350,7 @@ var Zotero_QuickFormat = new function () {
// It's entirely unintuitive why, but after trying a bunch of things, it looks like using
// a XUL label for these things works best. A regular span causes issues with moving the
// cursor.
- var bubble = qftDocument.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "label");
+ var bubble = qfiDocument.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "label");
bubble.setAttribute("class", "quick-format-bubble");
bubble.setAttribute("value", str);
bubble.addEventListener("click", _onBubbleClick, false);
@@ -415,14 +417,15 @@ var Zotero_QuickFormat = new function () {
}
if(height === window.innerHeight) return;
+ Zotero.debug(qfeHeight);
if(qfeHeight > 20) {
- qft.style.height = (22-16+qfeHeight+(qft.style.height == "22px" ? 2 : -2))+"px";
+ qfs.style.height = (22-16+qfeHeight+(qfi.style.height == "22px" ? 2 : -2))+"px";
qfe.style.lineHeight = "18px";
- qft.setAttribute("multiline", true);
+ qfs.setAttribute("multiline", true);
} else {
- qft.style.height = "22px";
+ qfs.style.height = "22px";
qfe.style.lineHeight = "16px";
- qft.removeAttribute("multiline");
+ qfs.removeAttribute("multiline");
}
if(curResizer) curResizer.stop();
curResizer = new Resizer(window, null, height, 10, 100);
@@ -495,7 +498,7 @@ var Zotero_QuickFormat = new function () {
*/
function _onBubbleDrag(event) {
// just in case
- var el = qftDocument.getElementById("zotero-drag");
+ var el = qfiDocument.getElementById("zotero-drag");
if(el) el.parentNode.removeChild(el);
var dt = event.dataTransfer;
@@ -509,7 +512,7 @@ var Zotero_QuickFormat = new function () {
*/
function _onBubbleDrop(event) {
window.setTimeout(function() {
- var el = qftDocument.getElementById("zotero-drag");
+ var el = qfiDocument.getElementById("zotero-drag");
if(el) {
_insertBubble(dragging, el);
Zotero.debug(dragging);
diff --git a/chrome/content/zotero/integration/quickFormat.xul b/chrome/content/zotero/integration/quickFormat.xul
@@ -47,9 +47,12 @@
<vbox id="zotero-select-items-container" flex="1">
<hbox id="quick-format-entry" ondragstart="Zotero_QuickFormat.onDragStart(this, event)">
- <!-- javascript:encodeURIComponent('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="chrome://zotero/skin/integration.css"/></head><body id="quick-format-editor"/></html>') -->
- <iframe id="quick-format-search" ondragstart="event.stopPropagation()" src="data:application/xhtml+xml,%3C!DOCTYPE%20html%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20XHTML%201.0%20Strict%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FTR%2Fxhtml1%2FDTD%2Fxhtml1-strict.dtd%22%3E%3Chtml%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%3E%3Chead%3E%3Clink%20rel%3D%22stylesheet%22%20type%3D%22text%2Fcss%22%20href%3D%22chrome%3A%2F%2Fzotero%2Fskin%2Fintegration.css%22%2F%3E%3C%2Fhead%3E%3Cbody%20contenteditable%3D%22true%22%20id%3D%22quick-format-editor%22%2F%3E%3C%2Fhtml%3E"
- tabindex="1" flex="1"/>
+ <hbox id="quick-format-search" flex="1" align="start">
+ <image id="zotero-icon"/>
+ <!-- javascript:encodeURIComponent('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="chrome://zotero/skin/integration.css"/></head><body id="quick-format-editor"/></html>') -->
+ <iframe id="quick-format-iframe" ondragstart="event.stopPropagation()" src="data:application/xhtml+xml,%3C!DOCTYPE%20html%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20XHTML%201.0%20Strict%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FTR%2Fxhtml1%2FDTD%2Fxhtml1-strict.dtd%22%3E%3Chtml%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%3E%3Chead%3E%3Clink%20rel%3D%22stylesheet%22%20type%3D%22text%2Fcss%22%20href%3D%22chrome%3A%2F%2Fzotero%2Fskin%2Fintegration.css%22%2F%3E%3C%2Fhead%3E%3Cbody%20contenteditable%3D%22true%22%20id%3D%22quick-format-editor%22%2F%3E%3C%2Fhtml%3E"
+ tabindex="1" flex="1"/>
+ </hbox>
</hbox>
<richlistbox id="quick-format-reference-list" hidden="true" flex="1"/>
</vbox>
diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js
@@ -1804,7 +1804,7 @@ Zotero.Integration.Session.prototype.editCitation = function(index, noteIndex, c
io.style = this.style;
if(Zotero.Prefs.get("integration.quickFormat")) {
- this._displayDialog('chrome://zotero/content/integration/quickFormat.xul', io);
+ this._displayDialog('chrome://zotero/content/integration/quickFormat.xul', '', io);
} else {
this._displayDialog('chrome://zotero/content/integration/addCitationDialog.xul', 'resizable', io);
}
diff --git a/chrome/skin/default/zotero/integration.css b/chrome/skin/default/zotero/integration.css
@@ -143,12 +143,16 @@
}
#quick-format-search[multiline="true"] {
- padding: 1px 2px 0 18px;
+ padding: 2px 2px 0 18px;
border: 1px solid rgba(0, 0, 0, 0.5);
- border-radius: 8px;
+ border-radius: 10px;
-moz-appearance: none;
}
+#quick-format-search[multiline="true"] > #quick-format-iframe {
+ margin: -1px 0 0 0;
+}
+
body {
margin: 0 2px 0 2px;
padding: 0;
@@ -226,5 +230,13 @@ richlistitem[selected="true"] {
}
#citation-properties menulist > .menulist-dropmarker > .dropmarker-icon {
- list-style-image: url("chrome://browser/skin/hud-style-dropmarker-double-arrows.png");
+ list-style-image: url("chrome://browser/skin/hud-style-dropmarker-double-arrows.png");
+}
+
+#zotero-icon {
+ list-style-image: url("chrome://zotero/skin/zotero-new-z-16px.png");
+ width: 16px;
+ height: 16px;
+ background-color: #fff;
+ margin-left: -13px;
}
\ No newline at end of file