From: Steinar H. Gunderson Date: Thu, 28 Dec 2017 14:32:04 +0000 (+0100) Subject: Remove the option to sort by name; fewer options is good, and few people probably... X-Git-Url: https://git.sesse.net/?p=remoteglot;a=commitdiff_plain;h=4c690438b189e0656720b0e20eb09ec97b52727a Remove the option to sort by name; fewer options is good, and few people probably used this. --- diff --git a/www/index.html b/www/index.html index 76718a5..67b13b8 100644 --- a/www/index.html +++ b/www/index.html @@ -40,10 +40,6 @@ On Off | - Sort by: - Move - Score - | No history | Make moves by clicking on them, or on an involved square. diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index 34e1863..d614c7e 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -94,9 +94,6 @@ var toplay = 'W'; /** @type {number} @private */ var ims = 0; -/** @type {boolean} @private */ -var sort_refutation_lines_by_score = true; - /** @type {boolean} @private */ var truncate_display_history = true; @@ -569,15 +566,6 @@ var create_arrow = function(from_square, to_square, fg_color, line_width, arrow_ arrows.push(arrow); } -// Note: invert is ignored. -var compare_by_name = function(refutation_lines, invert, a, b) { - var ska = refutation_lines[a]['move']; - var skb = refutation_lines[b]['move']; - if (ska < skb) return -1; - if (ska > skb) return 1; - return 0; -}; - var compare_by_score = function(refutation_lines, invert, a, b) { var sa = compute_score_sort_key(refutation_lines[b]['score'], refutation_lines[b]['depth'], invert); var sb = compute_score_sort_key(refutation_lines[a]['score'], refutation_lines[a]['depth'], invert); @@ -801,8 +789,7 @@ var update_refutation_lines = function() { if (current_display_line && current_display_move % 2 == 0) { invert = !invert; } - var compare = sort_refutation_lines_by_score ? compare_by_score : compare_by_name; - moves = moves.sort(function(a, b) { return compare(refutation_lines, invert, a, b) }); + moves = moves.sort(function(a, b) { return compare_by_score(refutation_lines, invert, a, b) }); for (var i = 0; i < moves.length; ++i) { var line = refutation_lines[moves[i]]; @@ -863,15 +850,6 @@ var update_refutation_lines = function() { tbl.append(tr); } - // Make one of the links clickable and the other nonclickable. - if (sort_refutation_lines_by_score) { - $("#sortbyscore0").html("Move"); - $("#sortbyscore1").html("Score"); - } else { - $("#sortbyscore0").html("Move"); - $("#sortbyscore1").html("Score"); - } - // Update the move highlight, as we've rewritten all the HTML. update_move_highlight(); } @@ -1540,18 +1518,6 @@ var format_tooltip = function(data, halfmove_num) { } } -/** - * @param {boolean} sort_by_score - */ -var resort_refutation_lines = function(sort_by_score) { - sort_refutation_lines_by_score = sort_by_score; - if (supports_html5_storage()) { - localStorage['sort_refutation_lines_by_score'] = sort_by_score ? 1 : 0; - } - update_refutation_lines(); -} -window['resort_refutation_lines'] = resort_refutation_lines; - /** * @param {boolean} truncate_history */ @@ -2201,11 +2167,6 @@ var init = function() { } else { set_sound(false); } - if (supports_html5_storage() && localStorage['sort_refutation_lines_by_score']) { - sort_refutation_lines_by_score = parseInt(localStorage['sort_refutation_lines_by_score']); - } else { - sort_refutation_lines_by_score = true; - } // Create board. board = new window.ChessBoard('board', {