|
|
|
@ -205,6 +205,43 @@ var AnnotationElement = (function AnnotationElementClosure() {
@@ -205,6 +205,43 @@ var AnnotationElement = (function AnnotationElementClosure() {
|
|
|
|
|
return container; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Create a popup for the annotation's HTML element. This is used for |
|
|
|
|
* annotations that do not have a Popup entry in the dictionary, but |
|
|
|
|
* are of a type that works with popups (such as Highlight annotations). |
|
|
|
|
* |
|
|
|
|
* @private |
|
|
|
|
* @param {HTMLSectionElement} container |
|
|
|
|
* @param {HTMLDivElement|HTMLImageElement|null} trigger |
|
|
|
|
* @param {Object} data |
|
|
|
|
* @memberof AnnotationElement |
|
|
|
|
*/ |
|
|
|
|
_createPopup: |
|
|
|
|
function AnnotationElement_createPopup(container, trigger, data) { |
|
|
|
|
// If no trigger element is specified, create it.
|
|
|
|
|
if (!trigger) { |
|
|
|
|
trigger = document.createElement('div'); |
|
|
|
|
trigger.style.height = container.style.height; |
|
|
|
|
trigger.style.width = container.style.width; |
|
|
|
|
container.appendChild(trigger); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var popupElement = new PopupElement({ |
|
|
|
|
container: container, |
|
|
|
|
trigger: trigger, |
|
|
|
|
color: data.color, |
|
|
|
|
title: data.title, |
|
|
|
|
contents: data.contents, |
|
|
|
|
hideWrapper: true |
|
|
|
|
}); |
|
|
|
|
var popup = popupElement.render(); |
|
|
|
|
|
|
|
|
|
// Position the popup next to the annotation's container.
|
|
|
|
|
popup.style.left = container.style.width; |
|
|
|
|
|
|
|
|
|
container.appendChild(popup); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Render the annotation's HTML element in the empty container. |
|
|
|
|
* |
|
|
|
@ -333,20 +370,7 @@ var TextAnnotationElement = (function TextAnnotationElementClosure() {
@@ -333,20 +370,7 @@ var TextAnnotationElement = (function TextAnnotationElementClosure() {
|
|
|
|
|
image.dataset.l10nArgs = JSON.stringify({type: this.data.name}); |
|
|
|
|
|
|
|
|
|
if (!this.data.hasPopup) { |
|
|
|
|
var popupElement = new PopupElement({ |
|
|
|
|
container: this.container, |
|
|
|
|
trigger: image, |
|
|
|
|
color: this.data.color, |
|
|
|
|
title: this.data.title, |
|
|
|
|
contents: this.data.contents, |
|
|
|
|
hideWrapper: true |
|
|
|
|
}); |
|
|
|
|
var popup = popupElement.render(); |
|
|
|
|
|
|
|
|
|
// Position the popup next to the Text annotation's container.
|
|
|
|
|
popup.style.left = image.style.width; |
|
|
|
|
|
|
|
|
|
this.container.appendChild(popup); |
|
|
|
|
this._createPopup(this.container, image, this.data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.container.appendChild(image); |
|
|
|
@ -623,7 +647,8 @@ var PopupElement = (function PopupElementClosure() {
@@ -623,7 +647,8 @@ var PopupElement = (function PopupElementClosure() {
|
|
|
|
|
var HighlightAnnotationElement = ( |
|
|
|
|
function HighlightAnnotationElementClosure() { |
|
|
|
|
function HighlightAnnotationElement(parameters) { |
|
|
|
|
var isRenderable = parameters.data.hasPopup; |
|
|
|
|
var isRenderable = !!(parameters.data.hasPopup || |
|
|
|
|
parameters.data.title || parameters.data.contents); |
|
|
|
|
AnnotationElement.call(this, parameters, isRenderable); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -637,6 +662,11 @@ var HighlightAnnotationElement = (
@@ -637,6 +662,11 @@ var HighlightAnnotationElement = (
|
|
|
|
|
*/ |
|
|
|
|
render: function HighlightAnnotationElement_render() { |
|
|
|
|
this.container.className = 'highlightAnnotation'; |
|
|
|
|
|
|
|
|
|
if (!this.data.hasPopup) { |
|
|
|
|
this._createPopup(this.container, null, this.data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return this.container; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -651,7 +681,8 @@ var HighlightAnnotationElement = (
@@ -651,7 +681,8 @@ var HighlightAnnotationElement = (
|
|
|
|
|
var UnderlineAnnotationElement = ( |
|
|
|
|
function UnderlineAnnotationElementClosure() { |
|
|
|
|
function UnderlineAnnotationElement(parameters) { |
|
|
|
|
var isRenderable = parameters.data.hasPopup; |
|
|
|
|
var isRenderable = !!(parameters.data.hasPopup || |
|
|
|
|
parameters.data.title || parameters.data.contents); |
|
|
|
|
AnnotationElement.call(this, parameters, isRenderable); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -665,6 +696,11 @@ var UnderlineAnnotationElement = (
@@ -665,6 +696,11 @@ var UnderlineAnnotationElement = (
|
|
|
|
|
*/ |
|
|
|
|
render: function UnderlineAnnotationElement_render() { |
|
|
|
|
this.container.className = 'underlineAnnotation'; |
|
|
|
|
|
|
|
|
|
if (!this.data.hasPopup) { |
|
|
|
|
this._createPopup(this.container, null, this.data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return this.container; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -678,7 +714,8 @@ var UnderlineAnnotationElement = (
@@ -678,7 +714,8 @@ var UnderlineAnnotationElement = (
|
|
|
|
|
*/ |
|
|
|
|
var SquigglyAnnotationElement = (function SquigglyAnnotationElementClosure() { |
|
|
|
|
function SquigglyAnnotationElement(parameters) { |
|
|
|
|
var isRenderable = parameters.data.hasPopup; |
|
|
|
|
var isRenderable = !!(parameters.data.hasPopup || |
|
|
|
|
parameters.data.title || parameters.data.contents); |
|
|
|
|
AnnotationElement.call(this, parameters, isRenderable); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -692,6 +729,11 @@ var SquigglyAnnotationElement = (function SquigglyAnnotationElementClosure() {
@@ -692,6 +729,11 @@ var SquigglyAnnotationElement = (function SquigglyAnnotationElementClosure() {
|
|
|
|
|
*/ |
|
|
|
|
render: function SquigglyAnnotationElement_render() { |
|
|
|
|
this.container.className = 'squigglyAnnotation'; |
|
|
|
|
|
|
|
|
|
if (!this.data.hasPopup) { |
|
|
|
|
this._createPopup(this.container, null, this.data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return this.container; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -706,7 +748,8 @@ var SquigglyAnnotationElement = (function SquigglyAnnotationElementClosure() {
@@ -706,7 +748,8 @@ var SquigglyAnnotationElement = (function SquigglyAnnotationElementClosure() {
|
|
|
|
|
var StrikeOutAnnotationElement = ( |
|
|
|
|
function StrikeOutAnnotationElementClosure() { |
|
|
|
|
function StrikeOutAnnotationElement(parameters) { |
|
|
|
|
var isRenderable = parameters.data.hasPopup; |
|
|
|
|
var isRenderable = !!(parameters.data.hasPopup || |
|
|
|
|
parameters.data.title || parameters.data.contents); |
|
|
|
|
AnnotationElement.call(this, parameters, isRenderable); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -720,6 +763,11 @@ var StrikeOutAnnotationElement = (
@@ -720,6 +763,11 @@ var StrikeOutAnnotationElement = (
|
|
|
|
|
*/ |
|
|
|
|
render: function StrikeOutAnnotationElement_render() { |
|
|
|
|
this.container.className = 'strikeoutAnnotation'; |
|
|
|
|
|
|
|
|
|
if (!this.data.hasPopup) { |
|
|
|
|
this._createPopup(this.container, null, this.data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return this.container; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -758,21 +806,7 @@ var FileAttachmentAnnotationElement = (
@@ -758,21 +806,7 @@ var FileAttachmentAnnotationElement = (
|
|
|
|
|
trigger.addEventListener('dblclick', this._download.bind(this)); |
|
|
|
|
|
|
|
|
|
if (!this.data.hasPopup && (this.data.title || this.data.contents)) { |
|
|
|
|
var popupElement = new PopupElement({ |
|
|
|
|
container: this.container, |
|
|
|
|
trigger: trigger, |
|
|
|
|
color: this.data.color, |
|
|
|
|
title: this.data.title, |
|
|
|
|
contents: this.data.contents, |
|
|
|
|
hideWrapper: true |
|
|
|
|
}); |
|
|
|
|
var popup = popupElement.render(); |
|
|
|
|
|
|
|
|
|
// Position the popup next to the FileAttachment annotation's
|
|
|
|
|
// container.
|
|
|
|
|
popup.style.left = this.container.style.width; |
|
|
|
|
|
|
|
|
|
this.container.appendChild(popup); |
|
|
|
|
this._createPopup(this.container, trigger, this.data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.container.appendChild(trigger); |
|
|
|
|