Merge branch 'master' into py3

This commit is contained in:
j 2014-09-29 15:24:15 +02:00
commit 53e8a05c6e
16 changed files with 114 additions and 117 deletions

View file

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Open Media Library</title> <title>Open Media Library</title>
<link href="../oxjs/build/Ox.UI/css/Ox.UI.css" rel="stylesheet" type="text/css" /> <link href="../oxjs/min/UI/css/UI.css" rel="stylesheet" type="text/css" />
<style> <style>
#loading { #loading {
text-align: center; text-align: center;

View file

@ -25,7 +25,6 @@ limitations under the License.
<link rel="stylesheet" href="/static/pdf.js/viewer.css"/> <link rel="stylesheet" href="/static/pdf.js/viewer.css"/>
<script type="text/javascript" src="/static/oxjs/build/Ox.js"></script> <script type="text/javascript" src="/static/oxjs/build/Ox.js"></script>
<script type="text/javascript" src="/static/oxjs/source/Ox.UI/js/Core/Message.js"></script>
<script type="text/javascript" src="/static/pdf.js/compatibility.js"></script> <script type="text/javascript" src="/static/pdf.js/compatibility.js"></script>

View file

@ -241,7 +241,7 @@ oml.URL = (function() {
Ox.Request.cancel(); Ox.Request.cancel();
self.isPopState = true; self.isPopState = true;
$('.OxDialog:visible').each(function() { $('.OxDialog:visible').each(function() {
Ox.UI.elements[$(this).data('oxid')].close(); Ox.$elements[$(this).data('oxid')].close();
}); });
if (e.state && !Ox.isEmpty(e.state)) { if (e.state && !Ox.isEmpty(e.state)) {
document.title = Ox.decodeHTMLEntities(e.state.title); document.title = Ox.decodeHTMLEntities(e.state.title);

View file

@ -31,7 +31,7 @@ oml.ui.appPanel = function() {
|| !Ox.contains(['import', 'export'], previousPage) || !Ox.contains(['import', 'export'], previousPage)
) { ) {
$('.OxDialog:visible').each(function() { $('.OxDialog:visible').each(function() {
Ox.UI.elements[$(this).data('oxid')].close(); Ox.$elements[$(this).data('oxid')].close();
}); });
} }
// open dialog // open dialog

View file

@ -7,7 +7,7 @@ oml.ui.backButton = function() {
that = Ox.Button({ that = Ox.Button({
style: 'squared', style: 'squared',
title: 'arrowLeft', title: 'arrowLeft',
tooltip: Ox._('Back to Books {0}', [Ox.UI.symbols.control + 'W']), tooltip: Ox._('Back to Books {0}', [Ox.SYMBOLS.control + 'W']),
type: 'image' type: 'image'
}) })
.css({ .css({

View file

@ -704,6 +704,11 @@ oml.ui.infoView = function(identifyData) {
} }
} }
}); });
that.bindEvent({
mousedown: function() {
that.gainFocus();
}
})
return that; return that;

View file

@ -23,7 +23,7 @@ oml.ui.itemInnerPanel = function() {
}) })
.bindEvent({ .bindEvent({
oml_showbrowser: function(data) { oml_showbrowser: function(data) {
data.value == that.options('elements')[0].collapsed && that.toggle(0); data.value == that.options('elements')[0].collapsed && that.toggleElement(0);
} }
}); });

View file

@ -49,7 +49,7 @@ oml.ui.leftPanel = function() {
}, },
oml_showinfo: function(data) { oml_showinfo: function(data) {
if (data.value == that.options('elements')[2].collapsed) { if (data.value == that.options('elements')[2].collapsed) {
that.toggle(2); that.toggleElement(2);
} }
} }
}); });

View file

@ -31,7 +31,7 @@ oml.ui.listInnerPanel = function() {
that.replaceElement(1, oml.$ui.list = oml.ui.list()); that.replaceElement(1, oml.$ui.list = oml.ui.list());
}, },
oml_showfilters: function(data) { oml_showfilters: function(data) {
data.value == that.options('elements')[0].collapsed && that.toggle(0); data.value == that.options('elements')[0].collapsed && that.toggleElement(0);
} }
}); });

View file

@ -286,7 +286,6 @@ oml.ui.mainMenu = function() {
} }
] ]
}) })
.bindKeyboard()
.bindEvent({ .bindEvent({
change: function(data) { change: function(data) {
var id = data.id, var id = data.id,
@ -447,69 +446,6 @@ oml.ui.mainMenu = function() {
Ox.print('MAIN MENU DOES NOT YET HANDLE', id); Ox.print('MAIN MENU DOES NOT YET HANDLE', id);
} }
}, },
key_backtick: function() {
changeFocus(1);
},
key_control_comma: function() {
if (!oml.hasDialogOrScreen()) {
oml.UI.set({page: 'preferences'});
}
},
key_control_f: function() {
if (!oml.hasDialogOrScreen()) {
if (ui._findState.key != 'advanced') {
setTimeout(function() {
oml.$ui.findInput.focusInput(true);
});
} else {
oml.$ui.filterDialog = oml.ui.filterDialog().open();
}
}
},
key_control_m: function() {
if (!oml.hasDialogOrScreen() && !that.isSelected()) {
that.options('menus')[0].element.trigger('click');
}
},
key_control_shift_f: function() {
Ox.print('FIXME: NOT IMPLEMENTED')
},
key_control_shift_w: function() {
if (!oml.hasDialogOrScreen()) {
oml.UI.set({
find: oml.config.user.ui.find,
item: ''
});
}
},
key_control_shift_z: function() {
oml.redoHistory();
},
key_control_slash: function() {
if (!oml.hasDialogOrScreen()) {
oml.UI.set({page: 'help'});
}
},
key_control_w: function() {
if (!oml.hasDialogOrScreen()) {
oml.UI.set({item: ''});
}
},
key_control_z: function() {
oml.undoHistory();
},
key_shift_b: function() {
ui.item && oml.UI.set({showBrowser: !ui.showBrowser});
},
key_shift_f: function() {
!ui.item && oml.UI.set({showFilters: !ui.showFilters});
},
key_shift_i: function() {
ui.showSidebar && oml.UI.set({showInfo: !ui.showInfo});
},
key_shift_s: function() {
oml.UI.set({showSidebar: !ui.showSidebar});
},
oml_find: function() { oml_find: function() {
that.replaceMenu('listMenu', getListMenu()); that.replaceMenu('listMenu', getListMenu());
that.replaceMenu('editMenu', getEditMenu()); that.replaceMenu('editMenu', getEditMenu());
@ -565,6 +501,71 @@ oml.ui.mainMenu = function() {
that[data.value ? 'enableItem' : 'disableItem']('showinfo'); that[data.value ? 'enableItem' : 'disableItem']('showinfo');
}, },
}); });
Ox.Event.bind({
key_backtick: function() {
changeFocus(1);
},
key_control_comma: function() {
if (!oml.hasDialogOrScreen()) {
oml.UI.set({page: 'preferences'});
}
},
key_control_f: function() {
if (!oml.hasDialogOrScreen()) {
if (ui._findState.key != 'advanced') {
setTimeout(function() {
oml.$ui.findInput.focusInput(true);
});
} else {
oml.$ui.filterDialog = oml.ui.filterDialog().open();
}
}
},
key_control_m: function() {
if (!oml.hasDialogOrScreen() && !that.isSelected()) {
that.options('menus')[0].element.trigger('click');
}
},
key_control_shift_f: function() {
Ox.print('FIXME: NOT IMPLEMENTED')
},
key_control_shift_w: function() {
if (!oml.hasDialogOrScreen()) {
oml.UI.set({
find: oml.config.user.ui.find,
item: ''
});
}
},
key_control_shift_z: function() {
oml.redoHistory();
},
key_control_slash: function() {
if (!oml.hasDialogOrScreen()) {
oml.UI.set({page: 'help'});
}
},
key_control_w: function() {
if (!oml.hasDialogOrScreen()) {
oml.UI.set({item: ''});
}
},
key_control_z: function() {
oml.undoHistory();
},
key_shift_b: function() {
ui.item && oml.UI.set({showBrowser: !ui.showBrowser});
},
key_shift_f: function() {
!ui.item && oml.UI.set({showFilters: !ui.showFilters});
},
key_shift_i: function() {
ui.showSidebar && oml.UI.set({showInfo: !ui.showInfo});
},
key_shift_s: function() {
oml.UI.set({showSidebar: !ui.showSidebar});
}
});
function getEditMenu() { function getEditMenu() {
var listData = oml.getListData(), var listData = oml.getListData(),

View file

@ -24,7 +24,7 @@ oml.ui.mainPanel = function() {
}) })
.bindEvent({ .bindEvent({
oml_showsidebar: function(data) { oml_showsidebar: function(data) {
data.value == that.options('elements')[0].collapsed && that.toggle(0); data.value == that.options('elements')[0].collapsed && that.toggleElement(0);
} }
}); });

