Index: branches/js2-work/phase3/js/mwEmbed/skins/common/common.css |
— | — | @@ -330,6 +330,9 @@ |
331 | 331 | .ui-widget-content input { |
332 | 332 | padding: 5px; |
333 | 333 | } |
| 334 | +.ui-widget-content a { |
| 335 | + color:#009; |
| 336 | +} |
334 | 337 | |
335 | 338 | ul.ui-provider-selection { |
336 | 339 | list-style-type: none; |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/loader.js |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | mw.addClassFilePaths( { |
15 | 15 | "$j.fn.dragDropFile" : "modules/AddMedia/jquery.dragDropFile.js", |
16 | 16 | |
17 | | - "mw.UploadForm": "modules/AddMedia/mw.UploadForm.js", |
| 17 | + "mw.UploadForm" : "modules/AddMedia/mw.UploadForm.js", |
18 | 18 | |
19 | 19 | "mw.UploadHandler" : "modules/AddMedia/mw.UploadHandler.js", |
20 | 20 | "mw.UploadInterface" : "modules/AddMedia/mw.UploadInterface.js", |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadInterface.js |
— | — | @@ -18,23 +18,23 @@ |
19 | 19 | "mwe-uploaded-status" : "Uploaded", |
20 | 20 | "mwe-uploaded-time-remaining" : "Time remaining: $1" |
21 | 21 | }); |
| 22 | + |
22 | 23 | /** |
23 | | - * Base UploadInterface object |
| 24 | + * Set the base uploadInterface |
24 | 25 | */ |
25 | 26 | mw.UploadInterface = { }; |
26 | 27 | |
27 | | - |
28 | 28 | /** |
29 | | - * Dialog Interface |
| 29 | + * Upload Dialog Interface |
30 | 30 | */ |
31 | | -mw.DialogInterface = function( uploadHandler ) { |
| 31 | +mw.UploadDialogInterface = function( uploadHandler ) { |
32 | 32 | // Set a reference the uploadHandler if provided |
33 | 33 | if( uploadHandler ) { |
34 | 34 | this.uploadHandler = uploadHandler; |
35 | 35 | } |
36 | 36 | return this; |
37 | 37 | } |
38 | | -mw.DialogInterface.prototype = { |
| 38 | +mw.UploadDialogInterface.prototype = { |
39 | 39 | |
40 | 40 | // The following are really state of the upload, not the interface. |
41 | 41 | // we are currently only managing one, so this is okay... for now. |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | var _this = this; |
50 | 50 | |
51 | 51 | // Start the "upload" time |
52 | | - this.uploadBeginTime = (new Date()).getTime(); |
| 52 | + this.uploadBeginTime = ( new Date() ).getTime(); |
53 | 53 | |
54 | 54 | // Remove the old instance if present |
55 | 55 | if( $j( '#upProgressDialog' ).length != 0 ) { |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadForm.js |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | /** |
3 | | - * simple form output jquery binding |
| 3 | + * Simple form output jquery binding |
4 | 4 | * enables dynamic form output to a given target |
5 | 5 | * |
6 | 6 | */ |
— | — | @@ -96,10 +96,8 @@ |
97 | 97 | return false; |
98 | 98 | } |
99 | 99 | options.eToken = eToken; |
100 | | - // Add the upload form html: |
101 | | - $j( options.target ).html( |
102 | | - getUploadForm( options ) |
103 | | - ); |
| 100 | + // Add the upload form to the options target: |
| 101 | + addUploadForm( options ); |
104 | 102 | |
105 | 103 | |
106 | 104 | // Set the target with the form output: |
— | — | @@ -117,35 +115,41 @@ |
118 | 116 | } |
119 | 117 | } ); |
120 | 118 | |
121 | | - // Do destination fill |
122 | | - $j( "#wpUploadFile" ).change( function() { |
123 | | - var path = $j( this ).val(); |
124 | | - // Find trailing part |
125 | | - var slash = path.lastIndexOf( '/' ); |
126 | | - var backslash = path.lastIndexOf( '\\' ); |
127 | | - var fname; |
128 | | - if ( slash == -1 && backslash == -1 ) { |
129 | | - fname = path; |
130 | | - } else if ( slash > backslash ) { |
131 | | - fname = path.substring( slash + 1, 10000 ); |
132 | | - } else { |
133 | | - fname = path.substring( backslash + 1, 10000 ); |
134 | | - } |
135 | | - fname = fname.charAt( 0 ).toUpperCase().concat( fname.substring( 1, 10000 ) ).replace( / /g, '_' ); |
| 119 | + |
| 120 | + // Do local destination fill ( if we are local ) |
| 121 | + // Otherwise its handled via mw.ApiProxy.browseFile selectFileCb option |
| 122 | + if( mw.isLocalDomain( options.api_target ) ) { |
| 123 | + $j( "#wpUploadFile" ).change( function() { |
| 124 | + var path = $j( this ).val(); |
| 125 | + // Find trailing part |
| 126 | + var slash = path.lastIndexOf( '/' ); |
| 127 | + var backslash = path.lastIndexOf( '\\' ); |
| 128 | + var fname; |
| 129 | + if ( slash == -1 && backslash == -1 ) { |
| 130 | + fname = path; |
| 131 | + } else if ( slash > backslash ) { |
| 132 | + fname = path.substring( slash + 1, 10000 ); |
| 133 | + } else { |
| 134 | + fname = path.substring( backslash + 1, 10000 ); |
| 135 | + } |
| 136 | + fname = fname.charAt( 0 ).toUpperCase().concat( fname.substring( 1, 10000 ) ).replace( / /g, '_' ); |
| 137 | + |
| 138 | + // Output result |
| 139 | + $j( "#wpDestFile" ).val( fname ); |
| 140 | + |
| 141 | + // Do destination check |
| 142 | + $j( "#wpDestFile" ).doDestCheck( { |
| 143 | + 'warn_target':'#wpDestFile-warning' |
| 144 | + } ); |
| 145 | + } ); |
136 | 146 | |
137 | | - // Output result |
138 | | - $j( "#wpDestFile" ).val( fname ); |
139 | | - |
140 | | - // Do destination check |
141 | | - $j( "#wpDestFile" ).doDestCheck( { |
142 | | - 'warn_target':'#wpDestFile-warning' |
143 | | - } ); |
144 | | - } ); |
| 147 | + } |
145 | 148 | |
146 | 149 | |
147 | | - // Do destination check: |
| 150 | + // Do remote or local destination check: |
148 | 151 | $j( "#wpDestFile" ).change( function() { |
149 | 152 | $j( "#wpDestFile" ).doDestCheck( { |
| 153 | + 'apiUrl' : options.api_target, |
150 | 154 | 'warn_target':'#wpDestFile-warning' |
151 | 155 | } ); |
152 | 156 | } ); |
— | — | @@ -198,6 +202,33 @@ |
199 | 203 | } |
200 | 204 | |
201 | 205 | /** |
| 206 | + * Setup a fileBrowse proxy for a given target |
| 207 | + */ |
| 208 | + function setupApiFileBrowseProxy ( $targetFileBrowse, options ) { |
| 209 | + // Load the apiProxy ( if its not already loaded ) |
| 210 | + mw.load( 'ApiProxy', function( ) { |
| 211 | + var fileIframeName = mw.ApiProxy.browseFile( { |
| 212 | + //Target div to put the iframe browser button: |
| 213 | + 'target' : $targetFileBrowse, |
| 214 | + |
| 215 | + // Api url to upload to |
| 216 | + 'apiUrl' : options.api_target, |
| 217 | + |
| 218 | + // File Destination Name change callback: |
| 219 | + 'selectFileCb' : function( fname ) { |
| 220 | + // Update our local target: |
| 221 | + $j('#wpDestFile').val( fname ); |
| 222 | + // Run a destination file name check on the remote target |
| 223 | + $j('#wpDestFile').doDestCheck( { |
| 224 | + 'apiUrl' : options.api_target, |
| 225 | + 'warn_target': '#file-warning' |
| 226 | + } ); |
| 227 | + } |
| 228 | + // Error / "prompt" callback |
| 229 | + } ); |
| 230 | + }); |
| 231 | + } |
| 232 | + /** |
202 | 233 | * Get a provider upload links for local upload and remote |
203 | 234 | */ |
204 | 235 | function getProviderUploadLinks( uploadTargetId ){ |
— | — | @@ -290,22 +321,27 @@ |
291 | 322 | /** |
292 | 323 | * Get a jquery built upload form |
293 | 324 | */ |
294 | | - function getUploadForm( options ){ |
| 325 | + function addUploadForm( options ){ |
295 | 326 | |
296 | 327 | if( ! options.eToken ){ |
297 | 328 | mw.log( "Error getUploadForm missing token" ); |
298 | 329 | return false; |
299 | 330 | } |
300 | 331 | |
301 | | - // Build an upload form: |
302 | | - var $uploadForm = $j( '<form />' ).attr( { |
303 | | - 'id' : "suf_upload", |
304 | | - 'name' : "suf_upload", |
305 | | - 'enctype' : "multipart/form-data", |
306 | | - 'action' : options.api_target, |
307 | | - 'method' : "post" |
308 | | - } ); |
| 332 | + // Build an upload form: |
| 333 | + $j( options.target ).empty().append( |
| 334 | + $j( '<form />' ).attr( { |
| 335 | + 'id' : "suf_upload", |
| 336 | + 'name' : "suf_upload", |
| 337 | + 'enctype' : "multipart/form-data", |
| 338 | + 'action' : options.api_target, |
| 339 | + 'method' : "post" |
| 340 | + } ) |
| 341 | + ); |
309 | 342 | |
| 343 | + //Set the uploadForm target |
| 344 | + var $uploadForm = $j( options.target ).find('#suf_upload'); |
| 345 | + |
310 | 346 | // Add hidden input |
311 | 347 | $uploadForm.append( |
312 | 348 | $j( '<input />') |
— | — | @@ -334,7 +370,7 @@ |
335 | 371 | // Add upload File input |
336 | 372 | $uploadForm.append( |
337 | 373 | $j( '<label />' ).attr({ |
338 | | - 'for' : "wpUploadFile" |
| 374 | + 'for' : "file-name" |
339 | 375 | }) |
340 | 376 | .text( gM( 'mwe-select_file' ) ), |
341 | 377 | |
— | — | @@ -353,13 +389,13 @@ |
354 | 390 | } ) |
355 | 391 | .css( 'display', 'inline' ) |
356 | 392 | ); |
357 | | - } else { |
| 393 | + } else { |
358 | 394 | $uploadForm.append( |
359 | 395 | $j( '<div />' ) |
360 | 396 | .addClass( 'remote-browse-file' ) |
361 | 397 | .loadingSpinner() |
362 | 398 | ) |
363 | | - setupApiFileBrowseProxy( |
| 399 | + setupApiFileBrowseProxy( |
364 | 400 | $uploadForm.find('.remote-browse-file' ), |
365 | 401 | options |
366 | 402 | ); |
— | — | @@ -370,7 +406,7 @@ |
371 | 407 | $j( '<br />' ), |
372 | 408 | $j( '<label />' ) |
373 | 409 | .attr({ |
374 | | - 'for' : "wpUploadDescription" |
| 410 | + 'for' : "file-desc" |
375 | 411 | }) |
376 | 412 | .text( gM( 'mwe-summary' ) ), |
377 | 413 | |
— | — | @@ -479,34 +515,6 @@ |
480 | 516 | |
481 | 517 | return $uploadForm; |
482 | 518 | }; |
483 | | - |
484 | | - /** |
485 | | - * Setup a fileBrowse proxy for a given target |
486 | | - */ |
487 | | - function setupApiFileBrowseProxy ( $targetFileBrowse, options ) { |
488 | | - // Load the apiProxy ( if its not already loaded ) |
489 | | - mw.load( 'ApiProxy', function( ) { |
490 | | - var fileIframeName = mw.ApiProxy.browseFile( { |
491 | | - //Target div to put the iframe browser button: |
492 | | - 'target' : $targetFileBrowse, |
493 | | - |
494 | | - // Api url to upload to |
495 | | - 'apiUrl' : options.api_target, |
496 | | - |
497 | | - // File Destination Name change callback: |
498 | | - 'selectFileCb' : function( fname ) { |
499 | | - // Update our local target: |
500 | | - $j('#file-name').val( fname ); |
501 | | - // Run a destination file name check on the remote target |
502 | | - $j('#file-name').doDestCheck( { |
503 | | - 'apiUrl' : options.api_target, |
504 | | - 'warn_target': '#file-warning' |
505 | | - } ); |
506 | | - } |
507 | | - // Error / "prompt" callback |
508 | | - } ); |
509 | | - }); |
510 | | - } |
511 | 519 | |
512 | 520 | |
513 | 521 | } )( window.mw.UploadForm ); |
\ No newline at end of file |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.RemoteSearchDriver.js |
— | — | @@ -262,6 +262,8 @@ |
263 | 263 | 'apiUrl': ( wgServer && wgScriptPath ) ? |
264 | 264 | wgServer + wgScriptPath + '/api.php' : null, |
265 | 265 | 'lib': 'mediaWiki', |
| 266 | + 'homepage' : ( wgServer && wgScript ) ? |
| 267 | + wgServer + wgScript : null, |
266 | 268 | 'local': true, |
267 | 269 | 'tab_img': false |
268 | 270 | }, |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/kplayerEmbed.js |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | var playerPath = mw.getMwEmbedPath() + 'modules/EmbedPlayer/binPlayers/kaltura-player'; |
27 | 27 | |
28 | 28 | |
29 | | - $j( this ).html( |
| 29 | + /*$j( this ).html( |
30 | 30 | '<object width="' + this.getWidth() + '" height="' + this.getHeight() + '" ' + |
31 | 31 | 'data="' + playerPath + '/wrapper.swf" allowfullscreen="true" ' + |
32 | 32 | 'allownetworking="all" allowscriptaccess="always" ' + |
— | — | @@ -49,7 +49,36 @@ |
50 | 50 | 'name="flashVars"/>' + |
51 | 51 | '<param value="opaque" name="wmode"/>' + |
52 | 52 | '</object>' |
53 | | - ) |
| 53 | + )*/ |
| 54 | + |
| 55 | + var flashvars = {}; |
| 56 | + flashvars.autoPlay = "true"; |
| 57 | + flashvars.entryId = _this.getSrc(); |
| 58 | + flashvars.debugMode = "true"; |
| 59 | + flashvars.fileSystemMode = "true"; |
| 60 | + flashvars.widgetId = "_7463"; |
| 61 | + flashvars.partnerId = "7463"; |
| 62 | + flashvars.pluginDomain = "kdp3/plugins/"; |
| 63 | + flashvars.kml = "local"; |
| 64 | + flashvars.kmlPath = playerPath + '/config.xml'; |
| 65 | + flashvars.sourceType = "url"; |
| 66 | + flashvars.host = "www.kaltura.com"; |
| 67 | + flashvars.externalInterfaceDisabled = 'false'; |
| 68 | + |
| 69 | + var params = {}; |
| 70 | + params.quality = "best"; |
| 71 | + params.wmode = "opaque"; |
| 72 | + params.allowfullscreen = "true"; |
| 73 | + params.allowscriptaccess = "sameDomain"; |
| 74 | + |
| 75 | + var attributes = {}; |
| 76 | + attributes.id = 'vid1'; |
| 77 | + attributes.name = "kdp3"; |
| 78 | + attributes.styleclass = "player"; |
| 79 | + debugger; |
| 80 | + swfobject.embedSWF( playerPath + "/kdp3.swf", "kdp3", "790", "466", "10.0.0", playerPath +"/expressInstall.swf", flashvars, params, attributes); |
| 81 | + |
| 82 | + |
54 | 83 | setTimeout(function() { |
55 | 84 | _this.postEmbedJS(); |
56 | 85 | }, 50); |
— | — | @@ -182,3 +211,783 @@ |
183 | 212 | function onKdpReady( playerId ) { |
184 | 213 | mw.log( "player is ready::" + playerId); |
185 | 214 | } |
| 215 | + |
| 216 | + |
| 217 | + |
| 218 | +/*! SWFObject v2.2 <http://code.google.com/p/swfobject/> |
| 219 | + is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> |
| 220 | +*/ |
| 221 | + |
| 222 | +var swfobject = function() { |
| 223 | + |
| 224 | + var UNDEF = "undefined", |
| 225 | + OBJECT = "object", |
| 226 | + SHOCKWAVE_FLASH = "Shockwave Flash", |
| 227 | + SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash", |
| 228 | + FLASH_MIME_TYPE = "application/x-shockwave-flash", |
| 229 | + EXPRESS_INSTALL_ID = "SWFObjectExprInst", |
| 230 | + ON_READY_STATE_CHANGE = "onreadystatechange", |
| 231 | + |
| 232 | + win = window, |
| 233 | + doc = document, |
| 234 | + nav = navigator, |
| 235 | + |
| 236 | + plugin = false, |
| 237 | + domLoadFnArr = [main], |
| 238 | + regObjArr = [], |
| 239 | + objIdArr = [], |
| 240 | + listenersArr = [], |
| 241 | + storedAltContent, |
| 242 | + storedAltContentId, |
| 243 | + storedCallbackFn, |
| 244 | + storedCallbackObj, |
| 245 | + isDomLoaded = false, |
| 246 | + isExpressInstallActive = false, |
| 247 | + dynamicStylesheet, |
| 248 | + dynamicStylesheetMedia, |
| 249 | + autoHideShow = true, |
| 250 | + |
| 251 | + /* Centralized function for browser feature detection |
| 252 | + - User agent string detection is only used when no good alternative is possible |
| 253 | + - Is executed directly for optimal performance |
| 254 | + */ |
| 255 | + ua = function() { |
| 256 | + var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF, |
| 257 | + u = nav.userAgent.toLowerCase(), |
| 258 | + p = nav.platform.toLowerCase(), |
| 259 | + windows = p ? /win/.test(p) : /win/.test(u), |
| 260 | + mac = p ? /mac/.test(p) : /mac/.test(u), |
| 261 | + webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit |
| 262 | + ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html |
| 263 | + playerVersion = [0,0,0], |
| 264 | + d = null; |
| 265 | + if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) { |
| 266 | + d = nav.plugins[SHOCKWAVE_FLASH].description; |
| 267 | + if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+ |
| 268 | + plugin = true; |
| 269 | + ie = false; // cascaded feature detection for Internet Explorer |
| 270 | + d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); |
| 271 | + playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10); |
| 272 | + playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10); |
| 273 | + playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0; |
| 274 | + } |
| 275 | + } |
| 276 | + else if (typeof win.ActiveXObject != UNDEF) { |
| 277 | + try { |
| 278 | + var a = new ActiveXObject(SHOCKWAVE_FLASH_AX); |
| 279 | + if (a) { // a will return null when ActiveX is disabled |
| 280 | + d = a.GetVariable("$version"); |
| 281 | + if (d) { |
| 282 | + ie = true; // cascaded feature detection for Internet Explorer |
| 283 | + d = d.split(" ")[1].split(","); |
| 284 | + playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; |
| 285 | + } |
| 286 | + } |
| 287 | + } |
| 288 | + catch(e) {} |
| 289 | + } |
| 290 | + return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac }; |
| 291 | + }(), |
| 292 | + |
| 293 | + /* Cross-browser onDomLoad |
| 294 | + - Will fire an event as soon as the DOM of a web page is loaded |
| 295 | + - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/ |
| 296 | + - Regular onload serves as fallback |
| 297 | + */ |
| 298 | + onDomLoad = function() { |
| 299 | + if (!ua.w3) { return; } |
| 300 | + if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically |
| 301 | + callDomLoadFunctions(); |
| 302 | + } |
| 303 | + if (!isDomLoaded) { |
| 304 | + if (typeof doc.addEventListener != UNDEF) { |
| 305 | + doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false); |
| 306 | + } |
| 307 | + if (ua.ie && ua.win) { |
| 308 | + doc.attachEvent(ON_READY_STATE_CHANGE, function() { |
| 309 | + if (doc.readyState == "complete") { |
| 310 | + doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee); |
| 311 | + callDomLoadFunctions(); |
| 312 | + } |
| 313 | + }); |
| 314 | + if (win == top) { // if not inside an iframe |
| 315 | + (function(){ |
| 316 | + if (isDomLoaded) { return; } |
| 317 | + try { |
| 318 | + doc.documentElement.doScroll("left"); |
| 319 | + } |
| 320 | + catch(e) { |
| 321 | + setTimeout(arguments.callee, 0); |
| 322 | + return; |
| 323 | + } |
| 324 | + callDomLoadFunctions(); |
| 325 | + })(); |
| 326 | + } |
| 327 | + } |
| 328 | + if (ua.wk) { |
| 329 | + (function(){ |
| 330 | + if (isDomLoaded) { return; } |
| 331 | + if (!/loaded|complete/.test(doc.readyState)) { |
| 332 | + setTimeout(arguments.callee, 0); |
| 333 | + return; |
| 334 | + } |
| 335 | + callDomLoadFunctions(); |
| 336 | + })(); |
| 337 | + } |
| 338 | + addLoadEvent(callDomLoadFunctions); |
| 339 | + } |
| 340 | + }(); |
| 341 | + |
| 342 | + function callDomLoadFunctions() { |
| 343 | + if (isDomLoaded) { return; } |
| 344 | + try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early |
| 345 | + var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span")); |
| 346 | + t.parentNode.removeChild(t); |
| 347 | + } |
| 348 | + catch (e) { return; } |
| 349 | + isDomLoaded = true; |
| 350 | + var dl = domLoadFnArr.length; |
| 351 | + for (var i = 0; i < dl; i++) { |
| 352 | + domLoadFnArr[i](); |
| 353 | + } |
| 354 | + } |
| 355 | + |
| 356 | + function addDomLoadEvent(fn) { |
| 357 | + if (isDomLoaded) { |
| 358 | + fn(); |
| 359 | + } |
| 360 | + else { |
| 361 | + domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+ |
| 362 | + } |
| 363 | + } |
| 364 | + |
| 365 | + /* Cross-browser onload |
| 366 | + - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/ |
| 367 | + - Will fire an event as soon as a web page including all of its assets are loaded |
| 368 | + */ |
| 369 | + function addLoadEvent(fn) { |
| 370 | + if (typeof win.addEventListener != UNDEF) { |
| 371 | + win.addEventListener("load", fn, false); |
| 372 | + } |
| 373 | + else if (typeof doc.addEventListener != UNDEF) { |
| 374 | + doc.addEventListener("load", fn, false); |
| 375 | + } |
| 376 | + else if (typeof win.attachEvent != UNDEF) { |
| 377 | + addListener(win, "onload", fn); |
| 378 | + } |
| 379 | + else if (typeof win.onload == "function") { |
| 380 | + var fnOld = win.onload; |
| 381 | + win.onload = function() { |
| 382 | + fnOld(); |
| 383 | + fn(); |
| 384 | + }; |
| 385 | + } |
| 386 | + else { |
| 387 | + win.onload = fn; |
| 388 | + } |
| 389 | + } |
| 390 | + |
| 391 | + /* Main function |
| 392 | + - Will preferably execute onDomLoad, otherwise onload (as a fallback) |
| 393 | + */ |
| 394 | + function main() { |
| 395 | + if (plugin) { |
| 396 | + testPlayerVersion(); |
| 397 | + } |
| 398 | + else { |
| 399 | + matchVersions(); |
| 400 | + } |
| 401 | + } |
| 402 | + |
| 403 | + /* Detect the Flash Player version for non-Internet Explorer browsers |
| 404 | + - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description: |
| 405 | + a. Both release and build numbers can be detected |
| 406 | + b. Avoid wrong descriptions by corrupt installers provided by Adobe |
| 407 | + c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports |
| 408 | + - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available |
| 409 | + */ |
| 410 | + function testPlayerVersion() { |
| 411 | + var b = doc.getElementsByTagName("body")[0]; |
| 412 | + var o = createElement(OBJECT); |
| 413 | + o.setAttribute("type", FLASH_MIME_TYPE); |
| 414 | + var t = b.appendChild(o); |
| 415 | + if (t) { |
| 416 | + var counter = 0; |
| 417 | + (function(){ |
| 418 | + if (typeof t.GetVariable != UNDEF) { |
| 419 | + var d = t.GetVariable("$version"); |
| 420 | + if (d) { |
| 421 | + d = d.split(" ")[1].split(","); |
| 422 | + ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; |
| 423 | + } |
| 424 | + } |
| 425 | + else if (counter < 10) { |
| 426 | + counter++; |
| 427 | + setTimeout(arguments.callee, 10); |
| 428 | + return; |
| 429 | + } |
| 430 | + b.removeChild(o); |
| 431 | + t = null; |
| 432 | + matchVersions(); |
| 433 | + })(); |
| 434 | + } |
| 435 | + else { |
| 436 | + matchVersions(); |
| 437 | + } |
| 438 | + } |
| 439 | + |
| 440 | + /* Perform Flash Player and SWF version matching; static publishing only |
| 441 | + */ |
| 442 | + function matchVersions() { |
| 443 | + var rl = regObjArr.length; |
| 444 | + if (rl > 0) { |
| 445 | + for (var i = 0; i < rl; i++) { // for each registered object element |
| 446 | + var id = regObjArr[i].id; |
| 447 | + var cb = regObjArr[i].callbackFn; |
| 448 | + var cbObj = {success:false, id:id}; |
| 449 | + if (ua.pv[0] > 0) { |
| 450 | + var obj = getElementById(id); |
| 451 | + if (obj) { |
| 452 | + if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match! |
| 453 | + setVisibility(id, true); |
| 454 | + if (cb) { |
| 455 | + cbObj.success = true; |
| 456 | + cbObj.ref = getObjectById(id); |
| 457 | + cb(cbObj); |
| 458 | + } |
| 459 | + } |
| 460 | + else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported |
| 461 | + var att = {}; |
| 462 | + att.data = regObjArr[i].expressInstall; |
| 463 | + att.width = obj.getAttribute("width") || "0"; |
| 464 | + att.height = obj.getAttribute("height") || "0"; |
| 465 | + if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); } |
| 466 | + if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); } |
| 467 | + // parse HTML object param element's name-value pairs |
| 468 | + var par = {}; |
| 469 | + var p = obj.getElementsByTagName("param"); |
| 470 | + var pl = p.length; |
| 471 | + for (var j = 0; j < pl; j++) { |
| 472 | + if (p[j].getAttribute("name").toLowerCase() != "movie") { |
| 473 | + par[p[j].getAttribute("name")] = p[j].getAttribute("value"); |
| 474 | + } |
| 475 | + } |
| 476 | + showExpressInstall(att, par, id, cb); |
| 477 | + } |
| 478 | + else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF |
| 479 | + displayAltContent(obj); |
| 480 | + if (cb) { cb(cbObj); } |
| 481 | + } |
| 482 | + } |
| 483 | + } |
| 484 | + else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content) |
| 485 | + setVisibility(id, true); |
| 486 | + if (cb) { |
| 487 | + var o = getObjectById(id); // test whether there is an HTML object element or not |
| 488 | + if (o && typeof o.SetVariable != UNDEF) { |
| 489 | + cbObj.success = true; |
| 490 | + cbObj.ref = o; |
| 491 | + } |
| 492 | + cb(cbObj); |
| 493 | + } |
| 494 | + } |
| 495 | + } |
| 496 | + } |
| 497 | + } |
| 498 | + |
| 499 | + function getObjectById(objectIdStr) { |
| 500 | + var r = null; |
| 501 | + var o = getElementById(objectIdStr); |
| 502 | + if (o && o.nodeName == "OBJECT") { |
| 503 | + if (typeof o.SetVariable != UNDEF) { |
| 504 | + r = o; |
| 505 | + } |
| 506 | + else { |
| 507 | + var n = o.getElementsByTagName(OBJECT)[0]; |
| 508 | + if (n) { |
| 509 | + r = n; |
| 510 | + } |
| 511 | + } |
| 512 | + } |
| 513 | + return r; |
| 514 | + } |
| 515 | + |
| 516 | + /* Requirements for Adobe Express Install |
| 517 | + - only one instance can be active at a time |
| 518 | + - fp 6.0.65 or higher |
| 519 | + - Win/Mac OS only |
| 520 | + - no Webkit engines older than version 312 |
| 521 | + */ |
| 522 | + function canExpressInstall() { |
| 523 | + return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312); |
| 524 | + } |
| 525 | + |
| 526 | + /* Show the Adobe Express Install dialog |
| 527 | + - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75 |
| 528 | + */ |
| 529 | + function showExpressInstall(att, par, replaceElemIdStr, callbackFn) { |
| 530 | + isExpressInstallActive = true; |
| 531 | + storedCallbackFn = callbackFn || null; |
| 532 | + storedCallbackObj = {success:false, id:replaceElemIdStr}; |
| 533 | + var obj = getElementById(replaceElemIdStr); |
| 534 | + if (obj) { |
| 535 | + if (obj.nodeName == "OBJECT") { // static publishing |
| 536 | + storedAltContent = abstractAltContent(obj); |
| 537 | + storedAltContentId = null; |
| 538 | + } |
| 539 | + else { // dynamic publishing |
| 540 | + storedAltContent = obj; |
| 541 | + storedAltContentId = replaceElemIdStr; |
| 542 | + } |
| 543 | + att.id = EXPRESS_INSTALL_ID; |
| 544 | + if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; } |
| 545 | + if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; } |
| 546 | + doc.title = doc.title.slice(0, 47) + " - Flash Player Installation"; |
| 547 | + var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn", |
| 548 | + fv = "MMredirectURL=" + win.location.toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title; |
| 549 | + if (typeof par.flashvars != UNDEF) { |
| 550 | + par.flashvars += "&" + fv; |
| 551 | + } |
| 552 | + else { |
| 553 | + par.flashvars = fv; |
| 554 | + } |
| 555 | + // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, |
| 556 | + // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work |
| 557 | + if (ua.ie && ua.win && obj.readyState != 4) { |
| 558 | + var newObj = createElement("div"); |
| 559 | + replaceElemIdStr += "SWFObjectNew"; |
| 560 | + newObj.setAttribute("id", replaceElemIdStr); |
| 561 | + obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf |
| 562 | + obj.style.display = "none"; |
| 563 | + (function(){ |
| 564 | + if (obj.readyState == 4) { |
| 565 | + obj.parentNode.removeChild(obj); |
| 566 | + } |
| 567 | + else { |
| 568 | + setTimeout(arguments.callee, 10); |
| 569 | + } |
| 570 | + })(); |
| 571 | + } |
| 572 | + createSWF(att, par, replaceElemIdStr); |
| 573 | + } |
| 574 | + } |
| 575 | + |
| 576 | + /* Functions to abstract and display alternative content |
| 577 | + */ |
| 578 | + function displayAltContent(obj) { |
| 579 | + if (ua.ie && ua.win && obj.readyState != 4) { |
| 580 | + // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, |
| 581 | + // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work |
| 582 | + var el = createElement("div"); |
| 583 | + obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content |
| 584 | + el.parentNode.replaceChild(abstractAltContent(obj), el); |
| 585 | + obj.style.display = "none"; |
| 586 | + (function(){ |
| 587 | + if (obj.readyState == 4) { |
| 588 | + obj.parentNode.removeChild(obj); |
| 589 | + } |
| 590 | + else { |
| 591 | + setTimeout(arguments.callee, 10); |
| 592 | + } |
| 593 | + })(); |
| 594 | + } |
| 595 | + else { |
| 596 | + obj.parentNode.replaceChild(abstractAltContent(obj), obj); |
| 597 | + } |
| 598 | + } |
| 599 | + |
| 600 | + function abstractAltContent(obj) { |
| 601 | + var ac = createElement("div"); |
| 602 | + if (ua.win && ua.ie) { |
| 603 | + ac.innerHTML = obj.innerHTML; |
| 604 | + } |
| 605 | + else { |
| 606 | + var nestedObj = obj.getElementsByTagName(OBJECT)[0]; |
| 607 | + if (nestedObj) { |
| 608 | + var c = nestedObj.childNodes; |
| 609 | + if (c) { |
| 610 | + var cl = c.length; |
| 611 | + for (var i = 0; i < cl; i++) { |
| 612 | + if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) { |
| 613 | + ac.appendChild(c[i].cloneNode(true)); |
| 614 | + } |
| 615 | + } |
| 616 | + } |
| 617 | + } |
| 618 | + } |
| 619 | + return ac; |
| 620 | + } |
| 621 | + |
| 622 | + /* Cross-browser dynamic SWF creation |
| 623 | + */ |
| 624 | + function createSWF(attObj, parObj, id) { |
| 625 | + var r, el = getElementById(id); |
| 626 | + if (ua.wk && ua.wk < 312) { return r; } |
| 627 | + if (el) { |
| 628 | + if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content |
| 629 | + attObj.id = id; |
| 630 | + } |
| 631 | + if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML |
| 632 | + var att = ""; |
| 633 | + for (var i in attObj) { |
| 634 | + if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries |
| 635 | + if (i.toLowerCase() == "data") { |
| 636 | + parObj.movie = attObj[i]; |
| 637 | + } |
| 638 | + else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword |
| 639 | + att += ' class="' + attObj[i] + '"'; |
| 640 | + } |
| 641 | + else if (i.toLowerCase() != "classid") { |
| 642 | + att += ' ' + i + '="' + attObj[i] + '"'; |
| 643 | + } |
| 644 | + } |
| 645 | + } |
| 646 | + var par = ""; |
| 647 | + for (var j in parObj) { |
| 648 | + if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries |
| 649 | + par += '<param name="' + j + '" value="' + parObj[j] + '" />'; |
| 650 | + } |
| 651 | + } |
| 652 | + el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>'; |
| 653 | + objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only) |
| 654 | + r = getElementById(attObj.id); |
| 655 | + } |
| 656 | + else { // well-behaving browsers |
| 657 | + var o = createElement(OBJECT); |
| 658 | + o.setAttribute("type", FLASH_MIME_TYPE); |
| 659 | + for (var m in attObj) { |
| 660 | + if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries |
| 661 | + if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword |
| 662 | + o.setAttribute("class", attObj[m]); |
| 663 | + } |
| 664 | + else if (m.toLowerCase() != "classid") { // filter out IE specific attribute |
| 665 | + o.setAttribute(m, attObj[m]); |
| 666 | + } |
| 667 | + } |
| 668 | + } |
| 669 | + for (var n in parObj) { |
| 670 | + if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element |
| 671 | + createObjParam(o, n, parObj[n]); |
| 672 | + } |
| 673 | + } |
| 674 | + el.parentNode.replaceChild(o, el); |
| 675 | + r = o; |
| 676 | + } |
| 677 | + } |
| 678 | + return r; |
| 679 | + } |
| 680 | + |
| 681 | + function createObjParam(el, pName, pValue) { |
| 682 | + var p = createElement("param"); |
| 683 | + p.setAttribute("name", pName); |
| 684 | + p.setAttribute("value", pValue); |
| 685 | + el.appendChild(p); |
| 686 | + } |
| 687 | + |
| 688 | + /* Cross-browser SWF removal |
| 689 | + - Especially needed to safely and completely remove a SWF in Internet Explorer |
| 690 | + */ |
| 691 | + function removeSWF(id) { |
| 692 | + var obj = getElementById(id); |
| 693 | + if (obj && obj.nodeName == "OBJECT") { |
| 694 | + if (ua.ie && ua.win) { |
| 695 | + obj.style.display = "none"; |
| 696 | + (function(){ |
| 697 | + if (obj.readyState == 4) { |
| 698 | + removeObjectInIE(id); |
| 699 | + } |
| 700 | + else { |
| 701 | + setTimeout(arguments.callee, 10); |
| 702 | + } |
| 703 | + })(); |
| 704 | + } |
| 705 | + else { |
| 706 | + obj.parentNode.removeChild(obj); |
| 707 | + } |
| 708 | + } |
| 709 | + } |
| 710 | + |
| 711 | + function removeObjectInIE(id) { |
| 712 | + var obj = getElementById(id); |
| 713 | + if (obj) { |
| 714 | + for (var i in obj) { |
| 715 | + if (typeof obj[i] == "function") { |
| 716 | + obj[i] = null; |
| 717 | + } |
| 718 | + } |
| 719 | + obj.parentNode.removeChild(obj); |
| 720 | + } |
| 721 | + } |
| 722 | + |
| 723 | + /* Functions to optimize JavaScript compression |
| 724 | + */ |
| 725 | + function getElementById(id) { |
| 726 | + var el = null; |
| 727 | + try { |
| 728 | + el = doc.getElementById(id); |
| 729 | + } |
| 730 | + catch (e) {} |
| 731 | + return el; |
| 732 | + } |
| 733 | + |
| 734 | + function createElement(el) { |
| 735 | + return doc.createElement(el); |
| 736 | + } |
| 737 | + |
| 738 | + /* Updated attachEvent function for Internet Explorer |
| 739 | + - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks |
| 740 | + */ |
| 741 | + function addListener(target, eventType, fn) { |
| 742 | + target.attachEvent(eventType, fn); |
| 743 | + listenersArr[listenersArr.length] = [target, eventType, fn]; |
| 744 | + } |
| 745 | + |
| 746 | + /* Flash Player and SWF content version matching |
| 747 | + */ |
| 748 | + function hasPlayerVersion(rv) { |
| 749 | + var pv = ua.pv, v = rv.split("."); |
| 750 | + v[0] = parseInt(v[0], 10); |
| 751 | + v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0" |
| 752 | + v[2] = parseInt(v[2], 10) || 0; |
| 753 | + return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false; |
| 754 | + } |
| 755 | + |
| 756 | + /* Cross-browser dynamic CSS creation |
| 757 | + - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php |
| 758 | + */ |
| 759 | + function createCSS(sel, decl, media, newStyle) { |
| 760 | + if (ua.ie && ua.mac) { return; } |
| 761 | + var h = doc.getElementsByTagName("head")[0]; |
| 762 | + if (!h) { return; } // to also support badly authored HTML pages that lack a head element |
| 763 | + var m = (media && typeof media == "string") ? media : "screen"; |
| 764 | + if (newStyle) { |
| 765 | + dynamicStylesheet = null; |
| 766 | + dynamicStylesheetMedia = null; |
| 767 | + } |
| 768 | + if (!dynamicStylesheet || dynamicStylesheetMedia != m) { |
| 769 | + // create dynamic stylesheet + get a global reference to it |
| 770 | + var s = createElement("style"); |
| 771 | + s.setAttribute("type", "text/css"); |
| 772 | + s.setAttribute("media", m); |
| 773 | + dynamicStylesheet = h.appendChild(s); |
| 774 | + if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) { |
| 775 | + dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1]; |
| 776 | + } |
| 777 | + dynamicStylesheetMedia = m; |
| 778 | + } |
| 779 | + // add style rule |
| 780 | + if (ua.ie && ua.win) { |
| 781 | + if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) { |
| 782 | + dynamicStylesheet.addRule(sel, decl); |
| 783 | + } |
| 784 | + } |
| 785 | + else { |
| 786 | + if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) { |
| 787 | + dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}")); |
| 788 | + } |
| 789 | + } |
| 790 | + } |
| 791 | + |
| 792 | + function setVisibility(id, isVisible) { |
| 793 | + if (!autoHideShow) { return; } |
| 794 | + var v = isVisible ? "visible" : "hidden"; |
| 795 | + if (isDomLoaded && getElementById(id)) { |
| 796 | + getElementById(id).style.visibility = v; |
| 797 | + } |
| 798 | + else { |
| 799 | + createCSS("#" + id, "visibility:" + v); |
| 800 | + } |
| 801 | + } |
| 802 | + |
| 803 | + /* Filter to avoid XSS attacks |
| 804 | + */ |
| 805 | + function urlEncodeIfNecessary(s) { |
| 806 | + var regex = /[\\\"<>\.;]/; |
| 807 | + var hasBadChars = regex.exec(s) != null; |
| 808 | + return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s; |
| 809 | + } |
| 810 | + |
| 811 | + /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only) |
| 812 | + */ |
| 813 | + var cleanup = function() { |
| 814 | + if (ua.ie && ua.win) { |
| 815 | + window.attachEvent("onunload", function() { |
| 816 | + // remove listeners to avoid memory leaks |
| 817 | + var ll = listenersArr.length; |
| 818 | + for (var i = 0; i < ll; i++) { |
| 819 | + listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]); |
| 820 | + } |
| 821 | + // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect |
| 822 | + var il = objIdArr.length; |
| 823 | + for (var j = 0; j < il; j++) { |
| 824 | + removeSWF(objIdArr[j]); |
| 825 | + } |
| 826 | + // cleanup library's main closures to avoid memory leaks |
| 827 | + for (var k in ua) { |
| 828 | + ua[k] = null; |
| 829 | + } |
| 830 | + ua = null; |
| 831 | + for (var l in swfobject) { |
| 832 | + swfobject[l] = null; |
| 833 | + } |
| 834 | + swfobject = null; |
| 835 | + }); |
| 836 | + } |
| 837 | + }(); |
| 838 | + |
| 839 | + return { |
| 840 | + /* Public API |
| 841 | + - Reference: http://code.google.com/p/swfobject/wiki/documentation |
| 842 | + */ |
| 843 | + registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) { |
| 844 | + if (ua.w3 && objectIdStr && swfVersionStr) { |
| 845 | + var regObj = {}; |
| 846 | + regObj.id = objectIdStr; |
| 847 | + regObj.swfVersion = swfVersionStr; |
| 848 | + regObj.expressInstall = xiSwfUrlStr; |
| 849 | + regObj.callbackFn = callbackFn; |
| 850 | + regObjArr[regObjArr.length] = regObj; |
| 851 | + setVisibility(objectIdStr, false); |
| 852 | + } |
| 853 | + else if (callbackFn) { |
| 854 | + callbackFn({success:false, id:objectIdStr}); |
| 855 | + } |
| 856 | + }, |
| 857 | + |
| 858 | + getObjectById: function(objectIdStr) { |
| 859 | + if (ua.w3) { |
| 860 | + return getObjectById(objectIdStr); |
| 861 | + } |
| 862 | + }, |
| 863 | + |
| 864 | + embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) { |
| 865 | + var callbackObj = {success:false, id:replaceElemIdStr}; |
| 866 | + if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) { |
| 867 | + setVisibility(replaceElemIdStr, false); |
| 868 | + addDomLoadEvent(function() { |
| 869 | + widthStr += ""; // auto-convert to string |
| 870 | + heightStr += ""; |
| 871 | + var att = {}; |
| 872 | + if (attObj && typeof attObj === OBJECT) { |
| 873 | + for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs |
| 874 | + att[i] = attObj[i]; |
| 875 | + } |
| 876 | + } |
| 877 | + att.data = swfUrlStr; |
| 878 | + att.width = widthStr; |
| 879 | + att.height = heightStr; |
| 880 | + var par = {}; |
| 881 | + if (parObj && typeof parObj === OBJECT) { |
| 882 | + for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs |
| 883 | + par[j] = parObj[j]; |
| 884 | + } |
| 885 | + } |
| 886 | + if (flashvarsObj && typeof flashvarsObj === OBJECT) { |
| 887 | + for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs |
| 888 | + if (typeof par.flashvars != UNDEF) { |
| 889 | + par.flashvars += "&" + k + "=" + flashvarsObj[k]; |
| 890 | + } |
| 891 | + else { |
| 892 | + par.flashvars = k + "=" + flashvarsObj[k]; |
| 893 | + } |
| 894 | + } |
| 895 | + } |
| 896 | + if (hasPlayerVersion(swfVersionStr)) { // create SWF |
| 897 | + var obj = createSWF(att, par, replaceElemIdStr); |
| 898 | + if (att.id == replaceElemIdStr) { |
| 899 | + setVisibility(replaceElemIdStr, true); |
| 900 | + } |
| 901 | + callbackObj.success = true; |
| 902 | + callbackObj.ref = obj; |
| 903 | + } |
| 904 | + else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install |
| 905 | + att.data = xiSwfUrlStr; |
| 906 | + showExpressInstall(att, par, replaceElemIdStr, callbackFn); |
| 907 | + return; |
| 908 | + } |
| 909 | + else { // show alternative content |
| 910 | + setVisibility(replaceElemIdStr, true); |
| 911 | + } |
| 912 | + if (callbackFn) { callbackFn(callbackObj); } |
| 913 | + }); |
| 914 | + } |
| 915 | + else if (callbackFn) { callbackFn(callbackObj); } |
| 916 | + }, |
| 917 | + |
| 918 | + switchOffAutoHideShow: function() { |
| 919 | + autoHideShow = false; |
| 920 | + }, |
| 921 | + |
| 922 | + ua: ua, |
| 923 | + |
| 924 | + getFlashPlayerVersion: function() { |
| 925 | + return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] }; |
| 926 | + }, |
| 927 | + |
| 928 | + hasFlashPlayerVersion: hasPlayerVersion, |
| 929 | + |
| 930 | + createSWF: function(attObj, parObj, replaceElemIdStr) { |
| 931 | + if (ua.w3) { |
| 932 | + return createSWF(attObj, parObj, replaceElemIdStr); |
| 933 | + } |
| 934 | + else { |
| 935 | + return undefined; |
| 936 | + } |
| 937 | + }, |
| 938 | + |
| 939 | + showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) { |
| 940 | + if (ua.w3 && canExpressInstall()) { |
| 941 | + showExpressInstall(att, par, replaceElemIdStr, callbackFn); |
| 942 | + } |
| 943 | + }, |
| 944 | + |
| 945 | + removeSWF: function(objElemIdStr) { |
| 946 | + if (ua.w3) { |
| 947 | + removeSWF(objElemIdStr); |
| 948 | + } |
| 949 | + }, |
| 950 | + |
| 951 | + createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) { |
| 952 | + if (ua.w3) { |
| 953 | + createCSS(selStr, declStr, mediaStr, newStyleBoolean); |
| 954 | + } |
| 955 | + }, |
| 956 | + |
| 957 | + addDomLoadEvent: addDomLoadEvent, |
| 958 | + |
| 959 | + addLoadEvent: addLoadEvent, |
| 960 | + |
| 961 | + getQueryParamValue: function(param) { |
| 962 | + var q = doc.location.search || doc.location.hash; |
| 963 | + if (q) { |
| 964 | + if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark |
| 965 | + if (param == null) { |
| 966 | + return urlEncodeIfNecessary(q); |
| 967 | + } |
| 968 | + var pairs = q.split("&"); |
| 969 | + for (var i = 0; i < pairs.length; i++) { |
| 970 | + if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { |
| 971 | + return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1))); |
| 972 | + } |
| 973 | + } |
| 974 | + } |
| 975 | + return ""; |
| 976 | + }, |
| 977 | + |
| 978 | + // For internal usage only |
| 979 | + expressInstallCallback: function() { |
| 980 | + if (isExpressInstallActive) { |
| 981 | + var obj = getElementById(EXPRESS_INSTALL_ID); |
| 982 | + if (obj && storedAltContent) { |
| 983 | + obj.parentNode.replaceChild(storedAltContent, obj); |
| 984 | + if (storedAltContentId) { |
| 985 | + setVisibility(storedAltContentId, true); |
| 986 | + if (ua.ie && ua.win) { storedAltContent.style.display = "block"; } |
| 987 | + } |
| 988 | + if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); } |
| 989 | + } |
| 990 | + isExpressInstallActive = false; |
| 991 | + } |
| 992 | + } |
| 993 | + }; |
| 994 | +}(); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/binPlayers/kaltura-player/kdp.swf |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/binPlayers/kaltura-player/wrapper.swf |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/binPlayers/kaltura-player/kdp3.swf |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/binPlayers/kaltura-player/kdp3.swf |
___________________________________________________________________ |
Name: svn:mime-type |
186 | 995 | + application/octet-stream |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/binPlayers/kaltura-player/config.xml |
— | — | @@ -0,0 +1,9 @@ |
| 2 | +<layout id="full" name="player" skinPath="assets/skin.swf">
|
| 3 | + <HBox id="topLevel" width="100%" height="100%">
|
| 4 | + <VBox id="player" width="100%" height="100%" styleName="black">
|
| 5 | + <Canvas height="100%" width="100%" id="PlayerHolder" styleName="black">
|
| 6 | + <Video id="video" width="100%" height="100%" />
|
| 7 | + </Canvas>
|
| 8 | + </VBox>
|
| 9 | + </HBox>
|
| 10 | +</layout> |
\ No newline at end of file |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/binPlayers/kaltura-player/README |
— | — | @@ -1,6 +1,9 @@ |
| 2 | + |
| 3 | +File: kdp3.swf |
| 4 | + |
2 | 5 | This Kaltura Dynamic Player +Playlist (KDP) is a sub package of the taken Kaltura Community Edition (CE) Built from Kaltura.org source. |
3 | 6 | |
4 | | -The full Kaltura Community Edition is licensed under the (GNU Affero General Public License v3) |
| 7 | +The full Kaltura Community Edition is licensed under the ( GNU Affero General Public License v3 ) |
5 | 8 | |
6 | 9 | And the source code is available on the kaltura.org site: |
7 | 10 | http://www.kaltura.org/project/kalturaCE |
— | — | @@ -9,3 +12,9 @@ |
10 | 13 | http://www.kaltura.org/kdp-dynamic-player-and-playlist-widget |
11 | 14 | |
12 | 15 | |
| 16 | + |
| 17 | +File: expressInstall.swf |
| 18 | +is part of SWFObject v2.2 <http://code.google.com/p/swfobject/> |
| 19 | + and is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> |
| 20 | + |
| 21 | + |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/binPlayers/kaltura-player/expressInstall.swf |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/binPlayers/kaltura-player/expressInstall.swf |
___________________________________________________________________ |
Name: svn:mime-type |
13 | 22 | + application/octet-stream |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/mw.ApiProxy.js |
— | — | @@ -207,7 +207,7 @@ |
208 | 208 | $j('<div />').loadingSpinner() |
209 | 209 | ); |
210 | 210 | |
211 | | - var uploadDialogInterface = new mw.DialogInterface({ |
| 211 | + var uploadDialogInterface = new mw.UploadDialogInterface({ |
212 | 212 | 'uploadHandlerAction' : function( action ){ |
213 | 213 | mw.log( 'apiProxy uploadActionHandler:: ' + action ); |
214 | 214 | // Send action to remote frame |
— | — | @@ -822,9 +822,7 @@ |
823 | 823 | * @param {Function} callback Function called once iframe is loaded |
824 | 824 | */ |
825 | 825 | function appendIframe( options, callback ){ |
826 | | - var s = '<iframe '; |
827 | | - var iframeAttr = ['id', 'name', 'style']; |
828 | | - |
| 826 | + var s = '<iframe '; |
829 | 827 | // Check for frame name: |
830 | 828 | if( ! options[ 'name' ] ) { |
831 | 829 | options[ 'name' ] = 'mwApiProxyFrame_' + $j('iframe').length; |
— | — | @@ -852,13 +850,17 @@ |
853 | 851 | // Close up the iframe: |
854 | 852 | s += '></iframe>'; |
855 | 853 | |
| 854 | + // Check for the iframe append target ( default "body" tag ) |
856 | 855 | if( ! options[ 'target' ] ){ |
857 | 856 | options[ 'target' ] = 'body'; |
858 | | - } |
859 | | - // Append to body if no target set |
| 857 | + } |
| 858 | + // Append to target |
860 | 859 | $j( options['target'] ).append( s ); |
861 | | - |
862 | | - // Setup the onload callback |
| 860 | + mw.log( 'append: ' + s + ' to: ' + $j( options['target'] ) ); |
| 861 | + mw.log(" lenth of target: " + options['target'].length ); |
| 862 | + mw.log('len of: ' + options['name'] + '::' + $j( '#' + options['name'] ).length ); |
| 863 | + mw.log('len target len: ' + $j( options['target'] ).find( '#' + options['name'] ).length ); |
| 864 | + // Setup the onload callback |
863 | 865 | $j( '#' + options['name'] ).get( 0 ).onload = function() { |
864 | 866 | if( ! options.persist ){ |
865 | 867 | // Schedule the removal of the iframe |
— | — | @@ -870,7 +872,7 @@ |
871 | 873 | if( callback ){ |
872 | 874 | callback(); |
873 | 875 | } |
874 | | - }; |
| 876 | + }; |
875 | 877 | } |
876 | 878 | |
877 | 879 | } )( window.mw.ApiProxy ); |