1// Name: AjaxFileUpload.AjaxFileUpload.Utils.debug.js 2// Assembly: AjaxControlToolkit 3// Version: 4.1.7.1213 4// FileVersion: 4.1.7.1213 5Type.registerNamespace("Sys.Extended.UI.AjaxFileUpload"); 6Type.registerNamespace("AjaxFileUpload"); 7 8Sys.Extended.UI.AjaxFileUpload.Utils = function () { 9 10 this.generateGuid = function() { 11 var result, i, j; 12 result = ''; 13 for (j = 0; j < 32; j++) { 14 if (j == 8 || j == 12 || j == 16 || j == 20) 15 result = result + '-'; 16 i = Math.floor(Math.random() * 16).toString(16).toUpperCase(); 17 result = result + i; 18 } 19 return result; 20 }; 21 22 this.getFileName = function (fullPath) { 23 24 var result = ""; 25 if (!fullPath) 26 return ''; 27 28 if (!fullPath.value && fullPath.name) 29 result = fullPath.name; 30 else { 31 if (!fullPath.value && typeof(fullPath) !== "string") 32 throw "Invalid parameter. fullPath parameter must be a string of full path or file element."; 33 34 if (fullPath.value) 35 fullPath = fullPath.value; 36 37 if (fullPath) { 38 var startIndex = (fullPath.indexOf('\\') >= 0 ? fullPath.lastIndexOf('\\') : fullPath.lastIndexOf('/')); 39 var filename = fullPath.substring(startIndex); 40 if (filename.indexOf('\\') === 0 || filename.indexOf('/') === 0) { 41 filename = filename.substring(1); 42 } 43 44 result = filename; 45 } 46 } 47 48 return encodeURIComponent(result); 49 }; 50 51 this.getFileType = function (file) { 52 if (!file) 53 throw 'file must defined or not null'; 54 55 if (!file.value && file.name) 56 return file.name.substring(file.name.lastIndexOf('.') + 1); 57 58 if (file.value) 59 file = file.value; 60 61 if (typeof (file) !== "string") 62 throw "can't resolve file type."; 63 64 return file.substring(file.lastIndexOf('.') + 1); 65 }; 66 67 this.sizeToString = function(bytes) { 68 if (!bytes || bytes <= 0) 69 return '0 Kb'; 70 71 var s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB']; 72 var e = Math.floor(Math.log(bytes) / Math.log(1024)); 73 return (bytes / Math.pow(1024, Math.floor(e))).toFixed(2) + " " + s[e]; 74 }; 75 76 this.checkHtml5BrowserSupport = function () { 77 78 var browser = Sys.Browser; 79 if (browser.name == "Microsoft Internet Explorer" && browser.version <= 10) 80 return false; 81 82 return window.File 83 && window.FileReader && window.FileList 84 && window.Blob && (new XMLHttpRequest()).upload; 85 }; 86 87};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.