closes #551, ability to minimize annotations
This commit is contained in:
parent
bb0fe85b52
commit
8eeefc16e7
|
@ -41,6 +41,7 @@ var Zotero_Browser = new function() {
|
||||||
this.scrapeThisPage = scrapeThisPage;
|
this.scrapeThisPage = scrapeThisPage;
|
||||||
this.annotatePage = annotatePage;
|
this.annotatePage = annotatePage;
|
||||||
this.toggleMode = toggleMode;
|
this.toggleMode = toggleMode;
|
||||||
|
this.setCollapsed = setCollapsed;
|
||||||
this.chromeLoad = chromeLoad;
|
this.chromeLoad = chromeLoad;
|
||||||
this.chromeUnload = chromeUnload;
|
this.chromeUnload = chromeUnload;
|
||||||
this.contentLoad = contentLoad;
|
this.contentLoad = contentLoad;
|
||||||
|
@ -167,6 +168,14 @@ var Zotero_Browser = new function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* expands all annotations
|
||||||
|
*/
|
||||||
|
function setCollapsed(status) {
|
||||||
|
var tab = _getTabObject(Zotero_Browser.tabbrowser.selectedBrowser);
|
||||||
|
tab.page.annotations.setCollapsed(status);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* called to hide the collection selection popup
|
* called to hide the collection selection popup
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -315,6 +315,8 @@
|
||||||
<!-- Annotation Toolbar -->
|
<!-- Annotation Toolbar -->
|
||||||
<toolbar id="zotero-annotate-tb" crop="end" insertbefore="content" hidden="true">
|
<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);"/>
|
<toolbarbutton id="zotero-annotate-tb-add" tooltiptext="&zotero.annotate.toolbar.add.label;" oncommand="Zotero_Browser.toggleMode(this.id);"/>
|
||||||
|
<toolbarbutton id="zotero-annotate-tb-collapse" tooltiptext="&zotero.annotate.toolbar.collapse.label;" oncommand="Zotero_Browser.setCollapsed(true);"/>
|
||||||
|
<toolbarbutton id="zotero-annotate-tb-expand" tooltiptext="&zotero.annotate.toolbar.expand.label;" oncommand="Zotero_Browser.setCollapsed(false);"/>
|
||||||
<toolbarbutton id="zotero-annotate-tb-highlight" tooltiptext="&zotero.annotate.toolbar.highlight.label;" oncommand="Zotero_Browser.toggleMode(this.id);"/>
|
<toolbarbutton id="zotero-annotate-tb-highlight" tooltiptext="&zotero.annotate.toolbar.highlight.label;" oncommand="Zotero_Browser.toggleMode(this.id);"/>
|
||||||
<toolbarbutton id="zotero-annotate-tb-unhighlight" tooltiptext="&zotero.annotate.toolbar.unhighlight.label;" oncommand="Zotero_Browser.toggleMode(this.id);"/>
|
<toolbarbutton id="zotero-annotate-tb-unhighlight" tooltiptext="&zotero.annotate.toolbar.unhighlight.label;" oncommand="Zotero_Browser.toggleMode(this.id);"/>
|
||||||
</toolbar>
|
</toolbar>
|
||||||
|
|
|
@ -511,6 +511,12 @@ Zotero.Annotations.prototype.load = function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Zotero.Annotations.prototype.setCollapsed = function(status) {
|
||||||
|
for each(var annotation in this.annotations) {
|
||||||
|
annotation.setCollapsed(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Zotero.Annotation
|
// Zotero.Annotation
|
||||||
|
@ -653,9 +659,13 @@ Zotero.Annotation.prototype.displayWithAbsoluteCoordinates = function(absX, absY
|
||||||
var startScroll = this.window.scrollMaxX;
|
var startScroll = this.window.scrollMaxX;
|
||||||
|
|
||||||
if(!this.div) {
|
if(!this.div) {
|
||||||
|
var me = this;
|
||||||
|
var body = this.document.getElementsByTagName("body")[0];
|
||||||
|
|
||||||
|
// generate regular div
|
||||||
this.div = this.document.createElement("div");
|
this.div = this.document.createElement("div");
|
||||||
this.div.setAttribute("zotero", "annotation");
|
this.div.setAttribute("zotero", "annotation");
|
||||||
this.document.getElementsByTagName("body")[0].appendChild(this.div);
|
body.appendChild(this.div);
|
||||||
this.div.style.backgroundColor = Zotero.Annotate.annotationColor;
|
this.div.style.backgroundColor = Zotero.Annotate.annotationColor;
|
||||||
this.div.style.padding = "0";
|
this.div.style.padding = "0";
|
||||||
this.div.style.display = "block";
|
this.div.style.display = "block";
|
||||||
|
@ -664,10 +674,24 @@ Zotero.Annotation.prototype.displayWithAbsoluteCoordinates = function(absX, absY
|
||||||
this.div.style.borderColor = Zotero.Annotate.annotationBorderColor;
|
this.div.style.borderColor = Zotero.Annotate.annotationBorderColor;
|
||||||
this.div.style.MozOpacity = 0.9;
|
this.div.style.MozOpacity = 0.9;
|
||||||
this.div.style.zIndex = this.annotationsObj.zIndex;
|
this.div.style.zIndex = this.annotationsObj.zIndex;
|
||||||
var me = this;
|
|
||||||
this.div.addEventListener("click", function() { me._click() }, false);
|
this.div.addEventListener("click", function() { me._click() }, false);
|
||||||
|
|
||||||
this._addChildElements();
|
this._addChildElements();
|
||||||
|
|
||||||
|
// generate pushpin div
|
||||||
|
this.pushpinDiv = this.document.createElement("div");
|
||||||
|
this.pushpinDiv.style.padding = "0";
|
||||||
|
this.pushpinDiv.style.display = "block";
|
||||||
|
this.pushpinDiv.style.position = "absolute";
|
||||||
|
this.pushpinDiv.style.MozOpacity = 0.9;
|
||||||
|
this.pushpinDiv.style.cursor = "pointer";
|
||||||
|
// generate pushpin image
|
||||||
|
var img = this.document.createElement("img");
|
||||||
|
img.src = "chrome://zotero/skin/annotation-hidden.png";
|
||||||
|
img.addEventListener("click", function() {
|
||||||
|
me.setCollapsed(false);
|
||||||
|
}, false);
|
||||||
|
this.pushpinDiv.appendChild(img);
|
||||||
|
body.appendChild(this.pushpinDiv);
|
||||||
}
|
}
|
||||||
this.div.style.display = "block";
|
this.div.style.display = "block";
|
||||||
this.div.style.left = absX+"px";
|
this.div.style.left = absX+"px";
|
||||||
|
@ -679,6 +703,24 @@ Zotero.Annotation.prototype.displayWithAbsoluteCoordinates = function(absX, absY
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Zotero.Annotation.prototype.setCollapsed = function(status) {
|
||||||
|
if(status == true) {
|
||||||
|
// hide div
|
||||||
|
this.div.style.display = "none";
|
||||||
|
// move pushpin div
|
||||||
|
this.pushpinDiv.style.left = this.div.style.left;
|
||||||
|
this.pushpinDiv.style.top = this.div.style.top;
|
||||||
|
this.pushpinDiv.style.zIndex = this.div.style.zIndex;
|
||||||
|
// show pushpin div
|
||||||
|
this.pushpinDiv.style.display = "block";
|
||||||
|
} else {
|
||||||
|
// hide pushpin div
|
||||||
|
this.pushpinDiv.style.display = "none";
|
||||||
|
// show div
|
||||||
|
this.div.style.display = "block";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Zotero.Annotation.prototype._generateMarker = function(offset) {
|
Zotero.Annotation.prototype._generateMarker = function(offset) {
|
||||||
// first, we create a new span at the correct offset in the node
|
// first, we create a new span at the correct offset in the node
|
||||||
var range = this.document.createRange();
|
var range = this.document.createRange();
|
||||||
|
@ -710,13 +752,15 @@ Zotero.Annotation.prototype._addChildElements = function() {
|
||||||
bar.style.height = "10px";
|
bar.style.height = "10px";
|
||||||
bar.style.borderColor = Zotero.Annotate.annotationBorderColor;
|
bar.style.borderColor = Zotero.Annotate.annotationBorderColor;
|
||||||
|
|
||||||
// close box
|
// left box
|
||||||
var closeDiv = this.document.createElement("div");
|
var closeDiv = this.document.createElement("div");
|
||||||
closeDiv.style.display = "block";
|
closeDiv.style.display = "block";
|
||||||
closeDiv.style.position = "absolute";
|
closeDiv.style.position = "absolute";
|
||||||
closeDiv.style.left = "1px";
|
closeDiv.style.left = "1px";
|
||||||
closeDiv.style.top = "1px";
|
closeDiv.style.top = "1px";
|
||||||
closeDiv.style.cursor = "pointer";
|
closeDiv.style.cursor = "pointer";
|
||||||
|
|
||||||
|
// close image
|
||||||
var img = this.document.createElement("img");
|
var img = this.document.createElement("img");
|
||||||
img.src = "chrome://zotero/skin/annotation-close.png";
|
img.src = "chrome://zotero/skin/annotation-close.png";
|
||||||
img.addEventListener("click", function(event) {
|
img.addEventListener("click", function(event) {
|
||||||
|
@ -724,22 +768,34 @@ Zotero.Annotation.prototype._addChildElements = function() {
|
||||||
me._delete();
|
me._delete();
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
closeDiv.appendChild(img);
|
closeDiv.appendChild(img);
|
||||||
bar.appendChild(closeDiv);
|
bar.appendChild(closeDiv);
|
||||||
|
|
||||||
// move box
|
// right box
|
||||||
var moveDiv = this.document.createElement("div");
|
var moveDiv = this.document.createElement("div");
|
||||||
moveDiv.style.display = "block";
|
moveDiv.style.display = "block";
|
||||||
moveDiv.style.position = "absolute";
|
moveDiv.style.position = "absolute";
|
||||||
moveDiv.style.right = "1px";
|
moveDiv.style.right = "1px";
|
||||||
moveDiv.style.top = "1px";
|
moveDiv.style.top = "1px";
|
||||||
moveDiv.style.cursor = "pointer";
|
moveDiv.style.cursor = "pointer";
|
||||||
|
|
||||||
|
// move image
|
||||||
this.moveImg = this.document.createElement("img");
|
this.moveImg = this.document.createElement("img");
|
||||||
this.moveImg.src = "chrome://zotero/skin/annotation-move.png";
|
this.moveImg.src = "chrome://zotero/skin/annotation-move.png";
|
||||||
this.moveImg.addEventListener("click", function(e) {
|
this.moveImg.addEventListener("click", function(e) {
|
||||||
me._startMove(e);
|
me._startMove();
|
||||||
}, false);
|
}, false);
|
||||||
moveDiv.appendChild(this.moveImg);
|
moveDiv.appendChild(this.moveImg);
|
||||||
|
|
||||||
|
// hide image
|
||||||
|
var img = this.document.createElement("img");
|
||||||
|
img.src = "chrome://zotero/skin/annotation-hide.png";
|
||||||
|
img.addEventListener("click", function(event) {
|
||||||
|
me.setCollapsed(true);
|
||||||
|
}, false);
|
||||||
|
moveDiv.appendChild(img);
|
||||||
|
|
||||||
bar.appendChild(moveDiv);
|
bar.appendChild(moveDiv);
|
||||||
|
|
||||||
// grippy
|
// grippy
|
||||||
|
@ -786,7 +842,7 @@ Zotero.Annotation.prototype._click = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Zotero.Annotation.prototype._confirmDelete = function(event) {
|
Zotero.Annotation.prototype._confirmDelete = function(event) {
|
||||||
if (event.target.parentNode.nextSibling.value == '' ||
|
if (this.textarea.value == '' ||
|
||||||
!Zotero.Prefs.get('annotations.warnOnClose')) {
|
!Zotero.Prefs.get('annotations.warnOnClose')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,5 +97,7 @@
|
||||||
<!ENTITY zotero.citation.line "Line">
|
<!ENTITY zotero.citation.line "Line">
|
||||||
|
|
||||||
<!ENTITY zotero.annotate.toolbar.add.label "Add Annotation">
|
<!ENTITY zotero.annotate.toolbar.add.label "Add Annotation">
|
||||||
|
<!ENTITY zotero.annotate.toolbar.collapse.label "Collapse All Annotations">
|
||||||
|
<!ENTITY zotero.annotate.toolbar.expand.label "Expand All Annotations">
|
||||||
<!ENTITY zotero.annotate.toolbar.highlight.label "Highlight Text">
|
<!ENTITY zotero.annotate.toolbar.highlight.label "Highlight Text">
|
||||||
<!ENTITY zotero.annotate.toolbar.unhighlight.label "Unhighlight Text">
|
<!ENTITY zotero.annotate.toolbar.unhighlight.label "Unhighlight Text">
|
BIN
chrome/skin/default/zotero/annotate-collapse-all.png
Normal file
BIN
chrome/skin/default/zotero/annotate-collapse-all.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 670 B |
BIN
chrome/skin/default/zotero/annotate-expand-all.png
Normal file
BIN
chrome/skin/default/zotero/annotate-expand-all.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 678 B |
BIN
chrome/skin/default/zotero/annotation-hidden.png
Normal file
BIN
chrome/skin/default/zotero/annotation-hidden.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 462 B |
BIN
chrome/skin/default/zotero/annotation-hide.png
Normal file
BIN
chrome/skin/default/zotero/annotation-hide.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 403 B |
|
@ -254,6 +254,16 @@
|
||||||
list-style-image: url('chrome://zotero/skin/annotate-add.png');
|
list-style-image: url('chrome://zotero/skin/annotate-add.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#zotero-annotate-tb-collapse
|
||||||
|
{
|
||||||
|
list-style-image: url('chrome://zotero/skin/annotate-collapse-all.png');
|
||||||
|
}
|
||||||
|
|
||||||
|
#zotero-annotate-tb-expand
|
||||||
|
{
|
||||||
|
list-style-image: url('chrome://zotero/skin/annotate-expand-all.png');
|
||||||
|
}
|
||||||
|
|
||||||
#zotero-annotate-tb-highlight
|
#zotero-annotate-tb-highlight
|
||||||
{
|
{
|
||||||
list-style-image: url('chrome://zotero/skin/annotate-highlight.png');
|
list-style-image: url('chrome://zotero/skin/annotate-highlight.png');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user