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) {
|
2020-09-10 23:10:19 +08:00
|
|
|
if ( field == 'FrameScore' ) {
|
|
|
|
window.location.assign('?view=stats&eid='+row.EventId+'&fid='+row.FrameId);
|
2020-08-20 22:13:11 +08:00
|
|
|
} else {
|
2020-09-10 23:10:19 +08:00
|
|
|
window.location.assign('?view=frame&eid='+row.EventId+'&fid='+row.FrameId);
|
2020-08-20 22:13:11 +08:00
|
|
|
}
|
2020-08-20 06:54:39 +08:00
|
|
|
}
|
|
|
|
|
2020-09-13 20:32:49 +08:00
|
|
|
// This function handles when the user clicks a "+" link to retrieve stats for a frame
|
|
|
|
function detailFormatter(index, row, $detail) {
|
|
|
|
$detail.html('Please wait. Loading from ajax request...');
|
|
|
|
$j.get(thisUrl + '?request=stats&eid=' + row.EventId + '&fid=' + row.FrameId + '&row=' + index)
|
2020-09-13 21:33:47 +08:00
|
|
|
.done(function(data) {
|
2020-09-13 21:52:52 +08:00
|
|
|
$detail.html(data.html);
|
2020-09-13 21:33:47 +08:00
|
|
|
})
|
2020-09-20 21:41:16 +08:00
|
|
|
.fail(logAjaxFail);
|
2020-08-23 01:45:19 +08:00
|
|
|
}
|
2020-08-20 01:04:08 +08:00
|
|
|
function initPage() {
|
|
|
|
var backBtn = $j('#backBtn');
|
|
|
|
var table = $j('#framesTable');
|
|
|
|
|
|
|
|
// Init the bootstrap-table
|
2020-09-24 03:32:40 +08:00
|
|
|
table.bootstrapTable({icons: icons});
|
2020-08-20 01:04:08 +08:00
|
|
|
|
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();
|
|
|
|
});
|