')); $('body').fadeOut(100, function() { $('body').html(htmlContent); $('body').fadeIn(100); if (totalPages > 1) { startLoader(reloadInterval); $('#title').html($('#title').html() + ' (' + (currentPage + 1) + '/' + totalPages + ')'); // restart the loader startLoader(reloadInterval); setCurrentDateTime(false); setTimeout(function() { reloadContent(); }, reloadInterval); } else { // restart the loader startLoader(reloadInterval); setCurrentDateTime(false); setTimeout(function() { reloadContent(); }, reloadInterval); } }); }); } /** * Set the Current Date/Time and repeat this every second */ function setCurrentDateTime(reload) { $('currentdate').html(moment().format('DD/MM/YYYY')); $('currenttime').html(moment().format('HH:mm')); if (reload) { setTimeout(function() { setCurrentDateTime(true); }, 1000); } } /** * start the loader indicator for a certain amount of time */ function startLoader(totalTime) { NProgress.configure({ showSpinner: false, easing: 'linear', speed: totalTime - 200 }); NProgress.start(); NProgress.set(0.08); setTimeout(function() { NProgress.set(1); }, 5); } /** * Start the content reload + the current date/time */ $(function() { moment.locale('ja'); setCurrentDateTime(true); reloadInterval = (totalPages > 1) ? reloadIntervalPaging : reloadIntervalFullRefresh; if (totalPages > 1) { $('#title').html($('#title').html() + ' (' + (currentPage + 1) + '/' + totalPages + ')'); startLoader(reloadInterval); } setTimeout(function() { reloadContent(); }, reloadInterval); });
|