mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-27 13:34:30 -04:00
Final modifications.
This commit is contained in:
parent
de92767e5a
commit
ade6cf8e0b
24 changed files with 316 additions and 275 deletions
|
@ -3,7 +3,7 @@ module.define('core/settings', [H5AI_CONFIG], function (config) {
|
|||
|
||||
var defaults = {
|
||||
rootAbsHref: '/',
|
||||
h5aiAbsHref: '/_h5ai/',
|
||||
h5aiAbsHref: '/_h5ai/'
|
||||
};
|
||||
|
||||
return _.extend({}, defaults, config.options);
|
||||
|
@ -31,7 +31,7 @@ module.define('core/types', [H5AI_CONFIG], function (config) {
|
|||
} else {
|
||||
fileNames[match] = type;
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -61,5 +61,33 @@ module.define('core/types', [H5AI_CONFIG], function (config) {
|
|||
|
||||
module.define('core/langs', [H5AI_CONFIG], function (config) {
|
||||
|
||||
return _.extend({}, config.langs);
|
||||
var defaults = {
|
||||
lang: 'unknown',
|
||||
details: 'details',
|
||||
icons: 'icons',
|
||||
name: 'Name',
|
||||
lastModified: 'Last modified',
|
||||
size: 'Size',
|
||||
parentDirectory: 'Parent Directory',
|
||||
empty: 'empty',
|
||||
folders: 'folders',
|
||||
files: 'files',
|
||||
download: 'download',
|
||||
noMatch: 'no match',
|
||||
dateFormat: 'YYYY-MM-DD HH:mm'
|
||||
},
|
||||
|
||||
translations = {},
|
||||
|
||||
parse = function (langs) {
|
||||
|
||||
_.each(langs, function (trans, lang) {
|
||||
|
||||
translations[lang] = _.extend({}, defaults, trans);
|
||||
});
|
||||
};
|
||||
|
||||
parse(_.extend({}, config.langs));
|
||||
|
||||
return translations;
|
||||
});
|
||||
|
|
|
@ -3,10 +3,11 @@ module.define('ext/download', [jQuery, 'core/settings', 'core/resource', 'core/e
|
|||
|
||||
var defaults = {
|
||||
enabled: false,
|
||||
format: 'tar'
|
||||
execution: 'php',
|
||||
format: 'zip'
|
||||
},
|
||||
|
||||
settings = _.extend({}, defaults, allsettings['download']),
|
||||
settings = _.extend({}, defaults, allsettings.download),
|
||||
|
||||
formats = ['tar', 'zip'],
|
||||
|
||||
|
@ -38,7 +39,7 @@ module.define('ext/download', [jQuery, 'core/settings', 'core/resource', 'core/e
|
|||
$img.attr('src', resource.image('download'));
|
||||
|
||||
if (response) {
|
||||
if (response.status === 'ok') {
|
||||
if (response.code === 0) {
|
||||
setTimeout(function () { // wait here so the img above can be updated in time
|
||||
|
||||
window.location = resource.api() + '?action=getarchive&id=' + response.id + '&as=h5ai-selection.' + settings.format;
|
||||
|
@ -68,6 +69,7 @@ module.define('ext/download', [jQuery, 'core/settings', 'core/resource', 'core/e
|
|||
url: resource.api(),
|
||||
data: {
|
||||
action: 'archive',
|
||||
execution: settings.execution,
|
||||
format: settings.format,
|
||||
hrefs: hrefsStr
|
||||
},
|
||||
|
@ -95,15 +97,13 @@ module.define('ext/download', [jQuery, 'core/settings', 'core/resource', 'core/e
|
|||
|
||||
onSelection = function (entries) {
|
||||
|
||||
var $download = $('#download').appendTo('#navbar');
|
||||
|
||||
selectedHrefsStr = '';
|
||||
if (entries.length) {
|
||||
selectedHrefsStr = _.map(entries, function (entry) {
|
||||
|
||||
return entry.absHref;
|
||||
}).join(':');
|
||||
$download.show();
|
||||
$download.appendTo('#navbar').show();
|
||||
} else {
|
||||
$download.hide();
|
||||
$downloadAuth.hide();
|
||||
|
@ -117,13 +117,13 @@ module.define('ext/download', [jQuery, 'core/settings', 'core/resource', 'core/e
|
|||
}
|
||||
|
||||
$download = $(downloadBtnTemplate)
|
||||
.appendTo('#navbar')
|
||||
.find('a').on('click', function (event) {
|
||||
|
||||
event.preventDefault();
|
||||
$downloadAuth.hide();
|
||||
requestArchive(selectedHrefsStr);
|
||||
});
|
||||
}).end()
|
||||
.appendTo('#navbar');
|
||||
$img = $download.find('img');
|
||||
|
||||
$downloadAuth = $(authTemplate).appendTo('body');
|
||||
|
|
|
@ -4,8 +4,7 @@ module.define('ext/l10n', [jQuery, 'core/settings', 'core/langs', 'core/format',
|
|||
var defaults = {
|
||||
enabled: true,
|
||||
lang: 'en',
|
||||
useBrowserLang: true,
|
||||
defaultDateFormat: 'YYYY-MM-DD HH:mm'
|
||||
useBrowserLang: true
|
||||
},
|
||||
|
||||
settings = _.extend({}, defaults, allsettings.l10n),
|
||||
|
@ -52,7 +51,7 @@ module.define('ext/l10n', [jQuery, 'core/settings', 'core/langs', 'core/format',
|
|||
$('.langOption.' + lang).addClass('current');
|
||||
}
|
||||
|
||||
format.setDefaultDateFormat(currentLang.dateFormat || settings.defaultDateFormat);
|
||||
format.setDefaultDateFormat(currentLang.dateFormat);
|
||||
|
||||
$('#extended .entry .date').each(function () {
|
||||
|
||||
|
|
|
@ -7,8 +7,9 @@ module.define('ext/select', [jQuery, 'core/settings', 'core/event'], function ($
|
|||
|
||||
settings = _.extend({}, defaults, allsettings.select),
|
||||
|
||||
x = 0,
|
||||
y = 0,
|
||||
x = 0, y = 0,
|
||||
l = 0, t = 0, w = 0, h = 0,
|
||||
shrink = 1/3,
|
||||
$document = $(document),
|
||||
$selectionRect = $('<div id="selection-rect"></div>'),
|
||||
|
||||
|
@ -24,16 +25,17 @@ module.define('ext/select', [jQuery, 'core/settings', 'core/event'], function ($
|
|||
|
||||
selectionUpdate = function (event) {
|
||||
|
||||
var l = Math.min(x, event.pageX),
|
||||
t = Math.min(y, event.pageY),
|
||||
w = Math.abs(x - event.pageX),
|
||||
h = Math.abs(y - event.pageY),
|
||||
selRect;
|
||||
l = Math.min(x, event.pageX);
|
||||
t = Math.min(y, event.pageY);
|
||||
w = Math.abs(x - event.pageX);
|
||||
h = Math.abs(y - event.pageY);
|
||||
|
||||
event.preventDefault();
|
||||
$selectionRect.css({left: l, top: t, width: w, height: h});
|
||||
$selectionRect
|
||||
.stop(true, true)
|
||||
.css({left: l, top: t, width: w, height: h});
|
||||
|
||||
selRect = $selectionRect.fracs('rect');
|
||||
var selRect = $selectionRect.fracs('rect');
|
||||
$('#extended .entry').removeClass('selecting').each(function () {
|
||||
|
||||
var $entry = $(this),
|
||||
|
@ -49,10 +51,13 @@ module.define('ext/select', [jQuery, 'core/settings', 'core/event'], function ($
|
|||
|
||||
event.preventDefault();
|
||||
$document.off('mousemove', selectionUpdate);
|
||||
$selectionRect.fadeOut(300);
|
||||
$('#extended .entry.selecting.selected').removeClass('selecting').removeClass('selected');
|
||||
$('#extended .entry.selecting').removeClass('selecting').addClass('selected');
|
||||
publish();
|
||||
|
||||
$selectionRect
|
||||
.stop(true, true)
|
||||
.animate({left: l + w * 0.5 * shrink, top: t + h * 0.5 * shrink, width: w * (1 - shrink), height: h * (1 - shrink), opacity: 0}, 300);
|
||||
},
|
||||
|
||||
selectionStart = function (event) {
|
||||
|
@ -61,8 +66,13 @@ module.define('ext/select', [jQuery, 'core/settings', 'core/event'], function ($
|
|||
|
||||
x = event.pageX;
|
||||
y = event.pageY;
|
||||
l = x;
|
||||
t = y;
|
||||
w = 0;
|
||||
h = 0;
|
||||
|
||||
// only on left button and don't block the scrollbars
|
||||
if (event.button !== 0 || x >= view.right || y >= view.bottom) {
|
||||
if (event.button !== 0 || l >= view.right || t >= view.bottom) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -72,7 +82,10 @@ module.define('ext/select', [jQuery, 'core/settings', 'core/event'], function ($
|
|||
$('#extended .entry').removeClass('selected');
|
||||
publish();
|
||||
}
|
||||
$selectionRect.show().css({left: x, top: y, width: 0, height: 0});
|
||||
$selectionRect
|
||||
.stop(true, true)
|
||||
.css({left: l, top: t, width: w, height: h, opacity: 1})
|
||||
.show();
|
||||
|
||||
$document
|
||||
.on('mousemove', selectionUpdate)
|
||||
|
|
|
@ -27,14 +27,14 @@ module.define('ext/thumbnails', [jQuery, 'core/settings', 'core/resource', 'core
|
|||
var $imgBig = entry.$extended.find('.icon.big img');
|
||||
|
||||
requestThumb($imgSmall, {
|
||||
action: 'thumbsrc',
|
||||
action: 'getthumbsrc',
|
||||
href: entry.absHref,
|
||||
width: 16,
|
||||
height: 16,
|
||||
mode: 'square'
|
||||
});
|
||||
requestThumb($imgBig, {
|
||||
action: 'thumbsrc',
|
||||
action: 'getthumbsrc',
|
||||
href: entry.absHref,
|
||||
width: 100,
|
||||
height: 48,
|
||||
|
|
|
@ -14,10 +14,10 @@ module.define('h5ai-info', [jQuery, 'core/resource'], function ($, resource) {
|
|||
|
||||
handleChecksResponse = function (response) {
|
||||
|
||||
_.each(['php', 'cache', 'thumbs', 'temp', 'download'], function (test) {
|
||||
$('.test').each(function () {
|
||||
|
||||
setCheckResult('#test-' + test, response && response[test]);
|
||||
})
|
||||
setCheckResult(this, response && response[$(this).data('id')]);
|
||||
});
|
||||
},
|
||||
|
||||
checks = function () {
|
||||
|
@ -25,7 +25,7 @@ module.define('h5ai-info', [jQuery, 'core/resource'], function ($, resource) {
|
|||
$.ajax({
|
||||
url: resource.api(),
|
||||
data: {
|
||||
action: 'checks'
|
||||
action: 'getchecks'
|
||||
},
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue