mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-13 18:16:57 -07:00
Dynamically adjust user recently watched items
Only show one row of recently watched items which adjusts to the window size, similar to recently added items.
This commit is contained in:
parent
c98505038a
commit
317a9f0b8e
1 changed files with 32 additions and 10 deletions
|
@ -240,6 +240,33 @@ from plexpy import helpers
|
||||||
<script src="interfaces/default/js/tables/user_ips.js"></script>
|
<script src="interfaces/default/js/tables/user_ips.js"></script>
|
||||||
<script src="interfaces/default/js/tables/sync_table.js"></script>
|
<script src="interfaces/default/js/tables/sync_table.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
function recentlyWatched() {
|
||||||
|
var widthVal = $('body').find("#user-recently-watched").width();
|
||||||
|
var tmp = (widthVal-32) / 180;
|
||||||
|
|
||||||
|
if (tmp > 0) {
|
||||||
|
containerSize = parseInt(tmp);
|
||||||
|
} else {
|
||||||
|
containerSize = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
% if data['user_id']:
|
||||||
|
var user_id = ${data['user_id']};
|
||||||
|
% else:
|
||||||
|
var user_id = null;
|
||||||
|
% endif
|
||||||
|
|
||||||
|
// Populate recently watched
|
||||||
|
$.ajax({
|
||||||
|
url: 'get_user_recently_watched',
|
||||||
|
async: true,
|
||||||
|
data: { user_id: user_id, user: '${data['username']}', limit: containerSize },
|
||||||
|
complete: function(xhr, status) {
|
||||||
|
$("#user-recently-watched").html(xhr.responseText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
% if data['user_id']:
|
% if data['user_id']:
|
||||||
|
@ -270,16 +297,6 @@ from plexpy import helpers
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Populate recently watched
|
|
||||||
$.ajax({
|
|
||||||
url: 'get_user_recently_watched',
|
|
||||||
async: true,
|
|
||||||
data: { user_id: user_id, user: '${data['username']}' },
|
|
||||||
complete: function(xhr, status) {
|
|
||||||
$("#user-recently-watched").html(xhr.responseText);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$( "#history-tab-btn" ).one( "click", function() {
|
$( "#history-tab-btn" ).one( "click", function() {
|
||||||
// Build watch history table
|
// Build watch history table
|
||||||
history_table_options.ajax = {
|
history_table_options.ajax = {
|
||||||
|
@ -356,6 +373,11 @@ from plexpy import helpers
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
recentlyWatched();
|
||||||
|
$(window).resize(function() {
|
||||||
|
recentlyWatched();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue