mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-29 14:35:18 -04:00
Updates sort extension.
This commit is contained in:
parent
1d24ab33e9
commit
bbdafb9def
1 changed files with 25 additions and 24 deletions
|
@ -96,7 +96,7 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
cmpFn = function (getVal, reverse, ignorecase, natural) {
|
cmpFn = function (getValue, reverse, ignorecase, natural) {
|
||||||
|
|
||||||
return function (item1, item2) {
|
return function (item1, item2) {
|
||||||
|
|
||||||
|
@ -107,8 +107,8 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
val1 = '' + getVal(item1);
|
val1 = '' + getValue(item1);
|
||||||
val2 = '' + getVal(item2);
|
val2 = '' + getValue(item2);
|
||||||
|
|
||||||
if (ignorecase) {
|
if (ignorecase) {
|
||||||
val1 = val1.toLowerCase();
|
val1 = val1.toLowerCase();
|
||||||
|
@ -163,30 +163,31 @@ modulejs.define('ext/sort', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var $ascending = $('<img src="' + resource.image('ascending') + '" class="sort ascending" alt="ascending" />'),
|
$('#items li.header')
|
||||||
$descending = $('<img src="' + resource.image('descending') + '" class="sort descending" alt="descending" />'),
|
|
||||||
$header = $('#items li.header');
|
|
||||||
|
|
||||||
$header.find('a.label')
|
.find('a.label')
|
||||||
.append(template)
|
.append(template)
|
||||||
.click(function (event) {
|
.click(function (event) {
|
||||||
sortItems(0, $(this).hasClass('ascending'));
|
sortItems(0, $(this).hasClass('ascending'));
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
})
|
||||||
|
.end()
|
||||||
|
|
||||||
$header.find('a.date')
|
.find('a.date')
|
||||||
.prepend(template)
|
.prepend(template)
|
||||||
.click(function (event) {
|
.click(function (event) {
|
||||||
sortItems(1, $(this).hasClass('ascending'));
|
sortItems(1, $(this).hasClass('ascending'));
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
})
|
||||||
|
.end()
|
||||||
|
|
||||||
$header.find('a.size')
|
.find('a.size')
|
||||||
.prepend(template)
|
.prepend(template)
|
||||||
.click(function (event) {
|
.click(function (event) {
|
||||||
sortItems(2, $(this).hasClass('ascending'));
|
sortItems(2, $(this).hasClass('ascending'));
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
})
|
||||||
|
.end();
|
||||||
|
|
||||||
event.sub('location.changed', onContentChanged);
|
event.sub('location.changed', onContentChanged);
|
||||||
event.sub('location.refreshed', onContentChanged);
|
event.sub('location.refreshed', onContentChanged);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue