annotate media/js/tiny_mce/plugins/preview/jscripts/embed.js @ 45:a5b4c5ce0658

Breaking down and controlling all media files, including javascript libraries.
author Brian Neal <bgneal@gmail.com>
date Fri, 19 Jun 2009 03:16:03 +0000
parents
children
rev   line source
bgneal@45 1 /**
bgneal@45 2 * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
bgneal@45 3 */
bgneal@45 4
bgneal@45 5 function writeFlash(p) {
bgneal@45 6 writeEmbed(
bgneal@45 7 'D27CDB6E-AE6D-11cf-96B8-444553540000',
bgneal@45 8 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
bgneal@45 9 'application/x-shockwave-flash',
bgneal@45 10 p
bgneal@45 11 );
bgneal@45 12 }
bgneal@45 13
bgneal@45 14 function writeShockWave(p) {
bgneal@45 15 writeEmbed(
bgneal@45 16 '166B1BCA-3F9C-11CF-8075-444553540000',
bgneal@45 17 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
bgneal@45 18 'application/x-director',
bgneal@45 19 p
bgneal@45 20 );
bgneal@45 21 }
bgneal@45 22
bgneal@45 23 function writeQuickTime(p) {
bgneal@45 24 writeEmbed(
bgneal@45 25 '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
bgneal@45 26 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
bgneal@45 27 'video/quicktime',
bgneal@45 28 p
bgneal@45 29 );
bgneal@45 30 }
bgneal@45 31
bgneal@45 32 function writeRealMedia(p) {
bgneal@45 33 writeEmbed(
bgneal@45 34 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
bgneal@45 35 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
bgneal@45 36 'audio/x-pn-realaudio-plugin',
bgneal@45 37 p
bgneal@45 38 );
bgneal@45 39 }
bgneal@45 40
bgneal@45 41 function writeWindowsMedia(p) {
bgneal@45 42 p.url = p.src;
bgneal@45 43 writeEmbed(
bgneal@45 44 '6BF52A52-394A-11D3-B153-00C04F79FAA6',
bgneal@45 45 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
bgneal@45 46 'application/x-mplayer2',
bgneal@45 47 p
bgneal@45 48 );
bgneal@45 49 }
bgneal@45 50
bgneal@45 51 function writeEmbed(cls, cb, mt, p) {
bgneal@45 52 var h = '', n;
bgneal@45 53
bgneal@45 54 h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
bgneal@45 55 h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
bgneal@45 56 h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
bgneal@45 57 h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
bgneal@45 58 h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
bgneal@45 59 h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
bgneal@45 60 h += '>';
bgneal@45 61
bgneal@45 62 for (n in p)
bgneal@45 63 h += '<param name="' + n + '" value="' + p[n] + '">';
bgneal@45 64
bgneal@45 65 h += '<embed type="' + mt + '"';
bgneal@45 66
bgneal@45 67 for (n in p)
bgneal@45 68 h += n + '="' + p[n] + '" ';
bgneal@45 69
bgneal@45 70 h += '></embed></object>';
bgneal@45 71
bgneal@45 72 document.write(h);
bgneal@45 73 }