1/* 2 Uploadify v3.2.1 3 Copyright (c) 2012 Reactive Apps, Ronnie Garcia 4 Released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 5 6 SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com 7 mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/ 8 SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License: 9 http://www.opensource.org/licenses/mit-license.php 10 SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License: 11 http://www.opensource.org/licenses/mit-license.php 12 13 SWFObject v2.2 <http://code.google.com/p/swfobject/> 14 is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 15 */ 16; var swfobject = function() { 17 var aq = "undefined", aD = "object", ab = "Shockwave Flash", X = "ShockwaveFlash.ShockwaveFlash", aE = "application/x-shockwave-flash", ac = "SWFObjectExprInst", ax = "onreadystatechange", af = window, aL = document, aB = navigator, aa = false, Z = [aN], aG = [], ag = [], al = [], aJ, ad, ap, at, ak = false, aU = false, aH, an, aI = true, ah = function() { 18 var a = typeof aL.getElementById != aq && typeof aL.getElementsByTagName != aq && typeof aL.createElement != aq, e = aB.userAgent.toLowerCase(), c = aB.platform.toLowerCase(), h = c ? /win/.test(c) : /win/.test(e), j = c ? /mac/.test(c) : /mac/.test(e), g = /webkit/.test(e) ? parseFloat(e.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, d = ! + "\v1", f = [0, 0, 0], k = null; if (typeof aB.plugins != aq && typeof aB.plugins [ab] == aD) { 19 k = aB.plugins [ab].description; if (k && !(typeof aB.mimeTypes != aq && aB.mimeTypes [aE] && !aB.mimeTypes [aE].enabledPlugin)) { 20 aa = true; d = false; k = k.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); f [0] = parseInt(k.replace(/^(.*)\..*$/, "$1"), 10); f [1] = parseInt(k.replace(/^.*\.(.*)\s.*$/, "$1"), 10); f [2] = /[a-zA-Z]/.test(k) ? parseInt(k.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0; 21 } 22 } else { 23 if (typeof af.ActiveXObject != aq) { 24 try { 25 var i = new ActiveXObject(X); if (i) { 26 k = i.GetVariable("$version"); if (k) { 27 d = true; k = k.split(" ") [1].split(","); f = [parseInt(k [0], 10), parseInt(k [1], 10), parseInt(k [2], 10)]; 28 } 29 } 30 } catch (b) {} 31 } 32 } return { 33 w3 : a, pv : f, wk : g, ie : d, win : h, mac : j 34 }; 35 } (), aK = function() { 36 if (!ah.w3) { 37 return; 38 } if ((typeof aL.readyState != aq && aL.readyState == "complete") || (typeof aL.readyState == aq && (aL.getElementsByTagName("body") [0] || aL.body))) { 39 aP(); 40 } if (!ak) { 41 if (typeof aL.addEventListener != aq) { 42 aL.addEventListener("DOMContentLoaded", aP, false); 43 } if (ah.ie && ah.win) { 44 aL.attachEvent(ax, function() { 45 if (aL.readyState == "complete") { 46 aL.detachEvent(ax, arguments.callee); aP(); 47 } 48 }); if (af == top) { 49 (function() { 50 if (ak) { 51 return; 52 } try { 53 aL.documentElement.doScroll("left"); 54 } catch (a) { 55 setTimeout(arguments.callee, 0); return; 56 } aP(); 57 }) (); 58 } 59 } if (ah.wk) { 60 (function() { 61 if (ak) { 62 return; 63 } if (! /loaded|complete/.test(aL.readyState)) { 64 setTimeout(arguments.callee, 0); return; 65 } aP(); 66 }) (); 67 } aC(aP); 68 } 69 } (); function aP() { 70 if (ak) { 71 return; 72 } try { 73 var b = aL.getElementsByTagName("body") [0].appendChild(ar("span")); b.parentNode.removeChild(b); 74 } catch (a) { 75 return; 76 } ak = true; var d = Z.length; for (var c = 0; c < d; c++) { 77 Z [c] (); 78 } 79 } function aj(a) { 80 if (ak) { 81 a(); 82 } else { 83 Z [Z.length] = a; 84 } 85 } function aC(a) { 86 if (typeof af.addEventListener != aq) { 87 af.addEventListener("load", a, false); 88 } else { 89 if (typeof aL.addEventListener != aq) { 90 aL.addEventListener("load", a, false); 91 } else { 92 if (typeof af.attachEvent != aq) { 93 aM(af, "onload", a); 94 } else { 95 if (typeof af.onload == "function") { 96 var b = af.onload; af.onload = function() { 97 b(); a(); 98 }; 99 } else { 100 af.onload = a; 101 } 102 } 103 } 104 } 105 } function aN() { 106 if (aa) { 107 Y(); 108 } else { 109 am(); 110 } 111 } function Y() { 112 var d = aL.getElementsByTagName("body") [0]; var b = ar(aD); b.setAttribute("type", aE); var a = d.appendChild(b); if (a) { 113 var c = 0; (function() { 114 if (typeof a.GetVariable != aq) { 115 var e = a.GetVariable("$version"); if (e) { 116 e = e.split(" ") [1].split(","); ah.pv = [parseInt(e [0], 10), parseInt(e [1], 10), parseInt(e [2], 10)]; 117 } 118 } else { 119 if (c < 10) { 120 c++; setTimeout(arguments.callee, 10); return; 121 } 122 } d.removeChild(b); a = null; am(); 123 }) (); 124 } else { 125 am(); 126 } 127 } function am() { 128 var g = aG.length; if (g > 0) { 129 for (var h = 0; h < g; h++) { 130 var c = aG [h].id; var l = aG [h].callbackFn; var a = { 131 success : false, id : c 132 }; if (ah.pv [0] > 0) { 133 var i = aS(c); if (i) { 134 if (ao(aG [h].swfVersion) && !(ah.wk && ah.wk < 312)) { 135 ay(c, true); if (l) { 136 a.success = true; a.ref = av(c); l(a); 137 } 138 } else { 139 if (aG [h].expressInstall && au()) { 140 var e = {}; e.data = aG [h].expressInstall; e.width = i.getAttribute("width") || "0"; e.height = i.getAttribute("height") || "0"; if (i.getAttribute("class")) { 141 e.styleclass = i.getAttribute("class"); 142 } if (i.getAttribute("align")) { 143 e.align = i.getAttribute("align"); 144 } var f = {}; var d = i.getElementsByTagName("param"); var k = d.length; for (var j = 0; j < k; j++) { 145 if (d [j].getAttribute("name").toLowerCase() != "movie") { 146 f [d [j].getAttribute("name")] = d [j].getAttribute("value"); 147 } 148 } ae(e, f, c, l); 149 } else { 150 aF(i); if (l) { 151 l(a); 152 } 153 } 154 } 155 } 156 } else { 157 ay(c, true); if (l) { 158 var b = av(c); if (b && typeof b.SetVariable != aq) { 159 a.success = true; a.ref = b; 160 } l(a); 161 } 162 } 163 } 164 } 165 } function av(b) { 166 var d = null; var c = aS(b); if (c && c.nodeName == "OBJECT") { 167 if (typeof c.SetVariable != aq) { 168 d = c; 169 } else { 170 var a = c.getElementsByTagName(aD) [0]; if (a) { 171 d = a; 172 } 173 } 174 } return d; 175 } function au() { 176 return !aU && ao("6.0.65") && (ah.win || ah.mac) && !(ah.wk && ah.wk < 312); 177 } function ae(f, d, h, e) { 178 aU = true; ap = e || null; at = { 179 success : false, id : h 180 }; var a = aS(h); if (a) { 181 if (a.nodeName == "OBJECT") { 182 aJ = aO(a); ad = null; 183 } else { 184 aJ = a; ad = h; 185 } f.id = ac; if (typeof f.width == aq || (! /%$/.test(f.width) && parseInt(f.width, 10) < 310)) { 186 f.width = "310"; 187 } if (typeof f.height == aq || (! /%$/.test(f.height) && parseInt(f.height, 10) < 137)) { 188 f.height = "137"; 189 } aL.title = aL.title.slice(0, 47) + " - Flash Player Installation"; var b = ah.ie && ah.win ? "ActiveX" : "PlugIn", c = "MMredirectURL=" + af.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + b + "&MMdoctitle=" + aL.title; if (typeof d.flashvars != aq) { 190 d.flashvars += "&" + c; 191 } else { 192 d.flashvars = c; 193 } if (ah.ie && ah.win && a.readyState != 4) { 194 var g = ar("div"); h += "SWFObjectNew"; g.setAttribute("id", h); a.parentNode.insertBefore(g, a); a.style.display = "none"; (function() { 195 if (a.readyState == 4) { 196 a.parentNode.removeChild(a); 197 } else { 198 setTimeout(arguments.callee, 10); 199 } 200 }) (); 201 } aA(f, d, h); 202 } 203 } function aF(a) { 204 if (ah.ie && ah.win && a.readyState != 4) { 205 var b = ar("div"); a.parentNode.insertBefore(b, a); b.parentNode.replaceChild(aO(a), b); a.style.display = "none"; (function() { 206 if (a.readyState == 4) { 207 a.parentNode.removeChild(a); 208 } else { 209 setTimeout(arguments.callee, 10); 210 } 211 }) (); 212 } else { 213 a.parentNode.replaceChild(aO(a), a); 214 } 215 } function aO(b) { 216 var d = ar("div"); if (ah.win && ah.ie) { 217 d.innerHTML = b.innerHTML; 218 } else { 219 var e = b.getElementsByTagName(aD) [0]; if (e) { 220 var a = e.childNodes; if (a) { 221 var f = a.length; for (var c = 0; c < f; c++) { 222 if (!(a [c].nodeType == 1 && a [c].nodeName == "PARAM") && !(a [c].nodeType == 8)) { 223 d.appendChild(a [c].cloneNode(true)); 224 } 225 } 226 } 227 } 228 } return d; 229 } function aA(e, g, c) { 230 var d, a = aS(c); if (ah.wk && ah.wk < 312) { 231 return d; 232 } if (a) { 233 if (typeof e.id == aq) { 234 e.id = c; 235 } if (ah.ie && ah.win) { 236 var f = ""; for (var i in e) { 237 if (e [i] != Object.prototype [i]) { 238 if (i.toLowerCase() == "data") { 239 g.movie = e [i]; 240 } else { 241 if (i.toLowerCase() == "styleclass") { 242 f += ' class="' + e [i] + '"'; 243 } else { 244 if (i.toLowerCase() != "classid") { 245 f += " " + i + '="' + e [i] + '"'; 246 } 247 } 248 } 249 } 250 } var h = ""; for (var j in g) { 251 if (g [j] != Object.prototype [j]) { 252 h += '<param name="' + j + '" value="' + g [j] + '" />'; 253 } 254 } a.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + f + ">
254" + h + "</object>"; ag [ag.length] = e.id; d = aS(e.id); 255 } else { 256 var b = ar(aD); b.setAttribute("type", aE); for (var k in e) { 257 if (e [k] != Object.prototype [k]) { 258 if (k.toLowerCase() == "styleclass") { 259 b.setAttribute("class", e [k]); 260 } else { 261 if (k.toLowerCase() != "classid") { 262 b.setAttribute(k, e [k]); 263 } 264 } 265 } 266 } for (var l in g) { 267 if (g [l] != Object.prototype [l] && l.toLowerCase() != "movie") { 268 aQ(b, l, g [l]); 269 } 270 } a.parentNode.replaceChild(b, a); d = b; 271 } 272 } return d; 273 } function aQ(b, d, c) { 274 var a = ar("param"); a.setAttribute("name", d); a.setAttribute("value", c); b.appendChild(a); 275 } function aw(a) { 276 var b = aS(a); if (b && b.nodeName == "OBJECT") { 277 if (ah.ie && ah.win) { 278 b.style.display = "none"; (function() { 279 if (b.readyState == 4) { 280 aT(a); 281 } else { 282 setTimeout(arguments.callee, 10); 283 } 284 }) (); 285 } else { 286 b.parentNode.removeChild(b); 287 } 288 } 289 } function aT(a) { 290 var b = aS(a); if (b) { 291 for (var c in b) { 292 if (typeof b [c] == "function") { 293 b [c] = null; 294 } 295 } b.parentNode.removeChild(b); 296 } 297 } function aS(a) { 298 var c = null; try { 299 c = aL.getElementById(a); 300 } catch (b) {} return c; 301 } function ar(a) { 302 return aL.createElement(a); 303 } function aM(a, c, b) { 304 a.attachEvent(c, b); al [al.length] = [a, c, b]; 305 } function ao(a) { 306 var b = ah.pv, c = a.split("."); c [0] = parseInt(c [0], 10); c [1] = parseInt(c [1], 10) || 0; c [2] = parseInt(c [2], 10) || 0; return (b [0] > c [0] || (b [0] == c [0] && b [1] > c [1]) || (b [0] == c [0] && b [1] == c [1] && b [2] >= c [2])) ? true : false; 307 } function az(b, f, a, c) { 308 if (ah.ie && ah.mac) { 309 return; 310 } var e = aL.getElementsByTagName("head") [0]; if (!e) { 311 return; 312 } var g = (a && typeof a == "string") ? a : "screen"; if (c) { 313 aH = null; an = null; 314 } if (!aH || an != g) { 315 var d = ar("style"); d.setAttribute("type", "text/css"); d.setAttribute("media", g); aH = e.appendChild(d); if (ah.ie && ah.win && typeof aL.styleSheets != aq && aL.styleSheets.length > 0) { 316 aH = aL.styleSheets [aL.styleSheets.length - 1]; 317 } an = g; 318 } if (ah.ie && ah.win) { 319 if (aH && typeof aH.addRule == aD) { 320 aH.addRule(b, f); 321 } 322 } else { 323 if (aH && typeof aL.createTextNode != aq) { 324 aH.appendChild(aL.createTextNode(b + " {" + f + "}")); 325 } 326 } 327 } function ay(a, c) { 328 if (!aI) { 329 return; 330 } var b = c ? "visible" : "hidden"; if (ak && aS(a)) { 331 aS(a).style.visibility = b; 332 } else { 333 az("#" + a, "visibility:" + b); 334 } 335 } function ai(b) { 336 var a = /[\\\"<>\.;]/; var c = a.exec(b) != null; return c && typeof encodeURIComponent != aq ? encodeURIComponent(b) : b; 337 } var aR = function() { 338 if (ah.ie && ah.win) { 339 window.attachEvent("onunload", function() { 340 var a = al.length; for (var b = 0; b < a; b++) { 341 al [b] [0].detachEvent(al [b] [1], al [b] [2]); 342 } var d = ag.length; for (var c = 0; c < d; c++) { 343 aw(ag [c]); 344 } for (var e in ah) { 345 ah [e] = null; 346 } ah = null; for (var f in swfobject) { 347 swfobject [f] = null; 348 } swfobject = null; 349 }); 350 } 351 } (); return { 352 registerObject : function(a, e, c, b) { 353 if (ah.w3 && a && e) { 354 var d = {}; d.id = a; d.swfVersion = e; d.expressInstall = c; d.callbackFn = b; aG [aG.length] = d; ay(a, false); 355 } else { 356 if (b) { 357 b({ 358 success : false, id : a 359 }); 360 } 361 } 362 }, getObjectById : function(a) { 363 if (ah.w3) { 364 return av(a); 365 } 366 }, embedSWF : function(k, e, h, f, c, a, b, i, g, j) { 367 var d = { 368 success : false, id : e 369 }; if (ah.w3 && !(ah.wk && ah.wk < 312) && k && e && h && f && c) { 370 ay(e, false); aj(function() { 371 h += ""; f += ""; var q = {}; if (g && typeof g === aD) { 372 for (var o in g) { 373 q [o] = g [o]; 374 } 375 } q.data = k; q.width = h; q.height = f; var n = {}; if (i && typeof i === aD) { 376 for (var p in i) { 377 n [p] = i [p]; 378 } 379 } if (b && typeof b === aD) { 380 for (var l in b) { 381 if (typeof n.flashvars != aq) { 382 n.flashvars += "&" + l + "=" + b [l]; 383 } else { 384 n.flashvars = l + "=" + b [l]; 385 } 386 } 387 } if (ao(c)) { 388 var m = aA(q, n, e); if (q.id == e) { 389 ay(e, true); 390 } d.success = true; d.ref = m; 391 } else { 392 if (a && au()) { 393 q.data = a; ae(q, n, e, j); return; 394 } else { 395 ay(e, true); 396 } 397 } if (j) { 398 j(d); 399 } 400 }); 401 } else { 402 if (j) { 403 j(d); 404 } 405 } 406 }, switchOffAutoHideShow : function() { 407 aI = false;
408 }, ua : ah, getFlashPlayerVersion : function() { 409 return { 410 major : ah.pv [0], minor : ah.pv [1], release : ah.pv [2] 411 }; 412 }, hasFlashPlayerVersion : ao, createSWF : function(a, b, c) { 413 if (ah.w3) { 414 return aA(a, b, c); 415 } else { 416 return undefined; 417 } 418 }, showExpressInstall : function(b, a, d, c) { 419 if (ah.w3 && au()) { 420 ae(b, a, d, c); 421 } 422 }, removeSWF : function(a) { 423 if (ah.w3) { 424 aw(a); 425 } 426 }, createCSS : function(b, a, c, d) { 427 if (ah.w3) { 428 az(b, a, c, d); 429 } 430 }, addDomLoadEvent : aj, addLoadEvent : aC, getQueryParamValue : function(b) { 431 var a = aL.location.search || aL.location.hash; if (a) { 432 if (/\?/.test(a)) { 433 a = a.split("?") [1]; 434 } if (b == null) { 435 return ai(a); 436 } var c = a.split("&"); for (var d = 0; d < c.length; d++) { 437 if (c [d].substring(0, c [d].indexOf("=")) == b) { 438 return ai(c [d].substring((c [d].indexOf("=") + 1))); 439 } 440 } 441 } return ""; 442 }, expressInstallCallback : function() { 443 if (aU) { 444 var a = aS(ac); if (a && aJ) { 445 a.parentNode.replaceChild(aJ, a); if (ad) { 446 ay(ad, true); if (ah.ie && ah.win) { 447 aJ.style.display = "block"; 448 } 449 } if (ap) { 450 ap(at); 451 } 452 } aU = false; 453 } 454 } 455 }; 456} (); var SWFUpload; if (SWFUpload == undefined) { 457 SWFUpload = function(b) { 458 this.initSWFUpload(b); 459 }; 460} SWFUpload.prototype.initSWFUpload = function(c) { 461 try { 462 this.customSettings = {}; this.settings = c; this.eventQueue = []; this.movieName = "SWFUpload_" + SWFUpload.movieCount++; this.movieElement = null; SWFUpload.instances [this.movieName] = this; this.initSettings(); this.loadFlash(); this.displayDebugInfo(); 463 } catch (d) { 464 delete SWFUpload.instances [this.movieName]; throw d; 465 } 466}; SWFUpload.instances = {}; SWFUpload.movieCount = 0; SWFUpload.version = "2.2.0 2009-03-25"; SWFUpload.QUEUE_ERROR = { 467 QUEUE_LIMIT_EXCEEDED : - 100, FILE_EXCEEDS_SIZE_LIMIT : - 110, ZERO_BYTE_FILE : - 120, INVALID_FILETYPE : - 130 468}; SWFUpload.UPLOAD_ERROR = { 469 HTTP_ERROR : - 200, MISSING_UPLOAD_URL : - 210, IO_ERROR : - 220, SECURITY_ERROR : - 230, UPLOAD_LIMIT_EXCEEDED : - 240, UPLOAD_FAILED : - 250, SPECIFIED_FILE_ID_NOT_FOUND : - 260, FILE_VALIDATION_FAILED : - 270, FILE_CANCELLED : - 280, UPLOAD_STOPPED : - 290 470}; SWFUpload.FILE_STATUS = { 471 QUEUED : - 1, IN_PROGRESS : - 2, ERROR : - 3, COMPLETE : - 4, CANCELLED : - 5 472}; SWFUpload.BUTTON_ACTION = { 473 SELECT_FILE : - 100, SELECT_FILES : - 110, START_UPLOAD : - 120 474}; SWFUpload.CURSOR = { 475 ARROW : - 1, HAND : - 2 476}; SWFUpload.WINDOW_MODE = { 477 WINDOW : "window", TRANSPARENT : "transparent", OPAQUE : "opaque" 478}; SWFUpload.completeURL = function(e) { 479 if (typeof (e) !== "string" || e.match(/^https?:\/\//i) || e.match(/^\//)) { 480 return e; 481 } var f = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : ""); var d = window.location.pathname.lastIndexOf("/"); if (d <= 0) { 482 path = "/"; 483 } else { 484 path = window.location.pathname.substr(0, d) + "/"; 485 } return path + e; 486}; SWFUpload.prototype.initSettings = function() { 487 this.ensureDefault = function(c, d) { 488 this.settings [c] = (this.settings [c] == undefined) ? d : this.settings [c]; 489 }; this.ensureDefault("upload_url", ""); this.ensureDefault("preserve_relative_urls", false); this.ensureDefault("file_post_name", "Filedata"); this.ensureDefault("post_params", {}); this.ensureDefault("use_query_string", false); this.ensureDefault("requeue_on_error", false); this.ensureDefault("http_success", []); this.ensureDefault("assume_success_timeout", 0); this.ensureDefault("file_types", "*.*"); this.ensureDefault("file_types_description", "All Files"); this.ensureDefault("file_size_limit", 0); this.ensureDefault("file_upload_limit", 0); this.ensureDefault("file_queue_limit", 0); this.ensureDefault("flash_url", "swfupload.swf"); this.ensureDefault("prevent_swf_caching", true); this.ensureDefault("button_image_url", ""); this.ensureDefault("button_width", 1); this.ensureDefault("button_height", 1); this.ensureDefault("button_text", ""); this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;"); this.ensureDefault("button_text_top_padding", 0); this.ensureDefault("button_text_left_padding", 0); this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES); this.ensureDefault("button_disabled", false); this.ensureDefault("button_placeholder_id", ""); this.ensureDefault("button_placeholder", null); this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW); this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW); this.ensureDefault("debug", false); this.settings.debug_enabled = this.settings.debug; this.settings.return_upload_start_handler = this.returnUploadStart; this.ensureDefault("swfupload_loaded_handler", null); this.ensureDefault("file_dialog_start_handler", null); this.ensureDefault("file_queued_handler", null); this.ensureDefault("file_queue_error_handler", null); this.ensureDefault("file_dialog_complete_handler", null); this.ensureDefault("upload_start_handler", null); this.ensureDefault("upload_progress_handler", null); this.ensureDefault("upload_error_handler", null); this.ensureDefault("upload_success_handler", null); this.ensureDefault("upload_complete_handler", null); this.ensureDefault("debug_handler", this.debugMessage);
489 this.ensureDefault("custom_settings", {}); this.customSettings = this.settings.custom_settings; if (! ! this.settings.prevent_swf_caching) { 490 this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime(); 491 } if (! this.settings.preserve_relative_urls) { 492 this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url); this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url); 493 } delete this.ensureDefault; 494}; SWFUpload.prototype.loadFlash = function() { 495 var d, c; if (document.getElementById(this.movieName) !== null) { 496 throw "ID " + this.movieName + " is already in use. The Flash Object could not be added"; 497 } d = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder; if (d == undefined) { 498 throw "Could not find the placeholder element: " + this.settings.button_placeholder_id; 499 } c = document.createElement("div"); c.innerHTML = this.getFlashHTML(); d.parentNode.replaceChild(c.firstChild, d); if (window [this.movieName] == undefined) { 500 window [this.movieName] = this.getMovieElement(); 501 } 502}; SWFUpload.prototype.getFlashHTML = function() { 503 return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">', '<param name="wmode" value="', this.settings.button_window_mode, '" />', '<param name="movie" value="', this.settings.flash_url, '" />', '<param name="quality" value="high" />', '<param name="menu" value="false" />', '<param name="allowScriptAccess" value="always" />', '<param name="flashvars" value="' + this.getFlashVars() + '" />', "</object>"].join(""); 504}; SWFUpload.prototype.getFlashVars = function() { 505 var c = this.buildParamString(); var d = this.settings.http_success.join(","); return ["movieName=", encodeURIComponent(this.movieName), "&uploadURL=", encodeURIComponent(this.settings.upload_url), "&useQueryString=", encodeURIComponent(this.settings.use_query_string), "&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error), "&httpSuccess=", encodeURIComponent(d), "&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout), "&params=", encodeURIComponent(c), "&filePostName=", encodeURIComponent(this.settings.file_post_name), "&fileTypes=", encodeURIComponent(this.settings.file_types), "&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description), "&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit), "&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit), "&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit), "&debugEnabled=", encodeURIComponent(this.settings.debug_enabled), "&buttonImageURL=", encodeURIComponent(this.settings.button_image_url), "&buttonWidth=", encodeURIComponent(this.settings.button_width), "&buttonHeight=", encodeURIComponent(this.settings.button_height), "&buttonText=", encodeURIComponent(this.settings.button_text), "&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding), "&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding), "&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style), "&buttonAction=", encodeURIComponent(this.settings.button_action), "&buttonDisabled=", encodeURIComponent(this.settings.button_disabled), "&buttonCursor=", encodeURIComponent(this.settings.button_cursor)].join(""); 506}; SWFUpload.prototype.getMovieElement = function() { 507 if (this.movieElement == undefined) { 508 this.movieElement = document.getElementById(this.movieName); 509 } if (this.movieElement === null) { 510 throw "Could not find Flash element"; 511 } return this.movieElement; 512}; SWFUpload.prototype.buildParamString = function() { 513 var f = this.settings.post_params; var d = []; if (typeof (f) === "object") { 514 for (var e in f) { 515 if (f.hasOwnProperty(e)) { 516 d.push(encodeURIComponent(e.toString()) + "=" + encodeURIComponent(f [e].toString())); 517 } 518 } 519 } return d.join("&"); 520}; SWFUpload.prototype.destroy = function() { 521 try { 522 this.cancelUpload(null, false); var g = null; g = this.getMovieElement(); if (g && typeof (g.CallFunction) === "unknown") { 523 for (var j in g) { 524 try { 525 if (typeof (g [j]) === "function") { 526 g [j] = null; 527 } 528 } catch (h) {} 529 } try { 530 g.parentNode.removeChild(g); 531 } catch (f) {} 532 } window [this.movieName] = null; SWFUpload.instances [this.movieName] = null; delete SWFUpload.instances [this.movieName]; this.movieElement = null; this.settings = null; this.customSettings = null; this.eventQueue = null; this.movieName = null; return true; 533 } catch (i) { 534 return false;
535 } 536}; SWFUpload.prototype.displayDebugInfo = function() { 537 this.debug(["---SWFUpload Instance Info---\n", "Version: ", SWFUpload.version, "\n", "Movie Name: ", this.movieName, "\n", "Settings:\n", "\t", "upload_url: ", this.settings.upload_url, "\n", "\t", "flash_url: ", this.settings.flash_url, "\n", "\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n", "\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n", "\t", "http_success: ", this.settings.http_success.join(", "), "\n", "\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n", "\t", "file_post_name: ", this.settings.file_post_name, "\n", "\t", "post_params: ", this.settings.post_params.toString(), "\n", "\t", "file_types: ", this.settings.file_types, "\n", "\t", "file_types_description: ", this.settings.file_types_description, "\n", "\t", "file_size_limit: ", this.settings.file_size_limit, "\n", "\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n", "\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n", "\t", "debug: ", this.settings.debug.toString(), "\n", "\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n", "\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n", "\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n", "\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n", "\t", "button_width: ", this.settings.button_width.toString(), "\n", "\t", "button_height: ", this.settings.button_height.toString(), "\n", "\t", "button_text: ", this.settings.button_text.toString(), "\n", "\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n", "\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n", "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n", "\t", "button_action: ", this.settings.button_action.toString(), "\n", "\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n", "\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n", "Event Handlers:\n", "\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n", "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n", "\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n", "\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n", "\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n", "\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n", "\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n", "\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n", "\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n", "\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n"].join("")); 538}; SWFUpload.prototype.addSetting = function(d, f, e) { 539 if (f == undefined) { 540 return (this.settings [d] = e); 541 } else { 542 return (this.settings [d] = f); 543 } 544}; SWFUpload.prototype.getSetting = function(b) { 545 if (this.settings [b] != undefined) { 546 return this.settings [b]; 547 } return ""; 548}; SWFUpload.prototype.callFlash = function(functionName, argumentArray) { 549 argumentArray = argumentArray || []; var movieElement = this.getMovieElement(); var returnValue, returnString; try { 550 returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + "</invoke>"); returnValue = eval(returnString); 551 } catch (ex) { 552 throw "Call to " + functionName + " failed"; 553 } if (returnValue != undefined && typeof returnValue.post === "object") { 554 returnValue = this.unescapeFilePostParams(returnValue); 555 } return returnValue; 556}; SWFUpload.prototype.selectFile = function() { 557 this.callFlash("SelectFile"); 558}; SWFUpload.prototype.selectFiles = function() { 559 this.callFlash("SelectFiles"); 560}; SWFUpload.prototype.startUpload = function(b) { 561 this.callFlash("StartUpload", [b]); 562}; SWFUpload.prototype.cancelUpload = function(d, c) { 563 if (c !== false) { 564 c = true; 565 } this.callFlash("CancelUpload", [d, c]); 566}; SWFUpload.prototype.stopUpload = function() { 567 this.callFlash("StopUpload"); 568}; SWFUpload.prototype.getStats = function() { 569 return this.callFlash("GetStats"); 570}; SWFUpload.prototype.setStats = function(b) { 571 this.callFlash("SetStats", [b]); 572}; SWFUpload.prototype.getFile = function(b) { 573 if (typeof (b) === "number") { 574 return this.callFlash("GetFileByIndex", [b]); 575 } else { 576 return this.callFlash("GetFile", [b]); 577 } 578}; SWFUpload.prototype.addFileParam = function(e, d, f) { 579 return this.callFlash("AddFileParam", [e, d, f]); 580}; SWFUpload.prototype.removeFileParam = function(d, c) { 581 this.callFlash("RemoveFileParam", [d, c]); 582}; SWFUpload.prototype.setUploadURL = function(b) { 583 this.settings.upload_url = b.toString(); this.callFlash("SetUploadURL", [b]); 584}; SWFUpload.prototype.setPostParams = function(b) { 585 this.settings.post_params = b; this.callFlash("SetPostParams", [b]); 586}; SWFUpload.prototype.addPostParam = function(d, c) { 587 this.settings.post_params [d] = c; this.callFlash("SetPostParams", [this.settings.post_params]); 588}; SWFUpload.prototype.removePostParam = function(b) { 589 delete this.settings.post_params [b]; this.callFlash("SetPostParams", [this.settings.post_params]); 590}; SWFUpload.prototype.setFileTypes = function(d, c) { 591 this.settings.file_types = d; this.settings.file_types_description = c; this.callFlash("SetFileTypes", [d, c]); 592}; SWFUpload.prototype.setFileSizeLimit = function(b) { 593 this.settings.file_size_limit = b; this.callFlash("SetFileSizeLimit", [b]); 594}; SWFUpload.prototype.setFileUploadLimit = function(b) { 595 this.settings.file_upload_limit = b; this.callFlash("SetFileUploadLimit", [b]); 596}; SWFUpload.prototype.setFileQueueLimit = function(b) { 597 this.settings.file_queue_limit = b; this.callFlash("SetFileQueueLimit", [b]); 598}; SWFUpload.prototype.setFilePostName = function(b) { 599 this.settings.file_post_name = b; this.callFlash("SetFilePostName", [b]); 600}; SWFUpload.prototype.setUseQueryString = function(b) { 601 this.settings.use_query_string = b; this.callFlash("SetUseQueryString", [b]); 602};
602 SWFUpload.prototype.setRequeueOnError = function(b) { 603 this.settings.requeue_on_error = b; this.callFlash("SetRequeueOnError", [b]); 604}; SWFUpload.prototype.setHTTPSuccess = function(b) { 605 if (typeof b === "string") { 606 b = b.replace(" ", "").split(","); 607 } this.settings.http_success = b; this.callFlash("SetHTTPSuccess", [b]); 608}; SWFUpload.prototype.setAssumeSuccessTimeout = function(b) { 609 this.settings.assume_success_timeout = b; this.callFlash("SetAssumeSuccessTimeout", [b]); 610}; SWFUpload.prototype.setDebugEnabled = function(b) { 611 this.settings.debug_enabled = b; this.callFlash("SetDebugEnabled", [b]); 612}; SWFUpload.prototype.setButtonImageURL = function(b) { 613 if (b == undefined) { 614 b = ""; 615 } this.settings.button_image_url = b; this.callFlash("SetButtonImageURL", [b]); 616}; SWFUpload.prototype.setButtonDimensions = function(f, e) { 617 this.settings.button_width = f; this.settings.button_height = e; var d = this.getMovieElement(); if (d != undefined) { 618 d.style.width = f + "px"; d.style.height = e + "px"; 619 } this.callFlash("SetButtonDimensions", [f, e]); 620}; SWFUpload.prototype.setButtonText = function(b) { 621 this.settings.button_text = b; this.callFlash("SetButtonText", [b]); 622}; SWFUpload.prototype.setButtonTextPadding = function(c, d) { 623 this.settings.button_text_top_padding = d; this.settings.button_text_left_padding = c; this.callFlash("SetButtonTextPadding", [c, d]); 624}; SWFUpload.prototype.setButtonTextStyle = function(b) { 625 this.settings.button_text_style = b; this.callFlash("SetButtonTextStyle", [b]); 626}; SWFUpload.prototype.setButtonDisabled = function(b) { 627 this.settings.button_disabled = b; this.callFlash("SetButtonDisabled", [b]); 628}; SWFUpload.prototype.setButtonAction = function(b) { 629 this.settings.button_action = b; this.callFlash("SetButtonAction", [b]); 630}; SWFUpload.prototype.setButtonCursor = function(b) { 631 this.settings.button_cursor = b; this.callFlash("SetButtonCursor", [b]); 632}; SWFUpload.prototype.queueEvent = function(d, f) { 633 if (f == undefined) { 634 f = []; 635 } else { 636 if (!(f instanceof Array)) { 637 f = [f]; 638 } 639 } var e = this; if (typeof this.settings [d] === "function") { 640 this.eventQueue.push(function() { 641 this.settings [d].apply(this, f); 642 }); setTimeout(function() { 643 e.executeNextEvent(); 644 }, 0); 645 } else { 646 if (this.settings [d] !== null) { 647 throw "Event handler " + d + " is unknown or is not a function"; 648 } 649 } 650}; SWFUpload.prototype.executeNextEvent = function() { 651 var b = this.eventQueue ? this.eventQueue.shift() : null; if (typeof (b) === "function") { 652 b.apply(this); 653 } 654}; SWFUpload.prototype.unescapeFilePostParams = function(l) { 655 var j = /[$]([0-9a-f]{4})/i; var i = {}; var k; if (l != undefined) { 656 for (var h in l.post) { 657 if (l.post.hasOwnProperty(h)) { 658 k = h; var g; while ((g = j.exec(k)) !== null) { 659 k = k.replace(g [0], String.fromCharCode(parseInt("0x" + g [1], 16))); 660 } i [k] = l.post [h]; 661 } 662 } l.post = i; 663 } return l; 664}; SWFUpload.prototype.testExternalInterface = function() { 665 try { 666 return this.callFlash("TestExternalInterface"); 667 } catch (b) { 668 return false; 669 } 670}; SWFUpload.prototype.flashReady = function() { 671 var b = this.getMovieElement(); if (!b) { 672 this.debug("Flash called back ready but the flash movie can't be found."); return; 673 } this.cleanUp(b); this.queueEvent("swfupload_loaded_handler"); 674}; SWFUpload.prototype.cleanUp = function(f) { 675 try { 676 if (this.movieElement && typeof (f.CallFunction) === "unknown") { 677 this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)"); for (var h in f) { 678 try { 679 if (typeof (f [h]) === "function") { 680 f [h] = null; 681 } 682 } catch (e) {} 683 } 684 } 685 } catch (g) {} window.__flash__removeCallback = function(c, b) { 686 try { 687 if (c) { 688 c [b] = null; 689 } 690 } catch (a) {} 691 }; 692}; SWFUpload.prototype.fileDialogStart = function() { 693 this.queueEvent("file_dialog_start_handler"); 694}; SWFUpload.prototype.fileQueued = function(b) { 695 b = this.unescapeFilePostParams(b); this.queueEvent("file_queued_handler", b); 696}; SWFUpload.prototype.fileQueueError = function(e, f, d) { 697 e = this.unescapeFilePostParams(e); this.queueEvent("file_queue_error_handler", [e, f, d]); 698}; SWFUpload.prototype.fileDialogComplete = function(d, f, e) { 699 this.queueEvent("file_dialog_complete_handler", [d, f, e]); 700}; SWFUpload.prototype.uploadStart = function(b) { 701 b = this.unescapeFilePostParams(b); this.queueEvent("return_upload_start_handler", b); 702}; SWFUpload.prototype.returnUploadStart = function(d) { 703 var c; if (typeof this.settings.upload_start_handler === "function") { 704 d = this.unescapeFilePostParams(d); c = this.settings.upload_start_handler.call(this, d); 705 } else { 706 if (this.settings.upload_start_handler != undefined) { 707 throw "upload_start_handler must be a function"; 708 } 709 }
709 if (c === undefined) { 710 c = true; 711 } c = ! !c; this.callFlash("ReturnUploadStart", [c]); 712}; SWFUpload.prototype.uploadProgress = function(e, f, d) { 713 e = this.unescapeFilePostParams(e); this.queueEvent("upload_progress_handler", [e, f, d]); 714}; SWFUpload.prototype.uploadError = function(e, f, d) { 715 e = this.unescapeFilePostParams(e); this.queueEvent("upload_error_handler", [e, f, d]); 716}; SWFUpload.prototype.uploadSuccess = function(d, e, f) { 717 d = this.unescapeFilePostParams(d); this.queueEvent("upload_success_handler", [d, e, f]); 718}; SWFUpload.prototype.uploadComplete = function(b) { 719 b = this.unescapeFilePostParams(b); this.queueEvent("upload_complete_handler", b); 720}; SWFUpload.prototype.debug = function(b) { 721 this.queueEvent("debug_handler", b); 722}; SWFUpload.prototype.debugMessage = function(h) { 723 if (this.settings.debug) { 724 var f, g = []; if (typeof h === "object" && typeof h.name === "string" && typeof h.message === "string") { 725 for (var e in h) { 726 if (h.hasOwnProperty(e)) { 727 g.push(e + ": " + h [e]); 728 } 729 } f = g.join("\n") || ""; g = f.split("\n"); f = "EXCEPTION: " + g.join("\nEXCEPTION: "); SWFUpload.Console.writeLine(f); 730 } else { 731 SWFUpload.Console.writeLine(h); 732 } 733 } 734}; SWFUpload.Console = {}; SWFUpload.Console.writeLine = function(g) { 735 var e, f; try { 736 e = document.getElementById("SWFUpload_Console"); if (!e) { 737 f = document.createElement("form"); document.getElementsByTagName("body") [0].appendChild(f); e = document.createElement("textarea"); e.id = "SWFUpload_Console"; e.style.fontFamily = "monospace"; e.setAttribute("wrap", "off"); e.wrap = "off"; e.style.overflow = "auto"; e.style.width = "700px"; e.style.height = "350px"; e.style.margin = "5px"; f.appendChild(e); 738 } e.value += g + "\n"; e.scrollTop = e.scrollHeight - e.clientHeight; 739 } catch (h) { 740 alert("Exception: " + h.name + " Message: " + h.message); 741 } 742}; (function(c) { 743 var b = { 744 init : function(d, e) { 745 return this.each(function() { 746 var n = c(this); var m = n.clone(); var j = c.extend({ 747 id : n.attr("id"), swf : "uploadify.swf", uploader : "uploadify.php", auto : true, buttonClass : "", buttonCursor : "hand", buttonImage : null, buttonText : "SELECT FILES", checkExisting : false, debug : false, fileObjName : "Filedata", fileSizeLimit : 0, fileTypeDesc : "All Files", fileTypeExts : "*.*", height : 30, itemTemplate : false, method : "post", multi : true, formData : {}, preventCaching : true, progressData : "percentage", queueID : false, queueSizeLimit : 999, removeCompleted : true, removeTimeout : 3, requeueErrors : false, successTimeout : 30, uploadLimit : 0, width : 120, overrideEvents : [] 748 }, d); var g = { 749 assume_success_timeout : j.successTimeout, button_placeholder_id : j.id, button_width : j.width, button_height : j.height, button_text : null, button_text_style : null, button_text_top_padding : 0, button_text_left_padding : 0, button_action : (j.multi ? SWFUpload.BUTTON_ACTION.SELECT_FILES : SWFUpload.BUTTON_ACTION.SELECT_FILE), button_disabled : false, button_cursor : (j.buttonCursor == "arrow" ? SWFUpload.CURSOR.ARROW : SWFUpload.CURSOR.HAND), button_window_mode : SWFUpload.WINDOW_MODE.TRANSPARENT, debug : j.debug, requeue_on_error : j.requeueErrors, file_post_name : j.fileObjName, file_size_limit : j.fileSizeLimit, file_types : j.fileTypeExts, file_types_description : j.fileTypeDesc, file_queue_limit : j.queueSizeLimit, file_upload_limit : j.uploadLimit, flash_url : j.swf, prevent_swf_caching : j.preventCaching, post_params : j.formData, upload_url : j.uploader, use_query_string : (j.method == "get"), file_dialog_complete_handler : a.onDialogClose, file_dialog_start_handler : a.onDialogOpen, file_queued_handler : a.onSelect, file_queue_error_handler : a.onSelectError, swfupload_loaded_handler : j.onSWFReady, upload_complete_handler : a.onUploadComplete, upload_error_handler : a.onUploadError, upload_progress_handler : a.onUploadProgress, upload_start_handler : a.onUploadStart, upload_success_handler : a.onUploadSuccess 750 }; if (e) { 751 g = c.extend(g, e); 752 } g = c.extend(g, j); var o = swfobject.getFlashPlayerVersion();
752 var h = (o.major >= 9); if (h) { 753 window ["uploadify_" + j.id] = new SWFUpload(g); var i = window ["uploadify_" + j.id]; n.data("uploadify", i); var l = c("<div />", { 754 id : j.id, "class" : "uploadify", css : { 755 height : j.height + "px", width : j.width + "px" 756 } 757 }); c("#" + i.movieName).wrap(l); l = c("#" + j.id); l.data("uploadify", i); var f = c("<div />", { 758 id : j.id + "-button", "class" : "uploadify-button " + j.buttonClass 759 }); if (j.buttonImage) { 760 f.css({ 761 "background-image" : "url('" + j.buttonImage + "')", "text-indent" : "-9999px" 762 }); 763 } f.html('<span class="uploadify-button-text">' + j.buttonText + "</span>").css({ 764 height : j.height + "px", "line-height" : j.height + "px", width : j.width + "px" 765 }); l.append(f); c("#" + i.movieName).css({ 766 position : "absolute", "z-index" : 1 767 }); if (!j.queueID) { 768 var k = c("<div />", { 769 id : j.id + "-queue", "class" : "uploadify-queue" 770 }); l.after(k); i.settings.queueID = j.id + "-queue"; i.settings.defaultQueue = true; 771 } i.queueData = { 772 files : {}, filesSelected : 0, filesQueued : 0, filesReplaced : 0, filesCancelled : 0, filesErrored : 0, uploadsSuccessful : 0, uploadsErrored : 0, averageSpeed : 0, queueLength : 0, queueSize : 0, uploadSize : 0, queueBytesUploaded : 0, uploadQueue : [], errorMsg : "Some files were not added to the queue:" 773 }; i.original = m; i.wrapper = l; i.button = f; i.queue = k; if (j.onInit) { 774 j.onInit.call(n, i); 775 } 776 } else { 777 if (j.onFallback) { 778 j.onFallback.call(n); 779 } 780 } 781 }); 782 }, cancel : function(d, f) { 783 var e = arguments; this.each(function() { 784 var l = c(this), i = l.data("uploadify"), j = i.settings, h = - 1; if (e [0]) { 785 if (e [0] == "*") { 786 var g = i.queueData.queueLength; c("#" + j.queueID).find(".uploadify-queue-item").each(function() { 787 h++; if (e [1] === true) { 788 i.cancelUpload(c(this).attr("id"), false); 789 } else { 790 i.cancelUpload(c(this).attr("id")); 791 } c(this).find(".data").removeClass("data").html(" - Cancelled"); c(this).find(".uploadify-progress-bar").remove(); c(this).delay(1000 + 100 * h).fadeOut(500, function() { 792 c(this).remove(); 793 }); 794 }); i.queueData.queueSize = 0; i.queueData.queueLength = 0; if (j.onClearQueue) { 795 j.onClearQueue.call(l, g); 796 } 797 } else { 798 for (var m = 0; m < e.length; m++) { 799 i.cancelUpload(e [m]); c("#" + e [m]).find(".data").removeClass("data").html(" - Cancelled"); c("#" + e [m]).find(".uploadify-progress-bar").remove(); c("#" + e [m]).delay(1000 + 100 * m).fadeOut(500, function() { 800 c(this).remove(); 801 }); 802 } 803 } 804 } else { 805 var k = c("#" + j.queueID).find(".uploadify-queue-item").get(0); $item = c(k); i.cancelUpload($item.attr("id")); $item.find(".data").removeClass("data").html(" - Cancelled"); $item.find(".uploadify-progress-bar").remove(); $item.delay(1000).fadeOut(500, function() { 806 c(this).remove(); 807 }); 808 } 809 }); 810 }, destroy : function() { 811 this.each(function() { 812 var f = c(this), d = f.data("uploadify"), e = d.settings; d.destroy(); if (e.defaultQueue) { 813 c("#" + e.queueID).remove(); 814 } c("#" + e.id).replaceWith(d.original); if (e.onDestroy) { 815 e.onDestroy.call(this); 816 } delete d; 817 }); 818 }, disable : function(d) { 819 this.each(function() { 820 var g = c(this), e = g.data("uploadify"), f = e.settings; if (d) { 821 e.button.addClass("disabled"); if (f.onDisable) { 822 f.onDisable.call(this); 823 } 824 } else { 825 e.button.removeClass("disabled"); if (f.onEnable) { 826 f.onEnable.call(this); 827 } 828 } e.setButtonDisabled(d); 829 }); 830 }, settings : function(e, g, h) { 831 var d = arguments; var f = g; this.each(function() { 832 var k = c(this), i = k.data("uploadify"), j = i.settings; if (typeof (d [0]) == "object") { 833 for (var l in g) { 834 setData(l, g [l]); 835 } 836 } if (d.length === 1) { 837 f = j [e]; 838 } else { 839 switch (e) { 840 case "uploader" : i.setUploadURL(g); break; case "formData" : if (!h) { 841 g = c.extend(j.formData, g); 842 } i.setPostParams(j.formData); break; case "method" : if (g == "get") { 843 i.setUseQueryString(true); 844 } else { 845 i.setUseQueryString(false); 846 } break; case "fileObjName" : i.setFilePostName(g); break; case "fileTypeExts" : i.setFileTypes(g, j.fileTypeDesc); break; case "fileTypeDesc" : i.setFileTypes(j.fileTypeExts, g); break; case "fileSizeLimit" : i.setFileSizeLimit(g); break; case "uploadLimit" : i.setFileUploadLimit(g); break; case "queueSizeLimit" : i.setFileQueueLimit(g); break; case "buttonImage" : i.button.css("background-image", settingValue); break; case "buttonCursor" : if (g == "arrow") { 847 i.setButtonCursor(SWFUpload.CURSOR.ARROW); 848 } else { 849 i.setButtonCursor(SWFUpload.CURSOR.HAND); 850 } break; case "buttonText" : c("#" + j.id + "-button").find(".uploadify-button-text").html(g); break; case "width" : i.setButtonDimensions(g, j.height); break; case "height" : i.setButtonDimensions(j.width, g); break; case "multi" : if (g) { 851 i.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILES); 852 } else { 853 i.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILE); 854 } break; 855 } j [e] = g; 856 } 857 }); if (d.length === 1) { 858 return f; 859 } 860 }, stop : function() { 861 this.each(function() { 862 var e = c(this), d = e.data("uploadify"); d.queueData.averageSpeed = 0; d.queueData.uploadSize = 0; d.queueData.bytesUploaded = 0; d.queueData.uploadQueue = []; d.stopUpload(); 863 }); 864 }, upload : function() { 865 var d = arguments; this.each(function() { 866 var f = c(this), e = f.data("uploadify"); e.queueData.averageSpeed = 0; e.queueData.uploadSize = 0; e.queueData.bytesUploaded = 0; e.queueData.uploadQueue = []; if (d [0]) { 867 if (d [0] == "*") { 868 e.queueData.uploadSize = e.queueData.queueSize; e.queueData.uploadQueue.push("*"); e.startUpload(); 869 } else { 870 for (var g = 0; g < d.length; g++) { 871 e.queueData.uploadSize += e.queueData.files [d [g]].size; e.queueData.uploadQueue.push(d [g]); 872 } e.startUpload(e.queueData.uploadQueue.shift()); 873 } 874 } else { 875 e.startUpload(); 876 } 877 }); 878 } 879 }; var a = { 880 onDialogOpen : function() { 881 var d = this.settings; this.queueData.errorMsg = "Some files were not added to the queue:"; this.queueData.filesReplaced = 0; this.queueData.filesCancelled = 0; if (d.onDialogOpen) { 882 d.onDialogOpen.call(this); 883 } 884 }, onDialogClose : function(d, f, g) { 885 var e = this.settings; this.queueData.filesErrored = d - f; this.queueData.filesSelected = d; this.queueData.filesQueued = f - this.queueData.filesCancelled; this.queueData.queueLength = g; if (c.inArray("onDialogClose", e.overrideEvents) < 0) { 886 if (this.queueData.filesErrored > 0) { 887 alert(this.queueData.errorMsg); 888 } 889 } if (e.onDialogClose) { 890 e.onDialogClose.call(this, this.queueData); 891 } if (e.auto) { 892 c("#" + e.id).uploadify("upload", "*"); 893 } 894 }, onSelect : function(h) { 895 var i = this.settings; var f = {}; for (var g in this.queueData.files) { 896 f = this.queueData.files [g]; if (f.uploaded != true && f.name == h.name) { 897 var e = confirm('The file named "' + h.name + '" is already in the queue.\nDo you want to replace the existing item in the queue?'); if (!e) { 898 this.cancelUpload(h.id); this.queueData.filesCancelled++; return false;
899 } else { 900 c("#" + f.id).remove(); this.cancelUpload(f.id); this.queueData.filesReplaced++; 901 } 902 } 903 } var j = Math.round(h.size / 1024); var o = "KB"; if (j > 1000) { 904 j = Math.round(j / 1000); o = "MB"; 905 } var l = j.toString().split("."); j = l [0]; if (l.length > 1) { 906 j += "." + l [1].substr(0, 2); 907 } j += o; var k = h.name; if (k.length > 25) { 908 k = k.substr(0, 25) + "..."; 909 } itemData = { 910 fileID : h.id, instanceID : i.id, fileName : k, fileSize : j 911 }; if (i.itemTemplate == false) { 912 i.itemTemplate = '<div id="${fileID}" class="uploadify-queue-item"> <div class="cancel"> <a href="javascript:$(\'#${instanceID}\').uploadify(\'cancel\', \'${fileID}\')">X</a> </div> <span class="fileName">${fileName} (${fileSize})</span><span class="data"></span> <div class="uploadify-progress"> <div class="uploadify-progress-bar"><!--Progress Bar--></div> </div> </div>'; 913 } if (c.inArray("onSelect", i.overrideEvents) < 0) { 914 itemHTML = i.itemTemplate; for (var m in itemData) { 915 itemHTML = itemHTML.replace(new RegExp("\\$\\{" + m + "\\}", "g"), itemData [m]); 916 } c("#" + i.queueID).append(itemHTML); 917 } this.queueData.queueSize += h.size; this.queueData.files [h.id] = h; if (i.onSelect) { 918 i.onSelect.apply(this, arguments); 919 } 920 }, onSelectError : function(d, g, f) { 921 var e = this.settings; if (c.inArray("onSelectError", e.overrideEvents) < 0) { 922 switch (g) { 923 case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED : if (e.queueSizeLimit > f) { 924 this.queueData.errorMsg += "\nThe number of files selected exceeds the remaining upload limit (" + f + ")."; 925 } else { 926 this.queueData.errorMsg += "\nThe number of files selected exceeds the queue size limit (" + e.queueSizeLimit + ")."; 927 } break; case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT : this.queueData.errorMsg += '\nThe file "' + d.name + '" exceeds the size limit (' + e.fileSizeLimit + ")."; break; case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE : this.queueData.errorMsg += '\nThe file "' + d.name + '" is empty.'; break; case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT : this.queueData.errorMsg += '\nThe file "' + d.name + '" is not an accepted file type (' + e.fileTypeDesc + ")."; break; 928 } 929 } if (g != SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) { 930 delete this.queueData.files [d.id]; 931 } if (e.onSelectError) { 932 e.onSelectError.apply(this, arguments); 933 } 934 }, onQueueComplete : function() { 935 if (this.settings.onQueueComplete) { 936 this.settings.onQueueComplete.call(this, this.settings.queueData); 937 } 938 }, onUploadComplete : function(f) { 939 var g = this.settings, d = this; var e = this.getStats(); this.queueData.queueLength = e.files_queued; if (this.queueData.uploadQueue [0] == "*") { 940 if (this.queueData.queueLength > 0) { 941 this.startUpload(); 942 } else { 943 this.queueData.uploadQueue = []; if (g.onQueueComplete) { 944 g.onQueueComplete.call(this, this.queueData); 945 } 946 } 947 } else { 948 if (this.queueData.uploadQueue.length > 0) { 949 this.startUpload(this.queueData.uploadQueue.shift()); 950 } else { 951 this.queueData.uploadQueue = []; if (g.onQueueComplete) { 952 g.onQueueComplete.call(this, this.queueData); 953 } 954 } 955 } if (c.inArray("onUploadComplete", g.overrideEvents) < 0) { 956 if (g.removeCompleted) { 957 switch (f.filestatus) { 958 case SWFUpload.FILE_STATUS.COMPLETE : setTimeout(function() { 959 if (c("#" + f.id)) { 960 d.queueData.queueSize -= f.size; d.queueData.queueLength -= 1; delete d.queueData.files [f.id]; c("#" + f.id).fadeOut(500, function() { 961 c(this).remove(); 962 }); 963 } 964 }, g.removeTimeout * 1000); break; case SWFUpload.FILE_STATUS.ERROR : if (!g.requeueErrors) { 965 setTimeout(function() { 966 if (c("#" + f.id)) { 967 d.queueData.queueSize -= f.size; d.queueData.queueLength -= 1; delete d.queueData.files [f.id]; c("#" + f.id).fadeOut(500, function() { 968 c(this).remove(); 969 }); 970 } 971 }, g.removeTimeout * 1000); 972 } break; 973 } 974 } else { 975 f.uploaded = true; 976 } 977 } if (g.onUploadComplete) { 978 g.onUploadComplete.call(this, f); 979 } 980 }, onUploadError : function(e, i, h) { 981 var f = this.settings; var g = "Error"; switch (i) { 982 case SWFUpload.UPLOAD_ERROR.HTTP_ERROR : g = "HTTP Error (" + h + ")"; break; case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL : g = "Missing Upload URL"; break; case SWFUpload.UPLOAD_ERROR.IO_ERROR : g = "IO Error"; break; case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR : g = "Security Error"; break; case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED : alert("The upload limit has been reached (" + h + ")."); g = "Exceeds Upload Limit"; break; case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED : g = "Failed"; break; case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND : break; case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED : g = "Validation Error"; break; case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED : g = "Cancelled"; this.queueData.queueSize -= e.size; this.queueData.queueLength -= 1; if (e.status == SWFUpload.FILE_STATUS.IN_PROGRESS || c.inArray(e.id, this.queueData.uploadQueue) >= 0) { 983 this.queueData.uploadSize -= e.size; 984 } if (f.onCancel) { 985 f.onCancel.call(this, e); 986 } delete this.queueData.files [e.id]; break; case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED : g = "Stopped"; break; 987 } if (c.inArray("onUploadError", f.overrideEvents) < 0) { 988 if (i != SWFUpload.UPLOAD_ERROR.FILE_CANCELLED && i != SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED) { 989 c("#" + e.id).addClass("uploadify-error"); 990 } c("#" + e.id).find(".uploadify-progress-bar").css("width", "1px"); if (i != SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND && e.status != SWFUpload.FILE_STATUS.COMPLETE) { 991 c("#" + e.id).find(".data").html(" - " + g); 992 } 993 }
993 var d = this.getStats(); this.queueData.uploadsErrored = d.upload_errors; if (f.onUploadError) { 994 f.onUploadError.call(this, e, i, h, g); 995 } 996 }, onUploadProgress : function(g, m, j) { 997 var h = this.settings; var e = new Date(); var n = e.getTime(); var k = n - this.timer; if (k > 500) { 998 this.timer = n; 999 } var i = m - this.bytesLoaded; this.bytesLoaded = m; var d = this.queueData.queueBytesUploaded + m; var p = Math.round(m / j * 100); var o = "KB/s"; var l = 0; var f = (i / 1024) / (k / 1000); f = Math.floor(f * 10) / 10; if (this.queueData.averageSpeed > 0) { 1000 this.queueData.averageSpeed = Math.floor((this.queueData.averageSpeed + f) / 2); 1001 } else { 1002 this.queueData.averageSpeed = Math.floor(f); 1003 } if (f > 1000) { 1004 l = (f * 0.001); this.queueData.averageSpeed = Math.floor(l); o = "MB/s"; 1005 } if (c.inArray("onUploadProgress", h.overrideEvents) < 0) { 1006 if (h.progressData == "percentage") { 1007 c("#" + g.id).find(".data").html(" - " + p + "%"); 1008 } else { 1009 if (h.progressData == "speed" && k > 500) { 1010 c("#" + g.id).find(".data").html(" - " + this.queueData.averageSpeed + o); 1011 } 1012 } c("#" + g.id).find(".uploadify-progress-bar").css("width", p + "%"); 1013 } if (h.onUploadProgress) { 1014 h.onUploadProgress.call(this, g, m, j, d, this.queueData.uploadSize); 1015 } 1016 }, onUploadStart : function(d) { 1017 var e = this.settings; var f = new Date(); this.timer = f.getTime(); this.bytesLoaded = 0; if (this.queueData.uploadQueue.length == 0) { 1018 this.queueData.uploadSize = d.size; 1019 } if (e.checkExisting) { 1020 c.ajax({ 1021 type : "POST", async : false, url : e.checkExisting, data : { 1022 filename : d.name 1023 }, success : function(h) { 1024 if (h == 1) { 1025 var g = confirm('A file with the name "' + d.name + '" already exists on the server.\nWould you like to replace the existing file?'); if (!g) { 1026 this.cancelUpload(d.id); c("#" + d.id).remove(); if (this.queueData.uploadQueue.length > 0 && this.queueData.queueLength > 0) { 1027 if (this.queueData.uploadQueue [0] == "*") { 1028 this.startUpload(); 1029 } else { 1030 this.startUpload(this.queueData.uploadQueue.shift()); 1031 } 1032 } 1033 } 1034 } 1035 } 1036 }); 1037 } if (e.onUploadStart) { 1038 e.onUploadStart.call(this, d); 1039 } 1040 }, onUploadSuccess : function(f, h, d) { 1041 var g = this.settings; var e = this.getStats(); this.queueData.uploadsSuccessful = e.successful_uploads; this.queueData.queueBytesUploaded += f.size; if (c.inArray("onUploadSuccess", g.overrideEvents) < 0) { 1042 c("#" + f.id).find(".data").html(" - Complete"); 1043 } if (g.onUploadSuccess) { 1044 g.onUploadSuccess.call(this, f, h, d); 1045 } 1046 } 1047 }; c.fn.uploadify = function(d) { 1048 if (b [d]) { 1049 return b [d].apply(this, Array.prototype.slice.call(arguments, 1)); 1050 } else { 1051 if (typeof d === "object" || !d) { 1052 return b.init.apply(this, arguments); 1053 } else { 1054 c.error("The method " + d + " does not exist in $.uploadify"); 1055 } 1056 } 1057 }; 1058}) ($);
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.