mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-27 21:44:22 -04:00
Improves event system.
This commit is contained in:
parent
34eed09537
commit
2819fd8496
9 changed files with 75 additions and 50 deletions
|
@ -119,23 +119,18 @@ modulejs.define('view/items', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
}
|
||||
},
|
||||
|
||||
onLocationRefreshed = function (item) {
|
||||
onLocationRefreshed = function (item, added, removed) {
|
||||
|
||||
var $extended = $('#extended'),
|
||||
$ul = $extended.find('ul'),
|
||||
$empty = $extended.find('.empty'),
|
||||
$items = $ul.find('.entry:not(.folder-parent)'),
|
||||
currentItems = _.map($items.get(), function (i) { return $(i).data('entry'); }),
|
||||
refreshedItems = _.values(item.content),
|
||||
create = _.difference(refreshedItems, currentItems),
|
||||
remove = _.difference(currentItems, refreshedItems);
|
||||
$empty = $extended.find('.empty');
|
||||
|
||||
_.each(create, function (item) {
|
||||
_.each(added, function (item) {
|
||||
|
||||
update(item, true).hide().appendTo($ul).fadeIn(400);
|
||||
});
|
||||
|
||||
_.each(remove, function (item) {
|
||||
_.each(removed, function (item) {
|
||||
|
||||
item.$extended.fadeOut(400, function () {
|
||||
item.$extended.remove();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue