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

View file

@ -31,10 +31,10 @@ 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);
}
});
return that;
};
};

View file

@ -286,7 +286,6 @@ oml.ui.mainMenu = function() {
}
]
})
.bindKeyboard()
.bindEvent({
change: function(data) {
var id = data.id,
@ -447,69 +446,6 @@ oml.ui.mainMenu = function() {
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() {
that.replaceMenu('listMenu', getListMenu());
that.replaceMenu('editMenu', getEditMenu());
@ -565,6 +501,71 @@ oml.ui.mainMenu = function() {
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() {
var listData = oml.getListData(),

View file

@ -24,10 +24,10 @@ 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);
}
});
return that;
};
};

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,15 +75,10 @@ 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) {
video.src = data.src;
video.src !== '' ? enableVideoUI() : disableVideoUI();
}
Ox.$parent.bindMessage('update', function(data) {
if (video && 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.stopPropagation();
var videoId = 'video' + page + id + Ox.uid(),
$iframe = Ox.$('<iframe>')
$iframe = Ox.Element('<iframe>')
.attr({
id: videoId,
src: video.src
@ -98,25 +96,19 @@ function getVideoOverlay(page) {
height: '100%',
frameborder: 0
})
.bindMessage({
close: function(data) {
if(!closed) {
closed = true;
$iframe.remove();
delete $iframe;
$playButton.show();
$editButton.show();
}
}
})
.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) {
closed = true;
$iframe.remove();
delete $iframe;
$playButton.show();
$editButton.show();
}
}
});
$playButton.hide();
$editButton.hide();
return false;