﻿$(document).ready(function() {
	/*setInterval(function() {
		updateIndexCount()
	}, 10000);*/
});

function uploadCheck() {
	alert('请先登录');
	return false;
}

function loginCheck() {
	alert('登录失败');
	return false;
}

// 首页即时统计
function updateIndexCount() {
	$('#fileCount').load('/Include/fileCount.txt?'+new Date().getTime());
	$.get('/Include/fileSizeCount.txt?'+new Date().getTime(), function(result) {
		var size = parseInt(result);
		$('#fileSizeCount').html(formatFileSize(size));
	});
}

function formatFileSize(filesize) {
	filesize = parseInt(filesize);
	if (filesize > 1024*1024*1024) return (filesize/1024/1024/1024).toFormatString(3, 2) + ' TB';
	if (filesize > 1024*1024) return (filesize/1024/1024).toFormatString(3, 2) + ' GB';
	if (filesize > 1024) return (filesize/1024).toFormatString(3, 2) + ' MB';
	return filesize.toFormatString(3, 2) + ' KB';
}