Edit D:\AVAWeike\AVAWeike\AVA.ResourcesPlatform.AdminUI\JS\zh-CN\Global.js
??unction getOs() { var OsObject = ""; if (navigator.userAgent.indexOf("MSIE") > 0) { return "MSIE"; } if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) { return "Firefox"; } if (isSafari = navigator.userAgent.indexOf("Safari") > 0) { return "Safari"; } if (isCamino = navigator.userAgent.indexOf("Camino") > 0) { return "Camino"; } if (isMozilla = navigator.userAgent.indexOf("Gecko/") > 0) { return "Gecko"; } } //??????????? window.onerror = function (msg, url, line) { //??????????????msg????????6????? //alert(msg.substring(msg.length - 6).length); //alert(msg+msg.length); if (msg == "Global_Define_Error" || msg == "error" || msg.indexOf("Stack overflow at line") != -1) { return true; } else { try { console.warn("error:" + msg + "," + url + "," + line); } catch (ex) { } return false; var OsObject = getOs(); if (OsObject == "MSIE" || OsObject == "Firefox") { //alert("error:" + msg + "," + url + "," + line); } else { return true; } } }; // //??????????? // var Global = new Object(); // Global.Animation = new Object(); // /******************************************* // * ??????????????? // *******************************************/ // // //?????? // Global.Virtual = ""; //??????????????????????????????????????"/web" // Global.RootDomain = "" //?????????????????ookie?? // //??????Cookie // Global.Animation.Small = ""; // //????????? // Global.Site = ""; //??????????? ?????? //???JavaScript??? Global.Stop = function () { throw new Error("Global_Define_Error"); } //?????????????? Global.Error = function (msg) { //???????????????????? if (msg == null) { return; } var lenindex = msg.indexOf("^$#$^"); if (lenindex != -1) { var message = msg.substring(0, lenindex).replace(/(^\s*)|(\s*$)/g, ""); if (message.length != 0) { alert(message); } //????????????????? var url = msg.substring(lenindex + 5); window.location.href = url; Global.Stop(); } else { //???????????6????????indow.error??????????????????????? var msg = msg.replace(/(^\s*)|(\s*$)/g, ""); if (msg.length != 0) { alert(msg); } Global.Stop(); } }; //????????????????????ost??? Global.GetFormValue = function (form) { var fields = form.find("[name]"); var data = ""; for (var i = 0; i <= fields.length - 1; i++) { var item = fields.eq(i); var objType = item.attr("type"); var name = encodeURIComponent(item.attr("name")); var val = encodeURIComponent(item.val()); //?????nput radio??heck????? ??n???1 off???0 if (objType == "radio") { if (typeof (item.prop) != "undefined") { if (item.prop("checked") != true) { //Jquery 1.6??? continue; } } else { if (item.attr("checked") != true) { //Jquery 1.6??? continue; } } } else if (objType == "checkbox") { //if (item.attr("checked") != true) {//Jquery 1.6??? if (typeof (item.prop) != "undefined") { if (item.prop("checked") != true) {//Jquery 1.6??? val = item.attr("unvalue"); if (typeof (val) == "undefined") { val = null; } } } else { if (item.attr("checked") != true) {//Jquery 1.6??? val = item.attr("unvalue"); if (typeof (val) == "undefined") { val = null; } } } } else if (objType == "select-multiple") { if (item.length > 0) { var selectControl = item.get(0); for (var x = 0; x <= selectControl.options.length - 1; x++) { if (selectControl.options[x].selected == true) { if (data == "") { data += name + "=" + encodeURIComponent(selectControl.options[x].value); } else { data += "&" + name + "=" + encodeURIComponent(selectControl.options[x].value); } } } } continue; } if (data == "") { data += name + "=" + val; } else { data += "&" + name + "=" + val; } } return data; }; //???????????????????? Global.Disabled = function (target, bool) { if (target != null) { try { $(target).attr("disabled", bool); } catch (ex) { } } }; //?????? Global.Mark = function (target, typeName, bool) { if (typeof (target) != "undefined" && typeof (typeName) != "undefined") { if (bool == true) { if (typeof (Global.Animation[typeName]) != "undefined") { if ($(target).find("[name=Animation" + typeName + "]").length > 0) { $(target).find("[name=Animation" + typeName + "]").fadeIn(); } else { target.append(Global.Animation[typeName]); $(target).find("[name=Animation" + typeName + "]").fadeIn(); } } } else { if (typeof (Global.Animation[typeName]) != "undefined") { $(target).find("[name=Animation" + typeName + "]").fadeOut(); } } } } //???Ajax??? Global.Ajax = function (options, send, target, html) { var setting = { ajaxCache: true, ajaxUrl: "", ajaxData: "", ajaxAsync: true, ajaxMark: true } $.extend(true, setting, options); var reVal; jQuery.support.cors = true; $.ajax( { cache: setting.ajaxCache, type: "POST", url: Global.Site + setting.ajaxUrl, data: setting.ajaxData, async: setting.ajaxAsync, dataType: 'json', crossDomain: true, success: function (result) { reVal = result; if (typeof (setting.ajaxFunSuccess) == "function") { setting.ajaxFunSuccess(result); } }, beforeSend: function () { //??????????? Global.Disabled(send, true) //if (setting.ajaxMark == true) { // Global.Mark(target, html, true); // //????????? // if (window.top != null && window.top.frames[0] != null && window.top.frames[0].document.getElementById("dvLoadingMsg") != null) { // window.top.frames[0].document.getElementById("dvLoadingMsg").style.display = ""; // } // if (document.getElementById("dvLoadingMsg") != null) { // document.getElementById("dvLoadingMsg").style.display = "inline"; // } // $("#divloading").show(); //} }, complete: function () { //????????? Global.Disabled(send, false) //Global.Mark(target, html, false); //????????????????????? //if (window.top != null && window.top.frames[0] != null && window.top.frames[0].document.getElementById("dvLoadingMsg") != null) { // window.top.frames[0].document.getElementById("dvLoadingMsg").style.display = "none"; //} //if (document.getElementById("dvLoadingMsg") != null) { // document.getElementById("dvLoadingMsg").style.display = "none"; //} //$("#divloading").hide(); }, error: function (XMLHttpRequest, textStatus, errorThrown) { //???textStatus?????error?????MLHttpRequest?????essage?? var message = XMLHttpRequest.responseText || XMLHttpRequest.statusText;//ie8 only statusText //??????????????100???????? // if (message.length > 100) // { // alert("???????????"); // } // else // { // alert(message); // } //alert(message); Global.Disabled(send, false) //Global.Mark(target, html, false); //???????????????????????????????? //changeCheckCode(); //????????????????????? //if (window.top != null && window.top.frames[0] != null && window.top.frames[0].document.getElementById("dvLoadingMsg") != null) { // window.top.frames[0].document.getElementById("dvLoadingMsg").style.display = "none"; //} //if (document.getElementById("dvLoadingMsg") != null) { // document.getElementById("dvLoadingMsg").style.display = "none"; //} //$("#divloading").hide(); if (typeof (options.ajaxFunError) != "undefined" && options.ajaxFunError != null) { setting.ajaxFunError(XMLHttpRequest, textStatus, errorThrown); } else if (message.indexOf("Service Unavailable") == -1 && message != "error") { Global.Error(message); } } }); //??eVal????? setting.ajaxAsync == false (?????) ????????????????? // if (typeof (reVal) == "undefined" && setting.ajaxAsync == false) { // Global.Error("???????????"); // } return reVal; }; //??query Input??? Global.GetSearchURL = function (params) { var query = ""; for (var i = 0; i <= params.length - 1; i++) { var name = params[i].name; var value = encodeURIComponent($(params[i]).val()); if (query.length == 0) { query += "?" + name + "=" + value; } else { query += "&" + name + "=" + value; } } query = Global.Virtual + "/ajax.aspx" + query; return query; }; //???????????????? Global.UserControl = function (name, params, send, fun, async, mark, errFun) { var url = Global.Virtual + "/ajax.aspx"; if (typeof (fun) == "undefined") { alert("fun undefined"); return; } var data = "template=" + encodeURIComponent(name) + "&" + params; if (typeof (async) == "undefined") { async = true; } if (typeof (mark) == "undefined") { mark = true; } if (typeof (errFun) != "function") { errFun = null; } return Global.Ajax( { ajaxAsync: async, ajaxFunSuccess: fun, ajaxUrl: url, ajaxData: data, ajaxMark: mark, ajaxFunError: errFun }, send); }; //???????????????? Global.DataControl = function (name, params, send, fun, async, mark) { var url = Global.Virtual + "/ajax.aspx"; if (typeof (fun) == "undefined") { alert("fun undefined"); return; } var data = "templatedata=" + encodeURIComponent(name) + "&" + params; if (typeof (async) == "undefined") { async = true; } if (typeof (mark) == "undefined") { mark = true; } return Global.Ajax( { ajaxAsync: async, ajaxFunSuccess: fun, ajaxUrl: url, ajaxData: data, ajaxMark: mark }, send); }; //???????????????? Global.HtmlControl = function (name, params, send, fun, async, mark) { var url = Global.Virtual + "/ajax.aspx"; if (typeof (fun) == "undefined") { alert("fun undefined"); return; } var data = "templatedefine=" + encodeURIComponent(name) + "&" + params; if (typeof (async) == "undefined") { async = true; } if (typeof (mark) == "undefined") { mark = true; } return Global.Ajax( { ajaxAsync: async, ajaxFunSuccess: fun, ajaxUrl: url, ajaxData: data, ajaxMark: mark }, send); }; //?????? function UploadFile(valueControl, title, type, path, fileName, width, height, sizeControl) { $.fn.fancybox.show({ 'zoomSpeedIn': 600, 'zoomSpeedOut': 500, frameWidth: 500, frameHeight: 350, frameURL: Global.Site + "/tools/uploadform.aspx?title=" + encodeURIComponent(title) + "&type=" + encodeURIComponent(type) + "&path=" + encodeURIComponent(path) + "&fileName=" + encodeURIComponent(fileName) + "&height=" + encodeURIComponent(height) + "&width=" + encodeURIComponent(width) + "&valueControl=" + encodeURIComponent(valueControl) + "&sizeControl=" + encodeURIComponent(sizeControl), hideOnContentClick: false }); return false; } //?????? function UploadImage(valueControl, title, type, path, fileName, width, height, sizeControl) { $.fn.fancybox.show({ 'zoomSpeedIn': 600, 'zoomSpeedOut': 500, frameWidth: 600, frameHeight: 500, frameURL: Global.Site + "/tools/CreateVideoImage/Create.aspx?title=" + encodeURIComponent(title) + "&type=" + encodeURIComponent(type) + "&path=" + encodeURIComponent(path) + "&fileName=" + encodeURIComponent(fileName) + "&height=" + encodeURIComponent(height) + "&width=" + encodeURIComponent(width) + "&valueControl=" + encodeURIComponent(valueControl) + "&sizeControl=" + encodeURIComponent(sizeControl), hideOnContentClick: false }); return false; } //----------------------------------------------------------------------------------- var Helper = new Object(); Helper.SecondToTime = function (time) { var size = time; var result = ""; if (size < 60) { result = size.toString(); } else if (size < 60 * 60) { result = Math.floor((size / 60)).toString() + ":"; if (size % 60 != 0) { result += (size % 60).toString().padLeft(2, '0'); } else { result += "00"; } } else { result = Math.floor((size / (60 * 60))).toString() + ":"; size = size % (60 * 60); result += Math.floor((size / 60)).toString().padLeft(2, '0') + ":"; if (size % 60 != 0) { result += (size % 60).toString().padLeft(2, '0'); } else { result += "00"; } } return result; } String.prototype.padLeft = function (padChar, width) { var ret = this; while (ret.length < width) { if (ret.length + padChar.length < width) { ret = padChar + ret; } else { ret = padChar.substring(0, width - ret.length) + ret; } } return ret; }; String.prototype.padRight = function (padChar, width) { var ret = this; while (ret.length < width) { if (ret.length + padChar.length < width) { ret += padChar; } else { ret += padChar.substring(0, width - ret.length); } } return ret; }; String.prototype.trim = function () { return this.replace(/^\s+/, '').replace(/\s+$/, ''); }; String.prototype.trimLeft = function () { return this.replace(/^\s+/, ''); }; String.prototype.trimRight = function () { return this.replace(/\s+$/, ''); }; String.prototype.caption = function () { if (this) { return this.charAt(0).toUpperCase() + this.substr(1); } return this; }; String.prototype.reverse = function () { var ret = ''; for (var i = this.length - 1; i >= 0; i--) { ret += this.charAt(i); } return ret; }; String.prototype.startWith = function (compareValue, ignoreCase) { if (ignoreCase) { return this.toLowerCase().indexOf(compareValue.toLowerCase()) == 0; } return this.indexOf(compareValue) == 0 }; String.prototype.endWith = function (compareValue, ignoreCase) { if (ignoreCase) { return this.toLowerCase().lastIndexOf(compareValue.toLowerCase()) == this.length - compareValue.length; } return this.lastIndexOf(compareValue) == this.length - compareValue.length; }; Helper.resizeIFrame = function resizeIFrame(id, target) { //var targetParent = target ? (document.getElementById(target) ? document.getElementById(target) : document.body) : document.body; //var iframer = document.getElementById(id); Helper.setIframeHeight(id); //iframer.height = targetParent.offsetHeight - iframer.offsetTop ; } Helper.getDocHeight = function getDocHeight(doc) { doc = doc || document; // stackoverflow.com/questions/1145850/ var body = doc.body, html = doc.documentElement; var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight); return height; } Helper.setIframeHeight = function setIframeHeight(id) { var ifrm = document.getElementById(id); var doc = ifrm.contentDocument ? ifrm.contentDocument : ifrm.contentWindow.document; ifrm.style.visibility = 'hidden'; ifrm.style.height = "10px"; // reset to minimal height ... // IE opt. for bing/msn needs a bit added or scrollbar appears ifrm.style.height = Helper.getDocHeight(doc) + 4 + "px"; ifrm.style.visibility = 'visible'; }
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de