mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 05:31:15 -07:00
743 lines
No EOL
36 KiB
HTML
743 lines
No EOL
36 KiB
HTML
<%doc>
|
|
USAGE DOCUMENTATION :: PLEASE LEAVE THIS AT THE TOP OF THIS FILE
|
|
|
|
For Mako templating syntax documentation please visit: http://docs.makotemplates.org/en/latest/
|
|
|
|
Filename: library.html
|
|
Version: 0.1
|
|
Variable names: data [list]
|
|
|
|
data :: Usable parameters
|
|
|
|
section_id Returns the library id of the library.
|
|
section_name Returns the name of the library.
|
|
section_type Returns the type of the library.
|
|
library_thumb Returns the thumbnail for the library.
|
|
custom_thumb Returns the custom thumbnail for the library.
|
|
library_art Returns the artwork for the library.
|
|
count Returns the item count for the library.
|
|
parent_count Returns the parent item count for the library.
|
|
child_count Returns the child item count for the library.
|
|
do_notify Returns bool value for whether to send notifications for the library.
|
|
keep_history Returns bool value for whether to keep history for the library.
|
|
|
|
DOCUMENTATION :: END
|
|
|
|
</%doc>
|
|
|
|
<%inherit file="base.html"/>
|
|
|
|
<%def name="headIncludes()">
|
|
<link rel="stylesheet" href="${http_root}css/dataTables.bootstrap.css">
|
|
<link rel="stylesheet" href="${http_root}css/dataTables.colVis.css">
|
|
<link rel="stylesheet" href="${http_root}css/tautulli-dataTables.css">
|
|
</%def>
|
|
|
|
<%def name="body()">
|
|
% if data:
|
|
<%
|
|
from plexpy.common import LIVE_TV_SECTION_ID
|
|
from plexpy.helpers import page
|
|
%>
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
% if data['library_art']:
|
|
<div class="art-face" style="background-image:url(${page('pms_image_proxy', data['library_art'], None, 1920, 1080)})"></div>
|
|
% if _session['user_group'] == 'admin':
|
|
<span class="overlay-refresh-image info-art" title="Refresh background image"><i class="fa fa-refresh refresh_pms_image"></i></span>
|
|
% endif
|
|
% endif
|
|
<div class="summary-container">
|
|
<div class="summary-navbar">
|
|
<div class="col-md-12">
|
|
<div class="summary-navbar-list">
|
|
<ul class="list-unstyled breadcrumb">
|
|
<li class="active">${data['section_name']}</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="summary-content-wrapper" style="min-height: calc(100% - 50px);">
|
|
<div class="col-md-12">
|
|
<div class="table-card-back">
|
|
<div class="user-info-wrapper">
|
|
% if data['library_thumb'].startswith('http'):
|
|
<div class="library-info-poster-face" style="background-image: url(${page('pms_image_proxy', data['library_thumb'], None, 80, 80)});">
|
|
% if not data['is_active']:
|
|
<span class="inactive-library-tooltip" data-toggle="tooltip" title="Library not on Plex server">
|
|
<i class="fa fa-2x fa-exclamation-triangle"></i>
|
|
</span>
|
|
% endif
|
|
</div>
|
|
% else:
|
|
<div class="library-info-poster-face svg-icon library-${data['section_type']}">
|
|
% if not data['is_active']:
|
|
<span class="inactive-library-tooltip" data-toggle="tooltip" title="Library not on Plex server">
|
|
<i class="fa fa-2x fa-exclamation-triangle"></i>
|
|
</span>
|
|
% endif
|
|
</div>
|
|
% endif
|
|
<div class="user-info-username">
|
|
<span class="set-username">${data['section_name']}</span>
|
|
% if _session['user_group'] == 'admin':
|
|
<span id="edit-library-tooltip" data-target="tooltip" title="Edit library details">
|
|
<a href="#" data-toggle="modal" data-target="#edit-library-modal" id="toggle-edit-library-modal"><i class="fa fa-pencil"></i></a>
|
|
</span>
|
|
% endif
|
|
</div>
|
|
<div class="user-info-nav">
|
|
<ul class="user-info-nav" role="tablist">
|
|
<li class="active"><a href="#tabs-profile" role="tab" data-toggle="tab">Profile</a></li>
|
|
<li><a id="history-tab-btn" href="#tabs-history" role="tab" data-toggle="tab">History</a></li>
|
|
% if _session['user_group'] == 'admin':
|
|
% if data['section_id'] != LIVE_TV_SECTION_ID:
|
|
<li><a id="media-info-tab-btn" href="#tabs-mediainfo" role="tab" data-toggle="tab">Media Info</a></li>
|
|
<li><a id="export-tab-btn" href="#tabs-export" role="tab" data-toggle="tab">Export</a></li>
|
|
% endif
|
|
% endif
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="tab-content">
|
|
<div role="tabpanel" class="tab-pane active" id="tabs-profile">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="table-card-header">
|
|
<div class="header-bar">
|
|
<span><i class="fa fa-line-chart"></i> Global Stats</span>
|
|
</div>
|
|
</div>
|
|
<div class="table-card-back">
|
|
<div id="library-time-stats" class="user-overview-stats-wrapper">
|
|
<div class='muted'><i class="fa fa-refresh fa-spin"></i> Loading data...</div>
|
|
<br>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="table-card-header">
|
|
<div class="header-bar">
|
|
<span><i class="fa fa-group"></i> User Stats</span>
|
|
</div>
|
|
</div>
|
|
<div class="table-card-back">
|
|
<div id="library-user-stats" class="user-player">
|
|
<div class='muted'><i class="fa fa-refresh fa-spin"></i> Loading data...</div>
|
|
<br>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="table-card-header">
|
|
<ul class="nav nav-header nav-dashboard pull-right">
|
|
<li>
|
|
<a href="#" id="recently-watched-page-left" class="paginate-watched btn-gray disabled" data-id="+1"><i class="fa fa-lg fa-chevron-left"></i></a>
|
|
</li>
|
|
<li>
|
|
<a href="#" id="recently-watched-page-right" class="paginate-watched btn-gray disabled" data-id="-1"><i class="fa fa-lg fa-chevron-right"></i></a>
|
|
</li>
|
|
</ul>
|
|
<div class="header-bar">
|
|
<span><i class="fa fa-history"></i> Recently Played</span>
|
|
</div>
|
|
</div>
|
|
<div class="table-card-back">
|
|
<div id="library-recently-watched">
|
|
<div class='muted'><i class="fa fa-refresh fa-spin"></i> Loading data...</div>
|
|
<br>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
% if data['section_id'] != LIVE_TV_SECTION_ID:
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="table-card-header">
|
|
<ul class="nav nav-header nav-dashboard pull-right">
|
|
<li>
|
|
<a href="#" id="recently-added-page-left" class="paginate-added btn-gray disabled" data-id="+1"><i class="fa fa-lg fa-chevron-left"></i></a>
|
|
</li>
|
|
<li>
|
|
<a href="#" id="recently-added-page-right" class="paginate-added btn-gray disabled" data-id="-1"><i class="fa fa-lg fa-chevron-right"></i></a>
|
|
</li>
|
|
</ul>
|
|
<div class="header-bar">
|
|
<span><i class="fa fa-history"></i> Recently Added</span>
|
|
</div>
|
|
</div>
|
|
<div class="table-card-back">
|
|
<div id="library-recently-added">
|
|
<div class='muted'><i class="fa fa-refresh fa-spin"></i> Loading data...</div>
|
|
<br>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
% endif
|
|
</div>
|
|
<div role="tabpanel" class="tab-pane" id="tabs-history">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class='table-card-header'>
|
|
<div class="header-bar">
|
|
<span>
|
|
<i class="fa fa-history"></i> History for <strong>
|
|
<span class="set-username">${data['section_name']}</span>
|
|
</strong>
|
|
</span>
|
|
</div>
|
|
<div class="button-bar">
|
|
% if _session['user_group'] == 'admin':
|
|
<div class="alert alert-danger alert-edit" role="alert" id="row-edit-mode-alert"><i class="fa fa-exclamation-triangle"></i> Select rows to delete. Data is deleted upon exiting delete mode.</div>
|
|
<div class="btn-group">
|
|
<button class="btn btn-danger btn-edit" data-toggle="button" aria-pressed="false" autocomplete="off" id="row-edit-mode">
|
|
<i class="fa fa-trash-o"></i> Delete mode
|
|
</button>
|
|
</div>
|
|
% endif
|
|
<div class="btn-group">
|
|
<button class="btn btn-dark refresh-history-button" id="refresh-history-list"><i class="fa fa-refresh"></i> Refresh history</button>
|
|
</div>
|
|
<div class="btn-group colvis-button-bar" id="button-bar-history"></div>
|
|
</div>
|
|
</div>
|
|
<div class="table-card-back">
|
|
<table class="display history_table" id="history_table-SID-${data['section_id']}" width="100%">
|
|
<thead>
|
|
<tr>
|
|
<th align="left" id="delete">Delete</th>
|
|
<th align="left" id="date">Date</th>
|
|
<th align="left" id="friendly_name">User</th>
|
|
<th align="left" id="ip_address">IP Address</th>
|
|
<th align="left" id="platform">Platform</th>
|
|
<th align="left" id="product">Product</th>
|
|
<th align="left" id="player">Player</th>
|
|
<th align="left" id="title">Title</th>
|
|
<th align="left" id="started">Started</th>
|
|
<th align="left" id="paused_counter">Paused</th>
|
|
<th align="left" id="stopped">Stopped</th>
|
|
<th align="left" id="duration">Duration</th>
|
|
<th align="left" id="percent_complete"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody></tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div role="tabpanel" class="tab-pane" id="tabs-mediainfo">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
% if config['get_file_sizes'] and data['section_id'] in config['get_file_sizes_hold']['section_ids']:
|
|
<div id="get_file_sizes_message" style="text-align: center; margin-top: 20px;">
|
|
% else:
|
|
<div id="get_file_sizes_message" style="text-align: center; margin-top: 20px; display: none;">
|
|
% endif
|
|
<i class="fa fa-refresh fa-spin"></i> Tautulli is calculating the file sizes for the library's media info. This could take a few minutes depending on the size of your library.
|
|
<br />
|
|
You may leave this page and check back later.
|
|
</div>
|
|
<div class='table-card-header'>
|
|
<div class="header-bar">
|
|
<span>
|
|
<i class="fa fa-history"></i> Media Info for <strong>
|
|
<span class="set-username">${data['section_name']}</span>
|
|
</strong>
|
|
</span>
|
|
</div>
|
|
<div class="button-bar">
|
|
% if _session['user_group'] == 'admin':
|
|
<div class="btn-group">
|
|
% if config['get_file_sizes'] and data['section_id'] in config['get_file_sizes_hold']['section_ids']:
|
|
<button class="btn btn-dark refresh-media-info-table-button" id="refresh-media-info-table" disabled>
|
|
<i class="fa fa-refresh"></i> Refresh media info
|
|
</button>
|
|
% else:
|
|
<button class="btn btn-dark refresh-media-info-table-button" id="refresh-media-info-table">
|
|
<i class="fa fa-refresh"></i> Refresh media info
|
|
</button>
|
|
% endif
|
|
</div>
|
|
% endif
|
|
<div class="btn-group colvis-button-bar" id="button-bar-media-info"></div>
|
|
</div>
|
|
</div>
|
|
<div class="table-card-back">
|
|
<table class="display media_info_table" id="media_info_table-SID-${data['section_id']}" width="100%">
|
|
<thead>
|
|
<tr>
|
|
<th align="left" id="added_at">Added At</th>
|
|
<th align="left" id="title">Title</th>
|
|
<th align="left" id="container">Container</th>
|
|
<th align="left" id="bitrate">Bitrate</th>
|
|
<th align="left" id="video_codec">Video Codec</th>
|
|
<th align="left" id="video_resolution">Video Resolution</th>
|
|
<th align="left" id="video_resolution">Video Framerate</th>
|
|
<th align="left" id="audio_codec">Audio Codec</th>
|
|
<th align="left" id="audio_channels">Audio Channels</th>
|
|
<th align="left" id="file_size">File Size</th>
|
|
<th align="left" id="last_played">Last Played</th>
|
|
<th align="left" id="total_plays">Total Plays</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody></tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div role="tabpanel" class="tab-pane" id="tabs-export">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class='table-card-header'>
|
|
<div class="header-bar">
|
|
<span>
|
|
<i class="fa fa-file-export"></i> Exports for <strong>
|
|
<span class="set-username">${data['section_name']}</span>
|
|
</strong>
|
|
</span>
|
|
</div>
|
|
<div class="button-bar">
|
|
% if _session['user_group'] == 'admin':
|
|
<div class="btn-group">
|
|
<button class="btn btn-dark refresh-export-table-button" id="refresh-export-table">
|
|
<i class="fa fa-refresh"></i> Refresh exports
|
|
</button>
|
|
</div>
|
|
% endif
|
|
<div class="btn-group colvis-button-bar" id="button-bar-export"></div>
|
|
</div>
|
|
</div>
|
|
<div class="table-card-back">
|
|
<table class="display export_table" id="export_table-SID-${data['section_id']}" width="100%">
|
|
<thead>
|
|
<tr>
|
|
<th align="left" id="timestamp">Exported At</th>
|
|
<th align="left" id="media_type_title">Media Type</th>
|
|
<th align="left" id="rating_key">Rating Key</th>
|
|
<th align="left" id="file_format">Format</th>
|
|
<th align="left" id="filename">Filename</th>
|
|
<th align="left" id="complete">Download</th>
|
|
<th align="left" id="delete">Delete</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody></tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<footer></footer>
|
|
% else:
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="summary-container">
|
|
<div class="summary-navbar">
|
|
<div class="col-md-12">
|
|
<div class="summary-navbar-list">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="summary-content-wrapper">
|
|
<div class='col-md-12'>
|
|
<div style="text-align: center; margin-top: 20px;">
|
|
<i class="fa fa-exclamation-triangle"></i> Error retrieving library information. Please see the logs for more details.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
% endif
|
|
</%def>
|
|
|
|
<%def name="modalIncludes()">
|
|
<div id="edit-library-modal" class="modal fade" tabindex="-1" role="dialog"
|
|
aria-labelledby="edit-library-modal">
|
|
</div>
|
|
<div class="modal fade" id="info-modal" tabindex="-1" role="dialog" aria-labelledby="info-modal">
|
|
</div>
|
|
<div class="modal fade" id="ip-info-modal" tabindex="-1" role="dialog" aria-labelledby="ip-info-modal">
|
|
</div>
|
|
<div class="modal fade" id="confirm-modal-delete" tabindex="-1" role="dialog" aria-labelledby="confirm-modal-delete">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-remove"></i></button>
|
|
<h4 class="modal-title" id="myModalLabel">Confirm Delete</h4>
|
|
</div>
|
|
<div class="modal-body" style="text-align: center;">
|
|
<p>Are you REALLY sure you want to delete <strong><span id="deleteCount"></span></strong> history item(s)?</p>
|
|
<p>This is permanent and cannot be undone!</p>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-dark" data-dismiss="modal">Cancel</button>
|
|
<button type="button" class="btn btn-danger btn-ok" data-dismiss="modal" id="confirm-delete">Delete</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</%def>
|
|
|
|
<%def name="javascriptIncludes()">
|
|
<script src="${http_root}js/jquery.dataTables.min.js"></script>
|
|
<script src="${http_root}js/dataTables.colVis.js"></script>
|
|
<script src="${http_root}js/dataTables.bootstrap.min.js"></script>
|
|
<script src="${http_root}js/dataTables.bootstrap.pagination.js"></script>
|
|
% if data:
|
|
<% from plexpy.common import LIVE_TV_SECTION_ID %>
|
|
<script>
|
|
% if str(data['section_id']).isdigit():
|
|
var section_id = ${data['section_id']};
|
|
% else:
|
|
var section_id = null;
|
|
% endif
|
|
var section_name = '${data['section_name'].replace("'", "\\'")}';
|
|
var refresh_table = false;
|
|
|
|
% if config['get_file_sizes']:
|
|
var get_file_sizes = false;
|
|
% else:
|
|
var get_file_sizes = null;
|
|
% endif
|
|
</script>
|
|
<script src="${http_root}js/moment-with-locale.js"></script>
|
|
<script src="${http_root}js/tables/history_table.js${cache_param}"></script>
|
|
<script src="${http_root}js/tables/media_info_table.js${cache_param}"></script>
|
|
<script src="${http_root}js/tables/export_table.js${cache_param}"></script>
|
|
<script>
|
|
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
|
$.fn.dataTable.tables({ visible: true, api: true }).columns.adjust();
|
|
});
|
|
|
|
function loadHistoryTable() {
|
|
// Build watch history table
|
|
history_table_options.ajax = {
|
|
url: 'get_history',
|
|
type: 'POST',
|
|
data: function ( d ) {
|
|
return {
|
|
json_data: JSON.stringify( d ),
|
|
section_id: section_id,
|
|
user_id: "${_session['user_group']}" == "admin" ? null : "${_session['user_id']}"
|
|
};
|
|
}
|
|
};
|
|
history_table = $('#history_table-SID-${data["section_id"]}').DataTable(history_table_options);
|
|
|
|
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 12] });
|
|
$(colvis.button()).appendTo('#button-bar-history');
|
|
|
|
clearSearchButton('history_table-SID-${data["section_id"]}', history_table);
|
|
}
|
|
|
|
$('a[href="#tabs-history"]').on('shown.bs.tab', function() {
|
|
if (typeof(history_table) === 'undefined') {
|
|
loadHistoryTable();
|
|
}
|
|
});
|
|
|
|
$("#refresh-history-list").click(function () {
|
|
history_table.draw();
|
|
});
|
|
|
|
$(".inactive-library-tooltip").tooltip();
|
|
|
|
% if _session['user_group'] == 'admin':
|
|
function loadMediaInfoTable() {
|
|
// Build media info table
|
|
media_info_table_options.ajax = {
|
|
url: 'get_library_media_info',
|
|
type: 'POST',
|
|
data: function ( d ) {
|
|
return {
|
|
json_data: JSON.stringify( d ),
|
|
section_id: section_id,
|
|
refresh: refresh_table
|
|
};
|
|
}
|
|
};
|
|
media_info_table = $('#media_info_table-SID-${data["section_id"]}').DataTable(media_info_table_options);
|
|
|
|
var colvis = new $.fn.dataTable.ColVis(media_info_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark' });
|
|
$(colvis.button()).appendTo('#button-bar-media-info');
|
|
|
|
clearSearchButton('media_info_table-SID-${data["section_id"]}', media_info_table);
|
|
}
|
|
|
|
$('a[href="#tabs-mediainfo"]').on('shown.bs.tab', function() {
|
|
if (typeof(media_info_table) === 'undefined') {
|
|
loadMediaInfoTable();
|
|
}
|
|
});
|
|
|
|
$("#refresh-media-info-table").click(function () {
|
|
media_info_child_table = {};
|
|
refresh_table = true;
|
|
refresh_child_tables = true;
|
|
media_info_table.draw();
|
|
refresh_table = false;
|
|
});
|
|
|
|
function loadExportTable() {
|
|
// Build export table
|
|
export_table_options.ajax = {
|
|
url: 'get_library_export',
|
|
type: 'POST',
|
|
data: function ( d ) {
|
|
return {
|
|
json_data: JSON.stringify( d ),
|
|
section_id: section_id
|
|
};
|
|
}
|
|
};
|
|
export_table = $('#export_table-SID-${data["section_id"]}').DataTable(export_table_options);
|
|
|
|
var colvis = new $.fn.dataTable.ColVis(export_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark' });
|
|
$(colvis.button()).appendTo('#button-bar-export-table');
|
|
|
|
clearSearchButton('export_table-SID-${data["section_id"]}', export_table);
|
|
}
|
|
|
|
$('a[href="#tabs-export"]').on('shown.bs.tab', function() {
|
|
if (typeof(export_table) === 'undefined') {
|
|
loadExportTable();
|
|
}
|
|
});
|
|
|
|
$("#refresh-export-table").click(function () {
|
|
export_table.draw();
|
|
});
|
|
|
|
$("#edit-library-tooltip").tooltip();
|
|
|
|
// Load edit library modal
|
|
$("#toggle-edit-library-modal").click(function() {
|
|
$("#edit-library-tooltip").tooltip('hide');
|
|
$.ajax({
|
|
url: 'edit_library_dialog',
|
|
data: { section_id: section_id },
|
|
cache: false,
|
|
async: true,
|
|
complete: function(xhr, status) {
|
|
$("#edit-library-modal").html(xhr.responseText);
|
|
}
|
|
});
|
|
});
|
|
|
|
$('#row-edit-mode').on('click', function() {
|
|
$('#row-edit-mode-alert').fadeIn(200);
|
|
|
|
if ($(this).hasClass('active')) {
|
|
if (history_to_delete.length > 0) {
|
|
$('#deleteCount').text(history_to_delete.length);
|
|
$('#confirm-modal-delete').modal();
|
|
$('#confirm-modal-delete').one('click', '#confirm-delete', function () {
|
|
$.ajax({
|
|
url: 'delete_history_rows',
|
|
type: 'POST',
|
|
data: { row_ids: history_to_delete.join(',') },
|
|
async: true,
|
|
success: function (data) {
|
|
var msg = "History deleted";
|
|
showMsg(msg, false, true, 2000);
|
|
history_table.draw();
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
$('.delete-control').each(function () {
|
|
$(this).addClass('hidden');
|
|
$('#row-edit-mode-alert').fadeOut(200);
|
|
});
|
|
|
|
} else {
|
|
history_to_delete = [];
|
|
$('.delete-control').each(function() {
|
|
$(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger');
|
|
$(this).removeClass('hidden');
|
|
});
|
|
}
|
|
});
|
|
% endif
|
|
|
|
function recentlyWatched() {
|
|
// Populate recently watched
|
|
$.ajax({
|
|
url: 'library_recently_watched',
|
|
async: true,
|
|
data: {
|
|
section_id: section_id,
|
|
limit: 50
|
|
},
|
|
complete: function(xhr, status) {
|
|
$("#library-recently-watched").html(xhr.responseText);
|
|
highlightWatchedScrollerButton();
|
|
}
|
|
});
|
|
}
|
|
|
|
function recentlyAdded() {
|
|
// Populate recently added
|
|
$.ajax({
|
|
url: 'library_recently_added',
|
|
async: true,
|
|
data: {
|
|
section_id: section_id,
|
|
limit: 50
|
|
},
|
|
complete: function(xhr, status) {
|
|
$("#library-recently-added").html(xhr.responseText);
|
|
highlightAddedScrollerButton();
|
|
}
|
|
});
|
|
}
|
|
|
|
recentlyWatched();
|
|
% if data['section_id'] != LIVE_TV_SECTION_ID:
|
|
recentlyAdded();
|
|
% endif
|
|
|
|
function highlightWatchedScrollerButton() {
|
|
var scroller = $("#recently-watched-row-scroller");
|
|
var numElems = scroller.find("li").length;
|
|
scroller.width(numElems * 175);
|
|
if (scroller.width() > $("#library-recently-watched").width()) {
|
|
$("#recently-watched-page-right").removeClass("disabled");
|
|
} else {
|
|
$("#recently-watched-page-right").addClass("disabled");
|
|
}
|
|
}
|
|
|
|
function highlightAddedScrollerButton() {
|
|
var scroller = $("#recently-added-row-scroller");
|
|
var numElems = scroller.find("li").length;
|
|
scroller.width(numElems * 175);
|
|
if (scroller.width() > $("#library-recently-added").width()) {
|
|
$("#recently-added-page-right").removeClass("disabled");
|
|
} else {
|
|
$("#recently-added-page-right").addClass("disabled");
|
|
}
|
|
}
|
|
|
|
$(window).resize(function() {
|
|
highlightWatchedScrollerButton();
|
|
highlightAddedScrollerButton();
|
|
});
|
|
|
|
$('div.art-face').animate({ opacity: 0.2 }, { duration: 1000 });
|
|
|
|
var leftTotalWatched = 0;
|
|
$(".paginate-watched").click(function (e) {
|
|
e.preventDefault();
|
|
var scroller = $("#recently-watched-row-scroller");
|
|
var containerWidth = $("#library-recently-watched").width();
|
|
var scrollAmount = $(this).data("id") * parseInt(containerWidth / 175) * 175;
|
|
var leftMax = Math.min(-parseInt(scroller.width()) + Math.abs(scrollAmount), 0);
|
|
|
|
leftTotalWatched = Math.max(Math.min(leftTotalWatched + scrollAmount, 0), leftMax);
|
|
scroller.animate({ left: leftTotalWatched }, 250);
|
|
|
|
if (leftTotalWatched == 0) {
|
|
$("#recently-watched-page-left").addClass("disabled").blur();
|
|
} else {
|
|
$("#recently-watched-page-left").removeClass("disabled");
|
|
}
|
|
|
|
if (leftTotalWatched == leftMax) {
|
|
$("#recently-watched-page-right").addClass("disabled").blur();
|
|
} else {
|
|
$("#recently-watched-page-right").removeClass("disabled");
|
|
}
|
|
});
|
|
|
|
var leftTotalAdded = 0;
|
|
$(".paginate-added").click(function (e) {
|
|
e.preventDefault();
|
|
var scroller = $("#recently-added-row-scroller");
|
|
var containerWidth = $("#library-recently-added").width();
|
|
var scrollAmount = $(this).data("id") * parseInt(containerWidth / 175) * 175;
|
|
var leftMax = Math.min(-parseInt(scroller.width()) + Math.abs(scrollAmount), 0);
|
|
|
|
leftTotalAdded = Math.max(Math.min(leftTotalAdded + scrollAmount, 0), leftMax);
|
|
scroller.animate({ left: leftTotalAdded }, 250);
|
|
|
|
if (leftTotalAdded == 0) {
|
|
$("#recently-added-page-left").addClass("disabled").blur();
|
|
} else {
|
|
$("#recently-added-page-left").removeClass("disabled");
|
|
}
|
|
|
|
if (leftTotalAdded == leftMax) {
|
|
$("#recently-added-page-right").addClass("disabled").blur();
|
|
} else {
|
|
$("#recently-added-page-right").removeClass("disabled");
|
|
}
|
|
});
|
|
|
|
$(document).ready(function () {
|
|
|
|
// Javascript to enable link to tab
|
|
var hash = document.location.hash;
|
|
var prefix = "tab_";
|
|
if (hash) {
|
|
$('.user-info-nav a[href='+hash.replace(prefix,"")+']').tab('show').trigger('show.bs.tab');
|
|
}
|
|
|
|
// Change hash for page-reload
|
|
$('.user-info-nav a').on('shown.bs.tab', function (e) {
|
|
window.location.hash = e.target.hash.replace("#", "#" + prefix);
|
|
});
|
|
|
|
// Populate watch time stats
|
|
$.ajax({
|
|
url: 'library_watch_time_stats',
|
|
async: true,
|
|
data: { section_id: section_id },
|
|
complete: function(xhr, status) {
|
|
$("#library-time-stats").html(xhr.responseText);
|
|
}
|
|
});
|
|
|
|
// Populate user stats
|
|
$.ajax({
|
|
url: 'library_user_stats',
|
|
async: true,
|
|
data: { section_id: section_id },
|
|
complete: function(xhr, status) {
|
|
$("#library-user-stats").html(xhr.responseText);
|
|
}
|
|
});
|
|
|
|
});
|
|
</script>
|
|
% endif
|
|
</%def> |