2020-08-20 04:42:35 +08:00
|
|
|
function thumbnail_onmouseover(event) {
|
|
|
|
var img = event.target;
|
|
|
|
img.src = '';
|
|
|
|
img.src = img.getAttribute('full_img_src');
|
|
|
|
}
|
|
|
|
|
|
|
|
function thumbnail_onmouseout(event) {
|
|
|
|
var img = event.target;
|
|
|
|
img.src = '';
|
|
|
|
img.src = img.getAttribute('img_src');
|
|
|
|
}
|
|
|
|
|
|
|
|
function initThumbAnimation() {
|
|
|
|
$j('.colThumbnail img').each(function() {
|
|
|
|
this.addEventListener('mouseover', thumbnail_onmouseover, false);
|
|
|
|
this.addEventListener('mouseout', thumbnail_onmouseout, false);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-08-20 22:13:11 +08:00
|
|
|
function processClicks(event, field, value, row, $element) {
|
|
|
|
if ( field == 'FramesScore' ) {
|
2020-08-25 01:05:31 +08:00
|
|
|
window.location.assign('?view=stats&eid='+row.EventId+'&fid='+row.FramesId);
|
2020-08-20 22:13:11 +08:00
|
|
|
} else {
|
|
|
|
window.location.assign('?view=frame&eid='+row.EventId+'&fid='+row.FramesId);
|
|
|
|
}
|
2020-08-20 06:54:39 +08:00
|
|
|
}
|
|
|
|
|
2020-08-23 01:45:19 +08:00
|
|
|
function detailFormatter(index, row, element) {
|
|
|
|
return $j(element).html($j('#contentStatsTable'+index).clone(true).show());
|
|
|
|
}
|
|
|
|
|
2020-08-20 01:04:08 +08:00
|
|
|
function initPage() {
|
|
|
|
var backBtn = $j('#backBtn');
|
|
|
|
var table = $j('#framesTable');
|
|
|
|
|
|
|
|
// Define the icons used in the bootstrap-table top-right toolbar
|
|
|
|
var icons = {
|
|
|
|
paginationSwitchDown: 'fa-caret-square-o-down',
|
|
|
|
paginationSwitchUp: 'fa-caret-square-o-up',
|
2020-08-21 20:11:57 +08:00
|
|
|
export: 'fa-download',
|
2020-08-20 01:04:08 +08:00
|
|
|
refresh: 'fa-sync',
|
|
|
|
toggleOff: 'fa-toggle-off',
|
|
|
|
toggleOn: 'fa-toggle-on',
|
|
|
|
columns: 'fa-th-list',
|
|
|
|
fullscreen: 'fa-arrows-alt',
|
|
|
|
detailOpen: 'fa-plus',
|
|
|
|
detailClose: 'fa-minus'
|
|
|
|
};
|
|
|
|
|
|
|
|
// Init the bootstrap-table
|
|
|
|
table.bootstrapTable('destroy').bootstrapTable({icons: icons});
|
|
|
|
|
2020-08-20 06:54:39 +08:00
|
|
|
// Hide these columns on first run when no cookie is saved
|
|
|
|
if ( !getCookie("zmFramesTable.bs.table.columns") ) {
|
2020-09-10 23:04:18 +08:00
|
|
|
table.bootstrapTable('hideColumn', 'EventId');
|
2020-08-20 06:54:39 +08:00
|
|
|
}
|
|
|
|
|
2020-08-23 01:45:19 +08:00
|
|
|
// Hide the stats tables on init
|
|
|
|
$j(".contentStatsTable").hide();
|
|
|
|
|
2020-08-20 04:42:35 +08:00
|
|
|
// Disable the back button if there is nothing to go back to
|
2020-08-20 01:04:08 +08:00
|
|
|
backBtn.prop('disabled', !document.referrer.length);
|
2020-08-20 03:07:00 +08:00
|
|
|
|
2020-08-20 04:42:35 +08:00
|
|
|
// Setup the thumbnail animation
|
|
|
|
initThumbAnimation();
|
|
|
|
|
2020-08-20 05:16:27 +08:00
|
|
|
// Some toolbar events break the thumbnail animation, so re-init eventlistener
|
|
|
|
table.on('all.bs.table', initThumbAnimation);
|
|
|
|
|
2020-08-20 06:54:39 +08:00
|
|
|
// Load the associated frame image when the user clicks on a row
|
2020-08-20 22:13:11 +08:00
|
|
|
table.on('click-cell.bs.table', processClicks);
|
2020-08-20 06:54:39 +08:00
|
|
|
|
2020-08-20 01:04:08 +08:00
|
|
|
// Manage the BACK button
|
|
|
|
document.getElementById("backBtn").addEventListener("click", function onBackClick(evt) {
|
|
|
|
evt.preventDefault();
|
|
|
|
window.history.back();
|
|
|
|
});
|
|
|
|
// Manage the REFRESH Button
|
|
|
|
document.getElementById("refreshBtn").addEventListener("click", function onRefreshClick(evt) {
|
|
|
|
evt.preventDefault();
|
|
|
|
window.location.reload(true);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$j(document).ready(function() {
|
|
|
|
initPage();
|
|
|
|
});
|