|
|
@ -6,7 +6,7 @@ |
|
|
|
var config = { |
|
|
|
var config = { |
|
|
|
fileTypes: "txt|epub|umd", //允许上传的文件格式 "txt|epub" // |doc|docx|wps|xls|xlsx|et|ppt|pptx|dps
|
|
|
|
fileTypes: "txt|epub|umd", //允许上传的文件格式 "txt|epub" // |doc|docx|wps|xls|xlsx|et|ppt|pptx|dps
|
|
|
|
//url : "http://"+location.host+"?action=addBook",//"http://localhost/t/post.php",//
|
|
|
|
//url : "http://"+location.host+"?action=addBook",//"http://localhost/t/post.php",//
|
|
|
|
url: "http://192.168.1.16:1122/addLocalBook", |
|
|
|
url: "../addLocalBook", |
|
|
|
fileLimitSize: 500 * 1024 * 1024 |
|
|
|
fileLimitSize: 500 * 1024 * 1024 |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -41,8 +41,7 @@ $.ajax({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
//统计文件大小
|
|
|
|
//统计文件大小
|
|
|
|
function countFileSize(fileSize) |
|
|
|
function countFileSize(fileSize) { |
|
|
|
{ |
|
|
|
|
|
|
|
var KB = 1024; |
|
|
|
var KB = 1024; |
|
|
|
var MB = 1024 * 1024; |
|
|
|
var MB = 1024 * 1024; |
|
|
|
if (KB >= fileSize) { |
|
|
|
if (KB >= fileSize) { |
|
|
@ -55,8 +54,7 @@ function countFileSize(fileSize) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//如果文件太长进行截取
|
|
|
|
//如果文件太长进行截取
|
|
|
|
function substr_string(name) |
|
|
|
function substr_string(name) { |
|
|
|
{ |
|
|
|
|
|
|
|
var maxLen = 15; |
|
|
|
var maxLen = 15; |
|
|
|
var len = name.length; |
|
|
|
var len = name.length; |
|
|
|
if (len < 17) return name; |
|
|
|
if (len < 17) return name; |
|
|
@ -101,13 +99,11 @@ function checkFile(file) { |
|
|
|
* @param object file 文件对象 |
|
|
|
* @param object file 文件对象 |
|
|
|
* @param int type 0 是swf 上传的,1 是html5上传的 |
|
|
|
* @param int type 0 是swf 上传的,1 是html5上传的 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function fileQueued(file, type) |
|
|
|
function fileQueued(file, type) { |
|
|
|
{ |
|
|
|
|
|
|
|
var size = 0, fid = file.id, name = ""; |
|
|
|
var size = 0, fid = file.id, name = ""; |
|
|
|
type = type || 0; |
|
|
|
type = type || 0; |
|
|
|
|
|
|
|
|
|
|
|
if(file != undefined ) |
|
|
|
if (file != undefined) { |
|
|
|
{ |
|
|
|
|
|
|
|
//计算文件大小 单位MB
|
|
|
|
//计算文件大小 单位MB
|
|
|
|
size = countFileSize(file.size); |
|
|
|
size = countFileSize(file.size); |
|
|
|
name = substr_string(file.name) |
|
|
|
name = substr_string(file.name) |
|
|
@ -137,8 +133,7 @@ function fileQueued(file, type) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function changeTrBackGroundColor() |
|
|
|
function changeTrBackGroundColor() { |
|
|
|
{ |
|
|
|
|
|
|
|
var getTr = document.getElementById("tableStyle").getElementsByTagName("dl"); |
|
|
|
var getTr = document.getElementById("tableStyle").getElementsByTagName("dl"); |
|
|
|
trNum = getTr.length; |
|
|
|
trNum = getTr.length; |
|
|
|
for (var i = 0; i < trNum; i++) { |
|
|
|
for (var i = 0; i < trNum; i++) { |
|
|
@ -151,8 +146,7 @@ function changeTrBackGroundColor() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//上传时返回的状态
|
|
|
|
//上传时返回的状态
|
|
|
|
function uploadProgress(file, bytesLoaded, bytesTotal)
|
|
|
|
function uploadProgress(file, bytesLoaded, bytesTotal) { |
|
|
|
{ |
|
|
|
|
|
|
|
if (!$("#progress_bar_p_" + file.id).hasClass("orange")) { |
|
|
|
if (!$("#progress_bar_p_" + file.id).hasClass("orange")) { |
|
|
|
$("#progress_bar_p_" + file.id).addClass("orange"); |
|
|
|
$("#progress_bar_p_" + file.id).addClass("orange"); |
|
|
|
} |
|
|
|
} |
|
|
@ -163,16 +157,14 @@ function uploadProgress(file, bytesLoaded, bytesTotal) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//上传成功
|
|
|
|
//上传成功
|
|
|
|
function uploadSuccess(file, serverData, res) |
|
|
|
function uploadSuccess(file, serverData, res) { |
|
|
|
{ |
|
|
|
|
|
|
|
var id = "handle_button_" + file.id; |
|
|
|
var id = "handle_button_" + file.id; |
|
|
|
$("#" + id).replaceWith("<dd>" + jsonLang.t10 + "</dd>") |
|
|
|
$("#" + id).replaceWith("<dd>" + jsonLang.t10 + "</dd>") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//取消上传
|
|
|
|
//取消上传
|
|
|
|
function userCancelUpload(file_id, type) |
|
|
|
function userCancelUpload(file_id, type) { |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type == 0) { |
|
|
|
if (type == 0) { |
|
|
|
SWFFuns.cancelUpload(file_id); |
|
|
|
SWFFuns.cancelUpload(file_id); |
|
|
|