Index: branches/js2-work/phase3/js/mwEmbed/loader.js |
— | — | @@ -33,10 +33,69 @@ |
34 | 34 | 'ApiProxy', |
35 | 35 | 'Sequencer', |
36 | 36 | 'TimedText' |
37 | | -]; |
| 37 | +]; |
38 | 38 | |
39 | | -mw.setConfig( 'enabledModules', mwEnabledModuleList ); |
| 39 | +/** |
| 40 | +* mwEmbed default config values. |
| 41 | +*/ |
| 42 | +mw.setDefaultConfig ( { |
| 43 | + // Default enabled modules: |
| 44 | + "enabledModules" : mwEnabledModuleList, |
| 45 | + |
| 46 | + // Default skin name |
| 47 | + "skinName" : "mvpcf", |
| 48 | + |
| 49 | + // Default jquery ui skin name |
| 50 | + "jQueryUISkin" : "redmond", |
| 51 | + |
| 52 | + /** |
| 53 | + * If jQuery / mwEmbed should be loaded. |
| 54 | + * |
| 55 | + * This flag is automatically set to true if: |
| 56 | + * Any script calls mw.ready ( callback_function ) |
| 57 | + * Page DOM includes any tags set in config.rewritePlayerTags at onDomReady |
| 58 | + * ( embedPlayer module ) |
| 59 | + * |
| 60 | + * This flag increases page performance on pages that do not use mwEmbed |
| 61 | + * and don't already load jQuery |
| 62 | + * |
| 63 | + * For example when including the mwEmbed.js in your blog template |
| 64 | + * mwEmbed will only load extra js on blog posts that include the video tag. |
| 65 | + * |
| 66 | + * NOTE: Future architecture will probably do away with this flag and refactor it into |
| 67 | + * a smaller "remotePageMwEmbed.js" script similar to ../remoteMwEmbed.js |
| 68 | + */ |
| 69 | + "runSetupMwEmbed" : false, |
40 | 70 | |
| 71 | + // The mediaWiki path of mwEmbed |
| 72 | + "mediaWikiEmbedPath" : "js/mwEmbed/", |
| 73 | + |
| 74 | + // Api actions that must be submitted in a POST, and need an api proxy for cross domain calls |
| 75 | + 'apiPostActions': [ 'login', 'purge', 'rollback', 'delete', 'undelete', |
| 76 | + 'protect', 'block', 'unblock', 'move', 'edit', 'upload', 'emailuser', |
| 77 | + 'import', 'userrights' ], |
| 78 | + |
| 79 | + //If we are in debug mode ( results in fresh debug javascript includes ) |
| 80 | + 'debug' : false, |
| 81 | + |
| 82 | + // Valid language codes ( has a file in /includes/languages/classes/Language{code}.js ) |
| 83 | + // TODO: mirror the mediaWiki language "fallback" system |
| 84 | + 'languageCodeList': ['en', 'am', 'ar', 'bat_smg', 'be_tarak', 'be', 'bh', |
| 85 | + 'bs', 'cs', 'cu', 'cy', 'dsb', 'fr', 'ga', 'gd', 'gv', 'he', 'hi', |
| 86 | + 'hr', 'hsb', 'hy', 'ksh', 'ln', 'lt', 'lv', 'mg', 'mk', 'mo', 'mt', |
| 87 | + 'nso', 'pl', 'pt_br', 'ro', 'ru', 'se', 'sh', 'sk', 'sl', 'sma', |
| 88 | + 'sr_ec', 'sr_el', 'sr', 'ti', 'tl', 'uk', 'wa' |
| 89 | + ], |
| 90 | + |
| 91 | + // Default user language is "en" Can be overwritten by: |
| 92 | + // "uselang" url param |
| 93 | + // wgUserLang global |
| 94 | + 'userLanguage' : 'en', |
| 95 | + |
| 96 | + // Set the default providers ( you can add more provider via {provider_id}_apiurl = $api_url |
| 97 | + 'commons_apiurl' : 'http://commons.wikimedia.org/w/api.php' |
| 98 | +} ); |
| 99 | + |
41 | 100 | /** |
42 | 101 | * -- Load Class Paths -- |
43 | 102 | * |
Index: branches/js2-work/phase3/js/mwEmbed/tests/Player_Themable.html |
— | — | @@ -2,15 +2,19 @@ |
3 | 3 | "http://www.w3.org/TR/html4/loose.dtd"> |
4 | 4 | <html> |
5 | 5 | <head> |
6 | | - <title>Sample Themed Player</title> |
7 | | - <!-- Pre-loading demo ( stuff ) likely needed for video display |
8 | | - <script type="text/javascript" src="../jsScriptLoader.php?urid=1.1d&class=window.jQuery,mwEmbed,$j.ui,mw.EmbedPlayer,nativeEmbed,kplayerEmbed,javaEmbed,vlcEmbed,ctrlBuilder,mvpcfConfig,kskinConfig,$j.fn.menu,$j.cookie,$j.ui.slider,mw.TimedText"></script> |
| 6 | + <title> Sample Themed Player </title> |
| 7 | + Pre-loading demo ( stuff ) likely needed for video display |
| 8 | + <!-- <script type="text/javascript" src="../jsScriptLoader.php?debug=true&class=window.jQuery,mwEmbed,$j.ui,mw.EmbedPlayer,nativeEmbed,kplayerEmbed,javaEmbed,vlcEmbed,ctrlBuilder,mvpcfConfig,kskinConfig,$j.fn.menu,$j.cookie,$j.ui.slider,mw.TimedText"></script> |
| 9 | + |
| 10 | + <script type="text/javascript" src="../jsScriptLoader.php?debug=true&class=mwEmbed"></script> |
9 | 11 | <link rel="stylesheet" href="../skins/styles.css" type="text/css" media="screen" /> |
10 | 12 | <link rel="stylesheet" href="../skins/mvpcf/EmbedPlayer.css" type="text/css" media="screen" /> |
11 | 13 | <link rel="stylesheet" href="../skins/kskin/EmbedPlayer.css" type="text/css" media="screen" /> |
12 | 14 | --> |
13 | | - <script type="text/javascript" src="../mwEmbed.js?debug=true"></script> |
14 | | - |
| 15 | + |
| 16 | + <script type="text/javascript" src="../mwEmbed.js?debug=true"></script> |
| 17 | + |
| 18 | + |
15 | 19 | </head> |
16 | 20 | <script type="text/javascript"> |
17 | 21 | </script> |
— | — | @@ -19,14 +23,15 @@ |
20 | 24 | To play with dynamic Themes install <a href="http://jqueryui.com/themeroller/developertool/">Themeroller</a><p><p> |
21 | 25 | |
22 | 26 | <div style="width:450px;float:left"> |
23 | | -<video |
24 | | - src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg" |
| 27 | +<video |
| 28 | + src="http://localhost/lucky.ogv" |
25 | 29 | poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" |
26 | 30 | apiTitleKey="Charles_Lindbergh_flight_to_Brussels.ogg" |
27 | 31 | apiProvider="commons" |
28 | | - durationHint="60"> |
| 32 | + durationHint="60" > |
29 | 33 | </video> |
30 | 34 | |
| 35 | +<!-- |
31 | 36 | <video |
32 | 37 | style="width:208px;height:160px;float:left" |
33 | 38 | src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg" |
— | — | @@ -57,7 +62,7 @@ |
58 | 63 | poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" |
59 | 64 | durationHint="60"> |
60 | 65 | </video> |
61 | | - |
| 66 | + --> |
62 | 67 | <b>(kskin) Source Code used:</b><br> |
63 | 68 | <textarea cols="50" rows="7"><video class="kskin" style="width:400px;height:288px" poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" |
64 | 69 | src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg"></video></textarea> |
Index: branches/js2-work/phase3/js/mwEmbed/skins/kskin/EmbedPlayer.css |
— | — | @@ -358,6 +358,11 @@ |
359 | 359 | font-size: 1em; |
360 | 360 | } |
361 | 361 | |
| 362 | +.k-player .menu-screen { |
| 363 | + height: 100%; |
| 364 | + overflow: auto; |
| 365 | +} |
| 366 | + |
362 | 367 | .k-player .menu-screen.menu-share div.ui-state-highlight { |
363 | 368 | background: none repeat scroll 0 0 transparent; |
364 | 369 | border-color: #554926; |
Index: branches/js2-work/phase3/js/mwEmbed/skins/kskin/kskinConfig.js |
— | — | @@ -3,8 +3,7 @@ |
4 | 4 | */ |
5 | 5 | |
6 | 6 | mw.addMessages( { |
7 | | - "mwe-credit-title" : "Title: $1", |
8 | | - "mwe-kaltura-platform-title" : "Kaltura open source video platform" |
| 7 | + "mwe-credit-title" : "Title: $1" |
9 | 8 | } ); |
10 | 9 | |
11 | 10 | var kskinConfig = { |
— | — | @@ -30,68 +29,108 @@ |
31 | 30 | |
32 | 31 | // Extends base components with kskin specific options: |
33 | 32 | components: { |
34 | | - 'play-btn-large' : { |
| 33 | + 'playButtonLarge' : { |
35 | 34 | 'h' : 55 |
36 | 35 | }, |
37 | 36 | 'options': { |
38 | 37 | 'w':50, |
39 | 38 | 'o':function() { |
40 | | - return '<div class="ui-state-default ui-corner-bl rButton k-options" title="' + gM( 'mwe-player_options' ) + '" >' + |
41 | | - '<span>' + gM( 'mwe-menu_btn' ) + '</span>' + |
42 | | - '</div>' |
| 39 | + return $j( '<div />' ) |
| 40 | + .attr( 'title', gM( 'mwe-player_options' ) ) |
| 41 | + .addClass( "ui-state-default ui-corner-bl rButton k-options" ) |
| 42 | + .append( |
| 43 | + $j( '<span />' ) |
| 44 | + .text( gM( 'mwe-menu_btn' ) ) |
| 45 | + ) |
43 | 46 | } |
44 | 47 | }, |
45 | | - 'volume_control':{ |
| 48 | + 'volumeControl':{ |
46 | 49 | 'w':40 |
47 | 50 | }, |
48 | | - 'time_display': { |
| 51 | + // No kalturaAttribution component for kSkin ( its integrated into the credits screen ) |
| 52 | + 'kalturaAttribution' : false, |
| 53 | + 'timeDisplay': { |
49 | 54 | 'w':45 |
50 | 55 | }, |
51 | 56 | /* |
52 | 57 | * The playhead html |
53 | 58 | */ |
54 | | - 'play_head': { |
| 59 | + 'playHead': { |
55 | 60 | 'w':0, // special case (takes up remaining space) |
56 | 61 | 'o':function( ctrlObj ) { |
57 | | - return '<div class="play_head" style="width: ' + ( ctrlObj.available_width - 10 ) + 'px;"></div>'; |
| 62 | + return $j( '<div />' ) |
| 63 | + .addClass( "play_head" ) |
| 64 | + .css( "width", parseInt( ctrlObj.available_width - 10 ) + 'px' ) |
58 | 65 | } |
59 | 66 | }, |
60 | | - 'options_menu': { |
61 | | - 'w':0, |
62 | | - 'o':function( ctrlObj ) { |
| 67 | + 'optionsMenu': { |
| 68 | + 'w' : 0, |
| 69 | + 'o' : function( ctrlObj ) { |
63 | 70 | var embedPlayer = ctrlObj.embedPlayer; |
64 | 71 | |
65 | | - // Setup menu offset ( if player height < getOverlayHeight ) |
| 72 | + |
66 | 73 | var menuOffset = ( embedPlayer.getPlayerHeight() < ctrlObj.getOverlayHeight() ) ? |
67 | | - 'top:' + ( embedPlayer.getPlayerHeight() + ctrlObj.getControlBarHeight() ) + 'px;' : ''; |
| 74 | + 'top:' + + 'px;' : ''; |
68 | 75 | |
69 | | - // Special common overflow hack: |
70 | | - // NOTE: should re-factor to just append menu to top body when it does not "fit" in the player |
71 | | - if( menuOffset != '' ) |
72 | | - $j( embedPlayer ).parents( '.thumbinner' ).css( 'overflow', 'visible' ); |
73 | | - |
74 | | - var o = '' + |
75 | | - '<div id="blackbg_' + embedPlayer.id +'" class="k-menu ui-widget-content" ' + |
76 | | - 'style="width:' + ctrlObj.getOverlayWidth() + 'px; height:' + ctrlObj.getOverlayHeight() + 'px;' + menuOffset + '">' + |
77 | | - '<ul class="k-menu-bar">'; |
78 | | - // Output menu item containers: |
79 | | - for ( i = 0; i < ctrlObj.menu_items.length; i++ ) { |
80 | | - var mk = ctrlObj.menu_items[i]; |
81 | | - o += '<li class="k-' + mk + '-btn" rel="' + mk + '">' + |
82 | | - '<a href="#" title="' + gM( 'mwe-' + mk ) + '">' + gM( 'mwe-' + mk ) + '</a></li>'; |
83 | | - } |
84 | | - o += '</ul>' + |
85 | | - // We have to subtract the width of the k-menu-bar |
86 | | - '<div class="k-menu-screens" style="width:' + ( ctrlObj.getOverlayWidth() - 75 ) + |
87 | | - 'px; height:' + ( ctrlObj.getOverlayHeight() - ctrlObj.getControlBarHeight() ) + 'px;">'; |
88 | | - |
89 | | - // Output menu item containers: |
90 | | - for ( i = 0; i < ctrlObj.menu_items.length; i++ ) { |
91 | | - o += '<div class="menu-screen menu-' + ctrlObj.menu_items[i] + '"></div>'; |
92 | | - } |
93 | | - '</div>' + |
94 | | - '</div>'; |
95 | | - return o; |
| 76 | + |
| 77 | + |
| 78 | + $menuOverlay = $j( '<div />') |
| 79 | + .attr('id', 'blackbg_' + embedPlayer.id ) |
| 80 | + .addClass( 'k-menu ui-widget-content' ) |
| 81 | + .css( { |
| 82 | + 'width' : ctrlObj.getOverlayWidth(), |
| 83 | + 'height' : ctrlObj.getOverlayHeight(), |
| 84 | + } ); |
| 85 | + |
| 86 | + // Setup menu offset ( if player height < getOverlayHeight ) |
| 87 | + // This displays the menu outside of the player on small embeds |
| 88 | + if ( embedPlayer.getPlayerHeight() < ctrlObj.getOverlayHeight() ) { |
| 89 | + $menuOverlay.css( 'top', parseInt( embedPlayer.getPlayerHeight() + ctrlObj.getControlBarHeight() ) + 'px' ); |
| 90 | + |
| 91 | + // Special common overflow hack for thumbnail display of player |
| 92 | + $j( embedPlayer ).parents( '.thumbinner' ).css( 'overflow', 'visible' ); |
| 93 | + } |
| 94 | + $menuBar = $j( '<ul />' ) |
| 95 | + .addClass( 'k-menu-bar' ); |
| 96 | + |
| 97 | + // Output menu item containers: |
| 98 | + for ( i = 0; i < ctrlObj.menu_items.length; i++ ) { |
| 99 | + var mk = ctrlObj.menu_items[i]; |
| 100 | + $menuBar.append( |
| 101 | + $j( '<li />') |
| 102 | + // Add the menu item class: |
| 103 | + .addClass( 'k-' + mk + '-btn' ) |
| 104 | + .attr( 'rel', mk ) |
| 105 | + .append( |
| 106 | + $j( '<a />' ) |
| 107 | + .attr( { |
| 108 | + 'title' : gM( 'mwe-' + mk ), |
| 109 | + 'href' : '#' |
| 110 | + }) |
| 111 | + ) |
| 112 | + ); |
| 113 | + } |
| 114 | + |
| 115 | + // Add the menuBar to the menuOverlay |
| 116 | + $menuOverlay.append( $menuBar ); |
| 117 | + |
| 118 | + var $menuScreens = $j( '<div />' ) |
| 119 | + .addClass( 'k-menu-screens' ) |
| 120 | + .css({ |
| 121 | + 'width' : ( ctrlObj.getOverlayWidth() - 75 ), |
| 122 | + 'height' : ( ctrlObj.getOverlayHeight() - ctrlObj.getControlBarHeight() ) |
| 123 | + }) |
| 124 | + for ( i = 0; i < ctrlObj.menu_items.length; i++ ) { |
| 125 | + $menuScreens.append( |
| 126 | + $j( '<div />' ) |
| 127 | + .addClass( 'menu-screen menu-' + ctrlObj.menu_items[i] ) |
| 128 | + ); |
| 129 | + } |
| 130 | + |
| 131 | + // Add the menuScreens to the menuOverlay |
| 132 | + $menuOverlay.append( $menuScreens ); |
| 133 | + |
| 134 | + return $menuOverlay; |
96 | 135 | } |
97 | 136 | } |
98 | 137 | }, |
— | — | @@ -127,10 +166,12 @@ |
128 | 167 | .unbind() |
129 | 168 | .click( function() { |
130 | 169 | if ( _this.$playerTarget.find( '.k-menu' ).length == 0 ) { |
| 170 | + |
131 | 171 | // Stop the player if it does not support overlays: |
132 | 172 | if ( !embedPlayer.supports['overlays'] ){ |
133 | 173 | embedPlayer.stop(); |
134 | 174 | } |
| 175 | + |
135 | 176 | // Add the menu binding |
136 | 177 | _this.addMeunBinding(); |
137 | 178 | } |
— | — | @@ -147,7 +188,7 @@ |
148 | 189 | /** |
149 | 190 | * Close the menu overlay |
150 | 191 | */ |
151 | | - closeMenuOverlay: function( ){ |
| 192 | + closeMenuOverlay: function( ) { |
152 | 193 | var $optionsMenu = this.$playerTarget.find( '.k-options' ); |
153 | 194 | this.$kmenu.fadeOut( "fast", function() { |
154 | 195 | $optionsMenu.find( 'span' ) |
— | — | @@ -155,10 +196,11 @@ |
156 | 197 | } ); |
157 | 198 | this.$playerTarget.find( '.play-btn-large' ).fadeIn( 'fast' ); |
158 | 199 | }, |
| 200 | + |
159 | 201 | /** |
160 | 202 | * Show the menu overlay |
161 | 203 | */ |
162 | | - showMenuOverlay: function( $ktxt ){ |
| 204 | + showMenuOverlay: function( $ktxt ) { |
163 | 205 | var $optionsMenu = this.$playerTarget.find( '.k-options' ); |
164 | 206 | this.$kmenu.fadeIn( "fast", function() { |
165 | 207 | $optionsMenu.find( 'span' ) |
— | — | @@ -184,10 +226,9 @@ |
185 | 227 | |
186 | 228 | // Add options menu to top of player target children: |
187 | 229 | $playerTarget.prepend( |
188 | | - _this.components[ 'options_menu' ].o( _this ) |
| 230 | + _this.getComponent( 'optionsMenu' ) |
189 | 231 | ); |
190 | 232 | |
191 | | - |
192 | 233 | // By default its hidden: |
193 | 234 | $playerTarget.find( '.k-menu' ).hide(); |
194 | 235 | |
— | — | @@ -216,7 +257,7 @@ |
217 | 258 | * |
218 | 259 | * @param {String} menu_itme Menu item key to display |
219 | 260 | */ |
220 | | - showMenuItem:function( menu_item ) { |
| 261 | + showMenuItem:function( menu_item ) { |
221 | 262 | var embedPlayer = this.embedPlayer; |
222 | 263 | //handle special k-skin specific display; |
223 | 264 | if( menu_item == 'credits'){ |
— | — | @@ -231,6 +272,7 @@ |
232 | 273 | |
233 | 274 | /** |
234 | 275 | * Show the "edit with kaltura" screen ( specific to kaltura skin ) |
| 276 | + * NOTE: stub function |
235 | 277 | */ |
236 | 278 | showKalturaEdit: function(){ |
237 | 279 | |
— | — | @@ -253,7 +295,7 @@ |
254 | 296 | .loadingSpinner() |
255 | 297 | ); |
256 | 298 | |
257 | | - if( mw.getConfig( 'k_attribution' ) == true ){ |
| 299 | + if( mw.getConfig( 'kalturaAttribution' ) == true ){ |
258 | 300 | $target.append( |
259 | 301 | $j( '<div />' ) |
260 | 302 | .addClass( 'k-attribution' ) |
Index: branches/js2-work/phase3/js/mwEmbed/skins/ctrlBuilder.js |
— | — | @@ -31,10 +31,17 @@ |
32 | 32 | // Default control bar height is 33 |
33 | 33 | height: 33, |
34 | 34 | |
35 | | - // Default supported components is merged with embedPlayerect supported types |
| 35 | + // Default supported components is merged with embedPlayer set of supported types |
36 | 36 | supportedComponets: { |
37 | | - 'options':true, |
38 | | - 'borders':true |
| 37 | + |
| 38 | + // All playback types support options |
| 39 | + 'options':true, |
| 40 | + |
| 41 | + // All playback types support kalturaAttribution |
| 42 | + // to enable or disable use mw.setConfig( 'kalturaAttribution', [true|false] ) |
| 43 | + 'kalturaAttribution' : true, |
| 44 | + |
| 45 | + 'playButtonLarge' : true |
39 | 46 | }, |
40 | 47 | /** |
41 | 48 | * Initialization Object for the control builder |
— | — | @@ -69,7 +76,7 @@ |
70 | 77 | var _this = this; |
71 | 78 | |
72 | 79 | // Remove any old controls: |
73 | | - embedPlayer.$interface.find('.control-bar').remove(); |
| 80 | + embedPlayer.$interface.find( '.control-bar' ).remove(); |
74 | 81 | |
75 | 82 | // Add some space to control_wrap for the control bar: |
76 | 83 | embedPlayer.$interface.css( { |
— | — | @@ -103,6 +110,7 @@ |
104 | 111 | |
105 | 112 | // Make pointer to the embedPlayer |
106 | 113 | this.embedPlayer = embedPlayer; |
| 114 | + |
107 | 115 | var _this = this; |
108 | 116 | this.supportedComponets = $j.extend(this.supportedComponets, embedPlayer.supports); |
109 | 117 | |
— | — | @@ -113,19 +121,28 @@ |
114 | 122 | |
115 | 123 | // Append options to body (if not already there) |
116 | 124 | if ( this.external_options && $j( '#mv_vid_options_' + this.id ).length == 0 ){ |
117 | | - $j( 'body' ).append( this.components[ 'options_menu' ].o( this ) ); |
| 125 | + $j( 'body' ).append( this.getComponent( 'optionsMenu' ) ); |
118 | 126 | } |
119 | 127 | |
| 128 | + |
| 129 | + |
120 | 130 | // Build component output: |
121 | 131 | for ( var component_id in this.components ) { |
| 132 | + |
| 133 | + // Special case with playhead skip if we have > 30px of space for it |
| 134 | + if ( component_id == 'playHead' && this.available_width < 30 ){ |
| 135 | + continue; |
| 136 | + } |
| 137 | + |
| 138 | + // Special case of kalturaAttribution skip if set in configuration |
| 139 | + if( component_id == 'kalturaAttribution' && mw.getConfig( 'kalturaAttribution' ) == false ){ |
| 140 | + continue; |
| 141 | + } |
| 142 | + |
122 | 143 | // Make sure the given components is supported: |
123 | 144 | if ( this.supportedComponets[ component_id ] ) { |
124 | | - if ( this.available_width > this.components[ component_id ].w ) { |
125 | | - // Special case with playhead don't add unless we have 30px |
126 | | - if ( component_id == 'play_head' && this.available_width < 30 ){ |
127 | | - continue; |
128 | | - } |
129 | | - // Append the component |
| 145 | + if ( this.available_width > this.components[ component_id ].w ) { |
| 146 | + // Append the component |
130 | 147 | $controlBar.append( |
131 | 148 | _this.getComponent( component_id ) |
132 | 149 | ); |
— | — | @@ -511,24 +528,24 @@ |
512 | 529 | /** |
513 | 530 | * The large play button in center of the player |
514 | 531 | */ |
515 | | - 'play-btn-large': { |
| 532 | + 'playButtonLarge': { |
516 | 533 | 'w' : 130, |
517 | 534 | 'h' : 96, |
518 | | - 'o' : function( ctrlObj ) { |
519 | | - // Get dynamic position for big play button |
| 535 | + 'o' : function( ctrlObj ) { |
520 | 536 | return $j( '<div/>' ) |
521 | | - .attr( { |
522 | | - 'title' : gM( 'mwe-play_clip' ), |
523 | | - 'class' : "ui-state-default play-btn-large" |
524 | | - } ) |
525 | | - .css( { |
526 | | - 'left' : ( ( ctrlObj.embedPlayer.getPlayerWidth() - this.w ) / 2 ), |
527 | | - 'top' : ( ( ctrlObj.embedPlayer.getPlayerHeight() - this.h ) / 2 ) |
528 | | - } ) |
529 | | - // Add play hook: |
530 | | - .buttonHover().click( function() { |
531 | | - ctrlObj.embedPlayer.play(); |
532 | | - } ); |
| 537 | + .attr( { |
| 538 | + 'title' : gM( 'mwe-play_clip' ), |
| 539 | + 'class' : "ui-state-default play-btn-large" |
| 540 | + } ) |
| 541 | + // Get dynamic position for big play button |
| 542 | + .css( { |
| 543 | + 'left' : ( ( ctrlObj.embedPlayer.getPlayerWidth() - this.w ) / 2 ), |
| 544 | + 'top' : ( ( ctrlObj.embedPlayer.getPlayerHeight() - this.h ) / 2 ) |
| 545 | + } ) |
| 546 | + // Add play hook: |
| 547 | + .buttonHover().click( function() { |
| 548 | + ctrlObj.embedPlayer.play(); |
| 549 | + } ); |
533 | 550 | } |
534 | 551 | }, |
535 | 552 | |
— | — | @@ -536,7 +553,7 @@ |
537 | 554 | * The options for the player, includes player selection, |
538 | 555 | * download, and share options |
539 | 556 | */ |
540 | | - 'options_menu': { |
| 557 | + 'optionsMenu': { |
541 | 558 | 'w' : 0, |
542 | 559 | 'o' : function( ctrlObj ) { |
543 | 560 | var o = '<div id="mv_vid_options_' + ctrlObj.embedPlayer.id + '" class="videoOptions">' + |
— | — | @@ -563,6 +580,24 @@ |
564 | 581 | }, |
565 | 582 | |
566 | 583 | /** |
| 584 | + * The kaltura attribution button |
| 585 | + */ |
| 586 | + 'kalturaAttribution' : { |
| 587 | + 'w' : 28, |
| 588 | + 'o' : function( ctrlObj ){ |
| 589 | + return $j( '<div />' ) |
| 590 | + .attr( 'title', gM( 'mwe-kaltura-platform-title' ) ) |
| 591 | + .addClass( 'ui-state-default ui-corner-all ui-icon_link rButton k-attribution' ) |
| 592 | + .append( |
| 593 | + $j('<span />') |
| 594 | + .addClass( 'ui-icon k-attribution' ) |
| 595 | + ) |
| 596 | + .click( function( ) { |
| 597 | + window.location = 'http://kaltura.com'; |
| 598 | + } ); |
| 599 | + } |
| 600 | + }, |
| 601 | + /** |
567 | 602 | * The options button, invokes display of the options menu |
568 | 603 | */ |
569 | 604 | 'options': { |
— | — | @@ -574,7 +609,7 @@ |
575 | 610 | .append( |
576 | 611 | $j('<span />') |
577 | 612 | .addClass( 'ui-icon ui-icon-wrench' ) |
578 | | - ) |
| 613 | + ) |
579 | 614 | } |
580 | 615 | }, |
581 | 616 | |
— | — | @@ -630,7 +665,7 @@ |
631 | 666 | /** |
632 | 667 | * The volume control interface html |
633 | 668 | */ |
634 | | - 'volume_control': { |
| 669 | + 'volumeControl': { |
635 | 670 | 'w' : 28, |
636 | 671 | 'o' : function( ctrlObj ) { |
637 | 672 | $volumeOut = $j( '<div />' ); |
— | — | @@ -673,9 +708,9 @@ |
674 | 709 | /* |
675 | 710 | * The time display area |
676 | 711 | */ |
677 | | - 'time_display': { |
678 | | - 'w':90, |
679 | | - 'o':function( ctrlObj ) { |
| 712 | + 'timeDisplay': { |
| 713 | + 'w' : 90, |
| 714 | + 'o' : function( ctrlObj ) { |
680 | 715 | return $j( '<div />' ) |
681 | 716 | .addClass( "ui-widget time-disp" ) |
682 | 717 | .append( |
— | — | @@ -685,9 +720,9 @@ |
686 | 721 | } |
687 | 722 | }, |
688 | 723 | /* |
689 | | - * The playhead html |
| 724 | + * The playhead component |
690 | 725 | */ |
691 | | - 'play_head': { |
| 726 | + 'playHead': { |
692 | 727 | 'w':0, // special case (takes up remaining space) |
693 | 728 | 'o':function( ctrlObj ) { |
694 | 729 | return $j( '<div />' ) |
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js |
— | — | @@ -1209,7 +1209,6 @@ |
1210 | 1210 | var request = {}; |
1211 | 1211 | var _this = this; |
1212 | 1212 | this.getSourcePages( assetKey, function( sourcePages ){ |
1213 | | - mw.log(' got sub pages... '); |
1214 | 1213 | if( ! sourcePages.query.allpages ){ |
1215 | 1214 | //Check if a shared asset |
1216 | 1215 | mw.log( 'no subtitle pages found'); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/kplayerEmbed.js |
— | — | @@ -18,24 +18,13 @@ |
19 | 19 | }, |
20 | 20 | |
21 | 21 | /* |
22 | | - * Get the Embed html by wraping the embed code in the embed container: |
| 22 | + * Write the Embed html to the target |
23 | 23 | */ |
24 | | - getEmbedHTML : function () { |
| 24 | + doEmbedHTML : function () { |
25 | 25 | var _this = this; |
26 | | - setTimeout(function(){ |
27 | | - _this.postEmbedJS(); |
28 | | - }, 50); |
29 | | - var embed_code = this.getEmbedObj(); |
30 | | - mw.log( "return embed html: " + embed_code ); |
31 | | - return embed_code; |
32 | | - }, |
33 | | - |
34 | | - /** |
35 | | - * Get the plugin embed html |
36 | | - */ |
37 | | - getEmbedObj:function() { |
38 | 26 | var playerPath = mw.getMwEmbedPath() + 'modules/EmbedPlayer/binPlayers/kaltura-player'; |
39 | | - return '<object width="' + this.width + '" height="' + this.height + '" '+ |
| 27 | + $j( this ).html( |
| 28 | + '<object width="' + this.width + '" height="' + this.height + '" '+ |
40 | 29 | 'data="' + playerPath + '/wrapper.swf" allowfullscreen="true" '+ |
41 | 30 | 'allownetworking="all" allowscriptaccess="always" '+ |
42 | 31 | 'type="application/x-shockwave-flash" '+ |
— | — | @@ -52,11 +41,15 @@ |
53 | 42 | '" ' + |
54 | 43 | 'name="flashVars"/>'+ |
55 | 44 | '<param value="opaque" name="wmode"/>'+ |
56 | | - '</object>'; |
57 | | - }, |
| 45 | + '</object>' |
| 46 | + ) |
| 47 | + setTimeout(function(){ |
| 48 | + _this.postEmbedJS(); |
| 49 | + }, 50); |
| 50 | + }, |
58 | 51 | |
59 | 52 | /** |
60 | | - * javascript run post player embeding |
| 53 | + * javascript run post player embedding |
61 | 54 | */ |
62 | 55 | postEmbedJS:function() { |
63 | 56 | var _this = this; |
— | — | @@ -84,6 +77,7 @@ |
85 | 78 | // Start the monitor |
86 | 79 | this.monitor(); |
87 | 80 | }else{ |
| 81 | + // Keep trying to get the html: |
88 | 82 | //mw.log('insert media: not defiend:' + typeof this.playerElement.insertMedia ); |
89 | 83 | setTimeout( function(){ |
90 | 84 | _this.postEmbedJS(); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/loader.js |
— | — | @@ -1,31 +1,35 @@ |
2 | 2 | /** |
3 | | -* libEmbedPlayer loader |
4 | | -* |
| 3 | +* EmbedPlayer loader |
5 | 4 | */ |
6 | 5 | |
7 | 6 | /** |
8 | | -* Default player module configuration: |
9 | | -*/ |
| 7 | +* Default player module configuration |
| 8 | +*/ |
| 9 | + |
| 10 | +mw.setDefaultConfig( { |
| 11 | + // If the Timed Text interface should be displayed: |
| 12 | + // 'always' Displays link and call to contribute always |
| 13 | + // 'auto' Looks for child timed text elements or "apiTitleKey" & load interface |
| 14 | + // 'off' Does not display the timed text interface |
| 15 | + "textInterface" : "auto", |
10 | 16 | |
11 | | -//If the Timed Text interface should be displayed: |
12 | | -// 'always' Displays link and call to contribute always |
13 | | -// 'auto' Looks for child timed text elements or "apiTitleKey" & load interface |
14 | | -// 'off' Does not display the timed text interface |
15 | | -mw.setConfig( 'textInterface', 'auto' ); |
| 17 | + // Timed Text provider presently just "commons", |
| 18 | + // NOTE: Each player instance can also specify a provider |
| 19 | + "timedTextProvider" : "commons", |
16 | 20 | |
17 | | -// Timed Text provider presently just "commons", |
18 | | -// NOTE: Each player instance can also specify a provider |
19 | | -mw.setConfig( 'timedTextProvider', 'commons' ); |
| 21 | + // What tags will be re-written to video player by default |
| 22 | + // Set to empty string or null to avoid automatic video tag rewrites to embedPlayer |
| 23 | + "rewritePlayerTags" : "video,audio,playlist", |
20 | 24 | |
21 | | -// What tags will be re-written to video player by default |
22 | | -// Set to empty string or null to avoid automatic tag rewrites |
23 | | -mw.setConfig( 'rewritePlayerTags', 'video,audio,playlist' ); |
| 25 | + // Default video size ( if no size provided ) |
| 26 | + "video_size" : "400x300", |
24 | 27 | |
25 | | -// Default video size ( if no size provided ) |
26 | | -mw.setConfig( 'video_size', '400x300' ); |
27 | | - |
28 | | -// If the k-skin video player should attribute kaltura |
29 | | -mw.setConfig( 'k_attribution', true ); |
| 28 | + // If the video player should attribute kaltura |
| 29 | + "kalturaAttribution" : true, |
| 30 | + |
| 31 | + // Set the browser player warning flag to true by default ( applies to all players so its not part of attribute defaults above ) |
| 32 | + 'show_player_warning' : true |
| 33 | +} ); |
30 | 34 | |
31 | 35 | |
32 | 36 | // Add class file paths |
— | — | @@ -41,6 +45,7 @@ |
42 | 46 | "vlcEmbed" : "modules/EmbedPlayer/vlcEmbed.js" |
43 | 47 | } ); |
44 | 48 | |
| 49 | + |
45 | 50 | // Add style sheet dependencies ( From ROOT ) |
46 | 51 | mw.addClassStyleSheets( { |
47 | 52 | "kskinConfig" : "skins/kskin/EmbedPlayer.css", |
— | — | @@ -53,18 +58,24 @@ |
54 | 59 | * NOTE: this function can be part of setup can run prior to jQuery being ready |
55 | 60 | */ |
56 | 61 | mw.documentHasPlayerTags = function(){ |
57 | | - var rewriteTags = mw.getConfig( 'rewritePlayerTags' ); |
| 62 | + var rewriteTags = mw.getConfig( 'rewritePlayerTags' ); |
58 | 63 | if( rewriteTags ){ |
59 | 64 | var jtags = rewriteTags.split( ',' ); |
60 | | - for ( var i = 0; i < jtags.length; i++ ) { |
61 | | - if( document.getElementsByTagName( jtags[i] )[0] ) |
| 65 | + for ( var i = 0; i < jtags.length; i++ ) { |
| 66 | + if( document.getElementsByTagName( jtags[i] )[0] ){ |
62 | 67 | return true; |
63 | | - }; |
| 68 | + } |
| 69 | + } |
64 | 70 | } |
65 | 71 | return false; |
66 | 72 | } |
67 | 73 | |
68 | | -// Add a dom ready check for player tags |
| 74 | +/** |
| 75 | +* Add a DOM ready check for player tags |
| 76 | + |
| 77 | +* We use mw.addDOMReadyHook instead of mw.ready so that |
| 78 | +* player interfaces are ready once mw.ready is called. |
| 79 | +*/ |
69 | 80 | mw.addDOMReadyHook( function(){ |
70 | 81 | if( mw.documentHasPlayerTags() ) { |
71 | 82 | // Add the setup hook since we have player tags |
— | — | @@ -79,13 +90,14 @@ |
80 | 91 | }); |
81 | 92 | |
82 | 93 | // Tell mwEmbed to run setup |
83 | | - mw.setConfig( 'runSetupMwEmbed', true ); |
| 94 | + mw.setConfig( 'runSetupMwEmbed', true ); |
| 95 | + mw.log(" run setup is: " + mw.getConfig( 'runSetupMwEmbed' ) ); |
84 | 96 | } |
85 | 97 | }); |
86 | 98 | |
87 | | - |
88 | | - |
89 | | -// Add the module loader function: |
| 99 | +/** |
| 100 | +* Add the module loader function: |
| 101 | +*/ |
90 | 102 | mw.addModuleLoader( 'EmbedPlayer', function( callback ){ |
91 | 103 | var _this = this; |
92 | 104 | |
— | — | @@ -99,6 +111,7 @@ |
100 | 112 | 'mw.EmbedPlayer', |
101 | 113 | 'ctrlBuilder', |
102 | 114 | '$j.cookie', |
| 115 | + // Add JSON lib if browsers does not define "JSON" natively |
103 | 116 | 'JSON' |
104 | 117 | ], |
105 | 118 | [ |
— | — | @@ -107,8 +120,11 @@ |
108 | 121 | ] |
109 | 122 | ]; |
110 | 123 | |
| 124 | + |
| 125 | + |
| 126 | + |
111 | 127 | var addTimedTextReqFlag = false; |
112 | | - |
| 128 | + |
113 | 129 | // Merge in the timed text libs |
114 | 130 | if( mw.getConfig( 'textInterface' ) == 'always' ){ |
115 | 131 | addTimedTextReqFlag = true; |
— | — | @@ -168,7 +184,7 @@ |
169 | 185 | |
170 | 186 | // Load the video libs: |
171 | 187 | mw.load( dependencyRequest, function() { |
172 | | - //Setup userConfig |
| 188 | + // Setup userConfig |
173 | 189 | mw.setupUserConfig( function(){ |
174 | 190 | // Remove no video html elements: |
175 | 191 | $j( '.videonojs' ).remove(); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/omtkEmbed.js |
— | — | @@ -11,43 +11,36 @@ |
12 | 12 | |
13 | 13 | // Supported player features |
14 | 14 | supports: { |
15 | | - 'pause':true, |
16 | | - 'time_display':true |
| 15 | + 'pause' : true, |
| 16 | + 'timeDisplay' : true |
17 | 17 | }, |
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Wrap the embed code |
21 | 21 | */ |
22 | | - getEmbedHTML : function () { |
| 22 | + doEmbedHTML : function () { |
23 | 23 | var _this = this; |
24 | | - var embed_code = this.getEmbedObj(); |
25 | | - // Need omtk to fire an onReady event. |
| 24 | + var playerPath = mw.getMwEmbedPath() + 'modules/EmbedPlayer/binPlayers/omtk-fx/omtkp.swf'; |
| 25 | + $j( this ).html( |
| 26 | + '<object id="' + this.pid + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1" height="1">' + |
| 27 | + '<param name="movie" value="' + playerPath + '" />' + "\n" + |
| 28 | + '<!--[if !IE]>-->' + "\n" + |
| 29 | + '<object id="' + this.pid + '_ie" type="application/x-shockwave-flash" data="' + playerPath + '" width="1" height="1">' + "\n" + |
| 30 | + '<!--<![endif]-->' + "\n" + |
| 31 | + '<p>Error with Display of Flash Plugin</p>' + "\n" + |
| 32 | + '<!--[if !IE]>-->' + "\n" + |
| 33 | + '</object>' + "\n" + |
| 34 | + '<!--<![endif]-->' + "\n" + |
| 35 | + '</object>' |
| 36 | + ) |
| 37 | + // omtk needs to fire an onReady event. |
26 | 38 | setTimeout( function(){ |
27 | 39 | _this.postEmbedJS(); |
28 | 40 | }, 2000 ); |
29 | 41 | return embed_code; |
30 | | - }, |
| 42 | + }, |
31 | 43 | |
32 | 44 | /** |
33 | | - * Get the embed object html |
34 | | - */ |
35 | | - getEmbedObj:function() { |
36 | | - var player_path = mw.getMwEmbedPath() + 'modules/EmbedPlayer/binPlayers/omtk-fx/omtkp.swf'; |
37 | | - // player_path = 'omtkp.swf'; |
38 | | - mw.log( "player path: " + player_path ); |
39 | | - return '<object id="' + this.pid + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1" height="1">' + |
40 | | - '<param name="movie" value="' + player_path + '" />' + "\n" + |
41 | | - '<!--[if !IE]>-->' + "\n" + |
42 | | - '<object id="' + this.pid + '_ie" type="application/x-shockwave-flash" data="' + player_path + '" width="1" height="1">' + "\n" + |
43 | | - '<!--<![endif]-->' + "\n" + |
44 | | - '<p>Error with Display of Flash Plugin</p>' + "\n" + |
45 | | - '<!--[if !IE]>-->' + "\n" + |
46 | | - '</object>' + "\n" + |
47 | | - '<!--<![endif]-->' + "\n" + |
48 | | - '</object>'; |
49 | | - }, |
50 | | - |
51 | | - /** |
52 | 45 | * Run post embed javascript |
53 | 46 | */ |
54 | 47 | postEmbedJS:function() { |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/genericEmbed.js |
— | — | @@ -4,12 +4,12 @@ |
5 | 5 | var genericEmbed = { |
6 | 6 | // List of supported features of the generic plugin |
7 | 7 | supports: { |
8 | | - 'play_head':false, |
| 8 | + 'playHead':false, |
9 | 9 | 'pause':false, |
10 | 10 | 'stop':true, |
11 | 11 | 'fullscreen':false, |
12 | | - 'time_display':false, |
13 | | - 'volume_control':false |
| 12 | + 'timeDisplay':false, |
| 13 | + 'volumeControl':false |
14 | 14 | }, |
15 | 15 | |
16 | 16 | // Instance name: |
— | — | @@ -21,9 +21,11 @@ |
22 | 22 | * @return {String} |
23 | 23 | * embed code for genneric ogg plugin |
24 | 24 | */ |
25 | | - getEmbedHTML:function() { |
26 | | - return '<object type="application/ogg" ' + |
| 25 | + doEmbedHTML: function() { |
| 26 | + $j( this ).html( |
| 27 | + '<object type="application/ogg" ' + |
27 | 28 | 'width="' + this.width + '" height="' + this.height + '" ' + |
28 | | - 'data="' + this.getSrc( this.seek_time_sec ) + '"></object>'; |
| 29 | + 'data="' + this.getSrc( this.seek_time_sec ) + '"></object>' |
| 30 | + ); |
29 | 31 | } |
30 | 32 | }; |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -8,9 +8,6 @@ |
9 | 9 | * |
10 | 10 | */ |
11 | 11 | |
12 | | -// The global player list per page |
13 | | -mw.playerList = new Array(); |
14 | | - |
15 | 12 | mw.addMessages( { |
16 | 13 | "mwe-loading_plugin" : "loading plugin ...", |
17 | 14 | "mwe-select_playback" : "Set playback preference", |
— | — | @@ -42,6 +39,7 @@ |
43 | 40 | "mwe-no-player" : "No player available for $1", |
44 | 41 | "mwe-share_this_video" : "Share this video", |
45 | 42 | "mwe-video_credits" : "Video credits", |
| 43 | + "mwe-kaltura-platform-title" : "Kaltura open source video platform", |
46 | 44 | "mwe-menu_btn" : "Menu", |
47 | 45 | "mwe-close_btn" : "Close", |
48 | 46 | "mwe-ogg-player-vlc-player" : "VLC player", |
— | — | @@ -171,7 +169,7 @@ |
172 | 170 | * The base source attribute checks |
173 | 171 | * also see: http://dev.w3.org/html5/spec/Overview.html#the-source-element |
174 | 172 | */ |
175 | | -var default_source_attributes = new Array( |
| 173 | +var default_source_attributes = [ |
176 | 174 | // source id |
177 | 175 | 'id', |
178 | 176 | |
— | — | @@ -210,16 +208,13 @@ |
211 | 209 | // titleKey ( used for api lookups ) |
212 | 210 | 'titleKey', |
213 | 211 | |
214 | | - // The provider type ( for what type of api querie to make ) |
| 212 | + // The provider type ( for what type of api query to make ) |
215 | 213 | 'provider_type', |
216 | 214 | |
217 | 215 | // The api url for the provider |
218 | 216 | 'provider_url' |
219 | | -); |
| 217 | +]; |
220 | 218 | |
221 | | -// Set the browser player warning flag to true by default ( applies to all players so its not part of attribute defaults above ) |
222 | | -mw.setConfig( 'show_player_warning', true ); |
223 | | - |
224 | 219 | /** |
225 | 220 | * Adds jQuery binding for embedPlayer |
226 | 221 | */ |
— | — | @@ -397,7 +392,8 @@ |
398 | 393 | switch( element.tagName.toLowerCase() ) { |
399 | 394 | case 'playlist': |
400 | 395 | // Make sure we have the necessary playlist libs loaded: |
401 | | - mw.load( 'mw.PlayList', function() { |
| 396 | + mw.load( 'mw.PlayList', function() { |
| 397 | + |
402 | 398 | // Create playlist player interface |
403 | 399 | var playlistPlayer = new mw.PlayList( element, attributes ); |
404 | 400 | |
— | — | @@ -427,7 +423,7 @@ |
428 | 424 | } |
429 | 425 | |
430 | 426 | if( waitForMeta ){ |
431 | | - mw.log(" WaitForMeta ( video missing height, width or duration )"); |
| 427 | + mw.log(" WaitForMeta ( video missing height, width or duration )" ); |
432 | 428 | element.removeEventListener( "loadedmetadata", runPlayerSwap, true ); |
433 | 429 | element.addEventListener( "loadedmetadata", runPlayerSwap, true ); |
434 | 430 | // Time-out of 5 seconds ( maybe still playable but no timely metadata ) |
— | — | @@ -460,15 +456,9 @@ |
461 | 457 | swapPlayerElement[ method ] = playerInterface[ method ]; |
462 | 458 | } |
463 | 459 | } |
464 | | - |
| 460 | + |
465 | 461 | // Remove the targetElement |
466 | 462 | $j( targetElement ).replaceWith( swapPlayerElement ); |
467 | | - |
468 | | - // Now Swap out the video element for the embed_video obj: |
469 | | - //$j( targetElement ) |
470 | | - // Put the swapPlayerElement after the targetElement |
471 | | - //.after( swapPlayerElement ); |
472 | | - //$j( targetElement ).remove(); |
473 | 463 | |
474 | 464 | // Set swapPlayerElement has height / width set and set to loading: |
475 | 465 | $j( swapPlayerElement ).css( { |
— | — | @@ -1578,8 +1568,8 @@ |
1579 | 1569 | /** |
1580 | 1570 | * Get the plugin embed html ( should be implemented by embed player interface ) |
1581 | 1571 | */ |
1582 | | - getEmbedHTML : function() { |
1583 | | - return 'Error: function getEmbedHTML should be implemented by embed player interface '; |
| 1572 | + doEmbedHTML : function() { |
| 1573 | + return 'Error: function doEmbedHTML should be implemented by embed player interface '; |
1584 | 1574 | }, |
1585 | 1575 | |
1586 | 1576 | /** |
— | — | @@ -1628,8 +1618,8 @@ |
1629 | 1619 | |
1630 | 1620 | // Make sure the player is |
1631 | 1621 | mw.log( 'performing embed for ' + _this.id ); |
1632 | | - // mw.log('should embed:' + embed_code); |
1633 | | - $j( '#' + _this.id ).html( _this.getEmbedHTML() ); |
| 1622 | + // mw.log('should embed:' + embed_code); |
| 1623 | + _this.doEmbedHTML() |
1634 | 1624 | }, |
1635 | 1625 | /** |
1636 | 1626 | * Searches for related clips from titleKey |
— | — | @@ -1711,7 +1701,7 @@ |
1712 | 1702 | onClipDone:function() { |
1713 | 1703 | mw.log( 'base:onClipDone' ); |
1714 | 1704 | |
1715 | | - // stop the clip (load the thumbnail etc) |
| 1705 | + // Stop the clip (load the thumbnail etc) |
1716 | 1706 | this.stop(); |
1717 | 1707 | this.seek_time_sec = 0; |
1718 | 1708 | this.updatePlayHead( 0 ); |
— | — | @@ -1723,21 +1713,22 @@ |
1724 | 1714 | this.thumbnail_disp = true; |
1725 | 1715 | |
1726 | 1716 | // make sure we are not in preview mode( no end clip actions in preview mode) |
1727 | | - if ( this.preview_mode ) |
| 1717 | + if ( this.preview_mode ){ |
1728 | 1718 | return ; |
1729 | | - |
1730 | | - //if k-attribution and k-skin show the "credits" screen: |
1731 | | - if( mw.getConfig( 'k_attribution' ) && this.ctrlBuilder.showCredits ){ |
1732 | | - // Call a "credit" menu display: |
1733 | | - this.$interface.find( '.k-options' ).click(); |
| 1719 | + } |
| 1720 | + |
| 1721 | + // Call the ctrlBuilder end event:: |
| 1722 | + |
| 1723 | + //if kalturaAttribution and k-skin show the "credits" screen: |
| 1724 | + if( this.ctrlBuilder.showCredits ){ |
1734 | 1725 | this.ctrlBuilder.showCredits(); |
1735 | 1726 | return ; |
1736 | 1727 | } |
1737 | | - |
| 1728 | + // Related videos: |
1738 | 1729 | $j( '#img_thumb_' + this.id ).css( 'zindex', 1 ); |
1739 | 1730 | this.$interface.find( '.play-btn-large' ).hide(); |
1740 | 1731 | |
1741 | | - // add black background |
| 1732 | + // Add black background |
1742 | 1733 | $j( '#dc_' + this.id ).append( '<div id="black_back_' + this.id + '" ' + |
1743 | 1734 | 'style="z-index:-2;position:absolute;background:#000;' + |
1744 | 1735 | 'top:0px;left:0px;width:' + parseInt( this.width ) + 'px;' + |
— | — | @@ -2009,7 +2000,7 @@ |
2010 | 2001 | }) |
2011 | 2002 | ) |
2012 | 2003 | } |
2013 | | - //Set up local jQuery refrence to "interface_wrap" |
| 2004 | + //Set up local jQuery object reference to "interface_wrap" |
2014 | 2005 | this.$interface = $j(this).parent('.interface_wrap'); |
2015 | 2006 | |
2016 | 2007 | // Update Thumbnail for the "player" |
— | — | @@ -2337,7 +2328,7 @@ |
2338 | 2329 | * Show the "share" msg |
2339 | 2330 | * |
2340 | 2331 | * TODO share should be enabled via <embed> tag usage to be compatible |
2341 | | - * with sites that enable sharing flash embeds |
| 2332 | + * with sites social networking sites that allow <embed> tags but not js |
2342 | 2333 | * |
2343 | 2334 | * @param {Object} $target Target jQuery object to set share html |
2344 | 2335 | */ |
— | — | @@ -2605,7 +2596,7 @@ |
2606 | 2597 | }, |
2607 | 2598 | |
2608 | 2599 | /** |
2609 | | - * loads sources and calls showDownloadWithSources |
| 2600 | + * Loads sources and calls showDownloadWithSources |
2610 | 2601 | * @param {Object} $target jQuery target to output to |
2611 | 2602 | */ |
2612 | 2603 | showDownload:function( $target ) { |
— | — | @@ -2623,13 +2614,14 @@ |
2624 | 2615 | _this.showDownloadWithSources( $target ); |
2625 | 2616 | } |
2626 | 2617 | }, |
| 2618 | + |
2627 | 2619 | /** |
2628 | 2620 | * Shows the download interface with sources loaded |
2629 | 2621 | * @param {Object} $target jQuery target to output to |
2630 | 2622 | */ |
2631 | 2623 | showDownloadWithSources : function( $target ) { |
2632 | 2624 | var _this = this; |
2633 | | - $target.append( |
| 2625 | + $target.empty().append( |
2634 | 2626 | $j('<div />') |
2635 | 2627 | .css({ |
2636 | 2628 | "color":"white" |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/javaEmbed.js |
— | — | @@ -2,9 +2,7 @@ |
3 | 3 | * List of domains and hosted location of cortado. Lets clients avoid the security warning for cross domain cortado |
4 | 4 | */ |
5 | 5 | window.cortadoDomainLocations = { |
6 | | - 'upload.wikimedia.org' : 'http://upload.wikimedia.org/jars/cortado.jar', |
7 | | - 'tinyvid.tv' : 'http://tinyvid.tv/static/cortado.jar', |
8 | | - 'media.tinyvid.tv' : 'http://media.tinyvid.tv/cortado.jar' |
| 6 | + 'upload.wikimedia.org' : 'http://upload.wikimedia.org/jars/cortado.jar' |
9 | 7 | } |
10 | 8 | |
11 | 9 | var javaEmbed = { |
— | — | @@ -14,41 +12,79 @@ |
15 | 13 | |
16 | 14 | // Supported feature set of the cortado applet: |
17 | 15 | supports: { |
18 | | - 'play_head' : true, |
| 16 | + 'playHead' : true, |
19 | 17 | 'pause' : true, |
20 | 18 | 'stop' : true, |
21 | 19 | 'fullscreen' : false, |
22 | | - 'time_display' : true, |
23 | | - 'volume_control' : false |
| 20 | + 'timeDisplay' : true, |
| 21 | + 'volumeControl' : false |
24 | 22 | }, |
25 | 23 | |
26 | 24 | /** |
27 | | - * Wraps the embed object html output: |
| 25 | + * Output the the embed html |
28 | 26 | */ |
29 | | - getEmbedHTML: function () { |
| 27 | + doEmbedHTML: function () { |
30 | 28 | var _this = this; |
31 | | - // big delay on embed html cuz its just for status updates and ie6 is crazy. |
32 | | - if ( this.controls ){ |
33 | | - setTimeout( function(){ |
34 | | - _this.postEmbedJS(); |
35 | | - }, 250); |
36 | | - } |
37 | | - // set a default duration of 30 seconds: cortao should detect duration. |
38 | | - return this.getEmbedObj(); |
39 | | - }, |
40 | | - |
41 | | - /** |
42 | | - * Get the embed html code: |
43 | | - */ |
44 | | - getEmbedObj: function() { |
45 | 29 | mw.log( "java play url:" + this.getSrc( this.seek_time_sec ) ); |
46 | 30 | // get the duration |
47 | 31 | this.getDuration(); |
48 | 32 | // if still unset set to an arbitrary time 60 seconds: |
49 | 33 | if ( !this.duration )this.duration = 60; |
50 | | - // @@todo we should have src property in our base embed object |
51 | | - var mediaSrc = this.getSrc(); |
52 | 34 | |
| 35 | + var applet_loc = this.getAppletLocation(); |
| 36 | + |
| 37 | + mw.log('Applet location: ' + applet_loc ); |
| 38 | + mw.log('Play media: ' + this.getSrc() ); |
| 39 | + |
| 40 | + // load directly in the page.. |
| 41 | + // (media must be on the same server or applet must be signed) |
| 42 | + var appletCode = '' + |
| 43 | + '<applet id="' + this.pid + '" code="com.fluendo.player.Cortado.class" archive="' + applet_loc + '" width="' + this.width + '" height="' + this.height + '"> ' + "\n" + |
| 44 | + '<param name="url" value="' + this.getSrc() + '" /> ' + "\n" + |
| 45 | + '<param name="local" value="false"/>' + "\n" + |
| 46 | + '<param name="keepaspect" value="true" />' + "\n" + |
| 47 | + '<param name="video" value="true" />' + "\n" + |
| 48 | + '<param name="showStatus" value="hide" />' + "\n" + |
| 49 | + '<param name="audio" value="true" />' + "\n" + |
| 50 | + '<param name="seekable" value="true" />' + "\n" + |
| 51 | + '<param name="duration" value="' + this.duration + '" />' + "\n" + |
| 52 | + '<param name="bufferSize" value="4096" />' + "\n" + |
| 53 | + '</applet>'; |
| 54 | + |
| 55 | + // Wrap it in an iframe to avoid hanging the event thread in FF 2/3 and similar |
| 56 | + // Doesn't work in MSIE or Safari/Mac or Opera 9.5 |
| 57 | + if ( $j.browser.mozilla ) { |
| 58 | + var iframe = document.createElement( 'iframe' ); |
| 59 | + iframe.setAttribute( 'width', this.width ); |
| 60 | + iframe.setAttribute( 'height', this.height ); |
| 61 | + iframe.setAttribute( 'scrolling', 'no' ); |
| 62 | + iframe.setAttribute( 'frameborder', 0 ); |
| 63 | + iframe.setAttribute( 'marginWidth', 0 ); |
| 64 | + iframe.setAttribute( 'marginHeight', 0 ); |
| 65 | + iframe.setAttribute( 'id', 'cframe_' + this.id ) |
| 66 | + |
| 67 | + // Append the iframe to the embed object: |
| 68 | + $j( this ).html( iframe ); |
| 69 | + |
| 70 | + // Write out the iframe content: |
| 71 | + var newDoc = iframe.contentDocument; |
| 72 | + newDoc.open(); |
| 73 | + newDoc.write( '<html><body>' + appletCode + '</body></html>' ); |
| 74 | + // spurious error in some versions of FF, no workaround known |
| 75 | + newDoc.close(); |
| 76 | + } else { |
| 77 | + $j( this ).html( appletCode ); |
| 78 | + } |
| 79 | + |
| 80 | + // Start the monitor: |
| 81 | + this.monitor(); |
| 82 | + }, |
| 83 | + |
| 84 | + /** |
| 85 | + * Get the applet location |
| 86 | + */ |
| 87 | + getAppletLocation: function(){ |
| 88 | + var mediaSrc = this.getSrc() |
53 | 89 | if ( mediaSrc.indexOf( '://' ) != -1 & !mw.isLocalDomain( mediaSrc ) ) { |
54 | 90 | if ( window.cortadoDomainLocations[ mw.parseUri( mediaSrc ).host ] ) { |
55 | 91 | applet_loc = window.cortadoDomainLocations[mw.parseUri( mediaSrc ).host]; |
— | — | @@ -59,60 +95,18 @@ |
60 | 96 | // should be identical to cortado.jar |
61 | 97 | applet_loc = mw.getMwEmbedPath() + 'modules/EmbedPlayer/binPlayers/cortado/cortado-ovt-stripped-0.5.0.jar'; |
62 | 98 | } |
63 | | - // load directly in the page.. |
64 | | - // (media must be on the same server or applet must be signed) |
65 | | - var appplet_code = '' + |
66 | | - '<applet id="' + this.pid + '" code="com.fluendo.player.Cortado.class" archive="' + applet_loc + '" width="' + this.width + '" height="' + this.height + '"> ' + "\n" + |
67 | | - '<param name="url" value="' + mediaSrc + '" /> ' + "\n" + |
68 | | - '<param name="local" value="false"/>' + "\n" + |
69 | | - '<param name="keepaspect" value="true" />' + "\n" + |
70 | | - '<param name="video" value="true" />' + "\n" + |
71 | | - '<param name="showStatus" value="hide" />' + "\n" + |
72 | | - '<param name="audio" value="true" />' + "\n" + |
73 | | - '<param name="seekable" value="true" />' + "\n" + |
74 | | - '<param name="duration" value="' + this.duration + '" />' + "\n" + |
75 | | - '<param name="bufferSize" value="4096" />' + "\n" + |
76 | | - '</applet>'; |
77 | | - |
78 | | - // Wrap it in an iframe to avoid hanging the event thread in FF 2/3 and similar |
79 | | - // Doesn't work in MSIE or Safari/Mac or Opera 9.5 |
80 | | - if ( $j.browser.mozilla ) { |
81 | | - var iframe = document.createElement( 'iframe' ); |
82 | | - iframe.setAttribute( 'width', params.width ); |
83 | | - iframe.setAttribute( 'height', playerHeight ); |
84 | | - iframe.setAttribute( 'scrolling', 'no' ); |
85 | | - iframe.setAttribute( 'frameborder', 0 ); |
86 | | - iframe.setAttribute( 'marginWidth', 0 ); |
87 | | - iframe.setAttribute( 'marginHeight', 0 ); |
88 | | - iframe.setAttribute( 'id', 'cframe_' + this.id ) |
89 | | - elt.appendChild( iframe ); |
90 | | - var newDoc = iframe.contentDocument; |
91 | | - newDoc.open(); |
92 | | - newDoc.write( '<html><body>' + appplet_code + '</body></html>' ); |
93 | | - newDoc.close(); // spurious error in some versions of FF, no workaround known |
94 | | - } else { |
95 | | - return appplet_code; |
96 | | - } |
| 99 | + return applet_loc; |
97 | 100 | }, |
98 | 101 | |
99 | 102 | /** |
100 | | - * Once the applet has been embed start monitoring playback |
101 | | - */ |
102 | | - postEmbedJS:function() { |
103 | | - // start monitor: |
104 | | - this.monitor(); |
105 | | - }, |
106 | | - |
107 | | - /** |
108 | 103 | * Monitor applet playback, and update currentTime |
109 | 104 | */ |
110 | | - monitor:function() { |
111 | | - this.getPlayerElement(); |
112 | | - if ( this.isPlaying() ) { |
113 | | - if ( this.playerElement ) { |
| 105 | + monitor: function() { |
| 106 | + this.getPlayerElement(); |
| 107 | + if ( this.playerElement ) { |
114 | 108 | try { |
115 | 109 | // java reads ogg media time.. so no need to add the start or seek offset: |
116 | | - // mw.log(' ct: ' + this.playerElement.getPlayPosition() + ' ' + this.supportsURLTimeEncoding()); |
| 110 | + mw.log(' ct: ' + this.playerElement.getPlayPosition() + ' ' + this.supportsURLTimeEncoding()); |
117 | 111 | this.currentTime = this.playerElement.getPlayPosition(); |
118 | 112 | if ( this.playerElement.getPlayPosition() < 0 ) { |
119 | 113 | mw.log( 'pp:' + this.playerElement.getPlayPosition() ); |
— | — | @@ -120,17 +114,18 @@ |
121 | 115 | this.onClipDone(); |
122 | 116 | } |
123 | 117 | } catch ( e ) { |
124 | | - mw.log( 'could not get time from jPlayer: ' ); |
| 118 | + mw.log( 'could not get time from jPlayer: ' + e ); |
125 | 119 | } |
126 | | - } |
127 | | - } |
128 | | - // once currentTime is updated call parent_monitor |
| 120 | + }else{ |
| 121 | + mw.log(" could not find playerElement " ); |
| 122 | + } |
| 123 | + // Once currentTime is updated call parent_monitor |
129 | 124 | this.parent_monitor(); |
130 | 125 | }, |
131 | 126 | |
132 | 127 | /** |
133 | 128 | * Seek in the ogg stream |
134 | | - * (Cortado seek does not seem to work very well) |
| 129 | + * ( Cortado seek does not seem to work very well ) |
135 | 130 | * @param {Float} percentage Percentage to seek into the stream |
136 | 131 | */ |
137 | 132 | doSeek:function( percentage ) { |
— | — | @@ -138,10 +133,7 @@ |
139 | 134 | this.getPlayerElement(); |
140 | 135 | |
141 | 136 | if ( this.supportsURLTimeEncoding() ) { |
142 | | - this.parent_doSeek( percentage ); |
143 | | - // this.seek_time_sec = mw.npt2seconds( this.start_ntp ) + parseFloat( percentage * this.getDuration() ); |
144 | | - // this.playerElement.setParam('url', this.getSrc( this.seek_time_sec )) |
145 | | - // this.playerElement.restart(); |
| 137 | + this.parent_doSeek( percentage ); |
146 | 138 | } else if ( this.playerElement ) { |
147 | 139 | // do a (generally broken) local seek: |
148 | 140 | mw.log( "cortado javascript seems to always fail ... but here we go... doSeek(" + ( percentage * parseFloat( this.getDuration() ) ) ); |
— | — | @@ -183,7 +175,7 @@ |
184 | 176 | */ |
185 | 177 | getPlayerElement:function() { |
186 | 178 | if ( $j.browser.mozilla ) { |
187 | | - this.playerElement = window.frames['cframe_' + this.id ].document.getElementById( this.pid ); |
| 179 | + this.playerElement = $j('#cframe_' + this.id).contents().find( '#' + this.pid ); |
188 | 180 | } else { |
189 | 181 | this.playerElement = $j( '#' + this.pid ).get( 0 ); |
190 | 182 | } |
— | — | @@ -205,11 +197,12 @@ |
206 | 198 | * Issue the doPlay request to the playerElement |
207 | 199 | * calls parent_play to update interface |
208 | 200 | */ |
209 | | - play:function() { |
| 201 | + play: function() { |
210 | 202 | this.getPlayerElement(); |
211 | 203 | this.parent_play(); |
212 | | - if ( this.playerElement ) |
213 | | - this.playerElement.doPlay(); |
| 204 | + if ( this.playerElement && this.playerElement.play ){ |
| 205 | + this.playerElement.play(); |
| 206 | + } |
214 | 207 | }, |
215 | 208 | |
216 | 209 | /** |
— | — | @@ -218,8 +211,11 @@ |
219 | 212 | */ |
220 | 213 | pause:function() { |
221 | 214 | this.getPlayerElement(); |
| 215 | + // Update the interface |
222 | 216 | this.parent_pause(); |
223 | | - if ( this.playerElement && this.playerElement.doPause ) |
224 | | - this.playerElement.doPause(); |
| 217 | + // Call the pause function if it exists: |
| 218 | + if ( this.playerElement && this.playerElement.pause ){ |
| 219 | + this.playerElement.pause(); |
| 220 | + } |
225 | 221 | } |
226 | 222 | }; |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/htmlEmbed.js |
— | — | @@ -11,11 +11,11 @@ |
12 | 12 | |
13 | 13 | // List of supported features |
14 | 14 | supports: { |
15 | | - 'play_head':true, |
| 15 | + 'playHead':true, |
16 | 16 | 'pause':true, |
17 | 17 | 'fullscreen':false, |
18 | | - 'time_display':true, |
19 | | - 'volume_control':true, |
| 18 | + 'timeDisplay':true, |
| 19 | + 'volumeControl':true, |
20 | 20 | |
21 | 21 | 'overlays':true, |
22 | 22 | |
— | — | @@ -199,8 +199,8 @@ |
200 | 200 | /** |
201 | 201 | * Get the "embed" html for the html player |
202 | 202 | */ |
203 | | - getEmbedHTML:function() { |
204 | | - mw.log( 'f:html:getEmbedHTML: ' + this.id ); |
| 203 | + doEmbedHTML: function() { |
| 204 | + mw.log( 'f:html:doEmbedHTML: ' + this.id ); |
205 | 205 | // set up the css for our parent div: |
206 | 206 | $j( this ).css( { |
207 | 207 | 'width':this.pc.pp.width, |
— | — | @@ -242,14 +242,6 @@ |
243 | 243 | this.getEmbedHTML(); |
244 | 244 | }, |
245 | 245 | |
246 | | - /** |
247 | | - * Display the "embed" html right away |
248 | | - */ |
249 | | - getHTML:function() { |
250 | | - mw.log( 'htmlEmbed::getHTML() ' + this.id ); |
251 | | - this.getEmbedHTML(); |
252 | | - }, |
253 | | - |
254 | 246 | /** |
255 | 247 | * Get the media duration |
256 | 248 | */ |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/vlcEmbed.js |
— | — | @@ -10,12 +10,12 @@ |
11 | 11 | |
12 | 12 | //What the vlc player / plug-in supports: |
13 | 13 | supports : { |
14 | | - 'play_head':true, |
| 14 | + 'playHead':true, |
15 | 15 | 'pause':true, |
16 | 16 | 'stop':true, |
17 | 17 | 'fullscreen':true, |
18 | | - 'time_display':true, |
19 | | - 'volume_control':true, |
| 18 | + 'timeDisplay':true, |
| 19 | + 'volumeControl':true, |
20 | 20 | |
21 | 21 | 'playlist_driver':true, // if the object supports playlist functions |
22 | 22 | 'overlay':false |
— | — | @@ -30,43 +30,45 @@ |
31 | 31 | /** |
32 | 32 | * Get embed HTML |
33 | 33 | */ |
34 | | - getEmbedHTML: function() { |
35 | | - var _this = this; |
| 34 | + doEmbedHTML: function() { |
| 35 | + var _this = this; |
| 36 | + /*$j( this ).html( |
| 37 | + '<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" ' + |
| 38 | + 'codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab#Version=0,8,6,0" ' + |
| 39 | + 'id="' + this.pid + '" events="True" height="' + this.height + '" width="' + this.width + '"' + |
| 40 | + '>' + |
| 41 | + '<param name="MRL" value="">' + |
| 42 | + '<param name="ShowDisplay" value="True">' + |
| 43 | + '<param name="AutoLoop" value="False">' + |
| 44 | + '<param name="AutoPlay" value="False">' + |
| 45 | + '<param name="Volume" value="50">' + |
| 46 | + '<param name="StartTime" value="0">' + |
| 47 | + '<embed pluginspage="http://www.videolan.org" type="application/x-vlc-plugin" ' + |
| 48 | + 'progid="VideoLAN.VLCPlugin.2" name="' + this.pid + '" ' + |
| 49 | + 'height="' + this.height + '" width="' + this.width + '" ' + |
| 50 | + // set the style too 'just to be sure' |
| 51 | + 'style="width:' + this.width + 'px;height:' + this.height + 'px;" ' + |
| 52 | + '>' + |
| 53 | + '</object>' |
| 54 | + )*/ |
| 55 | + $j( this ).html( |
| 56 | + '<embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2" '+ |
| 57 | + 'width="' + this.width +'" ' + |
| 58 | + 'height="' + this.height + '" ' + |
| 59 | + 'id="' + this.pid + '"> ' + |
| 60 | + '</embed>' |
| 61 | + ); |
| 62 | + |
| 63 | + |
36 | 64 | // give VLC 150ms to initialize before we start playback |
37 | 65 | // @@todo should be able to do this as an ready event |
38 | 66 | this.waitForVlcCount = 0; |
39 | 67 | setTimeout( function(){ |
40 | 68 | _this.postEmbedJS(); |
41 | 69 | }, 150 ); |
42 | | - return this.getEmbedObj(); |
43 | | - }, |
| 70 | + }, |
44 | 71 | |
45 | 72 | /** |
46 | | - * Function to get embed object code |
47 | | - */ |
48 | | - getEmbedObj:function() { |
49 | | - var embed_code = '<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" ' + |
50 | | - 'codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab#Version=0,8,6,0" ' + |
51 | | - 'id="' + this.pid + '" events="True" height="' + this.height + '" width="' + this.width + '"' + |
52 | | - '>' + |
53 | | - '<param name="MRL" value="">' + |
54 | | - '<param name="ShowDisplay" value="True">' + |
55 | | - '<param name="AutoLoop" value="False">' + |
56 | | - '<param name="AutoPlay" value="False">' + |
57 | | - '<param name="Volume" value="50">' + |
58 | | - '<param name="StartTime" value="0">' + |
59 | | - '<embed pluginspage="http://www.videolan.org" type="application/x-vlc-plugin" ' + |
60 | | - 'progid="VideoLAN.VLCPlugin.2" name="' + this.pid + '" ' + |
61 | | - 'height="' + this.height + '" width="' + this.width + '" ' + |
62 | | - // set the style too 'just to be sure' |
63 | | - 'style="width:' + this.width + 'px;height:' + this.height + 'px;" ' + |
64 | | - '>' + |
65 | | - '</object>'; |
66 | | - mw.log( 'embed with: ' + embed_code ); |
67 | | - return embed_code; |
68 | | - }, |
69 | | - |
70 | | - /** |
71 | 73 | * Javascript to run post vlc embedding |
72 | 74 | * Inserts the requested src to the embed instance |
73 | 75 | */ |
— | — | @@ -74,12 +76,15 @@ |
75 | 77 | var _this = this; |
76 | 78 | // load a pointer to the vlc into the object (this.playerElement) |
77 | 79 | this.getPlayerElement(); |
78 | | - if ( this.playerElement.log ) { |
| 80 | + if ( this.playerElement && this.playerElement.playlist) { |
79 | 81 | // manipulate the dom object to make sure vlc has the correct size: |
80 | 82 | this.playerElement.style.width = this.width; |
81 | 83 | this.playerElement.style.height = this.height; |
82 | 84 | this.playerElement.playlist.items.clear(); |
| 85 | + |
| 86 | + // VLC likes absolute urls: |
83 | 87 | var src = mw.absoluteUrl( this.getSrc() ) ; |
| 88 | + |
84 | 89 | // @@todo if client supports seeking no need to send seek_offset to URI |
85 | 90 | mw.log( 'vlc play::' + src ); |
86 | 91 | var itemId = this.playerElement.playlist.add( src ); |
— | — | @@ -93,7 +98,7 @@ |
94 | 99 | _this.monitor(); |
95 | 100 | }, 100 ); |
96 | 101 | } else { |
97 | | - mw.log( 'postEmbedJS:vlc not ready' ); |
| 102 | + mw.log( 'postEmbedJS: vlc not ready' ); |
98 | 103 | this.waitForVlcCount++; |
99 | 104 | if ( this.waitForVlcCount < 10 ) { |
100 | 105 | setTimeout( function(){ |
— | — | @@ -299,7 +304,7 @@ |
300 | 305 | |
301 | 306 | /** |
302 | 307 | * Update the player volume |
303 | | - * @pram {Float} percent Percet of total volume |
| 308 | + * @pram {Float} percent Percent of total volume |
304 | 309 | */ |
305 | 310 | updateVolumen:function( percent ) { |
306 | 311 | if ( this.getPlayerElement() ) |
— | — | @@ -330,10 +335,7 @@ |
331 | 336 | * Get the embed vlc object |
332 | 337 | */ |
333 | 338 | getPlayerElement : function() { |
334 | | - this.playerElement = $j('#' + this.pid ).get(0); |
335 | | - if( this.playerElement ) |
336 | | - return true; |
337 | | - else |
338 | | - return false; |
| 339 | + this.playerElement = $j( '#' + this.pid ).get(0); |
| 340 | + return this.playerElement; |
339 | 341 | } |
340 | 342 | }; |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/nativeEmbed.js |
— | — | @@ -27,48 +27,45 @@ |
28 | 28 | |
29 | 29 | // Native player supported feature set |
30 | 30 | supports: { |
31 | | - 'play_head':true, |
32 | | - 'pause':true, |
33 | | - 'fullscreen':false, |
34 | | - 'time_display':true, |
35 | | - 'volume_control':true, |
| 31 | + 'playHead' : true, |
| 32 | + 'pause' : true, |
| 33 | + 'fullscreen' : false, |
| 34 | + 'timeDisplay' : true, |
| 35 | + 'volumeControl' : true, |
36 | 36 | |
37 | | - 'overlays':true, |
38 | | - 'playlist_swap_loader':true // if the object supports playlist functions |
| 37 | + 'overlays' : true, |
| 38 | + // if the object supports playlist functions |
| 39 | + 'playlist_swap_loader' : true |
39 | 40 | }, |
40 | 41 | |
41 | 42 | /** |
42 | 43 | * Return the embed code |
43 | 44 | */ |
44 | | - getEmbedHTML : function () { |
| 45 | + doEmbedHTML : function () { |
45 | 46 | var _this = this; |
46 | | - var embed_code = this.getEmbedObj(); |
47 | | - mw.log( "embed code: " + embed_code ) |
| 47 | + |
| 48 | + mw.log( "native play url:" + this.getSrc() + ' startOffset: ' + this.start_ntp + ' end: ' + this.end_ntp ); |
| 49 | + |
| 50 | + $j( this ).html( |
| 51 | + $j( '<video />' ) |
| 52 | + .attr( { |
| 53 | + 'id' : this.pid, |
| 54 | + 'autoplay' : "true", |
| 55 | + 'src' : this.getSrc() |
| 56 | + } ) |
| 57 | + .css( { |
| 58 | + 'width' : this.width, |
| 59 | + 'height' : this.height |
| 60 | + } ) |
| 61 | + ) |
| 62 | + mw.log( "Embed code: " + $j( this ).html() ) |
| 63 | + |
48 | 64 | setTimeout( function(){ |
49 | 65 | _this.postEmbedJS(); |
50 | | - }, 150 ); |
51 | | - return embed_code; |
| 66 | + }, 150 ); |
52 | 67 | }, |
53 | 68 | |
54 | 69 | /** |
55 | | - * Get the native embed code |
56 | | - */ |
57 | | - getEmbedObj: function() { |
58 | | - // We want to let mwEmbed handle the controls so notice the absence of control attribute |
59 | | - // controls=false results in controls being displayed: |
60 | | - // http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-August/016159.html |
61 | | - mw.log( "native play url:" + this.getSrc() + ' startOffset: ' + this.start_ntp + ' end: ' + this.end_ntp ); |
62 | | - var eb = '<video ' + |
63 | | - 'id="' + this.pid + '" ' + |
64 | | - 'style="width:' + this.width + 'px;height:' + this.height + 'px;" ' + |
65 | | - 'width="' + this.width + '" height="' + this.height + '" ' + |
66 | | - 'autoplay="true" ' + |
67 | | - 'src="' + this.getSrc() + '" >' + |
68 | | - '</video>'; |
69 | | - return eb; |
70 | | - }, |
71 | | - |
72 | | - /** |
73 | 70 | * Post element javascript, binds event listeners and starts monitor |
74 | 71 | */ |
75 | 72 | postEmbedJS: function() { |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/mw.ApiProxy.js |
— | — | @@ -462,9 +462,10 @@ |
463 | 463 | serverBrowseFile(); |
464 | 464 | return true; |
465 | 465 | } |
466 | | - // Else do a normal api request : |
| 466 | + // Else do an api request : |
467 | 467 | return serverApiRequest(); |
468 | 468 | } |
| 469 | + |
469 | 470 | /** |
470 | 471 | * Api iFrame request: |
471 | 472 | */ |
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js |
— | — | @@ -28,69 +28,9 @@ |
29 | 29 | /* |
30 | 30 | * Set the mwEmbedVersion ( not set by stopgap ) |
31 | 31 | */ |
32 | | -var MW_EMBED_VERSION = '1.1a'; |
| 32 | +var MW_EMBED_VERSION = '1.1d'; |
33 | 33 | |
34 | 34 | /** |
35 | | -* Default global config values. Configuration values are set via mw.setConfig |
36 | | -* Configuration values should generally be set prior to dom-ready |
37 | | -*/ |
38 | | -var mwDefaultConf = { |
39 | | - |
40 | | - // Default skin name |
41 | | - 'skinName' : 'mvpcf', |
42 | | - |
43 | | - // Default jquery ui skin name |
44 | | - 'jQueryUISkin' : 'redmond', |
45 | | - |
46 | | - /** |
47 | | - * If jQuery / mwEmbed should be loaded. |
48 | | - * |
49 | | - * This flag is automatically set to true if: |
50 | | - * Any script calls mw.ready ( callback_function ) |
51 | | - * Page DOM includes any tags set in config.rewritePlayerTags at onDomReady |
52 | | - * ( embedPlayer module ) |
53 | | - * |
54 | | - * This flag increases page performance on pages that do not use mwEmbed |
55 | | - * and don't already load jQuery |
56 | | - * |
57 | | - * For example when including the mwEmbed.js in your blog template |
58 | | - * mwEmbed will only load extra js on blog posts that include the video tag. |
59 | | - * |
60 | | - * NOTE: Future architecture will probably do away with this flag and refactor it into |
61 | | - * a smaller "remotePageMwEmbed.js" script similar to ../remoteMwEmbed.js |
62 | | - */ |
63 | | - 'runSetupMwEmbed' : false, |
64 | | - |
65 | | - // The mediaWiki path of mvEmbed |
66 | | - 'mediaWiki_mwEmbedPath' : 'js/mwEmbed/', |
67 | | - |
68 | | - // Api actions that must be submitted in a POST, and need an api proxy for cross domain calls |
69 | | - 'apiPostActions': [ 'login', 'purge', 'rollback', 'delete', 'undelete', |
70 | | - 'protect', 'block', 'unblock', 'move', 'edit', 'upload', 'emailuser', |
71 | | - 'import', 'userrights' ], |
72 | | - |
73 | | - //If we are in debug mode ( results in fresh debug javascript includes ) |
74 | | - 'debug' : false, |
75 | | - |
76 | | - // Valid language codes ( has a file in /includes/languages/classes/Language{code}.js ) |
77 | | - // TODO: mirror the mediaWiki language "fallback" system |
78 | | - 'languageCodeList': ['en', 'am', 'ar', 'bat_smg', 'be_tarak', 'be', 'bh', |
79 | | - 'bs', 'cs', 'cu', 'cy', 'dsb', 'fr', 'ga', 'gd', 'gv', 'he', 'hi', |
80 | | - 'hr', 'hsb', 'hy', 'ksh', 'ln', 'lt', 'lv', 'mg', 'mk', 'mo', 'mt', |
81 | | - 'nso', 'pl', 'pt_br', 'ro', 'ru', 'se', 'sh', 'sk', 'sl', 'sma', |
82 | | - 'sr_ec', 'sr_el', 'sr', 'ti', 'tl', 'uk', 'wa' |
83 | | - ], |
84 | | - |
85 | | - // Default user language is "en" Can be overwritten by: |
86 | | - // "uselang" url param |
87 | | - // wgUserLang global |
88 | | - 'userLanguage' : 'en', |
89 | | - |
90 | | - // Set the default providers ( you can add more provider via {provider_id}_apiurl = $api_url |
91 | | - 'commons_apiurl' : 'http://commons.wikimedia.org/w/api.php' |
92 | | -}; |
93 | | - |
94 | | -/** |
95 | 35 | * The global mw object: |
96 | 36 | * |
97 | 37 | * Any global functions/classes that are not jQuery plugins should make |
— | — | @@ -102,7 +42,7 @@ |
103 | 43 | mw.valid_skins = [ 'mvpcf', 'kskin' ]; |
104 | 44 | |
105 | 45 | // The version of mwEmbed |
106 | | - mw.version = '1.1'; |
| 46 | + mw.version = MW_EMBED_VERSION |
107 | 47 | |
108 | 48 | /** |
109 | 49 | * Configuration System: |
— | — | @@ -119,22 +59,45 @@ |
120 | 60 | //Local scope mwUserConfig var. Stores user configuration |
121 | 61 | var mwUserConfig = { }; |
122 | 62 | |
123 | | - for( var i in mwDefaultConf ){ |
124 | | - if( typeof mwConfig[ i ] == 'undefined' ) |
125 | | - mwConfig[ i ] = mwDefaultConf[ i ]; |
126 | | - } |
127 | | - |
128 | 63 | /** |
129 | 64 | * Setter for configuration values |
130 | 65 | * |
131 | | - * @param {String} name Name of configuration value |
| 66 | + * @param [Mixed] name Name of configuration value |
| 67 | + * {Object} Will iderate through each key and call setConfig |
| 68 | + * {String} Will set configuration by string name to value |
132 | 69 | * @param {String} value Value of configuration name |
133 | 70 | */ |
134 | | - mw.setConfig = function ( name, value ){ |
| 71 | + mw.setConfig = function ( name, value ) { |
| 72 | + if( typeof name == 'object' ){ |
| 73 | + for( var i in name ){ |
| 74 | + mw.setConfig( i, name[ i ] ); |
| 75 | + } |
| 76 | + } |
135 | 77 | mwConfig[ name ] = value; |
136 | 78 | } |
137 | 79 | |
138 | 80 | /** |
| 81 | + * Set a default config value |
| 82 | + * Will only update configuration if no value is present |
| 83 | + * @param [Mixed] name |
| 84 | + * {Object} Will iderate through each key and call setDefaultConfig |
| 85 | + * {String} Will set configuration by string name to value |
| 86 | + * @param [Mixed] value Set configuration name to value |
| 87 | + */ |
| 88 | + mw.setDefaultConfig = function( name, value ) { |
| 89 | + if( typeof name == 'object' ){ |
| 90 | + for( var i in name ){ |
| 91 | + mw.setDefaultConfig( i, name[ i ] ); |
| 92 | + } |
| 93 | + return ; |
| 94 | + } |
| 95 | + // Name is a string update the config directly |
| 96 | + if( ! mwConfig[ name ] ){ |
| 97 | + mwConfig[ name ] = value; |
| 98 | + } |
| 99 | + } |
| 100 | + |
| 101 | + /** |
139 | 102 | * Getter for configuration values |
140 | 103 | * |
141 | 104 | * @param {String} name of configuration value to get |
— | — | @@ -277,11 +240,11 @@ |
278 | 241 | * Swap in an array of values for $1, $2, $n for a given msg key |
279 | 242 | * |
280 | 243 | * @param string msgKey The msg key to lookup |
281 | | - * @param [mixed] args An array of string or jquery objects to be swaped in |
| 244 | + * @param [mixed] args An array of string or jquery objects to be swapped in |
282 | 245 | * @return string |
283 | 246 | */ |
284 | 247 | mw.lang.msgReplaceArgs = function( message , args ) { |
285 | | - // replace values |
| 248 | + // Replace Values |
286 | 249 | if ( typeof args == 'object' || typeof args == 'array' ) { |
287 | 250 | for ( var v =0; v < args.length; v++ ) { |
288 | 251 | if( typeof args[v] == 'undefined' ){ |
— | — | @@ -523,9 +486,11 @@ |
524 | 487 | size = Math.round( size * p ) / p; |
525 | 488 | return gM( msg , size ); |
526 | 489 | }; |
| 490 | + |
527 | 491 | /** |
528 | 492 | * Format a number |
529 | 493 | * @param {Number} num Number to be formated |
| 494 | + * NOTE: add il8n support to includes/lanuages/class/Language{langCode}.js |
530 | 495 | */ |
531 | 496 | mw.lang.formatNumber = function( num ) { |
532 | 497 | /* |
— | — | @@ -569,9 +534,10 @@ |
570 | 535 | // invalidate the output (will force a re-parse ) |
571 | 536 | this.pOut = ''; |
572 | 537 | }, |
| 538 | + |
573 | 539 | /** |
574 | 540 | * Quickly recursive / parse out templates: |
575 | | - * This parser only really only tested against msg templates see tests/testLang.html |
| 541 | + * This parser is only tested against msg templates see tests/testLang.html |
576 | 542 | */ |
577 | 543 | parse : function() { |
578 | 544 | function rdpp ( txt , cn ) { |
— | — | @@ -594,7 +560,7 @@ |
595 | 561 | } |
596 | 562 | if ( !node['t'] ) |
597 | 563 | node['t'] = ''; |
598 | | - // don't put closures into output: |
| 564 | + // Don't put }} closures into output: |
599 | 565 | if ( txt[a] && txt[a] != '}' ) |
600 | 566 | node['t'] += txt[a]; |
601 | 567 | |
— | — | @@ -692,12 +658,14 @@ |
693 | 659 | return getMagicTxtFromTempNode( node ); |
694 | 660 | } |
695 | 661 | } |
696 | | - // parse out the template node structure: |
| 662 | + |
| 663 | + // Parse out the template node structure: |
697 | 664 | this.pNode = rdpp ( this.wikiText ); |
698 | | - // strip out the parent from the root |
| 665 | + |
| 666 | + // Strip out the parent from the root |
699 | 667 | this.pNode['p'] = null; |
700 | 668 | |
701 | | - // do the recursive magic swap text: |
| 669 | + // Do the recursive magic swap text: |
702 | 670 | this.pOut = recurse_magic_swap( this.pNode ); |
703 | 671 | }, |
704 | 672 | |
— | — | @@ -835,7 +803,7 @@ |
836 | 804 | } |
837 | 805 | |
838 | 806 | /** |
839 | | - * Runs all the hooks by a given name with refrence to the host object |
| 807 | + * Runs all the hooks by a given name with reference to the host object |
840 | 808 | * |
841 | 809 | * Should be called by the host object at named execution points |
842 | 810 | * |
— | — | @@ -935,7 +903,7 @@ |
936 | 904 | typeof ( this.moduleLoaders[ loadRequest ] ) == 'function' |
937 | 905 | ){ |
938 | 906 | mw.log("mw.load: loadModule:" + loadRequest ); |
939 | | - //Run the module with the parent callback |
| 907 | + // Run the module with the parent callback |
940 | 908 | this.moduleLoaders[ loadRequest ]( callback ); |
941 | 909 | return ; |
942 | 910 | } |
— | — | @@ -995,8 +963,9 @@ |
996 | 964 | loadStates[ loadName ] = 0; |
997 | 965 | } |
998 | 966 | } |
| 967 | + |
999 | 968 | // We are infact loading many: |
1000 | | - mw.log("mw.load: LoadMany:: " + loadSet ); |
| 969 | + mw.log("mw.load: LoadMany:: " + loadSet ); |
1001 | 970 | |
1002 | 971 | // Issue the load request check check loadStates to see if we are "done" |
1003 | 972 | for( var loadName in loadStates ){ |
— | — | @@ -1280,7 +1249,7 @@ |
1281 | 1250 | callback( requestName ) |
1282 | 1251 | } |
1283 | 1252 | // Add it to the function queue |
1284 | | - if( ! mwLoadDoneCB[ requestName ] ){ |
| 1253 | + if( ! mwLoadDoneCB[ requestName ] || mwLoadDoneCB[ requestName ].length ){ |
1285 | 1254 | mwLoadDoneCB[ requestName ] = []; |
1286 | 1255 | } |
1287 | 1256 | mwLoadDoneCB[ requestName ].push( callback ); |
— | — | @@ -1332,11 +1301,11 @@ |
1333 | 1302 | |
1334 | 1303 | /** |
1335 | 1304 | * |
1336 | | - * Shortcut to latest revision text of a given title |
| 1305 | + * Shortcut to latest revision text for a given title |
1337 | 1306 | * |
1338 | 1307 | * Assumes "follow redirects" |
1339 | 1308 | * |
1340 | | - * $j.getTitleText( [url], title, callback ) |
| 1309 | + * $j.getTitleText( [apiUrl], title, callback ) |
1341 | 1310 | * |
1342 | 1311 | * @param {String} url or title key |
1343 | 1312 | * @parma {Mixed} title or callback function |
— | — | @@ -1970,7 +1939,7 @@ |
1971 | 1940 | // Check for scriptLoader include of mwEmbed: |
1972 | 1941 | if ( src.indexOf( 'mwScriptLoader.php' ) !== -1 ) { |
1973 | 1942 | // Script loader is in the root of MediaWiki, Include the default mwEmbed extension path: |
1974 | | - mwpath = src.substr( 0, src.indexOf( 'mwScriptLoader.php' ) ) + mw.getConfig( 'mediaWiki_mwEmbedPath' ); |
| 1943 | + mwpath = src.substr( 0, src.indexOf( 'mwScriptLoader.php' ) ) + mw.getConfig( 'mediaWikiEmbedPath' ); |
1975 | 1944 | } |
1976 | 1945 | |
1977 | 1946 | // Script-loader has jsScriptLoader name when local: |
— | — | @@ -2415,12 +2384,15 @@ |
2416 | 2385 | mw.log( 'doLoaderCheck::' ); |
2417 | 2386 | // Check if we are using scriptloader ( handles loader include automatically ) |
2418 | 2387 | if( mw.getScriptLoaderPath() ){ |
2419 | | - callback(); |
| 2388 | + // Do a async call to callback in cases where DOM is ready before we get to |
| 2389 | + // loader config code in the same file. |
| 2390 | + setTimeout(function(){ |
| 2391 | + callback(); |
| 2392 | + }, 1000); |
2420 | 2393 | return ; |
2421 | 2394 | } |
2422 | 2395 | // Add the Core loader to the request |
2423 | | - mw.load( 'loader.js', function(){ |
2424 | | - |
| 2396 | + mw.load( 'loader.js', function(){ |
2425 | 2397 | // Load all the "loaders" of the enabled modules: |
2426 | 2398 | var loaderRequest = []; |
2427 | 2399 | var enabledModules = mw.getConfig( 'enabledModules' ); |
— | — | @@ -2439,6 +2411,9 @@ |
2440 | 2412 | |
2441 | 2413 | mw.setConfig('loaderContext', '' ); |
2442 | 2414 | mw.load( loaderRequest, function(){ |
| 2415 | + mw.log( 'Done moduleLoaderCheck request' ); |
| 2416 | + // Set the mwModuleLoaderCheckFlag flag to true |
| 2417 | + mwModuleLoaderCheckFlag = true; |
2443 | 2418 | callback(); |
2444 | 2419 | } ); |
2445 | 2420 | } ); |
— | — | @@ -2484,7 +2459,10 @@ |
2485 | 2460 | // Flag to register the domReady has been called |
2486 | 2461 | var mwDomReadyFlag = false; |
2487 | 2462 | |
2488 | | - // Functions to run on DOM ready |
| 2463 | + // Flag to register if the domreadyHooks have been called |
| 2464 | + var mwModuleLoaderCheckFlag = false; |
| 2465 | + |
| 2466 | + // Functions to run on DOM ready |
2489 | 2467 | var mwOnDOMReadyFunctions = []; |
2490 | 2468 | |
2491 | 2469 | /** |
— | — | @@ -2496,12 +2474,13 @@ |
2497 | 2475 | * |
2498 | 2476 | * @param {Function} callback Function to be called at dom ready |
2499 | 2477 | */ |
2500 | | - mw.addDOMReadyHook = function( callback ) { |
2501 | | - //mw.log( 'addDOMReadyHook::' ); |
2502 | | - if ( ! mwDomReadyFlag ) { |
2503 | | - mwOnDOMReadyFunctions.push( callback ); |
2504 | | - } else { |
| 2478 | + mw.addDOMReadyHook = function( callback ) { |
| 2479 | + if ( mwModuleLoaderCheckFlag ) { |
| 2480 | + mw.log( "Possible Error: calling mw.addDOMReadyHook after moduleLoader check" ); |
2505 | 2481 | callback ( ); |
| 2482 | + } else { |
| 2483 | + // Add the dom ready check to the function queue: |
| 2484 | + mwOnDOMReadyFunctions.push( callback ); |
2506 | 2485 | } |
2507 | 2486 | } |
2508 | 2487 | |
— | — | @@ -2510,22 +2489,22 @@ |
2511 | 2490 | * Will check configuration and issue a mw.setupMwEmbed call if needed |
2512 | 2491 | */ |
2513 | 2492 | mw.domReady = function ( ) { |
2514 | | - if( mwDomReadyFlag ) |
2515 | | - return ; |
2516 | | - mw.log( 'run:domReady' ); |
| 2493 | + if( mwDomReadyFlag ){ |
| 2494 | + return ; |
| 2495 | + } |
| 2496 | + mw.log( 'run:domReady:: ' + document.getElementsByTagName('video').length ); |
2517 | 2497 | // Set the onDomReady Flag |
2518 | 2498 | mwDomReadyFlag = true; |
2519 | 2499 | |
2520 | 2500 | // Make sure we have all the module loader.js files included |
2521 | 2501 | // ( where we are not using the script-loader ) |
2522 | | - mw.moduleLoaderCheck( function( ) { |
2523 | | - |
| 2502 | + mw.moduleLoaderCheck( function( ) { |
| 2503 | + |
2524 | 2504 | // Run dom ready hooks: |
2525 | 2505 | while( mwOnDOMReadyFunctions.length ) { |
2526 | 2506 | mwOnDOMReadyFunctions.pop()(); |
2527 | 2507 | } |
2528 | | - |
2529 | | - |
| 2508 | + |
2530 | 2509 | // Check for the force setup flag: |
2531 | 2510 | if ( mw.getConfig( 'runSetupMwEmbed' ) ) { |
2532 | 2511 | mw.setupMwEmbed(); |
— | — | @@ -2742,10 +2721,11 @@ |
2743 | 2722 | window.onload = i; |
2744 | 2723 | } |
2745 | 2724 | })( domReadyCheck ); |
| 2725 | + |
2746 | 2726 | // As a backup check if "body" is not null ( for dynamic inserts ) |
2747 | 2727 | // ( mw.domReady ignores multiple ready calls ) |
2748 | 2728 | var mwCheckBody = function( ) { |
2749 | | - if( document.getElementsByTagName('body')[0] ){ |
| 2729 | + if( document.getElementsByTagName( 'body' )[0] ){ |
2750 | 2730 | mw.domReady(); |
2751 | 2731 | }else{ |
2752 | 2732 | setTimeout( function( ) { |
— | — | @@ -2753,6 +2733,10 @@ |
2754 | 2734 | }, 25); |
2755 | 2735 | } |
2756 | 2736 | } |
2757 | | -mwCheckBody(); |
| 2737 | +// Call with substatial timeout of 250ms |
| 2738 | +// ( This is just fallback method for |
| 2739 | +// dynamic inserts of mwEmbed ( rare ) ) |
| 2740 | +setTimeout( function( ) { |
| 2741 | + mwCheckBody(); |
| 2742 | +}, 250); |
2758 | 2743 | |
2759 | | - |