From e76a2d0b7a81a5aa8528ad6eb90f156ea351516a Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 18 May 2014 00:16:02 -0400 Subject: [PATCH] Move function def to correct place. --- main.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/main.js b/main.js index 61b7147..fb635a6 100644 --- a/main.js +++ b/main.js @@ -75,6 +75,22 @@ function load_score_into_element(data, anime_id, elem) { } } +function update_shared_row_colors(row, our_pos) { + var our_cell = $(row.find("td")[our_pos]); + var their_cell = $(row.find("td")[our_pos == 1 ? 2 : 1]); + var diff = our_cell.text() - their_cell.text(); + + if (!diff) { + row.find("td").css("background-color", "#f6f6f6"); + our_cell.add(their_cell).find("span").css("color", ""); + } + else { + row.find("td").css("background-color", ""); + our_cell.css("color", diff > 0 ? "#FF0000" : "#0000FF"); + their_cell.css("color", diff > 0 ? "#0000FF" : "#FF0000"); + } +} + /* --------------------------- Storage functions --------------------------- */ function save_score(anime_id, score) { @@ -422,22 +438,6 @@ function hook_edit(anime_id) { }); } -function update_shared_row_colors(row, our_pos) { - var our_cell = $(row.find("td")[our_pos]); - var their_cell = $(row.find("td")[our_pos == 1 ? 2 : 1]); - var diff = our_cell.text() - their_cell.text(); - - if (!diff) { - row.find("td").css("background-color", "#f6f6f6"); - our_cell.add(their_cell).find("span").css("color", ""); - } - else { - row.find("td").css("background-color", ""); - our_cell.css("color", diff > 0 ? "#FF0000" : "#0000FF"); - their_cell.css("color", diff > 0 ? "#0000FF" : "#FF0000"); - } -} - function hook_shared() { var our_profile = $("#nav a:first").attr("href"), our_pos; var profile_links = $("#content h2:first").find("a").slice(1);