Compare commits

..

No commits in common. "760494dd6d2fc59f58ef0e4118e798aaeec5a83c" and "d8ce172716aa1fa002723294bc6e00920d038a13" have entirely different histories.

4 changed files with 23 additions and 51 deletions

View file

@ -1,7 +0,0 @@
.OMLQuote {
background-color: rgb(255, 255, 255);
}
.OMLAnnotation.selected .OMLQuote {
background-color: rgb(128, 192, 255);
}

View file

@ -4,7 +4,6 @@
<title>Open Media Library</title> <title>Open Media Library</title>
<meta charset="UTF-8"/> <meta charset="UTF-8"/>
<link href="/static/png/oml.png" rel="icon" type="image/png"> <link href="/static/png/oml.png" rel="icon" type="image/png">
<link href="/static/css/oml.css" rel="stylesheet" type="text/css">
<script src="/static/js/oml.js?1" type="text/javascript"></script> <script src="/static/js/oml.js?1" type="text/javascript"></script>
<meta name="google" value="notranslate"/> <meta name="google" value="notranslate"/>
</head> </head>

View file

@ -1,22 +1,7 @@
'use strict'; 'use strict';
oml.ui.annotation = function(annotation, $iframe) { oml.ui.annotation = function(annotation, $iframe) {
var $quote = Ox.Element().addClass('OxSelectable OMLQuote').css({ var $arrayEditable = Ox.ArrayEditable({
backgroundColor: 'white',
color: 'black',
fontFamily: 'Georgia, Palatino, DejaVu Serif, Book Antiqua, Palatino Linotype, Times New Roman, serif',
fontSize: '14px',
lineHeight: '21px',
padding: '8px'
}).html(Ox.encodeHTMLEntities(annotation.text).replace(/\n/g, '<br/>')).on({
click: function(event) {
that.select()
$iframe.postMessage('selectAnnotation', {
id: annotation.id
})
}
})
var $note = Ox.ArrayEditable({
editing: true, editing: true,
items: (annotation.comments || []).map(function(comment) { items: (annotation.comments || []).map(function(comment) {
comment.editable = true comment.editable = true
@ -24,8 +9,7 @@ oml.ui.annotation = function(annotation, $iframe) {
}), }),
type: 'textarea' type: 'textarea'
}).css({ }).css({
margin: '2px', minHeight: '16px'
minHeight: '12px'
}).bindEvent({ }).bindEvent({
submit: function(data) { submit: function(data) {
var comment = Ox.getObjectById(annotation.comments, data.id) var comment = Ox.getObjectById(annotation.comments, data.id)
@ -46,23 +30,32 @@ oml.ui.annotation = function(annotation, $iframe) {
var that = Ox.Element().attr({ var that = Ox.Element().attr({
id: 'a-' + annotation.id id: 'a-' + annotation.id
}).addClass( }).addClass(
'OxSelectable OMLAnnotation' 'OxSelectable'
).css({ ).css({
borderBottom: '1px solid rgb(208, 208, 208)', borderBottom: '1px solid rgb(208, 208, 208)',
}).append($quote).append($note); }).append(
Ox.Element().addClass('OxSelectable').css({
backgroundColor: 'white',
color: 'black',
fontFamily: 'Georgia, Palatino, DejaVu Serif, Book Antiqua, Palatino Linotype, Times New Roman, serif',
fontSize: '14px',
lineHeight: '21px',
padding: '8px'
}).html(Ox.encodeHTMLEntities(annotation.text).replace(/\n/g, '<br/>')).on({
click: function(event) {
$iframe.postMessage('selectAnnotation', {
id: annotation.id
})
}
})
).append($arrayEditable);
that.annotate = function() { that.annotate = function() {
var item = { var item = {
id: 'note', value: '', editable: true id: 'note', value: '', editable: true
} }
} $arrayEditable.addItem(0, item)
that.deselect = function() { .options({selected: item.id})
that.removeClass('selected') .editItem();
}
that.select = function () {
let selected = document.querySelector('.OMLAnnotation.selected')
selected && selected.classList.remove('selected')
that.addClass('selected')
} }
return that; return that;
}; };

View file

@ -8,31 +8,18 @@ oml.ui.annotationPanel = function() {
disabled: true, disabled: true,
style: 'symbol', style: 'symbol',
title: 'add', title: 'add',
tooltip: Ox._('Add Quote'),
type: 'image' type: 'image'
}).appendTo($bar); }).appendTo($bar);
var $menuButton = Ox.MenuButton({ var $menuButton = Ox.MenuButton({
items: [ items: [
{id: 'showAnnotations', title: Ox._('Show Annotations'), disabled: true}, {id: 'sortAnnotations', title: 'Sort Annotations', disabled: true}
{group: 'sort', min: 1, max: 1, items: [
{id: 'all', title: Ox._('All Annotations'), checked: true},
{id: 'my', title: Ox._('My Annotations'), checked: false},
]},
{},
{id: 'sortAnnotations', title: Ox._('Sort Annotations'), disabled: true},
{group: 'sort', min: 1, max: 1, items: [
{id: 'position', title: Ox._('By Position'), checked: true},
{id: 'text', title: Ox._('By Note Text'), checked: false},
{id: 'date', title: Ox._('By Date Added'), checked: false}
]},
], ],
style: 'square', style: 'square',
title: 'set', title: 'set',
type: 'image', type: 'image',
width: 16 width: 16
}).css({ }).css({
// borderColor: 'transparent',
float: 'right' float: 'right'
}).appendTo($bar); }).appendTo($bar);