View file

@ -5,7 +5,7 @@
var animationInterval, var animationInterval,
enableDebugMode = getLocalStorage('oml.enableDebugMode'), enableDebugMode = getLocalStorage('oml.enableDebugMode'),
omlVersion = getOMLVersion(), omlVersion = getOMLVersion(),
oxjsPath = '/static/oxjs/' + (enableDebugMode ? 'dev' : 'build'), oxjsPath = '/static/oxjs/' + (enableDebugMode ? 'dev' : 'min'),
terminal, terminal,
theme = getLocalStorage('Ox.theme') theme = getLocalStorage('Ox.theme')
&& JSON.parse(localStorage['Ox.theme']) && JSON.parse(localStorage['Ox.theme'])
@ -143,7 +143,7 @@
images.loadingIcon.style.OUserSelect = 'none'; images.loadingIcon.style.OUserSelect = 'none';
images.loadingIcon.style.WebkitUserSelect = 'none'; images.loadingIcon.style.WebkitUserSelect = 'none';
images.loadingIcon.src = oxjsPath images.loadingIcon.src = oxjsPath
+ '/Ox.UI/themes/' + theme + '/svg/symbolLoading.svg'; + '/UI/themes/' + theme + '/svg/symbolLoading.svg';
callback(images); callback(images);
}; };
images.logo.src = '/static/png/oml.png'; images.logo.src = '/static/png/oml.png';

View file

@ -7,7 +7,7 @@ oml.ui.openButton = function() {
that = Ox.Button({ that = Ox.Button({
style: 'squared', style: 'squared',
title: 'arrowRight', title: 'arrowRight',
tooltip: Ox._('Open Book {0}', [Ox.UI.symbols.return]), tooltip: Ox._('Open Book {0}', [Ox.SYMBOLS.return]),
type: 'image' type: 'image'
}) })
.css({ .css({

View file

@ -8,7 +8,7 @@ oml.ui.previewButton = function() {
selectable: true, selectable: true,
style: 'squared', style: 'squared',
title: 'view', title: 'view',
tooltip: Ox._('Preview {0}', [Ox.UI.symbols.space]), tooltip: Ox._('Preview {0}', [Ox.SYMBOLS.space]),
type: 'image' type: 'image'
}) })
.css({ .css({

View file

@ -336,7 +336,7 @@ oml.enableDragAndDrop = function($list, canMove) {
}); });
}); });
$tooltip.options({title: getTitle()}).show(data.event); $tooltip.options({title: getTitle()}).show(data.event);
Ox.UI.$window.on({ Ox.$window.on({
keydown: keydown, keydown: keydown,
keyup: keyup keyup: keyup
}); });
@ -359,7 +359,7 @@ oml.enableDragAndDrop = function($list, canMove) {
if (event.clientX < 16 && event.clientY >= 44 if (event.clientX < 16 && event.clientY >= 44
&& event.clientY < window.innerHeight - 16 && event.clientY < window.innerHeight - 16
) { ) {
oml.$ui.mainPanel.toggle(0); oml.$ui.mainPanel.toggleElement(0);
} }
} else { } else {
$parent = $(event.target).parent(); $parent = $(event.target).parent();
@ -371,7 +371,7 @@ oml.enableDragAndDrop = function($list, canMove) {
title = $panel.children('.OxBar').children('.OxTitle') title = $panel.children('.OxBar').children('.OxTitle')
.html().split(' ')[0].toLowerCase(); .html().split(' ')[0].toLowerCase();
if (!ui.showFolder[title]) { if (!ui.showFolder[title]) {
Ox.UI.elements[$panel.data('oxid')].options({ Ox.$elements[$panel.data('oxid')].options({
collapsed: false collapsed: false
}); });
} }
@ -411,7 +411,7 @@ oml.enableDragAndDrop = function($list, canMove) {
}, },
draganddropend: function(data) { draganddropend: function(data) {
var targets; var targets;
Ox.UI.$window.off({ Ox.$window.off({
keydown: keydown, keydown: keydown,
keyup: keyup keyup: keyup
}); });

View file

@ -1,4 +1,8 @@
Ox.load(function() { Ox.load({
UI: {
loadCSS: false
}
}, function() {
var currentPage = PDFView.page; var currentPage = PDFView.page;
window.addEventListener('pagechange', function (evt) { window.addEventListener('pagechange', function (evt) {
var page = evt.pageNumber; var page = evt.pageNumber;
@ -9,19 +13,18 @@ Ox.load(function() {
}); });
} }
}); });
Ox.$parent.onMessage(function(event, data, oxid) { Ox.$parent.bindMessage({
if (event == 'page' && Ox.isUndefined(oxid)) { page: function(data) {
if (data.page != PDFView.page) { if (data.page != PDFView.page) {
PDFView.page = data.page; PDFView.page = data.page;
} }
} },
if (event == 'pdf' && Ox.isUndefined(oxid)) { pdf: function(data) {
if (PDFView.url != data.pdf) { if (PDFView.url != data.pdf) {
PDFView.open(data.pdf); PDFView.open(data.pdf);
} }
} }
}); });
Ox.$parent.postMessage('init', {});
}); });
function getVideoOverlay(page) { function getVideoOverlay(page) {
@ -72,15 +75,10 @@ function getVideoOverlay(page) {
enableVideoUI(); enableVideoUI();
} }
this.div.appendChild($interface[0]); this.div.appendChild($interface[0]);
Ox.Message.bind(function(event, data, oxid) { Ox.$parent.bindMessage('update', function(data) {
if (event == 'update') { if (video && data.id == video.id && data.page == video.page) {
if(Ox.isUndefined(oxid) video.src = data.src;
&& video video.src !== '' ? enableVideoUI() : disableVideoUI();
&& data.id == video.id
&& data.page == video.page) {
video.src = data.src;
video.src !== '' ? enableVideoUI() : disableVideoUI();
}
} }
}); });
} }
@ -88,7 +86,7 @@ function getVideoOverlay(page) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
var videoId = 'video' + page + id + Ox.uid(), var videoId = 'video' + page + id + Ox.uid(),
$iframe = Ox.$('<iframe>') $iframe = Ox.Element('<iframe>')
.attr({ .attr({
id: videoId, id: videoId,
src: video.src src: video.src
@ -98,25 +96,19 @@ function getVideoOverlay(page) {
height: '100%', height: '100%',
frameborder: 0 frameborder: 0
}) })
.bindMessage({
close: function(data) {
if(!closed) {
closed = true;
$iframe.remove();
delete $iframe;
$playButton.show();
$editButton.show();
}
}
})
.appendTo($interface), .appendTo($interface),
closed = false; closed = false;
$iframe.postMessage = function(event, data) {
Ox.Message.post($iframe, event, data);
return $iframe;
};
Ox.Message.bind(function(event, data, oxid) {
if(!closed && event == 'loaded') {
$iframe.postMessage('init', {id: videoId});
} else if(event == 'close') {
if(!closed && !Ox.isUndefined(oxid) && videoId == oxid) {
closed = true;
$iframe.remove();
delete $iframe;
$playButton.show();
$editButton.show();
}
}
});
$playButton.hide(); $playButton.hide();
$editButton.hide(); $editButton.hide();
return false; return false;