123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459 |
-
- Namespace.register("U.UP");
- U.UP.FTF = {};
- U.UP.FTF.EL;
- U.UP.uploading = function (UDE, UCB, UCT, UAC, UTF, UTP) {
- if (UDE.length > 0) {
- var _UDBD = document.body,
- _UFID = Guid.guidNoDash();
-
- U.M.IFO($$("iframe", { "id": _UFID, "name": _UFID, "width": 0, "height": 0, "style": { "display": "none" },
- "frameBorder": 0
- }, _UDBD), "", [[U.UP.uploadingA, [UDE, UCB, UCT, UAC, UTF, _UFID, UTP]]]);
- }
- }
- U.UP.uploadingA = function (UDE, UCB, UCT, UAC, UTF, UFID, UTP) {
- this.contentWindow.name = UFID;
- UDE = U.Ut.isArray(UDE) ? UDE : Array.prototype.slice.apply(UDE);
- UAC = UAC + (UAC.indexOf("?") > -1 ? "" : "?") + ((US && US.userInfo && US.userInfo.userid) || US.userInfo.userid ? "&UserId=" + (US.userInfo.userid || US.userInfo.userid) : "");
- var i = 0,
- _UL = UDE.length,
- _UCE = [],
- _UCB = UCB,
- _UDBD = document.body,
- _URE = { "UpObj": UDE, "context": UCT, "value": "" },
- _UDFD = $$("form", { "action": UAC, "target": UFID, "encoding": UTP ? UTP : "multipart/form-data",
- "enctype": UTP ? UTP : "multipart/form-data", "method": "post", "name": "loading", "style": { "display": "none" }
- }, _UDBD);
-
- (UTF) && (_UL = 1, _URE["UpObj"] = UDE.splice(0, 1), _UCB = U.M.apply(this, [[UCB, [_URE]], [U.UP.uploading, [UDE, UCB, UCT, UAC, UTF]]])); UDE = _URE["UpObj"];
-
- for (i; i < _UL; i++) {
- UDE[i].name = UDE[i].name || UDE[i].id || Guid.newGuid();
- _UCE.push($(UDE[i]).replaceC($$("div"))[0]);
- _UDFD.appendChild(UDE[i]);
- }
-
- _UDFD.submit();
- this.complete = "";
-
- U.MD.IframeLoad(this, [[U.UP.uploadingAsynF, [this, _UCB, _URE]]]);
- $(_UDFD).remove();
-
- for (i = 0; i < _UL; i++) {
- $(_UCE[i]).replaceC(UDE[i]);
- };
-
- }
- U.UP.uploadingAsynF = function (UDOD, UCB, UDE) {
- try {
- (!browser.msie) && (UDOD.src = "about:blank");
- setTimeout(function () {
- try { var _UTH = UDOD.contentWindow.document.body.innerHTML; } catch (e) { }
- try { _UTH = _UTH || (UDOD.contentWindow.name != UDOD.id ? UDOD.contentWindow.name : _UTH); } catch (e) { }
-
- if (_UTH == null) { U.Alert("服务器处理繁忙,上传失败"); }
-
- try { UDE.value = eval("0,(" + _UTH + ")"); }
- catch (e) { UDE.value = _UTH; }
- $(UDOD).remove();
-
- if (UCB) { UCB(UDE); }
- }, 0);
- }
- catch (e) { }
- }
- U.UP.AddFAN = function (UDOD, UDID, UWH) {
- UDID = UDID || Guid.newGuid();
- if ($("object", UDOD).length == 0) {
- _UDTD = $$("div", { "innerHTML": '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" class="UD_filePrew" width="' + UWH["width"] + '" height="' + UWH["height"] + '" id="' + UDID + '" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0"><param name="movie" value="/img/upload.swf" /><param name="menu" value="false" /><param name="wmode" value="Opaque" /><param name="quality" value="high" /><param name="bgcolor" value="ffffff" /><param name="allowScriptAccess" value="always" /><embed src="/img/upload.swf" quality="high" bgcolor="ffffff" width="' + UWH["width"] + '" height="' + UWH["height"] + '" name="' + UDID + '" align="middle" play="true" wmode="transparent" loop="false" quality="high" style="z-index: 0;" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object>' });
- UDOD.insertBefore(_UDTD.firstChild, UDOD.firstChild);
- }
- U.UP.FTF[UDID] = {};
- U.UP.FTF.EL = $("*" + UDID, UDOD).addAttrArray({ "width": UWH["width"] ? UWH["width"] : 1,
- "height": UWH["height"] ? UWH["height"] : 1, "style": { "display": "block" }
- })[0];
- U.UP.FTF[UDID]["EL"] = U.UP.FTF.EL;
- return U.UP.FTF.EL;
-
- }
- U.UP.FAFZ = function (UWH, UTE, UDE) {
- var _UCE = U.UP.FTF,
- _UDOD = _UCE["EL"],
- _UDID = _UDOD.id || _UDOD.name;
- _UCE[_UDID].WH = UWH;
- _UCE[_UDID].FT = UTE;
- _UCE[_UDID].GS = UDE || "*";
-
- if (_UDOD && _UDOD.SetStage) {
- if (!U.UP.FOnload()) {
- return false;
- }
- return true;
- }
- return false;
-
- }
- U.UP.FOnload = function () {
- try {
- var _UDE = U.UP.FTF;
- _UDE["EL"].SetStage(_UDE["WH"], _UDE["FT"], _UDE["GS"] || "*");
- return true;
- }
- catch (e) {
- return false;
- }
- }
- U.UP.FLEX = function (err) {
- U.Alert(err);
- U.M.Console(err);
- }
- U.UP.FLAdd = function (UDE, UL) {
- var _UDOD = U.UP.FTF.EL,
- _UDID = _UDOD.ID || _UDOD.name;
- if (U.UP.FTF[_UDID] && U.UP.FTF[_UDID].FT && U.UP.FTF[_UDID].FT["ADD"]) {
- U.UP.FTF[_UDID].FT["ADD"](UDE, UL);
- }
- }
- U.UP.FLACP = function (UFL) {
- var _UDOD = U.UP.FTF.EL,
- _UDID = _UDOD.ID || _UDOD.name;
- if (U.UP.FTF[_UDID] && U.UP.FTF[_UDID].FT && U.UP.FTF[_UDID].FT["AFCP"]) {
- U.UP.FTF[_UDID].FT["AFCP"](UFL);
- }
- }
- U.UP.FLJD = function (UDE, FID) {
- var _UDOD = U.UP.FTF.EL,
- _UDID = _UDOD.ID || _UDOD.name;
- if (U.UP.FTF[_UDID] && U.UP.FTF[_UDID].FT && U.UP.FTF[_UDID].FT["JDT"]) {
- U.UP.FTF[_UDID].FT["JDT"](UDE, FID);
- }
- }
- U.UP.FSLCP = function (UDAT, FID) {
- var _UDOD = U.UP.FTF.EL,
- _UDID = _UDOD.ID || _UDOD.name;
- if (U.UP.FTF[_UDID] && U.UP.FTF[_UDID].FT && U.UP.FTF[_UDID].FT["FCP"]) {
- U.UP.FTF[_UDID].FT["FCP"](UDAT, FID);
- }
- }
- U.UP.IsFUp = function (UWJL, FID) {
- var _UDOD = U.UP.FTF.EL,
- _UDID = _UDOD.ID || _UDOD.name;
- if (U.UP.FTF[_UDID] && U.UP.FTF[_UDID].FT && U.UP.FTF[_UDID].FT["FUP"]) {
- U.UP.FTF[_UDID].FT["FUP"](UWJL, FID);
- }
- }
- U.UP.FLCP = function (data) {
- U.Alert("等待服务器的响应...");
- }
- U.UP.FileDL = function (UFN, USN, UTF) {
- var _userid = US.userInfo.userid,
- _UIE = _userid ? _userid : U.M.GetCookie("usestudiosso", "userid") || [];
- if (_userid || _UIE[0]) {
- (!_userid) && (US.userInfo.userid = _UIE[0]);
- U.UP.uploading([$$("input", { "type": "text", "value": UFN, "name": "filename" }), $$("input", { "type": "text", "value": USN, "name": "filepath" })],
- null, null, "http://main.1473.cn/USupfile.ashx?iframename=" + (UTF || "UploadFile"), false);
- }
- else {
- if (window.location.href.indexOf("www.1473.cn")) {
- try {
- U.U.L.DLTC(3);
- }
- catch (e) {
- U.Alert("请在云端登录");
- }
- }
- else {
- U.UI.Confirm("是否跳转到云端进行下载", function () {
- window.location.href = "";
- })
- }
- }
- }
- U.UP.FileGS = function (UFID, UTP) {
- U.UP.uploading([$$("input", { "type": "text", "value": UFID, "name": "id" }),
- $$("input", { "type": "text", "value": UTP, "name": "type" })], null, null, "http://main.1473.cn/USupfile.ashx?iframename=DownType", false);
- }
- U.UP.FFT = function (UTF) {
- UTF = UTF.toLowerCase();
- var i, _UKE,
- _UDE = ["folder", "folderencrypt", "png,jpg,bmp,gif", "doc,docx,uw", "xls,xlsx,ue", "ppt,pptx", "txt", "wmv,video", "mp3", "rar,zip"],
- _UAE = [["文件夹", "-6px -41px", "-169px -5px"], ["文件夹", "-659px -42px", "-736px -77px"],
- ["图片文件", "-593px -402px", "-61px -5px"], ["Word文档", "-155px -41px", "-511px -198px", "-477px -10px", "-65px -420px"],
- ["Excel文档", "-297px -41px", "-584px -198px;", "-325px -10px", "-290px -50px", "-120px -420px"],
- ["PPT幻灯片", "-227px -41px", "-548px -198px", "-220px -420px"], ["Txt文本文档", "-84px -41px", "-477px -198px", "-170px -420px"],
- ["视频文件", "-503px -41px", "-760px -42px"], ["Mp3音乐文件", "-438px -41px", "-734px -43px", "-15px -420px", "-175px -10px"],
- ["Rar压缩文件", "-368px -41px", "-619px -199px", "-270px -420px"]];
-
- for (i = 0; i < _UDE.length; i++) {
- if (_UDE[i].split(",").indexOf(UTF) > -1) { _UKE = _UAE[i]; break; }
- };
-
- (!_UKE) && (_UKE = ["系统文件", "-575px -41px", "-478px -230px", "-320px -420px"]);
-
- for (i = 1; i < _UKE.length; i++) {
- _UKE[i] = "background-position:" + _UKE[i] + ";"
- };
- return _UKE;
- }
- U.UP.Down = function (UN, UCT) {
- if ("createElementNS" in document) {
- (!UCT) && (UCT = document.documentElement.outerHTML);
- var _UDAD,
- _UWE = window.URL || window.webkitURL || window,
- _UDE = new Blob[UCT];
- _UDAD = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
- _UDAD.href = _UWE.createObjectURL(_UDE);
- _UDAD.download = UN; U.M.IEVENT(_UDAD, "click");
- }
- else {
- if (UCT) {
- var _UDOD = $$("iframe", { "display": "none" });
- U.M.IFO(_UDOD, UCT, function () { _UDOD.contextWindow.document.execCommand("SaveAs"); });
- }
- else { document.execCommand("SaveAs"); }
- }
- }
- U.UP.GetUpName = function (UEHL) {
- UEHL = (UEHL.value || UEHL).toLocaleLowerCase();
- var _UI = UEHL.lastIndexOf(".");
- return [UEHL.substr(UEHL.lastIndexOf('\\') + 1, _UI), UEHL.substr(_UI + 1)];
- }
- U.UP.IsImg = function (UFN) {
- var _UTF = false,
- _UE = U.UP.GetUpName(UFN)[1].toLowerCase(),
- _UIF = "jpg,gif,png,bmp,jpeg,JPG,GIF,BMP,PNG,JPEG";
- (_UE && _UIF.indexOf(_UE) > -1) && (_UTF = true);
- return _UTF;
- }
- U.UP.IsSizeS = function (UFO, UFT) {
- return (UFO > UFT);
- }
- U.UP.FileSize = function (UIS) {
- UIS = UIS || 0;
- var _UDW = (UIS + "").replace(U.MS.Num, ""),
- _UDE = ["B", "KB", "M", "G", "TB"],
- i = _UDE.indexOf(_UDW);
-
- i = i == -1 ? 0 : i; UIS = parseInt(UIS);
- while (UIS > 1024) {
- UIS /= 1024; i++;
- };
-
- return UIS.toFixed(2) + _UDE[i];
- }
- U.UP.GetSfileS = function (UIS) {
- var i = 0, _UDE = ["B", "KB", "M", "G", "TB"],
- _UDW = (UIS + "").replace(U.MS.Num, ""),
- _UIE = _UDE.indexOf(_UDW, null, true);
- return parseFloat(UIS) * Math.pow(1024, _UIE);
- }
|