mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-06-02 10:41:54 +08:00
Merge pull request #345 from AndySky21/stores-az-sorting
Stores alphabetical sorting
This commit is contained in:
+6
-5
@@ -797,6 +797,7 @@ var Room = {
|
|||||||
$SM.set('stores["'+k+'"]', 0);
|
$SM.set('stores["'+k+'"]', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var lk = _(k);
|
||||||
|
|
||||||
// thieves?
|
// thieves?
|
||||||
if(typeof $SM.get('game.thieves') == 'undefined' && num > 5000 && $SM.get('features.location.world')) {
|
if(typeof $SM.get('game.thieves') == 'undefined' && num > 5000 && $SM.get('features.location.world')) {
|
||||||
@@ -805,21 +806,21 @@ var Room = {
|
|||||||
|
|
||||||
if(row.length === 0 && num > 0) {
|
if(row.length === 0 && num > 0) {
|
||||||
row = $('<div>').attr('id', id).addClass('storeRow');
|
row = $('<div>').attr('id', id).addClass('storeRow');
|
||||||
$('<div>').addClass('row_key').text(_(k)).appendTo(row);
|
$('<div>').addClass('row_key').text(lk).appendTo(row);
|
||||||
$('<div>').addClass('row_val').text(Math.floor(num)).appendTo(row);
|
$('<div>').addClass('row_val').text(Math.floor(num)).appendTo(row);
|
||||||
$('<div>').addClass('clear').appendTo(row);
|
$('<div>').addClass('clear').appendTo(row);
|
||||||
var curPrev = null;
|
var curPrev = null;
|
||||||
location.children().each(function(i) {
|
location.children().each(function(i) {
|
||||||
var child = $(this);
|
var child = $(this);
|
||||||
var cName = child.attr('id').substring(4).replace('-', ' ');
|
var cName = child.children('.row_key').text();
|
||||||
if(cName < k && (curPrev == null || cName > curPrev)) {
|
if(cName < lk) {
|
||||||
curPrev = cName;
|
curPrev = child.attr('id');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(curPrev == null) {
|
if(curPrev == null) {
|
||||||
row.prependTo(location);
|
row.prependTo(location);
|
||||||
} else {
|
} else {
|
||||||
row.insertAfter(location.find('#row_' + curPrev.replace(' ', '-')));
|
row.insertAfter(location.find('#' + curPrev));
|
||||||
}
|
}
|
||||||
newRow = true;
|
newRow = true;
|
||||||
} else if(num>= 0){
|
} else if(num>= 0){
|
||||||
|
|||||||
Reference in New Issue
Block a user