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>
<meta charset="utf-8" />
<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>
#loading {
text-align: center;

View file

@ -25,7 +25,6 @@ limitations under the License.
<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/source/Ox.UI/js/Core/Message.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();
self.isPopState = true;
$('.OxDialog:visible').each(function() {
Ox.UI.elements[$(this).data('oxid')].close();
Ox.$elements[$(this).data('oxid')].close();
});
if (e.state && !Ox.isEmpty(e.state)) {
document.title = Ox.decodeHTMLEntities(e.state.title);

View file

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

View file

@ -7,7 +7,7 @@ oml.ui.backButton = function() {
that = Ox.Button({
style: 'squared',
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'
})
.css({

View file

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

View file

@ -23,7 +23,7 @@ oml.ui.itemInnerPanel = function() {
})
.bindEvent({
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) {
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());
},
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({
change: function(data) {
var id = data.id,
@ -447,6 +446,62 @@ oml.ui.mainMenu = function() {
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() {
changeFocus(1);
},
@ -509,61 +564,7 @@ oml.ui.mainMenu = function() {
},
key_shift_s: function() {
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() {

View file

@ -24,7 +24,7 @@ oml.ui.mainPanel = function() {
})
.bindEvent({
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,
enableDebugMode = getLocalStorage('oml.enableDebugMode'),
omlVersion = getOMLVersion(),
oxjsPath = '/static/oxjs/' + (enableDebugMode ? 'dev' : 'build'),
oxjsPath = '/static/oxjs/' + (enableDebugMode ? 'dev' : 'min'),
terminal,
theme = getLocalStorage('Ox.theme')
&& JSON.parse(localStorage['Ox.theme'])
@ -143,7 +143,7 @@
images.loadingIcon.style.OUserSelect = 'none';
images.loadingIcon.style.WebkitUserSelect = 'none';
images.loadingIcon.src = oxjsPath
+ '/Ox.UI/themes/' + theme + '/svg/symbolLoading.svg';
+ '/UI/themes/' + theme + '/svg/symbolLoading.svg';
callback(images);
};
images.logo.src = '/static/png/oml.png';

View file

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

View file

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

View file

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

View file

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