flowplayer-3.2.13.min.js 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114
  1. /*
  2. * flowplayer.js The Flowplayer API
  3. *
  4. * Copyright 2009-2011 Flowplayer Oy
  5. *
  6. * This file is part of Flowplayer.
  7. *
  8. * Flowplayer is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * Flowplayer is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with Flowplayer. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. !(function() {
  23. function h(p) {
  24. console.log('$f.fireEvent', [].slice.call(p));
  25. }
  26. function l(r) {
  27. if (!r || typeof r != 'object') {
  28. return r;
  29. }
  30. var p = new r.constructor();
  31. for (var q in r) {
  32. if (r.hasOwnProperty(q)) {
  33. p[q] = l(r[q]);
  34. }
  35. }
  36. return p;
  37. }
  38. function n(u, r) {
  39. if (!u) {
  40. return;
  41. }
  42. var p,
  43. q = 0,
  44. s = u.length;
  45. if (s === undefined) {
  46. for (p in u) {
  47. if (r.call(u[p], p, u[p]) === false) {
  48. break;
  49. }
  50. }
  51. } else {
  52. for (var t = u[0]; q < s && r.call(t, q, t) !== false; t = u[++q]) {}
  53. }
  54. return u;
  55. }
  56. function c(p) {
  57. return document.getElementById(p);
  58. }
  59. function j(r, q, p) {
  60. if (typeof q != 'object') {
  61. return r;
  62. }
  63. if (r && q) {
  64. n(q, function(s, t) {
  65. if (!p || typeof t != 'function') {
  66. r[s] = t;
  67. }
  68. });
  69. }
  70. return r;
  71. }
  72. function o(t) {
  73. var r = t.indexOf('.');
  74. if (r != -1) {
  75. var q = t.slice(0, r) || '*';
  76. var p = t.slice(r + 1, t.length);
  77. var s = [];
  78. n(document.getElementsByTagName(q), function() {
  79. if (this.className && this.className.indexOf(p) != -1) {
  80. s.push(this);
  81. }
  82. });
  83. return s;
  84. }
  85. }
  86. function g(p) {
  87. p = p || window.event;
  88. if (p.preventDefault) {
  89. p.stopPropagation();
  90. p.preventDefault();
  91. } else {
  92. p.returnValue = false;
  93. p.cancelBubble = true;
  94. }
  95. return false;
  96. }
  97. function k(r, p, q) {
  98. r[p] = r[p] || [];
  99. r[p].push(q);
  100. }
  101. function e(p) {
  102. return p
  103. .replace(/&amp;/g, '%26')
  104. .replace(/&/g, '%26')
  105. .replace(/=/g, '%3D');
  106. }
  107. function f() {
  108. return '_' + ('' + Math.random()).slice(2, 10);
  109. }
  110. var i = function(u, s, t) {
  111. var r = this,
  112. q = {},
  113. v = {};
  114. r.index = s;
  115. if (typeof u == 'string') {
  116. u = { url: u };
  117. }
  118. j(this, u, true);
  119. n('Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop'.split(','), function() {
  120. var w = 'on' + this;
  121. if (w.indexOf('*') != -1) {
  122. w = w.slice(0, w.length - 1);
  123. var x = 'onBefore' + w.slice(2);
  124. r[x] = function(y) {
  125. k(v, x, y);
  126. return r;
  127. };
  128. }
  129. r[w] = function(y) {
  130. k(v, w, y);
  131. return r;
  132. };
  133. if (s == -1) {
  134. if (r[x]) {
  135. t[x] = r[x];
  136. }
  137. if (r[w]) {
  138. t[w] = r[w];
  139. }
  140. }
  141. });
  142. j(this, {
  143. onCuepoint: function(y, x) {
  144. if (arguments.length == 1) {
  145. q.embedded = [null, y];
  146. return r;
  147. }
  148. if (typeof y == 'number') {
  149. y = [y];
  150. }
  151. var w = f();
  152. q[w] = [y, x];
  153. if (t.isLoaded()) {
  154. t._api().fp_addCuepoints(y, s, w);
  155. }
  156. return r;
  157. },
  158. update: function(x) {
  159. j(r, x);
  160. if (t.isLoaded()) {
  161. t._api().fp_updateClip(x, s);
  162. }
  163. var w = t.getConfig();
  164. var y = s == -1 ? w.clip : w.playlist[s];
  165. j(y, x, true);
  166. },
  167. _fireEvent: function(w, z, x, B) {
  168. if (w == 'onLoad') {
  169. n(q, function(C, D) {
  170. if (D[0]) {
  171. t._api().fp_addCuepoints(D[0], s, C);
  172. }
  173. });
  174. return false;
  175. }
  176. B = B || r;
  177. if (w == 'onCuepoint') {
  178. var A = q[z];
  179. if (A) {
  180. return A[1].call(t, B, x);
  181. }
  182. }
  183. if (z && 'onBeforeBegin,onMetaData,onMetaDataChange,onStart,onUpdate,onResume'.indexOf(w) != -1) {
  184. j(B, z);
  185. if (z.metaData) {
  186. if (!B.duration) {
  187. B.duration = z.metaData.duration;
  188. } else {
  189. B.fullDuration = z.metaData.duration;
  190. }
  191. }
  192. }
  193. var y = true;
  194. n(v[w], function() {
  195. y = this.call(t, B, z, x);
  196. });
  197. return y;
  198. },
  199. });
  200. if (u.onCuepoint) {
  201. var p = u.onCuepoint;
  202. r.onCuepoint.apply(r, typeof p == 'function' ? [p] : p);
  203. delete u.onCuepoint;
  204. }
  205. n(u, function(w, x) {
  206. if (typeof x == 'function') {
  207. k(v, w, x);
  208. delete u[w];
  209. }
  210. });
  211. if (s == -1) {
  212. t.onCuepoint = this.onCuepoint;
  213. }
  214. };
  215. var m = function(q, s, r, u) {
  216. var p = this,
  217. t = {},
  218. v = false;
  219. if (u) {
  220. j(t, u);
  221. }
  222. n(s, function(w, x) {
  223. if (typeof x == 'function') {
  224. t[w] = x;
  225. delete s[w];
  226. }
  227. });
  228. j(this, {
  229. animate: function(z, A, y) {
  230. if (!z) {
  231. return p;
  232. }
  233. if (typeof A == 'function') {
  234. y = A;
  235. A = 500;
  236. }
  237. if (typeof z == 'string') {
  238. var x = z;
  239. z = {};
  240. z[x] = A;
  241. A = 500;
  242. }
  243. if (y) {
  244. var w = f();
  245. t[w] = y;
  246. }
  247. if (A === undefined) {
  248. A = 500;
  249. }
  250. s = r._api().fp_animate(q, z, A, w);
  251. return p;
  252. },
  253. css: function(x, y) {
  254. if (y !== undefined) {
  255. var w = {};
  256. w[x] = y;
  257. x = w;
  258. }
  259. s = r._api().fp_css(q, x);
  260. j(p, s);
  261. return p;
  262. },
  263. show: function() {
  264. this.display = 'block';
  265. r._api().fp_showPlugin(q);
  266. return p;
  267. },
  268. hide: function() {
  269. this.display = 'none';
  270. r._api().fp_hidePlugin(q);
  271. return p;
  272. },
  273. toggle: function() {
  274. this.display = r._api().fp_togglePlugin(q);
  275. return p;
  276. },
  277. fadeTo: function(z, y, x) {
  278. if (typeof y == 'function') {
  279. x = y;
  280. y = 500;
  281. }
  282. if (x) {
  283. var w = f();
  284. t[w] = x;
  285. }
  286. this.display = r._api().fp_fadeTo(q, z, y, w);
  287. this.opacity = z;
  288. return p;
  289. },
  290. fadeIn: function(x, w) {
  291. return p.fadeTo(1, x, w);
  292. },
  293. fadeOut: function(x, w) {
  294. return p.fadeTo(0, x, w);
  295. },
  296. getName: function() {
  297. return q;
  298. },
  299. getPlayer: function() {
  300. return r;
  301. },
  302. _fireEvent: function(x, w, y) {
  303. if (x == 'onUpdate') {
  304. var A = r._api().fp_getPlugin(q);
  305. if (!A) {
  306. return;
  307. }
  308. j(p, A);
  309. delete p.methods;
  310. if (!v) {
  311. n(A.methods, function() {
  312. var C = '' + this;
  313. p[C] = function() {
  314. var D = [].slice.call(arguments);
  315. var E = r._api().fp_invoke(q, C, D);
  316. return E === 'undefined' || E === undefined ? p : E;
  317. };
  318. });
  319. v = true;
  320. }
  321. }
  322. var B = t[x];
  323. if (B) {
  324. var z = B.apply(p, w);
  325. if (x.slice(0, 1) == '_') {
  326. delete t[x];
  327. }
  328. return z;
  329. }
  330. return p;
  331. },
  332. });
  333. };
  334. function b(r, H, u) {
  335. var x = this,
  336. w = null,
  337. E = false,
  338. v,
  339. t,
  340. G = [],
  341. z = {},
  342. y = {},
  343. F,
  344. s,
  345. q,
  346. D,
  347. p,
  348. B;
  349. j(x, {
  350. id: function() {
  351. return F;
  352. },
  353. isLoaded: function() {
  354. return w !== null && w.fp_play !== undefined && !E;
  355. },
  356. getParent: function() {
  357. return r;
  358. },
  359. hide: function(I) {
  360. if (I) {
  361. r.style.height = '0px';
  362. }
  363. if (x.isLoaded()) {
  364. w.style.height = '0px';
  365. }
  366. return x;
  367. },
  368. show: function() {
  369. r.style.height = B + 'px';
  370. if (x.isLoaded()) {
  371. w.style.height = p + 'px';
  372. }
  373. return x;
  374. },
  375. isHidden: function() {
  376. return x.isLoaded() && parseInt(w.style.height, 10) === 0;
  377. },
  378. load: function(K) {
  379. if (!x.isLoaded() && x._fireEvent('onBeforeLoad') !== false) {
  380. var I = function() {
  381. if (v && !flashembed.isSupported(H.version)) {
  382. r.innerHTML = '';
  383. }
  384. if (K) {
  385. K.cached = true;
  386. k(y, 'onLoad', K);
  387. }
  388. flashembed(r, H, { config: u });
  389. };
  390. var J = 0;
  391. n(a, function() {
  392. this.unload(function(L) {
  393. if (++J == a.length) {
  394. I();
  395. }
  396. });
  397. });
  398. }
  399. return x;
  400. },
  401. unload: function(K) {
  402. if (v.replace(/\s/g, '') !== '') {
  403. if (x._fireEvent('onBeforeUnload') === false) {
  404. if (K) {
  405. K(false);
  406. }
  407. return x;
  408. }
  409. E = true;
  410. try {
  411. if (w) {
  412. if (w.fp_isFullscreen()) {
  413. w.fp_toggleFullscreen();
  414. }
  415. w.fp_close();
  416. x._fireEvent('onUnload');
  417. }
  418. } catch (I) {}
  419. var J = function() {
  420. w = null;
  421. r.innerHTML = v;
  422. E = false;
  423. if (K) {
  424. K(true);
  425. }
  426. };
  427. if (/WebKit/i.test(navigator.userAgent) && !/Chrome/i.test(navigator.userAgent)) {
  428. setTimeout(J, 0);
  429. } else {
  430. J();
  431. }
  432. } else {
  433. if (K) {
  434. K(false);
  435. }
  436. }
  437. return x;
  438. },
  439. getClip: function(I) {
  440. if (I === undefined) {
  441. I = D;
  442. }
  443. return G[I];
  444. },
  445. getCommonClip: function() {
  446. return t;
  447. },
  448. getPlaylist: function() {
  449. return G;
  450. },
  451. getPlugin: function(I) {
  452. var K = z[I];
  453. if (!K && x.isLoaded()) {
  454. var J = x._api().fp_getPlugin(I);
  455. if (J) {
  456. K = new m(I, J, x);
  457. z[I] = K;
  458. }
  459. }
  460. return K;
  461. },
  462. getScreen: function() {
  463. return x.getPlugin('screen');
  464. },
  465. getControls: function() {
  466. return x.getPlugin('controls')._fireEvent('onUpdate');
  467. },
  468. getLogo: function() {
  469. try {
  470. return x.getPlugin('logo')._fireEvent('onUpdate');
  471. } catch (I) {}
  472. },
  473. getPlay: function() {
  474. return x.getPlugin('play')._fireEvent('onUpdate');
  475. },
  476. getConfig: function(I) {
  477. return I ? l(u) : u;
  478. },
  479. getFlashParams: function() {
  480. return H;
  481. },
  482. loadPlugin: function(L, K, N, M) {
  483. if (typeof N == 'function') {
  484. M = N;
  485. N = {};
  486. }
  487. var J = M ? f() : '_';
  488. x._api().fp_loadPlugin(L, K, N, J);
  489. var I = {};
  490. I[J] = M;
  491. var O = new m(L, null, x, I);
  492. z[L] = O;
  493. return O;
  494. },
  495. getState: function() {
  496. return x.isLoaded() ? w.fp_getState() : -1;
  497. },
  498. play: function(J, I) {
  499. var K = function() {
  500. if (J !== undefined) {
  501. x._api().fp_play(J, I);
  502. } else {
  503. x._api().fp_play();
  504. }
  505. };
  506. if (x.isLoaded()) {
  507. K();
  508. } else {
  509. if (E) {
  510. setTimeout(function() {
  511. x.play(J, I);
  512. }, 50);
  513. } else {
  514. x.load(function() {
  515. K();
  516. });
  517. }
  518. }
  519. return x;
  520. },
  521. getVersion: function() {
  522. var J = 'flowplayer.js @VERSION';
  523. if (x.isLoaded()) {
  524. var I = w.fp_getVersion();
  525. I.push(J);
  526. return I;
  527. }
  528. return J;
  529. },
  530. _api: function() {
  531. if (!x.isLoaded()) {
  532. throw 'Flowplayer ' + x.id() + ' not loaded when calling an API method';
  533. }
  534. return w;
  535. },
  536. setClip: function(I) {
  537. n(I, function(J, K) {
  538. if (typeof K == 'function') {
  539. k(y, J, K);
  540. delete I[J];
  541. } else {
  542. if (J == 'onCuepoint') {
  543. $f(r)
  544. .getCommonClip()
  545. .onCuepoint(I[J][0], I[J][1]);
  546. }
  547. }
  548. });
  549. x.setPlaylist([I]);
  550. return x;
  551. },
  552. getIndex: function() {
  553. return q;
  554. },
  555. bufferAnimate: function(I) {
  556. w.fp_bufferAnimate(I === undefined || I);
  557. return x;
  558. },
  559. _swfHeight: function() {
  560. return w.clientHeight;
  561. },
  562. });
  563. n(
  564. 'Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut'.split(','),
  565. function() {
  566. var I = 'on' + this;
  567. if (I.indexOf('*') != -1) {
  568. I = I.slice(0, I.length - 1);
  569. var J = 'onBefore' + I.slice(2);
  570. x[J] = function(K) {
  571. k(y, J, K);
  572. return x;
  573. };
  574. }
  575. x[I] = function(K) {
  576. k(y, I, K);
  577. return x;
  578. };
  579. }
  580. );
  581. n(
  582. 'pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed,setKeyboardShortcutsEnabled,isKeyboardShortcutsEnabled'.split(
  583. ','
  584. ),
  585. function() {
  586. var I = this;
  587. x[I] = function(K, J) {
  588. if (!x.isLoaded()) {
  589. return x;
  590. }
  591. var L = null;
  592. if (K !== undefined && J !== undefined) {
  593. L = w['fp_' + I](K, J);
  594. } else {
  595. L = K === undefined ? w['fp_' + I]() : w['fp_' + I](K);
  596. }
  597. return L === 'undefined' || L === undefined ? x : L;
  598. };
  599. }
  600. );
  601. x._fireEvent = function(R) {
  602. if (typeof R == 'string') {
  603. R = [R];
  604. }
  605. var S = R[0],
  606. P = R[1],
  607. N = R[2],
  608. M = R[3],
  609. L = 0;
  610. if (u.debug) {
  611. h(R);
  612. }
  613. if (!x.isLoaded() && S == 'onLoad' && P == 'player') {
  614. w = w || c(s);
  615. p = x._swfHeight();
  616. n(G, function() {
  617. this._fireEvent('onLoad');
  618. });
  619. n(z, function(T, U) {
  620. U._fireEvent('onUpdate');
  621. });
  622. t._fireEvent('onLoad');
  623. }
  624. if (S == 'onLoad' && P != 'player') {
  625. return;
  626. }
  627. if (S == 'onError') {
  628. if (typeof P == 'string' || (typeof P == 'number' && typeof N == 'number')) {
  629. P = N;
  630. N = M;
  631. }
  632. }
  633. if (S == 'onContextMenu') {
  634. n(u.contextMenu[P], function(T, U) {
  635. U.call(x);
  636. });
  637. return;
  638. }
  639. if (S == 'onPluginEvent' || S == 'onBeforePluginEvent') {
  640. var I = P.name || P;
  641. var J = z[I];
  642. if (J) {
  643. J._fireEvent('onUpdate', P);
  644. return J._fireEvent(N, R.slice(3));
  645. }
  646. return;
  647. }
  648. if (S == 'onPlaylistReplace') {
  649. G = [];
  650. var O = 0;
  651. n(P, function() {
  652. G.push(new i(this, O++, x));
  653. });
  654. }
  655. if (S == 'onClipAdd') {
  656. if (P.isInStream) {
  657. return;
  658. }
  659. P = new i(P, N, x);
  660. G.splice(N, 0, P);
  661. for (L = N + 1; L < G.length; L++) {
  662. G[L].index++;
  663. }
  664. }
  665. var Q = true;
  666. if (typeof P == 'number' && P < G.length) {
  667. D = P;
  668. var K = G[P];
  669. if (K) {
  670. Q = K._fireEvent(S, N, M);
  671. }
  672. if (!K || Q !== false) {
  673. Q = t._fireEvent(S, N, M, K);
  674. }
  675. }
  676. n(y[S], function() {
  677. Q = this.call(x, P, N);
  678. if (this.cached) {
  679. y[S].splice(L, 1);
  680. }
  681. if (Q === false) {
  682. return false;
  683. }
  684. L++;
  685. });
  686. return Q;
  687. };
  688. function C() {
  689. if ($f(r)) {
  690. $f(r).getParent().innerHTML = '';
  691. q = $f(r).getIndex();
  692. a[q] = x;
  693. } else {
  694. a.push(x);
  695. q = a.length - 1;
  696. }
  697. B = parseInt(r.style.height, 10) || r.clientHeight;
  698. F = r.id || 'fp' + f();
  699. s = H.id || F + '_api';
  700. H.id = s;
  701. v = r.innerHTML;
  702. if (typeof u == 'string') {
  703. u = { clip: { url: u } };
  704. }
  705. u.playerId = F;
  706. u.clip = u.clip || {};
  707. if (r.getAttribute('href', 2) && !u.clip.url) {
  708. u.clip.url = r.getAttribute('href', 2);
  709. }
  710. if (u.clip.url) {
  711. u.clip.url = e(u.clip.url);
  712. }
  713. t = new i(u.clip, -1, x);
  714. u.playlist = u.playlist || [u.clip];
  715. var J = 0;
  716. n(u.playlist, function() {
  717. var M = this;
  718. if (typeof M == 'object' && M.length) {
  719. M = { url: '' + M };
  720. }
  721. if (M.url) {
  722. M.url = e(M.url);
  723. }
  724. n(u.clip, function(N, O) {
  725. if (O !== undefined && M[N] === undefined && typeof O != 'function') {
  726. M[N] = O;
  727. }
  728. });
  729. u.playlist[J] = M;
  730. M = new i(M, J, x);
  731. G.push(M);
  732. J++;
  733. });
  734. n(u, function(M, N) {
  735. if (typeof N == 'function') {
  736. if (t[M]) {
  737. t[M](N);
  738. } else {
  739. k(y, M, N);
  740. }
  741. delete u[M];
  742. }
  743. });
  744. n(u.plugins, function(M, N) {
  745. if (N) {
  746. z[M] = new m(M, N, x);
  747. }
  748. });
  749. if (!u.plugins || u.plugins.controls === undefined) {
  750. z.controls = new m('controls', null, x);
  751. }
  752. z.canvas = new m('canvas', null, x);
  753. v = r.innerHTML;
  754. function L(M) {
  755. if (/iPad|iPhone|iPod/i.test(navigator.userAgent) && !/.flv$/i.test(G[0].url) && !K()) {
  756. return true;
  757. }
  758. if (!x.isLoaded() && x._fireEvent('onBeforeClick') !== false) {
  759. x.load();
  760. }
  761. return g(M);
  762. }
  763. function K() {
  764. return x.hasiPadSupport && x.hasiPadSupport();
  765. }
  766. function I() {
  767. if (v.replace(/\s/g, '') !== '') {
  768. if (r.addEventListener) {
  769. r.addEventListener('click', L, false);
  770. } else {
  771. if (r.attachEvent) {
  772. r.attachEvent('onclick', L);
  773. }
  774. }
  775. } else {
  776. if (r.addEventListener && !K()) {
  777. r.addEventListener('click', g, false);
  778. }
  779. x.load();
  780. }
  781. }
  782. setTimeout(I, 0);
  783. }
  784. if (typeof r == 'string') {
  785. var A = c(r);
  786. if (!A) {
  787. throw 'Flowplayer cannot access element: ' + r;
  788. }
  789. r = A;
  790. C();
  791. } else {
  792. C();
  793. }
  794. }
  795. var a = [];
  796. function d(p) {
  797. this.length = p.length;
  798. this.each = function(r) {
  799. n(p, r);
  800. };
  801. this.size = function() {
  802. return p.length;
  803. };
  804. var q = this;
  805. for (name in b.prototype) {
  806. q[name] = function() {
  807. var r = arguments;
  808. q.each(function() {
  809. this[name].apply(this, r);
  810. });
  811. };
  812. }
  813. }
  814. window.flowplayer = window.$f = function() {
  815. var q = null;
  816. var p = arguments[0];
  817. if (!arguments.length) {
  818. n(a, function() {
  819. if (this.isLoaded()) {
  820. q = this;
  821. return false;
  822. }
  823. });
  824. return q || a[0];
  825. }
  826. if (arguments.length == 1) {
  827. if (typeof p == 'number') {
  828. return a[p];
  829. } else {
  830. if (p == '*') {
  831. return new d(a);
  832. }
  833. n(a, function() {
  834. if (this.id() == p.id || this.id() == p || this.getParent() == p) {
  835. q = this;
  836. return false;
  837. }
  838. });
  839. return q;
  840. }
  841. }
  842. if (arguments.length > 1) {
  843. var u = arguments[1],
  844. r = arguments.length == 3 ? arguments[2] : {};
  845. if (typeof u == 'string') {
  846. u = { src: u };
  847. }
  848. u = j({ bgcolor: '#000000', version: [10, 1], expressInstall: 'http://releases.flowplayer.org/swf/expressinstall.swf', cachebusting: false }, u);
  849. if (typeof p == 'string') {
  850. if (p.indexOf('.') != -1) {
  851. var t = [];
  852. n(o(p), function() {
  853. t.push(new b(this, l(u), l(r)));
  854. });
  855. return new d(t);
  856. } else {
  857. var s = c(p);
  858. return new b(s !== null ? s : l(p), l(u), l(r));
  859. }
  860. } else {
  861. if (p) {
  862. return new b(p, l(u), l(r));
  863. }
  864. }
  865. }
  866. return null;
  867. };
  868. j(window.$f, {
  869. fireEvent: function() {
  870. var q = [].slice.call(arguments);
  871. var r = $f(q[0]);
  872. return r ? r._fireEvent(q.slice(1)) : null;
  873. },
  874. addPlugin: function(p, q) {
  875. b.prototype[p] = q;
  876. return $f;
  877. },
  878. each: n,
  879. extend: j,
  880. });
  881. if (typeof jQuery == 'function') {
  882. jQuery.fn.flowplayer = function(r, q) {
  883. if (!arguments.length || typeof arguments[0] == 'number') {
  884. var p = [];
  885. this.each(function() {
  886. var s = $f(this);
  887. if (s) {
  888. p.push(s);
  889. }
  890. });
  891. return arguments.length ? p[arguments[0]] : new d(p);
  892. }
  893. return this.each(function() {
  894. $f(this, l(r), q ? l(q) : {});
  895. });
  896. };
  897. }
  898. })();
  899. !(function() {
  900. var h = document.all,
  901. j = 'http://get.adobe.com/flashplayer',
  902. c = typeof jQuery == 'function',
  903. e = /(\d+)[^\d]+(\d+)[^\d]*(\d*)/,
  904. b = {
  905. width: '100%',
  906. height: '100%',
  907. id: '_' + ('' + Math.random()).slice(9),
  908. allowfullscreen: true,
  909. allowscriptaccess: 'always',
  910. quality: 'high',
  911. version: [3, 0],
  912. onFail: null,
  913. expressInstall: null,
  914. w3c: false,
  915. cachebusting: false,
  916. };
  917. if (window.attachEvent) {
  918. window.attachEvent('onbeforeunload', function() {
  919. __flash_unloadHandler = function() {};
  920. __flash_savedUnloadHandler = function() {};
  921. });
  922. }
  923. function i(m, l) {
  924. if (l) {
  925. for (var f in l) {
  926. if (l.hasOwnProperty(f)) {
  927. m[f] = l[f];
  928. }
  929. }
  930. }
  931. return m;
  932. }
  933. function a(f, n) {
  934. var m = [];
  935. for (var l in f) {
  936. if (f.hasOwnProperty(l)) {
  937. m[l] = n(f[l]);
  938. }
  939. }
  940. return m;
  941. }
  942. window.flashembed = function(f, m, l) {
  943. if (typeof f == 'string') {
  944. f = document.getElementById(f.replace('#', ''));
  945. }
  946. if (!f) {
  947. return;
  948. }
  949. if (typeof m == 'string') {
  950. m = { src: m };
  951. }
  952. return new d(f, i(i({}, b), m), l);
  953. };
  954. var g = i(window.flashembed, {
  955. conf: b,
  956. getVersion: function() {
  957. var m, f, o;
  958. try {
  959. o = navigator.plugins['Shockwave Flash'];
  960. if (o[0].enabledPlugin != null) {
  961. f = o.description.slice(16);
  962. }
  963. } catch (p) {
  964. try {
  965. m = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.7');
  966. f = m && m.GetVariable('$version');
  967. } catch (n) {
  968. try {
  969. m = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
  970. f = m && m.GetVariable('$version');
  971. } catch (l) {}
  972. }
  973. }
  974. f = e.exec(f);
  975. return f ? [1 * f[1], 1 * f[f[1] * 1 > 9 ? 2 : 3] * 1] : [0, 0];
  976. },
  977. asString: function(l) {
  978. if (l === null || l === undefined) {
  979. return null;
  980. }
  981. var f = typeof l;
  982. if (f == 'object' && l.push) {
  983. f = 'array';
  984. }
  985. switch (f) {
  986. case 'string':
  987. l = l.replace(new RegExp('(["\\\\])', 'g'), '\\$1');
  988. l = l.replace(/^\s?(\d+\.?\d*)%/, '$1pct');
  989. return '"' + l + '"';
  990. case 'array':
  991. return (
  992. '[' +
  993. a(l, function(o) {
  994. return g.asString(o);
  995. }).join(',') +
  996. ']'
  997. );
  998. case 'function':
  999. return '"function()"';
  1000. case 'object':
  1001. var m = [];
  1002. for (var n in l) {
  1003. if (l.hasOwnProperty(n)) {
  1004. m.push('"' + n + '":' + g.asString(l[n]));
  1005. }
  1006. }
  1007. return '{' + m.join(',') + '}';
  1008. }
  1009. return String(l)
  1010. .replace(/\s/g, ' ')
  1011. .replace(/\'/g, '"');
  1012. },
  1013. getHTML: function(o, l) {
  1014. o = i({}, o);
  1015. var n = '<object width="' + o.width + '" height="' + o.height + '" id="' + o.id + '" name="' + o.id + '"';
  1016. if (o.cachebusting) {
  1017. o.src += (o.src.indexOf('?') != -1 ? '&' : '?') + Math.random();
  1018. }
  1019. if (o.w3c || !h) {
  1020. n += ' data="' + o.src + '" type="application/x-shockwave-flash"';
  1021. } else {
  1022. n += ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
  1023. }
  1024. n += '>';
  1025. if (o.w3c || h) {
  1026. n += '<param name="movie" value="' + o.src + '" />';
  1027. }
  1028. o.width = o.height = o.id = o.w3c = o.src = null;
  1029. o.onFail = o.version = o.expressInstall = null;
  1030. for (var m in o) {
  1031. if (o[m]) {
  1032. n += '<param name="' + m + '" value="' + o[m] + '" />';
  1033. }
  1034. }
  1035. var p = '';
  1036. if (l) {
  1037. for (var f in l) {
  1038. if (l[f]) {
  1039. var q = l[f];
  1040. p += f + '=' + (/function|object/.test(typeof q) ? g.asString(q) : q) + '&';
  1041. }
  1042. }
  1043. p = p.slice(0, -1);
  1044. n += '<param name="flashvars" value=\'' + p + "' />";
  1045. }
  1046. n += '</object>';
  1047. return n;
  1048. },
  1049. isSupported: function(f) {
  1050. return k[0] > f[0] || (k[0] == f[0] && k[1] >= f[1]);
  1051. },
  1052. });
  1053. var k = g.getVersion();
  1054. function d(f, n, m) {
  1055. if (g.isSupported(n.version)) {
  1056. f.innerHTML = g.getHTML(n, m);
  1057. } else {
  1058. if (n.expressInstall && g.isSupported([6, 65])) {
  1059. f.innerHTML = g.getHTML(i(n, { src: n.expressInstall }), {
  1060. MMredirectURL: encodeURIComponent(location.href),
  1061. MMplayerType: 'PlugIn',
  1062. MMdoctitle: document.title,
  1063. });
  1064. } else {
  1065. if (!f.innerHTML.replace(/\s/g, '')) {
  1066. f.innerHTML =
  1067. '<h2>Flash version ' +
  1068. n.version +
  1069. ' or greater is required</h2><h3>' +
  1070. (k[0] > 0 ? 'Your version is ' + k : 'You have no flash plugin installed') +
  1071. '</h3>' +
  1072. (f.tagName == 'A' ? '<p>Click here to download latest version</p>' : "<p>Download latest version from <a href='" + j + "'>here</a></p>");
  1073. if (f.tagName == 'A' || f.tagName == 'DIV') {
  1074. f.onclick = function() {
  1075. location.href = j;
  1076. };
  1077. }
  1078. }
  1079. if (n.onFail) {
  1080. var l = n.onFail.call(this);
  1081. if (typeof l == 'string') {
  1082. f.innerHTML = l;
  1083. }
  1084. }
  1085. }
  1086. }
  1087. if (h) {
  1088. window[n.id] = document.getElementById(n.id);
  1089. }
  1090. i(this, {
  1091. getRoot: function() {
  1092. return f;
  1093. },
  1094. getOptions: function() {
  1095. return n;
  1096. },
  1097. getConf: function() {
  1098. return m;
  1099. },
  1100. getApi: function() {
  1101. return f.firstChild;
  1102. },
  1103. });
  1104. }
  1105. if (c) {
  1106. jQuery.tools = jQuery.tools || { version: '@VERSION' };
  1107. jQuery.tools.flashembed = { conf: b };
  1108. jQuery.fn.flashembed = function(l, f) {
  1109. return this.each(function() {
  1110. $(this).data('flashembed', flashembed(this, l, f));
  1111. });
  1112. };
  1113. }
  1114. })();