flvPlayer.js 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264
  1. // Reworks and improvements by Ivan Tcholakov, JUL-2009, FEB-2011.
  2. var dialog = window.parent ;
  3. var oEditor = dialog.InnerDialogLoaded() ;
  4. var FCK = oEditor.FCK ;
  5. var FCKLang = oEditor.FCKLang ;
  6. var FCKConfig = oEditor.FCKConfig ;
  7. var FCKTools = oEditor.FCKTools ;
  8. // Reading the Flash embedding method.
  9. if ( typeof FCKConfig[ 'FlashEmbeddingMethod' ] != 'string' )
  10. {
  11. FCKConfig[ 'FlashEmbeddingMethod' ] = 'embed' ;
  12. }
  13. if ( FCKConfig[ 'FlashEmbeddingMethod' ] != 'embed' &&
  14. FCKConfig[ 'FlashEmbeddingMethod' ] != 'object' &&
  15. FCKConfig[ 'FlashEmbeddingMethod' ] != 'adobe' &&
  16. FCKConfig[ 'FlashEmbeddingMethod' ] != 'swfobject' ) {
  17. FCKConfig[ 'FlashEmbeddingMethod' ] = 'embed' ;
  18. }
  19. // Set the language direction.
  20. window.document.dir = FCKLang.Dir ;
  21. // We have to avoid javascript errors if some language variables have not been defined.
  22. FCKLang['UploadSelectFileFirst'] = FCKLang['UploadSelectFileFirst'] ? FCKLang['UploadSelectFileFirst'] : 'Please, select a file before pressing the upload button.' ;
  23. FCKLang['FileSuccessfullyUploaded'] = FCKLang['FileSuccessfullyUploaded'] ? FCKLang['FileSuccessfullyUploaded'] : 'Your file has been successfully uploaded.' ;
  24. FCKLang['FileRenamed'] = FCKLang['FileRenamed'] ? FCKLang['FileRenamed'] : 'A file with the same name is already available. The uploaded file has been renamed to ' ;
  25. FCKLang['InvalidFileType'] = FCKLang['InvalidFileType'] ? FCKLang['InvalidFileType'] : 'Invalid file type.' ;
  26. FCKLang['SecurityError'] = FCKLang['SecurityError'] ? FCKLang['SecurityError'] : 'Security error. You probably don\'t have enough permissions to upload. Please check your server.' ;
  27. FCKLang['ConnectorDisabled'] = FCKLang['ConnectorDisabled'] ? FCKLang['ConnectorDisabled'] : 'The upload feature (connector) is disabled.' ;
  28. FCKLang['UploadError'] = FCKLang['UploadError'] ? FCKLang['UploadError'] : 'Error on file upload. Error number: ' ;
  29. // Dialog Tabs
  30. // Set the dialog tabs.
  31. dialog.AddTab( 'Info', FCKLang.DlgInfoTab ) ;
  32. dialog.AddTab( 'Preview', FCKLang.DlgImgPreview ) ;
  33. if ( FCKConfig.MediaUpload )
  34. {
  35. dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ;
  36. }
  37. // This function is called when a dialog tab has been selected.
  38. function OnDialogTabChange( tabCode )
  39. {
  40. ShowE( 'divInfo', ( tabCode == 'Info' ) ) ;
  41. ShowE( 'divPreview', ( tabCode == 'Preview' ) ) ;
  42. ShowE( 'divUpload', ( tabCode == 'Upload' ) ) ;
  43. if ( tabCode == 'Preview' )
  44. {
  45. UpdatePreview() ;
  46. }
  47. else
  48. {
  49. ClearPreview() ;
  50. }
  51. }
  52. function OnDialogModeChange( mode )
  53. {
  54. if ( mode == 'single')
  55. {
  56. btnBrowse.disabled = false ;
  57. btnImgBrowse.disabled = false ;
  58. btnLnkBrowse.disabled = true ;
  59. txtURL.disabled = false ;
  60. txtImgURL.disabled = false ;
  61. txtPlaylist.disabled = true ;
  62. txtPlaylist.value = '' ;
  63. txtURL.style.background = '#ffffff' ;
  64. txtImgURL.style.background = '#ffffff' ;
  65. txtPlaylist.style.background = 'transparent' ;
  66. selDispPlaylist.disabled = true ;
  67. }
  68. else
  69. {
  70. btnBrowse.disabled = true ;
  71. btnImgBrowse.disabled = true ;
  72. btnLnkBrowse.disabled = false ;
  73. txtURL.disabled = true ;
  74. txtImgURL.disabled = true ;
  75. txtPlaylist.disabled = false ;
  76. txtURL.value = '' ;
  77. txtImgURL.value = '' ;
  78. txtURL.style.background = 'transparent' ;
  79. txtImgURL.style.background = 'transparent' ;
  80. txtPlaylist.style.background = '#ffffff' ;
  81. selDispPlaylist.disabled = false ;
  82. }
  83. }
  84. var oMedia = null ;
  85. var is_new_flvplayer = true ;
  86. window.onload = function()
  87. {
  88. // Translate the dialog box texts.
  89. oEditor.FCKLanguageManager.TranslatePage(document) ;
  90. // Load the selected element information (if any).
  91. LoadSelection() ;
  92. // Show/Hide the "Browse Server" button.
  93. GetE('tdBrowse').style.display = FCKConfig.MediaBrowser ? '' : 'none' ;
  94. // Set the actual uploader URL.
  95. if ( FCKConfig.MediaUpload )
  96. GetE('frmUpload').action = FCKConfig.MediaUploadURL ;
  97. dialog.SetAutoSize( true ) ;
  98. // Activate the "OK" button.
  99. dialog.SetOkButton( true ) ;
  100. }
  101. function getSelectedMovie()
  102. {
  103. var oFakeImage = FCK.Selection.GetSelectedElement() ;
  104. var oSel = null ;
  105. oMedia = new Media() ;
  106. if ( oFakeImage )
  107. {
  108. if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute( '_fckvideo' ) )
  109. {
  110. oSel = FCK.GetRealElement( oFakeImage ) ;
  111. if ( oSel && oSel.id && oSel.id.match( /^player[0-9]*-parent$/ ) )
  112. {
  113. for ( var i = 0 ; i < oSel.childNodes.length ; i++ )
  114. {
  115. if ( oSel.childNodes.item(i).nodeName == "DIV" )
  116. {
  117. for ( var k = 0 ; k < oSel.childNodes.item(i).childNodes.length ; k++ )
  118. {
  119. if ( oSel.childNodes.item(i).childNodes.item(k).nodeName == "DIV" &&
  120. oSel.childNodes.item(i).childNodes.item(k).id &&
  121. oSel.childNodes.item(i).childNodes.item(k).id.match( /^player[0-9]*-config$/ ) )
  122. {
  123. var oC = oSel.childNodes.item(i).childNodes.item(k).innerHTML.split(' ') ;
  124. for ( var o = 0 ; o < oC.length ; o++ )
  125. {
  126. var tmp = oC[o].split( '=' ) ;
  127. oMedia.setAttribute( tmp[0], tmp[1] ) ;
  128. }
  129. is_new_flvplayer = false ;
  130. break ;
  131. }
  132. }
  133. }
  134. }
  135. }
  136. }
  137. }
  138. return oMedia ;
  139. }
  140. function updatePlaylistOption()
  141. {
  142. if ( GetE( 'selDispPlaylist' ).value == "right" || GetE( 'selDispPlaylist' ).value == "below" )
  143. {
  144. GetE( 'chkPLThumbs' ).disabled = false ;
  145. GetE( 'chkPLThumbs' ).checked = true ;
  146. GetE( 'txtPLDim' ).disabled = false ;
  147. GetE( 'txtPLDim' ).style.background = '#ffffff' ;
  148. GetE( 'spanDimText' ).style.display = 'none' ;
  149. if ( GetE( 'selDispPlaylist' ).value == "right" )
  150. {
  151. GetE( 'spanDimWText' ).style.display = '' ;
  152. GetE( 'spanDimHText' ).style.display = 'none' ;
  153. }
  154. else if ( GetE( 'selDispPlaylist' ).value == "below" )
  155. {
  156. GetE( 'spanDimWText' ).style.display = 'none' ;
  157. GetE( 'spanDimHText' ).style.display = '' ;
  158. }
  159. }
  160. else
  161. {
  162. GetE( 'chkPLThumbs' ).disabled = true ;
  163. GetE( 'chkPLThumbs' ).checked = false ;
  164. GetE( 'txtPLDim' ).value = "" ;
  165. GetE( 'txtPLDim' ).disabled = true ;
  166. GetE( 'txtPLDim' ).style.background = 'transparent' ;
  167. GetE( 'spanDimText' ).style.display = '' ;
  168. GetE( 'spanDimWText' ).style.display = 'none' ;
  169. GetE( 'spanDimHText' ).style.display = 'none' ;
  170. }
  171. }
  172. function LoadSelection()
  173. {
  174. oMedia = new Media() ;
  175. oMedia = getSelectedMovie() ;
  176. GetE( 'rbFileType' ).value = oMedia.fileType ;
  177. GetE( 'txtURL' ).value = oMedia.url ;
  178. GetE( 'txtPlaylist' ).value = oMedia.purl ;
  179. GetE( 'txtImgURL' ).value = oMedia.iurl ;
  180. GetE( 'txtWMURL' ).value = oMedia.wmurl ;
  181. GetE( 'txtWidth' ).value = oMedia.width.toString().length > 0 ? oMedia.width : 320 ;
  182. GetE( 'txtHeight' ).value = oMedia.height.toString().length > 0 ? oMedia.height : 240 ;
  183. GetE( 'chkLoop' ).checked = oMedia.loop ;
  184. GetE( 'chkAutoplay' ).checked = oMedia.play ;
  185. GetE( 'chkDownload' ).checked = oMedia.downloadable ;
  186. GetE( 'chkFullscreen' ).checked = oMedia.fullscreen ;
  187. GetE( 'txtBgColor' ).value = oMedia.bgcolor ;
  188. GetE( 'txtToolbarColor' ).value = oMedia.toolcolor ;
  189. GetE( 'txtToolbarTxtColor' ).value = oMedia.tooltcolor ;
  190. GetE( 'txtToolbarTxtRColor' ).value = oMedia.tooltrcolor ;
  191. GetE( 'chkShowNavigation' ).checked = oMedia.displayNavigation ;
  192. GetE( 'chkShowDigits' ).checked = oMedia.displayDigits ;
  193. GetE( 'selAlign' ).value = oMedia.align ;
  194. GetE( 'selDispPlaylist' ).value = oMedia.dispPlaylist ;
  195. GetE('txtRURL' ).value = oMedia.rurl ;
  196. GetE( 'txtPLDim' ).value = oMedia.playlistDim ;
  197. GetE( 'chkPLThumbs' ).checked = oMedia.playlistThumbs ;
  198. UpdatePreview() ;
  199. }
  200. // The OK button was hit.
  201. function Ok()
  202. {
  203. var rbFileTypeVal = "single" ;
  204. if ( !GetE( 'rbFileType' ).checked )
  205. {
  206. rbFileTypeVal = "list" ;
  207. }
  208. if ( rbFileTypeVal == "single" )
  209. {
  210. if ( GetE( 'txtURL' ).value.length == 0 )
  211. {
  212. GetE( 'txtURL' ).focus() ;
  213. alert( oEditor.FCKLang.DlgFLVPlayerAlertUrl ) ;
  214. return false ;
  215. }
  216. }
  217. if ( rbFileTypeVal == "list" )
  218. {
  219. if ( GetE( 'txtPlaylist' ).value.length == 0 )
  220. {
  221. GetE( 'txtPlaylist' ).focus() ;
  222. alert( oEditor.FCKLang.DlgFLVPlayerAlertPlaylist ) ;
  223. return false ;
  224. }
  225. }
  226. if ( GetE( 'txtWidth' ).value.length == 0 )
  227. {
  228. GetE( 'txtWidth' ).focus() ;
  229. alert( oEditor.FCKLang.DlgFLVPlayerAlertWidth ) ;
  230. return false ;
  231. }
  232. if ( GetE( 'txtHeight' ).value.length == 0 )
  233. {
  234. GetE( 'txtHeight' ).focus() ;
  235. alert( oEditor.FCKLang.DlgFLVPlayerAlertHeight ) ;
  236. return false ;
  237. }
  238. var e = ( oMedia || new Media() ) ;
  239. UpdateMovie( e ) ;
  240. // Replace or insert?
  241. if ( !is_new_flvplayer )
  242. {
  243. var oFakeImage = FCK.Selection.GetSelectedElement() ;
  244. var oSel = null ;
  245. oMedia = new Media() ;
  246. if ( oFakeImage )
  247. {
  248. if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute( '_fckvideo' ) )
  249. {
  250. oSel = FCK.GetRealElement( oFakeImage ) ;
  251. if ( oSel )
  252. {
  253. oSel = null ;
  254. FCK.InsertHtml( e.getInnerHTML() ) ;
  255. }
  256. }
  257. }
  258. }
  259. else
  260. {
  261. FCK.InsertHtml( e.getInnerHTML() ) ;
  262. }
  263. return true ;
  264. }
  265. function UpdateMovie( e )
  266. {
  267. e.fileType = GetE( 'rbFileType' ).value ;
  268. e.url = GetE( 'txtURL' ).value ;
  269. e.purl = GetE( 'txtPlaylist' ).value ;
  270. e.iurl = GetE( 'txtImgURL' ).value ;
  271. e.wmurl = GetE( 'txtWMURL' ).value ;
  272. e.bgcolor = GetE( 'txtBgColor' ).value ;
  273. e.toolcolor = GetE( 'txtToolbarColor' ).value ;
  274. e.tooltcolor = GetE( 'txtToolbarTxtColor' ).value ;
  275. e.tooltrcolor = GetE( 'txtToolbarTxtRColor' ).value ;
  276. e.width = ( isNaN( GetE( 'txtWidth' ).value ) ) ? 0 : parseInt( GetE( 'txtWidth' ).value ) ;
  277. e.height = ( isNaN( GetE( 'txtHeight' ).value ) ) ? 0 : parseInt( GetE( 'txtHeight' ).value ) ;
  278. e.loop = ( GetE( 'chkLoop' ).checked ) ? 'true' : 'false' ;
  279. e.play = ( GetE( 'chkAutoplay' ).checked ) ? 'true' : 'false' ;
  280. e.downloadable = ( GetE( 'chkDownload' ).checked ) ? 'true' : 'false' ;
  281. e.fullscreen = ( GetE( 'chkFullscreen' ).checked ) ? 'true' : 'false' ;
  282. e.displayNavigation = ( GetE( 'chkShowNavigation' ).checked ) ? 'true' : 'false' ;
  283. e.displayDigits = ( GetE( 'chkShowDigits' ).checked) ? 'true' : 'false' ;
  284. e.align = GetE( 'selAlign' ).value ;
  285. e.dispPlaylist = GetE( 'selDispPlaylist' ).value ;
  286. e.rurl = GetE( 'txtRURL' ).value ;
  287. e.playlistDim = GetE( 'txtPLDim' ).value ;
  288. e.playlistThumbs = ( GetE( 'chkPLThumbs' ).checked ) ? 'true' : 'false' ;
  289. }
  290. function BrowseServer()
  291. {
  292. OpenServerBrowser( 'flv', FCKConfig.MediaBrowserURL, FCKConfig.MediaBrowserWindowWidth, FCKConfig.MediaBrowserWindowHeight ) ;
  293. }
  294. function LnkBrowseServer()
  295. {
  296. OpenServerBrowser( 'link', FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ;
  297. }
  298. function Lnk2BrowseServer()
  299. {
  300. OpenServerBrowser( 'link2', FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ;
  301. }
  302. function img1BrowseServer()
  303. {
  304. OpenServerBrowser( 'img1', FCKConfig.ImageBrowserURL, FCKConfig.ImageBrowserWindowWidth, FCKConfig.ImageBrowserWindowHeight ) ;
  305. }
  306. function img2BrowseServer()
  307. {
  308. OpenServerBrowser( 'img2', FCKConfig.ImageBrowserURL, FCKConfig.ImageBrowserWindowWidth, FCKConfig.ImageBrowserWindowHeight ) ;
  309. }
  310. function OpenServerBrowser( type, url, width, height )
  311. {
  312. sActualBrowser = type ;
  313. OpenFileBrowser( url, width, height ) ;
  314. }
  315. var sActualBrowser ;
  316. function SetUrl( url ) {
  317. url = FCK.GetSelectedUrl( url ) ;
  318. if ( sActualBrowser == 'flv' ) {
  319. GetE('txtURL').value = url ;
  320. GetE('txtWidth').value = 320 ;
  321. GetE('txtHeight').value = 240 ;
  322. }
  323. else if ( sActualBrowser == 'link' )
  324. {
  325. GetE('txtPlaylist').value = url ;
  326. }
  327. else if ( sActualBrowser == 'link2' )
  328. {
  329. GetE('txtRURL').value = url ;
  330. }
  331. else if ( sActualBrowser == 'img1' )
  332. {
  333. GetE('txtImgURL').value = url ;
  334. }
  335. else if ( sActualBrowser == 'img2' )
  336. {
  337. GetE('txtWMURL').value = url ;
  338. }
  339. UpdatePreview() ;
  340. dialog.SetSelectedTab( 'Info' ) ;
  341. }
  342. var Media = function ( o )
  343. {
  344. this.fileType = '' ;
  345. this.url = '' ;
  346. this.purl = '' ;
  347. this.iurl = '' ;
  348. this.wmurl = '' ;
  349. this.width = '' ;
  350. this.height = '' ;
  351. this.loop = '' ;
  352. this.play = '' ;
  353. this.downloadable = '' ;
  354. this.fullscreen = true ;
  355. this.bgcolor = '' ;
  356. this.toolcolor = '' ;
  357. this.tooltcolor = '' ;
  358. this.tooltrcolor = '' ;
  359. this.displayNavigation = true ;
  360. this.displayDigits = true ;
  361. this.align = '' ;
  362. this.dispPlaylist = '' ;
  363. this.rurl = '' ;
  364. this.playlistDim = '' ;
  365. this.playlistThumbs = '' ;
  366. if ( o )
  367. {
  368. this.setObjectElement( o ) ;
  369. }
  370. } ;
  371. Media.prototype.setObjectElement = function ( e )
  372. {
  373. if ( !e ) return ;
  374. this.width = GetAttribute( e, 'width', this.width ) ;
  375. this.height = GetAttribute( e, 'height', this.height ) ;
  376. } ;
  377. Media.prototype.setAttribute = function( attr, val )
  378. {
  379. if ( val == 'true' )
  380. {
  381. this[attr] = true ;
  382. }
  383. else if (val == 'false' )
  384. {
  385. this[attr] = false ;
  386. }
  387. else
  388. {
  389. this[attr] = val ;
  390. }
  391. } ;
  392. Media.prototype.getInnerHTML = function ( objectId )
  393. {
  394. var embeddingMethod = FCKConfig[ 'FlashEmbeddingMethod' ];
  395. var randomnumber = Math.floor( Math.random() * 1000001 ) ;
  396. var thisWidth = this.width ;
  397. var thisHeight = this.height ;
  398. var thisMediaType = 'single' ;
  399. if ( !GetE( 'rbFileType' ).checked )
  400. {
  401. thisMediaType = 'mpl' ;
  402. }
  403. // Alignment
  404. var cssalign = '' ;
  405. var cssfloat = '' ;
  406. if ( this.align == 'center' )
  407. {
  408. cssalign = 'margin-left: auto;margin-right: auto;' ;
  409. }
  410. else if ( this.align == 'right' )
  411. {
  412. cssfloat = 'float: right;' ;
  413. }
  414. else if ( this.align == 'left' )
  415. {
  416. cssfloat = 'float: left;' ;
  417. }
  418. var s = '' ;
  419. s += '\n' ;
  420. s += '<div id="player' + randomnumber + '-parent" style="text-align: center;' + cssfloat + '">\n';
  421. s += '<div style="border-style: none; height: ' + thisHeight + 'px; width: ' + thisWidth + 'px; overflow: hidden; background-color: rgb(220, 220, 220); ' + cssalign + '">' ;
  422. if (embeddingMethod == 'swfobject')
  423. {
  424. s += '<script src="' + FCKConfig.ScriptSWFObject + '" type="text/javascript"></script>\n' ;
  425. }
  426. // NOTE: FOR LIST OF POSSIBLE SETTINGS GOTO http://www.jeroenwijering.com/extras/readme.html\n' ;
  427. // A hidden div containing setting, added width, height, overflow for MSIE7
  428. s += '<div id="player' + randomnumber + '-config" style="display: none; visibility: hidden; width: 0px; height: 0px; overflow: hidden;">' ;
  429. // Save settings.
  430. for ( var i in this )
  431. {
  432. if ( !i || !this[i] ) continue ;
  433. if ( !i.match( /(set|get)/ ) )
  434. {
  435. s += i + '=' + this[i] + ' ' ;
  436. }
  437. }
  438. s += '</div>' ;
  439. // The player's area.
  440. s += '<div id="player' + randomnumber + '">' ;
  441. if ( embeddingMethod == 'swfobject' )
  442. {
  443. s += '<a href="http://www.macromedia.com/go/getflashplayer" target="_blank">Get the Flash Player</a> to see this video.' ;
  444. }
  445. if ( embeddingMethod == 'object' || embeddingMethod == 'adobe' )
  446. {
  447. var p = '' ; // Parameters.
  448. var v = '' ; // Variables.
  449. s += '<object id="' + thisMediaType + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" style="" width="' + thisWidth + '" height="' + thisHeight + '">' ;
  450. p += '<param name="movie" value="' + FCKConfig.FlashPlayerVideo + '" />' ;
  451. p += '<param name="quality" value="high" />' ;
  452. p += '<param name="allowfullscreen" value="' + this.fullscreen + '" />' ;
  453. v += 'width=' + thisWidth + '&amp;' ;
  454. v += 'height=' + thisHeight + '&amp;' ;
  455. v += 'autostart=' + this.play + '&amp;' ;
  456. if ( thisMediaType == 'mpl' )
  457. {
  458. v += 'file=' + this.purl + '&amp;' ;
  459. v += 'autoscroll=true&amp;' ;
  460. p += 'allowscriptaccess="always" ' ;
  461. p += '<param name="allowscriptaccess" value="always" />' ;
  462. var dispWidth = thisWidth ;
  463. var dispHeight = thisHeight ;
  464. var dispThumbs = false ;
  465. if ( this.dispPlaylist != 'none' )
  466. {
  467. if ( this.dispPlaylist == 'right' )
  468. {
  469. if ( this.playlistDim.length > 0 )
  470. {
  471. dispWidth = thisWidth - this.playlistDim ;
  472. if ( this.playlistDim < 100 )
  473. {
  474. dispThumbs = false ;
  475. }
  476. else
  477. {
  478. dispThumbs = true ;
  479. }
  480. }
  481. else
  482. {
  483. if ( thisWidth >= 550 )
  484. {
  485. dispWidth = thisWidth - 200 ;
  486. dispThumbs = true ;
  487. }
  488. else if ( thisWidth >= 450 )
  489. {
  490. dispWidth = thisWidth - 100 ;
  491. dispThumbs = false ;
  492. }
  493. else if ( thisWidth >= 350 )
  494. {
  495. dispWidth = thisWidth - 50 ;
  496. dispThumbs = false ;
  497. }
  498. }
  499. v += 'displaywidth=' + dispWidth + '&amp;' ;
  500. }
  501. else if ( this.dispPlaylist == 'below' )
  502. {
  503. dispThumbs = true ;
  504. if ( this.playlistDim.length > 0 )
  505. {
  506. dispHeight = thisWidth - this.playlistDim ;
  507. }
  508. else
  509. {
  510. if ( thisHeight >= 550 )
  511. {
  512. dispHeight = thisWidth - 200 ;
  513. }
  514. else if ( thisHeight >= 450 )
  515. {
  516. dispHeight = thisHeight - 150 ;
  517. }
  518. else if ( thisHeight >= 350 )
  519. {
  520. dispHeight = thisHeight - 100 ;
  521. }
  522. }
  523. v += 'displayheight=' + dispHeight + '&amp;' ;
  524. }
  525. if ( this.playlistThumbs == 'false' )
  526. {
  527. dispThumbs = false ;
  528. }
  529. v += 'thumbsinplaylist=' + dispThumbs + '&amp;' ;
  530. }
  531. v += 'shuffle=false&amp;' ;
  532. if (this.loop)
  533. {
  534. v += 'repeat=list&amp;' ;
  535. }
  536. else
  537. {
  538. v += 'repeat=' + this.loop + '&amp;' ;
  539. }
  540. //v += 'transition=bgfade&amp;' ;
  541. }
  542. else
  543. {
  544. v += 'file=' + this.url + '&amp;' ;
  545. v += 'repeat=' + this.loop + '&amp;' ;
  546. v += 'image=' + this.iurl + '&amp;' ;
  547. }
  548. v += 'showdownload=' + this.downloadable + '&amp;' ;
  549. v += 'link=' + this.url + '&amp;' ;
  550. v += 'showdigits=' + this.displayDigits + '&amp;' ;
  551. v += 'shownavigation=' + this.displayNavigation + '&amp;' ;
  552. // SET THE COLOR OF THE TOOLBAR
  553. var colorChoice1 = this.toolcolor ;
  554. if ( colorChoice1.length > 0 )
  555. {
  556. colorChoice1 = colorChoice1.replace( '#', '0x' ) ;
  557. v += 'backcolor=' + colorChoice1 + '&amp;' ;
  558. }
  559. // SET THE COLOR OF THE TOOLBARS TEXT AND BUTTONS
  560. var colorChoice2 = this.tooltcolor ;
  561. if ( colorChoice2.length > 0 )
  562. {
  563. colorChoice2 = colorChoice2.replace( '#', '0x' ) ;
  564. v += 'frontcolor=' + colorChoice2 + '&amp;' ;
  565. }
  566. // SET COLOR OF ROLLOVER TEXT AND BUTTONS
  567. var colorChoice3 = this.tooltrcolor ;
  568. if ( colorChoice3.length > 0 )
  569. {
  570. colorChoice3 = colorChoice3.replace( '#', '0x' ) ;
  571. v += 'lightcolor=' + colorChoice3 + '&amp;' ;
  572. }
  573. // SET COLOR OF BACKGROUND
  574. var colorChoice4 = this.bgcolor ;
  575. if ( colorChoice4.length > 0 )
  576. {
  577. colorChoice4 = colorChoice4.replace( '#', '0x' ) ;
  578. v += 'screencolor=' + colorChoice4 + '&amp;' ;
  579. }
  580. v += 'logo=' + this.wmurl + '&amp;' ;
  581. if ( this.rurl.length > 0 )
  582. {
  583. v += 'recommendations=' + this.rurl + '&amp;' ;
  584. }
  585. s += p + '<param name="flashvars" value="' + v + '" />' ;
  586. }
  587. if ( embeddingMethod == 'object' || embeddingMethod == 'adobe' )
  588. {
  589. var p = '' ; // Parameters (attributes).
  590. var v = '' ; // Variables.
  591. p += 'type="application/x-shockwave-flash" ' ;
  592. p += 'src="' + FCKConfig.FlashPlayerVideo + '" ' ;
  593. p += 'style="" ' ;
  594. p += 'id="' + thisMediaType + '" ' ;
  595. p += 'name="' + thisMediaType + '" ' ;
  596. p += 'quality="high" ' ;
  597. p += 'width="' + thisWidth + '" ' ;
  598. p += 'height="' + thisHeight + '" ' ;
  599. p += 'allowfullscreen="' + this.fullscreen + '" ' ;
  600. v += 'width=' + thisWidth + '&amp;' ;
  601. v += 'height=' + thisHeight + '&amp;' ;
  602. v += 'autostart=' + this.play + '&amp;' ;
  603. if ( thisMediaType == 'mpl' )
  604. {
  605. v += 'file=' + this.purl + '&amp;' ;
  606. v += 'autoscroll=true&amp;' ;
  607. p += 'allowscriptaccess="always" ' ;
  608. var dispWidth = thisWidth ;
  609. var dispHeight = thisHeight ;
  610. var dispThumbs = false ;
  611. if ( this.dispPlaylist != 'none' )
  612. {
  613. if ( this.dispPlaylist == 'right' )
  614. {
  615. if ( this.playlistDim.length > 0 )
  616. {
  617. dispWidth = thisWidth - this.playlistDim ;
  618. if ( this.playlistDim < 100 )
  619. {
  620. dispThumbs = false ;
  621. }
  622. else
  623. {
  624. dispThumbs = true ;
  625. }
  626. }
  627. else
  628. {
  629. if ( thisWidth >= 550 )
  630. {
  631. dispWidth = thisWidth - 200 ;
  632. dispThumbs = true ;
  633. }
  634. else if ( thisWidth >= 450 )
  635. {
  636. dispWidth = thisWidth - 100 ;
  637. dispThumbs = false ;
  638. }
  639. else if ( thisWidth >= 350 )
  640. {
  641. dispWidth = thisWidth - 50 ;
  642. dispThumbs = false ;
  643. }
  644. }
  645. v += 'displaywidth=' + dispWidth + '&amp;' ;
  646. }
  647. else if ( this.dispPlaylist == 'below' )
  648. {
  649. dispThumbs = true ;
  650. if ( this.playlistDim.length > 0 )
  651. {
  652. dispHeight = thisWidth - this.playlistDim ;
  653. }
  654. else
  655. {
  656. if ( thisHeight >= 550 )
  657. {
  658. dispHeight = thisWidth - 200 ;
  659. }
  660. else if ( thisHeight >= 450 )
  661. {
  662. dispHeight = thisHeight - 150 ;
  663. }
  664. else if ( thisHeight >= 350 )
  665. {
  666. dispHeight = thisHeight - 100 ;
  667. }
  668. }
  669. v += 'displayheight=' + dispHeight + '&amp;' ;
  670. }
  671. if ( this.playlistThumbs == 'false' )
  672. {
  673. dispThumbs = false ;
  674. }
  675. v += 'thumbsinplaylist=' + dispThumbs + '&amp;' ;
  676. }
  677. v += 'shuffle=false&amp;' ;
  678. if (this.loop)
  679. {
  680. v += 'repeat=list&amp;' ;
  681. }
  682. else
  683. {
  684. v += 'repeat=' + this.loop + '&amp;' ;
  685. }
  686. //v += 'transition=bgfade&amp;' ;
  687. }
  688. else
  689. {
  690. v += 'file=' + this.url + '&amp;' ;
  691. v += 'repeat=' + this.loop + '&amp;' ;
  692. v += 'image=' + this.iurl + '&amp;' ;
  693. }
  694. v += 'showdownload=' + this.downloadable + '&amp;' ;
  695. v += 'link=' + this.url + '&amp;' ;
  696. v += 'showdigits=' + this.displayDigits + '&amp;' ;
  697. v += 'shownavigation=' + this.displayNavigation + '&amp;' ;
  698. // SET THE COLOR OF THE TOOLBAR
  699. var colorChoice1 = this.toolcolor ;
  700. if ( colorChoice1.length > 0 )
  701. {
  702. colorChoice1 = colorChoice1.replace( '#', '0x' ) ;
  703. v += 'backcolor=' + colorChoice1 + '&amp;' ;
  704. }
  705. // SET THE COLOR OF THE TOOLBARS TEXT AND BUTTONS
  706. var colorChoice2 = this.tooltcolor ;
  707. if ( colorChoice2.length > 0 )
  708. {
  709. colorChoice2 = colorChoice2.replace( '#', '0x' ) ;
  710. v += 'frontcolor=' + colorChoice2 + '&amp;' ;
  711. }
  712. // SET COLOR OF ROLLOVER TEXT AND BUTTONS
  713. var colorChoice3 = this.tooltrcolor ;
  714. if ( colorChoice3.length > 0 )
  715. {
  716. colorChoice3 = colorChoice3.replace( '#', '0x' ) ;
  717. v += 'lightcolor=' + colorChoice3 + '&amp;' ;
  718. }
  719. // SET COLOR OF BACKGROUND
  720. var colorChoice4 = this.bgcolor ;
  721. if ( colorChoice4.length > 0 )
  722. {
  723. colorChoice4 = colorChoice4.replace( '#', '0x' ) ;
  724. v += 'screencolor=' + colorChoice4 + '&amp;' ;
  725. }
  726. v += 'logo=' + this.wmurl + '&amp;' ;
  727. if ( this.rurl.length > 0 )
  728. {
  729. v += 'recommendations=' + this.rurl + '&amp;' ;
  730. }
  731. s += '<embed ' + p + 'flashvars="' + v + '" ></embed>' ;
  732. }
  733. if ( embeddingMethod == 'object' || embeddingMethod == 'adobe' )
  734. {
  735. s += '</object>' ;
  736. }
  737. s += '</div>' ;
  738. // Generation of a javascript that implements the swfobject embedding method.
  739. if (embeddingMethod == 'swfobject')
  740. {
  741. s += '<script type="text/javascript">\n' ;
  742. s += ' var s1 = new SWFObject("' + FCKConfig.FlashPlayerVideo + '","' + thisMediaType + '","' + thisWidth + '","' + thisHeight + '","7");\n' ;
  743. s += ' s1.addVariable("width","' + thisWidth + '");\n' ;
  744. s += ' s1.addVariable("height","' + thisHeight + '");\n' ;
  745. s += ' s1.addVariable("autostart","' + this.play + '");\n' ;
  746. if ( thisMediaType == 'mpl' )
  747. {
  748. s += ' s1.addVariable("file","' + this.purl + '");\n' ;
  749. s += ' s1.addVariable("autoscroll","true");\n' ;
  750. s += ' s1.addParam("allowscriptaccess","always");\n' ;
  751. var dispWidth = thisWidth ;
  752. var dispHeight = thisHeight ;
  753. var dispThumbs = false ;
  754. if ( this.dispPlaylist != 'none' )
  755. {
  756. if ( this.dispPlaylist == 'right' )
  757. {
  758. if ( this.playlistDim.length > 0 )
  759. {
  760. dispWidth = thisWidth - this.playlistDim ;
  761. if ( this.playlistDim < 100 )
  762. {
  763. dispThumbs = false ;
  764. }
  765. else
  766. {
  767. dispThumbs = true ;
  768. }
  769. }
  770. else
  771. {
  772. if ( thisWidth >= 550 )
  773. {
  774. dispWidth = thisWidth - 200 ;
  775. dispThumbs = true ;
  776. }
  777. else if ( thisWidth >= 450 )
  778. {
  779. dispWidth = thisWidth - 100 ;
  780. dispThumbs = false ;
  781. }
  782. else if ( thisWidth >= 350 )
  783. {
  784. dispWidth = thisWidth - 50 ;
  785. dispThumbs = false ;
  786. }
  787. }
  788. s += ' s1.addVariable("displaywidth","' + dispWidth + '");\n' ;
  789. }
  790. else if ( this.dispPlaylist == 'below' )
  791. {
  792. dispThumbs = true ;
  793. if ( this.playlistDim.length > 0 )
  794. {
  795. dispHeight = thisWidth - this.playlistDim ;
  796. }
  797. else
  798. {
  799. if ( thisHeight >= 550 )
  800. {
  801. dispHeight = thisWidth - 200 ;
  802. }
  803. else if ( thisHeight >= 450 )
  804. {
  805. dispHeight = thisHeight - 150 ;
  806. }
  807. else if ( thisHeight >= 350 )
  808. {
  809. dispHeight = thisHeight - 100 ;
  810. }
  811. }
  812. s += ' s1.addVariable("displayheight","' + dispHeight + '");\n' ;
  813. }
  814. if ( this.playlistThumbs == 'false' )
  815. {
  816. dispThumbs = false ;
  817. }
  818. s += ' s1.addVariable("thumbsinplaylist","' + dispThumbs + '");\n' ;
  819. }
  820. s += ' s1.addVariable("shuffle","false");\n' ;
  821. if (this.loop)
  822. {
  823. s += ' s1.addVariable("repeat","list");\n' ;
  824. }
  825. else
  826. {
  827. s += ' s1.addVariable("repeat","' + this.loop + '");\n' ;
  828. }
  829. s += ' //s1.addVariable("transition","bgfade");\n' ;
  830. }
  831. else
  832. {
  833. s += ' s1.addVariable("file","' + this.url + '");\n' ;
  834. s += ' s1.addVariable("repeat","' + this.loop + '");\n' ;
  835. s += ' s1.addVariable("image","' + this.iurl + '");\n' ;
  836. }
  837. s += ' s1.addVariable("showdownload","' + this.downloadable + '");\n' ;
  838. s += ' s1.addVariable("link","' + this.url + '");\n' ;
  839. s += ' s1.addParam("allowfullscreen","' + this.fullscreen + '");\n' ;
  840. s += ' s1.addVariable("showdigits","' + this.displayDigits + '");\n' ;
  841. s += ' s1.addVariable("shownavigation","' + this.displayNavigation + '");\n' ;
  842. // SET THE COLOR OF THE TOOLBAR
  843. var colorChoice1 = this.toolcolor ;
  844. if ( colorChoice1.length > 0 )
  845. {
  846. colorChoice1 = colorChoice1.replace( '#', '0x' ) ;
  847. s += ' s1.addVariable("backcolor","' + colorChoice1 + '");\n' ;
  848. }
  849. // SET THE COLOR OF THE TOOLBARS TEXT AND BUTTONS
  850. var colorChoice2 = this.tooltcolor ;
  851. if ( colorChoice2.length > 0 )
  852. {
  853. colorChoice2 = colorChoice2.replace( '#', '0x' ) ;
  854. s += ' s1.addVariable("frontcolor","' + colorChoice2 + '");\n' ;
  855. }
  856. // SET COLOR OF ROLLOVER TEXT AND BUTTONS
  857. var colorChoice3 = this.tooltrcolor ;
  858. if ( colorChoice3.length > 0 )
  859. {
  860. colorChoice3 = colorChoice3.replace( '#', '0x' ) ;
  861. s += ' s1.addVariable("lightcolor","' + colorChoice3 + '");\n' ;
  862. }
  863. // SET COLOR OF BACKGROUND
  864. var colorChoice4 = this.bgcolor ;
  865. if ( colorChoice4.length > 0 )
  866. {
  867. colorChoice4 = colorChoice4.replace( '#', '0x' ) ;
  868. s += ' s1.addVariable("screencolor","' + colorChoice4 + '");\n' ;
  869. }
  870. s += ' s1.addVariable("logo","' + this.wmurl + '");\n' ;
  871. if ( this.rurl.length > 0 )
  872. {
  873. s += ' s1.addVariable("recommendations","' + this.rurl + '");\n' ;
  874. }
  875. s += ' s1.write("player' + randomnumber + '");\n' ;
  876. s += '</script>\n' ;
  877. }
  878. s += '</div>\n' ;
  879. s += '</div>\n' ;
  880. s += '\n' ;
  881. return s ;
  882. } ;
  883. function SelectColor1()
  884. {
  885. oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, SelectBackColor ) ;
  886. }
  887. function SelectColor2()
  888. {
  889. oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, SelectToolColor ) ;
  890. }
  891. function SelectColor3()
  892. {
  893. oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, SelectToolTextColor ) ;
  894. }
  895. function SelectColor4()
  896. {
  897. oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, SelectToolTextRColor ) ;
  898. }
  899. function SelectBackColor( color )
  900. {
  901. if ( color && color.length > 0 )
  902. {
  903. GetE( 'txtBgColor' ).value = color ;
  904. }
  905. }
  906. function SelectToolColor( color )
  907. {
  908. if ( color && color.length > 0 )
  909. {
  910. GetE( 'txtToolbarColor' ).value = color ;
  911. }
  912. }
  913. function SelectToolTextColor( color )
  914. {
  915. if ( color && color.length > 0 )
  916. {
  917. GetE( 'txtToolbarTxtColor' ).value = color ;
  918. }
  919. }
  920. function SelectToolTextRColor( color )
  921. {
  922. if ( color && color.length > 0 )
  923. {
  924. GetE( 'txtToolbarTxtRColor' ).value = color ;
  925. }
  926. }
  927. var ePreview ;
  928. function IsValidMedia( oMedia )
  929. {
  930. if ( !oMedia )
  931. {
  932. return false ;
  933. }
  934. var url = oMedia.url ;
  935. var purl = oMedia.purl ;
  936. var width = oMedia.width ;
  937. var height = oMedia.height ;
  938. if ( url.length == 0 && purl.length == 0 )
  939. {
  940. return false ;
  941. }
  942. if ( isNaN( width ) )
  943. {
  944. return false ;
  945. }
  946. if ( parseInt( width, 10 ) <= 0 )
  947. {
  948. return false ;
  949. }
  950. if ( isNaN( height ) )
  951. {
  952. return false ;
  953. }
  954. if ( parseInt( height, 10 ) <= 0 )
  955. {
  956. return false ;
  957. }
  958. return true ;
  959. }
  960. function SetPreviewElement( previewEl )
  961. {
  962. ePreview = previewEl ;
  963. if ( IsValidMedia( oMedia ) )
  964. {
  965. UpdatePreview() ;
  966. }
  967. }
  968. function UpdatePreview()
  969. {
  970. if ( !ePreview )
  971. {
  972. return ;
  973. }
  974. while ( ePreview.firstChild )
  975. {
  976. ePreview.removeChild( ePreview.firstChild ) ;
  977. }
  978. if ( !oMedia )
  979. {
  980. var oMedia = new Media() ;
  981. UpdateMovie( oMedia ) ;
  982. }
  983. if ( !IsValidMedia( oMedia ) )
  984. {
  985. ePreview.innerHTML = '&nbsp;' ;
  986. }
  987. else
  988. {
  989. var max_width = 710 ;
  990. var max_height = 400 ;
  991. var new_size = FCK.ResizeToFit( oMedia.width, oMedia.height, max_width, max_height ) ;
  992. oMedia.width = new_size[0] ;
  993. oMedia.height = new_size[1] ;
  994. oMedia.play = false ;
  995. if ( FCKConfig[ 'FlashEmbeddingMethod' ] == 'swfobject' )
  996. {
  997. code = oMedia.getInnerHTML() ;
  998. var start = code.indexOf( 'var s1 = new SWFObject' ) ;
  999. if ( start == -1 )
  1000. {
  1001. return ;
  1002. }
  1003. var end = code.indexOf( 's1.write' ) ;
  1004. if ( end == -1 )
  1005. {
  1006. return ;
  1007. }
  1008. code = code.substring( start, end ) + 'html = s1.getSWFHTML();' ;
  1009. var html = '';
  1010. eval (code) ;
  1011. ePreview.innerHTML = html ;
  1012. }
  1013. else
  1014. {
  1015. ePreview.innerHTML = oMedia.getInnerHTML() ;
  1016. }
  1017. var margin_left = parseInt( ( max_width - oMedia.width ) / 2, 10 ) ;
  1018. var margin_top = parseInt( ( max_height - oMedia.height ) / 2, 10 ) ;
  1019. if ( ePreview.currentStyle )
  1020. {
  1021. // IE
  1022. ePreview.style.marginLeft = margin_left ;
  1023. ePreview.style.marginTop = margin_top ;
  1024. }
  1025. else
  1026. {
  1027. // Other browsers
  1028. SetAttribute( ePreview, 'style', 'margin-left: ' + margin_left + 'px; margin-top: ' + margin_top + 'px;' ) ;
  1029. }
  1030. }
  1031. }
  1032. function ClearPreview()
  1033. {
  1034. if ( !ePreview )
  1035. {
  1036. return ;
  1037. }
  1038. while ( ePreview.firstChild )
  1039. {
  1040. ePreview.removeChild( ePreview.firstChild ) ;
  1041. }
  1042. ePreview.innerHTML = '&nbsp;' ;
  1043. }
  1044. function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
  1045. {
  1046. // Remove animation
  1047. window.parent.Throbber.Hide() ;
  1048. GetE( 'divUpload' ).style.display = '' ;
  1049. switch ( errorNumber )
  1050. {
  1051. case 0 : // No errors
  1052. //alert( FCKLang['FileSuccessfullyUploaded'] ) ;
  1053. break ;
  1054. case 1 : // Custom error
  1055. alert( customMsg ) ;
  1056. return ;
  1057. case 101 : // Custom warning
  1058. alert( customMsg ) ;
  1059. break ;
  1060. case 201 :
  1061. alert( FCKLang['FileRenamed'] + ' "' + fileName + '".' ) ;
  1062. break ;
  1063. case 202 :
  1064. alert( FCKLang['InvalidFileType'] ) ;
  1065. return ;
  1066. case 203 :
  1067. alert( FCKLang['SecurityError'] ) ;
  1068. return ;
  1069. case 500 :
  1070. alert( FCKLang['ConnectorDisabled'] ) ;
  1071. break ;
  1072. default :
  1073. alert( FCKLang['UploadError'] + errorNumber ) ;
  1074. return ;
  1075. }
  1076. OnDialogModeChange( 'single' ) ;
  1077. sActualBrowser = 'flv' ;
  1078. SetUrl( fileUrl ) ;
  1079. GetE('frmUpload').reset() ;
  1080. }
  1081. var oUploadAllowedExtRegex = new RegExp( FCKConfig.MediaUploadAllowedExtensions, 'i' ) ;
  1082. var oUploadDeniedExtRegex = new RegExp( FCKConfig.MediaUploadDeniedExtensions, 'i' ) ;
  1083. function CheckUpload()
  1084. {
  1085. var sFile = GetE( 'txtUploadFile' ).value ;
  1086. if ( sFile.length == 0 )
  1087. {
  1088. alert( FCKLang['UploadSelectFileFirst'] ) ;
  1089. return false ;
  1090. }
  1091. if ( ( FCKConfig.MediaUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) ||
  1092. ( FCKConfig.MediaUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) )
  1093. {
  1094. OnUploadCompleted( 202 ) ;
  1095. return false ;
  1096. }
  1097. // Show animation.
  1098. window.parent.Throbber.Show( 100 ) ;
  1099. GetE( 'divUpload' ).style.display = 'none' ;
  1100. return true ;
  1101. }