Compare commits
No commits in common. "fbcbc2ab7b8177c3058d11ae702d4b77773908ec" and "2c5c56c036d866822769d60188b28b7e942f5f0a" have entirely different histories.
fbcbc2ab7b
...
2c5c56c036
6 changed files with 10 additions and 92 deletions
|
|
@ -31,8 +31,6 @@ oml.ui.annotationPanel = function() {
|
||||||
{id: 'note', title: Ox._('By Note Text'), checked: false},
|
{id: 'note', title: Ox._('By Note Text'), checked: false},
|
||||||
{id: 'date', title: Ox._('By Date Added'), checked: false}
|
{id: 'date', title: Ox._('By Date Added'), checked: false}
|
||||||
]},
|
]},
|
||||||
{},
|
|
||||||
{id: 'exportAnnotations', title: Ox._('Export Annotations')},
|
|
||||||
],
|
],
|
||||||
style: 'square',
|
style: 'square',
|
||||||
title: 'set',
|
title: 'set',
|
||||||
|
|
@ -41,20 +39,7 @@ oml.ui.annotationPanel = function() {
|
||||||
}).css({
|
}).css({
|
||||||
// borderColor: 'transparent',
|
// borderColor: 'transparent',
|
||||||
float: 'right'
|
float: 'right'
|
||||||
}).appendTo($bar)
|
}).appendTo($bar);
|
||||||
.bindEvent({
|
|
||||||
click: function(data) {
|
|
||||||
var id = data.id;
|
|
||||||
if (id == 'exportAnnotations') {
|
|
||||||
oml.api.get({
|
|
||||||
id: oml.user.ui.item,
|
|
||||||
keys: []
|
|
||||||
}, function(result) {
|
|
||||||
oml.ui.exportAnnotationsDialog(result.data).open()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var ui = oml.user.ui;
|
var ui = oml.user.ui;
|
||||||
var that = Ox.SplitPanel({
|
var that = Ox.SplitPanel({
|
||||||
|
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
oml.ui.exportAnnotationsDialog = function(data) {
|
|
||||||
|
|
||||||
var ui = oml.user.ui,
|
|
||||||
|
|
||||||
$text = Ox.Input({
|
|
||||||
type: 'textarea',
|
|
||||||
style: 'squared',
|
|
||||||
value: getAnnotationsText(),
|
|
||||||
width: 640,
|
|
||||||
height: 480
|
|
||||||
})
|
|
||||||
.css({margin: '16px'}),
|
|
||||||
|
|
||||||
that = Ox.Dialog({
|
|
||||||
buttons: [
|
|
||||||
Ox.Button({
|
|
||||||
id: 'done',
|
|
||||||
style: 'squared',
|
|
||||||
title: Ox._('Done')
|
|
||||||
})
|
|
||||||
.bindEvent({
|
|
||||||
click: function() {
|
|
||||||
that.close();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
],
|
|
||||||
closeButton: true,
|
|
||||||
content: $text,
|
|
||||||
height: 480 + 2 * 16,
|
|
||||||
keys: {enter: 'done'},
|
|
||||||
removeOnClose: true,
|
|
||||||
title: Ox._('Export Annotations'),
|
|
||||||
width: 640 + 2* 16
|
|
||||||
})
|
|
||||||
.bindEvent({
|
|
||||||
close: function() {
|
|
||||||
that.close();
|
|
||||||
},
|
|
||||||
open: function() {
|
|
||||||
// ..
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function getAnnotationsText() {
|
|
||||||
var annotations = oml.$ui.viewer.getAnnotations()
|
|
||||||
var text = 'Annotations for ' + data.title + ' (' + data.author.join(', ') + ')\n\n\n\n'
|
|
||||||
text += annotations.map(function(annotation) {
|
|
||||||
var text = 'Quote:\n\n' + annotation.text
|
|
||||||
if (annotation.notes.length) {
|
|
||||||
text += '\n\nNotes:\n' + annotation.notes.map(function(note) {
|
|
||||||
return note.value
|
|
||||||
}).join('\n\n')
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}).join('\n\n\n\n')
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
return that;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
@ -143,8 +143,6 @@ oml.ui.viewer = function() {
|
||||||
that.postMessage = function(event, data) {
|
that.postMessage = function(event, data) {
|
||||||
$iframe && $iframe.postMessage(event, data)
|
$iframe && $iframe.postMessage(event, data)
|
||||||
};
|
};
|
||||||
that.getAnnotations = function() {
|
|
||||||
return annotations;
|
|
||||||
}
|
|
||||||
return that.updateElement();
|
return that.updateElement();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
"deleteListDialog.js",
|
"deleteListDialog.js",
|
||||||
"editDialog.js",
|
"editDialog.js",
|
||||||
"errorDialog.js",
|
"errorDialog.js",
|
||||||
"exportAnnotationsDialog.js",
|
|
||||||
"filter.js",
|
"filter.js",
|
||||||
"filtersInnerPanel.js",
|
"filtersInnerPanel.js",
|
||||||
"filtersOuterPanel.js",
|
"filtersOuterPanel.js",
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,9 @@ function getText(book, cfiRange, cb) {
|
||||||
|
|
||||||
function onHighlightClicked(e) {
|
function onHighlightClicked(e) {
|
||||||
console.log("highlight clicked", e.target.dataset.epubcfi);
|
console.log("highlight clicked", e.target.dataset.epubcfi);
|
||||||
if(!e.target.classList.contains('selected')) {
|
if(e.target.classList.contains('selected')) {
|
||||||
|
e.target.classList.remove('selected')
|
||||||
|
} else {
|
||||||
document.querySelectorAll('.epubjs-hl.selected').forEach(function(other) {
|
document.querySelectorAll('.epubjs-hl.selected').forEach(function(other) {
|
||||||
other.classList.remove('selected')
|
other.classList.remove('selected')
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ Ox.load({
|
||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
var el = document.querySelector('.a' + annotation.id);
|
var el = document.querySelector('.a' + annotation.id);
|
||||||
if (el && !isInView(el)) {
|
if (el) {
|
||||||
document.querySelector('#viewerContainer').scrollTop = el.offsetTop + el.parentElement.offsetTop - 64;
|
document.querySelector('#viewerContainer').scrollTop = el.offsetTop + el.parentElement.offsetTop - 64;
|
||||||
}
|
}
|
||||||
}, delay)
|
}, delay)
|
||||||
|
|
@ -134,7 +134,10 @@ function renderAnnotation(annotation) {
|
||||||
'width:' + Math.abs(bounds[0] - bounds[2]) + 'px; height:' + Math.abs(bounds[1] - bounds[3]) + 'px;');
|
'width:' + Math.abs(bounds[0] - bounds[2]) + 'px; height:' + Math.abs(bounds[1] - bounds[3]) + 'px;');
|
||||||
|
|
||||||
el.addEventListener('click', function() {
|
el.addEventListener('click', function() {
|
||||||
if (!el.classList.contains('selected')) {
|
if (el.classList.contains('selected')) {
|
||||||
|
deselectAnnotation(annotation.id)
|
||||||
|
Ox.$parent.postMessage('selectAnnotation', {id: null})
|
||||||
|
} else {
|
||||||
selectAnnotation(annotation.id)
|
selectAnnotation(annotation.id)
|
||||||
Ox.$parent.postMessage('selectAnnotation', {id: annotation.id})
|
Ox.$parent.postMessage('selectAnnotation', {id: annotation.id})
|
||||||
}
|
}
|
||||||
|
|
@ -201,10 +204,3 @@ function loadAnnotations(page) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function isInView(element) {
|
|
||||||
var docViewTop = $(window).scrollTop();
|
|
||||||
var docViewBottom = docViewTop + $(window).height();
|
|
||||||
var elementTop = $(element).offset().top;
|
|
||||||
var elementBottom = elementTop + $(element).height();
|
|
||||||
return elementTop < docViewBottom && elementBottom > docViewTop;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue