Починил сортировку игр в Chrome

This commit is contained in:
Alexander Yakovlev 2018-12-08 19:09:42 +07:00
parent 1f9aae3b1f
commit be55530bd0
3 changed files with 11 additions and 10 deletions

View file

@ -7,7 +7,7 @@ function understrap_remove_scripts() {
}
add_action( 'wp_enqueue_scripts', 'understrap_remove_scripts', 20 );
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', 20 );
function theme_enqueue_styles() {
// Get the theme data

View file

@ -21,21 +21,22 @@ jQuery(document).ready(function($){
jQuery(".order-buttons input").attr("checked", "");
jQuery(this).attr("checked", "checked");
jQuery(this).parent().toggleClass("active");
//jQuery(this).parent().button('toggle');
let value = jQuery(this).val();
//console.log(value);
let value = jQuery(this).val().trim();
switch (value) {
case 'name':
jQuery(".gamelist").each(function(index, list) {
list = jQuery(list);
let games = list.children();
let games = Array.from(list.children());
games.sort(function(a, b) {
let nameA = jQuery(a).find(".nGameName").text();
let nameB = jQuery(b).find(".nGameName").text();
return (nameA > nameB);
let nameA = jQuery(a).find(".nGameName").text().trim();
let nameB = jQuery(b).find(".nGameName").text().trim();
if (nameA > nameB) {
return 1;
}
return -1;
});
list.empty();
games.appendTo(list);
list.append(games);
});
break;
case 'random':

View file

@ -5,7 +5,7 @@
Author: Alexander Yakovlev
Author URI: https://oreolek.ru
Template: understrap
Version: 2.0.0
Version: 2.0.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: understrap-child