var date_format = 'YYYY-MM-DD'; var time_format = 'hh:mm a'; $.ajax({ url: 'get_date_formats', type: 'GET', success: function(data) { date_format = data.date_format; time_format = data.time_format; } }); history_table_modal_options = { "destroy": true, "language": { "search": "Search: ", "info":"Showing _START_ to _END_ of _TOTAL_ history items", "infoEmpty":"Showing 0 to 0 of 0 entries", "infoFiltered":"", "emptyTable": "No data in table", }, "pagingType": "bootstrap", "stateSave": false, "processing": false, "serverSide": true, "pageLength": 10, "lengthChange": false, "order": [ 0, 'desc'], "columnDefs": [ { "targets": [0], "data":"started", "createdCell": function (td, cellData, rowData, row, col) { if (cellData === null) { $(td).html('Unknown'); } else { $(td).html(moment(cellData,"X").format(time_format)); } }, "searchable": false, "className": "no-wrap", "width": "5%" }, { "targets": [1], "data":"stopped", "createdCell": function (td, cellData, rowData, row, col) { if (cellData === null) { $(td).html('Unknown'); } else { $(td).html(moment(cellData,"X").format(time_format)); } }, "searchable": false, "className": "no-wrap", "width": "5%" }, { "targets": [2], "data":"friendly_name", "createdCell": function (td, cellData, rowData, row, col) { if (cellData !== '') { if (rowData['user_id']) { $(td).html('' + cellData + ''); } else { $(td).html('' + cellData + ''); } } else { $(td).html(cellData); } }, "className": "no-wrap hidden-xs" }, { "targets": [3], "data":"player", "createdCell": function (td, cellData, rowData, row, col) { if (cellData !== '') { var transcode_dec = ''; if (rowData['video_decision'] === 'transcode') { transcode_dec = ''; } else if (rowData['video_decision'] === 'copy') { transcode_dec = ''; } else if (rowData['video_decision'] === 'direct play' || rowData['video_decision'] === '') { transcode_dec = ''; } $(td).html('
' + transcode_dec + ' ' + cellData + '
'); } }, "className": "no-wrap hidden-sm hidden-xs modal-control" }, { "targets": [4], "data":"full_title", "createdCell": function (td, cellData, rowData, row, col) { if (cellData !== '') { var media_type = ''; var thumb_popover = ''; if (rowData['media_type'] === 'movie') { media_type = ''; thumb_popover = '' + cellData + ' (' + rowData['year'] + ')' $(td).html('
' + media_type + ' ' + thumb_popover + '
'); } else if (rowData['media_type'] === 'episode') { media_type = ''; thumb_popover = '' + cellData + ' \ (S' + rowData['parent_media_index'] + '· E' + rowData['media_index'] + ')' $(td).html('
' + media_type + ' ' + thumb_popover + '
'); } else if (rowData['media_type'] === 'track') { media_type = ''; thumb_popover = '' + cellData + ' (' + rowData['parent_title'] + ')' $(td).html('
' + media_type + ' ' + thumb_popover + '
'); } else { $(td).html('' + cellData + ''); } } } } ], "drawCallback": function (settings) { // Jump to top of page // $('html,body').scrollTop(0); $('#ajaxMsg').fadeOut(); // Create the tooltips. $('.transcode-tooltip').tooltip(); $('.media-type-tooltip').tooltip(); $('.thumb-tooltip').popover({ html: true, trigger: 'hover', placement: 'right', content: function () { return '
'; } }); }, "preDrawCallback": function(settings) { var msg = " Fetching rows..."; showMsg(msg, false, false, 0) } } $('#history_table').on('click', 'td.modal-control', function () { var tr = $(this).parents('tr'); var row = history_table.row(tr); var rowData = row.data(); function showStreamDetails() { $.ajax({ url: 'get_stream_data', data: { row_id: rowData['id'], user: rowData['friendly_name'] }, cache: false, async: true, complete: function (xhr, status) { $("#info-modal").html(xhr.responseText); } }); } showStreamDetails(); });