From db7225fbad34aafcff29809c54ccd098442f0e14 Mon Sep 17 00:00:00 2001 From: Jonathan Wong Date: Tue, 20 Oct 2015 00:48:26 -0700 Subject: [PATCH] Clean up code --- data/interfaces/default/history.html | 16 +++++++--------- data/interfaces/default/user.html | 16 +++++++--------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/data/interfaces/default/history.html b/data/interfaces/default/history.html index 050e82c4..59cb8aa0 100644 --- a/data/interfaces/default/history.html +++ b/data/interfaces/default/history.html @@ -95,7 +95,7 @@ clearSearchButton('history_table', history_table); $('#history_table_filter').prepend('
\ -
'); $('#media_type-selection').on('change', function () { - media_type = $('input[name=media_type-filter]:checked', '#media_type-selection').val(); - loadHistoryTable(media_type) + $('#media_type-selection > label').removeClass('active'); + selected_filter = $('input[name=media_type-filter]:checked', '#media_type-selection'); + $(selected_filter).closest('label').addClass('active'); + media_type = $(selected_filter).val(); + history_table.draw(); }); - $('#media_type-selection > label').removeClass('active'); - if (media_type == 'all') { $('#history-all').closest('label').addClass('active'); } - if (media_type == 'movie') { $('#history-movies').closest('label').addClass('active'); } - if (media_type == 'episode') { $('#history-tv_shows').closest('label').addClass('active'); } - if (media_type == 'track') { $('#history-music').closest('label').addClass('active'); } } var media_type = 'all'; - loadHistoryTable(media_type) + loadHistoryTable(media_type); $('#row-edit-mode').on('click', function() { $('#row-edit-mode-alert').fadeIn(200); diff --git a/data/interfaces/default/user.html b/data/interfaces/default/user.html index 9bb05c7b..06d14d3b 100644 --- a/data/interfaces/default/user.html +++ b/data/interfaces/default/user.html @@ -342,7 +342,7 @@ from plexpy import helpers clearSearchButton('history_table', history_table); $('#history_table_filter').prepend('
\ -
'); $('#media_type-selection').on('change', function () { - media_type = $('input[name=media_type-filter]:checked', '#media_type-selection').val(); - loadHistoryTable(media_type) + $('#media_type-selection > label').removeClass('active'); + selected_filter = $('input[name=media_type-filter]:checked', '#media_type-selection'); + $(selected_filter).closest('label').addClass('active'); + media_type = $(selected_filter).val(); + history_table.draw(); }); - $('#media_type-selection > label').removeClass('active'); - if (media_type == 'all') { $('#history-all').closest('label').addClass('active'); } - if (media_type == 'movie') { $('#history-movies').closest('label').addClass('active'); } - if (media_type == 'episode') { $('#history-tv_shows').closest('label').addClass('active'); } - if (media_type == 'track') { $('#history-music').closest('label').addClass('active'); } } $( "#history-tab-btn" ).one( "click", function() { var media_type = 'all'; - loadHistoryTable(media_type) + loadHistoryTable(media_type); }); $( "#ip-tab-btn" ).one( "click", function() {