mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-27 13:34:30 -04:00
Adds drag'n'drop upload.
This commit is contained in:
parent
da438f2f0b
commit
d76fad3a51
15 changed files with 766 additions and 27 deletions
|
@ -1,5 +1,5 @@
|
|||
|
||||
modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/resource', 'core/store', 'core/entry'], function (_, $, allsettings, resource, store, entry) {
|
||||
modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/resource', 'core/store', 'core/event', 'core/entry'], function (_, $, allsettings, resource, store, event, entry) {
|
||||
|
||||
var defaults = {
|
||||
enabled: false,
|
||||
|
@ -149,7 +149,6 @@ modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/resource',
|
|||
$('#pv-img-bar-original').find('a').attr('href', currentEntries[currentIdx].absHref);
|
||||
}, 1);
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -201,13 +200,20 @@ modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/resource',
|
|||
}
|
||||
},
|
||||
|
||||
initEntry = function (entries, entry, idx) {
|
||||
initEntry = function (entry) {
|
||||
|
||||
if (entry.$extended) {
|
||||
if (entry.$extended && _.indexOf(settings.types, entry.type) >= 0) {
|
||||
entry.$extended.find('a').on('click', function (event) {
|
||||
|
||||
event.preventDefault();
|
||||
onEnter(entries, idx);
|
||||
|
||||
var matchedEntries = _.compact(_.map($('#extended .entry'), function (entry) {
|
||||
|
||||
entry = $(entry).data('entry');
|
||||
return _.indexOf(settings.types, entry.type) >= 0 ? entry : null;
|
||||
}));
|
||||
|
||||
onEnter(matchedEntries, _.indexOf(matchedEntries, entry));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -218,13 +224,9 @@ modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/resource',
|
|||
return;
|
||||
}
|
||||
|
||||
var imageEntries = _.filter(entry.content, function (entry) {
|
||||
_.each(entry.content, function (e) {
|
||||
|
||||
return _.indexOf(settings.types, entry.type) >= 0;
|
||||
});
|
||||
_.each(imageEntries, function (e, idx) {
|
||||
|
||||
initEntry(imageEntries, e, idx);
|
||||
initEntry(e);
|
||||
});
|
||||
|
||||
$(template).appendTo('body');
|
||||
|
@ -277,6 +279,11 @@ modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/resource',
|
|||
}
|
||||
});
|
||||
|
||||
event.sub('entry.created', function (entry) {
|
||||
|
||||
initEntry(entry);
|
||||
});
|
||||
|
||||
$(window).on('resize load', adjustSize);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue