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,6 +446,62 @@ oml.ui.mainMenu = function() {
Ox.print('MAIN MENU DOES NOT YET HANDLE', id); Ox.print('MAIN MENU DOES NOT YET HANDLE', id);
} }
}, },
oml_find: function() {
that.replaceMenu('listMenu', getListMenu());
that.replaceMenu('editMenu', getEditMenu());
that.replaceMenu('findMenu', getFindMenu());
/*
var action = Ox.startsWith(ui._list, ':') && ui._list != ':'
? 'enableItem' : 'disableItem';
that[
ui._list && !Ox.endsWith(ui._list, ':')
? 'enableItem' : 'disableItem'
]('duplicatelist');
that[action]('editlist');
that[action]('deletelist');
*/
},
oml_iconinfo: function(data) {
// ...
},
oml_icons: function(data) {
that.checkItem('viewMenu_iconsSubmenu_' + data.value);
},
oml_item: function(data) {
if (!!data.value != !!data.previousValue) {
that[data.value ? 'disableItem' : 'enableItem']('showfilters');
that[data.value ? 'enableItem' : 'disableItem']('showbrowser');
}
},
oml_listselection: function(data) {
that.replaceMenu('editMenu', getEditMenu());
},
oml_listsort: function(data) {
that.checkItem('sortMenu_sortitems_' + data.value[0].key);
that.checkItem('sortMenu_orderitems_' + (
data.value[0].operator == '+' ? 'ascending' : 'descending')
);
},
oml_showbrowser: function(data) {
that.setItemTitle('showbrowser', Ox._((data.value ? 'Hide' : 'Show') + ' Browser'));
},
oml_showfilters: function(data) {
that.setItemTitle('showfilters', Ox._((data.value ? 'Hide' : 'Show') + ' Filters'));
},
oml_showiconinfo: function(data) {
var action = data.value ? 'enableItem' : 'disableItem';
that[action]('viewMenu_iconsSubmenu_extension');
that[action]('viewMenu_iconsSubmenu_size');
},
oml_showinfo: function(data) {
that.setItemTitle('showinfo', Ox._((data.value ? 'Hide' : 'Show') + ' Info'));
},
oml_showsidebar: function(data) {
that.setItemTitle('showsidebar', Ox._((data.value ? 'Hide' : 'Show') + ' Sidebar'));
that[data.value ? 'enableItem' : 'disableItem']('showinfo');
},
});
Ox.Event.bind({
key_backtick: function() { key_backtick: function() {
changeFocus(1); changeFocus(1);
}, },
@ -509,61 +564,7 @@ oml.ui.mainMenu = function() {
}, },
key_shift_s: function() { key_shift_s: function() {
oml.UI.set({showSidebar: !ui.showSidebar}); oml.UI.set({showSidebar: !ui.showSidebar});
},
oml_find: function() {
that.replaceMenu('listMenu', getListMenu());
that.replaceMenu('editMenu', getEditMenu());
that.replaceMenu('findMenu', getFindMenu());
/*
var action = Ox.startsWith(ui._list, ':') && ui._list != ':'
? 'enableItem' : 'disableItem';
that[
ui._list && !Ox.endsWith(ui._list, ':')
? 'enableItem' : 'disableItem'
]('duplicatelist');
that[action]('editlist');
that[action]('deletelist');
*/
},
oml_iconinfo: function(data) {
// ...
},
oml_icons: function(data) {
that.checkItem('viewMenu_iconsSubmenu_' + data.value);
},
oml_item: function(data) {
if (!!data.value != !!data.previousValue) {
that[data.value ? 'disableItem' : 'enableItem']('showfilters');
that[data.value ? 'enableItem' : 'disableItem']('showbrowser');
} }
},
oml_listselection: function(data) {
that.replaceMenu('editMenu', getEditMenu());
},
oml_listsort: function(data) {
that.checkItem('sortMenu_sortitems_' + data.value[0].key);
that.checkItem('sortMenu_orderitems_' + (
data.value[0].operator == '+' ? 'ascending' : 'descending')
);
},
oml_showbrowser: function(data) {
that.setItemTitle('showbrowser', Ox._((data.value ? 'Hide' : 'Show') + ' Browser'));
},
oml_showfilters: function(data) {
that.setItemTitle('showfilters', Ox._((data.value ? 'Hide' : 'Show') + ' Filters'));
},
oml_showiconinfo: function(data) {
var action = data.value ? 'enableItem' : 'disableItem';
that[action]('viewMenu_iconsSubmenu_extension');
that[action]('viewMenu_iconsSubmenu_size');
},
oml_showinfo: function(data) {
that.setItemTitle('showinfo', Ox._((data.value ? 'Hide' : 'Show') + ' Info'));
},
oml_showsidebar: function(data) {
that.setItemTitle('showsidebar', Ox._((data.value ? 'Hide' : 'Show') + ' Sidebar'));
that[data.value ? 'enableItem' : 'disableItem']('showinfo');
},
}); });
function getEditMenu() { function getEditMenu() {

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,23 +75,18 @@ 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
&& data.id == video.id
&& data.page == video.page) {
video.src = data.src; video.src = data.src;
video.src !== '' ? enableVideoUI() : disableVideoUI(); video.src !== '' ? enableVideoUI() : disableVideoUI();
} }
}
}); });
} }
function play(e) { function play(e) {
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,17 +96,9 @@ function getVideoOverlay(page) {
height: '100%', height: '100%',
frameborder: 0 frameborder: 0
}) })
.appendTo($interface), .bindMessage({
closed = false; close: function(data) {
$iframe.postMessage = function(event, data) { if(!closed) {
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; closed = true;
$iframe.remove(); $iframe.remove();
delete $iframe; delete $iframe;
@ -116,7 +106,9 @@ function getVideoOverlay(page) {
$editButton.show(); $editButton.show();
} }
} }
}); })
.appendTo($interface),
closed = false;
$playButton.hide(); $playButton.hide();
$editButton.hide(); $editButton.hide();
return false; return false;