11 908
edições
Sem resumo de edição |
Sem resumo de edição |
||
| Linha 52: | Linha 52: | ||
mw.loader.using('jquery', function () { | mw.loader.using('jquery', function () { | ||
$(document).ready(function () { | $(document).ready(function () { | ||
var $sortButton = $('<div class="sort-button" style="width: 25px; height: 25px; background-image: url(https://wiki.otpokemon.com/images/e/e2/O-d.png); background-position: center; background-repeat: no-repeat; background-size: cover; border-radius: 3px;"></div>'); | var isAscending = true; | ||
var $sortButton = $('<div class="sort-button" style="width: 25px; height: 25px; background-image: url(https://wiki.otpokemon.com/images/e/e2/O-d.png); background-position: center; background-repeat: no-repeat; background-size: cover; border-radius: 3px; cursor: pointer;"></div>'); | |||
$('.square-div-gym').before($sortButton); | $('.square-div-gym').before($sortButton); | ||
| Linha 62: | Linha 64: | ||
var numA = parseInt($(a).find('.square-name-gym').text().match(/\d+/)[0], 10); | var numA = parseInt($(a).find('.square-name-gym').text().match(/\d+/)[0], 10); | ||
var numB = parseInt($(b).find('.square-name-gym').text().match(/\d+/)[0], 10); | var numB = parseInt($(b).find('.square-name-gym').text().match(/\d+/)[0], 10); | ||
return numA - numB; | |||
return isAscending ? numA - numB : numB - numA; | |||
}); | }); | ||
$container.append($boxes); | $container.append($boxes); | ||
isAscending = !isAscending; | |||
}); | }); | ||
}); | }); | ||
}); | }); | ||