芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/public_html/midiatech/web/dist/vendor/html5preloader/html5Preloader.js
var html5Preloader = (function () { var XHR = typeof XMLHttpRequest === 'undefined' ? function () { // IE FIX try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (err1) {} try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (err2) {} return null; } : XMLHttpRequest, AudioElement = typeof Audio !== 'undefined' ? // IE FIX function(){ return new Audio(); } : function(){ return document.createElement('audio'); }, VideoElement = typeof Video !== 'undefined' ? // IE FIX function () { return new Video(); } : function () { return document.createElement('video'); }, ImageElement = function () { return new Image(); }, codecs = { // Chart from jPlayer oga: { // OGG codec: 'audio/ogg; codecs="vorbis"', media: 'audio' }, wav: { // PCM codec: 'audio/wav; codecs="1"', media: 'audio' }, webma: { // WEBM codec: 'audio/webm; codecs="vorbis"', media: 'audio' }, mp3: { codec: 'audio/mpeg; codecs="mp3"', media: 'audio' }, m4a: { // AAC / MP4 codec: 'audio/mp4; codecs="mp4a.40.2"', media: 'audio' }, ogv: { // OGG codec: 'video/ogg; codecs="theora, vorbis"', media: 'video' }, webmv: { // WEBM codec: 'video/webm; codecs="vorbis, vp8"', media: 'video' }, m4v: { // H.264 / MP4 codec: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"', media: 'video' } }, support = { imageTypes: ['jpg', 'png', 'jpeg', 'tiff', 'gif'] }, ID_PREFIX = 'FILE@'; /* :) may fail sometimes, but these are the most common cases */ codecs.ogg = codecs.oga; codecs.mp4 = codecs.m4v; codecs.webm = codecs.webmv; function isIn (needle, haystack) { for (var i=0; i
not supported.'), a); }; } if (!support.video) { loadFile.video = function (a, callback) { delay(callback, Error('
not supported.'), a); }; } function html5Preloader () { var self = this, args = arguments; if (!(self instanceof html5Preloader)) { self = new html5Preloader(); args.length && self.loadFiles.apply(self, args); return self; } self.files = []; html5Preloader.EventEmitter.call(self); self.loadCallback = bind(self.loadCallback, self); args.length && self.loadFiles.apply(self, args); } html5Preloader.prototype = { active: false, files: null, filesLoading: 0, filesLoaded: 0, filesLoadedMap: {}, timeout: null, loadCallback: function (e, f) { if (!this.filesLoadedMap[f.id]) { this.filesLoaded++; this.filesLoadedMap[f.id] = f; } this.emit(e ? 'error' : 'fileloaded', e ? [e, f] : [f]); if (this.filesLoading - this.filesLoaded === 0) { this.active = false; this.emit('finish'); this.filesLoading = 0; this.filesLoaded = 0; } }, getFile: function (id) { return typeof id === 'undefined' ? map(this.files, function (f) { return f.dom; }) : typeof id === 'number' ? this.files[id].dom : typeof id === 'string' ? this.files[ID_PREFIX + id].dom : null; }, removeFile: function (id) { var f, i; switch (typeof id) { case 'undefined': this.files = []; break; case 'number': f = this.files[id]; this.files[ID_PREFIX + f.id] && delete this.files[ID_PREFIX + f.id]; this.files.splice(id, 1); break; case 'string': f = this.files[ID_PREFIX + id]; f && delete this.files[ID_PREFIX + id]; for (i=0; i