mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-06-04 17:03:41 -04:00
Final modifications.
This commit is contained in:
parent
de92767e5a
commit
ade6cf8e0b
24 changed files with 316 additions and 275 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue