jquery.uploadify.min.js 78 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979
  1. var swfobject = function() {
  2. var aq = "undefined",
  3. aD = "object",
  4. ab = "Shockwave Flash",
  5. X = "ShockwaveFlash.ShockwaveFlash",
  6. aE = "application/x-shockwave-flash",
  7. ac = "SWFObjectExprInst",
  8. ax = "onreadystatechange",
  9. af = window,
  10. aL = document,
  11. aB = navigator,
  12. aa = false,
  13. Z = [aN],
  14. aG = [],
  15. ag = [],
  16. al = [],
  17. aJ,
  18. ad,
  19. ap,
  20. at,
  21. ak = false,
  22. aU = false,
  23. aH,
  24. an,
  25. aI = true,
  26. ah = function() {
  27. var a = typeof aL.getElementById != aq && typeof aL.getElementsByTagName != aq && typeof aL.createElement != aq,
  28. e = aB.userAgent.toLowerCase(),
  29. c = aB.platform.toLowerCase(),
  30. h = c ? /win/.test(c) : /win/.test(e),
  31. j = c ? /mac/.test(c) : /mac/.test(e),
  32. g = /webkit/.test(e) ? parseFloat(e.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false,
  33. d = !+"\v1",
  34. f = [0, 0, 0],
  35. k = null;
  36. if (typeof aB.plugins != aq && typeof aB.plugins[ab] == aD) {
  37. k = aB.plugins[ab].description;
  38. if (k && !(typeof aB.mimeTypes != aq && aB.mimeTypes[aE] && !aB.mimeTypes[aE].enabledPlugin)) {
  39. aa = true;
  40. d = false;
  41. k = k.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
  42. f[0] = parseInt(k.replace(/^(.*)\..*$/, "$1"), 10);
  43. f[1] = parseInt(k.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
  44. f[2] = /[a-zA-Z]/.test(k) ? parseInt(k.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
  45. }
  46. } else {
  47. if (typeof af.ActiveXObject != aq) {
  48. try {
  49. var i = new ActiveXObject(X);
  50. if (i) {
  51. k = i.GetVariable("$version");
  52. if (k) {
  53. d = true;
  54. k = k.split(" ")[1].split(",");
  55. f = [parseInt(k[0], 10), parseInt(k[1], 10), parseInt(k[2], 10)];
  56. }
  57. }
  58. } catch(b) {}
  59. }
  60. }
  61. return {
  62. w3: a,
  63. pv: f,
  64. wk: g,
  65. ie: d,
  66. win: h,
  67. mac: j
  68. };
  69. } (),
  70. aK = function() {
  71. if (!ah.w3) {
  72. return;
  73. }
  74. if ((typeof aL.readyState != aq && aL.readyState == "complete") || (typeof aL.readyState == aq && (aL.getElementsByTagName("body")[0] || aL.body))) {
  75. aP();
  76. }
  77. if (!ak) {
  78. if (typeof aL.addEventListener != aq) {
  79. aL.addEventListener("DOMContentLoaded", aP, false);
  80. }
  81. if (ah.ie && ah.win) {
  82. aL.attachEvent(ax,
  83. function() {
  84. if (aL.readyState == "complete") {
  85. aL.detachEvent(ax, arguments.callee);
  86. aP();
  87. }
  88. });
  89. if (af == top) { (function() {
  90. if (ak) {
  91. return;
  92. }
  93. try {
  94. aL.documentElement.doScroll("left");
  95. } catch(a) {
  96. setTimeout(arguments.callee, 0);
  97. return;
  98. }
  99. aP();
  100. })();
  101. }
  102. }
  103. if (ah.wk) { (function() {
  104. if (ak) {
  105. return;
  106. }
  107. if (!/loaded|complete/.test(aL.readyState)) {
  108. setTimeout(arguments.callee, 0);
  109. return;
  110. }
  111. aP();
  112. })();
  113. }
  114. aC(aP);
  115. }
  116. } ();
  117. function aP() {
  118. if (ak) {
  119. return;
  120. }
  121. try {
  122. var b = aL.getElementsByTagName("body")[0].appendChild(ar("span"));
  123. b.parentNode.removeChild(b);
  124. } catch(a) {
  125. return;
  126. }
  127. ak = true;
  128. var d = Z.length;
  129. for (var c = 0; c < d; c++) {
  130. Z[c]();
  131. }
  132. }
  133. function aj(a) {
  134. if (ak) {
  135. a();
  136. } else {
  137. Z[Z.length] = a;
  138. }
  139. }
  140. function aC(a) {
  141. if (typeof af.addEventListener != aq) {
  142. af.addEventListener("load", a, false);
  143. } else {
  144. if (typeof aL.addEventListener != aq) {
  145. aL.addEventListener("load", a, false);
  146. } else {
  147. if (typeof af.attachEvent != aq) {
  148. aM(af, "onload", a);
  149. } else {
  150. if (typeof af.onload == "function") {
  151. var b = af.onload;
  152. af.onload = function() {
  153. b();
  154. a();
  155. };
  156. } else {
  157. af.onload = a;
  158. }
  159. }
  160. }
  161. }
  162. }
  163. function aN() {
  164. if (aa) {
  165. Y();
  166. } else {
  167. am();
  168. }
  169. }
  170. function Y() {
  171. var d = aL.getElementsByTagName("body")[0];
  172. var b = ar(aD);
  173. b.setAttribute("type", aE);
  174. var a = d.appendChild(b);
  175. if (a) {
  176. var c = 0; (function() {
  177. if (typeof a.GetVariable != aq) {
  178. var e = a.GetVariable("$version");
  179. if (e) {
  180. e = e.split(" ")[1].split(",");
  181. ah.pv = [parseInt(e[0], 10), parseInt(e[1], 10), parseInt(e[2], 10)];
  182. }
  183. } else {
  184. if (c < 10) {
  185. c++;
  186. setTimeout(arguments.callee, 10);
  187. return;
  188. }
  189. }
  190. d.removeChild(b);
  191. a = null;
  192. am();
  193. })();
  194. } else {
  195. am();
  196. }
  197. }
  198. function am() {
  199. var g = aG.length;
  200. if (g > 0) {
  201. for (var h = 0; h < g; h++) {
  202. var c = aG[h].id;
  203. var l = aG[h].callbackFn;
  204. var a = {
  205. success: false,
  206. id: c
  207. };
  208. if (ah.pv[0] > 0) {
  209. var i = aS(c);
  210. if (i) {
  211. if (ao(aG[h].swfVersion) && !(ah.wk && ah.wk < 312)) {
  212. ay(c, true);
  213. if (l) {
  214. a.success = true;
  215. a.ref = av(c);
  216. l(a);
  217. }
  218. } else {
  219. if (aG[h].expressInstall && au()) {
  220. var e = {};
  221. e.data = aG[h].expressInstall;
  222. e.width = i.getAttribute("width") || "0";
  223. e.height = i.getAttribute("height") || "0";
  224. if (i.getAttribute("class")) {
  225. e.styleclass = i.getAttribute("class");
  226. }
  227. if (i.getAttribute("align")) {
  228. e.align = i.getAttribute("align");
  229. }
  230. var f = {};
  231. var d = i.getElementsByTagName("param");
  232. var k = d.length;
  233. for (var j = 0; j < k; j++) {
  234. if (d[j].getAttribute("name").toLowerCase() != "movie") {
  235. f[d[j].getAttribute("name")] = d[j].getAttribute("value");
  236. }
  237. }
  238. ae(e, f, c, l);
  239. } else {
  240. aF(i);
  241. if (l) {
  242. l(a);
  243. }
  244. }
  245. }
  246. }
  247. } else {
  248. ay(c, true);
  249. if (l) {
  250. var b = av(c);
  251. if (b && typeof b.SetVariable != aq) {
  252. a.success = true;
  253. a.ref = b;
  254. }
  255. l(a);
  256. }
  257. }
  258. }
  259. }
  260. }
  261. function av(b) {
  262. var d = null;
  263. var c = aS(b);
  264. if (c && c.nodeName == "OBJECT") {
  265. if (typeof c.SetVariable != aq) {
  266. d = c;
  267. } else {
  268. var a = c.getElementsByTagName(aD)[0];
  269. if (a) {
  270. d = a;
  271. }
  272. }
  273. }
  274. return d;
  275. }
  276. function au() {
  277. return ! aU && ao("6.0.65") && (ah.win || ah.mac) && !(ah.wk && ah.wk < 312);
  278. }
  279. function ae(f, d, h, e) {
  280. aU = true;
  281. ap = e || null;
  282. at = {
  283. success: false,
  284. id: h
  285. };
  286. var a = aS(h);
  287. if (a) {
  288. if (a.nodeName == "OBJECT") {
  289. aJ = aO(a);
  290. ad = null;
  291. } else {
  292. aJ = a;
  293. ad = h;
  294. }
  295. f.id = ac;
  296. if (typeof f.width == aq || (!/%$/.test(f.width) && parseInt(f.width, 10) < 310)) {
  297. f.width = "310";
  298. }
  299. if (typeof f.height == aq || (!/%$/.test(f.height) && parseInt(f.height, 10) < 137)) {
  300. f.height = "137";
  301. }
  302. aL.title = aL.title.slice(0, 47) + " - Flash Player Installation";
  303. var b = ah.ie && ah.win ? "ActiveX": "PlugIn",
  304. c = "MMredirectURL=" + af.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + b + "&MMdoctitle=" + aL.title;
  305. if (typeof d.flashvars != aq) {
  306. d.flashvars += "&" + c;
  307. } else {
  308. d.flashvars = c;
  309. }
  310. if (ah.ie && ah.win && a.readyState != 4) {
  311. var g = ar("div");
  312. h += "SWFObjectNew";
  313. g.setAttribute("id", h);
  314. a.parentNode.insertBefore(g, a);
  315. a.style.display = "none"; (function() {
  316. if (a.readyState == 4) {
  317. a.parentNode.removeChild(a);
  318. } else {
  319. setTimeout(arguments.callee, 10);
  320. }
  321. })();
  322. }
  323. aA(f, d, h);
  324. }
  325. }
  326. function aF(a) {
  327. if (ah.ie && ah.win && a.readyState != 4) {
  328. var b = ar("div");
  329. a.parentNode.insertBefore(b, a);
  330. b.parentNode.replaceChild(aO(a), b);
  331. a.style.display = "none"; (function() {
  332. if (a.readyState == 4) {
  333. a.parentNode.removeChild(a);
  334. } else {
  335. setTimeout(arguments.callee, 10);
  336. }
  337. })();
  338. } else {
  339. a.parentNode.replaceChild(aO(a), a);
  340. }
  341. }
  342. function aO(b) {
  343. var d = ar("div");
  344. if (ah.win && ah.ie) {
  345. d.innerHTML = b.innerHTML;
  346. } else {
  347. var e = b.getElementsByTagName(aD)[0];
  348. if (e) {
  349. var a = e.childNodes;
  350. if (a) {
  351. var f = a.length;
  352. for (var c = 0; c < f; c++) {
  353. if (! (a[c].nodeType == 1 && a[c].nodeName == "PARAM") && !(a[c].nodeType == 8)) {
  354. d.appendChild(a[c].cloneNode(true));
  355. }
  356. }
  357. }
  358. }
  359. }
  360. return d;
  361. }
  362. function aA(e, g, c) {
  363. var d, a = aS(c);
  364. if (ah.wk && ah.wk < 312) {
  365. return d;
  366. }
  367. if (a) {
  368. if (typeof e.id == aq) {
  369. e.id = c;
  370. }
  371. if (ah.ie && ah.win) {
  372. var f = "";
  373. for (var i in e) {
  374. if (e[i] != Object.prototype[i]) {
  375. if (i.toLowerCase() == "data") {
  376. g.movie = e[i];
  377. } else {
  378. if (i.toLowerCase() == "styleclass") {
  379. f += ' class="' + e[i] + '"';
  380. } else {
  381. if (i.toLowerCase() != "classid") {
  382. f += " " + i + '="' + e[i] + '"';
  383. }
  384. }
  385. }
  386. }
  387. }
  388. var h = "";
  389. for (var j in g) {
  390. if (g[j] != Object.prototype[j]) {
  391. h += '<param name="' + j + '" value="' + g[j] + '" />';
  392. }
  393. }
  394. a.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + f + ">" + h + "</object>";
  395. ag[ag.length] = e.id;
  396. d = aS(e.id);
  397. } else {
  398. var b = ar(aD);
  399. b.setAttribute("type", aE);
  400. for (var k in e) {
  401. if (e[k] != Object.prototype[k]) {
  402. if (k.toLowerCase() == "styleclass") {
  403. b.setAttribute("class", e[k]);
  404. } else {
  405. if (k.toLowerCase() != "classid") {
  406. b.setAttribute(k, e[k]);
  407. }
  408. }
  409. }
  410. }
  411. for (var l in g) {
  412. if (g[l] != Object.prototype[l] && l.toLowerCase() != "movie") {
  413. aQ(b, l, g[l]);
  414. }
  415. }
  416. a.parentNode.replaceChild(b, a);
  417. d = b;
  418. }
  419. }
  420. return d;
  421. }
  422. function aQ(b, d, c) {
  423. var a = ar("param");
  424. a.setAttribute("name", d);
  425. a.setAttribute("value", c);
  426. b.appendChild(a);
  427. }
  428. function aw(a) {
  429. var b = aS(a);
  430. if (b && b.nodeName == "OBJECT") {
  431. if (ah.ie && ah.win) {
  432. b.style.display = "none"; (function() {
  433. if (b.readyState == 4) {
  434. aT(a);
  435. } else {
  436. setTimeout(arguments.callee, 10);
  437. }
  438. })();
  439. } else {
  440. b.parentNode.removeChild(b);
  441. }
  442. }
  443. }
  444. function aT(a) {
  445. var b = aS(a);
  446. if (b) {
  447. for (var c in b) {
  448. if (typeof b[c] == "function") {
  449. b[c] = null;
  450. }
  451. }
  452. b.parentNode.removeChild(b);
  453. }
  454. }
  455. function aS(a) {
  456. var c = null;
  457. try {
  458. c = aL.getElementById(a);
  459. } catch(b) {}
  460. return c;
  461. }
  462. function ar(a) {
  463. return aL.createElement(a);
  464. }
  465. function aM(a, c, b) {
  466. a.attachEvent(c, b);
  467. al[al.length] = [a, c, b];
  468. }
  469. function ao(a) {
  470. var b = ah.pv,
  471. c = a.split(".");
  472. c[0] = parseInt(c[0], 10);
  473. c[1] = parseInt(c[1], 10) || 0;
  474. c[2] = parseInt(c[2], 10) || 0;
  475. 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;
  476. }
  477. function az(b, f, a, c) {
  478. if (ah.ie && ah.mac) {
  479. return;
  480. }
  481. var e = aL.getElementsByTagName("head")[0];
  482. if (!e) {
  483. return;
  484. }
  485. var g = (a && typeof a == "string") ? a: "screen";
  486. if (c) {
  487. aH = null;
  488. an = null;
  489. }
  490. if (!aH || an != g) {
  491. var d = ar("style");
  492. d.setAttribute("type", "text/css");
  493. d.setAttribute("media", g);
  494. aH = e.appendChild(d);
  495. if (ah.ie && ah.win && typeof aL.styleSheets != aq && aL.styleSheets.length > 0) {
  496. aH = aL.styleSheets[aL.styleSheets.length - 1];
  497. }
  498. an = g;
  499. }
  500. if (ah.ie && ah.win) {
  501. if (aH && typeof aH.addRule == aD) {
  502. aH.addRule(b, f);
  503. }
  504. } else {
  505. if (aH && typeof aL.createTextNode != aq) {
  506. aH.appendChild(aL.createTextNode(b + " {" + f + "}"));
  507. }
  508. }
  509. }
  510. function ay(a, c) {
  511. if (!aI) {
  512. return;
  513. }
  514. var b = c ? "visible": "hidden";
  515. if (ak && aS(a)) {
  516. aS(a).style.visibility = b;
  517. } else {
  518. az("#" + a, "visibility:" + b);
  519. }
  520. }
  521. function ai(b) {
  522. var a = /[\\\"<>\.;]/;
  523. var c = a.exec(b) != null;
  524. return c && typeof encodeURIComponent != aq ? encodeURIComponent(b) : b;
  525. }
  526. var aR = function() {
  527. if (ah.ie && ah.win) {
  528. window.attachEvent("onunload",
  529. function() {
  530. var a = al.length;
  531. for (var b = 0; b < a; b++) {
  532. al[b][0].detachEvent(al[b][1], al[b][2]);
  533. }
  534. var d = ag.length;
  535. for (var c = 0; c < d; c++) {
  536. aw(ag[c]);
  537. }
  538. for (var e in ah) {
  539. ah[e] = null;
  540. }
  541. ah = null;
  542. for (var f in swfobject) {
  543. swfobject[f] = null;
  544. }
  545. swfobject = null;
  546. });
  547. }
  548. } ();
  549. return {
  550. registerObject: function(a, e, c, b) {
  551. if (ah.w3 && a && e) {
  552. var d = {};
  553. d.id = a;
  554. d.swfVersion = e;
  555. d.expressInstall = c;
  556. d.callbackFn = b;
  557. aG[aG.length] = d;
  558. ay(a, false);
  559. } else {
  560. if (b) {
  561. b({
  562. success: false,
  563. id: a
  564. });
  565. }
  566. }
  567. },
  568. getObjectById: function(a) {
  569. if (ah.w3) {
  570. return av(a);
  571. }
  572. },
  573. embedSWF: function(k, e, h, f, c, a, b, i, g, j) {
  574. var d = {
  575. success: false,
  576. id: e
  577. };
  578. if (ah.w3 && !(ah.wk && ah.wk < 312) && k && e && h && f && c) {
  579. ay(e, false);
  580. aj(function() {
  581. h += "";
  582. f += "";
  583. var q = {};
  584. if (g && typeof g === aD) {
  585. for (var o in g) {
  586. q[o] = g[o];
  587. }
  588. }
  589. q.data = k;
  590. q.width = h;
  591. q.height = f;
  592. var n = {};
  593. if (i && typeof i === aD) {
  594. for (var p in i) {
  595. n[p] = i[p];
  596. }
  597. }
  598. if (b && typeof b === aD) {
  599. for (var l in b) {
  600. if (typeof n.flashvars != aq) {
  601. n.flashvars += "&" + l + "=" + b[l];
  602. } else {
  603. n.flashvars = l + "=" + b[l];
  604. }
  605. }
  606. }
  607. if (ao(c)) {
  608. var m = aA(q, n, e);
  609. if (q.id == e) {
  610. ay(e, true);
  611. }
  612. d.success = true;
  613. d.ref = m;
  614. } else {
  615. if (a && au()) {
  616. q.data = a;
  617. ae(q, n, e, j);
  618. return;
  619. } else {
  620. ay(e, true);
  621. }
  622. }
  623. if (j) {
  624. j(d);
  625. }
  626. });
  627. } else {
  628. if (j) {
  629. j(d);
  630. }
  631. }
  632. },
  633. switchOffAutoHideShow: function() {
  634. aI = false;
  635. },
  636. ua: ah,
  637. getFlashPlayerVersion: function() {
  638. return {
  639. major: ah.pv[0],
  640. minor: ah.pv[1],
  641. release: ah.pv[2]
  642. };
  643. },
  644. hasFlashPlayerVersion: ao,
  645. createSWF: function(a, b, c) {
  646. if (ah.w3) {
  647. return aA(a, b, c);
  648. } else {
  649. return undefined;
  650. }
  651. },
  652. showExpressInstall: function(b, a, d, c) {
  653. if (ah.w3 && au()) {
  654. ae(b, a, d, c);
  655. }
  656. },
  657. removeSWF: function(a) {
  658. if (ah.w3) {
  659. aw(a);
  660. }
  661. },
  662. createCSS: function(b, a, c, d) {
  663. if (ah.w3) {
  664. az(b, a, c, d);
  665. }
  666. },
  667. addDomLoadEvent: aj,
  668. addLoadEvent: aC,
  669. getQueryParamValue: function(b) {
  670. var a = aL.location.search || aL.location.hash;
  671. if (a) {
  672. if (/\?/.test(a)) {
  673. a = a.split("?")[1];
  674. }
  675. if (b == null) {
  676. return ai(a);
  677. }
  678. var c = a.split("&");
  679. for (var d = 0; d < c.length; d++) {
  680. if (c[d].substring(0, c[d].indexOf("=")) == b) {
  681. return ai(c[d].substring((c[d].indexOf("=") + 1)));
  682. }
  683. }
  684. }
  685. return "";
  686. },
  687. expressInstallCallback: function() {
  688. if (aU) {
  689. var a = aS(ac);
  690. if (a && aJ) {
  691. a.parentNode.replaceChild(aJ, a);
  692. if (ad) {
  693. ay(ad, true);
  694. if (ah.ie && ah.win) {
  695. aJ.style.display = "block";
  696. }
  697. }
  698. if (ap) {
  699. ap(at);
  700. }
  701. }
  702. aU = false;
  703. }
  704. }
  705. };
  706. } ();
  707. var SWFUpload;
  708. if (SWFUpload == undefined) {
  709. SWFUpload = function(b) {
  710. this.initSWFUpload(b);
  711. };
  712. }
  713. SWFUpload.prototype.initSWFUpload = function(c) {
  714. try {
  715. this.customSettings = {};
  716. this.settings = c;
  717. this.eventQueue = [];
  718. this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
  719. this.movieElement = null;
  720. SWFUpload.instances[this.movieName] = this;
  721. this.initSettings();
  722. this.loadFlash();
  723. this.displayDebugInfo();
  724. } catch(d) {
  725. delete SWFUpload.instances[this.movieName];
  726. throw d;
  727. }
  728. };
  729. SWFUpload.instances = {};
  730. SWFUpload.movieCount = 0;
  731. SWFUpload.version = "2.2.0 2009-03-25";
  732. SWFUpload.QUEUE_ERROR = {
  733. QUEUE_LIMIT_EXCEEDED: -100,
  734. FILE_EXCEEDS_SIZE_LIMIT: -110,
  735. ZERO_BYTE_FILE: -120,
  736. INVALID_FILETYPE: -130
  737. };
  738. SWFUpload.UPLOAD_ERROR = {
  739. HTTP_ERROR: -200,
  740. MISSING_UPLOAD_URL: -210,
  741. IO_ERROR: -220,
  742. SECURITY_ERROR: -230,
  743. UPLOAD_LIMIT_EXCEEDED: -240,
  744. UPLOAD_FAILED: -250,
  745. SPECIFIED_FILE_ID_NOT_FOUND: -260,
  746. FILE_VALIDATION_FAILED: -270,
  747. FILE_CANCELLED: -280,
  748. UPLOAD_STOPPED: -290
  749. };
  750. SWFUpload.FILE_STATUS = {
  751. QUEUED: -1,
  752. IN_PROGRESS: -2,
  753. ERROR: -3,
  754. COMPLETE: -4,
  755. CANCELLED: -5
  756. };
  757. SWFUpload.BUTTON_ACTION = {
  758. SELECT_FILE: -100,
  759. SELECT_FILES: -110,
  760. START_UPLOAD: -120
  761. };
  762. SWFUpload.CURSOR = {
  763. ARROW: -1,
  764. HAND: -2
  765. };
  766. SWFUpload.WINDOW_MODE = {
  767. WINDOW: "window",
  768. TRANSPARENT: "transparent",
  769. OPAQUE: "opaque"
  770. };
  771. SWFUpload.completeURL = function(e) {
  772. if (typeof(e) !== "string" || e.match(/^https?:\/\//i) || e.match(/^\//)) {
  773. return e;
  774. }
  775. var f = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port: "");
  776. var d = window.location.pathname.lastIndexOf("/");
  777. if (d <= 0) {
  778. path = "/";
  779. } else {
  780. path = window.location.pathname.substr(0, d) + "/";
  781. }
  782. return path + e;
  783. };
  784. SWFUpload.prototype.initSettings = function() {
  785. this.ensureDefault = function(c, d) {
  786. this.settings[c] = (this.settings[c] == undefined) ? d: this.settings[c];
  787. };
  788. this.ensureDefault("upload_url", "");
  789. this.ensureDefault("preserve_relative_urls", false);
  790. this.ensureDefault("file_post_name", "Filedata");
  791. this.ensureDefault("post_params", {});
  792. this.ensureDefault("use_query_string", false);
  793. this.ensureDefault("requeue_on_error", false);
  794. this.ensureDefault("http_success", []);
  795. this.ensureDefault("assume_success_timeout", 0);
  796. this.ensureDefault("file_types", "*.*");
  797. this.ensureDefault("file_types_description", "All Files");
  798. this.ensureDefault("file_size_limit", 0);
  799. this.ensureDefault("file_upload_limit", 0);
  800. this.ensureDefault("file_queue_limit", 0);
  801. this.ensureDefault("flash_url", "swfupload.swf");
  802. this.ensureDefault("prevent_swf_caching", true);
  803. this.ensureDefault("button_image_url", "");
  804. this.ensureDefault("button_width", 1);
  805. this.ensureDefault("button_height", 1);
  806. this.ensureDefault("button_text", "");
  807. this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;");
  808. this.ensureDefault("button_text_top_padding", 0);
  809. this.ensureDefault("button_text_left_padding", 0);
  810. this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
  811. this.ensureDefault("button_disabled", false);
  812. this.ensureDefault("button_placeholder_id", "");
  813. this.ensureDefault("button_placeholder", null);
  814. this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);
  815. this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);
  816. this.ensureDefault("debug", false);
  817. this.settings.debug_enabled = this.settings.debug;
  818. this.settings.return_upload_start_handler = this.returnUploadStart;
  819. this.ensureDefault("swfupload_loaded_handler", null);
  820. this.ensureDefault("file_dialog_start_handler", null);
  821. this.ensureDefault("file_queued_handler", null);
  822. this.ensureDefault("file_queue_error_handler", null);
  823. this.ensureDefault("file_dialog_complete_handler", null);
  824. this.ensureDefault("upload_start_handler", null);
  825. this.ensureDefault("upload_progress_handler", null);
  826. this.ensureDefault("upload_error_handler", null);
  827. this.ensureDefault("upload_success_handler", null);
  828. this.ensureDefault("upload_complete_handler", null);
  829. this.ensureDefault("debug_handler", this.debugMessage);
  830. this.ensureDefault("custom_settings", {});
  831. this.customSettings = this.settings.custom_settings;
  832. if ( !! this.settings.prevent_swf_caching) {
  833. this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?": "&") + "preventswfcaching=" + new Date().getTime();
  834. }
  835. if (!this.settings.preserve_relative_urls) {
  836. this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);
  837. this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);
  838. }
  839. delete this.ensureDefault;
  840. };
  841. SWFUpload.prototype.loadFlash = function() {
  842. var d, c;
  843. if (document.getElementById(this.movieName) !== null) {
  844. throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
  845. }
  846. d = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;
  847. if (d == undefined) {
  848. throw "Could not find the placeholder element: " + this.settings.button_placeholder_id;
  849. }
  850. c = document.createElement("div");
  851. c.innerHTML = this.getFlashHTML();
  852. d.parentNode.replaceChild(c.firstChild, d);
  853. if (window[this.movieName] == undefined) {
  854. window[this.movieName] = this.getMovieElement();
  855. }
  856. };
  857. SWFUpload.prototype.getFlashHTML = function() {
  858. 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("");
  859. };
  860. SWFUpload.prototype.getFlashVars = function() {
  861. var c = this.buildParamString();
  862. var d = this.settings.http_success.join(",");
  863. return ["movieName=", encodeURIComponent(this.movieName), "&amp;uploadURL=", encodeURIComponent(this.settings.upload_url), "&amp;useQueryString=", encodeURIComponent(this.settings.use_query_string), "&amp;requeueOnError=", encodeURIComponent(this.settings.requeue_on_error), "&amp;httpSuccess=", encodeURIComponent(d), "&amp;assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout), "&amp;params=", encodeURIComponent(c), "&amp;filePostName=", encodeURIComponent(this.settings.file_post_name), "&amp;fileTypes=", encodeURIComponent(this.settings.file_types), "&amp;fileTypesDescription=", encodeURIComponent(this.settings.file_types_description), "&amp;fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit), "&amp;fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit), "&amp;fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit), "&amp;debugEnabled=", encodeURIComponent(this.settings.debug_enabled), "&amp;buttonImageURL=", encodeURIComponent(this.settings.button_image_url), "&amp;buttonWidth=", encodeURIComponent(this.settings.button_width), "&amp;buttonHeight=", encodeURIComponent(this.settings.button_height), "&amp;buttonText=", encodeURIComponent(this.settings.button_text), "&amp;buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding), "&amp;buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding), "&amp;buttonTextStyle=", encodeURIComponent(this.settings.button_text_style), "&amp;buttonAction=", encodeURIComponent(this.settings.button_action), "&amp;buttonDisabled=", encodeURIComponent(this.settings.button_disabled), "&amp;buttonCursor=", encodeURIComponent(this.settings.button_cursor)].join("");
  864. };
  865. SWFUpload.prototype.getMovieElement = function() {
  866. if (this.movieElement == undefined) {
  867. this.movieElement = document.getElementById(this.movieName);
  868. }
  869. if (this.movieElement === null) {
  870. throw "Could not find Flash element";
  871. }
  872. return this.movieElement;
  873. };
  874. SWFUpload.prototype.buildParamString = function() {
  875. var f = this.settings.post_params;
  876. var d = [];
  877. if (typeof(f) === "object") {
  878. for (var e in f) {
  879. if (f.hasOwnProperty(e)) {
  880. d.push(encodeURIComponent(e.toString()) + "=" + encodeURIComponent(f[e].toString()));
  881. }
  882. }
  883. }
  884. return d.join("&amp;");
  885. };
  886. SWFUpload.prototype.destroy = function() {
  887. try {
  888. this.cancelUpload(null, false);
  889. var g = null;
  890. g = this.getMovieElement();
  891. if (g && typeof(g.CallFunction) === "unknown") {
  892. for (var j in g) {
  893. try {
  894. if (typeof(g[j]) === "function") {
  895. g[j] = null;
  896. }
  897. } catch(h) {}
  898. }
  899. try {
  900. g.parentNode.removeChild(g);
  901. } catch(f) {}
  902. }
  903. window[this.movieName] = null;
  904. SWFUpload.instances[this.movieName] = null;
  905. delete SWFUpload.instances[this.movieName];
  906. this.movieElement = null;
  907. this.settings = null;
  908. this.customSettings = null;
  909. this.eventQueue = null;
  910. this.movieName = null;
  911. return true;
  912. } catch(i) {
  913. return false;
  914. }
  915. };
  916. SWFUpload.prototype.displayDebugInfo = function() {
  917. 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(""));
  918. };
  919. SWFUpload.prototype.addSetting = function(d, f, e) {
  920. if (f == undefined) {
  921. return (this.settings[d] = e);
  922. } else {
  923. return (this.settings[d] = f);
  924. }
  925. };
  926. SWFUpload.prototype.getSetting = function(b) {
  927. if (this.settings[b] != undefined) {
  928. return this.settings[b];
  929. }
  930. return "";
  931. };
  932. SWFUpload.prototype.callFlash = function(functionName, argumentArray) {
  933. argumentArray = argumentArray || [];
  934. var movieElement = this.getMovieElement();
  935. var returnValue, returnString;
  936. try {
  937. returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + "</invoke>");
  938. returnValue = eval(returnString);
  939. } catch(ex) {
  940. throw "Call to " + functionName + " failed";
  941. }
  942. if (returnValue != undefined && typeof returnValue.post === "object") {
  943. returnValue = this.unescapeFilePostParams(returnValue);
  944. }
  945. return returnValue;
  946. };
  947. SWFUpload.prototype.selectFile = function() {
  948. this.callFlash("SelectFile");
  949. };
  950. SWFUpload.prototype.selectFiles = function() {
  951. this.callFlash("SelectFiles");
  952. };
  953. SWFUpload.prototype.startUpload = function(b) {
  954. this.callFlash("StartUpload", [b]);
  955. };
  956. SWFUpload.prototype.cancelUpload = function(d, c) {
  957. if (c !== false) {
  958. c = true;
  959. }
  960. this.callFlash("CancelUpload", [d, c]);
  961. };
  962. SWFUpload.prototype.stopUpload = function() {
  963. this.callFlash("StopUpload");
  964. };
  965. SWFUpload.prototype.getStats = function() {
  966. return this.callFlash("GetStats");
  967. };
  968. SWFUpload.prototype.setStats = function(b) {
  969. this.callFlash("SetStats", [b]);
  970. };
  971. SWFUpload.prototype.getFile = function(b) {
  972. if (typeof(b) === "number") {
  973. return this.callFlash("GetFileByIndex", [b]);
  974. } else {
  975. return this.callFlash("GetFile", [b]);
  976. }
  977. };
  978. SWFUpload.prototype.addFileParam = function(e, d, f) {
  979. return this.callFlash("AddFileParam", [e, d, f]);
  980. };
  981. SWFUpload.prototype.removeFileParam = function(d, c) {
  982. this.callFlash("RemoveFileParam", [d, c]);
  983. };
  984. SWFUpload.prototype.setUploadURL = function(b) {
  985. this.settings.upload_url = b.toString();
  986. this.callFlash("SetUploadURL", [b]);
  987. };
  988. SWFUpload.prototype.setPostParams = function(b) {
  989. this.settings.post_params = b;
  990. this.callFlash("SetPostParams", [b]);
  991. };
  992. SWFUpload.prototype.addPostParam = function(d, c) {
  993. this.settings.post_params[d] = c;
  994. this.callFlash("SetPostParams", [this.settings.post_params]);
  995. };
  996. SWFUpload.prototype.removePostParam = function(b) {
  997. delete this.settings.post_params[b];
  998. this.callFlash("SetPostParams", [this.settings.post_params]);
  999. };
  1000. SWFUpload.prototype.setFileTypes = function(d, c) {
  1001. this.settings.file_types = d;
  1002. this.settings.file_types_description = c;
  1003. this.callFlash("SetFileTypes", [d, c]);
  1004. };
  1005. SWFUpload.prototype.setFileSizeLimit = function(b) {
  1006. this.settings.file_size_limit = b;
  1007. this.callFlash("SetFileSizeLimit", [b]);
  1008. };
  1009. SWFUpload.prototype.setFileUploadLimit = function(b) {
  1010. this.settings.file_upload_limit = b;
  1011. this.callFlash("SetFileUploadLimit", [b]);
  1012. };
  1013. SWFUpload.prototype.setFileQueueLimit = function(b) {
  1014. this.settings.file_queue_limit = b;
  1015. this.callFlash("SetFileQueueLimit", [b]);
  1016. };
  1017. SWFUpload.prototype.setFilePostName = function(b) {
  1018. this.settings.file_post_name = b;
  1019. this.callFlash("SetFilePostName", [b]);
  1020. };
  1021. SWFUpload.prototype.setUseQueryString = function(b) {
  1022. this.settings.use_query_string = b;
  1023. this.callFlash("SetUseQueryString", [b]);
  1024. };
  1025. SWFUpload.prototype.setRequeueOnError = function(b) {
  1026. this.settings.requeue_on_error = b;
  1027. this.callFlash("SetRequeueOnError", [b]);
  1028. };
  1029. SWFUpload.prototype.setHTTPSuccess = function(b) {
  1030. if (typeof b === "string") {
  1031. b = b.replace(" ", "").split(",");
  1032. }
  1033. this.settings.http_success = b;
  1034. this.callFlash("SetHTTPSuccess", [b]);
  1035. };
  1036. SWFUpload.prototype.setAssumeSuccessTimeout = function(b) {
  1037. this.settings.assume_success_timeout = b;
  1038. this.callFlash("SetAssumeSuccessTimeout", [b]);
  1039. };
  1040. SWFUpload.prototype.setDebugEnabled = function(b) {
  1041. this.settings.debug_enabled = b;
  1042. this.callFlash("SetDebugEnabled", [b]);
  1043. };
  1044. SWFUpload.prototype.setButtonImageURL = function(b) {
  1045. if (b == undefined) {
  1046. b = "";
  1047. }
  1048. this.settings.button_image_url = b;
  1049. this.callFlash("SetButtonImageURL", [b]);
  1050. };
  1051. SWFUpload.prototype.setButtonDimensions = function(f, e) {
  1052. this.settings.button_width = f;
  1053. this.settings.button_height = e;
  1054. var d = this.getMovieElement();
  1055. if (d != undefined) {
  1056. d.style.width = f + "px";
  1057. d.style.height = e + "px";
  1058. }
  1059. this.callFlash("SetButtonDimensions", [f, e]);
  1060. };
  1061. SWFUpload.prototype.setButtonText = function(b) {
  1062. this.settings.button_text = b;
  1063. this.callFlash("SetButtonText", [b]);
  1064. };
  1065. SWFUpload.prototype.setButtonTextPadding = function(c, d) {
  1066. this.settings.button_text_top_padding = d;
  1067. this.settings.button_text_left_padding = c;
  1068. this.callFlash("SetButtonTextPadding", [c, d]);
  1069. };
  1070. SWFUpload.prototype.setButtonTextStyle = function(b) {
  1071. this.settings.button_text_style = b;
  1072. this.callFlash("SetButtonTextStyle", [b]);
  1073. };
  1074. SWFUpload.prototype.setButtonDisabled = function(b) {
  1075. this.settings.button_disabled = b;
  1076. this.callFlash("SetButtonDisabled", [b]);
  1077. };
  1078. SWFUpload.prototype.setButtonAction = function(b) {
  1079. this.settings.button_action = b;
  1080. this.callFlash("SetButtonAction", [b]);
  1081. };
  1082. SWFUpload.prototype.setButtonCursor = function(b) {
  1083. this.settings.button_cursor = b;
  1084. this.callFlash("SetButtonCursor", [b]);
  1085. };
  1086. SWFUpload.prototype.queueEvent = function(d, f) {
  1087. if (f == undefined) {
  1088. f = [];
  1089. } else {
  1090. if (! (f instanceof Array)) {
  1091. f = [f];
  1092. }
  1093. }
  1094. var e = this;
  1095. if (typeof this.settings[d] === "function") {
  1096. this.eventQueue.push(function() {
  1097. this.settings[d].apply(this, f);
  1098. });
  1099. setTimeout(function() {
  1100. e.executeNextEvent();
  1101. },
  1102. 0);
  1103. } else {
  1104. if (this.settings[d] !== null) {
  1105. throw "Event handler " + d + " is unknown or is not a function";
  1106. }
  1107. }
  1108. };
  1109. SWFUpload.prototype.executeNextEvent = function() {
  1110. var b = this.eventQueue ? this.eventQueue.shift() : null;
  1111. if (typeof(b) === "function") {
  1112. b.apply(this);
  1113. }
  1114. };
  1115. SWFUpload.prototype.unescapeFilePostParams = function(l) {
  1116. var j = /[$]([0-9a-f]{4})/i;
  1117. var i = {};
  1118. var k;
  1119. if (l != undefined) {
  1120. for (var h in l.post) {
  1121. if (l.post.hasOwnProperty(h)) {
  1122. k = h;
  1123. var g;
  1124. while ((g = j.exec(k)) !== null) {
  1125. k = k.replace(g[0], String.fromCharCode(parseInt("0x" + g[1], 16)));
  1126. }
  1127. i[k] = l.post[h];
  1128. }
  1129. }
  1130. l.post = i;
  1131. }
  1132. return l;
  1133. };
  1134. SWFUpload.prototype.testExternalInterface = function() {
  1135. try {
  1136. return this.callFlash("TestExternalInterface");
  1137. } catch(b) {
  1138. return false;
  1139. }
  1140. };
  1141. SWFUpload.prototype.flashReady = function() {
  1142. var b = this.getMovieElement();
  1143. if (!b) {
  1144. this.debug("Flash called back ready but the flash movie can't be found.");
  1145. return;
  1146. }
  1147. this.cleanUp(b);
  1148. this.queueEvent("swfupload_loaded_handler");
  1149. };
  1150. SWFUpload.prototype.cleanUp = function(f) {
  1151. try {
  1152. if (this.movieElement && typeof(f.CallFunction) === "unknown") {
  1153. this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
  1154. for (var h in f) {
  1155. try {
  1156. if (typeof(f[h]) === "function") {
  1157. f[h] = null;
  1158. }
  1159. } catch(e) {}
  1160. }
  1161. }
  1162. } catch(g) {}
  1163. window.__flash__removeCallback = function(c, b) {
  1164. try {
  1165. if (c) {
  1166. c[b] = null;
  1167. }
  1168. } catch(a) {}
  1169. };
  1170. };
  1171. SWFUpload.prototype.fileDialogStart = function() {
  1172. this.queueEvent("file_dialog_start_handler");
  1173. };
  1174. SWFUpload.prototype.fileQueued = function(b) {
  1175. b = this.unescapeFilePostParams(b);
  1176. this.queueEvent("file_queued_handler", b);
  1177. };
  1178. SWFUpload.prototype.fileQueueError = function(e, f, d) {
  1179. e = this.unescapeFilePostParams(e);
  1180. this.queueEvent("file_queue_error_handler", [e, f, d]);
  1181. };
  1182. SWFUpload.prototype.fileDialogComplete = function(d, f, e) {
  1183. this.queueEvent("file_dialog_complete_handler", [d, f, e]);
  1184. };
  1185. SWFUpload.prototype.uploadStart = function(b) {
  1186. b = this.unescapeFilePostParams(b);
  1187. this.queueEvent("return_upload_start_handler", b);
  1188. };
  1189. SWFUpload.prototype.returnUploadStart = function(d) {
  1190. var c;
  1191. if (typeof this.settings.upload_start_handler === "function") {
  1192. d = this.unescapeFilePostParams(d);
  1193. c = this.settings.upload_start_handler.call(this, d);
  1194. } else {
  1195. if (this.settings.upload_start_handler != undefined) {
  1196. throw "upload_start_handler must be a function";
  1197. }
  1198. }
  1199. if (c === undefined) {
  1200. c = true;
  1201. }
  1202. c = !!c;
  1203. this.callFlash("ReturnUploadStart", [c]);
  1204. };
  1205. SWFUpload.prototype.uploadProgress = function(e, f, d) {
  1206. e = this.unescapeFilePostParams(e);
  1207. this.queueEvent("upload_progress_handler", [e, f, d]);
  1208. };
  1209. SWFUpload.prototype.uploadError = function(e, f, d) {
  1210. e = this.unescapeFilePostParams(e);
  1211. this.queueEvent("upload_error_handler", [e, f, d]);
  1212. };
  1213. SWFUpload.prototype.uploadSuccess = function(d, e, f) {
  1214. d = this.unescapeFilePostParams(d);
  1215. this.queueEvent("upload_success_handler", [d, e, f]);
  1216. };
  1217. SWFUpload.prototype.uploadComplete = function(b) {
  1218. b = this.unescapeFilePostParams(b);
  1219. this.queueEvent("upload_complete_handler", b);
  1220. };
  1221. SWFUpload.prototype.debug = function(b) {
  1222. this.queueEvent("debug_handler", b);
  1223. };
  1224. SWFUpload.prototype.debugMessage = function(h) {
  1225. if (this.settings.debug) {
  1226. var f, g = [];
  1227. if (typeof h === "object" && typeof h.name === "string" && typeof h.message === "string") {
  1228. for (var e in h) {
  1229. if (h.hasOwnProperty(e)) {
  1230. g.push(e + ": " + h[e]);
  1231. }
  1232. }
  1233. f = g.join("\n") || "";
  1234. g = f.split("\n");
  1235. f = "EXCEPTION: " + g.join("\nEXCEPTION: ");
  1236. SWFUpload.Console.writeLine(f);
  1237. } else {
  1238. SWFUpload.Console.writeLine(h);
  1239. }
  1240. }
  1241. };
  1242. SWFUpload.Console = {};
  1243. SWFUpload.Console.writeLine = function(g) {
  1244. var e, f;
  1245. try {
  1246. e = document.getElementById("SWFUpload_Console");
  1247. if (!e) {
  1248. f = document.createElement("form");
  1249. document.getElementsByTagName("body")[0].appendChild(f);
  1250. e = document.createElement("textarea");
  1251. e.id = "SWFUpload_Console";
  1252. e.style.fontFamily = "monospace";
  1253. e.setAttribute("wrap", "off");
  1254. e.wrap = "off";
  1255. e.style.overflow = "auto";
  1256. e.style.width = "700px";
  1257. e.style.height = "350px";
  1258. e.style.margin = "5px";
  1259. f.appendChild(e);
  1260. }
  1261. e.value += g + "\n";
  1262. e.scrollTop = e.scrollHeight - e.clientHeight;
  1263. } catch(h) {
  1264. alert("Exception: " + h.name + " Message: " + h.message);
  1265. }
  1266. }; (function(c) {
  1267. var b = {
  1268. init: function(d, e) {
  1269. return this.each(function() {
  1270. var n = c(this);
  1271. var m = n.clone();
  1272. var j = c.extend({
  1273. id: n.attr("id"),
  1274. swf: "uploadify.swf",
  1275. uploader: "uploadify.php",
  1276. auto: true,
  1277. buttonClass: "",
  1278. buttonCursor: "hand",
  1279. buttonImage: null,
  1280. buttonText: "",
  1281. checkExisting: false,
  1282. debug: false,
  1283. fileObjName: "Filedata",
  1284. fileSizeLimit: 0,
  1285. fileTypeDesc: "ͼƬÎļþ",
  1286. fileTypeExts: "*.jpg;*.jpeg;*.gif;*.png",
  1287. height:42,
  1288. itemTemplate: false,
  1289. method: "post",
  1290. multi: true,
  1291. formData: {},
  1292. preventCaching: true,
  1293. progressData: "percentage",
  1294. queueID: false,
  1295. queueSizeLimit: 999,
  1296. removeCompleted: true,
  1297. removeTimeout: 3,
  1298. requeueErrors: false,
  1299. successTimeout: 30,
  1300. uploadLimit: 0,
  1301. width: 203,
  1302. overrideEvents: []
  1303. },
  1304. d);
  1305. var g = {
  1306. assume_success_timeout: j.successTimeout,
  1307. button_placeholder_id: j.id,
  1308. button_width: j.width,
  1309. button_height: j.height,
  1310. button_text: null,
  1311. button_text_style: null,
  1312. button_text_top_padding: 0,
  1313. button_text_left_padding: 0,
  1314. button_action: (j.multi ? SWFUpload.BUTTON_ACTION.SELECT_FILES: SWFUpload.BUTTON_ACTION.SELECT_FILE),
  1315. button_disabled: false,
  1316. button_cursor: (j.buttonCursor == "arrow" ? SWFUpload.CURSOR.ARROW: SWFUpload.CURSOR.HAND),
  1317. button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
  1318. debug: j.debug,
  1319. requeue_on_error: j.requeueErrors,
  1320. file_post_name: j.fileObjName,
  1321. file_size_limit: j.fileSizeLimit,
  1322. file_types: j.fileTypeExts,
  1323. file_types_description: j.fileTypeDesc,
  1324. file_queue_limit: j.queueSizeLimit,
  1325. file_upload_limit: j.uploadLimit,
  1326. flash_url: j.swf,
  1327. prevent_swf_caching: j.preventCaching,
  1328. post_params: j.formData,
  1329. upload_url: j.uploader,
  1330. use_query_string: (j.method == "get"),
  1331. file_dialog_complete_handler: a.onDialogClose,
  1332. file_dialog_start_handler: a.onDialogOpen,
  1333. file_queued_handler: a.onSelect,
  1334. file_queue_error_handler: a.onSelectError,
  1335. swfupload_loaded_handler: j.onSWFReady,
  1336. upload_complete_handler: a.onUploadComplete,
  1337. upload_error_handler: a.onUploadError,
  1338. upload_progress_handler: a.onUploadProgress,
  1339. upload_start_handler: a.onUploadStart,
  1340. upload_success_handler: a.onUploadSuccess
  1341. };
  1342. if (e) {
  1343. g = c.extend(g, e);
  1344. }
  1345. g = c.extend(g, j);
  1346. var o = swfobject.getFlashPlayerVersion();
  1347. var h = (o.major >= 9);
  1348. if (h) {
  1349. window["uploadify_" + j.id] = new SWFUpload(g);
  1350. var i = window["uploadify_" + j.id];
  1351. n.data("uploadify", i);
  1352. var l = c("<div />", {
  1353. id: j.id,
  1354. "class": "uploadify",
  1355. css: {
  1356. height: j.height + "px",
  1357. width: j.width + "px"
  1358. }
  1359. });
  1360. c("#" + i.movieName).wrap(l);
  1361. l = c("#" + j.id);
  1362. l.data("uploadify", i);
  1363. var f = c("<div />", {
  1364. id: j.id + "-button",
  1365. "class": "uploadify-button " + j.buttonClass
  1366. });
  1367. if (j.buttonImage) {
  1368. f.css({
  1369. "background-image": "url('" + j.buttonImage + "')",
  1370. "text-indent": "-9999px"
  1371. });
  1372. }
  1373. f.html('<span class="uploadify-button-text">' + j.buttonText + "</span>").css({
  1374. height: j.height + "px",
  1375. "line-height": j.height + "px",
  1376. width: j.width + "px"
  1377. });
  1378. l.append(f);
  1379. c("#" + i.movieName).css({
  1380. position: "absolute",
  1381. "z-index": 1
  1382. });
  1383. if (!j.queueID) {
  1384. var k = c("<div />", {
  1385. id: j.id + "-queue",
  1386. "class": "uploadify-queue"
  1387. });
  1388. l.after(k);
  1389. i.settings.queueID = j.id + "-queue";
  1390. i.settings.defaultQueue = true;
  1391. }
  1392. i.queueData = {
  1393. files: {},
  1394. filesSelected: 0,
  1395. filesQueued: 0,
  1396. filesReplaced: 0,
  1397. filesCancelled: 0,
  1398. filesErrored: 0,
  1399. uploadsSuccessful: 0,
  1400. uploadsErrored: 0,
  1401. averageSpeed: 0,
  1402. queueLength: 0,
  1403. queueSize: 0,
  1404. uploadSize: 0,
  1405. queueBytesUploaded: 0,
  1406. uploadQueue: [],
  1407. errorMsg: "Some files were not added to the queue:"
  1408. };
  1409. i.original = m;
  1410. i.wrapper = l;
  1411. i.button = f;
  1412. i.queue = k;
  1413. if (j.onInit) {
  1414. j.onInit.call(n, i);
  1415. }
  1416. } else {
  1417. if (j.onFallback) {
  1418. j.onFallback.call(n);
  1419. }
  1420. }
  1421. });
  1422. },
  1423. cancel: function(d, f) {
  1424. var e = arguments;
  1425. this.each(function() {
  1426. var l = c(this),
  1427. i = l.data("uploadify"),
  1428. j = i.settings,
  1429. h = -1;
  1430. if (e[0]) {
  1431. if (e[0] == "*") {
  1432. var g = i.queueData.queueLength;
  1433. c("#" + j.queueID).find(".uploadify-queue-item").each(function() {
  1434. h++;
  1435. if (e[1] === true) {
  1436. i.cancelUpload(c(this).attr("id"), false);
  1437. } else {
  1438. i.cancelUpload(c(this).attr("id"));
  1439. }
  1440. c(this).find(".data").removeClass("data").html(" - Cancelled");
  1441. c(this).find(".uploadify-progress-bar").remove();
  1442. c(this).delay(1000 + 100 * h).fadeOut(500,
  1443. function() {
  1444. c(this).remove();
  1445. });
  1446. });
  1447. i.queueData.queueSize = 0;
  1448. i.queueData.queueLength = 0;
  1449. if (j.onClearQueue) {
  1450. j.onClearQueue.call(l, g);
  1451. }
  1452. } else {
  1453. for (var m = 0; m < e.length; m++) {
  1454. i.cancelUpload(e[m]);
  1455. c("#" + e[m]).find(".data").removeClass("data").html(" - Cancelled");
  1456. c("#" + e[m]).find(".uploadify-progress-bar").remove();
  1457. c("#" + e[m]).delay(1000 + 100 * m).fadeOut(500,
  1458. function() {
  1459. c(this).remove();
  1460. });
  1461. }
  1462. }
  1463. } else {
  1464. var k = c("#" + j.queueID).find(".uploadify-queue-item").get(0);
  1465. $item = c(k);
  1466. i.cancelUpload($item.attr("id"));
  1467. $item.find(".data").removeClass("data").html(" - Cancelled");
  1468. $item.find(".uploadify-progress-bar").remove();
  1469. $item.delay(1000).fadeOut(500,
  1470. function() {
  1471. c(this).remove();
  1472. });
  1473. }
  1474. });
  1475. },
  1476. destroy: function() {
  1477. this.each(function() {
  1478. var f = c(this),
  1479. d = f.data("uploadify"),
  1480. e = d.settings;
  1481. d.destroy();
  1482. if (e.defaultQueue) {
  1483. c("#" + e.queueID).remove();
  1484. }
  1485. c("#" + e.id).replaceWith(d.original);
  1486. if (e.onDestroy) {
  1487. e.onDestroy.call(this);
  1488. }
  1489. delete d;
  1490. });
  1491. },
  1492. disable: function(d) {
  1493. this.each(function() {
  1494. var g = c(this),
  1495. e = g.data("uploadify"),
  1496. f = e.settings;
  1497. if (d) {
  1498. e.button.addClass("disabled");
  1499. if (f.onDisable) {
  1500. f.onDisable.call(this);
  1501. }
  1502. } else {
  1503. e.button.removeClass("disabled");
  1504. if (f.onEnable) {
  1505. f.onEnable.call(this);
  1506. }
  1507. }
  1508. e.setButtonDisabled(d);
  1509. });
  1510. },
  1511. settings: function(e, g, h) {
  1512. var d = arguments;
  1513. var f = g;
  1514. this.each(function() {
  1515. var k = c(this),
  1516. i = k.data("uploadify"),
  1517. j = i.settings;
  1518. if (typeof(d[0]) == "object") {
  1519. for (var l in g) {
  1520. setData(l, g[l]);
  1521. }
  1522. }
  1523. if (d.length === 1) {
  1524. f = j[e];
  1525. } else {
  1526. switch (e) {
  1527. case "uploader":
  1528. i.setUploadURL(g);
  1529. break;
  1530. case "formData":
  1531. if (!h) {
  1532. g = c.extend(j.formData, g);
  1533. }
  1534. i.setPostParams(j.formData);
  1535. break;
  1536. case "method":
  1537. if (g == "get") {
  1538. i.setUseQueryString(true);
  1539. } else {
  1540. i.setUseQueryString(false);
  1541. }
  1542. break;
  1543. case "fileObjName":
  1544. i.setFilePostName(g);
  1545. break;
  1546. case "fileTypeExts":
  1547. i.setFileTypes(g, j.fileTypeDesc);
  1548. break;
  1549. case "fileTypeDesc":
  1550. i.setFileTypes(j.fileTypeExts, g);
  1551. break;
  1552. case "fileSizeLimit":
  1553. i.setFileSizeLimit(g);
  1554. break;
  1555. case "uploadLimit":
  1556. i.setFileUploadLimit(g);
  1557. break;
  1558. case "queueSizeLimit":
  1559. i.setFileQueueLimit(g);
  1560. break;
  1561. case "buttonImage":
  1562. i.button.css("background-image", settingValue);
  1563. break;
  1564. case "buttonCursor":
  1565. if (g == "arrow") {
  1566. i.setButtonCursor(SWFUpload.CURSOR.ARROW);
  1567. } else {
  1568. i.setButtonCursor(SWFUpload.CURSOR.HAND);
  1569. }
  1570. break;
  1571. case "buttonText":
  1572. c("#" + j.id + "-button").find(".uploadify-button-text").html(g);
  1573. break;
  1574. case "width":
  1575. i.setButtonDimensions(g, j.height);
  1576. break;
  1577. case "height":
  1578. i.setButtonDimensions(j.width, g);
  1579. break;
  1580. case "multi":
  1581. if (g) {
  1582. i.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILES);
  1583. } else {
  1584. i.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILE);
  1585. }
  1586. break;
  1587. }
  1588. j[e] = g;
  1589. }
  1590. });
  1591. if (d.length === 1) {
  1592. return f;
  1593. }
  1594. },
  1595. stop: function() {
  1596. this.each(function() {
  1597. var e = c(this),
  1598. d = e.data("uploadify");
  1599. d.queueData.averageSpeed = 0;
  1600. d.queueData.uploadSize = 0;
  1601. d.queueData.bytesUploaded = 0;
  1602. d.queueData.uploadQueue = [];
  1603. d.stopUpload();
  1604. });
  1605. },
  1606. upload: function() {
  1607. var d = arguments;
  1608. this.each(function() {
  1609. var f = c(this),
  1610. e = f.data("uploadify");
  1611. e.queueData.averageSpeed = 0;
  1612. e.queueData.uploadSize = 0;
  1613. e.queueData.bytesUploaded = 0;
  1614. e.queueData.uploadQueue = [];
  1615. if (d[0]) {
  1616. if (d[0] == "*") {
  1617. e.queueData.uploadSize = e.queueData.queueSize;
  1618. e.queueData.uploadQueue.push("*");
  1619. e.startUpload();
  1620. } else {
  1621. for (var g = 0; g < d.length; g++) {
  1622. e.queueData.uploadSize += e.queueData.files[d[g]].size;
  1623. e.queueData.uploadQueue.push(d[g]);
  1624. }
  1625. e.startUpload(e.queueData.uploadQueue.shift());
  1626. }
  1627. } else {
  1628. e.startUpload();
  1629. }
  1630. });
  1631. }
  1632. };
  1633. var a = {
  1634. onDialogOpen: function() {
  1635. var d = this.settings;
  1636. this.queueData.errorMsg = "Some files were not added to the queue:";
  1637. this.queueData.filesReplaced = 0;
  1638. this.queueData.filesCancelled = 0;
  1639. if (d.onDialogOpen) {
  1640. d.onDialogOpen.call(this);
  1641. }
  1642. },
  1643. onDialogClose: function(d, f, g) {
  1644. var e = this.settings;
  1645. this.queueData.filesErrored = d - f;
  1646. this.queueData.filesSelected = d;
  1647. this.queueData.filesQueued = f - this.queueData.filesCancelled;
  1648. this.queueData.queueLength = g;
  1649. if (c.inArray("onDialogClose", e.overrideEvents) < 0) {
  1650. if (this.queueData.filesErrored > 0) {
  1651. alert(this.queueData.errorMsg);
  1652. }
  1653. }
  1654. if (e.onDialogClose) {
  1655. e.onDialogClose.call(this, this.queueData);
  1656. }
  1657. if (e.auto) {
  1658. c("#" + e.id).uploadify("upload", "*");
  1659. }
  1660. },
  1661. onSelect: function(h) {
  1662. var i = this.settings;
  1663. var f = {};
  1664. for (var g in this.queueData.files) {
  1665. f = this.queueData.files[g];
  1666. if (f.uploaded != true && f.name == h.name) {
  1667. var e = confirm('The file named "' + h.name + '" is already in the queue.\nDo you want to replace the existing item in the queue?');
  1668. if (!e) {
  1669. this.cancelUpload(h.id);
  1670. this.queueData.filesCancelled++;
  1671. return false;
  1672. } else {
  1673. c("#" + f.id).remove();
  1674. this.cancelUpload(f.id);
  1675. this.queueData.filesReplaced++;
  1676. }
  1677. }
  1678. }
  1679. var j = Math.round(h.size / 1024);
  1680. var o = "KB";
  1681. if (j > 1000) {
  1682. j = Math.round(j / 1000);
  1683. o = "MB";
  1684. }
  1685. var l = j.toString().split(".");
  1686. j = l[0];
  1687. if (l.length > 1) {
  1688. j += "." + l[1].substr(0, 2);
  1689. }
  1690. j += o;
  1691. var k = h.name;
  1692. if (k.length > 25) {
  1693. k = k.substr(0, 25) + "...";
  1694. }
  1695. itemData = {
  1696. fileID: h.id,
  1697. instanceID: i.id,
  1698. fileName: k,
  1699. fileSize: j
  1700. };
  1701. if (i.itemTemplate == false) {
  1702. 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>';
  1703. }
  1704. if (c.inArray("onSelect", i.overrideEvents) < 0) {
  1705. itemHTML = i.itemTemplate;
  1706. for (var m in itemData) {
  1707. itemHTML = itemHTML.replace(new RegExp("\\$\\{" + m + "\\}", "g"), itemData[m]);
  1708. }
  1709. c("#" + i.queueID).append(itemHTML);
  1710. }
  1711. this.queueData.queueSize += h.size;
  1712. this.queueData.files[h.id] = h;
  1713. if (i.onSelect) {
  1714. i.onSelect.apply(this, arguments);
  1715. }
  1716. },
  1717. onSelectError: function(d, g, f) {
  1718. var e = this.settings;
  1719. if (c.inArray("onSelectError", e.overrideEvents) < 0) {
  1720. switch (g) {
  1721. case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
  1722. if (e.queueSizeLimit > f) {
  1723. this.queueData.errorMsg += "\nThe number of files selected exceeds the remaining upload limit (" + f + ").";
  1724. } else {
  1725. this.queueData.errorMsg += "\nThe number of files selected exceeds the queue size limit (" + e.queueSizeLimit + ").";
  1726. }
  1727. break;
  1728. case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
  1729. this.queueData.errorMsg += '\nThe file "' + d.name + '" exceeds the size limit (' + e.fileSizeLimit + ").";
  1730. break;
  1731. case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
  1732. this.queueData.errorMsg += '\nThe file "' + d.name + '" is empty.';
  1733. break;
  1734. case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
  1735. this.queueData.errorMsg += '\nThe file "' + d.name + '" is not an accepted file type (' + e.fileTypeDesc + ").";
  1736. break;
  1737. }
  1738. }
  1739. if (g != SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
  1740. delete this.queueData.files[d.id];
  1741. }
  1742. if (e.onSelectError) {
  1743. e.onSelectError.apply(this, arguments);
  1744. }
  1745. },
  1746. onQueueComplete: function() {
  1747. if (this.settings.onQueueComplete) {
  1748. this.settings.onQueueComplete.call(this, this.settings.queueData);
  1749. }
  1750. },
  1751. onUploadComplete: function(f) {
  1752. var g = this.settings,
  1753. d = this;
  1754. var e = this.getStats();
  1755. this.queueData.queueLength = e.files_queued;
  1756. if (this.queueData.uploadQueue[0] == "*") {
  1757. if (this.queueData.queueLength > 0) {
  1758. this.startUpload();
  1759. } else {
  1760. this.queueData.uploadQueue = [];
  1761. if (g.onQueueComplete) {
  1762. g.onQueueComplete.call(this, this.queueData);
  1763. }
  1764. }
  1765. } else {
  1766. if (this.queueData.uploadQueue.length > 0) {
  1767. this.startUpload(this.queueData.uploadQueue.shift());
  1768. } else {
  1769. this.queueData.uploadQueue = [];
  1770. if (g.onQueueComplete) {
  1771. g.onQueueComplete.call(this, this.queueData);
  1772. }
  1773. }
  1774. }
  1775. if (c.inArray("onUploadComplete", g.overrideEvents) < 0) {
  1776. if (g.removeCompleted) {
  1777. switch (f.filestatus) {
  1778. case SWFUpload.FILE_STATUS.COMPLETE:
  1779. setTimeout(function() {
  1780. if (c("#" + f.id)) {
  1781. d.queueData.queueSize -= f.size;
  1782. d.queueData.queueLength -= 1;
  1783. delete d.queueData.files[f.id];
  1784. c("#" + f.id).fadeOut(500,
  1785. function() {
  1786. c(this).remove();
  1787. });
  1788. }
  1789. },
  1790. g.removeTimeout * 1000);
  1791. break;
  1792. case SWFUpload.FILE_STATUS.ERROR:
  1793. if (!g.requeueErrors) {
  1794. setTimeout(function() {
  1795. if (c("#" + f.id)) {
  1796. d.queueData.queueSize -= f.size;
  1797. d.queueData.queueLength -= 1;
  1798. delete d.queueData.files[f.id];
  1799. c("#" + f.id).fadeOut(500,
  1800. function() {
  1801. c(this).remove();
  1802. });
  1803. }
  1804. },
  1805. g.removeTimeout * 1000);
  1806. }
  1807. break;
  1808. }
  1809. } else {
  1810. f.uploaded = true;
  1811. }
  1812. }
  1813. if (g.onUploadComplete) {
  1814. g.onUploadComplete.call(this, f);
  1815. }
  1816. },
  1817. onUploadError: function(e, i, h) {
  1818. var f = this.settings;
  1819. var g = "Error";
  1820. switch (i) {
  1821. case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
  1822. g = "HTTP Error (" + h + ")";
  1823. break;
  1824. case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
  1825. g = "Missing Upload URL";
  1826. break;
  1827. case SWFUpload.UPLOAD_ERROR.IO_ERROR:
  1828. g = "IO Error";
  1829. break;
  1830. case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
  1831. g = "Security Error";
  1832. break;
  1833. case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
  1834. alert("The upload limit has been reached (" + h + ").");
  1835. g = "Exceeds Upload Limit";
  1836. break;
  1837. case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
  1838. g = "Failed";
  1839. break;
  1840. case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:
  1841. break;
  1842. case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
  1843. g = "Validation Error";
  1844. break;
  1845. case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
  1846. g = "Cancelled";
  1847. this.queueData.queueSize -= e.size;
  1848. this.queueData.queueLength -= 1;
  1849. if (e.status == SWFUpload.FILE_STATUS.IN_PROGRESS || c.inArray(e.id, this.queueData.uploadQueue) >= 0) {
  1850. this.queueData.uploadSize -= e.size;
  1851. }
  1852. if (f.onCancel) {
  1853. f.onCancel.call(this, e);
  1854. }
  1855. delete this.queueData.files[e.id];
  1856. break;
  1857. case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
  1858. g = "Stopped";
  1859. break;
  1860. }
  1861. if (c.inArray("onUploadError", f.overrideEvents) < 0) {
  1862. if (i != SWFUpload.UPLOAD_ERROR.FILE_CANCELLED && i != SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED) {
  1863. c("#" + e.id).addClass("uploadify-error");
  1864. }
  1865. c("#" + e.id).find(".uploadify-progress-bar").css("width", "1px");
  1866. if (i != SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND && e.status != SWFUpload.FILE_STATUS.COMPLETE) {
  1867. c("#" + e.id).find(".data").html(" - " + g);
  1868. }
  1869. }
  1870. var d = this.getStats();
  1871. this.queueData.uploadsErrored = d.upload_errors;
  1872. if (f.onUploadError) {
  1873. f.onUploadError.call(this, e, i, h, g);
  1874. }
  1875. },
  1876. onUploadProgress: function(g, m, j) {
  1877. var h = this.settings;
  1878. var e = new Date();
  1879. var n = e.getTime();
  1880. var k = n - this.timer;
  1881. if (k > 500) {
  1882. this.timer = n;
  1883. }
  1884. var i = m - this.bytesLoaded;
  1885. this.bytesLoaded = m;
  1886. var d = this.queueData.queueBytesUploaded + m;
  1887. var p = Math.round(m / j * 100);
  1888. var o = "KB/s";
  1889. var l = 0;
  1890. var f = (i / 1024) / (k / 1000);
  1891. f = Math.floor(f * 10) / 10;
  1892. if (this.queueData.averageSpeed > 0) {
  1893. this.queueData.averageSpeed = Math.floor((this.queueData.averageSpeed + f) / 2);
  1894. } else {
  1895. this.queueData.averageSpeed = Math.floor(f);
  1896. }
  1897. if (f > 1000) {
  1898. l = (f * 0.001);
  1899. this.queueData.averageSpeed = Math.floor(l);
  1900. o = "MB/s";
  1901. }
  1902. if (c.inArray("onUploadProgress", h.overrideEvents) < 0) {
  1903. if (h.progressData == "percentage") {
  1904. c("#" + g.id).find(".data").html(" - " + p + "%");
  1905. } else {
  1906. if (h.progressData == "speed" && k > 500) {
  1907. c("#" + g.id).find(".data").html(" - " + this.queueData.averageSpeed + o);
  1908. }
  1909. }
  1910. c("#" + g.id).find(".uploadify-progress-bar").css("width", p + "%");
  1911. }
  1912. if (h.onUploadProgress) {
  1913. h.onUploadProgress.call(this, g, m, j, d, this.queueData.uploadSize);
  1914. }
  1915. },
  1916. onUploadStart: function(d) {
  1917. var e = this.settings;
  1918. var f = new Date();
  1919. this.timer = f.getTime();
  1920. this.bytesLoaded = 0;
  1921. if (this.queueData.uploadQueue.length == 0) {
  1922. this.queueData.uploadSize = d.size;
  1923. }
  1924. if (e.checkExisting) {
  1925. c.ajax({
  1926. type: "POST",
  1927. async: false,
  1928. url: e.checkExisting,
  1929. data: {
  1930. filename: d.name
  1931. },
  1932. success: function(h) {
  1933. if (h == 1) {
  1934. var g = confirm('A file with the name "' + d.name + '" already exists on the server.\nWould you like to replace the existing file?');
  1935. if (!g) {
  1936. this.cancelUpload(d.id);
  1937. c("#" + d.id).remove();
  1938. if (this.queueData.uploadQueue.length > 0 && this.queueData.queueLength > 0) {
  1939. if (this.queueData.uploadQueue[0] == "*") {
  1940. this.startUpload();
  1941. } else {
  1942. this.startUpload(this.queueData.uploadQueue.shift());
  1943. }
  1944. }
  1945. }
  1946. }
  1947. }
  1948. });
  1949. }
  1950. if (e.onUploadStart) {
  1951. e.onUploadStart.call(this, d);
  1952. }
  1953. },
  1954. onUploadSuccess: function(f, h, d) {
  1955. var g = this.settings;
  1956. var e = this.getStats();
  1957. this.queueData.uploadsSuccessful = e.successful_uploads;
  1958. this.queueData.queueBytesUploaded += f.size;
  1959. if (c.inArray("onUploadSuccess", g.overrideEvents) < 0) {
  1960. c("#" + f.id).find(".data").html(" - ÉÏ´«Íê³É");
  1961. }
  1962. if (g.onUploadSuccess) {
  1963. g.onUploadSuccess.call(this, f, h, d);
  1964. }
  1965. }
  1966. };
  1967. c.fn.uploadify = function(d) {
  1968. if (b[d]) {
  1969. return b[d].apply(this, Array.prototype.slice.call(arguments, 1));
  1970. } else {
  1971. if (typeof d === "object" || !d) {
  1972. return b.init.apply(this, arguments);
  1973. } else {
  1974. c.error("The method " + d + " does not exist in $.uploadify");
  1975. }
  1976. }
  1977. };
  1978. })($);