lots of stuff (part2)

This commit is contained in:
j 2014-05-21 02:02:39 +02:00
commit 0d77cfd158
14 changed files with 767 additions and 578 deletions

View file

@ -133,6 +133,27 @@ oml.clickLink = function(e) {
}
};
oml.createLinks = function($element) {
function isExternalLink(target) {
return target.hostname != document.location.hostname
|| Ox.startsWith(target.pathname, '/static');
}
$element.on({
click: function(e) {
var $target = $(e.target);
if ($target.is('a')) {
e.preventDefault();
if (isExternalLink(e.target)) {
oml.openLink(e.target.href);
} else {
oml.clickLink(e);
}
}
return false;
}
});
};
(function() {
oml.doHistory = function(action, items, targets, callback) {
@ -713,7 +734,15 @@ oml.getEditTooltip = function(title) {
}());
oml.getFileInfoColor = function(type, data) {
oml.getFilterSizes = function() {
var ui = oml.user.ui;
return Ox.splitInt(
window.innerWidth - ui.showSidebar * ui.sidebarSize - 1,
5
);
};
oml.getIconInfoColor = function(type, data) {
return type == 'extension' ? (
data.extension == 'epub' ? [[32, 160, 32], [0, 128, 0], [128, 255, 128]]
: data.extension == 'pdf' ? (
@ -728,14 +757,6 @@ oml.getFileInfoColor = function(type, data) {
: [[224, 32, 32], [192, 0, 0], [255, 192, 192]];
};
oml.getFilterSizes = function() {
var ui = oml.user.ui;
return Ox.splitInt(
window.innerWidth - ui.showSidebar * ui.sidebarSize - 1,
5
);
};
oml.getInfoHeight = function() {
return Math.min(
oml.user.ui.sidebarSize,
@ -909,8 +930,7 @@ oml.openLink = function(url) {
if (Ox.startsWith(url, 'mailto:')) {
window.open(url);
} else {
//window.open('/url=' + encodeURIComponent(url), '_blank');
window.open(url, '_blank');
window.open('/url=' + encodeURIComponent(url), '_blank');
}
};