Index: branches/js2-work/phase3/js/editPage.js |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | mw.log( 'Added via wikiEditor bind' ); |
44 | 44 | // Display a loader ( since its triggered onClick ) |
45 | 45 | mw.addLoaderDialog( gM( 'mwe-loading-add-media-wiz' ) ); |
46 | | - mw.load( 'AddMedia.addMediaWizard', function(){ |
| 46 | + mw.load( 'AddMedia.addMediaWizard', function() { |
47 | 47 | mw.closeLoaderDialog(); |
48 | 48 | $j.addMediaWizard( amwConf ); |
49 | 49 | }); |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 | mw.getConfig( 'images_path' ) + 'Button_add_media.png">' ); |
63 | 63 | |
64 | 64 | $j( '#btn-add-media-wiz' ).attr( 'title', gM( 'mwe-loading-add-media-wiz' ) ); |
65 | | - mw.load( 'AddMedia.addMediaWizard', function(){ |
| 65 | + mw.load( 'AddMedia.addMediaWizard', function() { |
66 | 66 | $j( '#btn-add-media-wiz' ).addMediaWizard( |
67 | 67 | amwConf |
68 | 68 | ); |
— | — | @@ -71,9 +71,12 @@ |
72 | 72 | // Make sure the wikieditor got binded: |
73 | 73 | if ( !didWikiEditorBind ) { |
74 | 74 | mw.log( 'Failed to bind via build section bind via target:' ); |
75 | | - $j( ".tool[rel='file']" ).attr( 'title', gM( 'mwe-loading-add-media-wiz' ) ); |
76 | | - mw.load( 'AddMedia.addMediaWizard', function(){ |
77 | | - if( $j( ".tool[rel='file']" ).size() != 0 ){ |
| 75 | + |
| 76 | + $j( ".tool[rel='file']" ) |
| 77 | + .attr( 'title', gM( 'mwe-loading-add-media-wiz' ) ); |
| 78 | + |
| 79 | + mw.load( 'AddMedia.addMediaWizard', function() { |
| 80 | + if( $j( ".tool[rel='file']" ).size() != 0 ) { |
78 | 81 | $j( ".tool[rel='file']" ).unbind().addMediaWizard( amwConf ); |
79 | 82 | } |
80 | 83 | }); |
Index: branches/js2-work/phase3/js/mwEmbed/tests/Player_Audio.html |
— | — | @@ -2,7 +2,8 @@ |
3 | 3 | <html> |
4 | 4 | <head> |
5 | 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
6 | | - <script type="text/javascript" src="../mwEmbed.js?debug=true"></script> |
| 6 | + <!-- <script type="text/javascript" src="../mwEmbed.js?debug=true"></script> --> |
| 7 | + <script type="text/javascript" src="../jsScriptLoader.php?class=mwEmbed&debug=true"></script> |
7 | 8 | <title>Audio Player sample</title> |
8 | 9 | </head> |
9 | 10 | <body> |
Index: branches/js2-work/phase3/js/mwEmbed/tests/Player_Themable.html |
— | — | @@ -4,15 +4,15 @@ |
5 | 5 | <head> |
6 | 6 | <title> Sample Themed Player </title> |
7 | 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 | | - |
| 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> |
10 | 9 | <script type="text/javascript" src="../jsScriptLoader.php?debug=true&class=mwEmbed"></script> |
11 | 10 | <link rel="stylesheet" href="../skins/styles.css" type="text/css" media="screen" /> |
12 | 11 | <link rel="stylesheet" href="../skins/mvpcf/EmbedPlayer.css" type="text/css" media="screen" /> |
13 | | - <link rel="stylesheet" href="../skins/kskin/EmbedPlayer.css" type="text/css" media="screen" /> |
| 12 | + <link rel="stylesheet" href="../skins/kskin/EmbedPlayer.css" type="text/css" media="screen" /> |
14 | 13 | |
15 | | - --> |
16 | | - <script type="text/javascript" src="../mwEmbed.js?debug=true"></script> |
| 14 | + <script type="text/javascript" src="../mwEmbed.js?debug=true"></script> |
| 15 | + --> |
| 16 | + <script type="text/javascript" src="../jsScriptLoader.php?debug=true&class=mwEmbed"></script> |
17 | 17 | |
18 | 18 | |
19 | 19 | </head> |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | To play with dynamic Themes install <a href="http://jqueryui.com/themeroller/developertool/">Themeroller</a><p><p> |
25 | 25 | |
26 | 26 | <div style="width:450px;float:left"> |
27 | | -<video |
| 27 | +<video |
28 | 28 | style="width:400px;height:300px" |
29 | 29 | src="http://localhost/lucky.ogv" |
30 | 30 | poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" |
— | — | @@ -32,7 +32,7 @@ |
33 | 33 | durationHint="60" > |
34 | 34 | </video> |
35 | 35 | |
36 | | - |
| 36 | +<!-- |
37 | 37 | <video |
38 | 38 | style="width:208px;height:160px;float:left" |
39 | 39 | src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg" |
— | — | @@ -41,6 +41,7 @@ |
42 | 42 | poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" |
43 | 43 | durationHint="60"> |
44 | 44 | </video> |
| 45 | + |
45 | 46 | <b>Source Code used:</b><br> |
46 | 47 | <textarea cols="50" rows="7"><video 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" |
47 | 48 | src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg"></video></textarea> |
— | — | @@ -69,7 +70,7 @@ |
70 | 71 | <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" |
71 | 72 | src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg"></video></textarea> |
72 | 73 | </div> |
73 | | - |
| 74 | + --> |
74 | 75 | |
75 | 76 | </body> |
76 | 77 | </html> |
Index: branches/js2-work/phase3/js/mwEmbed/includes/languages/classes/LanguageLt.js |
— | — | @@ -13,13 +13,13 @@ |
14 | 14 | |
15 | 15 | |
16 | 16 | //if no number with word, then use $form[0] for singular and $form[1] for plural or zero |
17 | | - if( forms.length == 2 ){ |
| 17 | + if( forms.length == 2 ) { |
18 | 18 | return count == 1 ? forms[0] : forms[1]; |
19 | 19 | } |
20 | 20 | |
21 | 21 | forms = mw.lang.preConvertPlural( forms, 3 ); |
22 | 22 | mw.log( 'Count: ' + count + ' mod 10: ' + (count % 10 ) + ' mod 100: ' + (count % 100) ); |
23 | | - if (count % 10 == 1 && count % 100 != 11 ){ |
| 23 | + if (count % 10 == 1 && count % 100 != 11 ) { |
24 | 24 | mw.log('return form 0 for count:' + count ); |
25 | 25 | return forms[0]; |
26 | 26 | } |
Index: branches/js2-work/phase3/js/mwEmbed/skins/ctrlBuilder.js |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | return this.init( embedPlayer, options ); |
12 | 12 | }; |
13 | 13 | |
14 | | -/* |
| 14 | +/** |
15 | 15 | * controlsBuilder prototype: |
16 | 16 | */ |
17 | 17 | ctrlBuilder.prototype = { |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | playerClass : 'mv-player', |
22 | 22 | |
23 | 23 | // Long string display of time value |
24 | | - long_time_disp: true, |
| 24 | + longTimeDisp: true, |
25 | 25 | |
26 | 26 | // If the options menu outside of player |
27 | 27 | external_options : true, |
— | — | @@ -35,12 +35,20 @@ |
36 | 36 | supportedComponets: { |
37 | 37 | |
38 | 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 | | - }, |
| 39 | + 'options': true |
| 40 | + }, |
| 41 | + |
| 42 | + // Default supported menu items is merged with skin menu items |
| 43 | + supportedMenuItems: { |
| 44 | + 'playerSelect' : true, |
| 45 | + |
| 46 | + // Download the file menu |
| 47 | + 'download' : true, |
| 48 | + |
| 49 | + // Share the video menu |
| 50 | + 'share' : true |
| 51 | + }, |
| 52 | + |
45 | 53 | /** |
46 | 54 | * Initialization Object for the control builder |
47 | 55 | * |
— | — | @@ -51,9 +59,9 @@ |
52 | 60 | this.embedPlayer = embedPlayer; |
53 | 61 | |
54 | 62 | // Check for skin overrides for ctrlBuilder |
55 | | - if ( window[ embedPlayer.skinName + 'Config'] ) { |
| 63 | + if ( window[ embedPlayer.skinName + 'Config' ] ) { |
56 | 64 | |
57 | | - // Clone as to not override prototype: |
| 65 | + // Clone as to not override prototype with the skin config |
58 | 66 | var _this = $j.extend( true, { }, this, window[ embedPlayer.skinName + 'Config'] ); |
59 | 67 | |
60 | 68 | return _this; |
— | — | @@ -85,8 +93,10 @@ |
86 | 94 | .addClass( 'ui-state-default ui-widget-header ui-helper-clearfix control-bar' ) |
87 | 95 | .css('display', 'block') |
88 | 96 | ); |
| 97 | + |
89 | 98 | //Add the Controls with their bindings |
90 | 99 | this.addControlComponents(); |
| 100 | + |
91 | 101 | // Add hooks once Controls are in DOM |
92 | 102 | this.addControlHooks(); |
93 | 103 | }, |
— | — | @@ -96,8 +106,9 @@ |
97 | 107 | * @returns the interface html string |
98 | 108 | */ |
99 | 109 | addControlComponents: function( ) { |
100 | | - var _this = this; |
| 110 | + var _this = this; |
101 | 111 | mw.log( 'f:controlsBuilder:: opt:' + this.options ); |
| 112 | + |
102 | 113 | // Set up local pointer to the embedPlayer |
103 | 114 | var embedPlayer = this.embedPlayer; |
104 | 115 | |
— | — | @@ -108,26 +119,24 @@ |
109 | 120 | |
110 | 121 | // Make pointer to the embedPlayer |
111 | 122 | this.embedPlayer = embedPlayer; |
| 123 | + |
| 124 | + // Build the supportedComponets list |
| 125 | + this.supportedComponets = $j.extend( this.supportedComponets, embedPlayer.supports ); |
112 | 126 | |
113 | | - var _this = this; |
114 | | - this.supportedComponets = $j.extend(this.supportedComponets, embedPlayer.supports); |
115 | | - |
116 | 127 | // Check for timed text support: |
117 | 128 | if( embedPlayer.isTimedTextSupported() ){ |
118 | | - this.supportedComponets['timed_text'] = true; |
| 129 | + this.supportedComponets['timedText'] = true; |
| 130 | + } |
| 131 | + // Check for kalturaAttribution |
| 132 | + if( mw.getConfig( 'kalturaAttribution' ) ){ |
| 133 | + this.supportedComponets[ 'kalturaAttribution' ] = true; |
119 | 134 | } |
120 | | - |
121 | | - // Append options to body (if not already there) |
122 | | - if ( this.external_options && $j( '#mv_vid_options_' + this.id ).length == 0 ){ |
123 | | - $j( 'body' ).append( this.getComponent( 'optionsMenu' ) ); |
124 | | - } |
125 | 135 | |
126 | | - |
127 | | - |
128 | | - // Build component output: |
| 136 | + |
| 137 | + // Output components |
129 | 138 | for ( var component_id in this.components ) { |
130 | 139 | |
131 | | - // Check for explit skip (component === false ) |
| 140 | + // Check for (component === false ) and skip |
132 | 141 | if( this.components[ component_id ] === false ){ |
133 | 142 | continue; |
134 | 143 | } |
— | — | @@ -135,12 +144,7 @@ |
136 | 145 | // Special case with playhead skip if we have > 30px of space for it |
137 | 146 | if ( component_id == 'playHead' && this.available_width < 30 ){ |
138 | 147 | continue; |
139 | | - } |
140 | | - |
141 | | - // Special case of kalturaAttribution skip if set in configuration |
142 | | - if( component_id == 'kalturaAttribution' && mw.getConfig( 'kalturaAttribution' ) == false ){ |
143 | | - continue; |
144 | | - } |
| 148 | + } |
145 | 149 | |
146 | 150 | // Make sure the given components is supported: |
147 | 151 | if ( this.supportedComponets[ component_id ] ) { |
— | — | @@ -195,87 +199,15 @@ |
196 | 200 | if ( _this.checkNativeWarning( ) ) { |
197 | 201 | _this.doNativeWarning(); |
198 | 202 | } |
199 | | - |
| 203 | + // Do png fix for ie6 |
200 | 204 | if ( $j.browser.msie && $j.browser.version <= 6 ) { |
201 | 205 | $j('#' + embedPlayer.id + ' .play-btn-large' ).pngFix(); |
202 | | - } |
203 | | - |
204 | | - |
205 | | - // Captions binding: |
206 | | - $target.find( '.timed-text' ).unbind().buttonHover().click( function() { |
207 | | - embedPlayer.showTextInterface(); |
208 | | - } ); |
209 | | - |
210 | | - // Options binding: |
211 | | - $target.find( '.options-btn' ).unbind().buttonHover().click( function() { |
212 | | - embedPlayer.doOptionsHTML(); |
213 | | - } ); |
214 | | - |
215 | | - // Fullscreen binding: |
216 | | - $target.find( '.fullscreen-btn' ).unbind().buttonHover().click( function() { |
217 | | - embedPlayer.fullscreen(); |
218 | | - } ); |
219 | | - |
220 | | - // Playhead binding |
221 | | - mw.log( " should add slider binding: " + $target.find( '.play_head' ).length ); |
222 | | - $target.find( '.play_head' ).slider( { |
223 | | - range: "min", |
224 | | - value: 0, |
225 | | - min: 0, |
226 | | - max: 1000, |
227 | | - start: function( event, ui ) { |
228 | | - var id = ( embedPlayer.pc != null ) ? embedPlayer.pc.pp.id:embedPlayer.id; |
229 | | - embedPlayer.userSlide = true; |
230 | | - $j( id + ' .play-btn-large' ).fadeOut( 'fast' ); |
231 | | - // If playlist always start at 0 |
232 | | - embedPlayer.start_time_sec = ( embedPlayer.instanceOf == 'mvPlayList' ) ? 0: |
233 | | - mw.npt2seconds( embedPlayer.getTimeRange().split( '/' )[0] ); |
234 | | - }, |
235 | | - slide: function( event, ui ) { |
236 | | - var perc = ui.value / 1000; |
237 | | - embedPlayer.jump_time = mw.seconds2npt( parseFloat( parseFloat( embedPlayer.getDuration() ) * perc ) + embedPlayer.start_time_sec ); |
238 | | - // mw.log('perc:' + perc + ' * ' + embedPlayer.getDuration() + ' jt:'+ this.jump_time); |
239 | | - if ( _this.long_time_disp ) { |
240 | | - embedPlayer.setStatus( gM( 'mwe-seek_to', embedPlayer.jump_time ) ); |
241 | | - } else { |
242 | | - embedPlayer.setStatus( embedPlayer.jump_time ); |
243 | | - } |
244 | | - // Update the thumbnail / frame |
245 | | - if ( embedPlayer.isPlaying == false ) { |
246 | | - embedPlayer.updateThumbPerc( perc ); |
247 | | - } |
248 | | - }, |
249 | | - change:function( event, ui ) { |
250 | | - // Only run the onChange event if done by a user slide |
251 | | - // (otherwise it runs times it should not) |
252 | | - if ( embedPlayer.userSlide ) { |
253 | | - embedPlayer.userSlide = false; |
254 | | - embedPlayer.seeking = true; |
255 | | - // Stop the monitor timer (if we can) |
256 | | - embedPlayer.stopMonitor(); |
257 | | - |
258 | | - var perc = ui.value / 1000; |
259 | | - // set seek time (in case we have to do a url seek) |
260 | | - embedPlayer.seek_time_sec = mw.npt2seconds( embedPlayer.jump_time, true ); |
261 | | - mw.log( 'do jump to: ' + embedPlayer.jump_time + ' perc:' + perc + ' sts:' + embedPlayer.seek_time_sec ); |
262 | | - embedPlayer.setStatus( gM( 'mwe-seeking' ) ); |
263 | | - embedPlayer.doSeek( perc ); |
264 | | - } |
265 | | - } |
266 | | - } ); |
267 | | - |
268 | | - // Up the z-index of the default status indicator: |
269 | | - $target.find( '.play_head .ui-slider-handle' ).css( 'z-index', 4 ); |
270 | | - $target.find( '.play_head .ui-slider-range' ).addClass( 'ui-corner-all' ).css( 'z-index', 2 ); |
271 | | - |
272 | | - // Extended class list for jQuery ui themeing |
273 | | - //(we can probably refactor this with custom buffering highlighter) |
274 | | - $target.find( '.play_head' ).append( this.getBufferHtml() ); |
| 206 | + } |
275 | 207 | |
276 | | - var $opt = $j( '#mv_vid_options_' + embedPlayer.id ); |
| 208 | + //var $opt = $j( '#mv_vid_options_' + embedPlayer.id ); |
277 | 209 | |
278 | 210 | // videoOptions ... @@todo should be merged with something more like kskin.js: |
279 | | - $opt.find( '.vo_selection' ).click( function() { |
| 211 | + /*$opt.find( '.vo_selection' ).click( function() { |
280 | 212 | embedPlayer.displayOverlay(); |
281 | 213 | embedPlayer.showPlayerSelect( embedPlayer.$interface.find( '.videoOptionsComplete' ) ); |
282 | 214 | $opt.hide(); |
— | — | @@ -295,6 +227,7 @@ |
296 | 228 | $opt.hide(); |
297 | 229 | return false; |
298 | 230 | } ); |
| 231 | + */ |
299 | 232 | |
300 | 233 | this.doVolumeBinding(); |
301 | 234 | |
— | — | @@ -303,6 +236,10 @@ |
304 | 237 | this.addSkinControlBindings(); |
305 | 238 | } |
306 | 239 | }, |
| 240 | + |
| 241 | + /** |
| 242 | + * Close a menu overlay |
| 243 | + */ |
307 | 244 | closeMenuOverlay: function(){ |
308 | 245 | var _this = this; |
309 | 246 | var $overlay = $j( '#blackbg_' + this.embedPlayer.id ); |
— | — | @@ -433,7 +370,7 @@ |
434 | 371 | var embedPlayer = this.embedPlayer; |
435 | 372 | var _this = this; |
436 | 373 | embedPlayer.$interface.find( '.volume_control' ).unbind().buttonHover().click( function() { |
437 | | - mw.log( 'clicked volume control' ); |
| 374 | + mw.log( 'Volume control toggle' ); |
438 | 375 | embedPlayer.toggleMute(); |
439 | 376 | } ); |
440 | 377 | |
— | — | @@ -493,16 +430,354 @@ |
494 | 431 | embedPlayer.$interface.find( '.volume-slider' ).slider( sliderConf ); |
495 | 432 | }, |
496 | 433 | |
| 434 | + /** |
| 435 | + * Get the options menu ul with li menu items |
| 436 | + */ |
| 437 | + getOptionsMenu: function( ) { |
| 438 | + $optionsMenu = $j( '<ul />' ); |
| 439 | + for( var i in this.optionMenuItems ){ |
| 440 | + |
| 441 | + // Make sure its supported in the current ctrlBuilder config: |
| 442 | + if( ! this.supportedMenuItems[ i ] ) { |
| 443 | + continue; |
| 444 | + } |
| 445 | + $optionsMenu.append( |
| 446 | + this.optionMenuItems[i]( this ) |
| 447 | + ); |
| 448 | + } |
| 449 | + return $optionsMenu; |
| 450 | + }, |
| 451 | + |
| 452 | + /** |
| 453 | + * Option menu items |
| 454 | + * |
| 455 | + * @return |
| 456 | + * 'li' a li line item with click action for that menu item |
| 457 | + */ |
| 458 | + optionMenuItems: { |
| 459 | + // Player select menu item |
| 460 | + 'playerSelect': function( ctrlObj ){ |
| 461 | + return $j.getLineItem( |
| 462 | + gM( 'mwe-chose_player' ), |
| 463 | + 'gear', |
| 464 | + function( ) { |
| 465 | + ctrObj.displayOverlay( |
| 466 | + ctrlObj.getPlayerSelect() |
| 467 | + ); |
| 468 | + } |
| 469 | + ) |
| 470 | + }, |
| 471 | + |
| 472 | + // Download the file menu |
| 473 | + 'download': function( ctrlObj ) { |
| 474 | + return $j.getLineItem( |
| 475 | + gM( 'mwe-download' ), |
| 476 | + 'disk', |
| 477 | + function( ) { |
| 478 | + ctrObj.displayOverlay( gM('loading' ) ); |
| 479 | + ctrlObj.showDownload( $j( ctrlObj.embedPlayer ).find( '.overlay-content' ) ); |
| 480 | + } |
| 481 | + ) |
| 482 | + }, |
| 483 | + |
| 484 | + // Share the video menu |
| 485 | + 'share': function( ctrlObj ) { |
| 486 | + return $j.getLineItem( |
| 487 | + gM( 'mwe-share' ), |
| 488 | + 'mail-closed', |
| 489 | + function( ) { |
| 490 | + ctrlObj.showShare(); |
| 491 | + } |
| 492 | + ) |
| 493 | + } |
| 494 | + }, |
| 495 | + |
497 | 496 | /** |
498 | | - * Get the Buffer Html that overlays the playhead |
| 497 | + * Generic function to display custom HTML overlay |
| 498 | + * on video. |
| 499 | + * |
| 500 | + * @param {String} overlayContent content to be displayed |
499 | 501 | */ |
500 | | - getBufferHtml:function() { |
501 | | - return '<div class="ui-slider-range ui-slider-range-min ui-widget-header ' + |
502 | | - 'ui-state-highlight ui-corner-all ' + |
503 | | - 'mw_buffer" style="width:0px;height:100%;z-index:1;top:0px" />'; |
| 502 | + displayOverlay: function( overlayContent ) { |
| 503 | + var _this = this; |
| 504 | + var embedPlayer = this.embedPlayer; |
| 505 | + |
| 506 | + if ( !this.supportedComponets[ 'overlays' ] ) { |
| 507 | + embedPlayer.stop(); |
| 508 | + } |
| 509 | + |
| 510 | + // Fade in if the overlay is not already displayed: |
| 511 | + var fade_in = true; |
| 512 | + if ( $j( '#blackbg_' + this.id ).length != 0 ) { |
| 513 | + fade_in = false; |
| 514 | + $j( '#blackbg_' + this.id ).remove(); |
| 515 | + } |
| 516 | + |
| 517 | + $closeButton = $j('<span />') |
| 518 | + .text( gM('mwe-close_btn') ) |
| 519 | + .css({ |
| 520 | + 'float' : 'right', |
| 521 | + 'color' : '#FFF', |
| 522 | + 'cursor' : 'pointer', |
| 523 | + 'background' : '#111', |
| 524 | + 'margin-right': '10px', |
| 525 | + 'text-decoration' : 'underline' |
| 526 | + }) |
| 527 | + .click(function() { |
| 528 | + _this.ctrlBuilder.closeMenuOverlay(); |
| 529 | + }) |
| 530 | + |
| 531 | + |
| 532 | + $overlayMenu = $j('<div />') |
| 533 | + .attr({ |
| 534 | + 'id' : 'blackbg_' + this.id |
| 535 | + }) |
| 536 | + .addClass( 'videoComplete' ) |
| 537 | + .css({ |
| 538 | + 'height' : this.ctrlBuilder.getOverlayHeight(), |
| 539 | + 'width' : this.ctrlBuilder.getOverlayWidth() |
| 540 | + }) |
| 541 | + .append( |
| 542 | + $closeButton, |
| 543 | + $j('<div />') |
| 544 | + .addClass( 'overlay-content' ) |
| 545 | + .append( $overlayContent ) |
| 546 | + ) |
| 547 | + this.$interface.prepend( $overlayMenu ); |
| 548 | + |
| 549 | + if ( fade_in ) |
| 550 | + $j( '#blackbg_' + this.id ).fadeIn( "slow" ); |
| 551 | + else |
| 552 | + $j( '#blackbg_' + this.id ).show(); |
| 553 | + return false; // onclick action return false |
| 554 | + }, |
| 555 | + /** |
| 556 | + * Show the "share" msg |
| 557 | + * |
| 558 | + * TODO share should be enabled via <embed> tag usage to be compatible |
| 559 | + * with sites social networking sites that allow <embed> tags but not js |
| 560 | + * |
| 561 | + * @param {Object} $target Target jQuery object to set share html |
| 562 | + */ |
| 563 | + showShare:function( $target ) { |
| 564 | + var embedPlayer = this.embedPlayer; |
| 565 | + var embed_code = embedPlayer.getEmbeddingHTML(); |
| 566 | + var _this = this; |
| 567 | + $target.empty(); |
| 568 | + $shareList = $j( '<ul />' ); |
| 569 | + |
| 570 | + $shareList |
| 571 | + .append( |
| 572 | + $j('<li />') |
| 573 | + .append( |
| 574 | + $j('<a />') |
| 575 | + .attr('href', '#') |
| 576 | + .addClass( 'active' ) |
| 577 | + .text( |
| 578 | + gM( 'mwe-embed_site_or_blog' ) |
| 579 | + ) |
| 580 | + ) |
| 581 | + ) |
| 582 | + |
| 583 | + $target.append( |
| 584 | + $j( '<h2 />' ) |
| 585 | + .text( gM( 'mwe-share_this_video' ) ) |
| 586 | + .append( |
| 587 | + $shareList |
| 588 | + ) |
| 589 | + ); |
| 590 | + |
| 591 | + $target.append( |
| 592 | + $j('<div />') |
| 593 | + .addClass( 'source_wrap' ) |
| 594 | + .html( |
| 595 | + $j( '<textarea />' ) |
| 596 | + .html( embed_code ) |
| 597 | + .click( function() { |
| 598 | + $j( this ).select(); |
| 599 | + }) |
| 600 | + ), |
| 601 | + |
| 602 | + $j('<button />') |
| 603 | + .addClass( 'ui-state-default ui-corner-all copycode' ) |
| 604 | + .text( gM( 'mwe-copy-code' ) ) |
| 605 | + .click(function() { |
| 606 | + $target.find( 'textarea' ).focus().select(); |
| 607 | + // Copy the text if supported: |
| 608 | + if ( document.selection ) { |
| 609 | + CopiedTxt = document.selection.createRange(); |
| 610 | + CopiedTxt.execCommand( "Copy" ); |
| 611 | + } |
| 612 | + } ), |
| 613 | + |
| 614 | + $j('<div />') |
| 615 | + .addClass( "ui-state-highlight ui-corner-all" ) |
| 616 | + .html( |
| 617 | + gM( 'mwe-read_before_embed' ) |
| 618 | + ) |
| 619 | + ); |
504 | 620 | }, |
| 621 | + /** |
| 622 | + * Shows the Player Select interface |
| 623 | + * |
| 624 | + * @param {Object} $target jQuery target for output |
| 625 | + */ |
| 626 | + getPlayerSelect: function( ) { |
| 627 | + mw.log('showPlayerSelect'); |
| 628 | + |
| 629 | + var embedPlayer = this.embedPlayer; |
| 630 | + |
| 631 | + $playerSelect = $j('<div />') |
| 632 | + .append( |
| 633 | + $j( '<h2 />' ) |
| 634 | + .text( gM( 'mwe-chose_player' ) ) |
| 635 | + ); |
| 636 | + |
| 637 | + $j.each( embedPlayer.mediaElement.getPlayableSources(), function( source_id, source ) { |
| 638 | + var playable = mw.EmbedTypes.players.defaultPlayer( source.getMIMEType() ); |
| 639 | + |
| 640 | + var is_selected = ( source == embedPlayer.mediaElement.selected_source ); |
| 641 | + |
| 642 | + $playerSelect.append( |
| 643 | + $j( '<h2 />' ) |
| 644 | + .text( source.getTitle() ) |
| 645 | + ); |
| 646 | + |
| 647 | + if ( playable ) { |
| 648 | + $playerList = $j('<ul />'); |
| 649 | + // output the player select code: |
| 650 | + var supporting_players = mw.EmbedTypes.players.getMIMETypePlayers( source.getMIMEType() ); |
| 651 | + |
| 652 | + for ( var i = 0; i < supporting_players.length ; i++ ) { |
| 653 | + var $playerLink = $j( '<a />') |
| 654 | + .attr({ |
| 655 | + 'href' : '#', |
| 656 | + 'rel' : 'sel_source', |
| 657 | + 'id' : 'sc_' + source_id + '_' + supporting_players[i].id |
| 658 | + }) |
| 659 | + .text( supporting_players[i].getName() ) |
| 660 | + .click( function() { |
| 661 | + var iparts = $j( this ).attr( 'id' ).replace(/sc_/ , '' ).split( '_' ); |
| 662 | + var source_id = iparts[0]; |
| 663 | + var default_player_id = iparts[1]; |
| 664 | + mw.log( 'source id: ' + source_id + ' player id: ' + default_player_id ); |
| 665 | + |
| 666 | + embedPlayer.ctrlBuilder.closeMenuOverlay(); |
| 667 | + embedPlayer.mediaElement.selectSource( source_id ); |
| 668 | + |
| 669 | + mw.EmbedTypes.players.setPlayerPreference( default_player_id, |
| 670 | + _this.mediaElement.sources[ source_id ].getMIMEType() ); |
| 671 | + |
| 672 | + // Issue a stop |
| 673 | + embedPlayer.stop(); |
| 674 | + |
| 675 | + // Don't follow the # link: |
| 676 | + return false; |
| 677 | + } ); |
| 678 | + |
| 679 | + if ( embedPlayer.selected_player.id == supporting_players[i].id && is_selected ) { |
| 680 | + $playerLink |
| 681 | + .addClass('active' ); |
| 682 | + } |
| 683 | + $playerList.append( |
| 684 | + $j( '<li />' ).append( |
| 685 | + $playerLink |
| 686 | + ) |
| 687 | + ); |
| 688 | + } |
| 689 | + |
| 690 | + // Append the player list: |
| 691 | + $playerSelect.append( $playerList ); |
| 692 | + |
| 693 | + } else { |
| 694 | + // No player available: |
| 695 | + $playerSelect.append( gM( 'mwe-no-player', source.getTitle() ) ) |
| 696 | + } |
| 697 | + } ); |
| 698 | + |
| 699 | + // Return the player select elements |
| 700 | + return $playerSelect; |
| 701 | + }, |
505 | 702 | |
506 | 703 | /** |
| 704 | + * Loads sources and calls showDownloadWithSources |
| 705 | + * @param {Object} $target jQuery target to output to |
| 706 | + */ |
| 707 | + showDownload: function( $target ) { |
| 708 | + var _this = this; |
| 709 | + var embedPlayer = this.embedPlayer; |
| 710 | + // Load the roe if available (to populate out download options: |
| 711 | + // mw.log('f:showDownload '+ this.roe + ' ' + this.mediaElement.addedROEData); |
| 712 | + if ( embedPlayer.roe && embedPlayer.mediaElement.addedROEData == false ) { |
| 713 | + $target.html( gM( 'loading_txt' ) ); |
| 714 | + embedPlayer.getMvJsonUrl( this.roe, function( data ) { |
| 715 | + embedPlayer.mediaElement.addROE( data ); |
| 716 | + _this.showDownloadWithSources( $target ); |
| 717 | + } ); |
| 718 | + } else { |
| 719 | + _this.showDownloadWithSources( $target ); |
| 720 | + } |
| 721 | + }, |
| 722 | + |
| 723 | + /** |
| 724 | + * Shows the download interface with sources loaded |
| 725 | + * @param {Object} $target jQuery target to output to |
| 726 | + */ |
| 727 | + showDownloadWithSources : function( $target ) { |
| 728 | + var _this = this; |
| 729 | + var embedPlayer = this.embedPlayer; |
| 730 | + $target.empty().append( |
| 731 | + $j('<div />') |
| 732 | + .css({ |
| 733 | + "color":"white" |
| 734 | + }) |
| 735 | + ); |
| 736 | + var $mediaList = $j( '<ul />' ); |
| 737 | + var $textList = $j( '<ul />' ); |
| 738 | + $j.each( embedPlayer.mediaElement.getSources(), function( index, source ) { |
| 739 | + if( source.getSrc() ) { |
| 740 | + var $dl_line = $j( '<li />').append( |
| 741 | + $j('<a />'). |
| 742 | + css({ |
| 743 | + "color" : "white" |
| 744 | + }) |
| 745 | + .attr( 'href', source.getSrc()) |
| 746 | + .text( source.getTitle() ) |
| 747 | + ); |
| 748 | + // Add link to correct "bucket" |
| 749 | + |
| 750 | + //Add link to time segment: |
| 751 | + if ( source.getSrc().indexOf( '?t=' ) !== -1 ) { |
| 752 | + $target.append( $dl_line ); |
| 753 | + } else if ( this.getMIMEType() == "text/cmml" || this.getMIMEType() == "text/x-srt" ) { |
| 754 | + // Add link to text list |
| 755 | + $textList.append( $dl_line ); |
| 756 | + } else { |
| 757 | + // Add link to media list |
| 758 | + $mediaList.append( $dl_line ); |
| 759 | + } |
| 760 | + |
| 761 | + } |
| 762 | + } ); |
| 763 | + if( $mediaList.find('li').length != 0 ) { |
| 764 | + $target.append( |
| 765 | + $j('<h2 />') |
| 766 | + .text( gM( 'mwe-download_full' ) ), |
| 767 | + $mediaList |
| 768 | + ) |
| 769 | + } |
| 770 | + |
| 771 | + if( $textList.find('li').length != 0 ) { |
| 772 | + $target.append( |
| 773 | + $j('<h2 />') |
| 774 | + .text( gM( 'mwe-download_text' ) ), |
| 775 | + $textList |
| 776 | + ) |
| 777 | + } |
| 778 | + }, |
| 779 | + |
| 780 | + |
| 781 | + /** |
507 | 782 | * Get component |
508 | 783 | * |
509 | 784 | * @param {String} component Component key to grab html output |
— | — | @@ -558,7 +833,7 @@ |
559 | 834 | 'optionsMenu': { |
560 | 835 | 'w' : 0, |
561 | 836 | 'o' : function( ctrlObj ) { |
562 | | - var o = '<div id="mv_vid_options_' + ctrlObj.embedPlayer.id + '" class="videoOptions">' + |
| 837 | + /*var o = '<div id="mv_vid_options_' + ctrlObj.embedPlayer.id + '" class="videoOptions">' + |
563 | 838 | '<div class="videoOptionsTop"></div>' + |
564 | 839 | '<div class="videoOptionsBox">' + |
565 | 840 | '<div class="block">' + |
— | — | @@ -578,6 +853,7 @@ |
579 | 854 | '<div class="videoOptionsBot"></div>' + |
580 | 855 | '</div><!--videoOptions-->'; |
581 | 856 | return o; |
| 857 | + */ |
582 | 858 | } |
583 | 859 | }, |
584 | 860 | |
— | — | @@ -614,7 +890,11 @@ |
615 | 891 | .append( |
616 | 892 | $j('<span />') |
617 | 893 | .addClass( 'ui-icon ui-icon-wrench' ) |
618 | | - ) |
| 894 | + ) |
| 895 | + // Options binding: |
| 896 | + .menu( { |
| 897 | + 'content' : ctrlObj.getOptionsMenu(), |
| 898 | + } ); |
619 | 899 | } |
620 | 900 | }, |
621 | 901 | |
— | — | @@ -631,6 +911,10 @@ |
632 | 912 | $j( '<span />' ) |
633 | 913 | .addClass( "ui-icon ui-icon-arrow-4-diag" ) |
634 | 914 | ) |
| 915 | + // Fullscreen binding: |
| 916 | + .buttonHover().click( function() { |
| 917 | + ctrlObj.embedPlayer.fullscreen(); |
| 918 | + } ); |
635 | 919 | } |
636 | 920 | }, |
637 | 921 | |
— | — | @@ -654,7 +938,7 @@ |
655 | 939 | /** |
656 | 940 | * The closed captions button |
657 | 941 | */ |
658 | | - 'timed_text': { |
| 942 | + 'timedText': { |
659 | 943 | 'w': 28, |
660 | 944 | 'o': function( ctrlObj ) { |
661 | 945 | return $j( '<div />' ) |
— | — | @@ -664,6 +948,10 @@ |
665 | 949 | $j( '<span />' ) |
666 | 950 | .addClass( "ui-icon ui-icon-comment" ) |
667 | 951 | ) |
| 952 | + // Captions binding: |
| 953 | + .buttonHover().click( function() { |
| 954 | + ctrlObj.embedPlayer.showTextInterface(); |
| 955 | + } ); |
668 | 956 | } |
669 | 957 | }, |
670 | 958 | |
— | — | @@ -725,15 +1013,76 @@ |
726 | 1014 | |
727 | 1015 | } |
728 | 1016 | }, |
729 | | - /* |
| 1017 | + |
| 1018 | + /** |
730 | 1019 | * The playhead component |
731 | 1020 | */ |
732 | 1021 | 'playHead': { |
733 | 1022 | 'w':0, // special case (takes up remaining space) |
734 | 1023 | 'o':function( ctrlObj ) { |
735 | | - return $j( '<div />' ) |
736 | | - .addClass ( "play_head" ) |
737 | | - .css( "width", parseInt( ctrlObj.available_width - 20 ) + 'px' ) |
| 1024 | + var embedPlayer = ctrlObj.embedPlayer; |
| 1025 | + var $playHead = $j( '<div />' ) |
| 1026 | + .addClass ( "play_head" ) |
| 1027 | + .css( "width", parseInt( ctrlObj.available_width - 20 ) + 'px' ) |
| 1028 | + // Playhead binding |
| 1029 | + .slider( { |
| 1030 | + range: "min", |
| 1031 | + value: 0, |
| 1032 | + min: 0, |
| 1033 | + max: 1000, |
| 1034 | + start: function( event, ui ) { |
| 1035 | + var id = ( embedPlayer.pc != null ) ? embedPlayer.pc.pp.id:embedPlayer.id; |
| 1036 | + embedPlayer.userSlide = true; |
| 1037 | + $j( id + ' .play-btn-large' ).fadeOut( 'fast' ); |
| 1038 | + // If playlist always start at 0 |
| 1039 | + embedPlayer.start_time_sec = ( embedPlayer.instanceOf == 'mvPlayList' ) ? 0: |
| 1040 | + mw.npt2seconds( embedPlayer.getTimeRange().split( '/' )[0] ); |
| 1041 | + }, |
| 1042 | + slide: function( event, ui ) { |
| 1043 | + var perc = ui.value / 1000; |
| 1044 | + embedPlayer.jump_time = mw.seconds2npt( parseFloat( parseFloat( embedPlayer.getDuration() ) * perc ) + embedPlayer.start_time_sec ); |
| 1045 | + // mw.log('perc:' + perc + ' * ' + embedPlayer.getDuration() + ' jt:'+ this.jump_time); |
| 1046 | + if ( _this.longTimeDisp ) { |
| 1047 | + embedPlayer.setStatus( gM( 'mwe-seek_to', embedPlayer.jump_time ) ); |
| 1048 | + } else { |
| 1049 | + embedPlayer.setStatus( embedPlayer.jump_time ); |
| 1050 | + } |
| 1051 | + // Update the thumbnail / frame |
| 1052 | + if ( embedPlayer.isPlaying == false ) { |
| 1053 | + embedPlayer.updateThumbPerc( perc ); |
| 1054 | + } |
| 1055 | + }, |
| 1056 | + change:function( event, ui ) { |
| 1057 | + // Only run the onChange event if done by a user slide |
| 1058 | + // (otherwise it runs times it should not) |
| 1059 | + if ( embedPlayer.userSlide ) { |
| 1060 | + embedPlayer.userSlide = false; |
| 1061 | + embedPlayer.seeking = true; |
| 1062 | + // Stop the monitor timer (if we can) |
| 1063 | + embedPlayer.stopMonitor(); |
| 1064 | + |
| 1065 | + var perc = ui.value / 1000; |
| 1066 | + // set seek time (in case we have to do a url seek) |
| 1067 | + embedPlayer.seek_time_sec = mw.npt2seconds( embedPlayer.jump_time, true ); |
| 1068 | + mw.log( 'do jump to: ' + embedPlayer.jump_time + ' perc:' + perc + ' sts:' + embedPlayer.seek_time_sec ); |
| 1069 | + embedPlayer.setStatus( gM( 'mwe-seeking' ) ); |
| 1070 | + embedPlayer.doSeek( perc ); |
| 1071 | + } |
| 1072 | + } |
| 1073 | + } ); |
| 1074 | + |
| 1075 | + // Up the z-index of the default status indicator: |
| 1076 | + $playHead.find( 'ui-slider-handle' ).css( 'z-index', 4 ); |
| 1077 | + $playHead.find( '.ui-slider-range' ).addClass( 'ui-corner-all' ).css( 'z-index', 2 ); |
| 1078 | + |
| 1079 | + // Add buffer html: |
| 1080 | + $playHead.append( |
| 1081 | + $j('<div />') |
| 1082 | + .addClass( "ui-slider-range ui-slider-range-min ui-widget-header") |
| 1083 | + .addClass( "ui-state-highlight ui-corner-all mw_buffer") |
| 1084 | + ); |
| 1085 | + |
| 1086 | + return $playHead; |
738 | 1087 | } |
739 | 1088 | } |
740 | 1089 | } |
Index: branches/js2-work/phase3/js/mwEmbed/skins/common/common.css |
— | — | @@ -477,4 +477,10 @@ |
478 | 478 | width: 12px; |
479 | 479 | margin-top: -6px !important; |
480 | 480 | margin-left: 3px !important; |
| 481 | +} |
| 482 | +mw-buffer{ |
| 483 | + width:0px; |
| 484 | + height:100%; |
| 485 | + z-index:1; |
| 486 | + top:0px; |
481 | 487 | } |
\ No newline at end of file |
Index: branches/js2-work/phase3/js/mwEmbed/skins/kskin/kskinConfig.js |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | playerClass: 'k-player', |
13 | 13 | |
14 | 14 | // Display time string length |
15 | | - long_time_disp: false, |
| 15 | + longTimeDisp: false, |
16 | 16 | |
17 | 17 | // Options are handled internally |
18 | 18 | external_options: false, |
— | — | @@ -19,13 +19,11 @@ |
20 | 20 | // Volume control layout is horizontal |
21 | 21 | volume_layout: 'horizontal', |
22 | 22 | |
23 | | - // Menu items for the kskin: |
24 | | - menu_items:[ |
25 | | - 'playerSelect', |
26 | | - 'download', |
27 | | - 'share', |
28 | | - 'credits' |
29 | | - ], |
| 23 | + // Skin "kskin" is specific for wikimedia we have an |
| 24 | + // api Title key so the "credits" menu item can be showed. |
| 25 | + supportedMenuItems: { |
| 26 | + 'credits': true |
| 27 | + }, |
30 | 28 | |
31 | 29 | // Extends base components with kskin specific options: |
32 | 30 | components: { |
— | — | @@ -89,17 +87,17 @@ |
90 | 88 | .addClass( 'k-menu-bar' ); |
91 | 89 | |
92 | 90 | // Output menu item containers: |
93 | | - for ( i = 0; i < ctrlObj.menu_items.length; i++ ) { |
94 | | - var mk = ctrlObj.menu_items[i]; |
| 91 | + for ( i = 0; i < ctrlObj.optionMenuItems.length; i++ ) { |
| 92 | + var menuItem = ctrlObj.optionMenuItems[ i ]; |
95 | 93 | $menuBar.append( |
96 | 94 | $j( '<li />') |
97 | 95 | // Add the menu item class: |
98 | | - .addClass( 'k-' + mk + '-btn' ) |
99 | | - .attr( 'rel', mk ) |
| 96 | + .addClass( 'k-' + menuItem + '-btn' ) |
| 97 | + .attr( 'rel', menuItem ) |
100 | 98 | .append( |
101 | 99 | $j( '<a />' ) |
102 | 100 | .attr( { |
103 | | - 'title' : gM( 'mwe-' + mk ), |
| 101 | + 'title' : gM( 'mwe-' + menuItem ), |
104 | 102 | 'href' : '#' |
105 | 103 | }) |
106 | 104 | ) |
— | — | @@ -115,10 +113,10 @@ |
116 | 114 | 'width' : ( ctrlObj.getOverlayWidth() - 75 ), |
117 | 115 | 'height' : ( ctrlObj.getOverlayHeight() - ctrlObj.getControlBarHeight() ) |
118 | 116 | }) |
119 | | - for ( i = 0; i < ctrlObj.menu_items.length; i++ ) { |
| 117 | + for ( i = 0; i < ctrlObj.optionMenuItems.length; i++ ) { |
120 | 118 | $menuScreens.append( |
121 | 119 | $j( '<div />' ) |
122 | | - .addClass( 'menu-screen menu-' + ctrlObj.menu_items[i] ) |
| 120 | + .addClass( 'menu-screen menu-' + ctrlObj.optionMenuItems[i] ) |
123 | 121 | ); |
124 | 122 | } |
125 | 123 | |
— | — | @@ -229,8 +227,8 @@ |
230 | 228 | $playerTarget.find( '.k-menu' ).hide(); |
231 | 229 | |
232 | 230 | // Add menu-items bindings: |
233 | | - for ( i = 0; i < _this.menu_items.length ; i++ ) { |
234 | | - $playerTarget.find( '.k-' + _this.menu_items[i] + '-btn' ).click( function() { |
| 231 | + for ( i = 0; i < _this.optionMenuItems.length ; i++ ) { |
| 232 | + $playerTarget.find( '.k-' + _this.optionMenuItems[ i ] + '-btn' ).click( function( ) { |
235 | 233 | var mk = $j( this ).attr( 'rel' ); |
236 | 234 | // hide menu items |
237 | 235 | $targetItem = $playerTarget.find( '.menu-' + mk ); |
— | — | @@ -246,27 +244,9 @@ |
247 | 245 | return false; |
248 | 246 | } ); |
249 | 247 | } |
250 | | - }, |
| 248 | + }, |
251 | 249 | |
252 | 250 | /** |
253 | | - * Shows a selected menu_item |
254 | | - * |
255 | | - * @param {String} menu_itme Menu item key to display |
256 | | - */ |
257 | | - showMenuItem:function( menu_item ) { |
258 | | - var embedPlayer = this.embedPlayer; |
259 | | - //handle special k-skin specific display; |
260 | | - if( menu_item == 'credits'){ |
261 | | - this.showCredits(); |
262 | | - }else{ |
263 | | - // Call the base embedPlayer "show{Item}" |
264 | | - this.embedPlayer['show' + menu_item.charAt( 0 ).toUpperCase() + menu_item.substring( 1 )]( |
265 | | - embedPlayer.$interface.find( '.menu-' + menu_item ) |
266 | | - ); |
267 | | - } |
268 | | - }, |
269 | | - |
270 | | - /** |
271 | 251 | * Show the credit screen (presently specific to kaltura skin ) |
272 | 252 | */ |
273 | 253 | showCredits: function() { |
— | — | @@ -290,7 +270,7 @@ |
291 | 271 | .attr({ |
292 | 272 | 'title': gM('mwe-kaltura-platform-title') |
293 | 273 | }) |
294 | | - .click( function(){ |
| 274 | + .click( function( ) { |
295 | 275 | window.location = 'http://kaltura.com'; |
296 | 276 | }) |
297 | 277 | ); |
— | — | @@ -321,7 +301,7 @@ |
322 | 302 | // Get the image info |
323 | 303 | var request = { |
324 | 304 | 'prop' : 'imageinfo', |
325 | | - 'titles': fileTitle, |
| 305 | + 'titles' : fileTitle, |
326 | 306 | 'iiprop' : 'url' |
327 | 307 | }; |
328 | 308 | var articleUrl = ''; |
— | — | @@ -332,12 +312,12 @@ |
333 | 313 | // Check properites for "missing" |
334 | 314 | if( imageProps.imageinfo && imageProps.imageinfo[0] && imageProps.imageinfo[0].descriptionurl ){ |
335 | 315 | // Found page |
336 | | - $target.find('.credits_box').html( |
| 316 | + $target.find( '.credits_box' ).html( |
337 | 317 | _this.doCreditLine( imageProps.imageinfo[0].descriptionurl ) |
338 | 318 | ); |
339 | 319 | }else{ |
340 | 320 | // missing page descriptionurl |
341 | | - $target.find('.credits_box').text( |
| 321 | + $target.find( '.credits_box' ).text( |
342 | 322 | 'Error: title key: ' + embedPlayer.apiTitleKey + ' not found' |
343 | 323 | ); |
344 | 324 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/loader.js |
— | — | @@ -16,14 +16,14 @@ |
17 | 17 | }); |
18 | 18 | |
19 | 19 | // TimedText module |
20 | | -mw.addModuleLoader( 'TimedText', function( callback ){ |
21 | | - mw.load( [ '$j.fn.menu', 'mw.TimedText' ], function(){ |
| 20 | +mw.addModuleLoader( 'TimedText', function( callback ) { |
| 21 | + mw.load( [ '$j.fn.menu', 'mw.TimedText' ], function() { |
22 | 22 | callback( 'TimedText' ); |
23 | 23 | } ); |
24 | 24 | }); |
25 | 25 | |
26 | 26 | // TimedText editor: |
27 | | -mw.addModuleLoader( 'TimedText.Edit', function( callback ){ |
| 27 | +mw.addModuleLoader( 'TimedText.Edit', function( callback ) { |
28 | 28 | mw.load([ |
29 | 29 | [ |
30 | 30 | '$j.ui', |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | '$j.ui.dialog', |
37 | 37 | '$j.ui.tabs' |
38 | 38 | ] |
39 | | - ], function( ){ |
| 39 | + ], function( ) { |
40 | 40 | callback( 'TimedText.Edit' ); |
41 | 41 | }); |
42 | 42 | }); |
\ No newline at end of file |
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/jquery.menu/jquery.menu.js |
— | — | @@ -18,20 +18,44 @@ |
19 | 19 | (function($) { |
20 | 20 | |
21 | 21 | |
22 | | -$.fn.menu = function( options ){ |
| 22 | +/** |
| 23 | +* Utility line item ( li ) from text string function |
| 24 | +* |
| 25 | +* @param {String} string Text to display for the menu item |
| 26 | +* @param {String} icon jQuery UI icon key displayed to the left of the menu item |
| 27 | +* @param {Function} callback Function called once the line item is selected |
| 28 | +*/ |
| 29 | +$.getLineItem = function( string, icon , callback) { |
| 30 | + var $li = $j( '<li>' ).append( |
| 31 | + $j('<a>') |
| 32 | + .attr('href', '#') |
| 33 | + .click( callback ) |
| 34 | + ) |
| 35 | + if( icon ) { |
| 36 | + $li.find( 'a' ).append( |
| 37 | + $j('<span style="float:left;"></span>') |
| 38 | + .addClass( 'ui-icon ui-icon-' + icon ) |
| 39 | + ) |
| 40 | + } |
| 41 | + $li.find( 'a' ).append( $j('<span>').text( string ) ); |
| 42 | + //mw.log(' li html: ' + $j('<div>').append( $li ).html() ); |
| 43 | + return $li; |
| 44 | +}; |
| 45 | + |
| 46 | +$.fn.menu = function( options ) { |
23 | 47 | var caller = this; |
24 | 48 | var options = options; |
25 | | - if( ! caller.m ){ |
| 49 | + if( ! caller.m ) { |
26 | 50 | caller.m = new Menu(caller, options); |
27 | 51 | allUIMenus.push( caller.m ); |
28 | 52 | |
29 | 53 | |
30 | 54 | //Set up bindings: |
31 | 55 | $(this) |
32 | | - .mousedown(function(){ |
| 56 | + .mousedown(function() { |
33 | 57 | if (!caller.m.menuOpen) { caller.m.showLoading(); }; |
34 | 58 | }) |
35 | | - .click(function(){ |
| 59 | + .click(function() { |
36 | 60 | if (caller.m.menuOpen == false) { |
37 | 61 | caller.m.showMenu(); |
38 | 62 | }else { |
— | — | @@ -42,15 +66,14 @@ |
43 | 67 | } |
44 | 68 | |
45 | 69 | //Check for autoShow menu option |
46 | | - if( options.autoShow ){ |
| 70 | + if( options.autoShow ) { |
47 | 71 | // ( handle async build out) |
48 | | - setTimeout(function(){ |
| 72 | + setTimeout(function() { |
49 | 73 | caller.m.showLoading(); |
50 | 74 | caller.m.showMenu(); |
51 | 75 | }, 0 ); |
52 | | - } |
| 76 | + } |
53 | 77 | |
54 | | - |
55 | 78 | //Else process the request: |
56 | 79 | if( options == 'show' ) |
57 | 80 | caller.m.showMenu(); |
— | — | @@ -58,14 +81,14 @@ |
59 | 82 | return this; |
60 | 83 | }; |
61 | 84 | |
62 | | -function Menu(caller, options){ |
| 85 | +function Menu(caller, options) { |
63 | 86 | var menu = this; |
64 | 87 | var caller = $(caller); |
65 | 88 | |
66 | 89 | mw.log( 'target container: ' + options.targetMenuContainer ); |
67 | 90 | |
68 | 91 | var callerClassList = 'fg-menu-container ui-widget ui-widget-content ui-corner-all'; |
69 | | - if( options.targetMenuContainer ){ |
| 92 | + if( options.targetMenuContainer ) { |
70 | 93 | var container = $( options.targetMenuContainer ).addClass( callerClassList ).html( options.content ); |
71 | 94 | }else{ |
72 | 95 | var container = $('<div>').addClass( callerClassList ).html( options.content ); |
— | — | @@ -109,13 +132,13 @@ |
110 | 133 | nextCrumbLink: 'ui-icon-carat-1-e' |
111 | 134 | }, options); |
112 | 135 | |
113 | | - var killAllMenus = function(){ |
114 | | - $.each(allUIMenus, function(i){ |
| 136 | + var killAllMenus = function() { |
| 137 | + $.each(allUIMenus, function(i) { |
115 | 138 | if (allUIMenus[i].menuOpen) { allUIMenus[i].kill(); }; |
116 | 139 | }); |
117 | 140 | }; |
118 | 141 | |
119 | | - this.kill = function(){ |
| 142 | + this.kill = function() { |
120 | 143 | caller |
121 | 144 | .removeClass(options.loadingState) |
122 | 145 | .removeClass('fg-menu-open') |
— | — | @@ -131,18 +154,18 @@ |
132 | 155 | $(document).unbind('keydown'); |
133 | 156 | }; |
134 | 157 | |
135 | | - this.showLoading = function(){ |
| 158 | + this.showLoading = function() { |
136 | 159 | caller.addClass(options.loadingState); |
137 | 160 | }; |
138 | 161 | |
139 | | - this.showMenu = function(){ |
| 162 | + this.showMenu = function() { |
140 | 163 | mw.log('$j.menu:: show menu' ); |
141 | 164 | killAllMenus(); |
142 | 165 | if (!menu.menuExists) { menu.create() }; |
143 | 166 | caller |
144 | 167 | .addClass('fg-menu-open') |
145 | 168 | .addClass(options.callerOnState); |
146 | | - container.parent().show().click(function(){ |
| 169 | + container.parent().show().click(function() { |
147 | 170 | menu.kill(); |
148 | 171 | return false; |
149 | 172 | }); |
— | — | @@ -152,7 +175,7 @@ |
153 | 176 | $(document).click(killAllMenus); |
154 | 177 | |
155 | 178 | // assign key events |
156 | | - $(document).keydown(function(event){ |
| 179 | + $(document).keydown(function(event) { |
157 | 180 | var e; |
158 | 181 | if (event.which !="") { e = event.which; } |
159 | 182 | else if (event.charCode != "") { e = event.charCode; } |
— | — | @@ -197,7 +220,7 @@ |
198 | 221 | } |
199 | 222 | else if (menuType == 'ipod') { |
200 | 223 | $(event.target).trigger('click'); |
201 | | - setTimeout(function(){ |
| 224 | + setTimeout(function() { |
202 | 225 | $(event.target).next().find('a:eq(0)').trigger('mouseover'); |
203 | 226 | }, options.crossSpeed); |
204 | 227 | }; |
— | — | @@ -224,7 +247,7 @@ |
225 | 248 | case 13: // enter |
226 | 249 | if ($(event.target).is('.fg-menu-indicator') && menuType == 'ipod') { |
227 | 250 | $(event.target).trigger('click'); |
228 | | - setTimeout(function(){ |
| 251 | + setTimeout(function() { |
229 | 252 | $(event.target).next().find('a:eq(0)').trigger('mouseover'); |
230 | 253 | }, options.crossSpeed); |
231 | 254 | }; |
— | — | @@ -233,7 +256,7 @@ |
234 | 257 | }); |
235 | 258 | }; |
236 | 259 | |
237 | | - this.create = function(){ |
| 260 | + this.create = function() { |
238 | 261 | container.css({ width: options.width }).appendTo('body').find('ul:first').not('.fg-menu-breadcrumb').addClass('fg-menu'); |
239 | 262 | container.find('ul, li a').addClass('ui-corner-all'); |
240 | 263 | |
— | — | @@ -249,7 +272,7 @@ |
250 | 273 | else { menu.drilldown(container, options); } |
251 | 274 | } |
252 | 275 | else { |
253 | | - container.find('a').click(function(){ |
| 276 | + container.find('a').click(function() { |
254 | 277 | menu.chooseItem(this); |
255 | 278 | return false; |
256 | 279 | }); |
— | — | @@ -258,12 +281,12 @@ |
259 | 282 | if (options.linkHover) { |
260 | 283 | var allLinks = container.find('.fg-menu li a'); |
261 | 284 | allLinks.hover( |
262 | | - function(){ |
| 285 | + function() { |
263 | 286 | var menuitem = $(this); |
264 | 287 | $('.'+options.linkHover).removeClass(options.linkHover).blur().parent().removeAttr('id'); |
265 | 288 | $(this).addClass(options.linkHover).focus().parent().attr('id','active-menuitem'); |
266 | 289 | }, |
267 | | - function(){ |
| 290 | + function() { |
268 | 291 | $(this).removeClass(options.linkHover).blur().parent().removeAttr('id'); |
269 | 292 | } |
270 | 293 | ); |
— | — | @@ -271,12 +294,12 @@ |
272 | 295 | |
273 | 296 | if (options.linkHoverSecondary) { |
274 | 297 | container.find('.fg-menu li').hover( |
275 | | - function(){ |
| 298 | + function() { |
276 | 299 | $(this).siblings('li').removeClass(options.linkHoverSecondary); |
277 | 300 | if (options.flyOutOnState) { $(this).siblings('li').find('a').removeClass(options.flyOutOnState); } |
278 | 301 | $(this).addClass(options.linkHoverSecondary); |
279 | 302 | }, |
280 | | - function(){ $(this).removeClass(options.linkHoverSecondary); } |
| 303 | + function() { $(this).removeClass(options.linkHoverSecondary); } |
281 | 304 | ); |
282 | 305 | }; |
283 | 306 | |
— | — | @@ -284,7 +307,7 @@ |
285 | 308 | menu.menuExists = true; |
286 | 309 | }; |
287 | 310 | |
288 | | - this.chooseItem = function(item){ |
| 311 | + this.chooseItem = function(item) { |
289 | 312 | menu.kill(); |
290 | 313 | if( options.selectItemCallback ) |
291 | 314 | options.selectItemCallback( item ); |
— | — | @@ -294,12 +317,12 @@ |
295 | 318 | Menu.prototype.flyout = function(container, options) { |
296 | 319 | var menu = this; |
297 | 320 | |
298 | | - this.resetFlyoutMenu = function(){ |
| 321 | + this.resetFlyoutMenu = function() { |
299 | 322 | var allLists = container.find('ul ul'); |
300 | 323 | allLists.removeClass('ui-widget-content').hide(); |
301 | 324 | }; |
302 | 325 | |
303 | | - container.addClass('fg-menu-flyout').find('li:has(ul)').each(function(){ |
| 326 | + container.addClass('fg-menu-flyout').find('li:has(ul)').each(function() { |
304 | 327 | var linkWidth = container.width(); |
305 | 328 | var showTimer, hideTimer; |
306 | 329 | var allSubLists = $(this).find('ul'); |
— | — | @@ -310,33 +333,33 @@ |
311 | 334 | '<span>' + $(this).find('a:eq(0)').html() + |
312 | 335 | '</span><span class="ui-icon '+options.nextMenuLink+'"></span>') |
313 | 336 | .hover( |
314 | | - function(){ |
| 337 | + function() { |
315 | 338 | clearTimeout(hideTimer); |
316 | 339 | var subList = $(this).next(); |
317 | 340 | if (!fitVertical(subList, $(this).offset().top)) { subList.css({ top: 'auto', bottom: 0 }); }; |
318 | 341 | if (!fitHorizontal(subList, $(this).offset().left + 100)) { subList.css({ left: 'auto', right: linkWidth, 'z-index': 1005 }); }; |
319 | | - showTimer = setTimeout(function(){ |
| 342 | + showTimer = setTimeout(function() { |
320 | 343 | subList.addClass('ui-widget-content').show(options.showSpeed).attr('aria-expanded', 'true'); |
321 | 344 | }, 300); |
322 | 345 | }, |
323 | | - function(){ |
| 346 | + function() { |
324 | 347 | clearTimeout(showTimer); |
325 | 348 | var subList = $(this).next(); |
326 | | - hideTimer = setTimeout(function(){ |
| 349 | + hideTimer = setTimeout(function() { |
327 | 350 | subList.removeClass('ui-widget-content').hide(options.showSpeed).attr('aria-expanded', 'false'); |
328 | 351 | }, 400); |
329 | 352 | } |
330 | 353 | ); |
331 | 354 | |
332 | 355 | $(this).find('ul a').hover( |
333 | | - function(){ |
| 356 | + function() { |
334 | 357 | clearTimeout(hideTimer); |
335 | 358 | if ($(this).parents('ul').prev().is('a.fg-menu-indicator')) { |
336 | 359 | $(this).parents('ul').prev().addClass(options.flyOutOnState); |
337 | 360 | } |
338 | 361 | }, |
339 | | - function(){ |
340 | | - hideTimer = setTimeout(function(){ |
| 362 | + function() { |
| 363 | + hideTimer = setTimeout(function() { |
341 | 364 | allSubLists.hide(options.showSpeed); |
342 | 365 | container.find(options.flyOutOnState).removeClass(options.flyOutOnState); |
343 | 366 | }, 500); |
— | — | @@ -344,7 +367,7 @@ |
345 | 368 | ); |
346 | 369 | }); |
347 | 370 | |
348 | | - container.find('a').click(function(){ |
| 371 | + container.find('a').click(function() { |
349 | 372 | menu.chooseItem(this); |
350 | 373 | return false; |
351 | 374 | }); |
— | — | @@ -368,19 +391,19 @@ |
369 | 392 | else { breadcrumb.addClass('fg-menu-header').prependTo(container); }; |
370 | 393 | breadcrumb.append(crumbDefaultHeader); |
371 | 394 | |
372 | | - var checkMenuHeight = function(el){ |
| 395 | + var checkMenuHeight = function(el) { |
373 | 396 | if (el.height() > options.maxHeight) { el.addClass('fg-menu-scroll') }; |
374 | 397 | el.css({ |
375 | 398 | height: options.maxHeight-30 |
376 | 399 | }); |
377 | 400 | }; |
378 | 401 | |
379 | | - var resetChildMenu = function(el){ el.removeClass('fg-menu-scroll').removeClass('fg-menu-current').height('auto'); }; |
| 402 | + var resetChildMenu = function(el) { el.removeClass('fg-menu-scroll').removeClass('fg-menu-current').height('auto'); }; |
380 | 403 | |
381 | | - this.resetDrilldownMenu = function(){ |
| 404 | + this.resetDrilldownMenu = function() { |
382 | 405 | $('.fg-menu-current').removeClass('fg-menu-current'); |
383 | | - topList.animate({ left: 0 }, options.crossSpeed, function(){ |
384 | | - $(this).find('ul').each(function(){ |
| 406 | + topList.animate({ left: 0 }, options.crossSpeed, function() { |
| 407 | + $(this).find('ul').each(function() { |
385 | 408 | $(this).hide(); |
386 | 409 | resetChildMenu($(this)); |
387 | 410 | }); |
— | — | @@ -401,13 +424,13 @@ |
402 | 425 | .hide(); |
403 | 426 | checkMenuHeight(topList); |
404 | 427 | |
405 | | - topList.find('a').each(function(){ |
| 428 | + topList.find('a').each(function() { |
406 | 429 | // if the link opens a child menu: |
407 | 430 | if ($(this).next().is('ul')) { |
408 | 431 | $(this) |
409 | 432 | .addClass('fg-menu-indicator') |
410 | | - .each(function(){ $(this).html('<span>' + $(this).html() + '</span><span class="ui-icon '+options.nextMenuLink+'"></span>'); }) |
411 | | - .click(function(){ // ----- show the next menu |
| 433 | + .each(function() { $(this).html('<span>' + $(this).html() + '</span><span class="ui-icon '+options.nextMenuLink+'"></span>'); }) |
| 434 | + .click(function() { // ----- show the next menu |
412 | 435 | var nextList = $(this).next(); |
413 | 436 | var parentUl = $(this).parents('ul:eq(0)'); |
414 | 437 | var parentLeft = (parentUl.is('.fg-menu-content')) ? 0 : parseFloat(topList.css('left')); |
— | — | @@ -420,7 +443,7 @@ |
421 | 444 | topList.animate({ left: nextLeftVal }, options.crossSpeed); |
422 | 445 | nextList.show().addClass('fg-menu-current').attr('aria-expanded', 'true'); |
423 | 446 | |
424 | | - var setPrevMenu = function(backlink){ |
| 447 | + var setPrevMenu = function(backlink) { |
425 | 448 | var b = backlink; |
426 | 449 | var c = $('.fg-menu-current'); |
427 | 450 | var prevList = c.parents('ul:eq(0)'); |
— | — | @@ -437,10 +460,10 @@ |
438 | 461 | footer.show(); |
439 | 462 | $('<a href="#"><span class="ui-icon ui-icon-triangle-1-w"></span> <span>Back</span></a>') |
440 | 463 | .appendTo(footer) |
441 | | - .click(function(){ // ----- show the previous menu |
| 464 | + .click(function() { // ----- show the previous menu |
442 | 465 | var b = $(this); |
443 | 466 | var prevLeftVal = parseFloat(topList.css('left')) + container.width(); |
444 | | - topList.animate({ left: prevLeftVal }, options.crossSpeed, function(){ |
| 467 | + topList.animate({ left: prevLeftVal }, options.crossSpeed, function() { |
445 | 468 | setPrevMenu(b); |
446 | 469 | }); |
447 | 470 | return false; |
— | — | @@ -449,9 +472,9 @@ |
450 | 473 | } |
451 | 474 | // or initialize top breadcrumb |
452 | 475 | else { |
453 | | - if (breadcrumb.find('li').size() == 1){ |
| 476 | + if (breadcrumb.find('li').size() == 1) { |
454 | 477 | breadcrumb.empty().append(firstCrumb); |
455 | | - firstCrumb.find('a').click(function(){ |
| 478 | + firstCrumb.find('a').click(function() { |
456 | 479 | menu.resetDrilldownMenu(); |
457 | 480 | return false; |
458 | 481 | }); |
— | — | @@ -461,13 +484,13 @@ |
462 | 485 | var newCrumb = $('<li class="fg-menu-current-crumb"><a href="javascript://" class="fg-menu-crumb">'+crumbText+'</a></li>'); |
463 | 486 | newCrumb |
464 | 487 | .appendTo(breadcrumb) |
465 | | - .find('a').click(function(){ |
466 | | - if ($(this).parent().is('.fg-menu-current-crumb')){ |
| 488 | + .find('a').click(function() { |
| 489 | + if ($(this).parent().is('.fg-menu-current-crumb')) { |
467 | 490 | menu.chooseItem(this); |
468 | 491 | } |
469 | 492 | else { |
470 | 493 | var newLeftVal = - ($('.fg-menu-current').parents('ul').size() - 1) * 180; |
471 | | - topList.animate({ left: newLeftVal }, options.crossSpeed, function(){ |
| 494 | + topList.animate({ left: newLeftVal }, options.crossSpeed, function() { |
472 | 495 | setPrevMenu(); |
473 | 496 | }); |
474 | 497 | |
— | — | @@ -484,7 +507,7 @@ |
485 | 508 | } |
486 | 509 | // if the link is a leaf node (doesn't open a child menu) |
487 | 510 | else { |
488 | | - $(this).click(function(){ |
| 511 | + $(this).click(function() { |
489 | 512 | menu.chooseItem(this); |
490 | 513 | return false; |
491 | 514 | }); |
— | — | @@ -520,7 +543,7 @@ |
521 | 544 | |
522 | 545 | var helper = $( '<div class="positionHelper">' ); |
523 | 546 | // Hard code width heigh of button if unset ( crazy IE ) |
524 | | - if( isNaN( dims.refW ) || isNaN( dims.refH ) ){ |
| 547 | + if( isNaN( dims.refW ) || isNaN( dims.refH ) ) { |
525 | 548 | dims.refH = 16; |
526 | 549 | dims.refW = 23; |
527 | 550 | } |
— | — | @@ -604,28 +627,28 @@ |
605 | 628 | |
606 | 629 | function sortBigToSmall(a, b) { return b - a; }; |
607 | 630 | |
608 | | -jQuery.fn.getTotalWidth = function(){ |
| 631 | +jQuery.fn.getTotalWidth = function() { |
609 | 632 | return $(this).width() + parseInt($(this).css('paddingRight')) + parseInt($(this).css('paddingLeft')) + parseInt($(this).css('borderRightWidth')) + parseInt($(this).css('borderLeftWidth')); |
610 | 633 | }; |
611 | 634 | |
612 | | -jQuery.fn.getTotalHeight = function(){ |
| 635 | +jQuery.fn.getTotalHeight = function() { |
613 | 636 | return $(this).height() + parseInt($(this).css('paddingTop')) + parseInt($(this).css('paddingBottom')) + parseInt($(this).css('borderTopWidth')) + parseInt($(this).css('borderBottomWidth')); |
614 | 637 | }; |
615 | 638 | |
616 | | -function getScrollTop(){ |
| 639 | +function getScrollTop() { |
617 | 640 | return self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; |
618 | 641 | }; |
619 | 642 | |
620 | | -function getScrollLeft(){ |
| 643 | +function getScrollLeft() { |
621 | 644 | return self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft; |
622 | 645 | }; |
623 | 646 | |
624 | | -function getWindowHeight(){ |
| 647 | +function getWindowHeight() { |
625 | 648 | var de = document.documentElement; |
626 | 649 | return self.innerHeight || (de && de.clientHeight) || document.body.clientHeight; |
627 | 650 | }; |
628 | 651 | |
629 | | -function getWindowWidth(){ |
| 652 | +function getWindowWidth() { |
630 | 653 | var de = document.documentElement; |
631 | 654 | return self.innerWidth || (de && de.clientWidth) || document.body.clientWidth; |
632 | 655 | }; |
— | — | @@ -635,12 +658,12 @@ |
636 | 659 | el = element to position, required |
637 | 660 | leftOffset / topOffset = optional parameter if the offset cannot be calculated (i.e., if the object is in the DOM but is set to display: 'none') */ |
638 | 661 | |
639 | | -function fitHorizontal(el, leftOffset){ |
| 662 | +function fitHorizontal(el, leftOffset) { |
640 | 663 | var leftVal = parseInt(leftOffset) || $(el).offset().left; |
641 | 664 | return (leftVal + $(el).width() <= getWindowWidth() + getScrollLeft() && leftVal - getScrollLeft() >= 0); |
642 | 665 | }; |
643 | 666 | |
644 | | -function fitVertical(el, topOffset){ |
| 667 | +function fitVertical(el, topOffset) { |
645 | 668 | var topVal = parseInt(topOffset) || $(el).offset().top; |
646 | 669 | return (topVal + $(el).height() <= getWindowHeight() + getScrollTop() && topVal - getScrollTop() >= 0); |
647 | 670 | }; |
— | — | @@ -671,7 +694,7 @@ |
672 | 695 | * 08.01.2008 - fixed font-size calculation for IE |
673 | 696 | --------------------------------------------------------------------*/ |
674 | 697 | |
675 | | -Number.prototype.pxToEm = String.prototype.pxToEm = function(settings){ |
| 698 | +Number.prototype.pxToEm = String.prototype.pxToEm = function(settings) { |
676 | 699 | //set defaults |
677 | 700 | settings = jQuery.extend({ |
678 | 701 | scope: 'body', |
— | — | @@ -680,7 +703,7 @@ |
681 | 704 | |
682 | 705 | var pxVal = (this == '') ? 0 : parseFloat(this); |
683 | 706 | var scopeVal; |
684 | | - var getWindowWidth = function(){ |
| 707 | + var getWindowWidth = function() { |
685 | 708 | var de = document.documentElement; |
686 | 709 | return self.innerWidth || (de && de.clientWidth) || document.body.clientWidth; |
687 | 710 | }; |
— | — | @@ -691,7 +714,7 @@ |
692 | 715 | to get an accurate em value. */ |
693 | 716 | |
694 | 717 | if (settings.scope == 'body' && $.browser.msie && (parseFloat($('body').css('font-size')) / getWindowWidth()).toFixed(1) > 0.0) { |
695 | | - var calcFontSize = function(){ |
| 718 | + var calcFontSize = function() { |
696 | 719 | return (parseFloat($('body').css('font-size'))/getWindowWidth()).toFixed(3) * 16; |
697 | 720 | }; |
698 | 721 | scopeVal = calcFontSize(); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js |
— | — | @@ -134,7 +134,7 @@ |
135 | 135 | * @constructor |
136 | 136 | * @param {Object} embedPlayer Host player for timedText interfaces |
137 | 137 | */ |
138 | | - init: function( embedPlayer, options ){ |
| 138 | + init: function( embedPlayer, options ) { |
139 | 139 | var _this = this; |
140 | 140 | mw.log("TimedText: init() ") |
141 | 141 | this.embedPlayer = embedPlayer; |
— | — | @@ -147,7 +147,7 @@ |
148 | 148 | this.textSourceSetupFlag = false; |
149 | 149 | |
150 | 150 | //Set default langauge via wgUserLanguage if set |
151 | | - if( typeof wgUserLanguage != 'undefined'){ |
| 151 | + if( typeof wgUserLanguage != 'undefined') { |
152 | 152 | this.config.userLanugage = wgUserLanguage; |
153 | 153 | } |
154 | 154 | |
— | — | @@ -158,11 +158,11 @@ |
159 | 159 | } |
160 | 160 | |
161 | 161 | // Set up embedPlayer hooks: |
162 | | - embedPlayer.addHook( 'monitor', function(){ |
| 162 | + embedPlayer.addHook( 'monitor', function() { |
163 | 163 | _this.monitor(); |
164 | 164 | } ) |
165 | 165 | |
166 | | - embedPlayer.addHook( 'play', function(){ |
| 166 | + embedPlayer.addHook( 'play', function() { |
167 | 167 | // Will load and setup timedText sources (if not loaded already loaded ) |
168 | 168 | _this.setupTextSources(); |
169 | 169 | } ); |
— | — | @@ -174,16 +174,16 @@ |
175 | 175 | * auto-selects a source based on the user language |
176 | 176 | * @param {Function} callback Function to be called once text sources are setup. |
177 | 177 | */ |
178 | | - setupTextSources: function( callback ){ |
| 178 | + setupTextSources: function( callback ) { |
179 | 179 | var _this = this; |
180 | | - if( this.textSourceSetupFlag ){ |
181 | | - if( callback ){ |
| 180 | + if( this.textSourceSetupFlag ) { |
| 181 | + if( callback ) { |
182 | 182 | callback(); |
183 | 183 | } |
184 | 184 | return ; |
185 | 185 | } |
186 | 186 | // Load textSources |
187 | | - _this.loadTextSources( function(){ |
| 187 | + _this.loadTextSources( function() { |
188 | 188 | |
189 | 189 | // Enable a default source and issue a request to "load it" |
190 | 190 | _this.autoSelectSource(); |
— | — | @@ -205,7 +205,7 @@ |
206 | 206 | * @param {Object} target to display the menu |
207 | 207 | * @param {Boolean} autoShow If the menu should be displayed |
208 | 208 | */ |
209 | | - bindMenu: function( target , autoShow){ |
| 209 | + bindMenu: function( target , autoShow) { |
210 | 210 | var _this = this; |
211 | 211 | mw.log( "TimedText:bindMenu:" + target ); |
212 | 212 | _this.menuTarget = target; |
— | — | @@ -214,7 +214,7 @@ |
215 | 215 | // Else bind and show the menu |
216 | 216 | // We already have a loader in embedPlayer so the delay of |
217 | 217 | // setupTextSources is already taken into account |
218 | | - _this.setupTextSources( function(){ |
| 218 | + _this.setupTextSources( function() { |
219 | 219 | // NOTE: Button target should be an option or config |
220 | 220 | $menuButton.unbind().menu( { |
221 | 221 | 'content' : _this.getMainMenu(), |
— | — | @@ -229,7 +229,7 @@ |
230 | 230 | /** |
231 | 231 | * Monitor video time and update timed text filed[s] |
232 | 232 | */ |
233 | | - monitor: function( ){ |
| 233 | + monitor: function( ) { |
234 | 234 | //mw.log(" timed Text monitor: " + this.enabledSources.length ); |
235 | 235 | embedPlayer = this.embedPlayer; |
236 | 236 | // Setup local reference to currentTime: |
— | — | @@ -249,20 +249,20 @@ |
250 | 250 | * or from a timedTextProviders |
251 | 251 | * @param {Function} callback Function to call once text sources are loaded |
252 | 252 | */ |
253 | | - loadTextSources: function( callback ){ |
| 253 | + loadTextSources: function( callback ) { |
254 | 254 | var _this = this; |
255 | 255 | this.textSources = [ ]; |
256 | 256 | // Get local reference to all timed text sources: ( text/xml, text/x-srt etc ) |
257 | 257 | var inlineSources = this.embedPlayer.mediaElement.getSources( 'text' ); |
258 | 258 | // Add all the sources to textSources |
259 | | - for( var i = 0 ; i < inlineSources.length ; i++ ){ |
| 259 | + for( var i = 0 ; i < inlineSources.length ; i++ ) { |
260 | 260 | // make a new textSource: |
261 | 261 | var source = new TextSource( inlineSources[i] ); |
262 | 262 | this.textSources.push( source ); |
263 | 263 | } |
264 | 264 | |
265 | 265 | //If there are no inline sources check timedTextProviders & apiTitleKey |
266 | | - if( !this.embedPlayer.apiTitleKey ){ |
| 266 | + if( !this.embedPlayer.apiTitleKey ) { |
267 | 267 | //no other sources just issue the callback: |
268 | 268 | callback(); |
269 | 269 | return ; |
— | — | @@ -272,7 +272,7 @@ |
273 | 273 | var provider_id = ( this.embedPlayer.apiProvider ) ? this.embedPlayer.apiProvider : 'local'; |
274 | 274 | var api_url = mw.getApiProviderURL( provider_id ); |
275 | 275 | var assetKey = this.embedPlayer.apiTitleKey; |
276 | | - if( !api_url || !assetKey ){ |
| 276 | + if( !api_url || !assetKey ) { |
277 | 277 | mw.log("Error: loading source without apiProvider or apiTitleKey"); |
278 | 278 | return ; |
279 | 279 | } |
— | — | @@ -284,8 +284,8 @@ |
285 | 285 | } ); |
286 | 286 | |
287 | 287 | // Load the textProvider sources |
288 | | - this.textProvider.loadSources( assetKey, function( textSources ){ |
289 | | - for( var i in textSources ){ |
| 288 | + this.textProvider.loadSources( assetKey, function( textSources ) { |
| 289 | + for( var i in textSources ) { |
290 | 290 | var textSource = textSources[ i ]; |
291 | 291 | // Try to insert the itext source: |
292 | 292 | var textElm = document.createElement( 'itext' ); |
— | — | @@ -315,9 +315,9 @@ |
316 | 316 | * Playback method overlays support ( have to put subtitles bellow video ) |
317 | 317 | * |
318 | 318 | */ |
319 | | - getLayoutMode: function(){ |
| 319 | + getLayoutMode: function() { |
320 | 320 | // Re-map "ontop" to "below" if player does not support |
321 | | - if( this.config.layout == 'ontop' && !this.embedPlayer.supports['overlays'] ){ |
| 321 | + if( this.config.layout == 'ontop' && !this.embedPlayer.supports['overlays'] ) { |
322 | 322 | this.config.layout = 'below'; |
323 | 323 | } |
324 | 324 | return this.config.layout; |
— | — | @@ -329,32 +329,32 @@ |
330 | 330 | * NOTE: presently this selects a "single" source. |
331 | 331 | * In the future we could support multiple "enabled sources" |
332 | 332 | */ |
333 | | - autoSelectSource: function(){ |
| 333 | + autoSelectSource: function() { |
334 | 334 | this.enabledSources = []; |
335 | 335 | |
336 | 336 | // Check if any source matches our "local" |
337 | | - for( var i in this.textSources ){ |
| 337 | + for( var i in this.textSources ) { |
338 | 338 | var source = this.textSources[ i ]; |
339 | 339 | if( this.config.userLanugage && |
340 | | - this.config.userLanugage == source.lang.toLowerCase() ){ |
| 340 | + this.config.userLanugage == source.lang.toLowerCase() ) { |
341 | 341 | // Check for category if available |
342 | 342 | this.enabledSources.push( source ); |
343 | 343 | return ; |
344 | 344 | } |
345 | 345 | } |
346 | 346 | // If no userLang, source try enabling English: |
347 | | - if( this.enabledSources.length == 0 ){ |
348 | | - for( var i in this.textSources ){ |
| 347 | + if( this.enabledSources.length == 0 ) { |
| 348 | + for( var i in this.textSources ) { |
349 | 349 | var source = this.textSources[ i ]; |
350 | | - if( source.lang.toLowerCase() == 'en' ){ |
| 350 | + if( source.lang.toLowerCase() == 'en' ) { |
351 | 351 | this.enabledSources.push( source ); |
352 | 352 | return ; |
353 | 353 | } |
354 | 354 | } |
355 | 355 | } |
356 | 356 | // If still no source try the first source we get; |
357 | | - if( this.enabledSources.length == 0 ){ |
358 | | - for( var i in this.textSources ){ |
| 357 | + if( this.enabledSources.length == 0 ) { |
| 358 | + for( var i in this.textSources ) { |
359 | 359 | var source = this.textSources[ i ]; |
360 | 360 | this.enabledSources.push( source ); |
361 | 361 | return ; |
— | — | @@ -366,8 +366,8 @@ |
367 | 367 | * Issue a request to load all enabled Sources |
368 | 368 | * Should be called anytime enabled Source list is updatd |
369 | 369 | */ |
370 | | - loadEnabledSources: function(){ |
371 | | - for(var i in this.enabledSources ){ |
| 370 | + loadEnabledSources: function() { |
| 371 | + for(var i in this.enabledSources ) { |
372 | 372 | var enabledSource = this.enabledSources[ i ]; |
373 | 373 | if( ! enabledSource.loaded ) |
374 | 374 | enabledSource.load(); |
— | — | @@ -379,7 +379,7 @@ |
380 | 380 | * |
381 | 381 | * @param {Element} item Item selected |
382 | 382 | */ |
383 | | - selectMenuItem: function( item ){ |
| 383 | + selectMenuItem: function( item ) { |
384 | 384 | mw.log("selectMenuItem: " + $j( item ).find('a').attr('class') ); |
385 | 385 | }, |
386 | 386 | |
— | — | @@ -390,14 +390,14 @@ |
391 | 391 | * false if source is off |
392 | 392 | * @type {Boolean} |
393 | 393 | */ |
394 | | - isSourceEnabled: function( source ){ |
395 | | - for(var i in this.enabledSources ){ |
| 394 | + isSourceEnabled: function( source ) { |
| 395 | + for(var i in this.enabledSources ) { |
396 | 396 | var enabledSource = this.enabledSources[i]; |
397 | | - if( source.id ){ |
| 397 | + if( source.id ) { |
398 | 398 | if( source.id == enabledSource.id ) |
399 | 399 | return true; |
400 | 400 | } |
401 | | - if( source.lang ){ |
| 401 | + if( source.lang ) { |
402 | 402 | if( source.lang == enabledSource.lang ) |
403 | 403 | return true; |
404 | 404 | } |
— | — | @@ -407,8 +407,8 @@ |
408 | 408 | /* |
409 | 409 | * Get a source object by language, returns "false" if not found |
410 | 410 | */ |
411 | | - getSourceByLanguage: function ( langKey ){ |
412 | | - for(var i in this.textSources){ |
| 411 | + getSourceByLanguage: function ( langKey ) { |
| 412 | + for(var i in this.textSources) { |
413 | 413 | var source = this.textSources[ i ]; |
414 | 414 | if( source.lang == langKey ) |
415 | 415 | return source; |
— | — | @@ -434,25 +434,25 @@ |
435 | 435 | * [ All videos ] |
436 | 436 | * [ Chapters ] seek to chapter |
437 | 437 | */ |
438 | | - getMainMenu: function(){ |
| 438 | + getMainMenu: function() { |
439 | 439 | var _this = this; |
440 | 440 | |
441 | 441 | |
442 | 442 | // Build the source list menu item: |
443 | 443 | $menu = $j( '<ul>' ); |
444 | 444 | // Chouse text menu item ( if there are sources) |
445 | | - if( _this.textSources.length != 0 ){ |
| 445 | + if( _this.textSources.length != 0 ) { |
446 | 446 | $menu.append( |
447 | | - _this.getLi( gM( 'mwe-chose-text'), 'comment' ).append( |
| 447 | + $j.getLineItem( gM( 'mwe-chose-text'), 'comment' ).append( |
448 | 448 | _this.getLanguageMenu() |
449 | 449 | ), |
450 | 450 | // Layout Menu option |
451 | | - _this.getLi( gM( 'mwe-layout' ), 'image' ).append( |
| 451 | + $j.getLineItem( gM( 'mwe-layout' ), 'image' ).append( |
452 | 452 | _this.getLayoutMenu() |
453 | 453 | ) |
454 | 454 | |
455 | 455 | // Search Menu option |
456 | | - //_this.getLi( gM('mwe-search'), 'search') |
| 456 | + //$j.getLineItem( gM('mwe-search'), 'search') |
457 | 457 | ); |
458 | 458 | } |
459 | 459 | // Put in the "Make Transcript" link |
— | — | @@ -469,13 +469,13 @@ |
470 | 470 | * |
471 | 471 | * @param {String} mode Mode or page to display ( to differentiate between edit vs new transcript) |
472 | 472 | */ |
473 | | - showTimedTextEditUI: function( mode ){ |
| 473 | + showTimedTextEditUI: function( mode ) { |
474 | 474 | var _this = this; |
475 | 475 | // Show a loader: |
476 | 476 | mw.addLoaderDialog( gM( 'mwe-loading-text-edit' )); |
477 | 477 | // Load the timedText edit interface |
478 | | - mw.load( 'TimedText.Edit', function(){ |
479 | | - if( ! _this.editText ){ |
| 478 | + mw.load( 'TimedText.Edit', function() { |
| 479 | + if( ! _this.editText ) { |
480 | 480 | _this.editText = new mw.TimedTextEdit( _this ); |
481 | 481 | } |
482 | 482 | // Close the loader: |
— | — | @@ -494,9 +494,9 @@ |
495 | 495 | /** |
496 | 496 | * Get the add text menu item: |
497 | 497 | */ |
498 | | - getLiAddText: function(){ |
| 498 | + getLiAddText: function() { |
499 | 499 | var _this = this; |
500 | | - return _this.getLi( gM( 'mwe-add-timed-text'), 'script', function(){ |
| 500 | + return $j.getLineItem( gM( 'mwe-add-timed-text'), 'script', function() { |
501 | 501 | _this.showTimedTextEditUI( 'add' ); |
502 | 502 | } ) |
503 | 503 | }, |
— | — | @@ -505,61 +505,38 @@ |
506 | 506 | * Get line item (li) from source object |
507 | 507 | * @param {Object} source Source to get menu line item from |
508 | 508 | */ |
509 | | - getLiSource: function( source ){ |
| 509 | + getLiSource: function( source ) { |
510 | 510 | var _this = this; |
511 | 511 | //See if the source is currently "on" |
512 | 512 | var source_icon = ( this.isSourceEnabled( source ) )? 'bullet' : 'radio-on'; |
513 | 513 | |
514 | | - if( source.title ){ |
515 | | - return this.getLi( source.title, source_icon, function(){ |
| 514 | + if( source.title ) { |
| 515 | + return $j.getLineItem( source.title, source_icon, function() { |
516 | 516 | mw.log(" call selectTextSource"); |
517 | 517 | _this.selectTextSource( source ); |
518 | 518 | }); |
519 | 519 | } |
520 | 520 | |
521 | | - if( source.lang ){ |
| 521 | + if( source.lang ) { |
522 | 522 | var langKey = source.lang.toLowerCase(); |
523 | 523 | _this.getLanguageName ( langKey ); |
524 | | - return this.getLi( |
| 524 | + return $j.getLineItem( |
525 | 525 | gM('mwe-key-language', [langKey, unescape( mw.languages[ source.lang ] ) ] ), |
526 | 526 | source_icon, |
527 | | - function(){ |
| 527 | + function() { |
528 | 528 | mw.log(" call selectTextSource"); |
529 | 529 | _this.selectTextSource( source ); |
530 | 530 | } |
531 | 531 | ); |
532 | 532 | } |
533 | | - }, |
| 533 | + }, |
534 | 534 | |
535 | 535 | /** |
536 | | - * Get line item ( li ) from text string |
537 | | - * @param {String} string Text to display for the menu item |
538 | | - * @param {String} icon jQuery UI icon key displayed to the left of the menu item |
539 | | - * @param {Function} callback Function called once the line item is selected |
540 | | - */ |
541 | | - getLi: function( string, icon , callback){ |
542 | | - var $li = $j( '<li>' ).append( |
543 | | - $j('<a>') |
544 | | - .attr('href', '#') |
545 | | - .click( callback ) |
546 | | - ) |
547 | | - if( icon ){ |
548 | | - $li.find( 'a' ).append( |
549 | | - $j('<span style="float:left;"></span>') |
550 | | - .addClass( 'ui-icon ui-icon-' + icon ) |
551 | | - ) |
552 | | - } |
553 | | - $li.find( 'a' ).append( $j('<span>').text( string ) ); |
554 | | - //mw.log(' li html: ' + $j('<div>').append( $li ).html() ); |
555 | | - return $li; |
556 | | - }, |
557 | | - |
558 | | - /** |
559 | 536 | * Get lagnuage name from language key |
560 | 537 | * @param {String} lang_key Language key |
561 | 538 | */ |
562 | | - getLanguageName: function( lang_key ){ |
563 | | - if( mw.languages[ lang_key ]){ |
| 539 | + getLanguageName: function( lang_key ) { |
| 540 | + if( mw.languages[ lang_key ]) { |
564 | 541 | return mw.languages[ lang_key ]; |
565 | 542 | } |
566 | 543 | return false |
— | — | @@ -570,7 +547,7 @@ |
571 | 548 | * @return {Object} |
572 | 549 | * The jquery menu dom object |
573 | 550 | */ |
574 | | - getLayoutMenu: function(){ |
| 551 | + getLayoutMenu: function() { |
575 | 552 | var _this = this; |
576 | 553 | var layoutOptions = [ ]; |
577 | 554 | |
— | — | @@ -583,13 +560,13 @@ |
584 | 561 | layoutOptions.push( 'off' ); |
585 | 562 | |
586 | 563 | $ul = $j('<ul>'); |
587 | | - $j.each( layoutOptions, function( na, layoutMode ){ |
| 564 | + $j.each( layoutOptions, function( na, layoutMode ) { |
588 | 565 | var icon = ( _this.config.layout == layoutMode ) ? 'bullet' : 'radio-on'; |
589 | 566 | $ul.append( |
590 | | - _this.getLi( |
| 567 | + $j.getLineItem( |
591 | 568 | gM( 'mwe-layout-' + layoutMode), |
592 | 569 | icon, |
593 | | - function(){ |
| 570 | + function() { |
594 | 571 | _this.selectLayout( layoutMode ); |
595 | 572 | } ) |
596 | 573 | ) |
— | — | @@ -601,9 +578,9 @@ |
602 | 579 | * Select a new layout |
603 | 580 | * @param {Object} layoutMode The selected layout mode |
604 | 581 | */ |
605 | | - selectLayout: function( layoutMode ){ |
| 582 | + selectLayout: function( layoutMode ) { |
606 | 583 | var _this = this; |
607 | | - if( layoutMode != _this.config.layout ){ |
| 584 | + if( layoutMode != _this.config.layout ) { |
608 | 585 | // Update the config and redraw layout |
609 | 586 | _this.config.layout = layoutMode; |
610 | 587 | |
— | — | @@ -618,7 +595,7 @@ |
619 | 596 | /** |
620 | 597 | * Updates the timed text layout ( should be called when config.layout changes ) |
621 | 598 | */ |
622 | | - updateLayout: function(){ |
| 599 | + updateLayout: function() { |
623 | 600 | var $playerTarget = this.embedPlayer.$interface; |
624 | 601 | $playerTarget.find('.itext').remove(); |
625 | 602 | this.refreshDisplay(); |
— | — | @@ -629,7 +606,7 @@ |
630 | 607 | * |
631 | 608 | * @param {Object} source Source object selected |
632 | 609 | */ |
633 | | - selectTextSource: function( source ){ |
| 610 | + selectTextSource: function( source ) { |
634 | 611 | var _this = this; |
635 | 612 | mw.log(" select source: " + source.lang ); |
636 | 613 | |
— | — | @@ -652,7 +629,7 @@ |
653 | 630 | $playerTarget.find('.itext').text( gM('mwe-loading-text') ); |
654 | 631 | } |
655 | 632 | // Load the text: |
656 | | - source.load( function(){ |
| 633 | + source.load( function() { |
657 | 634 | // Refresh the interface: |
658 | 635 | _this.refreshDisplay(); |
659 | 636 | }) |
— | — | @@ -661,11 +638,11 @@ |
662 | 639 | /** |
663 | 640 | * Refresh the display, updates the timedText layout, menu, and text display |
664 | 641 | */ |
665 | | - refreshDisplay: function(){ |
| 642 | + refreshDisplay: function() { |
666 | 643 | // Empty out previous text to force an interface update: |
667 | 644 | this.prevText = []; |
668 | 645 | // Refresh the Menu (if it has a target to refresh) |
669 | | - if( this.menuTarget ){ |
| 646 | + if( this.menuTarget ) { |
670 | 647 | this.bindMenu( this.menuTarget, false ) |
671 | 648 | } |
672 | 649 | // Issues a "monitor" command to update the timed text for the new layout |
— | — | @@ -676,7 +653,7 @@ |
677 | 654 | * Builds the language source list menu |
678 | 655 | * checks all text sources for category and language key attribute |
679 | 656 | */ |
680 | | - getLanguageMenu: function(){ |
| 657 | + getLanguageMenu: function() { |
681 | 658 | var _this = this; |
682 | 659 | |
683 | 660 | // See if we have categories to worry about: |
— | — | @@ -686,10 +663,10 @@ |
687 | 664 | var sourcesWithoutCategory = [ ]; |
688 | 665 | for( var i in this.textSources ) { |
689 | 666 | var source = this.textSources[ i ]; |
690 | | - if( source.category ){ |
| 667 | + if( source.category ) { |
691 | 668 | var catKey = source.category ; |
692 | 669 | // Init Category menu item if it does not already exist: |
693 | | - if( !catSourceList[ catKey ] ){ |
| 670 | + if( !catSourceList[ catKey ] ) { |
694 | 671 | // Set up catList pointer: |
695 | 672 | catSourceList[ catKey ] = [ ] |
696 | 673 | } |
— | — | @@ -703,24 +680,24 @@ |
704 | 681 | } |
705 | 682 | var $langMenu = $j('<ul>'); |
706 | 683 | // Check if we have multiple categories ( if not just list them under the parent menu item) |
707 | | - if( catSourceList.length > 1 ){ |
708 | | - for(var catKey in catSourceList){ |
| 684 | + if( catSourceList.length > 1 ) { |
| 685 | + for(var catKey in catSourceList) { |
709 | 686 | $catChildren = $j('<ul>'); |
710 | | - for(var i in catSourceList[ catKey ]){ |
| 687 | + for(var i in catSourceList[ catKey ]) { |
711 | 688 | $catChildren.append( |
712 | 689 | catSourceList[ catKey ][i] |
713 | 690 | ) |
714 | 691 | } |
715 | 692 | // Append a cat menu item for each category list |
716 | 693 | $langMenu.append( |
717 | | - _this.getLi( gM( 'mwe-textcat-' + catKey.toLowerCase() ) ).append( |
| 694 | + $j.getLineItem( gM( 'mwe-textcat-' + catKey.toLowerCase() ) ).append( |
718 | 695 | $catChildren |
719 | 696 | ) |
720 | 697 | ); |
721 | 698 | } |
722 | 699 | } else { |
723 | | - for(var catKey in catSourceList){ |
724 | | - for(var i in catSourceList[ catKey ]){ |
| 700 | + for(var catKey in catSourceList) { |
| 701 | + for(var i in catSourceList[ catKey ]) { |
725 | 702 | $langMenu.append( |
726 | 703 | catSourceList[ catKey ][i] |
727 | 704 | ) |
— | — | @@ -728,7 +705,7 @@ |
729 | 706 | } |
730 | 707 | } |
731 | 708 | |
732 | | - for(var i in sourcesWithoutCategory){ |
| 709 | + for(var i in sourcesWithoutCategory) { |
733 | 710 | $langMenu.append( sourcesWithoutCategory[i] ) |
734 | 711 | } |
735 | 712 | |
— | — | @@ -744,7 +721,7 @@ |
745 | 722 | * Updates a source display in the interface for a given time |
746 | 723 | * @param {Object} source Source to update |
747 | 724 | */ |
748 | | - updateSourceDisplay: function ( source, time ){ |
| 725 | + updateSourceDisplay: function ( source, time ) { |
749 | 726 | // Get the source text for the requested time: |
750 | 727 | var text = source.getTimedText( time ); |
751 | 728 | |
— | — | @@ -757,7 +734,7 @@ |
758 | 735 | var $playerTarget = this.embedPlayer.$interface; |
759 | 736 | var $textTarget = $playerTarget.find( '.itext_' + source.category + ' span' ); |
760 | 737 | // If we are missing the target add it: |
761 | | - if( $textTarget.length == 0){ |
| 738 | + if( $textTarget.length == 0) { |
762 | 739 | this.addItextDiv( source.category ) |
763 | 740 | // Re-grab the textTarget: |
764 | 741 | $textTarget = $playerTarget.find( '.itext_' + source.category + ' span' ); |
— | — | @@ -765,11 +742,11 @@ |
766 | 743 | |
767 | 744 | |
768 | 745 | // If text is "false" fade out the subtitle: |
769 | | - if( text === false ){ |
| 746 | + if( text === false ) { |
770 | 747 | $textTarget.fadeOut('fast'); |
771 | 748 | }else{ |
772 | 749 | // Fade in the target if not visible |
773 | | - if( ! $textTarget.is(':visible') ){ |
| 750 | + if( ! $textTarget.is(':visible') ) { |
774 | 751 | $textTarget.fadeIn('fast'); |
775 | 752 | } |
776 | 753 | // Update text ( use "html" instead of "text" so that parsers can swap in html for formating |
— | — | @@ -784,7 +761,7 @@ |
785 | 762 | /** |
786 | 763 | * Add an itext div to the embedPlayer |
787 | 764 | */ |
788 | | - addItextDiv: function( category ){ |
| 765 | + addItextDiv: function( category ) { |
789 | 766 | mw.log(" addItextDiv: " + category ) |
790 | 767 | // Get the relative positioned player class from the ctrlBuilder: |
791 | 768 | var $playerTarget = this.embedPlayer.$interface; |
— | — | @@ -794,7 +771,7 @@ |
795 | 772 | |
796 | 773 | // Setup the display text div: |
797 | 774 | var layoutMode = this.getLayoutMode(); |
798 | | - if( layoutMode == 'ontop' ){ |
| 775 | + if( layoutMode == 'ontop' ) { |
799 | 776 | $playerTarget.append( |
800 | 777 | $j('<div>').addClass( 'itext' + ' ' + 'itext_' + category ) |
801 | 778 | .css( { |
— | — | @@ -816,7 +793,7 @@ |
817 | 794 | this.embedPlayer.$interface.animate({ |
818 | 795 | 'height': this.embedPlayer.height + this.embedPlayer.ctrlBuilder.height |
819 | 796 | }) |
820 | | - }else if ( layoutMode == 'below'){ |
| 797 | + }else if ( layoutMode == 'below') { |
821 | 798 | // Append before controls: |
822 | 799 | $playerTarget.find( '.control-bar' ).before( |
823 | 800 | $j('<div>').addClass( 'itext' + ' ' + 'itext_' + category ) |
— | — | @@ -852,7 +829,7 @@ |
853 | 830 | * @param {Object} source Source object to extend |
854 | 831 | * @param {Object} {Optional} textProvider The text provider interface ( to load source from api ) |
855 | 832 | */ |
856 | | - TextSource = function( source , textProvider){ |
| 833 | + TextSource = function( source , textProvider) { |
857 | 834 | return this.init( source, textProvider ); |
858 | 835 | } |
859 | 836 | TextSource.prototype = { |
— | — | @@ -872,16 +849,16 @@ |
873 | 850 | * @constructor Inherits mediaSource from embedPlayer |
874 | 851 | * @param {source} Base source element |
875 | 852 | */ |
876 | | - init: function( source , textProvider){ |
877 | | - for( var i in source){ |
| 853 | + init: function( source , textProvider) { |
| 854 | + for( var i in source) { |
878 | 855 | this[i] = source[i]; |
879 | 856 | } |
880 | 857 | // Set default category to subtitle if unset: |
881 | | - if( ! this.category ){ |
| 858 | + if( ! this.category ) { |
882 | 859 | this.category = 'SUB'; |
883 | 860 | } |
884 | 861 | //Set the textProvider if provided |
885 | | - if( textProvider ){ |
| 862 | + if( textProvider ) { |
886 | 863 | this.textProvider = textProvider; |
887 | 864 | } |
888 | 865 | }, |
— | — | @@ -890,17 +867,17 @@ |
891 | 868 | * Function to load and parse the source text |
892 | 869 | * @param {Function} callback Function called once text source is loaded |
893 | 870 | */ |
894 | | - load: function( callback ){ |
| 871 | + load: function( callback ) { |
895 | 872 | var _this = this; |
896 | 873 | |
897 | 874 | //check if its already loaded: |
898 | | - if( _this.loaded ){ |
899 | | - if( callback ){ |
| 875 | + if( _this.loaded ) { |
| 876 | + if( callback ) { |
900 | 877 | callback(); |
901 | 878 | } |
902 | 879 | } |
903 | 880 | // Set parser handler: |
904 | | - switch( this.getMIMEType() ){ |
| 881 | + switch( this.getMIMEType() ) { |
905 | 882 | //Special mediaWiki srt format ( support wiki-text in srt's ) |
906 | 883 | case 'text/mw-srt': |
907 | 884 | var handler = parseMwSrt; |
— | — | @@ -915,23 +892,23 @@ |
916 | 893 | var hanlder = null; |
917 | 894 | break; |
918 | 895 | } |
919 | | - if( !handler ){ |
| 896 | + if( !handler ) { |
920 | 897 | mw.log("Error: no handler for type: " + this.getMIMEType() ); |
921 | 898 | return ; |
922 | 899 | } |
923 | 900 | // Try to load src via src attr: |
924 | | - if( this.getSrc() ){ |
| 901 | + if( this.getSrc() ) { |
925 | 902 | // Issue the direct load request ( if we can ) |
926 | | - if ( !mw.isLocalDomain( this.getSrc() ) ){ |
| 903 | + if ( !mw.isLocalDomain( this.getSrc() ) ) { |
927 | 904 | mw.log("Error: cant load crossDomain src:" + this.getSrc() ) |
928 | 905 | return ; |
929 | 906 | } |
930 | | - $j.get( this.getSrc(), function( data ){ |
| 907 | + $j.get( this.getSrc(), function( data ) { |
931 | 908 | // Parse and load captions: |
932 | 909 | _this.captions = handler( data ); |
933 | 910 | // Update the loaded state: |
934 | 911 | _this.loaded = true; |
935 | | - if( callback ){ |
| 912 | + if( callback ) { |
936 | 913 | callback(); |
937 | 914 | } |
938 | 915 | }, 'text' ); |
— | — | @@ -939,12 +916,12 @@ |
940 | 917 | } |
941 | 918 | |
942 | 919 | // Try to load src via textProvider: |
943 | | - if( this.textProvider && this.titleKey ){ |
944 | | - this.textProvider.loadTitleKey( this.titleKey, function( data ){ |
945 | | - if( data ){ |
| 920 | + if( this.textProvider && this.titleKey ) { |
| 921 | + this.textProvider.loadTitleKey( this.titleKey, function( data ) { |
| 922 | + if( data ) { |
946 | 923 | _this.captions = handler( data ); |
947 | 924 | } |
948 | | - if( callback ){ |
| 925 | + if( callback ) { |
949 | 926 | callback(); |
950 | 927 | } |
951 | 928 | return ; |
— | — | @@ -957,21 +934,21 @@ |
958 | 935 | * |
959 | 936 | * @param {String} time Time in seconds |
960 | 937 | */ |
961 | | - getTimedText: function ( time ){ |
| 938 | + getTimedText: function ( time ) { |
962 | 939 | var prevCaption = this.captions[ this.prevIndex ]; |
963 | 940 | |
964 | 941 | // Setup the startIndex: |
965 | | - if( prevCaption && time >= prevCaption.start ){ |
| 942 | + if( prevCaption && time >= prevCaption.start ) { |
966 | 943 | var startIndex = this.prevIndex; |
967 | 944 | }else{ |
968 | 945 | //If a backwards seek start searching at the start: |
969 | 946 | var startIndex = 0; |
970 | 947 | } |
971 | 948 | // Start looking for the text via time, return first match: |
972 | | - for( var i = startIndex ; i < this.captions.length; i ++ ){ |
| 949 | + for( var i = startIndex ; i < this.captions.length; i ++ ) { |
973 | 950 | caption = this.captions[ i ]; |
974 | 951 | if( time >= caption.start && |
975 | | - time <= caption.end ){ |
| 952 | + time <= caption.end ) { |
976 | 953 | this.prevIndex = i; |
977 | 954 | return caption.content; |
978 | 955 | } |
— | — | @@ -984,12 +961,12 @@ |
985 | 962 | * parse mediaWiki html srt |
986 | 963 | * @param {Object} data XML data string to be parsed |
987 | 964 | */ |
988 | | - function parseMwSrt( data ){ |
| 965 | + function parseMwSrt( data ) { |
989 | 966 | var captions = [ ]; |
990 | 967 | var curentCap = []; |
991 | 968 | var parseNextAsTime = false; |
992 | 969 | // Optimize: we could use javascript strings functions instead of jQuery XML parsing: |
993 | | - $j( '<div>' + data + '</div>' ).find('p').each( function(){ |
| 970 | + $j( '<div>' + data + '</div>' ).find('p').each( function() { |
994 | 971 | currentPtext = $j(this).html(); |
995 | 972 | //mw.log( 'pText: ' + currentPtext ); |
996 | 973 | |
— | — | @@ -1012,7 +989,7 @@ |
1013 | 990 | return 'next'; |
1014 | 991 | } |
1015 | 992 | // Else check for multi-line match: |
1016 | | - if( parseInt( currentPtext ) == currentPtext ){ |
| 993 | + if( parseInt( currentPtext ) == currentPtext ) { |
1017 | 994 | if( curentCap.length != 0) { |
1018 | 995 | captions.push( curentCap ); |
1019 | 996 | } |
— | — | @@ -1037,12 +1014,12 @@ |
1038 | 1015 | return 'next'; |
1039 | 1016 | } |
1040 | 1017 | //Else content for the curentCap |
1041 | | - if( currentPtext != '<br>' ){ |
| 1018 | + if( currentPtext != '<br>' ) { |
1042 | 1019 | curentCap['content'] += currentPtext; |
1043 | 1020 | } |
1044 | 1021 | }); |
1045 | 1022 | //Push last subtitle: |
1046 | | - if( curentCap.length != 0){ |
| 1023 | + if( curentCap.length != 0) { |
1047 | 1024 | captions.push( curentCap ); |
1048 | 1025 | } |
1049 | 1026 | return captions; |
— | — | @@ -1107,7 +1084,7 @@ |
1108 | 1085 | * CMML parser handle |
1109 | 1086 | * @param {Mixed} data String or XML tree of CMML data to be parsed |
1110 | 1087 | */ |
1111 | | - function parseCMML( data ){ |
| 1088 | + function parseCMML( data ) { |
1112 | 1089 | var captions = [ ]; |
1113 | 1090 | $j( data ).find( 'clip' ).each( function( inx, clip ) { |
1114 | 1091 | var content, start, end; |
— | — | @@ -1140,11 +1117,11 @@ |
1141 | 1118 | * |
1142 | 1119 | |
1143 | 1120 | // Will add a base class once we are serving more than just mediaWiki "commons" |
1144 | | - mw.BaseTextProvider = function(){ |
| 1121 | + mw.BaseTextProvider = function() { |
1145 | 1122 | return this.init(); |
1146 | 1123 | } |
1147 | 1124 | mw.BaseTextProvider.prototype = { |
1148 | | - init: function(){ |
| 1125 | + init: function() { |
1149 | 1126 | |
1150 | 1127 | } |
1151 | 1128 | } |
— | — | @@ -1157,7 +1134,7 @@ |
1158 | 1135 | 'embedPlayer' |
1159 | 1136 | ]; |
1160 | 1137 | |
1161 | | - mw.MediaWikiTextProvider = function( options ){ |
| 1138 | + mw.MediaWikiTextProvider = function( options ) { |
1162 | 1139 | this.init( options ) |
1163 | 1140 | } |
1164 | 1141 | mw.MediaWikiTextProvider.prototype = { |
— | — | @@ -1172,8 +1149,8 @@ |
1173 | 1150 | * @constructor |
1174 | 1151 | * @param {Object} options Set of options for the provider |
1175 | 1152 | */ |
1176 | | - init: function( options ){ |
1177 | | - for(var i in default_textProvider_attr){ |
| 1153 | + init: function( options ) { |
| 1154 | + for(var i in default_textProvider_attr) { |
1178 | 1155 | var attr = default_textProvider_attr[ i ]; |
1179 | 1156 | if( options[ attr ] ) |
1180 | 1157 | this[ attr ] = options[ attr ]; |
— | — | @@ -1185,12 +1162,12 @@ |
1186 | 1163 | * Loads a single text source by titleKey |
1187 | 1164 | * @param {titleKey} |
1188 | 1165 | */ |
1189 | | - loadTitleKey: function( titleKey, callback ){ |
| 1166 | + loadTitleKey: function( titleKey, callback ) { |
1190 | 1167 | var request = { |
1191 | 1168 | 'action': 'parse', |
1192 | 1169 | 'page': titleKey |
1193 | 1170 | }; |
1194 | | - mw.getJSON( this.api_url, request, function( data ){ |
| 1171 | + mw.getJSON( this.api_url, request, function( data ) { |
1195 | 1172 | if ( data && data.parse && data.parse.text['*'] ) { |
1196 | 1173 | callback( data.parse.text['*'] ); |
1197 | 1174 | return; |
— | — | @@ -1205,11 +1182,11 @@ |
1206 | 1183 | * |
1207 | 1184 | * @param {String} assetKey For mediaWiki the assetKey is the "wiki title" |
1208 | 1185 | */ |
1209 | | - loadSources: function( assetKey, callback ){ |
| 1186 | + loadSources: function( assetKey, callback ) { |
1210 | 1187 | var request = {}; |
1211 | 1188 | var _this = this; |
1212 | | - this.getSourcePages( assetKey, function( sourcePages ){ |
1213 | | - if( ! sourcePages.query.allpages ){ |
| 1189 | + this.getSourcePages( assetKey, function( sourcePages ) { |
| 1190 | + if( ! sourcePages.query.allpages ) { |
1214 | 1191 | //Check if a shared asset |
1215 | 1192 | mw.log( 'no subtitle pages found'); |
1216 | 1193 | callback(); |
— | — | @@ -1225,7 +1202,7 @@ |
1226 | 1203 | * @param {String} titleKey Title to get subtitles for |
1227 | 1204 | * @param {Function} callback Function to call once NS subs are grabbed |
1228 | 1205 | */ |
1229 | | - getSourcePages: function( titleKey, callback ){ |
| 1206 | + getSourcePages: function( titleKey, callback ) { |
1230 | 1207 | var _this = this; |
1231 | 1208 | var request = { |
1232 | 1209 | 'list' : 'allpages', |
— | — | @@ -1268,7 +1245,7 @@ |
1269 | 1246 | |
1270 | 1247 | //NOTE: we hard code the mw-srt type |
1271 | 1248 | // ( This is because mediaWiki srt files can have wiki-text and parsed as such ) |
1272 | | - if( extension == 'srt' ){ |
| 1249 | + if( extension == 'srt' ) { |
1273 | 1250 | extension = 'mw-srt'; |
1274 | 1251 | } |
1275 | 1252 | |
— | — | @@ -1288,7 +1265,7 @@ |
1289 | 1266 | /** |
1290 | 1267 | * Return the namespace (if not encoded on the page return default 102 ) |
1291 | 1268 | */ |
1292 | | - getTimedTextNS: function(){ |
| 1269 | + getTimedTextNS: function() { |
1293 | 1270 | if( this.timed_text_NS ) |
1294 | 1271 | return this.timed_text_NS; |
1295 | 1272 | if ( typeof wgNamespaceIds != 'undefined' && wgNamespaceIds['timedtext'] ) { |
— | — | @@ -1303,15 +1280,15 @@ |
1304 | 1281 | /** |
1305 | 1282 | * Get the Canonical timed text namespace text |
1306 | 1283 | */ |
1307 | | - getCanonicalTimedTextNS: function(){ |
| 1284 | + getCanonicalTimedTextNS: function() { |
1308 | 1285 | return 'TimedText'; |
1309 | 1286 | }, |
1310 | 1287 | |
1311 | 1288 | /** |
1312 | 1289 | * Check if the language is supported |
1313 | 1290 | */ |
1314 | | - isSuportedLang: function( lang_key ){ |
1315 | | - if( mw.languages[ lang_key ]){ |
| 1291 | + isSuportedLang: function( lang_key ) { |
| 1292 | + if( mw.languages[ lang_key ]) { |
1316 | 1293 | return true; |
1317 | 1294 | } |
1318 | 1295 | return false; |
— | — | @@ -1332,17 +1309,17 @@ |
1333 | 1310 | * |
1334 | 1311 | * @param {Object} options Options for the timed text menu |
1335 | 1312 | */ |
1336 | | - $.fn.timedText = function ( action, target ){ |
| 1313 | + $.fn.timedText = function ( action, target ) { |
1337 | 1314 | if( !target ) |
1338 | 1315 | options = action; |
1339 | 1316 | if( typeof options == 'undefined' ) |
1340 | 1317 | options = {}; |
1341 | 1318 | |
1342 | | - $j( this.selector ).each(function(){ |
| 1319 | + $j( this.selector ).each(function() { |
1343 | 1320 | var embedPlayer = $j(this).get(0); |
1344 | 1321 | |
1345 | 1322 | // Setup timed text for the given player: |
1346 | | - if( ! embedPlayer.timedText ){ |
| 1323 | + if( ! embedPlayer.timedText ) { |
1347 | 1324 | embedPlayer.timedText = new mw.TimedText( embedPlayer, options); |
1348 | 1325 | } |
1349 | 1326 | |
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedTextEdit.js |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | "mwe-upload-text-done-uploading" : "Done uploading" |
30 | 30 | } ); |
31 | 31 | |
32 | | -mw.TimedTextEdit = function( parentTimedText ){ |
| 32 | +mw.TimedTextEdit = function( parentTimedText ) { |
33 | 33 | return this.init( parentTimedText ); |
34 | 34 | } |
35 | 35 | mw.TimedTextEdit.prototype = { |
— | — | @@ -55,14 +55,14 @@ |
56 | 56 | * @constructor |
57 | 57 | * @param {Object} parentTimedText The parent TimedText object that called the editor |
58 | 58 | */ |
59 | | - init: function( parentTimedText ){ |
| 59 | + init: function( parentTimedText ) { |
60 | 60 | this.parentTimedText = parentTimedText; |
61 | 61 | }, |
62 | 62 | |
63 | 63 | /** |
64 | 64 | * Show the editor UI |
65 | 65 | */ |
66 | | - showUI: function(){ |
| 66 | + showUI: function() { |
67 | 67 | // Setup the parent container: |
68 | 68 | this.createDialogContainer(); |
69 | 69 | |
— | — | @@ -73,7 +73,7 @@ |
74 | 74 | /** |
75 | 75 | * Setup the dialog layout: s |
76 | 76 | */ |
77 | | - initDialog: function(){ |
| 77 | + initDialog: function() { |
78 | 78 | var _this =this; |
79 | 79 | _this.createTabs(); |
80 | 80 | }, |
— | — | @@ -81,12 +81,12 @@ |
82 | 82 | /** |
83 | 83 | * Creates interface tabs from the textEditStages |
84 | 84 | */ |
85 | | - createTabs: function(){ |
| 85 | + createTabs: function() { |
86 | 86 | var _this = this; |
87 | 87 | $tabContainer = $j( '<div />' ) |
88 | 88 | .attr( 'id', "TimedTextEdit-tabs" ) |
89 | 89 | .append( '<ul />' ); |
90 | | - for(var edit_stage_id in this.textEditStages){ |
| 90 | + for(var edit_stage_id in this.textEditStages) { |
91 | 91 | var editStage = this.textEditStages[ edit_stage_id ]; |
92 | 92 | // Append the menu item: |
93 | 93 | $tabContainer.find('ul').append( |
— | — | @@ -118,7 +118,7 @@ |
119 | 119 | $j( _this.target_container ).append( $tabContainer ); |
120 | 120 | |
121 | 121 | //Create all the "interfaces" |
122 | | - for(var edit_stage_id in this.textEditStages){ |
| 122 | + for(var edit_stage_id in this.textEditStages) { |
123 | 123 | _this.createInterface( edit_stage_id ) |
124 | 124 | } |
125 | 125 | |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | }); |
132 | 132 | |
133 | 133 | }, |
134 | | - selectTab: function( tab_id ){ |
| 134 | + selectTab: function( tab_id ) { |
135 | 135 | mw.log('sel: ' + tab_id); |
136 | 136 | }, |
137 | 137 | |
— | — | @@ -139,9 +139,9 @@ |
140 | 140 | * @return the jquery interface |
141 | 141 | * @type {Object} |
142 | 142 | */ |
143 | | - createInterface: function( edit_stage_id){ |
| 143 | + createInterface: function( edit_stage_id) { |
144 | 144 | $target = $j('#tab-' + edit_stage_id); |
145 | | - if( this[edit_stage_id + 'Interface']){ |
| 145 | + if( this[edit_stage_id + 'Interface']) { |
146 | 146 | this[ edit_stage_id + 'Interface']( $target ); |
147 | 147 | }else{ |
148 | 148 | $target.append( ' interface under development' ); |
— | — | @@ -151,7 +151,7 @@ |
152 | 152 | * Builds out and binds the upload interface to a given target |
153 | 153 | * @param {Object} $target jQuery target for the upload interface |
154 | 154 | */ |
155 | | - uploadInterface: function( $target ){ |
| 155 | + uploadInterface: function( $target ) { |
156 | 156 | var _this = this; |
157 | 157 | // Check if user has XHR file upload support & we are on the target wiki |
158 | 158 | |
— | — | @@ -214,9 +214,9 @@ |
215 | 215 | 'maxlength' : "10", |
216 | 216 | 'size' :"3" |
217 | 217 | } ) |
218 | | - .change(function(){ |
| 218 | + .change(function() { |
219 | 219 | var langKey = $j(this).val(); |
220 | | - if( mw.languages[ langKey ] ){ |
| 220 | + if( mw.languages[ langKey ] ) { |
221 | 221 | $buttonTarget.find('.btnText').text( |
222 | 222 | unescape( mw.languages[ langKey ] ) |
223 | 223 | ); |
— | — | @@ -269,7 +269,7 @@ |
270 | 270 | |
271 | 271 | // Update the preview text area: |
272 | 272 | var file = $j( '#timed-text-file-upload' ).get(0).files[0]; |
273 | | - if( file.fileSize > 1048576 ){ |
| 273 | + if( file.fileSize > 1048576 ) { |
274 | 274 | $j( '#timed-text-file-preview' ).text( 'Error the file you selected is too lage'); |
275 | 275 | return ; |
276 | 276 | } |
— | — | @@ -281,7 +281,7 @@ |
282 | 282 | var langKey = $j(this).val().split( '.' ); |
283 | 283 | var extension = langKey.pop(); |
284 | 284 | langKey = langKey.pop(); |
285 | | - if( mw.languages[ langKey ] ){ |
| 285 | + if( mw.languages[ langKey ] ) { |
286 | 286 | $buttonTarget.find('.btnText').text( |
287 | 287 | unescape( mw.languages[ langKey ] ) |
288 | 288 | ); |
— | — | @@ -304,7 +304,7 @@ |
305 | 305 | } ) |
306 | 306 | .unbind() |
307 | 307 | .buttonHover() |
308 | | - .click( function(){ |
| 308 | + .click( function() { |
309 | 309 | _this.uploadTextFile(); |
310 | 310 | }) |
311 | 311 | ); |
— | — | @@ -313,7 +313,7 @@ |
314 | 314 | /** |
315 | 315 | * Uploads the text content |
316 | 316 | */ |
317 | | - uploadTextFile: function(){ |
| 317 | + uploadTextFile: function() { |
318 | 318 | // Put a dialog ontop |
319 | 319 | mw.addLoaderDialog( gM( 'mwe-uploading-text') ); |
320 | 320 | |
— | — | @@ -325,7 +325,7 @@ |
326 | 326 | targetTitleKey = 'TimedText:' + targetTitleKey + '.' + $j('#timed-text-langKey-input').val() + '.srt'; |
327 | 327 | |
328 | 328 | // Get a token |
329 | | - mw.getToken( targetTitleKey, function( token ){ |
| 329 | + mw.getToken( targetTitleKey, function( token ) { |
330 | 330 | mw.log("got token: " + token); |
331 | 331 | var request = { |
332 | 332 | 'action' : 'edit', |
— | — | @@ -333,17 +333,17 @@ |
334 | 334 | 'text' : $j('#timed-text-file-preview').val(), |
335 | 335 | 'token': token |
336 | 336 | }; |
337 | | - mw.getJSON( request, function( data ){ |
| 337 | + mw.getJSON( request, function( data ) { |
338 | 338 | //Close the loader dialog: |
339 | 339 | mw.closeLoaderDialog(); |
340 | 340 | |
341 | | - if( data.edit && data.edit.result == 'Success' ){ |
| 341 | + if( data.edit && data.edit.result == 'Success' ) { |
342 | 342 | var buttons = { }; |
343 | | - buttons[ gM("mwe-upload-text-another")] = function(){ |
| 343 | + buttons[ gM("mwe-upload-text-another")] = function() { |
344 | 344 | // just close the current dialog: |
345 | 345 | $j( this ).dialog('close'); |
346 | 346 | } |
347 | | - buttons[ gM( "mwe-upload-text-done-uploading" ) ] = function(){ |
| 347 | + buttons[ gM( "mwe-upload-text-done-uploading" ) ] = function() { |
348 | 348 | window.location.reload(); |
349 | 349 | } |
350 | 350 | //Edit success |
— | — | @@ -374,7 +374,7 @@ |
375 | 375 | * |
376 | 376 | * ~ what really a lot of time is putting this ~into~ the dom ~ |
377 | 377 | */ |
378 | | - getLanguageList: function(){ |
| 378 | + getLanguageList: function() { |
379 | 379 | var _this = this; |
380 | 380 | var $langMenu = $j( '<ul>' ); |
381 | 381 | // Loop through all supported languages: |
— | — | @@ -382,9 +382,9 @@ |
383 | 383 | var language = mw.languages [ langKey ]; |
384 | 384 | var source_icon = 'radio-on'; |
385 | 385 | //check if the key is in the _this.parentTimedText source array |
386 | | - for( var i in _this.parentTimedText.textSources ){ |
| 386 | + for( var i in _this.parentTimedText.textSources ) { |
387 | 387 | var pSource = _this.parentTimedText.textSources[i]; |
388 | | - if( pSource.lang == langKey){ |
| 388 | + if( pSource.lang == langKey) { |
389 | 389 | source_icon = 'bullet'; |
390 | 390 | } |
391 | 391 | } |
— | — | @@ -395,11 +395,11 @@ |
396 | 396 | } |
397 | 397 | return $langMenu; |
398 | 398 | }, |
399 | | - getLangMenuItem: function( langKey , source_icon){ |
| 399 | + getLangMenuItem: function( langKey , source_icon) { |
400 | 400 | return this.parentTimedText.getLi( |
401 | 401 | langKey + ' - ' + unescape( mw.languages[ langKey ] ), |
402 | 402 | source_icon, |
403 | | - function(){ |
| 403 | + function() { |
404 | 404 | mw.log( "Selected: " + langKey ); |
405 | 405 | // Update the input box text |
406 | 406 | $j('#timed-text-langKey-input').val( langKey ); |
— | — | @@ -410,7 +410,7 @@ |
411 | 411 | /** |
412 | 412 | * Creates the interface dialog container |
413 | 413 | */ |
414 | | - createDialogContainer: function(){ |
| 414 | + createDialogContainer: function() { |
415 | 415 | var _this = this; |
416 | 416 | //Setup the target container: |
417 | 417 | _this.target_container = '#timedTextEdit_target'; |
— | — | @@ -453,7 +453,7 @@ |
454 | 454 | |
455 | 455 | }, |
456 | 456 | |
457 | | - onCancelClipEdit: function(){ |
| 457 | + onCancelClipEdit: function() { |
458 | 458 | var _this = this; |
459 | 459 | // Cancel edit |
460 | 460 | $j( _this.target_container ).dialog( 'close' ); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/remotes/RemoteMwTimedText.js |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | "mwe-language-no-subtitles-for-clip": "No $1 subtitles where found for clip: $2" |
13 | 13 | }); |
14 | 14 | |
15 | | -RemoteMwTimedText = function( options ){ |
| 15 | +RemoteMwTimedText = function( options ) { |
16 | 16 | return this.init( options ); |
17 | 17 | } |
18 | 18 | mw_default_remote_text_options = [ |
— | — | @@ -23,36 +23,36 @@ |
24 | 24 | RemoteMwTimedText.prototype = { |
25 | 25 | |
26 | 26 | init: function( options ) { |
27 | | - for(var i in mw_default_remote_text_options){ |
| 27 | + for(var i in mw_default_remote_text_options) { |
28 | 28 | var opt = mw_default_remote_text_options[i] |
29 | | - if( options[ opt ] ){ |
| 29 | + if( options[ opt ] ) { |
30 | 30 | this[ opt ] = options[ opt ]; |
31 | 31 | } |
32 | 32 | } |
33 | 33 | }, |
34 | | - updateUI: function(){ |
| 34 | + updateUI: function() { |
35 | 35 | // Check page type |
36 | | - if( this.action == 'view' ){ |
| 36 | + if( this.action == 'view' ) { |
37 | 37 | this.showViewUI(); |
38 | 38 | }else{ |
39 | 39 | //restore |
40 | 40 | } |
41 | 41 | }, |
42 | | - showViewUI: function(){ |
| 42 | + showViewUI: function() { |
43 | 43 | var _this = this; |
44 | 44 | var fileTitleKey = this.title.split('.'); |
45 | 45 | this.extension = fileTitleKey.pop(); |
46 | 46 | this.langKey = fileTitleKey.pop(); |
47 | 47 | this.fileTitleKey = fileTitleKey.join('.'); |
48 | 48 | |
49 | | - this.getTitleResource( this.fileTitleKey, function( resource ){ |
| 49 | + this.getTitleResource( this.fileTitleKey, function( resource ) { |
50 | 50 | _this.embedViewUI( resource ); |
51 | 51 | }); |
52 | 52 | }, |
53 | | - embedViewUI: function( resource ){ |
| 53 | + embedViewUI: function( resource ) { |
54 | 54 | var _this = this; |
55 | 55 | // Load the player module: |
56 | | - mw.load( 'EmbedPlayer', function(){ |
| 56 | + mw.load( 'EmbedPlayer', function() { |
57 | 57 | // Add the embed code: ( jquery wrapping of "video" fails ) |
58 | 58 | $j( _this.target ).append( |
59 | 59 | $j( '<div class="videoLoading">').html( |
— | — | @@ -73,9 +73,9 @@ |
74 | 74 | /* |
75 | 75 | * embeds a player with the current language key pre selected |
76 | 76 | */ |
77 | | - embedPlayerLang: function(){ |
| 77 | + embedPlayerLang: function() { |
78 | 78 | var _this = this; |
79 | | - if( wgArticlePath ){ |
| 79 | + if( wgArticlePath ) { |
80 | 80 | var $fileLink = $j('<div>').append( |
81 | 81 | $j('<a>').attr({ |
82 | 82 | 'href' : wgArticlePath.replace( '$1', 'File:' + _this.fileTitleKey) |
— | — | @@ -85,7 +85,7 @@ |
86 | 86 | } |
87 | 87 | |
88 | 88 | // Rewrite the player (any video tags on the page) |
89 | | - $j('#timed-text-player-embed').embedPlayer( function(){ |
| 89 | + $j('#timed-text-player-embed').embedPlayer( function() { |
90 | 90 | //Select the timed text for the page: |
91 | 91 | |
92 | 92 | //remove the loader |
— | — | @@ -94,7 +94,7 @@ |
95 | 95 | var player = $j('#timed-text-player-embed').get(0); |
96 | 96 | |
97 | 97 | |
98 | | - if( !player.timedText ){ |
| 98 | + if( !player.timedText ) { |
99 | 99 | mw.log("Error: no timedText method on embedPlayer" ); |
100 | 100 | return ; |
101 | 101 | } |
— | — | @@ -102,11 +102,11 @@ |
103 | 103 | player.timedText.config.userLanugage = this.langKey; |
104 | 104 | |
105 | 105 | // Make sure the timed text sources are loaded: |
106 | | - player.timedText.setupTextSources( function(){ |
| 106 | + player.timedText.setupTextSources( function() { |
107 | 107 | |
108 | 108 | var source = player.timedText.getSourceByLanguage( _this.langKey ); |
109 | 109 | var pageMsgKey = 'mwe-language-subtitles-for-clip'; |
110 | | - if( ! source ){ |
| 110 | + if( ! source ) { |
111 | 111 | pageMsgKey = "mwe-language-no-subtitles-for-clip" |
112 | 112 | } |
113 | 113 | // Add the page msg to the top |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | ) |
119 | 119 | ); |
120 | 120 | // Select the language if possible: |
121 | | - if( source ){ |
| 121 | + if( source ) { |
122 | 122 | player.timedText.selectTextSource( source ); |
123 | 123 | } |
124 | 124 | // Un-hide the player |
— | — | @@ -131,7 +131,7 @@ |
132 | 132 | * @param {String} fileTitle Title of media asset to embed |
133 | 133 | * @param {Function} {Optional} callback Function to call once asset is embedded |
134 | 134 | */ |
135 | | - getTitleResource: function( fileTitle, callback ){ |
| 135 | + getTitleResource: function( fileTitle, callback ) { |
136 | 136 | var _this = this; |
137 | 137 | // Get all the embed details: |
138 | 138 | var request = { |
— | — | @@ -144,7 +144,7 @@ |
145 | 145 | // (only works for commons right now) |
146 | 146 | mw.getJSON( request, function( data ) { |
147 | 147 | // Check for "page not found" |
148 | | - if( data.query.pages['-1'] ){ |
| 148 | + if( data.query.pages['-1'] ) { |
149 | 149 | //restore content: |
150 | 150 | $j(_this.target).html( _this.orgBody ); |
151 | 151 | return ; |
— | — | @@ -176,7 +176,7 @@ |
177 | 177 | /** |
178 | 178 | * Get the embed code from response resource and sends it a callback |
179 | 179 | */ |
180 | | - getResource: function( page ){ |
| 180 | + getResource: function( page ) { |
181 | 181 | return { |
182 | 182 | 'apiTitleKey' : page.title.replace(/File:/ig, '' ), |
183 | 183 | 'link' : page.imageinfo[0].descriptionurl, |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.FirefoggGUI.js |
— | — | @@ -71,7 +71,7 @@ |
72 | 72 | /** |
73 | 73 | * Setup firefoggGUI jquery binding |
74 | 74 | */ |
75 | | -( function( $ ){ |
| 75 | +( function( $ ) { |
76 | 76 | $.fn.firefoggGUI = function( options ) { |
77 | 77 | if ( !options ) |
78 | 78 | options = { }; |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.RemoteSearchDriver.js |
— | — | @@ -126,10 +126,10 @@ |
127 | 127 | // Enabled providers can be keyword 'all' or an array of enabled content provider keys |
128 | 128 | 'enabled_providers': 'all', |
129 | 129 | |
130 | | - // Enalbed license types can any set of |
| 130 | + // Enabled license types can any set of |
131 | 131 | // 'pd' (public domain), 'by' ( attribution ) , 'sa' (share alike ), |
132 | 132 | // 'nd' ( no derivatives ) |
133 | | - // 'nc' ( non-comercial ), 'all' ( all found licenses are "ok") |
| 133 | + // 'nc' ( non-commercial ), 'all' ( all found licenses are "ok") |
134 | 134 | 'enabled_licenses' : ['pd', 'by', 'sa' ], |
135 | 135 | |
136 | 136 | // Set a default provider |
— | — | @@ -156,7 +156,7 @@ |
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | | - $.addMediaWizard = function( options ){ |
| 160 | + $.addMediaWizard = function( options ) { |
161 | 161 | $.fn.addMediaWizard ( options, function( amwObj ) { |
162 | 162 | // Do the add-media-wizard display |
163 | 163 | amwObj.createUI(); |
— | — | @@ -429,7 +429,7 @@ |
430 | 430 | _this.enabled_providers = 'all'; |
431 | 431 | |
432 | 432 | // Set the current_provider from default_provider |
433 | | - if( this.default_provider && this.content_providers[ this.default_provider ] ){ |
| 433 | + if( this.default_provider && this.content_providers[ this.default_provider ] ) { |
434 | 434 | this.current_provider = this.default_provider; |
435 | 435 | } |
436 | 436 | |
— | — | @@ -561,7 +561,7 @@ |
562 | 562 | getLicenseFromUrl: function( license_url ) { |
563 | 563 | // Get the license key: |
564 | 564 | var licenseKey = this.getLicenseKeyFromUrl( license_url ); |
565 | | - if( licenseKey ){ |
| 565 | + if( licenseKey ) { |
566 | 566 | // Return the license object: |
567 | 567 | return this.getLicenseFromKey( licenseKey , license_url ); |
568 | 568 | } |
— | — | @@ -578,10 +578,10 @@ |
579 | 579 | * @parma {String} license_url License url to get key from |
580 | 580 | * @return mixed license key or false if not found. |
581 | 581 | */ |
582 | | - getLicenseKeyFromUrl: function( license_url ){ |
| 582 | + getLicenseKeyFromUrl: function( license_url ) { |
583 | 583 | // Check for some pre-defined us gov url: |
584 | 584 | if ( license_url == 'http://www.usa.gov/copyright.shtml' || |
585 | | - license_url == 'http://creativecommons.org/licenses/publicdomain' ){ |
| 585 | + license_url == 'http://creativecommons.org/licenses/publicdomain' ) { |
586 | 586 | return 'pd'; |
587 | 587 | } |
588 | 588 | // First do a direct lookup check: |
— | — | @@ -611,7 +611,7 @@ |
612 | 612 | return false; |
613 | 613 | var licenseSet = licenseKey.split( '-' ); |
614 | 614 | for ( var i = 0; i < licenseSet.length; i++ ) { |
615 | | - if( $j.inArray( licenseSet[i], this.enabled_licenses ) == -1){ |
| 615 | + if( $j.inArray( licenseSet[i], this.enabled_licenses ) == -1) { |
616 | 616 | return false; |
617 | 617 | } |
618 | 618 | } |
— | — | @@ -664,7 +664,7 @@ |
665 | 665 | |
666 | 666 | // Setup the parent container (if not already created) |
667 | 667 | mw.log(" looking for: " + _this.target_container); |
668 | | - if( !_this.target_container || $j( _this.target_container ).length == 0 ){ |
| 668 | + if( !_this.target_container || $j( _this.target_container ).length == 0 ) { |
669 | 669 | this.createDialogContainer(); |
670 | 670 | }else{ |
671 | 671 | // Empty out the target |
— | — | @@ -914,7 +914,7 @@ |
915 | 915 | text: gM( 'mwe-media_search' ) }) |
916 | 916 | .addClass( 'rsd_search_button' ) |
917 | 917 | .buttonHover() |
918 | | - .click(function (){ |
| 918 | + .click(function () { |
919 | 919 | _this.updateResults( _this.current_provider, true ); |
920 | 920 | return false; |
921 | 921 | }); |
— | — | @@ -978,7 +978,7 @@ |
979 | 979 | if ( this.content_providers['upload'].enabled) { |
980 | 980 | $uploadButton = $j.button( { icon_id: 'disk', text: gM( 'mwe-upload_tab' ) }) |
981 | 981 | .addClass("rsd_upload_button") |
982 | | - .click(function(){ |
| 982 | + .click(function() { |
983 | 983 | _this.current_provider = 'upload'; |
984 | 984 | _this.updateUploadResults( ); |
985 | 985 | return false; |
— | — | @@ -1502,7 +1502,7 @@ |
1503 | 1503 | /** |
1504 | 1504 | * Show failure |
1505 | 1505 | */ |
1506 | | - showFailure : function( resultStatus ){ |
| 1506 | + showFailure : function( resultStatus ) { |
1507 | 1507 | //only one type of resultStatus right now: |
1508 | 1508 | if( resultStatus == 'timeout' ) |
1509 | 1509 | $j( '#tab-' + this.current_provider ).text( |
— | — | @@ -1748,8 +1748,8 @@ |
1749 | 1749 | */ |
1750 | 1750 | getMediaType: function( resource ) { |
1751 | 1751 | var types = [ 'image', 'audio', 'video']; |
1752 | | - for( var i=0; i < types.length ; i++ ){ |
1753 | | - if ( resource.mime.indexOf( types[i] ) !== -1){ |
| 1752 | + for( var i=0; i < types.length ; i++ ) { |
| 1753 | + if ( resource.mime.indexOf( types[i] ) !== -1) { |
1754 | 1754 | return types[i]; |
1755 | 1755 | } |
1756 | 1756 | } |
— | — | @@ -1993,7 +1993,7 @@ |
1994 | 1994 | |
1995 | 1995 | // Add extra space at the top if the embed player is less than 90px high |
1996 | 1996 | // bug 22189 |
1997 | | - if( $j('#embed_vid').get(0).getPlayerHeight() < 90 ){ |
| 1997 | + if( $j('#embed_vid').get(0).getPlayerHeight() < 90 ) { |
1998 | 1998 | $j( '#clip_edit_disp' ).prepend( |
1999 | 1999 | $j( '<span />' ) |
2000 | 2000 | .css({ |
— | — | @@ -2186,7 +2186,7 @@ |
2187 | 2187 | ); |
2188 | 2188 | |
2189 | 2189 | // Update video tag (if a video) |
2190 | | - if ( resource.mime.indexOf( 'video/' ) !== -1 ){ |
| 2190 | + if ( resource.mime.indexOf( 'video/' ) !== -1 ) { |
2191 | 2191 | var target_rewrite_id = $j( _this.target_container ).attr( 'id' ) + '_rsd_pv_vid'; |
2192 | 2192 | $j('#' + target_rewrite_id ).embedPlayer(); |
2193 | 2193 | } |
— | — | @@ -2223,7 +2223,7 @@ |
2224 | 2224 | mw.log( "do import asset:" + _this.import_url_mode ); |
2225 | 2225 | // check import mode: |
2226 | 2226 | if ( _this.import_url_mode == 'api' ) { |
2227 | | - _this.doApiImport( resource, function(){ |
| 2227 | + _this.doApiImport( resource, function() { |
2228 | 2228 | $j( '#rsd_resource_import' ).remove(); |
2229 | 2229 | _this.clipEdit.updateInsertControlActions(); |
2230 | 2230 | callback |
— | — | @@ -2249,7 +2249,7 @@ |
2250 | 2250 | /** |
2251 | 2251 | * Get the resource Import interface |
2252 | 2252 | */ |
2253 | | - getResourceImportInterface: function( resource, description ){ |
| 2253 | + getResourceImportInterface: function( resource, description ) { |
2254 | 2254 | var _this = this; |
2255 | 2255 | var $rsdResourceImport = $j('<div />') |
2256 | 2256 | .attr( 'id', 'rsd_resource_import' ) |
— | — | @@ -2386,7 +2386,7 @@ |
2387 | 2387 | * Get Template Description wikitext |
2388 | 2388 | * @pram {Object} resource Resource source for description |
2389 | 2389 | */ |
2390 | | - getTemplateDescription: function( resource ){ |
| 2390 | + getTemplateDescription: function( resource ) { |
2391 | 2391 | // setup the resource description from resource description: |
2392 | 2392 | // FIXME: i18n, namespace |
2393 | 2393 | var description = '{{Information ' + "\n"; |
— | — | @@ -2441,7 +2441,7 @@ |
2442 | 2442 | mw.getJSON( mw.getLocalApiUrl(), request, function( data ) { |
2443 | 2443 | if ( data.query.pages ) { |
2444 | 2444 | for ( var i in data.query.pages ) { |
2445 | | - if( i == '-1' ){ |
| 2445 | + if( i == '-1' ) { |
2446 | 2446 | callback( false ); |
2447 | 2447 | return ; |
2448 | 2448 | } |
— | — | @@ -2521,7 +2521,7 @@ |
2522 | 2522 | |
2523 | 2523 | // If status is missing show import UI |
2524 | 2524 | if ( status === 'missing' ) { |
2525 | | - _this.showImportUI( resource, function(){ |
| 2525 | + _this.showImportUI( resource, function() { |
2526 | 2526 | // Once the image is imported re-issue the showPreview request: |
2527 | 2527 | _this.showPreview( resource ); |
2528 | 2528 | } ); |
— | — | @@ -2588,8 +2588,8 @@ |
2589 | 2589 | _this.target_title, |
2590 | 2590 | function( phtml ) { |
2591 | 2591 | $j( '#rsd_preview_display' ).html( phtml ); |
2592 | | - if( mw.documentHasPlayerTags() ){ |
2593 | | - mw.load( 'EmbedPlayer', function(){ |
| 2592 | + if( mw.documentHasPlayerTags() ) { |
| 2593 | + mw.load( 'EmbedPlayer', function() { |
2594 | 2594 | // Update the display of video tag items (if any) |
2595 | 2595 | $j( mw.getConfig( 'rewritePlayerTags' ) ).embedPlayer(); |
2596 | 2596 | }); |
— | — | @@ -2665,7 +2665,7 @@ |
2666 | 2666 | * |
2667 | 2667 | * @param {Object} resource Resource to be inserted into the output targets |
2668 | 2668 | */ |
2669 | | - insertResourceToOutput: function( resource ){ |
| 2669 | + insertResourceToOutput: function( resource ) { |
2670 | 2670 | var _this = this; |
2671 | 2671 | var embed_code = _this.getEmbedCode( resource ); |
2672 | 2672 | $j( _this.target_textbox ).textSelection( 'encapsulateSelection', { 'post' : embed_code } ); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/jquery.simpleUploadForm.js |
— | — | @@ -137,7 +137,7 @@ |
138 | 138 | |
139 | 139 | // Set up the binding per the config |
140 | 140 | if ( options.enable_fogg ) { |
141 | | - mw.load( 'AddMedia.firefogg', function(){ |
| 141 | + mw.load( 'AddMedia.firefogg', function() { |
142 | 142 | $j( "#wpUploadFile" ).firefogg( { |
143 | 143 | // An api url (we won't submit directly to action of the form) |
144 | 144 | 'api_url' : options.api_target, |
— | — | @@ -151,13 +151,13 @@ |
152 | 152 | warn_target: "#wpDestFile-warning" |
153 | 153 | } ); |
154 | 154 | }, |
155 | | - 'onsubmit_cb' : function( ){ |
| 155 | + 'onsubmit_cb' : function( ) { |
156 | 156 | // Update with basic info template: |
157 | 157 | // TODO: it would be nice to have a template generator class |
158 | 158 | var desc = $j('#wpUploadDescription').val(); |
159 | 159 | |
160 | 160 | // Update the template if the user does not already have template code: |
161 | | - if( desc.indexOf('{{Information') == -1){ |
| 161 | + if( desc.indexOf('{{Information') == -1) { |
162 | 162 | $j('#wpUploadDescription').val( |
163 | 163 | '== {{int:filedesc}} ==' + "\n" + |
164 | 164 | '{{Information' + "\n" + |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadHandler.js |
— | — | @@ -68,9 +68,9 @@ |
69 | 69 | /** |
70 | 70 | * Setup upload jQuery binding |
71 | 71 | */ |
72 | | -( function( $ ){ |
| 72 | +( function( $ ) { |
73 | 73 | $.fn.uploadHandler = function( options ) { |
74 | | - if ( !options ){ |
| 74 | + if ( !options ) { |
75 | 75 | options = { }; |
76 | 76 | } |
77 | 77 | |
— | — | @@ -133,7 +133,7 @@ |
134 | 134 | $j.extend( this, default_bui_options, options ); |
135 | 135 | |
136 | 136 | // Set a api_url if unset |
137 | | - if( !this.api_url ){ |
| 137 | + if( !this.api_url ) { |
138 | 138 | this.api_url = mw.getLocalApiUrl(); |
139 | 139 | } |
140 | 140 | // Setup the UploadInterface handler |
— | — | @@ -189,7 +189,7 @@ |
190 | 190 | } |
191 | 191 | |
192 | 192 | // Call the onsubmit_cb option if set: |
193 | | - if( this.onsubmit_cb && typeof this.onsubmit_cb == 'function' ){ |
| 193 | + if( this.onsubmit_cb && typeof this.onsubmit_cb == 'function' ) { |
194 | 194 | this.onsubmit_cb(); |
195 | 195 | } |
196 | 196 | |
— | — | @@ -319,7 +319,7 @@ |
320 | 320 | // |
321 | 321 | mw.log("remapFormToApi:: " + this.api_url + ' form: ' + this.form); |
322 | 322 | |
323 | | - if ( !this.api_url ){ |
| 323 | + if ( !this.api_url ) { |
324 | 324 | mw.log( 'Error: no api url target' ); |
325 | 325 | return false; |
326 | 326 | } |
— | — | @@ -328,12 +328,12 @@ |
329 | 329 | // Set the form action |
330 | 330 | try{ |
331 | 331 | $form.attr('action', _this.api_url); |
332 | | - }catch(e){ |
| 332 | + }catch(e) { |
333 | 333 | mw.log("IE for some reason error's out when you change the action") |
334 | 334 | } |
335 | 335 | |
336 | 336 | // Add API action |
337 | | - if ( $form.find( "[name='action']" ).length == 0 ){ |
| 337 | + if ( $form.find( "[name='action']" ).length == 0 ) { |
338 | 338 | $form.append( |
339 | 339 | $j('<input />') |
340 | 340 | .attr({ |
— | — | @@ -345,7 +345,7 @@ |
346 | 346 | } |
347 | 347 | |
348 | 348 | // Add JSON response format |
349 | | - if ( $form.find( "[name='format']" ).length == 0 ){ |
| 349 | + if ( $form.find( "[name='format']" ).length == 0 ) { |
350 | 350 | $form.append( |
351 | 351 | $j( '<input />' ) |
352 | 352 | .attr({ |
— | — | @@ -670,13 +670,13 @@ |
671 | 671 | * @return {String} |
672 | 672 | * value of wpUploadDescription |
673 | 673 | */ |
674 | | - getUploadDescription: function(){ |
| 674 | + getUploadDescription: function() { |
675 | 675 | //Special case of upload.js commons hack: |
676 | 676 | var comment_value = $j( '#wpUploadDescription' ).val(); |
677 | | - if( comment_value == '' ){ |
| 677 | + if( comment_value == '' ) { |
678 | 678 | comment_value = $j( "[name='wpUploadDescription']").val(); |
679 | 679 | } |
680 | | - |
| 680 | + mw.log( 'getUploadDescription:: base:' + comment_value + ' ucr:' + this.useCopyrightUpload ); |
681 | 681 | // Set license, copyStatus, source if available ( generally not available SpecialUpload needs some refactoring ) |
682 | 682 | if ( this.useCopyrightUpload ) { |
683 | 683 | var license = ( $j("[name='wpLicense']").length ) ? $j("[name='wpLicense']").val() : ''; |
— | — | @@ -686,8 +686,8 @@ |
687 | 687 | // Run the JS equivalent of SpecialUpload.php getInitialPageText |
688 | 688 | comment_value = this.getCommentText( comment_value, license, copyStatus, source ); |
689 | 689 | } |
690 | | - |
691 | | - return comment_value; |
| 690 | + mw.log( 'getCommentText:: new val:' + comment_value ); |
| 691 | + return comment_value; |
692 | 692 | }, |
693 | 693 | |
694 | 694 | /** |
— | — | @@ -700,7 +700,7 @@ |
701 | 701 | * @param {String} copyStatus the copyright status field |
702 | 702 | * @param {String} source The source filed |
703 | 703 | */ |
704 | | - getCommentText: function( comment, license, copyStatus, source ){ |
| 704 | + getCommentText: function( comment, license, copyStatus, source ) { |
705 | 705 | var licensetxt = ''; |
706 | 706 | if ( license != '' ) { |
707 | 707 | licensetxt = '== ' + gM( 'license-header' ) + " ==\n" + '{{' + license + '}}' + "\n"; |
— | — | @@ -1011,11 +1011,11 @@ |
1012 | 1012 | mw.log( 'doDestCheck::' + _this.selector ); |
1013 | 1013 | |
1014 | 1014 | // Set up option defaults |
1015 | | - if ( !options.warn_target ){ |
| 1015 | + if ( !options.warn_target ) { |
1016 | 1016 | options.warn_target = '#wpDestFile-warning'; |
1017 | 1017 | } |
1018 | 1018 | |
1019 | | - if( ! options.api_url ){ |
| 1019 | + if( ! options.api_url ) { |
1020 | 1020 | options.api_url = mw.getLocalApiUrl(); |
1021 | 1021 | } |
1022 | 1022 | |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/kalturaSearch.js |
— | — | @@ -271,7 +271,7 @@ |
272 | 272 | var result = data[ result_id ]; |
273 | 273 | |
274 | 274 | // Skip the resource if the license is not compatible |
275 | | - if( result.license_url && ! _this.rsd.checkCompatibleLicense( result.license_url ) ){ |
| 275 | + if( result.license_url && ! _this.rsd.checkCompatibleLicense( result.license_url ) ) { |
276 | 276 | continue; |
277 | 277 | } |
278 | 278 | |
— | — | @@ -305,7 +305,7 @@ |
306 | 306 | */ |
307 | 307 | getImageObj: function( resource, size, callback ) { |
308 | 308 | var _this = this; |
309 | | - this.getSerachLib( resource.content_provider_id, function( searchLib ){ |
| 309 | + this.getSerachLib( resource.content_provider_id, function( searchLib ) { |
310 | 310 | searchLib.getImageObj( resource, size, callback ); |
311 | 311 | }); |
312 | 312 | }, |
— | — | @@ -314,9 +314,9 @@ |
315 | 315 | * Get extra resource info via a library specific callback |
316 | 316 | * NOTE: this info should be included in the original kaltura search results |
317 | 317 | */ |
318 | | - addResourceInfoCallback: function( resource, callback ){ |
| 318 | + addResourceInfoCallback: function( resource, callback ) { |
319 | 319 | mw.log('Kaltura: addResourceInfoCallback'); |
320 | | - this.getSerachLib( resource.content_provider_id, function( searchLib ){ |
| 320 | + this.getSerachLib( resource.content_provider_id, function( searchLib ) { |
321 | 321 | searchLib.addResourceInfoCallback( resource, callback ); |
322 | 322 | }); |
323 | 323 | }, |
— | — | @@ -327,16 +327,16 @@ |
328 | 328 | * @param {Function} callback Function to call once provider search lib is loaded |
329 | 329 | * callback is passed the search object |
330 | 330 | */ |
331 | | - getSerachLib: function( provider_id, callback ){ |
| 331 | + getSerachLib: function( provider_id, callback ) { |
332 | 332 | var _this = this; |
333 | 333 | // Check if we already have the library loaded: |
334 | | - if( this.searchLibs[ provider_id ] ){ |
| 334 | + if( this.searchLibs[ provider_id ] ) { |
335 | 335 | callback ( this.searchLibs[ provider_id ] ); |
336 | 336 | return ; |
337 | 337 | } |
338 | 338 | // Else load the provider lib: |
339 | 339 | var provider = this.rsd.content_providers [ provider_id ]; |
340 | | - mw.load( provider.lib + 'Search', function(){ |
| 340 | + mw.load( provider.lib + 'Search', function() { |
341 | 341 | //Set up the search lib options |
342 | 342 | var options = { |
343 | 343 | 'provider': provider, |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/mediaWikiSearch.js |
— | — | @@ -261,7 +261,7 @@ |
262 | 262 | |
263 | 263 | |
264 | 264 | this.num_results++; |
265 | | - // for(var i in this.resultsObj[page_id]){ |
| 265 | + // for(var i in this.resultsObj[page_id]) { |
266 | 266 | // mw.log('added: '+ i +' '+ this.resultsObj[page_id][i]); |
267 | 267 | // } |
268 | 268 | } |
— | — | @@ -310,7 +310,7 @@ |
311 | 311 | mw.getJSON( this.provider.api_url, request, function( data ) { |
312 | 312 | var imObj = { }; |
313 | 313 | for ( var page_id in data.query.pages ) { |
314 | | - if( page_id == -1 ){ |
| 314 | + if( page_id == -1 ) { |
315 | 315 | mw.log( 'Error: missing page for title: ' + resource.titleKey ) |
316 | 316 | continue; |
317 | 317 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/baseRemoteSearch.js |
— | — | @@ -87,7 +87,7 @@ |
88 | 88 | /** |
89 | 89 | * getProviderResults abstract method |
90 | 90 | */ |
91 | | - getProviderResults: function( searchQuery , calback){ |
| 91 | + getProviderResults: function( searchQuery , calback) { |
92 | 92 | mw.log( 'Error: getProviderResults not set by provider' ); |
93 | 93 | callback( 'error-provider' ); |
94 | 94 | }, |
— | — | @@ -158,7 +158,7 @@ |
159 | 159 | * @param {XML Node} the xml result node |
160 | 160 | * @param {attr} the name attribute we are maping to the resource object |
161 | 161 | */ |
162 | | - mapAttributeToResource: function( resource, item, attr ){ |
| 162 | + mapAttributeToResource: function( resource, item, attr ) { |
163 | 163 | var selector = rsd_default_rss_item_mapping[ attr ].split( '@' ); |
164 | 164 | var flag_multiple = ( selector[0].substr( 0, 1 ) == '.' ) ? true : false; |
165 | 165 | if ( flag_multiple ) { |
— | — | @@ -228,14 +228,14 @@ |
229 | 229 | } |
230 | 230 | |
231 | 231 | options.style = ''; |
232 | | - if( options.height ){ |
| 232 | + if( options.height ) { |
233 | 233 | options.style += 'height:' + parseInt( options.height ) + 'px;'; |
234 | 234 | } |
235 | | - if( options.width ){ |
| 235 | + if( options.width ) { |
236 | 236 | options.style += 'width:' + parseInt( options.width ) + 'px;'; |
237 | 237 | } |
238 | 238 | |
239 | | - if ( resource.mime.indexOf( 'image/' ) != -1 ){ |
| 239 | + if ( resource.mime.indexOf( 'image/' ) != -1 ) { |
240 | 240 | outHtml = this.getImageEmbedHTML( resource, options ); |
241 | 241 | } |
242 | 242 | |
— | — | @@ -252,7 +252,7 @@ |
253 | 253 | 'type="' + mw.escapeQuotesHTML( resource.mime ) + '" '; |
254 | 254 | |
255 | 255 | // Add the api title key if avaliable: |
256 | | - if( resource.titleKey ){ |
| 256 | + if( resource.titleKey ) { |
257 | 257 | 'apiTitleKey="' + mw.escapeQuotesHTML( resource.titleKey ) + '" '; |
258 | 258 | } |
259 | 259 | |
— | — | @@ -266,7 +266,7 @@ |
267 | 267 | } |
268 | 268 | |
269 | 269 | // Return the output. Wrap with a description div if insert_description is on. |
270 | | - if( outHtml != ''){ |
| 270 | + if( outHtml != '') { |
271 | 271 | return ( options['insert_description'] ) ? |
272 | 272 | this.wrapHtmlDesc(resource, options, outHtml) : |
273 | 273 | outHtml; |
— | — | @@ -329,10 +329,10 @@ |
330 | 330 | 'src' : resource.edit_url, |
331 | 331 | 'style' : options.style |
332 | 332 | }); |
333 | | - if( options['id'] ){ |
| 333 | + if( options['id'] ) { |
334 | 334 | $img.attr( 'id', options['id'] ); |
335 | 335 | } |
336 | | - if ( resource.crop == null ){ |
| 336 | + if ( resource.crop == null ) { |
337 | 337 | return $j('<div />').append( $img ).html(); |
338 | 338 | } |
339 | 339 | // Else do crop output: |
— | — | @@ -490,7 +490,7 @@ |
491 | 491 | * @parma {Object} resource Resource to update title on. |
492 | 492 | */ |
493 | 493 | updateTargetResourceTitle:function( resource ) { |
494 | | - if( resource.titleKey ){ |
| 494 | + if( resource.titleKey ) { |
495 | 495 | resource.target_resource_title = resource.titleKey.replace( /^(File:|Image:)/ , '' ).replace(':', ''); |
496 | 496 | resource.target_resource_title = this.provider.resource_prefix + resource.target_resource_title; |
497 | 497 | } |
— | — | @@ -499,7 +499,7 @@ |
500 | 500 | /** |
501 | 501 | * Utily to convert from mime type to extension |
502 | 502 | */ |
503 | | - getMimeExtension: function( mime ){ |
| 503 | + getMimeExtension: function( mime ) { |
504 | 504 | if( mime == 'video/ogg' || mime == 'application/ogg' ) |
505 | 505 | return 'ogv'; |
506 | 506 | if( mime == 'audio/ogg' ) |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/archiveOrgSearch.js |
— | — | @@ -76,7 +76,7 @@ |
77 | 77 | |
78 | 78 | // Skip the resource if the license is not compatible |
79 | 79 | // ( archive.org does not let us filter the license on search ) |
80 | | - if( ! _this.rsd.checkCompatibleLicense( resource.licenseurl ) ){ |
| 80 | + if( ! _this.rsd.checkCompatibleLicense( resource.licenseurl ) ) { |
81 | 81 | continue; |
82 | 82 | } |
83 | 83 | |
— | — | @@ -138,14 +138,14 @@ |
139 | 139 | var attributes = ( options['id'] ) ? ' id = "' + options['id'] + '" ': ''; |
140 | 140 | |
141 | 141 | // Add height width if we have it: |
142 | | - if( resource.width ){ |
| 142 | + if( resource.width ) { |
143 | 143 | attributes += ' width="'+ parseInt( resource.width ) + '"'; |
144 | 144 | } |
145 | | - if( resource.height ){ |
| 145 | + if( resource.height ) { |
146 | 146 | attributes += ' height="' + parseInt( resource.height ) + '"'; |
147 | 147 | } |
148 | 148 | // Add the src |
149 | | - if( !resource.src ){ |
| 149 | + if( !resource.src ) { |
150 | 150 | mw.log("Error: resource missing src"); |
151 | 151 | }else{ |
152 | 152 | attributes += ' src="' + resource.src + '"'; |
— | — | @@ -160,7 +160,7 @@ |
161 | 161 | if ( resource.mime == 'application/ogg' || resource.mime == 'video/ogg' ) { |
162 | 162 | return '<video poster="' + resource.poster + '" ' + attributes + |
163 | 163 | ' type="video/ogg"></video>'; |
164 | | - }else if( resource.mime == 'audio/ogg' ){ |
| 164 | + }else if( resource.mime == 'audio/ogg' ) { |
165 | 165 | return '<audio ' + attributes + ' type="audio/ogg" ></audio>'; |
166 | 166 | } |
167 | 167 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/metavidSearch.js |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | $j.getJSON( url + '&cb=?&cb_inx=1', request, function( data ) { |
51 | 51 | mw.log( 'mvSearch: got data response::' ); |
52 | 52 | var xmldata = ( data && data['pay_load'] ) ? mw.parseXML( data['pay_load'] ) : false; |
53 | | - if( !xmldata ){ |
| 53 | + if( !xmldata ) { |
54 | 54 | // XML Error or No results: |
55 | 55 | _this.resultsObj = {}; |
56 | 56 | _this.loading = 0; |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/flickrSearch.js |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | * |
99 | 99 | * @param {Object} flickrResource Fliker response resource |
100 | 100 | */ |
101 | | - getResourceObject: function( flickrResource ){ |
| 101 | + getResourceObject: function( flickrResource ) { |
102 | 102 | var _this = this; |
103 | 103 | var resource = { |
104 | 104 | 'titleKey' : flickrResource.title + '.jpg', |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/loader.js |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | */ |
38 | 38 | |
39 | 39 | //Setup the addMediaWizard module |
40 | | - mw.addModuleLoader( 'AddMedia.addMediaWizard', function( callback ){ |
| 40 | + mw.addModuleLoader( 'AddMedia.addMediaWizard', function( callback ) { |
41 | 41 | // Load all the required libs: |
42 | 42 | var request = [ |
43 | 43 | [ 'mw.RemoteSearchDriver', |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | * Upload interface loader: |
77 | 77 | */ |
78 | 78 | |
79 | | - mw.addModuleLoader( 'AddMedia.UploadHandler', function( callback ){ |
| 79 | + mw.addModuleLoader( 'AddMedia.UploadHandler', function( callback ) { |
80 | 80 | mw.load( baseUploadlibs , function() { |
81 | 81 | callback( 'AddMedia.BaseUploadHandler' ); |
82 | 82 | }); |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | var mwBaseFirefoggReq = baseUploadlibs.slice( 0 ) |
93 | 93 | mwBaseFirefoggReq[0].push('mw.Firefogg'); |
94 | 94 | |
95 | | - mw.addModuleLoader( 'AddMedia.firefogg', function( callback ){ |
| 95 | + mw.addModuleLoader( 'AddMedia.firefogg', function( callback ) { |
96 | 96 | |
97 | 97 | //Load firefogg libs |
98 | 98 | mw.load( mwBaseFirefoggReq, function() { |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | }); |
101 | 101 | } ); |
102 | 102 | |
103 | | - mw.addModuleLoader( 'AddMedia.FirefoggGUI', function( callback ){ |
| 103 | + mw.addModuleLoader( 'AddMedia.FirefoggGUI', function( callback ) { |
104 | 104 | // Clone the array: |
105 | 105 | var request = mwBaseFirefoggReq.slice( 0 ) ; |
106 | 106 | |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | }); |
119 | 119 | } ); |
120 | 120 | |
121 | | - mw.addModuleLoader( 'AddMedia.firefoggRender', function( callback ){ |
| 121 | + mw.addModuleLoader( 'AddMedia.firefoggRender', function( callback ) { |
122 | 122 | mw.load( [ |
123 | 123 | 'mw.UploadHandler', |
124 | 124 | 'mw.UploadInterface', |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadInterface.js |
— | — | @@ -18,8 +18,8 @@ |
19 | 19 | * Base UploadInterface object |
20 | 20 | */ |
21 | 21 | mw.UploadInterface = { |
22 | | - factory : function( interfaceType ){ |
23 | | - switch( interfaceType ){ |
| 22 | + factory : function( interfaceType ) { |
| 23 | + switch( interfaceType ) { |
24 | 24 | case 'iframe': |
25 | 25 | return new mw.iframeInterface( ); |
26 | 26 | break; |
— | — | @@ -43,7 +43,7 @@ |
44 | 44 | // we are currently only managing one, so this is okay... for now. |
45 | 45 | uploadBeginTime: null, |
46 | 46 | |
47 | | - setup: function( options ){ |
| 47 | + setup: function( options ) { |
48 | 48 | var _this = this; |
49 | 49 | |
50 | 50 | // Start the "upload" time |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | $j( '<div />') |
61 | 61 | .attr( 'id', "upProgressDialog" ) |
62 | 62 | ); |
63 | | - if( typeof options == 'undefined' || !options.title ){ |
| 63 | + if( typeof options == 'undefined' || !options.title ) { |
64 | 64 | options.title = gM('mwe-upload-in-progress'); |
65 | 65 | } |
66 | 66 | $j( '#upProgressDialog' ).dialog( { |
— | — | @@ -168,7 +168,7 @@ |
169 | 169 | * Set the dialog to loading |
170 | 170 | * @param optional loadingText text to set dialog to. |
171 | 171 | */ |
172 | | - setLoading: function( loadingText ){ |
| 172 | + setLoading: function( loadingText ) { |
173 | 173 | this.action_done = false; |
174 | 174 | //Update the progress dialog (no bar without XHR request) |
175 | 175 | $j( '#upProgressDialog' ).loadingSpinner(); |
— | — | @@ -206,7 +206,7 @@ |
207 | 207 | /** |
208 | 208 | * Set the dialog to "done" |
209 | 209 | */ |
210 | | - close: function(){ |
| 210 | + close: function() { |
211 | 211 | this.action_done = true; |
212 | 212 | $j( '#upProgressDialog' ).dialog( 'destroy' ).remove(); |
213 | 213 | }, |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.Firefogg.js |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | /** |
99 | 99 | * Setup firefogg jquery binding |
100 | 100 | */ |
101 | | -( function( $ ){ |
| 101 | +( function( $ ) { |
102 | 102 | $.fn.firefogg = function( options ) { |
103 | 103 | if ( !options ) |
104 | 104 | options = { }; |
— | — | @@ -121,20 +121,25 @@ |
122 | 122 | return this.init( options ); |
123 | 123 | }; |
124 | 124 | mw.Firefogg.prototype = { // extends mw.BaseUploadHandler |
| 125 | + // Minnium version of firefogg allowed |
125 | 126 | min_firefogg_version: '1.1.0', |
126 | | - default_encoder_settings: { // NOTE: allow the server to set these |
| 127 | + |
| 128 | + // The default encoder seetings |
| 129 | + // NOTE: should be mw.getConfig based |
| 130 | + default_encoder_settings: { |
127 | 131 | 'maxSize' : '400', |
128 | 132 | 'videoBitrate' : '544', |
129 | 133 | 'audioBitrate' : '96', |
130 | 134 | 'noUpscaling' : true |
131 | 135 | }, |
132 | | - // lazy initialised, use getFirefogg() |
| 136 | + |
| 137 | + // Lazy initialised, use getFirefogg() |
133 | 138 | have_firefogg: null, |
134 | 139 | |
135 | | - // lazy initialised, use getEncoderSettings() |
| 140 | + // Lazy initialised, use getEncoderSettings() |
136 | 141 | current_encoder_settings: null, |
137 | 142 | |
138 | | - // lazy initialised, use getSourceFileInfo() |
| 143 | + // Lazy initialised, use getSourceFileInfo() |
139 | 144 | sourceFileInfo: null, |
140 | 145 | |
141 | 146 | // Valid ogg extensions |
— | — | @@ -299,7 +304,7 @@ |
300 | 305 | |
301 | 306 | |
302 | 307 | // Set up the click handler for the "save local file" button |
303 | | - if( _this.target_btn_save_local_file ){ |
| 308 | + if( _this.target_btn_save_local_file ) { |
304 | 309 | $j( _this.target_btn_save_local_file ) |
305 | 310 | .unbind() |
306 | 311 | .click( function() { |
— | — | @@ -311,7 +316,7 @@ |
312 | 317 | /** |
313 | 318 | * Show the install firefogg msg |
314 | 319 | */ |
315 | | - showInstallFirefog: function(){ |
| 320 | + showInstallFirefog: function() { |
316 | 321 | var _this = this; |
317 | 322 | |
318 | 323 | var upMsg = ( _this.form_type == 'upload' ) ? |
— | — | @@ -329,7 +334,7 @@ |
330 | 335 | } |
331 | 336 | |
332 | 337 | // Add the upload msg if we are "uploading" |
333 | | - if ( _this.form_type == 'upload' ){ |
| 338 | + if ( _this.form_type == 'upload' ) { |
334 | 339 | $j( _this.target_use_latest_firefox ) |
335 | 340 | .prepend( upMsg ); |
336 | 341 | } |
— | — | @@ -341,7 +346,7 @@ |
342 | 347 | |
343 | 348 | // Otherwise show the "install Firefogg" message |
344 | 349 | var firefoggUrl = _this.getFirefoggInstallUrl(); |
345 | | - if( firefoggUrl ){ |
| 350 | + if( firefoggUrl ) { |
346 | 351 | |
347 | 352 | // Add the target please install in not present: |
348 | 353 | if ( !this.target_please_install ) { |
— | — | @@ -424,7 +429,7 @@ |
425 | 430 | // If uploading and firefogg is on show warning |
426 | 431 | if ( this.form_type == 'upload' |
427 | 432 | && typeof console != 'undefined' |
428 | | - && console.firebug ){ |
| 433 | + && console.firebug ) { |
429 | 434 | $j( this.selector ).after( |
430 | 435 | $j( '<div />' ) |
431 | 436 | .addClass( 'ui-state-error ui-corner-all' ) |
— | — | @@ -474,7 +479,7 @@ |
475 | 480 | |
476 | 481 | // Set the initial button html: |
477 | 482 | var buttonHtml = ''; |
478 | | - if( _this.show_preview == true ){ |
| 483 | + if( _this.show_preview == true ) { |
479 | 484 | buttonHtml = $j.btnHtml( gM( 'fogg-hidepreview' ), 'fogg_preview', 'triangle-1-s' ); |
480 | 485 | } else { |
481 | 486 | buttonHtml = $j.btnHtml( gM( 'fogg-preview' ), 'fogg_preview', 'triangle-1-e' ); |
— | — | @@ -553,7 +558,7 @@ |
554 | 559 | |
555 | 560 | function seekToEnd() { |
556 | 561 | var v = $j( '#fogg_preview_vid' ).get( 0 ); |
557 | | - if( v ){ |
| 562 | + if( v ) { |
558 | 563 | // Seek to near the end of the clip ( arbitrary -.4 seconds from end ) |
559 | 564 | v.currentTime = v.duration - 0.4; |
560 | 565 | } |
— | — | @@ -904,9 +909,9 @@ |
905 | 910 | var data = $j( this.form ).serializeArray(); |
906 | 911 | this.formData = {}; |
907 | 912 | for ( var i = 0; i < data.length; i++ ) { |
908 | | - if ( data[i]['name'] ){ |
| 913 | + if ( data[i]['name'] ) { |
909 | 914 | // Special case of upload.js commons hack: |
910 | | - if( data[i]['name'] == 'wpUploadDescription' ){ |
| 915 | + if( data[i]['name'] == 'wpUploadDescription' ) { |
911 | 916 | this.formData[ 'comment' ] = data[i]['value']; |
912 | 917 | }else{ |
913 | 918 | this.formData[ data[i]['name'] ] = data[i]['value']; |
— | — | @@ -940,10 +945,10 @@ |
941 | 946 | /** |
942 | 947 | * Internal function called once the token and form data is avaliable |
943 | 948 | */ |
944 | | - doUploadWithFormData: function(){ |
| 949 | + doUploadWithFormData: function() { |
945 | 950 | var _this = this; |
946 | 951 | // We can do a chunk upload |
947 | | - if( _this.upload_mode == 'post' && _this.enable_chunks ){ |
| 952 | + if( _this.upload_mode == 'post' && _this.enable_chunks ) { |
948 | 953 | _this.doChunkUpload(); |
949 | 954 | } else if ( _this.upload_mode == 'post' ) { |
950 | 955 | // Encode and then do a post upload |
— | — | @@ -997,7 +1002,7 @@ |
998 | 1003 | * |
999 | 1004 | * @param {Object} options Options |
1000 | 1005 | */ |
1001 | | - getUploadApiRequest: function( options ){ |
| 1006 | + getUploadApiRequest: function( options ) { |
1002 | 1007 | var _this = this; |
1003 | 1008 | var request = { |
1004 | 1009 | 'action': 'upload', |
— | — | @@ -1005,19 +1010,19 @@ |
1006 | 1011 | 'filename': _this.formData['filename'], |
1007 | 1012 | 'comment': _this.formData['comment'] |
1008 | 1013 | }; |
1009 | | - if( options && options.enable_chunks == true ){ |
| 1014 | + if( options && options.enable_chunks == true ) { |
1010 | 1015 | request[ 'enablechunks' ] = 'true'; |
1011 | 1016 | } |
1012 | 1017 | |
1013 | | - if ( _this.editToken ){ |
| 1018 | + if ( _this.editToken ) { |
1014 | 1019 | request['token'] = this.editToken; |
1015 | 1020 | } |
1016 | 1021 | |
1017 | | - if ( _this.formData['watch'] ){ |
| 1022 | + if ( _this.formData['watch'] ) { |
1018 | 1023 | request['watch'] = _this.formData['watch']; |
1019 | 1024 | } |
1020 | 1025 | |
1021 | | - if ( _this.formData['ignorewarnings'] ){ |
| 1026 | + if ( _this.formData['ignorewarnings'] ) { |
1022 | 1027 | request['ignorewarnings'] = _this.formData['ignorewarnings']; |
1023 | 1028 | } |
1024 | 1029 | |
— | — | @@ -1058,7 +1063,7 @@ |
1059 | 1064 | var encoderSettings = this.getEncoderSettings(); |
1060 | 1065 | |
1061 | 1066 | // Check if encoderSettings passthrough is on ( then skip the encode ) |
1062 | | - if( encoderSettings['passthrough'] == true){ |
| 1067 | + if( encoderSettings['passthrough'] == true) { |
1063 | 1068 | // Firefogg requires an encode request to setup a the file to be uploaded. |
1064 | 1069 | _this.fogg.encode( JSON.stringify( { 'passthrough' : true } ) ); |
1065 | 1070 | doneCallback(); |
— | — | @@ -1139,7 +1144,7 @@ |
1140 | 1145 | } |
1141 | 1146 | |
1142 | 1147 | //Check for success: |
1143 | | - if( apiResult && _this.isApiSuccess( apiResult ) ){ |
| 1148 | + if( apiResult && _this.isApiSuccess( apiResult ) ) { |
1144 | 1149 | if( _this.processApiResult ( apiResult ) ) { |
1145 | 1150 | return true; |
1146 | 1151 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/kplayerEmbed.js |
— | — | @@ -43,7 +43,7 @@ |
44 | 44 | '<param value="opaque" name="wmode"/>'+ |
45 | 45 | '</object>' |
46 | 46 | ) |
47 | | - setTimeout(function(){ |
| 47 | + setTimeout(function() { |
48 | 48 | _this.postEmbedJS(); |
49 | 49 | }, 50); |
50 | 50 | }, |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | var _this = this; |
57 | 57 | this.getPlayerElement(); |
58 | 58 | //alert( this.playerElement ); |
59 | | - if( this.playerElement && this.playerElement.insertMedia){ |
| 59 | + if( this.playerElement && this.playerElement.insertMedia) { |
60 | 60 | // Add KDP listeners |
61 | 61 | |
62 | 62 | //this.playerElement.addJsListener("doPlay","kdpDoOnPlay"); |
— | — | @@ -79,7 +79,7 @@ |
80 | 80 | }else{ |
81 | 81 | // Keep trying to get the html: |
82 | 82 | //mw.log('insert media: not defiend:' + typeof this.playerElement.insertMedia ); |
83 | | - setTimeout( function(){ |
| 83 | + setTimeout( function() { |
84 | 84 | _this.postEmbedJS(); |
85 | 85 | }, 25); |
86 | 86 | } |
— | — | @@ -93,9 +93,9 @@ |
94 | 94 | * @param {String} flash binding name |
95 | 95 | * @param {String} function callback name |
96 | 96 | */ |
97 | | - bindPlayerFunction:function( bName, fName ){ |
| 97 | + bindPlayerFunction:function( bName, fName ) { |
98 | 98 | var cbid = fName + '_cb_' + this.id.replace(' ', '_'); |
99 | | - eval( 'window[ \'' + cbid +'\' ] = function(){$j(\'#' + this.id + '\').get(0).'+ fName +'();}' ); |
| 99 | + eval( 'window[ \'' + cbid +'\' ] = function() {$j(\'#' + this.id + '\').get(0).'+ fName +'();}' ); |
100 | 100 | this.playerElement.addJsListener( bName , cbid); |
101 | 101 | }, |
102 | 102 | |
— | — | @@ -103,7 +103,7 @@ |
104 | 104 | * on Pause callback from the kaltura flash player |
105 | 105 | * calls parent_pause to update the interface |
106 | 106 | */ |
107 | | - onPause:function(){ |
| 107 | + onPause:function() { |
108 | 108 | this.parent_pause(); |
109 | 109 | }, |
110 | 110 | |
— | — | @@ -129,13 +129,13 @@ |
130 | 130 | /** |
131 | 131 | * Issues a seek to the playerElement |
132 | 132 | */ |
133 | | - doSeek:function( prec ){ |
| 133 | + doSeek:function( prec ) { |
134 | 134 | var _this = this; |
135 | | - if( this.playerElement ){ |
| 135 | + if( this.playerElement ) { |
136 | 136 | var seek_time = prec * this.getDuration(); |
137 | 137 | this.playerElement.dispatchKdpEvent('doSeek', seek_time); |
138 | 138 | // Kdp is missing seek done callback |
139 | | - setTimeout(function(){ |
| 139 | + setTimeout(function() { |
140 | 140 | _this.seeking= false; |
141 | 141 | },500); |
142 | 142 | } |
— | — | @@ -154,7 +154,7 @@ |
155 | 155 | * Monitors playback updating the current Time |
156 | 156 | */ |
157 | 157 | monitor:function() { |
158 | | - if( this.playerElement && this.playerElement.getMediaSeekTime ){ |
| 158 | + if( this.playerElement && this.playerElement.getMediaSeekTime ) { |
159 | 159 | this.currentTime = this.playerElement.getMediaSeekTime(); |
160 | 160 | } |
161 | 161 | this.parent_monitor(); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/loader.js |
— | — | @@ -57,12 +57,12 @@ |
58 | 58 | * |
59 | 59 | * NOTE: this function can be part of setup can run prior to jQuery being ready |
60 | 60 | */ |
61 | | -mw.documentHasPlayerTags = function(){ |
| 61 | +mw.documentHasPlayerTags = function() { |
62 | 62 | var rewriteTags = mw.getConfig( 'rewritePlayerTags' ); |
63 | | - if( rewriteTags ){ |
| 63 | + if( rewriteTags ) { |
64 | 64 | var jtags = rewriteTags.split( ',' ); |
65 | 65 | for ( var i = 0; i < jtags.length; i++ ) { |
66 | | - if( document.getElementsByTagName( jtags[i] )[0] ){ |
| 66 | + if( document.getElementsByTagName( jtags[i] )[0] ) { |
67 | 67 | return true; |
68 | 68 | } |
69 | 69 | } |
— | — | @@ -76,10 +76,10 @@ |
77 | 77 | * We use mw.addDOMReadyHook instead of mw.ready so that |
78 | 78 | * player interfaces are ready once mw.ready is called. |
79 | 79 | */ |
80 | | -mw.addDOMReadyHook( function(){ |
| 80 | +mw.addDOMReadyHook( function() { |
81 | 81 | if( mw.documentHasPlayerTags() ) { |
82 | 82 | // Add the setup hook since we have player tags |
83 | | - mw.addSetupHook( function( callback ){ |
| 83 | + mw.addSetupHook( function( callback ) { |
84 | 84 | // Load the embedPlayer module ( then run queued hooks ) |
85 | 85 | mw.load( 'EmbedPlayer', function ( ) { |
86 | 86 | // Rewrite the rewritePlayerTags with the |
— | — | @@ -98,7 +98,7 @@ |
99 | 99 | /** |
100 | 100 | * Add the module loader function: |
101 | 101 | */ |
102 | | -mw.addModuleLoader( 'EmbedPlayer', function( callback ){ |
| 102 | +mw.addModuleLoader( 'EmbedPlayer', function( callback ) { |
103 | 103 | var _this = this; |
104 | 104 | |
105 | 105 | // Set module specific class videonojs to loading: |
— | — | @@ -126,25 +126,25 @@ |
127 | 127 | var addTimedTextReqFlag = false; |
128 | 128 | |
129 | 129 | // Merge in the timed text libs |
130 | | - if( mw.getConfig( 'textInterface' ) == 'always' ){ |
| 130 | + if( mw.getConfig( 'textInterface' ) == 'always' ) { |
131 | 131 | addTimedTextReqFlag = true; |
132 | 132 | } |
133 | 133 | |
134 | 134 | // Get the class of all embed video elements |
135 | 135 | // to add the skin to the load request |
136 | | - $j( mw.getConfig( 'rewritePlayerTags' ) ).each( function(){ |
| 136 | + $j( mw.getConfig( 'rewritePlayerTags' ) ).each( function() { |
137 | 137 | var playerElement = this; |
138 | 138 | var cName = $j( playerElement ).attr( 'class' ); |
139 | | - for( var n=0; n < mw.valid_skins.length ; n++ ){ |
| 139 | + for( var n=0; n < mw.valid_skins.length ; n++ ) { |
140 | 140 | // Get any other skins that we need to load |
141 | 141 | // That way skin js can be part of the single script-loader request: |
142 | | - if( cName.indexOf( mw.valid_skins[ n ] ) !== -1){ |
| 142 | + if( cName.indexOf( mw.valid_skins[ n ] ) !== -1) { |
143 | 143 | dependencyRequest[0].push( mw.valid_skins[n] + 'Config' ); |
144 | 144 | } |
145 | 145 | } |
146 | 146 | // If add timed text flag not already set check for itext, and sources |
147 | | - if( !addTimedTextReqFlag ){ |
148 | | - if( $j( playerElement ).find( 'itext' ).length != 0 ){ |
| 147 | + if( !addTimedTextReqFlag ) { |
| 148 | + if( $j( playerElement ).find( 'itext' ).length != 0 ) { |
149 | 149 | // Has an itext child include timed text request |
150 | 150 | addTimedTextReqFlag = true; |
151 | 151 | // break out of the loop |
— | — | @@ -162,23 +162,23 @@ |
163 | 163 | } ); |
164 | 164 | |
165 | 165 | // Add timed text items if flag set. |
166 | | - if( addTimedTextReqFlag ){ |
| 166 | + if( addTimedTextReqFlag ) { |
167 | 167 | dependencyRequest[0].push( 'mw.TimedText' ) |
168 | 168 | } |
169 | 169 | |
170 | 170 | // Add PNG fix code needed: |
171 | | - if ( $j.browser.msie || $j.browser.version < 7 ){ |
| 171 | + if ( $j.browser.msie || $j.browser.version < 7 ) { |
172 | 172 | dependencyRequest[0].push( '$j.fn.pngFix' ); |
173 | 173 | } |
174 | 174 | |
175 | 175 | // Do short detection, to avoid extra player library request in ~most~ cases. |
176 | 176 | //( If browser is firefox include native, if browser is IE include java ) |
177 | | - if( $j.browser.msie ){ |
| 177 | + if( $j.browser.msie ) { |
178 | 178 | dependencyRequest[0].push( 'javaEmbed' ) |
179 | 179 | } |
180 | 180 | |
181 | 181 | // Safari gets slower load since we have to detect ogg support |
182 | | - if( typeof HTMLVideoElement == 'object' && !$j.browser.safari ){ |
| 182 | + if( typeof HTMLVideoElement == 'object' && !$j.browser.safari ) { |
183 | 183 | dependencyRequest[0].push( 'nativeEmbed' ) |
184 | 184 | } |
185 | 185 | |
— | — | @@ -186,7 +186,7 @@ |
187 | 187 | // Load the video libs: |
188 | 188 | mw.load( dependencyRequest, function() { |
189 | 189 | // Setup userConfig |
190 | | - mw.setupUserConfig( function(){ |
| 190 | + mw.setupUserConfig( function() { |
191 | 191 | // Remove no video html elements: |
192 | 192 | $j( '.videonojs' ).remove(); |
193 | 193 | |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/omtkEmbed.js |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | '</object>' |
36 | 36 | ) |
37 | 37 | // omtk needs to fire an onReady event. |
38 | | - setTimeout( function(){ |
| 38 | + setTimeout( function() { |
39 | 39 | _this.postEmbedJS(); |
40 | 40 | }, 2000 ); |
41 | 41 | return embed_code; |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -148,9 +148,6 @@ |
149 | 149 | // If serving an ogg_chop segment use this to offset the presentation time |
150 | 150 | // ( for some plugins that use ogg page time rather than presentation time ) |
151 | 151 | "startOffset" : 0, |
152 | | - |
153 | | - //If we should display the play button |
154 | | - "play_button" : true, |
155 | 152 | |
156 | 153 | // Thumbnail (same as poster) |
157 | 154 | "thumbnail" : null, |
— | — | @@ -227,7 +224,7 @@ |
228 | 225 | * @param {Object} attributes Attributes to apply to embed players |
229 | 226 | * @param {Function} callback Function to call once embeding is done |
230 | 227 | */ |
231 | | - $.embedPlayers = function( attributes, callback){ |
| 228 | + $.embedPlayers = function( attributes, callback) { |
232 | 229 | $j( mw.getConfig( 'rewritePlayerTags' ) ).embedPlayer( attributes, callback ); |
233 | 230 | } |
234 | 231 | |
— | — | @@ -245,7 +242,7 @@ |
246 | 243 | * @param [ Optional ] {Function} callback Function to be called once video interfaces are ready |
247 | 244 | * |
248 | 245 | */ |
249 | | - $.fn.embedPlayer = function( attributes, callback ){ |
| 246 | + $.fn.embedPlayer = function( attributes, callback ) { |
250 | 247 | mw.log('fn:embedPlayer on: ' + this.selector); |
251 | 248 | var player_select = this.selector; |
252 | 249 | //Handle optional include of attributes argument: |
— | — | @@ -262,16 +259,16 @@ |
263 | 260 | |
264 | 261 | // IE not working well with jQuery selector on "VIDEO", "AUDIO" etc. |
265 | 262 | var ie_safe_selector = coma = ''; |
266 | | - if( $j.browser.msie ){ |
| 263 | + if( $j.browser.msie ) { |
267 | 264 | var selectors = player_select.split(','); |
268 | | - for( var i=0; i < selectors.length; i++){ |
| 265 | + for( var i=0; i < selectors.length; i++ ) { |
269 | 266 | if( selectors[i] == 'video' || |
270 | 267 | selectors[i] == 'playlist' || |
271 | 268 | selectors[i] == 'audio' |
272 | | - ){ |
273 | | - $j( document.getElementsByTagName( selectors[i] )).each(function(){ |
274 | | - mw.playerManager.addElement(this, attributes ); |
275 | | - }); |
| 269 | + ) { |
| 270 | + $j( document.getElementsByTagName( selectors[ i ] )).each( function( ) { |
| 271 | + mw.playerManager.addElement( this, attributes ); |
| 272 | + } ); |
276 | 273 | }else{ |
277 | 274 | ie_safe_selector += coma + selectors[i]; |
278 | 275 | coma = ','; |
— | — | @@ -279,9 +276,9 @@ |
280 | 277 | } |
281 | 278 | player_select = ie_safe_selector; |
282 | 279 | } |
283 | | - if( player_select != ''){ |
| 280 | + if( player_select != '') { |
284 | 281 | // Add each selected element to the player manager: |
285 | | - $j( player_select ).each( function(na, playerElement){ |
| 282 | + $j( player_select ).each( function(na, playerElement) { |
286 | 283 | mw.playerManager.addElement( playerElement, attributes); |
287 | 284 | } ); |
288 | 285 | } |
— | — | @@ -326,7 +323,7 @@ |
327 | 324 | /** |
328 | 325 | * get the list of players |
329 | 326 | */ |
330 | | - getPlayerList: function( ){ |
| 327 | + getPlayerList: function( ) { |
331 | 328 | return this.playerList; |
332 | 329 | }, |
333 | 330 | |
— | — | @@ -340,7 +337,9 @@ |
341 | 338 | * @param {Object} [Optional] attributes Extra attributes to apply to the player interface |
342 | 339 | */ |
343 | 340 | addElement: function( element, attributes ) { |
344 | | - var _this = this; |
| 341 | + var _this = this; |
| 342 | + |
| 343 | + // Assign id if unset |
345 | 344 | var element_id = $j( element ).attr( "id" ); |
346 | 345 | if ( element_id == '' ) { |
347 | 346 | element_id = 'v' + this.playerList.length; |
— | — | @@ -352,43 +351,19 @@ |
353 | 352 | // Add the element id to playerList |
354 | 353 | this.playerList.push( element_id ); |
355 | 354 | |
356 | | - // Check for class based player skin ( could have been loaded before in 'EmbedPlayer' loader module ) |
| 355 | + // Check for class based player skin |
357 | 356 | var skinClassRequest = [ ]; |
358 | 357 | var className = $j( element ).attr( 'class' ); |
359 | | - for( var n=0; n < mw.valid_skins.length ; n++ ){ |
360 | | - if( className && className.indexOf( mw.valid_skins[ n ] ) !== -1){ |
| 358 | + for( var n=0; n < mw.valid_skins.length ; n++ ) { |
| 359 | + if( className && className.indexOf( mw.valid_skins[ n ] ) !== -1) { |
361 | 360 | skinClassRequest.push( mw.valid_skins[n] + 'Config' ); |
362 | 361 | } |
363 | | - } |
364 | | - |
365 | | - // Firefox gives 300x150 css values OR -1 if video has not loaded metadata yet: |
366 | | - // We check that and delay swapping in the player interface |
367 | | - var waitForMeta = ( |
368 | | - ( |
369 | | - ( |
370 | | - $j(element).attr('width') == -1 && |
371 | | - $j(element).attr('height') == -1 |
372 | | - ) |
373 | | - || |
374 | | - // Google Chrome gives 0 width height for unloaded media |
375 | | - ( |
376 | | - $j(element).attr('width') == 0 && |
377 | | - $j(element).attr('height') == 0 |
378 | | - ) |
379 | | - || |
380 | | - // Strange firefox default width height ( should wait for "real" metadata ) |
381 | | - ( this.height == 150 && this.width == 300 ) |
382 | | - ) |
383 | | - && |
384 | | - // If media has video/audio "sources" wait for meta: |
385 | | - ( |
386 | | - $j(element).attr('src') || |
387 | | - $j(element).find("source[src]").filter('[type^=video],[type^=audio]').length != 0 |
388 | | - ) |
389 | | - ) ? true : false; |
| 362 | + } |
390 | 363 | |
391 | 364 | // Load any skins we need then swap in the interface |
392 | | - mw.load( skinClassRequest, function(){ |
| 365 | + mw.load( skinClassRequest, function() { |
| 366 | + var waitForMeta = _this.waitForMetaCheck( element ); |
| 367 | + |
393 | 368 | switch( element.tagName.toLowerCase() ) { |
394 | 369 | case 'playlist': |
395 | 370 | // Make sure we have the necessary playlist libs loaded: |
— | — | @@ -411,7 +386,7 @@ |
412 | 387 | var ranPlayerSwapFlag = false; |
413 | 388 | |
414 | 389 | // Local callback to runPlayer swap once element has metadata |
415 | | - function runPlayerSwap(){ |
| 390 | + function runPlayerSwap() { |
416 | 391 | if( ranPlayerSwapFlag ) |
417 | 392 | return ; |
418 | 393 | mw.log("runPlayerSwap::" + $j( element ).attr('id') ); |
— | — | @@ -422,8 +397,8 @@ |
423 | 398 | $j( '#' + $j( element ).attr('id') ).get(0).checkPlayerSources(); |
424 | 399 | } |
425 | 400 | |
426 | | - if( waitForMeta ){ |
427 | | - mw.log(" WaitForMeta ( video missing height, width or duration )" ); |
| 401 | + if( waitForMeta ) { |
| 402 | + mw.log(' WaitForMeta ( video missing height (' + $j( element ).attr('height') + '), width (' + $j( element ).attr('width') + ') or duration' ); |
428 | 403 | element.removeEventListener( "loadedmetadata", runPlayerSwap, true ); |
429 | 404 | element.addEventListener( "loadedmetadata", runPlayerSwap, true ); |
430 | 405 | // Time-out of 5 seconds ( maybe still playable but no timely metadata ) |
— | — | @@ -436,6 +411,54 @@ |
437 | 412 | }); |
438 | 413 | }, |
439 | 414 | |
| 415 | + /** |
| 416 | + * Check for bogus resolutions of the media asset that has not loaded. |
| 417 | + * @return |
| 418 | + * true if the resolution is "likely" to be updated |
| 419 | + * by waiting for metadata |
| 420 | + * false if the resolution has been set via an attribute or is already loaded |
| 421 | + */ |
| 422 | + waitForMetaCheck: function( element ){ |
| 423 | + var waitForMeta = false; |
| 424 | + var width = $j( element ).css( 'width' ); |
| 425 | + var height = $j( element ).css( 'height' ); |
| 426 | + |
| 427 | + // Css video defaults: |
| 428 | + if( $j( element ).css( 'width' ) == '300px' |
| 429 | + && $j( element ).css( 'height' ) == '150px' |
| 430 | + ){ |
| 431 | + waitForMeta = true; |
| 432 | + }else{ |
| 433 | + // css width height attribute has been set on the element return false |
| 434 | + return false; |
| 435 | + } |
| 436 | + //Firefox ~ sometimes ~ gives -1 for unloaded media |
| 437 | + if ( $j(element).attr('width') == -1 || $j(element).attr('height') == -1 ){ |
| 438 | + waitForMeta = true; |
| 439 | + } |
| 440 | + // Google Chrome / safari gives 0 width height for unloaded media |
| 441 | + if( $j(element).attr('width') == 0 || $j(element).attr('height') == 0 ){ |
| 442 | + waitForMeta = true; |
| 443 | + } |
| 444 | + // Firefox default width height is ~sometimes~ 150 / 300 |
| 445 | + if( this.height == 150 && this.width == 300 ){ |
| 446 | + waitForMeta = true; |
| 447 | + } |
| 448 | + // Make sure we have a src attribute or source child |
| 449 | + // ( i.e not a video tag to be dynamically populated or looked up from xml resource description ) |
| 450 | + if( waitForMeta |
| 451 | + && ( |
| 452 | + $j(element).attr('src') || |
| 453 | + $j(element).find("source[src]").filter('[type^=video],[type^=audio]').length != 0 |
| 454 | + ) |
| 455 | + ){ |
| 456 | + return true; |
| 457 | + } |
| 458 | + |
| 459 | + // Element is not likely to update its resolution: |
| 460 | + return false; |
| 461 | + }, |
| 462 | + |
440 | 463 | /** |
441 | 464 | * swapEmbedPlayerElement |
442 | 465 | * |
— | — | @@ -493,7 +516,7 @@ |
494 | 517 | } |
495 | 518 | } else { |
496 | 519 | // Continue checking the playerList |
497 | | - setTimeout( function(){ |
| 520 | + setTimeout( function() { |
498 | 521 | _this.waitPlayersReadyCallback(); |
499 | 522 | }, 10 ); |
500 | 523 | } |
— | — | @@ -576,9 +599,9 @@ |
577 | 600 | } |
578 | 601 | } |
579 | 602 | |
580 | | - if ( $j( element ).attr( 'type' ) ){ |
| 603 | + if ( $j( element ).attr( 'type' ) ) { |
581 | 604 | this.mime_type = $j( element ).attr( 'type' ); |
582 | | - }else if ( $j( element ).attr( 'content-type' ) ){ |
| 605 | + }else if ( $j( element ).attr( 'content-type' ) ) { |
583 | 606 | this.mime_type = $j( element ).attr( 'content-type' ); |
584 | 607 | }else{ |
585 | 608 | this.mime_type = this.detectType( this.src ); |
— | — | @@ -586,7 +609,7 @@ |
587 | 610 | |
588 | 611 | |
589 | 612 | // Check for parent elements ( supplies categories in "itext" ) |
590 | | - if( $j( element ).parent().attr('category') ){ |
| 613 | + if( $j( element ).parent().attr('category') ) { |
591 | 614 | this.category = $j( element ).parent().attr('category'); |
592 | 615 | } |
593 | 616 | |
— | — | @@ -615,11 +638,11 @@ |
616 | 639 | // if we have time we can use: |
617 | 640 | if ( this.URLTimeEncoding ) { |
618 | 641 | // make sure its a valid start time / end time (else set default) |
619 | | - if ( !mw.npt2seconds( start_npt ) ){ |
| 642 | + if ( !mw.npt2seconds( start_npt ) ) { |
620 | 643 | start_npt = this.start_npt; |
621 | 644 | } |
622 | 645 | |
623 | | - if ( !mw.npt2seconds( end_npt ) ){ |
| 646 | + if ( !mw.npt2seconds( end_npt ) ) { |
624 | 647 | end_npt = this.end_npt; |
625 | 648 | } |
626 | 649 | |
— | — | @@ -681,7 +704,7 @@ |
682 | 705 | return this.title; |
683 | 706 | |
684 | 707 | // Return a Title based on mime type: |
685 | | - switch( this.mime_type ){ |
| 708 | + switch( this.mime_type ) { |
686 | 709 | case 'video/h264' : |
687 | 710 | return gM( 'mwe-video-h264' ); |
688 | 711 | break; |
— | — | @@ -785,7 +808,7 @@ |
786 | 809 | * @param {element} video_element <video> element used for initialization. |
787 | 810 | * @constructor |
788 | 811 | */ |
789 | | -function mediaElement( element ){ |
| 812 | +function mediaElement( element ) { |
790 | 813 | this.init( element ); |
791 | 814 | }; |
792 | 815 | |
— | — | @@ -842,7 +865,7 @@ |
843 | 866 | this.thumbnail = mw.getConfig( 'images_path' ) + 'vid_default_thumb.jpg' ; |
844 | 867 | |
845 | 868 | // Process the video_element as a source element: |
846 | | - if ( $j( video_element ).attr( "src" ) ){ |
| 869 | + if ( $j( video_element ).attr( "src" ) ) { |
847 | 870 | this.tryAddSource( video_element ); |
848 | 871 | } |
849 | 872 | |
— | — | @@ -889,7 +912,7 @@ |
890 | 913 | * @return mediaSource elements. |
891 | 914 | * @type Array |
892 | 915 | */ |
893 | | - getSources: function( mime_filter ){ |
| 916 | + getSources: function( mime_filter ) { |
894 | 917 | if ( !mime_filter ) |
895 | 918 | return this.sources; |
896 | 919 | // apply mime filter: |
— | — | @@ -993,7 +1016,7 @@ |
994 | 1017 | } |
995 | 1018 | } |
996 | 1019 | // Select first source |
997 | | - if ( !this.selected_source ){ |
| 1020 | + if ( !this.selected_source ) { |
998 | 1021 | mw.log( 'set via first source:' + playable_sources[0] ); |
999 | 1022 | this.selected_source = playable_sources[0]; |
1000 | 1023 | return true; |
— | — | @@ -1028,7 +1051,7 @@ |
1029 | 1052 | /** |
1030 | 1053 | * Checks if media is a playable type |
1031 | 1054 | */ |
1032 | | - isPlayableType:function( mime_type ){ |
| 1055 | + isPlayableType:function( mime_type ) { |
1033 | 1056 | if ( mw.EmbedTypes.players.defaultPlayer( mime_type ) ) { |
1034 | 1057 | return true; |
1035 | 1058 | } else { |
— | — | @@ -1191,7 +1214,7 @@ |
1192 | 1215 | |
1193 | 1216 | // Setup the player Interface from supported attributes: |
1194 | 1217 | for ( var attr in default_video_attributes ) { |
1195 | | - if ( customAttributes[ attr ] ){ |
| 1218 | + if ( customAttributes[ attr ] ) { |
1196 | 1219 | this[ attr ] = customAttributes[ attr ]; |
1197 | 1220 | } else if ( element.getAttribute( attr ) ) { |
1198 | 1221 | this[ attr ] = element.getAttribute( attr ); |
— | — | @@ -1214,7 +1237,7 @@ |
1215 | 1238 | } |
1216 | 1239 | |
1217 | 1240 | // Set the default skin if unset: |
1218 | | - if ( !this.skinName ){ |
| 1241 | + if ( !this.skinName ) { |
1219 | 1242 | this.skinName = mw.getConfig( 'skinName' ); |
1220 | 1243 | } |
1221 | 1244 | |
— | — | @@ -1250,11 +1273,11 @@ |
1251 | 1274 | |
1252 | 1275 | // Setup the local "ROE" src pointer if added as media source |
1253 | 1276 | // also see: http://dev.w3.org/html5/spec/Overview.html#the-source-element |
1254 | | - $j.each(this.mediaElement.getSources( 'text/xml'), function( inx, source ){ |
1255 | | - if( source.codecs ){ |
| 1277 | + $j.each(this.mediaElement.getSources( 'text/xml'), function( inx, source ) { |
| 1278 | + if( source.codecs ) { |
1256 | 1279 | var codec_set = source.codecs.split(','); |
1257 | | - for( var i = 0; i < codec_set.length; i++ ){ |
1258 | | - if( codec_set[i] == 'roe' ){ |
| 1280 | + for( var i = 0; i < codec_set.length; i++ ) { |
| 1281 | + if( codec_set[i] == 'roe' ) { |
1259 | 1282 | _this.roe = source.src; |
1260 | 1283 | } |
1261 | 1284 | } |
— | — | @@ -1274,23 +1297,23 @@ |
1275 | 1298 | * |
1276 | 1299 | * @param {Element} element Source element to grab size from |
1277 | 1300 | */ |
1278 | | - setPlayerSize:function( element ){ |
| 1301 | + setPlayerSize: function( element ) { |
1279 | 1302 | this['height'] = parseInt( $j(element).css( 'height' ).replace( 'px' , '' ) ); |
1280 | 1303 | this['width'] = parseInt( $j(element).css( 'width' ).replace( 'px' , '' ) ); |
1281 | 1304 | |
1282 | | - if( !this['height'] && !this['width'] ){ |
| 1305 | + if( !this['height'] && !this['width'] ) { |
1283 | 1306 | this['height'] = parseInt( $j(element).attr( 'height' ) ); |
1284 | 1307 | this['width'] = parseInt( $j(element).attr( 'width' ) ); |
1285 | 1308 | } |
1286 | 1309 | |
1287 | 1310 | // Use default aspect ration to get height or width ( if rewriting a non-audio player ) |
1288 | | - if( element.tagName.toLowerCase() != 'audio' ){ |
1289 | | - if( this['height'] && !this['width'] && this.videoAspect ){ |
| 1311 | + if( element.tagName.toLowerCase() != 'audio' ) { |
| 1312 | + if( this['height'] && !this['width'] && this.videoAspect ) { |
1290 | 1313 | var aspect = this.videoAspect.split( ':' ); |
1291 | 1314 | this['width'] = parseInt( this.height * ( aspect[0] / aspect[1] ) ); |
1292 | 1315 | } |
1293 | 1316 | |
1294 | | - if( this['width'] && !this['height'] && this.videoAspect ){ |
| 1317 | + if( this['width'] && !this['height'] && this.videoAspect ) { |
1295 | 1318 | var aspect = this.videoAspect.split( ':' ); |
1296 | 1319 | this['height'] = parseInt( this.width * ( aspect[1] / aspect[0] ) ); |
1297 | 1320 | } |
— | — | @@ -1305,11 +1328,11 @@ |
1306 | 1329 | // Check for firefox defaults |
1307 | 1330 | // Note: ideally firefox would not do random guesses at css values |
1308 | 1331 | ( (this.height == 150 || this.height == 64 ) && this.width == 300 ) |
1309 | | - ){ |
| 1332 | + ) { |
1310 | 1333 | var defaultSize = mw.getConfig( 'video_size' ).split( 'x' ); |
1311 | 1334 | this['width'] = defaultSize[0]; |
1312 | 1335 | // Special height default for audio tag ( if not set ) |
1313 | | - if( element.tagName.toLowerCase() == 'audio' ){ |
| 1336 | + if( element.tagName.toLowerCase() == 'audio' ) { |
1314 | 1337 | this['height'] = 0; |
1315 | 1338 | }else{ |
1316 | 1339 | this['height'] = defaultSize[1]; |
— | — | @@ -1323,7 +1346,7 @@ |
1324 | 1347 | * |
1325 | 1348 | * @return {Number} pixle height of the video |
1326 | 1349 | */ |
1327 | | - getPlayerWidth: function(){ |
| 1350 | + getPlayerWidth: function() { |
1328 | 1351 | return parseInt( this.width ); |
1329 | 1352 | }, |
1330 | 1353 | |
— | — | @@ -1332,7 +1355,7 @@ |
1333 | 1356 | * |
1334 | 1357 | * @return {Number} pixle height of the video |
1335 | 1358 | */ |
1336 | | - getPlayerHeight: function(){ |
| 1359 | + getPlayerHeight: function() { |
1337 | 1360 | return parseInt( this.height ); |
1338 | 1361 | }, |
1339 | 1362 | |
— | — | @@ -1349,7 +1372,7 @@ |
1350 | 1373 | if ( this.roe && this.mediaElement.getPlayableSources().length == 0 ) { |
1351 | 1374 | mw.log( 'checkPlayerSources: loading external data' ); |
1352 | 1375 | this.loading_external_data = true; |
1353 | | - this.getMvJsonUrl( this.roe, function( data ){ |
| 1376 | + this.getMvJsonUrl( this.roe, function( data ) { |
1354 | 1377 | // Continue |
1355 | 1378 | _this.mediaElement.addROE( data ); |
1356 | 1379 | mw.log( 'added_roe::' + _this.mediaElement.sources.length ); |
— | — | @@ -1372,8 +1395,8 @@ |
1373 | 1396 | * |
1374 | 1397 | * @param roe_url to be updated |
1375 | 1398 | */ |
1376 | | - getMvJsonUrl : function( roe_url , callback){ |
1377 | | - if ( mw.isLocalDomain( roe_url ) ){ |
| 1399 | + getMvJsonUrl : function( roe_url , callback) { |
| 1400 | + if ( mw.isLocalDomain( roe_url ) ) { |
1378 | 1401 | $j.get( roe_url, callback ); |
1379 | 1402 | } else { |
1380 | 1403 | roe_url = mw.replaceUrlParams(roe_url, { |
— | — | @@ -1390,10 +1413,10 @@ |
1391 | 1414 | * |
1392 | 1415 | * Note we check for text sources outside of |
1393 | 1416 | */ |
1394 | | - isTimedTextSupported: function(){ |
| 1417 | + isTimedTextSupported: function() { |
1395 | 1418 | // Check for timed text sources or api/ roe url |
1396 | 1419 | if ( ( this.roe || this.apiTitleKey || |
1397 | | - this.mediaElement.textSourceExists() ) ){ |
| 1420 | + this.mediaElement.textSourceExists() ) ) { |
1398 | 1421 | return true; |
1399 | 1422 | } else { |
1400 | 1423 | return false; |
— | — | @@ -1406,12 +1429,12 @@ |
1407 | 1430 | * |
1408 | 1431 | * @param {Function} callback Function to call once timed text check is done |
1409 | 1432 | */ |
1410 | | - checkForTimedText: function( ){ |
| 1433 | + checkForTimedText: function( ) { |
1411 | 1434 | var _this = this; |
1412 | 1435 | mw.log( 'checkForTimedText: ' + this.id ); |
1413 | 1436 | // Check for timedText support |
1414 | | - if( this.isTimedTextSupported() ){ |
1415 | | - mw.load( 'TimedText', function(){ |
| 1437 | + if( this.isTimedTextSupported() ) { |
| 1438 | + mw.load( 'TimedText', function() { |
1416 | 1439 | $j( '#' + _this.id ).timedText(); |
1417 | 1440 | _this.setupSourcePlayer(); |
1418 | 1441 | }); |
— | — | @@ -1428,12 +1451,12 @@ |
1429 | 1452 | * |
1430 | 1453 | * Sets load error if no source is playable |
1431 | 1454 | */ |
1432 | | - setupSourcePlayer: function(){ |
| 1455 | + setupSourcePlayer: function() { |
1433 | 1456 | mw.log("setupSourcePlayer: " + this.id ); |
1434 | 1457 | // Autoseletct the media source |
1435 | 1458 | this.mediaElement.autoSelectSource(); |
1436 | 1459 | // Auto select player based on default order |
1437 | | - if ( !this.mediaElement.selected_source ){ |
| 1460 | + if ( !this.mediaElement.selected_source ) { |
1438 | 1461 | // check for parent clip: |
1439 | 1462 | if ( typeof this.pc != 'undefined' ) { |
1440 | 1463 | mw.log( 'no sources, type:' + this.type + ' check for html' ); |
— | — | @@ -1499,7 +1522,7 @@ |
1500 | 1523 | var playerInterface = window[ _this.selected_player.library + 'Embed' ]; |
1501 | 1524 | |
1502 | 1525 | for ( var method in playerInterface ) { |
1503 | | - if ( _this[method] && !_this['parent_' + method] ){ |
| 1526 | + if ( _this[method] && !_this['parent_' + method] ) { |
1504 | 1527 | _this['parent_' + method] = _this[method]; |
1505 | 1528 | } |
1506 | 1529 | _this[ method ] = playerInterface[method]; |
— | — | @@ -1524,7 +1547,7 @@ |
1525 | 1548 | var _this = this; |
1526 | 1549 | if ( this.selected_player.id != player.id ) { |
1527 | 1550 | this.selected_player = player; |
1528 | | - this.inheritEmbedPlayer( function(){ |
| 1551 | + this.inheritEmbedPlayer( function() { |
1529 | 1552 | // Update the controls for the new selected player |
1530 | 1553 | _this.refreshControls(); |
1531 | 1554 | }); |
— | — | @@ -1536,8 +1559,8 @@ |
1537 | 1560 | * |
1538 | 1561 | * @return start_npt and end_npt time if present |
1539 | 1562 | */ |
1540 | | - getTimeRange: function(){ |
1541 | | - var end_time = (this.ctrlBuilder.long_time_disp)? '/' + mw.seconds2npt( this.getDuration() ) : ''; |
| 1563 | + getTimeRange: function() { |
| 1564 | + var end_time = (this.ctrlBuilder.longTimeDisp)? '/' + mw.seconds2npt( this.getDuration() ) : ''; |
1542 | 1565 | var default_time_range = '0:00:00' + end_time; |
1543 | 1566 | if ( !this.mediaElement ) |
1544 | 1567 | return default_time_range; |
— | — | @@ -1590,7 +1613,7 @@ |
1591 | 1614 | this.updatePlayHead( percent ); |
1592 | 1615 | } |
1593 | 1616 | // Do play request in 100ms ( give the dom time to swap out the embed player ) |
1594 | | - setTimeout( function(){ |
| 1617 | + setTimeout( function() { |
1595 | 1618 | _this.play() |
1596 | 1619 | }, 100 ); |
1597 | 1620 | }, |
— | — | @@ -1716,14 +1739,14 @@ |
1717 | 1740 | this.thumbnail_disp = true; |
1718 | 1741 | |
1719 | 1742 | // make sure we are not in preview mode( no end clip actions in preview mode) |
1720 | | - if ( this.preview_mode ){ |
| 1743 | + if ( this.preview_mode ) { |
1721 | 1744 | return ; |
1722 | 1745 | } |
1723 | 1746 | |
1724 | 1747 | // Call the ctrlBuilder end event:: |
1725 | 1748 | |
1726 | 1749 | //if kalturaAttribution and k-skin show the "credits" screen: |
1727 | | - if( this.ctrlBuilder.showCredits ){ |
| 1750 | + if( this.ctrlBuilder.showCredits ) { |
1728 | 1751 | this.ctrlBuilder.showCredits(); |
1729 | 1752 | return ; |
1730 | 1753 | } |
— | — | @@ -1785,7 +1808,7 @@ |
1786 | 1809 | ) |
1787 | 1810 | // now load roe if run the showNextPrevLinks |
1788 | 1811 | if ( this.roe && this.mediaElement.addedROEData == false ) { |
1789 | | - this.getMvJsonUrl( this.roe, function( data ){ |
| 1812 | + this.getMvJsonUrl( this.roe, function( data ) { |
1790 | 1813 | _this.mediaElement.addROE( data ); |
1791 | 1814 | _this.getNextPrevLinks(); |
1792 | 1815 | } ); |
— | — | @@ -1945,7 +1968,7 @@ |
1946 | 1969 | .html( html ) |
1947 | 1970 | //Do bindings: |
1948 | 1971 | .children( '.playtimerequest' ) |
1949 | | - .click( function(){ |
| 1972 | + .click( function() { |
1950 | 1973 | _this.stop(); |
1951 | 1974 | _this.updateVideoTimeReq( time_req ); |
1952 | 1975 | _this.play(); |
— | — | @@ -1990,7 +2013,7 @@ |
1991 | 2014 | |
1992 | 2015 | var _this = this; |
1993 | 2016 | //make sure we have interface_wrap |
1994 | | - if( $j( this ).parent('.interface_wrap').length == 0 ){ |
| 2017 | + if( $j( this ).parent('.interface_wrap').length == 0 ) { |
1995 | 2018 | // Select "player" |
1996 | 2019 | $j( this ) |
1997 | 2020 | .wrap( |
— | — | @@ -2244,7 +2267,7 @@ |
2245 | 2268 | }) |
2246 | 2269 | ); |
2247 | 2270 | |
2248 | | - if ( this.play_button == true && this.controls == true ){ |
| 2271 | + if ( this.controls == true ) { |
2249 | 2272 | $thumb.append( |
2250 | 2273 | this.ctrlBuilder.getComponent( 'playButtonLarge' ) |
2251 | 2274 | ); |
— | — | @@ -2293,19 +2316,6 @@ |
2294 | 2317 | }, |
2295 | 2318 | |
2296 | 2319 | /** |
2297 | | - * Display the options div |
2298 | | - * NOTE: should move to skins "showShare" , "showTextInterface" etc. |
2299 | | - */ |
2300 | | - doOptionsHTML:function() { |
2301 | | - var pos = this.$interface.find( '.options-btn' ).offset(); |
2302 | | - pos['top'] = pos['top'] + 24; |
2303 | | - pos['left'] = pos['left'] -124; |
2304 | | - // mw.log('pos of options button: t:'+pos['top']+' l:'+ pos['left']); |
2305 | | - $j( '#mv_vid_options_' + this.id ).css( pos ).toggle(); |
2306 | | - return; |
2307 | | - }, |
2308 | | - |
2309 | | - /** |
2310 | 2320 | * Follows a linkback. Loads the ROE xml if no linkback is found |
2311 | 2321 | */ |
2312 | 2322 | doLinkBack: function() { |
— | — | @@ -2326,72 +2336,7 @@ |
2327 | 2337 | } |
2328 | 2338 | } |
2329 | 2339 | }, |
2330 | | - |
2331 | | - /** |
2332 | | - * Show the "share" msg |
2333 | | - * |
2334 | | - * TODO share should be enabled via <embed> tag usage to be compatible |
2335 | | - * with sites social networking sites that allow <embed> tags but not js |
2336 | | - * |
2337 | | - * @param {Object} $target Target jQuery object to set share html |
2338 | | - */ |
2339 | | - showShare:function( $target ) { |
2340 | | - var embed_code = this.getEmbeddingHTML(); |
2341 | | - var _this = this; |
2342 | | - $target.empty(); |
2343 | | - $shareList = $j( '<ul />' ); |
2344 | 2340 | |
2345 | | - $shareList |
2346 | | - .append( |
2347 | | - $j('<li />') |
2348 | | - .append( |
2349 | | - $j('<a />') |
2350 | | - .attr('href', '#') |
2351 | | - .addClass( 'active' ) |
2352 | | - .text( |
2353 | | - gM( 'mwe-embed_site_or_blog' ) |
2354 | | - ) |
2355 | | - ) |
2356 | | - ) |
2357 | | - |
2358 | | - $target.append( |
2359 | | - $j( '<h2 />' ) |
2360 | | - .text( gM( 'mwe-share_this_video' ) ) |
2361 | | - .append( |
2362 | | - $shareList |
2363 | | - ) |
2364 | | - ); |
2365 | | - |
2366 | | - $target.append( |
2367 | | - $j('<div />') |
2368 | | - .addClass( 'source_wrap' ) |
2369 | | - .html( |
2370 | | - $j( '<textarea />' ) |
2371 | | - .html( embed_code ) |
2372 | | - .click( function() { |
2373 | | - $j( this ).select(); |
2374 | | - }) |
2375 | | - ), |
2376 | | - |
2377 | | - $j('<button />') |
2378 | | - .addClass( 'ui-state-default ui-corner-all copycode' ) |
2379 | | - .text( gM( 'mwe-copy-code' ) ) |
2380 | | - .click(function() { |
2381 | | - $target.find( 'textarea' ).focus().select(); |
2382 | | - // Copy the text if supported: |
2383 | | - if ( document.selection ) { |
2384 | | - CopiedTxt = document.selection.createRange(); |
2385 | | - CopiedTxt.execCommand( "Copy" ); |
2386 | | - } |
2387 | | - } ), |
2388 | | - |
2389 | | - $j('<div />') |
2390 | | - .addClass( "ui-state-highlight ui-corner-all" ) |
2391 | | - .html( |
2392 | | - gM( 'mwe-read_before_embed' ) |
2393 | | - ) |
2394 | | - ); |
2395 | | - }, |
2396 | 2341 | |
2397 | 2342 | /** |
2398 | 2343 | * Loads the text interface library and show the text interface near the player. |
— | — | @@ -2428,7 +2373,7 @@ |
2429 | 2374 | } ).hide() |
2430 | 2375 | ); |
2431 | 2376 | // Load text interface ( if not already loaded ) |
2432 | | - mw.load( 'TimedText', function(){ |
| 2377 | + mw.load( 'TimedText', function() { |
2433 | 2378 | $j( '#' + _this.id ).timedText( 'showMenu', '#timedTextMenu_' + _this.id ); |
2434 | 2379 | }); |
2435 | 2380 | } |
— | — | @@ -2443,235 +2388,9 @@ |
2444 | 2389 | this.textInterface.close(); |
2445 | 2390 | } |
2446 | 2391 | }, |
2447 | | - |
2448 | | - /** |
2449 | | - * Generic function to display custom HTML inside the mwEmbedPlayer |
2450 | | - * Should call the closeDisplayedHTML function to close the |
2451 | | - * display of the custom HTML and restore the regular player display. |
2452 | | - * |
2453 | | - * NOTE: this should be moved to the ctrlBuilder |
2454 | | - * |
2455 | | - * @param {String} html_code code for the selection list. |
2456 | | - */ |
2457 | | - displayOverlay: function( html_code ) { |
2458 | | - var _this = this; |
2459 | 2392 | |
2460 | | - if ( !this.supports['overlays'] ){ |
2461 | | - this.stop(); |
2462 | | - } |
2463 | 2393 | |
2464 | | - |
2465 | | - // Put select list on-top |
2466 | | - // make sure the parent is relatively positioned: |
2467 | | - $j( '#' + this.id ).css( 'position', 'relative' ); |
2468 | | - |
2469 | | - |
2470 | | - var fade_in = true; |
2471 | | - if ( $j( '#blackbg_' + this.id ).length != 0 ){ |
2472 | | - fade_in = false; |
2473 | | - $j( '#blackbg_' + this.id ).remove(); |
2474 | | - } |
2475 | | - $closeButton = $j('<span />') |
2476 | | - .text( gM('mwe-close_btn') ) |
2477 | | - .css({ |
2478 | | - 'float' : 'right', |
2479 | | - 'color' : '#FFF', |
2480 | | - 'cursor' : 'pointer', |
2481 | | - 'background' : '#111', |
2482 | | - 'margin-right': '10px', |
2483 | | - 'text-decoration' : 'underline' |
2484 | | - }) |
2485 | | - .click(function(){ |
2486 | | - _this.ctrlBuilder.closeMenuOverlay(); |
2487 | | - }) |
2488 | | - |
2489 | | - |
2490 | | - $overlayMenu = $j('<div />') |
2491 | | - .attr({ |
2492 | | - 'id' : 'blackbg_' + this.id |
2493 | | - }) |
2494 | | - .addClass( 'videoComplete' ) |
2495 | | - .css({ |
2496 | | - 'height' : this.ctrlBuilder.getOverlayHeight(), |
2497 | | - 'width' : this.ctrlBuilder.getOverlayWidth() |
2498 | | - }) |
2499 | | - .append( |
2500 | | - $closeButton, |
2501 | | - $j('<div />') |
2502 | | - .addClass('videoOptionsComplete') |
2503 | | - ) |
2504 | | - this.$interface.prepend( $overlayMenu ); |
2505 | | - if ( fade_in ) |
2506 | | - $j( '#blackbg_' + this.id ).fadeIn( "slow" ); |
2507 | | - else |
2508 | | - $j( '#blackbg_' + this.id ).show(); |
2509 | | - return false; // onclick action return false |
2510 | | - }, |
2511 | | - |
2512 | 2394 | /** |
2513 | | - * Shows the Player Select interface |
2514 | | - * |
2515 | | - * NOTE: this should be switched over to jQuery style DOM construction |
2516 | | - * |
2517 | | - * @param {Object} $target jQuery target for output |
2518 | | - */ |
2519 | | - showPlayerSelect: function( $target ) { |
2520 | | - mw.log('showPlayerSelect'); |
2521 | | - if( ! $target ){ |
2522 | | - $target = this.$interface.find( '.videoOptionsComplete' ) |
2523 | | - } |
2524 | | - // Get id (in case where we have a parent container) |
2525 | | - var _this = this; |
2526 | | - |
2527 | | - $target |
2528 | | - .empty() |
2529 | | - .append( |
2530 | | - $j( '<h2 />' ) |
2531 | | - .text( gM( 'mwe-chose_player' ) ) |
2532 | | - ); |
2533 | | - |
2534 | | - var _this = this; |
2535 | | - $j.each( this.mediaElement.getPlayableSources(), function( source_id, source ) { |
2536 | | - var playable = mw.EmbedTypes.players.defaultPlayer( source.getMIMEType() ); |
2537 | | - |
2538 | | - var is_selected = ( source == _this.mediaElement.selected_source ); |
2539 | | - |
2540 | | - $target.append( |
2541 | | - $j( '<h2 />' ) |
2542 | | - .text( source.getTitle() ) |
2543 | | - ); |
2544 | | - |
2545 | | - if ( playable ) { |
2546 | | - $playerList = $j('<ul />'); |
2547 | | - // output the player select code: |
2548 | | - var supporting_players = mw.EmbedTypes.players.getMIMETypePlayers( source.getMIMEType() ); |
2549 | | - |
2550 | | - for ( var i = 0; i < supporting_players.length ; i++ ) { |
2551 | | - var $playerLink = $j( '<a />') |
2552 | | - .attr({ |
2553 | | - 'href' : '#', |
2554 | | - 'rel' : 'sel_source', |
2555 | | - 'id' : 'sc_' + source_id + '_' + supporting_players[i].id |
2556 | | - }) |
2557 | | - .text( supporting_players[i].getName() ); |
2558 | | - |
2559 | | - if ( _this.selected_player.id == supporting_players[i].id && is_selected ) { |
2560 | | - $playerLink |
2561 | | - .addClass('active' ); |
2562 | | - } |
2563 | | - $playerList.append( |
2564 | | - $j( '<li />' ).append( |
2565 | | - $playerLink |
2566 | | - ) |
2567 | | - ); |
2568 | | - } |
2569 | | - |
2570 | | - // Append the player list: |
2571 | | - $target.append( $playerList ); |
2572 | | - |
2573 | | - } else { |
2574 | | - // No player avaliable: |
2575 | | - $target.append( gM( 'mwe-no-player', source.getTitle() ) ) |
2576 | | - } |
2577 | | - } ); |
2578 | | - |
2579 | | - // Set up the click bindings: |
2580 | | - $target.find( "[rel='sel_source']" ).each( function() { |
2581 | | - $j( this ).click( function() { |
2582 | | - var iparts = $j( this ).attr( 'id' ).replace(/sc_/ , '' ).split( '_' ); |
2583 | | - var source_id = iparts[0]; |
2584 | | - var default_player_id = iparts[1]; |
2585 | | - mw.log( 'source id: ' + source_id + ' player id: ' + default_player_id ); |
2586 | | - |
2587 | | - _this.ctrlBuilder.closeMenuOverlay(); |
2588 | | - _this.mediaElement.selectSource( source_id ); |
2589 | | - |
2590 | | - mw.EmbedTypes.players.setPlayerPreference( default_player_id, |
2591 | | - _this.mediaElement.sources[ source_id ].getMIMEType() ); |
2592 | | - |
2593 | | - // Issue a stop |
2594 | | - _this.stop(); |
2595 | | - |
2596 | | - // Don't follow the empty # link: |
2597 | | - return false; |
2598 | | - } ); |
2599 | | - } ); |
2600 | | - }, |
2601 | | - |
2602 | | - /** |
2603 | | - * Loads sources and calls showDownloadWithSources |
2604 | | - * @param {Object} $target jQuery target to output to |
2605 | | - */ |
2606 | | - showDownload:function( $target ) { |
2607 | | - var _this = this; |
2608 | | - // Load the roe if available (to populate out download options: |
2609 | | - // mw.log('f:showDownload '+ this.roe + ' ' + this.mediaElement.addedROEData); |
2610 | | - if ( this.roe && this.mediaElement.addedROEData == false ) { |
2611 | | - var _this = this; |
2612 | | - $target.html( gM( 'loading_txt' ) ); |
2613 | | - this.getMvJsonUrl( this.roe, function( data ) { |
2614 | | - _this.mediaElement.addROE( data ); |
2615 | | - _this.showDownloadWithSources( $target ); |
2616 | | - } ); |
2617 | | - } else { |
2618 | | - _this.showDownloadWithSources( $target ); |
2619 | | - } |
2620 | | - }, |
2621 | | - |
2622 | | - /** |
2623 | | - * Shows the download interface with sources loaded |
2624 | | - * @param {Object} $target jQuery target to output to |
2625 | | - */ |
2626 | | - showDownloadWithSources : function( $target ) { |
2627 | | - var _this = this; |
2628 | | - $target.empty().append( |
2629 | | - $j('<div />') |
2630 | | - .css({ |
2631 | | - "color":"white" |
2632 | | - }) |
2633 | | - ); |
2634 | | - var $mediaList = $j( '<ul />' ); |
2635 | | - var $textList = $j( '<ul />' ); |
2636 | | - $j.each( _this.mediaElement.getSources(), function( index, source ) { |
2637 | | - if( source.getSrc() ){ |
2638 | | - var $dl_line = $j( '<li />').append( |
2639 | | - $j('<a />'). |
2640 | | - css({ |
2641 | | - "color" : "white" |
2642 | | - }) |
2643 | | - .attr( 'href', source.getSrc()) |
2644 | | - .text( source.getTitle() ) |
2645 | | - ); |
2646 | | - //Add link to time segment: |
2647 | | - if ( source.getSrc().indexOf( '?t=' ) !== -1 ) { |
2648 | | - $target.append( $dl_line ); |
2649 | | - } else if ( this.getMIMEType() == "text/cmml" || this.getMIMEType() == "text/x-srt" ) { |
2650 | | - // Add link to text list |
2651 | | - $textList.append( $dl_line ); |
2652 | | - } else { |
2653 | | - // Add link to media list |
2654 | | - $mediaList.append( $dl_line ); |
2655 | | - } |
2656 | | - |
2657 | | - } |
2658 | | - } ); |
2659 | | - if( $mediaList.find('li').length != 0 ){ |
2660 | | - $target.append( |
2661 | | - $j('<h2 />') |
2662 | | - .text( gM( 'mwe-download_full' ) ), |
2663 | | - $mediaList |
2664 | | - ) |
2665 | | - } |
2666 | | - |
2667 | | - if( $textList.find('li').length != 0 ){ |
2668 | | - $target.append( |
2669 | | - $j('<h2 />') |
2670 | | - .text( gM( 'mwe-download_text' ) ), |
2671 | | - $textList |
2672 | | - ) |
2673 | | - } |
2674 | | - }, |
2675 | | - /** |
2676 | 2395 | * Base Embed Controls |
2677 | 2396 | */ |
2678 | 2397 | |
— | — | @@ -2718,7 +2437,7 @@ |
2719 | 2438 | .attr( 'title', gM( 'mwe-pause_clip' ) ); |
2720 | 2439 | |
2721 | 2440 | // Do play tracking if enabled |
2722 | | - if( mw.getConfig( 'playTracking' ) ){ |
| 2441 | + if( mw.getConfig( 'playTracking' ) ) { |
2723 | 2442 | this.doPlayTracking(); |
2724 | 2443 | } |
2725 | 2444 | |
— | — | @@ -2892,15 +2611,15 @@ |
2893 | 2612 | * Checks if we are monitoring play requests |
2894 | 2613 | * presently this function is mediaWiki api specific. |
2895 | 2614 | */ |
2896 | | - doPlayTracking: function(){ |
| 2615 | + doPlayTracking: function() { |
2897 | 2616 | var playTrackingRate = mw.getConfig( 'playTrackingRate' ); |
2898 | 2617 | // Math.floor ( Math.random() * playTrackingRate ) == 0 |
2899 | | - if( true ){ |
| 2618 | + if( true ) { |
2900 | 2619 | mw.getJSON( { |
2901 | 2620 | 'action' : 'playtracking', |
2902 | 2621 | 'filename' : this.apiTitleKey, |
2903 | 2622 | 'client' : this.selected_player.library + ' && ' + navigator.userAgent |
2904 | | - }, function( data ){ |
| 2623 | + }, function( data ) { |
2905 | 2624 | mw.log( 'done logging play request' ); |
2906 | 2625 | } ); |
2907 | 2626 | } |
— | — | @@ -2918,19 +2637,19 @@ |
2919 | 2638 | if ( parseInt( this.startOffset ) != 0 ) { |
2920 | 2639 | // If start offset include that calculation |
2921 | 2640 | this.updatePlayHead( ( this.currentTime - this.startOffset ) / this.duration ); |
2922 | | - var et = ( this.ctrlBuilder.long_time_disp ) ? '/' + mw.seconds2npt( parseFloat( this.startOffset ) + parseFloat( this.duration ) ) : ''; |
| 2641 | + var et = ( this.ctrlBuilder.longTimeDisp ) ? '/' + mw.seconds2npt( parseFloat( this.startOffset ) + parseFloat( this.duration ) ) : ''; |
2923 | 2642 | this.setStatus( mw.seconds2npt( this.currentTime ) + et ); |
2924 | 2643 | } else { |
2925 | 2644 | this.updatePlayHead( this.currentTime / this.duration ); |
2926 | | - // Only include the end time if long_time_disp is enabled: |
2927 | | - var et = ( this.ctrlBuilder.long_time_disp ) ? '/' + mw.seconds2npt( this.duration ) : ''; |
| 2645 | + // Only include the end time if longTimeDisp is enabled: |
| 2646 | + var et = ( this.ctrlBuilder.longTimeDisp ) ? '/' + mw.seconds2npt( this.duration ) : ''; |
2928 | 2647 | this.setStatus( mw.seconds2npt( this.currentTime ) + et ); |
2929 | 2648 | } |
2930 | 2649 | } |
2931 | 2650 | // Check if we are "done" |
2932 | | - var end_presentation_time = ( this.startOffset ) ? ( this.startOffset + this.duration ) : this.duration; |
2933 | | - if ( this.currentTime > end_presentation_time ) { |
2934 | | - mw.log( "should run clip done :: " + this.currentTime + ' > ' + end_presentation_time ); |
| 2651 | + var endPresentationTime = ( this.startOffset ) ? ( this.startOffset + this.duration ) : this.duration; |
| 2652 | + if ( this.currentTime > endPresentationTime ) { |
| 2653 | + mw.log( "should run clip done :: " + this.currentTime + ' > ' + endPresentationTime ); |
2935 | 2654 | this.onClipDone(); |
2936 | 2655 | } |
2937 | 2656 | } else { |
— | — | @@ -2971,7 +2690,7 @@ |
2972 | 2691 | * Stop the playback monitor |
2973 | 2692 | */ |
2974 | 2693 | stopMonitor:function() { |
2975 | | - if ( this.monitorTimerId != 0 ){ |
| 2694 | + if ( this.monitorTimerId != 0 ) { |
2976 | 2695 | clearInterval( this.monitorTimerId ); |
2977 | 2696 | this.monitorTimerId = 0; |
2978 | 2697 | } |
— | — | @@ -3147,7 +2866,7 @@ |
3148 | 2867 | * false if mime type is unsupported |
3149 | 2868 | */ |
3150 | 2869 | supportsMIMEType: function( type ) { |
3151 | | - for ( var i = 0; i < this.supported_types.length; i++ ){ |
| 2870 | + for ( var i = 0; i < this.supported_types.length; i++ ) { |
3152 | 2871 | if ( this.supported_types[i] == type ) |
3153 | 2872 | return true; |
3154 | 2873 | } |
— | — | @@ -3430,7 +3149,7 @@ |
3431 | 3150 | var uniqueMimesOnly = $j.browser.opera || $j.browser.safari; |
3432 | 3151 | // Opera will switch off javaEnabled in preferences if java can't be found. |
3433 | 3152 | // And it doesn't register an application/x-java-applet mime type like Mozilla does. |
3434 | | - if ( javaEnabled ){ |
| 3153 | + if ( javaEnabled ) { |
3435 | 3154 | this.players.addPlayer( cortadoPlayer ); |
3436 | 3155 | } |
3437 | 3156 | |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/javaEmbed.js |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | /** |
85 | 85 | * Get the applet location |
86 | 86 | */ |
87 | | - getAppletLocation: function(){ |
| 87 | + getAppletLocation: function() { |
88 | 88 | var mediaSrc = this.getSrc() |
89 | 89 | if ( mediaSrc.indexOf( '://' ) != -1 & !mw.isLocalDomain( mediaSrc ) ) { |
90 | 90 | if ( window.cortadoDomainLocations[ mw.parseUri( mediaSrc ).host ] ) { |
— | — | @@ -200,7 +200,7 @@ |
201 | 201 | play: function() { |
202 | 202 | this.getPlayerElement(); |
203 | 203 | this.parent_play(); |
204 | | - if ( this.playerElement && this.playerElement.play ){ |
| 204 | + if ( this.playerElement && this.playerElement.play ) { |
205 | 205 | this.playerElement.play(); |
206 | 206 | } |
207 | 207 | }, |
— | — | @@ -214,7 +214,7 @@ |
215 | 215 | // Update the interface |
216 | 216 | this.parent_pause(); |
217 | 217 | // Call the pause function if it exists: |
218 | | - if ( this.playerElement && this.playerElement.pause ){ |
| 218 | + if ( this.playerElement && this.playerElement.pause ) { |
219 | 219 | this.playerElement.pause(); |
220 | 220 | } |
221 | 221 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/htmlEmbed.js |
— | — | @@ -79,7 +79,7 @@ |
80 | 80 | * |
81 | 81 | * @param {Float} perc Pecentage to seek into the virtual player |
82 | 82 | */ |
83 | | - doSeek:function( perc ){ |
| 83 | + doSeek:function( perc ) { |
84 | 84 | this.pauseTime = perc * this.getDuration(); |
85 | 85 | this.play(); |
86 | 86 | }, |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | * @param {Float} perc Pecentage to seek into the virtual player |
92 | 92 | * @param {Function} callback Function called once time has been updated |
93 | 93 | */ |
94 | | - setCurrentTime:function( perc, callback ){ |
| 94 | + setCurrentTime:function( perc, callback ) { |
95 | 95 | this.pauseTime = perc * this.getDuration(); |
96 | 96 | if( callback ) |
97 | 97 | callback(); |
— | — | @@ -246,10 +246,10 @@ |
247 | 247 | * Get the media duration |
248 | 248 | */ |
249 | 249 | getDuration:function() { |
250 | | - if( !this.duration ){ |
251 | | - if( this.pc.dur ){ |
| 250 | + if( !this.duration ) { |
| 251 | + if( this.pc.dur ) { |
252 | 252 | this.duration = this.pc.dur; |
253 | | - }else if( pcHtmlEmbedDefaults.dur ){ |
| 253 | + }else if( pcHtmlEmbedDefaults.dur ) { |
254 | 254 | this.duration = pcHtmlEmbedDefaults.dur ; |
255 | 255 | } |
256 | 256 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/vlcEmbed.js |
— | — | @@ -63,7 +63,7 @@ |
64 | 64 | // give VLC 150ms to initialize before we start playback |
65 | 65 | // @@todo should be able to do this as an ready event |
66 | 66 | this.waitForVlcCount = 0; |
67 | | - setTimeout( function(){ |
| 67 | + setTimeout( function() { |
68 | 68 | _this.postEmbedJS(); |
69 | 69 | }, 150 ); |
70 | 70 | }, |
— | — | @@ -94,14 +94,14 @@ |
95 | 95 | } else { |
96 | 96 | mw.log( "error:cannot play at the moment !" ); |
97 | 97 | } |
98 | | - setTimeout( function(){ |
| 98 | + setTimeout( function() { |
99 | 99 | _this.monitor(); |
100 | 100 | }, 100 ); |
101 | 101 | } else { |
102 | 102 | mw.log( 'postEmbedJS: vlc not ready' ); |
103 | 103 | this.waitForVlcCount++; |
104 | 104 | if ( this.waitForVlcCount < 10 ) { |
105 | | - setTimeout( function(){ |
| 105 | + setTimeout( function() { |
106 | 106 | _this.postEmbedJS(); |
107 | 107 | }, 100 ); |
108 | 108 | } else { |
— | — | @@ -209,7 +209,7 @@ |
210 | 210 | // current media is now playing |
211 | 211 | this.onPlay(); |
212 | 212 | } |
213 | | - else if ( this.playerElement.input.state == 4 ){ |
| 213 | + else if ( this.playerElement.input.state == 4 ) { |
214 | 214 | // current media is now paused |
215 | 215 | this.onPause(); |
216 | 216 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/nativeEmbed.js |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | ) |
62 | 62 | mw.log( "Embed code: " + $j( this ).html() ) |
63 | 63 | |
64 | | - setTimeout( function(){ |
| 64 | + setTimeout( function() { |
65 | 65 | _this.postEmbedJS(); |
66 | 66 | }, 150 ); |
67 | 67 | }, |
— | — | @@ -78,12 +78,12 @@ |
79 | 79 | var vid = $j( this.playerElement ).get(0); |
80 | 80 | |
81 | 81 | // Bind events to local js methods: |
82 | | - vid.addEventListener( 'canplaythrough', function(){ _this.canplaythrough }, true); |
83 | | - vid.addEventListener( 'loadedmetadata', function(){ _this.onloadedmetadata() }, true); |
84 | | - vid.addEventListener( 'progress', function( e ){ _this.onprogress( e ) }, true); |
85 | | - vid.addEventListener( 'ended', function(){ _this.onended() }, true); |
86 | | - vid.addEventListener( 'seeking', function(){ _this.onseeking() }, true); |
87 | | - vid.addEventListener( 'seeked', function(){ _this.onseeked() }, true); |
| 82 | + vid.addEventListener( 'canplaythrough', function() { _this.canplaythrough }, true); |
| 83 | + vid.addEventListener( 'loadedmetadata', function() { _this.onloadedmetadata() }, true); |
| 84 | + vid.addEventListener( 'progress', function( e ) { _this.onprogress( e ) }, true); |
| 85 | + vid.addEventListener( 'ended', function() { _this.onended() }, true); |
| 86 | + vid.addEventListener( 'seeking', function() { _this.onseeking() }, true); |
| 87 | + vid.addEventListener( 'seeked', function() { _this.onseeked() }, true); |
88 | 88 | |
89 | 89 | // Check for load flag |
90 | 90 | if ( this.onlyLoadFlag ) { |
— | — | @@ -92,7 +92,7 @@ |
93 | 93 | // Issue play request |
94 | 94 | this.playerElement.play(); |
95 | 95 | } |
96 | | - setTimeout( function(){ |
| 96 | + setTimeout( function() { |
97 | 97 | _this.monitor(); |
98 | 98 | }, 100 ); |
99 | 99 | |
— | — | @@ -103,7 +103,7 @@ |
104 | 104 | if ( this.grab_count == 20 ) { |
105 | 105 | mw.log( 'Could not get vid object after 20 tries re-run: getEmbedObj() ?' ) ; |
106 | 106 | } else { |
107 | | - setTimeout( function(){ |
| 107 | + setTimeout( function() { |
108 | 108 | _this.postEmbedJS(); |
109 | 109 | }, 200 ); |
110 | 110 | } |
— | — | @@ -202,7 +202,7 @@ |
203 | 203 | * @param {Float} position Position in seconds |
204 | 204 | * @param {Function} callback Function to call once seeking completes |
205 | 205 | */ |
206 | | - doSeekedCallback : function( position, callback ){ |
| 206 | + doSeekedCallback : function( position, callback ) { |
207 | 207 | var _this = this; |
208 | 208 | this.getPlayerElement(); |
209 | 209 | var once = function( event ) { |
— | — | @@ -390,7 +390,7 @@ |
391 | 391 | } |
392 | 392 | |
393 | 393 | //Fire "onLoaded" flags if set |
394 | | - if( typeof this.onLoadedCallback == 'function' ){ |
| 394 | + if( typeof this.onLoadedCallback == 'function' ) { |
395 | 395 | this.onLoadedCallback(); |
396 | 396 | } |
397 | 397 | }, |
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/loader.js |
— | — | @@ -18,12 +18,12 @@ |
19 | 19 | 'mw.Firefogg', |
20 | 20 | 'mw.FirefoggRender', |
21 | 21 | 'mw.BaseUploadInterface' |
22 | | - ], function(){ |
| 22 | + ], function() { |
23 | 23 | callback( 'FirefoggRender' ); |
24 | 24 | }); |
25 | 25 | }); |
26 | 26 | |
27 | | -mw.addModuleLoader( 'Sequencer', function( callback ){ |
| 27 | +mw.addModuleLoader( 'Sequencer', function( callback ) { |
28 | 28 | //Get sequencer style sheet |
29 | 29 | mw.getStyleSheet( mw.getMwEmbedPath() + 'modules/Sequencer/css/mv_sequence.css' ); |
30 | 30 | // Make sure we have the required mwEmbed libs: |
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/mw.FirefoggRender.js |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | $j.extend(this.renderOptions, default_render_options, options['render_options']); |
74 | 74 | |
75 | 75 | // If no height width provided use target DOM width/height |
76 | | - if( !this.renderOptions.width && !this.renderOptions.height ){ |
| 76 | + if( !this.renderOptions.width && !this.renderOptions.height ) { |
77 | 77 | this.renderOptions.width = $j(this.player_target).width(); |
78 | 78 | this.renderOptions.height = $j(this.player_target).height(); |
79 | 79 | } |
— | — | @@ -131,7 +131,7 @@ |
132 | 132 | // add audio if we had any: |
133 | 133 | |
134 | 134 | // issue a load request on the player: |
135 | | - this.player.load(function(){ |
| 135 | + this.player.load(function() { |
136 | 136 | $j( this.target_timeStatus ).val( "player ready" ); |
137 | 137 | //now issue the save video as call |
138 | 138 | _this.fogg.saveVideoAs(); |
— | — | @@ -142,7 +142,7 @@ |
143 | 143 | /** |
144 | 144 | * Do the next frame in the render target |
145 | 145 | */ |
146 | | - doNextFrame: function(){ |
| 146 | + doNextFrame: function() { |
147 | 147 | var _this = this; |
148 | 148 | // internal function to handle updates: |
149 | 149 | $j( _this.target_timeStatus ).val( " on " + ( Math.round( _this.render_time * 10 ) / 10 ) + " of " + |
— | — | @@ -186,7 +186,7 @@ |
187 | 187 | var rstatus = _this.fogg.renderstatus() |
188 | 188 | $j( _this.target_timeStatus ).val( rstatus ); |
189 | 189 | if ( rstatus != 'done' && rstatus != 'rendering failed' ) { |
190 | | - setTimeout( function(){ |
| 190 | + setTimeout( function() { |
191 | 191 | _this.updateStatus(); |
192 | 192 | }, 100 ); |
193 | 193 | } else { |
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/mw.Sequencer.js |
— | — | @@ -58,7 +58,7 @@ |
59 | 59 | /* |
60 | 60 | * Setup the sequencer jQuery binding: |
61 | 61 | */ |
62 | | -( function( $ ){ |
| 62 | +( function( $ ) { |
63 | 63 | $.fn.sequencer = function( options, callback ) { |
64 | 64 | // Debugger |
65 | 65 | options['target_sequence_container'] = this.selector; |
— | — | @@ -279,7 +279,7 @@ |
280 | 280 | |
281 | 281 | $j('#' + this.plObj_id ).embedPlayer(); |
282 | 282 | |
283 | | - setTimeout( function(){ |
| 283 | + setTimeout( function() { |
284 | 284 | _this.checkReadyPlObj() |
285 | 285 | }, 25 ); |
286 | 286 | }, |
— | — | @@ -481,8 +481,8 @@ |
482 | 482 | // & from seq obj to sequencer |
483 | 483 | this.plObj.pSeq = this; |
484 | 484 | |
485 | | - if ( this.plObj ){ |
486 | | - if ( ! this.plObj.loading ){ |
| 485 | + if ( this.plObj ) { |
| 486 | + if ( ! this.plObj.loading ) { |
487 | 487 | this.plReadyInit(); |
488 | 488 | return ; |
489 | 489 | } |
— | — | @@ -494,7 +494,7 @@ |
495 | 495 | mw.log( 'error playlist never ready' ); |
496 | 496 | } else { |
497 | 497 | this.plReadyTimeout++; |
498 | | - setTimeout( function(){ |
| 498 | + setTimeout( function() { |
499 | 499 | _this.checkReadyPlObj(); |
500 | 500 | }, 25 ); |
501 | 501 | } |
— | — | @@ -521,7 +521,7 @@ |
522 | 522 | this.sequenceEditToken = $j( 'input[wpEditToken]' ).val(); |
523 | 523 | |
524 | 524 | // Update the buttons for no Api url (local editor) |
525 | | - if( !this.getLocalApiUrl() ){ |
| 525 | + if( !this.getLocalApiUrl() ) { |
526 | 526 | _this.updateSeqSaveButtons(); |
527 | 527 | } |
528 | 528 | |
— | — | @@ -542,9 +542,9 @@ |
543 | 543 | $j.ajax({ |
544 | 544 | type: "GET", |
545 | 545 | url: token_url + _this.plObj.mTitle, |
546 | | - success:function(data){ |
| 546 | + success:function(data) { |
547 | 547 | var pageElm = data.getElementsByTagName('page')[0]; |
548 | | - if( $j(pageElm).attr('edittoken') ){ |
| 548 | + if( $j(pageElm).attr('edittoken') ) { |
549 | 549 | _this.sequenceEditToken = $j(pageElm).attr('edittoken'); |
550 | 550 | } |
551 | 551 | |
— | — | @@ -554,9 +554,9 @@ |
555 | 555 | /*$j.ajax({ |
556 | 556 | type:"GET", |
557 | 557 | url: token_url + _this.plObj.mTalk, |
558 | | - success:function(data){ |
| 558 | + success:function(data) { |
559 | 559 | var pageElm = data.getElementsByTagName('page')[0]; |
560 | | - if( $j(pageElm).attr('edittoken') ){ |
| 560 | + if( $j(pageElm).attr('edittoken') ) { |
561 | 561 | _this.clipboardEditToken = $j(pageElm).attr('edittoken'); |
562 | 562 | } |
563 | 563 | } |
— | — | @@ -1490,7 +1490,7 @@ |
1491 | 1491 | clip_desc += '<br>end time: ' + new_end; |
1492 | 1492 | // also shift all the other clips (after the current) |
1493 | 1493 | // mw.log("track_inx: " + track_inx + ' clip inx:'+clip_inx); |
1494 | | - // $j('#container_track_'+track_inx+' > .mv_clip_drag :gt('+clip_inx+')').each(function(){ |
| 1494 | + // $j('#container_track_'+track_inx+' > .mv_clip_drag :gt('+clip_inx+')').each(function() { |
1495 | 1495 | $j( '#container_track_' + track_inx + ' > :gt(' + clip_inx + ')' ).each( function() { |
1496 | 1496 | var move_id_parts = this.id.split( '_' ); |
1497 | 1497 | var move_clip = _this.plObj.tracks[move_id_parts[1]].clips[move_id_parts[3]]; |
— | — | @@ -1543,7 +1543,7 @@ |
1544 | 1544 | var out=''; |
1545 | 1545 | //output time-desc every 50pixles and jump links every 10 pixles |
1546 | 1546 | var n=0; |
1547 | | - for(i=0;i<pixle_length;i+=10){ |
| 1547 | + for(i=0;i<pixle_length;i+=10) { |
1548 | 1548 | out+='<div onclick="'+this.instance_name+'.jt('+i*this.timeline_scale+');"' + |
1549 | 1549 | ' style="z-index:2;position:absolute;left:'+i+'px;width:10px;height:20px;top:0px;"></div>'; |
1550 | 1550 | if(n==0) |
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/playlistEmbed.js |
— | — | @@ -32,7 +32,7 @@ |
33 | 33 | /** |
34 | 34 | * put the embed player into the container |
35 | 35 | */ |
36 | | - doEmbedPlayer: function(){ |
| 36 | + doEmbedPlayer: function() { |
37 | 37 | var _this = this; |
38 | 38 | // Set "loading" here: |
39 | 39 | $j(this).text( gM( 'mwe-loading_plugin' ) ); |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | /** |
48 | 48 | * Get the thumbnail html |
49 | 49 | */ |
50 | | - getThumbnailHTML: function(){ |
| 50 | + getThumbnailHTML: function() { |
51 | 51 | return 'thumb html'; |
52 | 52 | }, |
53 | 53 | /** |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | /** |
62 | 62 | * Get all the "clips" in a given range from currentTime |
63 | 63 | */ |
64 | | - getClipsInRange: function( range ){ |
| 64 | + getClipsInRange: function( range ) { |
65 | 65 | |
66 | 66 | } |
67 | 67 | } |
\ No newline at end of file |
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/mw.PlayList.js |
— | — | @@ -181,7 +181,7 @@ |
182 | 182 | } |
183 | 183 | this.cur_clip.embed.showShare( embed_code ); |
184 | 184 | }, |
185 | | - isTimedTextSupported: function(){ |
| 185 | + isTimedTextSupported: function() { |
186 | 186 | return false; |
187 | 187 | }, |
188 | 188 | checkForTextSource: function() { |
— | — | @@ -196,7 +196,7 @@ |
197 | 197 | // import methods from the plObj to this |
198 | 198 | for ( var method in plObj ) { |
199 | 199 | // js parent preservation for local overwritten methods |
200 | | - if ( this[method] && !this[ 'parent_' + method ] ){ |
| 200 | + if ( this[method] && !this[ 'parent_' + method ] ) { |
201 | 201 | this[ 'parent_' + method ] = this[ method ]; |
202 | 202 | } |
203 | 203 | this[method] = plObj[method]; |
— | — | @@ -262,7 +262,7 @@ |
263 | 263 | this.doWhenClipLoadDone(); |
264 | 264 | } else { |
265 | 265 | mw.log( "only " + _this.clip_ready_count + " clips done, scheduling callback:" ); |
266 | | - setTimeout( function(){ |
| 266 | + setTimeout( function() { |
267 | 267 | _this.doWhenParseDone() |
268 | 268 | }, 100 ); |
269 | 269 | } |
— | — | @@ -306,7 +306,7 @@ |
307 | 307 | // determine the type / first is it m3u or xml? |
308 | 308 | var _this = this; |
309 | 309 | this.src = mw.absoluteUrl( this.src ); |
310 | | - if ( mw.isLocalDomain( this.src ) ){ |
| 310 | + if ( mw.isLocalDomain( this.src ) ) { |
311 | 311 | $j.get( this.src, function( data ) { |
312 | 312 | _this.data = data; |
313 | 313 | _this.getSourceType(); |
— | — | @@ -323,7 +323,7 @@ |
324 | 324 | }); |
325 | 325 | } |
326 | 326 | }, |
327 | | - getSrc: function(){ |
| 327 | + getSrc: function() { |
328 | 328 | return this.src; |
329 | 329 | }, |
330 | 330 | getSourceType:function() { |
— | — | @@ -431,7 +431,7 @@ |
432 | 432 | var _this = this; |
433 | 433 | |
434 | 434 | //Check for playlist player sources: |
435 | | - this.checkPlayerSources(function(){ |
| 435 | + this.checkPlayerSources(function() { |
436 | 436 | _this.buildPlayerUI(); |
437 | 437 | }); |
438 | 438 | }, |
— | — | @@ -439,11 +439,11 @@ |
440 | 440 | /** |
441 | 441 | * Build out the player interface ( assumes checkPlayerSources has been run ) |
442 | 442 | */ |
443 | | - buildPlayerUI: function(){ |
| 443 | + buildPlayerUI: function() { |
444 | 444 | var _this = this; |
445 | 445 | mw.log('pl:buildPlayer'); |
446 | 446 | // Make sure we have interface_wrap |
447 | | - if( $j( this ).parent('.interface_wrap').length == 0 ){ |
| 447 | + if( $j( this ).parent('.interface_wrap').length == 0 ) { |
448 | 448 | // Select "player" |
449 | 449 | $j( this ) |
450 | 450 | // Add interface control class: |
— | — | @@ -639,7 +639,7 @@ |
640 | 640 | * this won't work so well with time range loading for smil (need to work on that) |
641 | 641 | */ |
642 | 642 | loadFutureClips:function() { |
643 | | - /*if( this.cur_clip.embed.bufferedPercent == 1){ |
| 643 | + /*if( this.cur_clip.embed.bufferedPercent == 1) { |
644 | 644 | //set the buffer to the currentTime - duration |
645 | 645 | var curBuffredTime = this.cur_clip.getDuration() - this.cur_clip.embed.currentTime; |
646 | 646 | |
— | — | @@ -647,20 +647,20 @@ |
648 | 648 | curBuffredTime = 0; |
649 | 649 | |
650 | 650 | mw.log( "curBuffredTime:: " + curBuffredTime ); |
651 | | - if( curBuffredTime < this.playlist_buffer_time ){ |
| 651 | + if( curBuffredTime < this.playlist_buffer_time ) { |
652 | 652 | mw.log(" we only have " + curBuffredTime + ' buffed but we need: ' + this.playlist_buffer_time); |
653 | 653 | |
654 | | - for(var inx = this.cur_clip.order + 1; inx < this.default_track.clips.length; inx++ ){ |
| 654 | + for(var inx = this.cur_clip.order + 1; inx < this.default_track.clips.length; inx++ ) { |
655 | 655 | var cClip = this.default_track.getClip( inx ); |
656 | 656 | |
657 | 657 | //check if the clip is already loaded (add its duration) |
658 | | - if( cClip.embed.bufferedPercent == 1){ |
| 658 | + if( cClip.embed.bufferedPercent == 1) { |
659 | 659 | curBuffredTime += cClip.embed.getDuration(); |
660 | 660 | } |
661 | 661 | //check if we still have to load a resource: |
662 | | - if( curBuffredTime < this.playlist_buffer_time ){ |
| 662 | + if( curBuffredTime < this.playlist_buffer_time ) { |
663 | 663 | //issue the load request |
664 | | - if( cClip.embed.networkState==0 ){ |
| 664 | + if( cClip.embed.networkState==0 ) { |
665 | 665 | cClip.embed.load(); |
666 | 666 | } |
667 | 667 | break; //check back next time |
— | — | @@ -715,9 +715,9 @@ |
716 | 716 | this.cur_clip = new_clip; |
717 | 717 | $j( '#clipDesc_' + this.cur_clip.id ).show(); |
718 | 718 | // Update the playhead: |
719 | | - if( this.controls ){ |
| 719 | + if( this.controls ) { |
720 | 720 | // Check if we have into_perc |
721 | | - if( into_perc ){ |
| 721 | + if( into_perc ) { |
722 | 722 | var clip_time = this.cur_clip.dur_offset + ( into_perc * this.cur_clip.getDuration() ); |
723 | 723 | }else{ |
724 | 724 | var clip_time = this.cur_clip.dur_offset; |
— | — | @@ -835,7 +835,7 @@ |
836 | 836 | |
837 | 837 | this.updateUIPauseState(); |
838 | 838 | }, |
839 | | - updateUIPauseState:function(){ |
| 839 | + updateUIPauseState:function() { |
840 | 840 | var _this = this; |
841 | 841 | // Copied from embedPlayer.pause ( in the refactor this is not needed ) |
842 | 842 | // update the ctrl "paused state" |
— | — | @@ -915,7 +915,7 @@ |
916 | 916 | * |
917 | 917 | * @returns the relative offsets of the current clip (given the playlist time) |
918 | 918 | */ |
919 | | - updateClipByTime: function(){ |
| 919 | + updateClipByTime: function() { |
920 | 920 | var _this = this; |
921 | 921 | var prevClip = null; |
922 | 922 | //set the current percent done: |
— | — | @@ -954,7 +954,7 @@ |
955 | 955 | updateBufferStatus: function() { |
956 | 956 | // Update the buffer status for all current clip |
957 | 957 | /*mw.log(' update: '+ this.cur_clip.embed.id + ' to ' + (this.cur_clip.embed.bufferedPercent * 100) ); |
958 | | - if( this.cur_clip.embed && this.cur_clip.embed.bufferedPercent ){ |
| 958 | + if( this.cur_clip.embed && this.cur_clip.embed.bufferedPercent ) { |
959 | 959 | $j('#cl_status_' + this.cur_clip.embed.id ).find('.mw_buffer').css({ |
960 | 960 | 'width': ( this.cur_clip.embed.bufferedPercent * 100) + '%' |
961 | 961 | }) |
— | — | @@ -974,7 +974,7 @@ |
975 | 975 | var cur_pixle = 0; |
976 | 976 | // set up _this |
977 | 977 | //remove any old cl_status |
978 | | - _this.$interface.find( '.play_head' ).find('.cl_status').remove(); |
| 978 | + _this.$interface.find( '.play_head' ).find( '.cl_status' ).remove(); |
979 | 979 | // mw.log("do play head total dur: "+pl_duration ); |
980 | 980 | $j.each( this.default_track.clips, function( i, clip ) { |
981 | 981 | // (use getSoloDuration to not include transitions and such) |
— | — | @@ -993,7 +993,8 @@ |
994 | 994 | barHtml += 'filter:alpha(opacity=40);' + |
995 | 995 | '-moz-opacity:.40;">'; |
996 | 996 | |
997 | | - barHtml += _this.ctrlBuilder.getBufferHtml(); |
| 997 | + barHtml += '<div class="ui-slider-range ui-slider-range-min ui-widget-header ' + |
| 998 | + 'ui-state-highlight ui-corner-all mw_buffer" />'; |
998 | 999 | |
999 | 1000 | barHtml += '</div>'; |
1000 | 1001 | |
— | — | @@ -1046,14 +1047,14 @@ |
1047 | 1048 | else |
1048 | 1049 | this.default_track.clips[ clip_inx ][ trans_type ].run_transition(); |
1049 | 1050 | }, |
1050 | | - getPlayerWidth: function(){ |
| 1051 | + getPlayerWidth: function() { |
1051 | 1052 | var player = $j( this ).get( 0 ); |
1052 | 1053 | if ( typeof player != 'undefined' && player['offsetWidth'] ) |
1053 | 1054 | return player.offsetWidth; |
1054 | 1055 | else |
1055 | 1056 | return parseInt( this.width ); |
1056 | 1057 | }, |
1057 | | - getPlayerHeight: function(){ |
| 1058 | + getPlayerHeight: function() { |
1058 | 1059 | var player = $j( this ).get( 0 ); |
1059 | 1060 | if ( typeof player != 'undefined' && player['offsetHeight'] ) |
1060 | 1061 | return player.offsetHeight; |
— | — | @@ -1114,7 +1115,7 @@ |
1115 | 1116 | // if in sequence mode hide controls / embed links |
1116 | 1117 | // init_pl_embed.play_button=false; |
1117 | 1118 | // init_pl_embed.controls=true; |
1118 | | - // if(this.pp.sequencer=='true'){ |
| 1119 | + // if(this.pp.sequencer=='true') { |
1119 | 1120 | init_pl_embed.linkback = null; |
1120 | 1121 | |
1121 | 1122 | if( this.durationHint ) |
— | — | @@ -1144,11 +1145,11 @@ |
1145 | 1146 | this.pp.refresh(); |
1146 | 1147 | /*var base_src = this.src.substr(0,this.src.indexOf('?')); |
1147 | 1148 | mw.log("delta:"+ delta); |
1148 | | - if(side=='start'){ |
| 1149 | + if(side=='start') { |
1149 | 1150 | //since we adjust start invert the delta: |
1150 | 1151 | var startOffset =parseInt(this.embed.startOffset/1000)+parseInt(delta*-1); |
1151 | 1152 | this.src = base_src +'?t='+ mw.seconds2npt(startOffset) +'/'+ this.embed.end_ntp; |
1152 | | - }else if(side=='end'){ |
| 1153 | + }else if(side=='end') { |
1153 | 1154 | //put back into seconds for adjustment: |
1154 | 1155 | var end_offset = parseInt(this.embed.startOffset/1000) + parseInt(this.embed.duration/1000) + parseInt(delta); |
1155 | 1156 | this.src = base_src +'?t='+ this.embed.start_ntp +'/'+ mw.seconds2npt(end_offset); |
— | — | @@ -1174,7 +1175,7 @@ |
1175 | 1176 | }, |
1176 | 1177 | // output the detail view: |
1177 | 1178 | // @@todo |
1178 | | - /*getDetail:function(){ |
| 1179 | + /*getDetail:function() { |
1179 | 1180 | //mw.log('get detail:' + this.pp.title); |
1180 | 1181 | var th=Math.round( this.layout.clip_desc * this.pp.height ); |
1181 | 1182 | var tw=Math.round( th * this.layout.clip_aspect ); |
— | — | @@ -1191,7 +1192,7 @@ |
1192 | 1193 | $j(this.embed).css({ 'position':"absolute",'top':"0px", 'left':"0px"}); |
1193 | 1194 | |
1194 | 1195 | //mw.log('append child to:#clipDesc_'+this.id); |
1195 | | - if($j('#clipDesc_'+this.id).get(0)){ |
| 1196 | + if($j('#clipDesc_'+this.id).get(0)) { |
1196 | 1197 | $j('#clipDesc_'+this.id).get(0).appendChild(this.embed); |
1197 | 1198 | |
1198 | 1199 | $j('#clipDesc_'+this.id).append(''+ |
— | — | @@ -1511,7 +1512,7 @@ |
1512 | 1513 | // status updates are handled by children clips ... playlist mostly manages smil actions |
1513 | 1514 | this.doSmilActions(); |
1514 | 1515 | |
1515 | | - setTimeout( function(){ |
| 1516 | + setTimeout( function() { |
1516 | 1517 | _this.monitor(); |
1517 | 1518 | }, 250); |
1518 | 1519 | } |
— | — | @@ -1551,7 +1552,7 @@ |
1552 | 1553 | * @param {string} tid the transition type [transIn|transOut] |
1553 | 1554 | * @param {function} callback the callback function passed onto doUPdate |
1554 | 1555 | */ |
1555 | | -mw.PlayList.prototype.procTranType = function( tid, callback){ |
| 1556 | +mw.PlayList.prototype.procTranType = function( tid, callback) { |
1556 | 1557 | // Setup local clip pointer: |
1557 | 1558 | var _clip = this.cur_clip; |
1558 | 1559 | |
— | — | @@ -1570,12 +1571,12 @@ |
1571 | 1572 | tObj.animation_state = 0; |
1572 | 1573 | tObj.run_transition(); |
1573 | 1574 | /*if ( this.userSlide || this.paused ) { |
1574 | | - if ( tid == 'transIn' ){ |
| 1575 | + if ( tid == 'transIn' ) { |
1575 | 1576 | mvTransLib.doUpdate( tObj, |
1576 | 1577 | ( _clip.embed.currentTime / tObj.dur ), |
1577 | 1578 | callback ); |
1578 | 1579 | } |
1579 | | - if ( tid == 'transOut' ){ |
| 1580 | + if ( tid == 'transOut' ) { |
1580 | 1581 | mvTransLib.doUpdate( tObj, |
1581 | 1582 | ( ( _clip.embed.currentTime - ( _clip.dur - tObj.dur ) ) / tObj.dur ), |
1582 | 1583 | callback ); |
— | — | @@ -1831,7 +1832,7 @@ |
1832 | 1833 | |
1833 | 1834 | // }else{ |
1834 | 1835 | // relay on currentTime update grabs (every 250ms or so) (ie for images) |
1835 | | - // if(this.prev_curtime!=this.pClip.embed.currentTime){ |
| 1836 | + // if(this.prev_curtime!=this.pClip.embed.currentTime) { |
1836 | 1837 | // this.prev_curtime = this.pClip.embed.currentTime; |
1837 | 1838 | // this.interValCount=0; |
1838 | 1839 | // } |
— | — | @@ -1845,11 +1846,11 @@ |
1846 | 1847 | this.animation_state = 1; |
1847 | 1848 | } |
1848 | 1849 | |
1849 | | - if( this.transAttrType=='transIn' ){ |
| 1850 | + if( this.transAttrType=='transIn' ) { |
1850 | 1851 | var percentage = ( this.pClip.embed.currentTime / this.dur ) ; |
1851 | 1852 | } |
1852 | 1853 | |
1853 | | - if( this.transAttrType=='transOut' ){ |
| 1854 | + if( this.transAttrType=='transOut' ) { |
1854 | 1855 | var percentage = ( this.pClip.embed.currentTime - |
1855 | 1856 | (this.pClip.dur - this.dur) |
1856 | 1857 | ) |
— | — | @@ -1867,8 +1868,8 @@ |
1868 | 1869 | } |
1869 | 1870 | |
1870 | 1871 | // run the animation ( animation_state == 1 && not "paused") |
1871 | | - if( !this.pClip.pp.paused ){ |
1872 | | - setTimeout( function(){ |
| 1872 | + if( !this.pClip.pp.paused ) { |
| 1873 | + setTimeout( function() { |
1873 | 1874 | _this.run_transition(); |
1874 | 1875 | }, MV_ANIMATION_CB_RATE); |
1875 | 1876 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/remotes/RemoteMwSequencer.js |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | "mwe-sequence-create-one" : "start a sequence" |
12 | 12 | }); |
13 | 13 | |
14 | | -RemoteMwSequencer = function( options ){ |
| 14 | +RemoteMwSequencer = function( options ) { |
15 | 15 | return this.init( options ); |
16 | 16 | }; |
17 | 17 | RemoteMwSequencer.prototype = { |
— | — | @@ -24,9 +24,9 @@ |
25 | 25 | this.target = ( options.target )? options.target : this.target; |
26 | 26 | }, |
27 | 27 | |
28 | | - updateUI: function(){ |
| 28 | + updateUI: function() { |
29 | 29 | // Check page type |
30 | | - if( this.action == 'view' ){ |
| 30 | + if( this.action == 'view' ) { |
31 | 31 | this.showViewUI(); |
32 | 32 | } |
33 | 33 | }, |
— | — | @@ -34,8 +34,8 @@ |
35 | 35 | * Check page for sequence |
36 | 36 | * if not present give link to "create" one. |
37 | 37 | */ |
38 | | - showViewUI: function(){ |
39 | | - if( wgArticleId == 0 ){ |
| 38 | + showViewUI: function() { |
| 39 | + if( wgArticleId == 0 ) { |
40 | 40 | $startLink = $j('<div>').append( |
41 | 41 | $j('<a>') |
42 | 42 | .text( gM('mwe-sequence-create-one') ) |
— | — | @@ -44,9 +44,9 @@ |
45 | 45 | $j( this.target ).html( |
46 | 46 | gM("mwe-no-sequence-create", [this.title, $startLink.html() ]) |
47 | 47 | ); |
48 | | - $j('#mwe-sequence-create').click(function(){ |
| 48 | + $j('#mwe-sequence-create').click(function() { |
49 | 49 | $j('body').append( '<div id="seqcontainer" style="position:absolute;top:5px;bottom:10px;left:10px;right:10px;" />' ); |
50 | | - mw.load( 'Sequencer', function(){ |
| 50 | + mw.load( 'Sequencer', function() { |
51 | 51 | $j('#seqcontainer').sequencer({ |
52 | 52 | 'amw_conf':{ |
53 | 53 | 'enabled_providers':['wiki_commons'] |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/loader.js |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | "JSON" : "modules/ApiProxy/json2.js" |
7 | 7 | } ); |
8 | 8 | |
9 | | -mw.addModuleLoader( 'ApiProxy', function( callback ){ |
| 9 | +mw.addModuleLoader( 'ApiProxy', function( callback ) { |
10 | 10 | mw.load( [ |
11 | 11 | 'mw.ApiProxy', |
12 | 12 | 'JSON' |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/NestedCallbackIframe.html |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
6 | 6 | <title>Simple nested iframe callback page</title> |
7 | 7 | <script type="text/javascript"> |
8 | | -window.onload = function (){ |
| 8 | +window.onload = function () { |
9 | 9 | //call the nested callback in top most frame: |
10 | 10 | top.mw.ApiProxy.nested( window.location.href.split("#")[1] || false ); |
11 | 11 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/mw.ApiProxy.js |
— | — | @@ -124,7 +124,7 @@ |
125 | 125 | |
126 | 126 | // Special callback to frameProxyOk flag |
127 | 127 | // (only used to quickly test the proxy connection) |
128 | | - if ( resultObject.state == 'ok' ){ |
| 128 | + if ( resultObject.state == 'ok' ) { |
129 | 129 | return ; |
130 | 130 | } |
131 | 131 | |
— | — | @@ -138,30 +138,30 @@ |
139 | 139 | * |
140 | 140 | * @param {Function} callback Function to host the |
141 | 141 | */ |
142 | | - $.browseFile = function( options ){ |
| 142 | + $.browseFile = function( options ) { |
143 | 143 | |
144 | 144 | // Set frame proxy ok state flag: |
145 | 145 | frameProxyOk = false; |
146 | 146 | |
147 | | - if( ! options ){ |
| 147 | + if( ! options ) { |
148 | 148 | options = {}; |
149 | 149 | } |
150 | 150 | |
151 | | - if( ! options.target ){ |
| 151 | + if( ! options.target ) { |
152 | 152 | mw.log( "Error: no target for file browse iframe" ) ; |
153 | 153 | return false; |
154 | 154 | } |
155 | | - if( ! options.api_url ){ |
| 155 | + if( ! options.api_url ) { |
156 | 156 | mw.log( "Error: no api url to target" ); |
157 | 157 | return false; |
158 | 158 | } |
159 | 159 | //update the current apiUrl: |
160 | 160 | currentApiUrl = options.api_url; |
161 | 161 | |
162 | | - if( ! options.width ){ |
| 162 | + if( ! options.width ) { |
163 | 163 | options.width = 270; |
164 | 164 | } |
165 | | - if( ! options.height ){ |
| 165 | + if( ! options.height ) { |
166 | 166 | options.height = 27; |
167 | 167 | } |
168 | 168 | var iFrameName = ( options.iframeName ) ? options.iframeName : 'fileBrowse_' + $j('iframe').length; |
— | — | @@ -200,21 +200,21 @@ |
201 | 201 | }; |
202 | 202 | |
203 | 203 | // Setup the proxy callback to display the upload unhide the iframe upload form |
204 | | - proxyCallback = function( iframeData ){ |
| 204 | + proxyCallback = function( iframeData ) { |
205 | 205 | // proccess fileBrowse callbacks:: |
206 | 206 | |
207 | 207 | // check for basic status "ok" |
208 | | - if( iframeData['status'] == 'ok' ){ |
| 208 | + if( iframeData['status'] == 'ok' ) { |
209 | 209 | // Hide the loading spinner |
210 | 210 | $j( options.target ).find('.loading_spinner').fadeOut('fast'); |
211 | 211 | mw.log("iframe ready callback"); |
212 | 212 | $j( '#' + iFrameName ).fadeIn( 'fast' ); |
213 | 213 | } |
214 | 214 | // else check for event |
215 | | - if( iframeData['event'] ){ |
216 | | - switch( iframeData['event'] ){ |
| 215 | + if( iframeData['event'] ) { |
| 216 | + switch( iframeData['event'] ) { |
217 | 217 | case 'selectFileCb': |
218 | | - if( options.selectFileCb ){ |
| 218 | + if( options.selectFileCb ) { |
219 | 219 | options.selectFileCb( iframeData['fileName'] ); |
220 | 220 | } |
221 | 221 | break; |
— | — | @@ -233,7 +233,7 @@ |
234 | 234 | $.server = function() { |
235 | 235 | var proxyConfig = mw.getConfig( 'apiProxyConfig' ); |
236 | 236 | // Validate the server request: |
237 | | - if( !validateIframeRequest( proxyConfig ) ){ |
| 237 | + if( !validateIframeRequest( proxyConfig ) ) { |
238 | 238 | mw.log( "Not a valid iframe request"); |
239 | 239 | return false; |
240 | 240 | } |
— | — | @@ -252,7 +252,7 @@ |
253 | 253 | /** |
254 | 254 | * Get the client frame path ( within mwEmbed ) |
255 | 255 | */ |
256 | | - function getClientFrame(){ |
| 256 | + function getClientFrame() { |
257 | 257 | return mw.getMwEmbedPath() + 'modules/ApiProxy/NestedCallbackIframe.html'; |
258 | 258 | } |
259 | 259 | |
— | — | @@ -265,9 +265,9 @@ |
266 | 266 | * ( there is no cost if they do already have the gadget on ) |
267 | 267 | */ |
268 | 268 | var gadgetWithJS = 'withJS=MediaWiki:Gadget-mwEmbed.js'; |
269 | | - function getServerFrame( apiUrl ){ |
| 269 | + function getServerFrame( apiUrl ) { |
270 | 270 | // Set to local scope currentApiUrl if unset by argument |
271 | | - if( !apiUrl){ |
| 271 | + if( !apiUrl) { |
272 | 272 | apiUrl = currentApiUrl; |
273 | 273 | } |
274 | 274 | var parsedUrl = mw.parseUri( apiUrl ); |
— | — | @@ -276,9 +276,9 @@ |
277 | 277 | /** |
278 | 278 | * Same as getServerFrame but for browse file interface |
279 | 279 | */ |
280 | | - function getServerBrowseFileFrame( apiUrl ){ |
| 280 | + function getServerBrowseFileFrame( apiUrl ) { |
281 | 281 | // Set to local scope currentApiUrl if unset by argument |
282 | | - if( !apiUrl){ |
| 282 | + if( !apiUrl) { |
283 | 283 | apiUrl = currentApiUrl; |
284 | 284 | } |
285 | 285 | var parsedUrl = mw.parseUri( apiUrl ); |
— | — | @@ -335,7 +335,7 @@ |
336 | 336 | * checks master_blacklist |
337 | 337 | * checks master_whitelist |
338 | 338 | */ |
339 | | - function validateIframeRequest( proxyConfig ){ |
| 339 | + function validateIframeRequest( proxyConfig ) { |
340 | 340 | var clientRequest = false; |
341 | 341 | |
342 | 342 | |
— | — | @@ -369,7 +369,7 @@ |
370 | 370 | * Check if a domain is allowed. |
371 | 371 | * @param {Object} clientFrame |
372 | 372 | */ |
373 | | - function isAllowedClientFrame( clientFrame ){ |
| 373 | + function isAllowedClientFrame( clientFrame ) { |
374 | 374 | var clientDomain = mw.parseUri( clientFrame ).host ; |
375 | 375 | // Get the proxy config |
376 | 376 | var proxyConfig = mw.getConfig( 'apiProxyConfig' ); |
— | — | @@ -399,7 +399,7 @@ |
400 | 400 | * Get the client request from the document hash |
401 | 401 | * @return {Object} the object result of parsing the document anchor msg |
402 | 402 | */ |
403 | | - function getClientRequest(){ |
| 403 | + function getClientRequest() { |
404 | 404 | // Read the anchor data package from the requesting url |
405 | 405 | var hashMsg = unescape( mw.parseUri( document.URL ).anchor ); |
406 | 406 | try { |
— | — | @@ -455,10 +455,10 @@ |
456 | 456 | * serverHandleRequest handle a given request from the client |
457 | 457 | * maps the request to serverBrowseFile or serverApiRequest |
458 | 458 | */ |
459 | | - function serverHandleRequest(){ |
| 459 | + function serverHandleRequest() { |
460 | 460 | var clientRequest = getClientRequest(); |
461 | 461 | // Process request type |
462 | | - if( clientRequest['browseFile'] ){ |
| 462 | + if( clientRequest['browseFile'] ) { |
463 | 463 | serverBrowseFile(); |
464 | 464 | return true; |
465 | 465 | } |
— | — | @@ -490,11 +490,11 @@ |
491 | 491 | * |
492 | 492 | * Sets the page content to browser file |
493 | 493 | */ |
494 | | - function serverBrowseFile( ){ |
| 494 | + function serverBrowseFile( ) { |
495 | 495 | // Get the proxy config |
496 | 496 | var proxyConfig = mw.getConfig( 'apiProxyConfig' ); |
497 | 497 | //check for fw ( file width ) |
498 | | - if( ! proxyConfig.fileWidth ){ |
| 498 | + if( ! proxyConfig.fileWidth ) { |
499 | 499 | proxyConfig.fileWidth = 130; |
500 | 500 | } |
501 | 501 | //Build a form with bindings similar to uploadPage.js ( but only the browse button ) |
— | — | @@ -526,7 +526,7 @@ |
527 | 527 | // load the mw.upload library with iframe interface (similar to uploadPage.js) |
528 | 528 | |
529 | 529 | // If wgEnableFirefogg is not boolean false, set to true |
530 | | - if ( typeof wgEnableFirefogg == 'undefined' ){ |
| 530 | + if ( typeof wgEnableFirefogg == 'undefined' ) { |
531 | 531 | wgEnableFirefogg = true; |
532 | 532 | } |
533 | 533 | |
— | — | @@ -536,7 +536,7 @@ |
537 | 537 | 'interface_type' : 'iframe', |
538 | 538 | |
539 | 539 | // Set the select file callback to update clientFrame |
540 | | - 'selectFileCb' : function( fileName ){ |
| 540 | + 'selectFileCb' : function( fileName ) { |
541 | 541 | sendClientMsg( { |
542 | 542 | 'event': 'selectFileCb', |
543 | 543 | 'fileName' : fileName |
— | — | @@ -544,14 +544,14 @@ |
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
548 | | - if( wgEnableFirefogg ){ |
549 | | - mw.load( 'AddMedia.firefogg', function(){ |
| 548 | + if( wgEnableFirefogg ) { |
| 549 | + mw.load( 'AddMedia.firefogg', function() { |
550 | 550 | $j( '#wpUploadFile' ).firefogg( uploadConfig ); |
551 | 551 | // Update status |
552 | 552 | sendClientMsg( {'status':'ok'} ); |
553 | 553 | }); |
554 | 554 | } else { |
555 | | - mw.load( 'AddMedia.UploadHandler', function(){ |
| 555 | + mw.load( 'AddMedia.UploadHandler', function() { |
556 | 556 | $j( 'mw-upload-form' ).uploadHandler( uploadConfig ); |
557 | 557 | sendClientMsg( {'status':'ok'} ); |
558 | 558 | }); |
— | — | @@ -569,7 +569,7 @@ |
570 | 570 | var clientFrame = getClientRequest()['clientFrame']; |
571 | 571 | |
572 | 572 | // Double check that the client is an approved domain before outputing the iframe |
573 | | - if( ! isAllowedClientFrame ( clientFrame ) ){ |
| 573 | + if( ! isAllowedClientFrame ( clientFrame ) ) { |
574 | 574 | mw.log( "cant send msg to " + clientFrame ); |
575 | 575 | return false; |
576 | 576 | } |
— | — | @@ -589,7 +589,7 @@ |
590 | 590 | // After the nested frame is done loading schedule its removal |
591 | 591 | $j( '#' + nestName ).get( 0 ).onload = function() { |
592 | 592 | // Use a settimeout to give time for client frame to propagate update. |
593 | | - setTimeout( function(){ |
| 593 | + setTimeout( function() { |
594 | 594 | $j('#' + nestName ).remove(); |
595 | 595 | }, 10 ); |
596 | 596 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/colorpicker/index.html |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | $(this).ColorPickerSetColor(this.value); |
62 | 62 | } |
63 | 63 | }) |
64 | | -.bind('keyup', function(){ |
| 64 | +.bind('keyup', function() { |
65 | 65 | $(this).ColorPickerSetColor(this.value); |
66 | 66 | }); |
67 | 67 | </pre> |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/colorpicker/js/colorpicker.js |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | defaults = { |
19 | 19 | eventName: 'click', |
20 | 20 | onShow: function () {}, |
21 | | - onBeforeShow: function(){}, |
| 21 | + onBeforeShow: function() {}, |
22 | 22 | onHide: function () {}, |
23 | 23 | onChange: function () {}, |
24 | 24 | onSubmit: function () {}, |
— | — | @@ -458,7 +458,7 @@ |
459 | 459 | } else { |
460 | 460 | return this; |
461 | 461 | } |
462 | | - return this.each(function(){ |
| 462 | + return this.each(function() { |
463 | 463 | if ($(this).data('colorpickerId')) { |
464 | 464 | var cal = $('#' + $(this).data('colorpickerId')); |
465 | 465 | cal.data('colorpicker').color = col; |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/colorpicker/js/layout.js |
— | — | @@ -1,4 +1,4 @@ |
2 | | -(function($){ |
| 2 | +(function($) { |
3 | 3 | var initLayout = function() { |
4 | 4 | var hash = window.location.hash.replace('#', ''); |
5 | 5 | var currentTab = $('ul.navigationTabs a') |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | $(this).ColorPickerSetColor(this.value); |
33 | 33 | } |
34 | 34 | }) |
35 | | - .bind('keyup', function(){ |
| 35 | + .bind('keyup', function() { |
36 | 36 | $(this).ColorPickerSetColor(this.value); |
37 | 37 | }); |
38 | 38 | $('#colorSelector').ColorPicker({ |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/colorpicker/js/utils.js |
— | — | @@ -175,7 +175,7 @@ |
176 | 176 | { |
177 | 177 | func(nodeEl); |
178 | 178 | nodeEl = nodeEl.firstChild; |
179 | | - while(nodeEl){ |
| 179 | + while(nodeEl) { |
180 | 180 | EYE.traverseDOM(nodeEl, func); |
181 | 181 | nodeEl = nodeEl.nextSibling; |
182 | 182 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/colorpicker/js/eye.js |
— | — | @@ -4,14 +4,14 @@ |
5 | 5 | * Author: Stefan Petre www.eyecon.ro |
6 | 6 | * |
7 | 7 | */ |
8 | | -(function($){ |
| 8 | +(function($) { |
9 | 9 | var EYE = window.EYE = function() { |
10 | 10 | var _registered = { |
11 | 11 | init: [] |
12 | 12 | }; |
13 | 13 | return { |
14 | 14 | init: function() { |
15 | | - $.each(_registered.init, function(nr, fn){ |
| 15 | + $.each(_registered.init, function(nr, fn) { |
16 | 16 | fn.call(); |
17 | 17 | }); |
18 | 18 | }, |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/pixastic-editor/editor.js |
— | — | @@ -164,7 +164,7 @@ |
165 | 165 | var undoRatio = canvasWidth / canvasHeight; |
166 | 166 | |
167 | 167 | for (var i=undoImages.length-1;i>=0;i--) { |
168 | | - (function(){ |
| 168 | + (function() { |
169 | 169 | var canvas = document.createElement("canvas"); |
170 | 170 | $j(canvas) |
171 | 171 | .addClass("undo-canvas-small") |
— | — | @@ -199,8 +199,8 @@ |
200 | 200 | $link = $j("<a href='#'></a>", doc) |
201 | 201 | .addClass("undo-link") |
202 | 202 | .appendTo($listCtr) |
203 | | - .mouseover(function(){ $j(this).addClass("hover") }) |
204 | | - .mouseout(function(){ $j(this).removeClass("hover") }); |
| 203 | + .mouseover(function() { $j(this).addClass("hover") }) |
| 204 | + .mouseout(function() { $j(this).removeClass("hover") }); |
205 | 205 | $j(canvas).appendTo($link); |
206 | 206 | |
207 | 207 | var displayShowing; |
— | — | @@ -389,8 +389,8 @@ |
390 | 390 | .click(function() { |
391 | 391 | enableTab(tab.id); |
392 | 392 | }) |
393 | | - .mouseover(function(){ $j(this).addClass("hover") }) |
394 | | - .mouseout(function(){ $j(this).removeClass("hover") }); |
| 393 | + .mouseover(function() { $j(this).addClass("hover") }) |
| 394 | + .mouseout(function() { $j(this).removeClass("hover") }); |
395 | 395 | |
396 | 396 | $j("#main-bar", doc).append($tabElement); |
397 | 397 | |
— | — | @@ -479,7 +479,7 @@ |
480 | 480 | for (var k=0;k<action.controls.length;k++) { |
481 | 481 | var control = action.controls[k]; |
482 | 482 | if (typeof control.defaultValue != "function") { |
483 | | - (function(){ |
| 483 | + (function() { |
484 | 484 | var defVal = control.defaultValue; |
485 | 485 | control.defaultValue = function() { |
486 | 486 | return defVal; |
— | — | @@ -707,14 +707,14 @@ |
708 | 708 | height : "100%", |
709 | 709 | zIndex : "11" |
710 | 710 | }); |
711 | | - $frame.load(function(){ |
| 711 | + $frame.load(function() { |
712 | 712 | doc = $frame.get(0).contentDocument; |
713 | 713 | |
714 | 714 | buildEditor(); |
715 | 715 | callback(); |
716 | 716 | $frame.show(); |
717 | 717 | hideLoadingScreen(); |
718 | | - setTimeout(function(){ |
| 718 | + setTimeout(function() { |
719 | 719 | updateDisplayCanvas(); |
720 | 720 | },10); |
721 | 721 | }); |
— | — | @@ -827,8 +827,8 @@ |
828 | 828 | .css("left", "-9999px") |
829 | 829 | .css("top", "-9999px") |
830 | 830 | .appendTo("body") |
831 | | - .load(function(){onload(this);}) |
832 | | - .error(function(){ |
| 831 | + .load(function() {onload(this);}) |
| 832 | + .error(function() { |
833 | 833 | throw new Error("Could not load temporary copy image. Is provided image valid?"); |
834 | 834 | unload(); |
835 | 835 | }) |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/pixastic-lib/pixastic-editor/editor.js |
— | — | @@ -164,7 +164,7 @@ |
165 | 165 | var undoRatio = canvasWidth / canvasHeight; |
166 | 166 | |
167 | 167 | for (var i=undoImages.length-1;i>=0;i--) { |
168 | | - (function(){ |
| 168 | + (function() { |
169 | 169 | var canvas = document.createElement("canvas"); |
170 | 170 | $j(canvas) |
171 | 171 | .addClass("undo-canvas-small") |
— | — | @@ -199,8 +199,8 @@ |
200 | 200 | $link = $j("<a href='#'></a>", doc) |
201 | 201 | .addClass("undo-link") |
202 | 202 | .appendTo($listCtr) |
203 | | - .mouseover(function(){ $j(this).addClass("hover") }) |
204 | | - .mouseout(function(){ $j(this).removeClass("hover") }); |
| 203 | + .mouseover(function() { $j(this).addClass("hover") }) |
| 204 | + .mouseout(function() { $j(this).removeClass("hover") }); |
205 | 205 | $j(canvas).appendTo($link); |
206 | 206 | |
207 | 207 | var displayShowing; |
— | — | @@ -389,8 +389,8 @@ |
390 | 390 | .click(function() { |
391 | 391 | enableTab(tab.id); |
392 | 392 | }) |
393 | | - .mouseover(function(){ $j(this).addClass("hover") }) |
394 | | - .mouseout(function(){ $j(this).removeClass("hover") }); |
| 393 | + .mouseover(function() { $j(this).addClass("hover") }) |
| 394 | + .mouseout(function() { $j(this).removeClass("hover") }); |
395 | 395 | |
396 | 396 | $j("#main-bar", doc).append($tabElement); |
397 | 397 | |
— | — | @@ -479,7 +479,7 @@ |
480 | 480 | for (var k=0;k<action.controls.length;k++) { |
481 | 481 | var control = action.controls[k]; |
482 | 482 | if (typeof control.defaultValue != "function") { |
483 | | - (function(){ |
| 483 | + (function() { |
484 | 484 | var defVal = control.defaultValue; |
485 | 485 | control.defaultValue = function() { |
486 | 486 | return defVal; |
— | — | @@ -707,14 +707,14 @@ |
708 | 708 | height : "100%", |
709 | 709 | zIndex : "11" |
710 | 710 | }); |
711 | | - $frame.load(function(){ |
| 711 | + $frame.load(function() { |
712 | 712 | doc = $frame.get(0).contentDocument; |
713 | 713 | |
714 | 714 | buildEditor(); |
715 | 715 | callback(); |
716 | 716 | $frame.show(); |
717 | 717 | hideLoadingScreen(); |
718 | | - setTimeout(function(){ |
| 718 | + setTimeout(function() { |
719 | 719 | updateDisplayCanvas(); |
720 | 720 | },10); |
721 | 721 | }); |
— | — | @@ -827,8 +827,8 @@ |
828 | 828 | .css("left", "-9999px") |
829 | 829 | .css("top", "-9999px") |
830 | 830 | .appendTo("body") |
831 | | - .load(function(){onload(this);}) |
832 | | - .error(function(){ |
| 831 | + .load(function() {onload(this);}) |
| 832 | + .error(function() { |
833 | 833 | throw new Error("Could not load temporary copy image. Is provided image valid?"); |
834 | 834 | unload(); |
835 | 835 | }) |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/mw.ClipEdit.js |
— | — | @@ -115,7 +115,7 @@ |
116 | 116 | * |
117 | 117 | * Clip edit profile is either "sequence" or "clip" |
118 | 118 | */ |
119 | | - showControlEdit: function(){ |
| 119 | + showControlEdit: function() { |
120 | 120 | mw.log( 'showControlEdit' ); |
121 | 121 | if ( this.profile == 'sequence' ) { |
122 | 122 | this.showEditTypesMenu(); |
— | — | @@ -139,7 +139,7 @@ |
140 | 140 | /** |
141 | 141 | * Get the mediatype for the current resource |
142 | 142 | */ |
143 | | - getMediaType: function (){ |
| 143 | + getMediaType: function () { |
144 | 144 | if( this.media_type ) |
145 | 145 | return this.media_type; |
146 | 146 | // If media type was not supplied detect for resource if possible: |
— | — | @@ -761,7 +761,7 @@ |
762 | 762 | ); |
763 | 763 | |
764 | 764 | // Make sure the default is reflected: |
765 | | - if ( ! _this.resource.layout ){ |
| 765 | + if ( ! _this.resource.layout ) { |
766 | 766 | _this.resource.layout = 'right'; |
767 | 767 | } |
768 | 768 | |
— | — | @@ -974,7 +974,7 @@ |
975 | 975 | /** |
976 | 976 | * Bind the Crop once the library $j.Jcrop is ready: |
977 | 977 | */ |
978 | | - bindCrop: function(){ |
| 978 | + bindCrop: function() { |
979 | 979 | var _this = this; |
980 | 980 | $j( '.mw_crop_msg_load' ).hide(); |
981 | 981 | $j( '.mw_reset_crop,.mw_apply_crop' ).show(); |
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js |
— | — | @@ -68,8 +68,8 @@ |
69 | 69 | * @param {String} value Value of configuration name |
70 | 70 | */ |
71 | 71 | mw.setConfig = function ( name, value ) { |
72 | | - if( typeof name == 'object' ){ |
73 | | - for( var i in name ){ |
| 72 | + if( typeof name == 'object' ) { |
| 73 | + for( var i in name ) { |
74 | 74 | mw.setConfig( i, name[ i ] ); |
75 | 75 | } |
76 | 76 | } |
— | — | @@ -85,14 +85,14 @@ |
86 | 86 | * @param [Mixed] value Set configuration name to value |
87 | 87 | */ |
88 | 88 | mw.setDefaultConfig = function( name, value ) { |
89 | | - if( typeof name == 'object' ){ |
90 | | - for( var i in name ){ |
| 89 | + if( typeof name == 'object' ) { |
| 90 | + for( var i in name ) { |
91 | 91 | mw.setDefaultConfig( i, name[ i ] ); |
92 | 92 | } |
93 | 93 | return ; |
94 | 94 | } |
95 | 95 | // Name is a string update the config directly |
96 | | - if( ! mwConfig[ name ] ){ |
| 96 | + if( ! mwConfig[ name ] ) { |
97 | 97 | mwConfig[ name ] = value; |
98 | 98 | } |
99 | 99 | } |
— | — | @@ -104,7 +104,7 @@ |
105 | 105 | * @return {Mixed} value of configuration key |
106 | 106 | * returns "false" if key not found |
107 | 107 | */ |
108 | | - mw.getConfig = function ( name ){ |
| 108 | + mw.getConfig = function ( name ) { |
109 | 109 | if( mwConfig[ name ] ) |
110 | 110 | return mwConfig[ name ]; |
111 | 111 | return false; |
— | — | @@ -125,18 +125,18 @@ |
126 | 126 | * @parma {Function} callback Function to be called once userPrefrences are loaded |
127 | 127 | */ |
128 | 128 | var setupUserConfigFlag = false; |
129 | | - mw.setupUserConfig = function( callback ){ |
130 | | - if( setupUserConfigFlag ){ |
| 129 | + mw.setupUserConfig = function( callback ) { |
| 130 | + if( setupUserConfigFlag ) { |
131 | 131 | if( callback ) |
132 | 132 | callback(); |
133 | 133 | } |
134 | 134 | // Do Setup user config: |
135 | | - mw.load( [ '$j.cookie', 'JSON' ], function(){ |
136 | | - if( $j.cookie( 'mwUserConfig' ) ){ |
| 135 | + mw.load( [ '$j.cookie', 'JSON' ], function() { |
| 136 | + if( $j.cookie( 'mwUserConfig' ) ) { |
137 | 137 | mwUserConfig = JSON.parse( $j.cookie( 'mwUserConfig' ) ); |
138 | 138 | } |
139 | 139 | mw.log( 'mw: ' + $j.cookie( 'mwUserConfig' ) ); |
140 | | - for(var i in mwUserConfig ){ |
| 140 | + for(var i in mwUserConfig ) { |
141 | 141 | mw.log( 'i: ' + i + ' ' + mwUserConfig[ i ] ) ; |
142 | 142 | } |
143 | 143 | //debugger; |
— | — | @@ -154,8 +154,8 @@ |
155 | 155 | * @param {String} name Name of user configuration value |
156 | 156 | * @param {String} value Value of configuration name |
157 | 157 | */ |
158 | | - mw.setUserConfig = function ( name, value, cookieOptions ){ |
159 | | - if( ! setupUserConfigFlag ){ |
| 158 | + mw.setUserConfig = function ( name, value, cookieOptions ) { |
| 159 | + if( ! setupUserConfigFlag ) { |
160 | 160 | mw.log( "Error: userConfig not setup" ); |
161 | 161 | return false; |
162 | 162 | } |
— | — | @@ -174,7 +174,7 @@ |
175 | 175 | * value of the configuration name |
176 | 176 | * false if the configuration name could not be found |
177 | 177 | */ |
178 | | - mw.getUserConfig = function ( name ){ |
| 178 | + mw.getUserConfig = function ( name ) { |
179 | 179 | if( mwUserConfig[ name ] ) |
180 | 180 | return mwUserConfig[ name ]; |
181 | 181 | return false; |
— | — | @@ -247,13 +247,13 @@ |
248 | 248 | // Replace Values |
249 | 249 | if ( typeof args == 'object' || typeof args == 'array' ) { |
250 | 250 | for ( var v =0; v < args.length; v++ ) { |
251 | | - if( typeof args[v] == 'undefined' ){ |
| 251 | + if( typeof args[v] == 'undefined' ) { |
252 | 252 | continue; |
253 | 253 | } |
254 | 254 | var replaceValue = args[ v ]; |
255 | 255 | |
256 | 256 | // Convert number if applicable |
257 | | - if( parseInt( replaceValue ) == replaceValue ){ |
| 257 | + if( parseInt( replaceValue ) == replaceValue ) { |
258 | 258 | replaceValue = mw.lang.convertNumber( replaceValue ); |
259 | 259 | } |
260 | 260 | |
— | — | @@ -261,7 +261,7 @@ |
262 | 262 | var rep = new RegExp( '\\$' + ( parseInt( v ) + 1 ), 'g' ); |
263 | 263 | |
264 | 264 | // Check if we got passed in a jQuery object: |
265 | | - if( typeof args[v]['html'] == 'function' ){ |
| 265 | + if( typeof args[v]['html'] == 'function' ) { |
266 | 266 | message = message.replace( rep, $j('<div />').append( replaceValue ).html() ); |
267 | 267 | }else{ |
268 | 268 | // Assume replaceValue string |
— | — | @@ -270,7 +270,7 @@ |
271 | 271 | } |
272 | 272 | } else if ( typeof args == 'string' || typeof args == 'number' ) { |
273 | 273 | // Convert number if applicable |
274 | | - if( parseInt( args ) == args ){ |
| 274 | + if( parseInt( args ) == args ) { |
275 | 275 | args = mw.lang.convertNumber( args ); |
276 | 276 | } |
277 | 277 | message = message.replace( /\$1/g, args ); |
— | — | @@ -322,7 +322,7 @@ |
323 | 323 | // ( gRuleSet is loaded from script-loader to contains local ruleset ) |
324 | 324 | var rs = gRuleSet[ 'PLURAL' ]; |
325 | 325 | |
326 | | - if( tObj.arg && tObj.param && mw.lang.convertPlural){ |
| 326 | + if( tObj.arg && tObj.param && mw.lang.convertPlural) { |
327 | 327 | // Check if we have forms to replace |
328 | 328 | if ( tObj.param.length == 0 ) { |
329 | 329 | return ''; |
— | — | @@ -335,7 +335,7 @@ |
336 | 336 | |
337 | 337 | } |
338 | 338 | // Could not proccess plural return first form or nothing |
339 | | - if( tObj.param[0] ){ |
| 339 | + if( tObj.param[0] ) { |
340 | 340 | return tObj.param[0]; |
341 | 341 | } |
342 | 342 | return ''; |
— | — | @@ -374,11 +374,11 @@ |
375 | 375 | var transformTable = mw.lang.digitTransformTable; |
376 | 376 | |
377 | 377 | // Check if the "restore" to latin number flag is set: |
378 | | - if( typeInt ){ |
| 378 | + if( typeInt ) { |
379 | 379 | if( parseInt( number ) == number ) |
380 | 380 | return number; |
381 | 381 | var tmp = []; |
382 | | - for( var i in transformTable ){ |
| 382 | + for( var i in transformTable ) { |
383 | 383 | tmp[ transformTable[ i ] ] = i; |
384 | 384 | } |
385 | 385 | transformTable = tmp; |
— | — | @@ -386,8 +386,8 @@ |
387 | 387 | |
388 | 388 | var numberString = '' + number; |
389 | 389 | var convertedNumber = ''; |
390 | | - for( var i =0; i < numberString.length; i++){ |
391 | | - if( transformTable[ numberString[i] ] ){ |
| 390 | + for( var i =0; i < numberString.length; i++) { |
| 391 | + if( transformTable[ numberString[i] ] ) { |
392 | 392 | convertedNumber += transformTable[ numberString[i] ]; |
393 | 393 | }else{ |
394 | 394 | convertedNumber += numberString[i]; |
— | — | @@ -401,10 +401,10 @@ |
402 | 402 | * @param {String} langKey Language key to be checked |
403 | 403 | * @return true if valid language, false if not |
404 | 404 | */ |
405 | | - mw.isValidLang = function( langKey ){ |
| 405 | + mw.isValidLang = function( langKey ) { |
406 | 406 | var langList = mw.getConfig( 'languageCodeList'); |
407 | | - for(var i =0; i < langList.length; i++){ |
408 | | - if( langList[i] == langKey ){ |
| 407 | + for(var i =0; i < langList.length; i++) { |
| 408 | + if( langList[i] == langKey ) { |
409 | 409 | return true; |
410 | 410 | } |
411 | 411 | } |
— | — | @@ -421,12 +421,12 @@ |
422 | 422 | var ammessages = ''; |
423 | 423 | if ( typeof msgSet == 'object' ) { |
424 | 424 | for ( var i in msgSet ) { |
425 | | - if( !messageCache[ i ] ){ |
| 425 | + if( !messageCache[ i ] ) { |
426 | 426 | ammessages += msgSet[i] + '|'; |
427 | 427 | } |
428 | 428 | } |
429 | 429 | } else if ( typeof msgSet == 'string' ) { |
430 | | - if( !messageCache[ i ] ){ |
| 430 | + if( !messageCache[ i ] ) { |
431 | 431 | ammessages += msgSet; |
432 | 432 | } |
433 | 433 | } |
— | — | @@ -701,24 +701,24 @@ |
702 | 702 | * |
703 | 703 | * NOTE: should be integrated with the parser |
704 | 704 | */ |
705 | | - getTemplateVars: function(){ |
| 705 | + getTemplateVars: function() { |
706 | 706 | //mw.log('matching against: ' + wikiText); |
707 | 707 | templateVars = new Array(); |
708 | 708 | var tempVars = wikiText.match(/\{\{\{([^\}]*)\}\}\}/gi); |
709 | 709 | |
710 | 710 | // Clean up results: |
711 | | - for(var i=0; i < tempVars.length; i++){ |
| 711 | + for(var i=0; i < tempVars.length; i++) { |
712 | 712 | //match |
713 | 713 | var tvar = tempVars[i].replace('{{{','').replace('}}}',''); |
714 | 714 | |
715 | 715 | // Strip anything after a | |
716 | | - if(tvar.indexOf('|') != -1){ |
| 716 | + if(tvar.indexOf('|') != -1) { |
717 | 717 | tvar = tvar.substr(0, tvar.indexOf('|')); |
718 | 718 | } |
719 | 719 | |
720 | 720 | // Check for duplicates: |
721 | 721 | var do_add=true; |
722 | | - for(var j=0; j < templateVars.length; j++){ |
| 722 | + for(var j=0; j < templateVars.length; j++) { |
723 | 723 | if( templateVars[j] == tvar) |
724 | 724 | do_add=false; |
725 | 725 | } |
— | — | @@ -758,7 +758,7 @@ |
759 | 759 | * @return {Object} parserObj returns a parser object that has methods for getting at |
760 | 760 | * things you would want |
761 | 761 | */ |
762 | | - mw.parser = function( wikiText, options){ |
| 762 | + mw.parser = function( wikiText, options) { |
763 | 763 | // return the parserObj |
764 | 764 | return new parseObj( wikiText, options ) ; |
765 | 765 | } |
— | — | @@ -784,7 +784,7 @@ |
785 | 785 | * |
786 | 786 | * @param {Object} targetObj Interface Object to add hook system to. |
787 | 787 | */ |
788 | | - mw.addHookSystem = function( targetObj ){ |
| 788 | + mw.addHookSystem = function( targetObj ) { |
789 | 789 | // Setup the target object hook holder: |
790 | 790 | targetObj[ 'hooks' ] = { }; |
791 | 791 | |
— | — | @@ -796,7 +796,7 @@ |
797 | 797 | * @param {String} hookName Name of hook to be added |
798 | 798 | * @param {Function} hookFunction Function to be called at hook time |
799 | 799 | */ |
800 | | - targetObj.addHook = function( hookName, hookFunction ){ |
| 800 | + targetObj.addHook = function( hookName, hookFunction ) { |
801 | 801 | if( ! this.hooks[ hookName ] ) |
802 | 802 | this.hooks[ hookName ] = [ ]; |
803 | 803 | this.hooks[ hookName ].push( hookFunction ) |
— | — | @@ -812,10 +812,10 @@ |
813 | 813 | * true interface should continue function execution |
814 | 814 | * false interface should stop or return from method |
815 | 815 | */ |
816 | | - targetObj.runHook = function( hookName ){ |
817 | | - if( this.hooks[ hookName ] ){ |
818 | | - for( var i in this.hooks[ hookName ]){ |
819 | | - if( typeof( this.hooks[ hookName ][ i ] ) == 'function'){ |
| 816 | + targetObj.runHook = function( hookName ) { |
| 817 | + if( this.hooks[ hookName ] ) { |
| 818 | + for( var i in this.hooks[ hookName ]) { |
| 819 | + if( typeof( this.hooks[ hookName ][ i ] ) == 'function') { |
820 | 820 | return this.hooks[ hookName ][ i ]( this ); |
821 | 821 | } |
822 | 822 | } |
— | — | @@ -879,17 +879,17 @@ |
880 | 880 | * |
881 | 881 | * @param {Function} callback Function called once loading is complete |
882 | 882 | */ |
883 | | - load: function( loadRequest, callback ){ |
| 883 | + load: function( loadRequest, callback ) { |
884 | 884 | // Check for empty loadRequest ( directly return the callback ) |
885 | | - if( mw.isEmpty( loadRequest ) ){ |
| 885 | + if( mw.isEmpty( loadRequest ) ) { |
886 | 886 | mw.log( 'Empty load request: ' + loadRequest ); |
887 | 887 | callback( loadRequest ); |
888 | 888 | return ; |
889 | 889 | } |
890 | 890 | |
891 | 891 | // Check if its a multi-part request: |
892 | | - if( typeof loadRequest == 'object' ){ |
893 | | - if( loadRequest.length > 1 ){ |
| 892 | + if( typeof loadRequest == 'object' ) { |
| 893 | + if( loadRequest.length > 1 ) { |
894 | 894 | this.loadMany ( loadRequest, callback ); |
895 | 895 | return ; |
896 | 896 | }else{ |
— | — | @@ -901,7 +901,7 @@ |
902 | 902 | // Check for the module name loader function |
903 | 903 | if( this.moduleLoaders[ loadRequest ] && |
904 | 904 | typeof ( this.moduleLoaders[ loadRequest ] ) == 'function' |
905 | | - ){ |
| 905 | + ) { |
906 | 906 | mw.log("mw.load: loadModule:" + loadRequest ); |
907 | 907 | // Run the module with the parent callback |
908 | 908 | this.moduleLoaders[ loadRequest ]( callback ); |
— | — | @@ -909,7 +909,7 @@ |
910 | 910 | } |
911 | 911 | |
912 | 912 | // Check for javascript class |
913 | | - if( this.getClassPath( loadRequest ) ){ |
| 913 | + if( this.getClassPath( loadRequest ) ) { |
914 | 914 | mw.log('mw.load: loadClass: ' + loadRequest ); |
915 | 915 | this.loadClass( loadRequest, callback ); |
916 | 916 | return ; |
— | — | @@ -917,7 +917,7 @@ |
918 | 918 | |
919 | 919 | // Try loading as a "file" or via ScriptLoader |
920 | 920 | if( loadRequest ) { |
921 | | - if( loadRequest.indexOf( '.js' ) == -1 && !mw.getScriptLoaderPath() ){ |
| 921 | + if( loadRequest.indexOf( '.js' ) == -1 && !mw.getScriptLoaderPath() ) { |
922 | 922 | mw.log( 'Error: are you sure ' + loadRequest + ' is a file ( is it missing a class path? ) ' ); |
923 | 923 | } |
924 | 924 | mw.getScript( loadRequest, callback ); |
— | — | @@ -941,16 +941,16 @@ |
942 | 942 | var loadStates = { }; |
943 | 943 | |
944 | 944 | // Check if we can load via the "script-loader" ( mwEmbed was included via scriptLoader ) |
945 | | - if( mw.getScriptLoaderPath() ){ |
| 945 | + if( mw.getScriptLoaderPath() ) { |
946 | 946 | loadStates = this.getGroupLoadState( loadSet ); |
947 | | - if( mw.isEmpty( loadStates ) ){ |
| 947 | + if( mw.isEmpty( loadStates ) ) { |
948 | 948 | mw.log( 'loadMany:all classes already loaded'); |
949 | 949 | callback(); |
950 | 950 | return ; |
951 | 951 | } |
952 | 952 | }else{ |
953 | 953 | // Check if its a dependency set ( nested objects ) |
954 | | - if( typeof loadSet [ 0 ] == 'object' ){ |
| 954 | + if( typeof loadSet [ 0 ] == 'object' ) { |
955 | 955 | _this.dependencyChainCallFlag[loadSet] = false; |
956 | 956 | //Load sets of classes ( to preserver order for some browsers ) |
957 | 957 | _this.loadDependencyChain( loadSet, callback ); |
— | — | @@ -958,7 +958,7 @@ |
959 | 959 | } |
960 | 960 | |
961 | 961 | // Set the initial load state for every item in the loadSet |
962 | | - for( var i = 0; i < loadSet.length ; i++ ){ |
| 962 | + for( var i = 0; i < loadSet.length ; i++ ) { |
963 | 963 | var loadName = loadSet[ i ]; |
964 | 964 | loadStates[ loadName ] = 0; |
965 | 965 | } |
— | — | @@ -968,19 +968,19 @@ |
969 | 969 | mw.log("mw.load: LoadMany:: " + loadSet ); |
970 | 970 | |
971 | 971 | // Issue the load request check check loadStates to see if we are "done" |
972 | | - for( var loadName in loadStates ){ |
| 972 | + for( var loadName in loadStates ) { |
973 | 973 | //mw.log("loadMany: load: " + loadName ); |
974 | | - this.load( loadName, function ( loadName ){ |
| 974 | + this.load( loadName, function ( loadName ) { |
975 | 975 | loadStates[ loadName ] = 1; |
976 | 976 | //mw.log( loadName + ' finished of: ' + JSON.stringify( loadStates ) ); |
977 | 977 | //Check if all load request states are set 1 |
978 | 978 | var loadDone = true; |
979 | | - for( var j in loadStates ){ |
| 979 | + for( var j in loadStates ) { |
980 | 980 | if( loadStates[ j ] === 0 ) |
981 | 981 | loadDone = false; |
982 | 982 | } |
983 | 983 | // Run the parent scope callback for "loadMany" |
984 | | - if( loadDone ){ |
| 984 | + if( loadDone ) { |
985 | 985 | callback( loadName ); |
986 | 986 | } |
987 | 987 | } ); |
— | — | @@ -999,13 +999,13 @@ |
1000 | 1000 | * @return {Object} |
1001 | 1001 | * grouped loadSet |
1002 | 1002 | */ |
1003 | | - getGroupLoadState: function( loadSet ){ |
| 1003 | + getGroupLoadState: function( loadSet ) { |
1004 | 1004 | var groupedLoadSet = []; |
1005 | 1005 | var loadStates = { }; |
1006 | 1006 | // Merge load set into new groupedLoadSet |
1007 | | - if( typeof loadSet[0] == 'object' ){ |
1008 | | - for( var i = 0; i < loadSet.length ; i++ ){ |
1009 | | - for( var j = 0; j < loadSet[i].length ; j++ ){ |
| 1007 | + if( typeof loadSet[0] == 'object' ) { |
| 1008 | + for( var i = 0; i < loadSet.length ; i++ ) { |
| 1009 | + for( var j = 0; j < loadSet[i].length ; j++ ) { |
1010 | 1010 | // Make sure we have not already included it: |
1011 | 1011 | groupedLoadSet.push( loadSet[i][j] ); |
1012 | 1012 | } |
— | — | @@ -1022,18 +1022,18 @@ |
1023 | 1023 | var loadName = groupedLoadSet[ i ]; |
1024 | 1024 | if( this.getClassPath( loadName ) ) { |
1025 | 1025 | // Only add to group request if not already set: |
1026 | | - if ( !mw.isset( loadName ) ){ |
| 1026 | + if ( !mw.isset( loadName ) ) { |
1027 | 1027 | groupClassKey += coma + loadName |
1028 | 1028 | coma = ','; |
1029 | 1029 | } |
1030 | 1030 | // Issue a request for any dependent style sheets ( won't load if already present ) |
1031 | | - if( typeof this.stylePaths[ loadName ] != 'undefined' ){ |
| 1031 | + if( typeof this.stylePaths[ loadName ] != 'undefined' ) { |
1032 | 1032 | mw.getStyleSheet( mw.getMwEmbedPath() + this.stylePaths[ loadName ] ); |
1033 | 1033 | } |
1034 | 1034 | |
1035 | 1035 | }else if( this.moduleLoaders[ loadName ] ) { |
1036 | 1036 | // Module loaders break up grouped script requests ( add the current groupClassKey ) |
1037 | | - if( groupClassKey != '' ){ |
| 1037 | + if( groupClassKey != '' ) { |
1038 | 1038 | loadStates[ groupClassKey ] = 0; |
1039 | 1039 | groupClassKey = coma = ''; |
1040 | 1040 | } |
— | — | @@ -1043,7 +1043,7 @@ |
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | // Add groupClassKey if set: |
1047 | | - if( groupClassKey != '' ){ |
| 1047 | + if( groupClassKey != '' ) { |
1048 | 1048 | loadStates [ groupClassKey ] = 0; |
1049 | 1049 | } |
1050 | 1050 | |
— | — | @@ -1059,7 +1059,7 @@ |
1060 | 1060 | */ |
1061 | 1061 | dependencyChainCallFlag: { }, |
1062 | 1062 | |
1063 | | - loadDependencyChain: function( loadChain, callback ){ |
| 1063 | + loadDependencyChain: function( loadChain, callback ) { |
1064 | 1064 | var _this = this; |
1065 | 1065 | // Load with dependency checks |
1066 | 1066 | var callSet = loadChain.shift(); |
— | — | @@ -1070,7 +1070,7 @@ |
1071 | 1071 | // NOTE: IE is playing tricks with me |
1072 | 1072 | // Need to figure out why this callback gets called twice |
1073 | 1073 | // and remove this flag |
1074 | | - if( _this.dependencyChainCallFlag[ callSet ] == callback ){ |
| 1074 | + if( _this.dependencyChainCallFlag[ callSet ] == callback ) { |
1075 | 1075 | mw.log("... already called this callback for " + callSet ); |
1076 | 1076 | return ; |
1077 | 1077 | } |
— | — | @@ -1087,10 +1087,10 @@ |
1088 | 1088 | * @param {String} className Name of class to load |
1089 | 1089 | * @param {Function} callback Function to run once class is loaded |
1090 | 1090 | */ |
1091 | | - loadClass: function( className , callback){ |
| 1091 | + loadClass: function( className , callback) { |
1092 | 1092 | var _this = this; |
1093 | 1093 | // Make sure the class is not already defined: |
1094 | | - if ( mw.isset( className ) ){ |
| 1094 | + if ( mw.isset( className ) ) { |
1095 | 1095 | mw.log( 'Class ( ' + className + ' ) already defined ' ); |
1096 | 1096 | callback( className ); |
1097 | 1097 | return ; |
— | — | @@ -1100,7 +1100,7 @@ |
1101 | 1101 | var scriptRequest = null; |
1102 | 1102 | |
1103 | 1103 | // If the scriptloader is enabled use the className as the scriptRequest: |
1104 | | - if( mw.getScriptLoaderPath() ){ |
| 1104 | + if( mw.getScriptLoaderPath() ) { |
1105 | 1105 | // replace $j with j since php strips the $ from the request class |
1106 | 1106 | scriptRequest = className; |
1107 | 1107 | }else{ |
— | — | @@ -1108,19 +1108,19 @@ |
1109 | 1109 | var baseClassPath = this.getClassPath( className ); |
1110 | 1110 | // Add the mwEmbed path if not a root path or a full url |
1111 | 1111 | if( baseClassPath.indexOf( '/' ) !== 0 && |
1112 | | - baseClassPath.indexOf('://') === -1 ){ |
| 1112 | + baseClassPath.indexOf('://') === -1 ) { |
1113 | 1113 | scriptRequest = mw.getMwEmbedPath() + baseClassPath; |
1114 | 1114 | }else{ |
1115 | 1115 | scriptRequest = baseClassPath; |
1116 | 1116 | } |
1117 | | - if( ! scriptRequest ){ |
| 1117 | + if( ! scriptRequest ) { |
1118 | 1118 | mw.log( "Could not get url for class " + className ); |
1119 | 1119 | return ; |
1120 | 1120 | } |
1121 | 1121 | } |
1122 | 1122 | |
1123 | 1123 | // Check for any associated style sheets that should be loaded |
1124 | | - if( typeof this.stylePaths[ className ] != 'undefined' ){ |
| 1124 | + if( typeof this.stylePaths[ className ] != 'undefined' ) { |
1125 | 1125 | mw.getStyleSheet( mw.getMwEmbedPath() + this.stylePaths[ className ] ); |
1126 | 1126 | } |
1127 | 1127 | |
— | — | @@ -1134,7 +1134,7 @@ |
1135 | 1135 | mw.getScript( scriptRequest, function( scriptRequest ) { |
1136 | 1136 | // Debug output |
1137 | 1137 | if(! mw.isset( className ) |
1138 | | - && mwLoadDoneCB[ className ] != 'done' ){ |
| 1138 | + && mwLoadDoneCB[ className ] != 'done' ) { |
1139 | 1139 | mw.log( 'Possible Error: ' + className +' not set in time, or not defined in:' + "\n" + _this.getClassPath( className ) ); |
1140 | 1140 | } |
1141 | 1141 | // Call load done (incase the script did not include a loadDone callback ) |
— | — | @@ -1149,9 +1149,9 @@ |
1150 | 1150 | * ( not all browsers support onLoad script attribute ) |
1151 | 1151 | * In the case of a "class" we can pull the javascript state until its ready |
1152 | 1152 | */ |
1153 | | - if( !mw.getScriptLoaderPath() ){ |
1154 | | - setTimeout( function(){ |
1155 | | - mw.waitForObject( className, function( className ){ |
| 1153 | + if( !mw.getScriptLoaderPath() ) { |
| 1154 | + setTimeout( function() { |
| 1155 | + mw.waitForObject( className, function( className ) { |
1156 | 1156 | // Once object is ready run loadDone |
1157 | 1157 | mw.loadDone( className ); |
1158 | 1158 | } ); |
— | — | @@ -1166,7 +1166,7 @@ |
1167 | 1167 | * @param {Function} moduleLoader Function that |
1168 | 1168 | * loads dependencies for a module |
1169 | 1169 | */ |
1170 | | - addModuleLoader: function( name, moduleLoader ){ |
| 1170 | + addModuleLoader: function( name, moduleLoader ) { |
1171 | 1171 | this.moduleLoaders [ name ] = moduleLoader; |
1172 | 1172 | }, |
1173 | 1173 | |
— | — | @@ -1179,11 +1179,11 @@ |
1180 | 1180 | * classSet must be strict JSON to allow the |
1181 | 1181 | * php scriptLoader to parse the file paths. |
1182 | 1182 | */ |
1183 | | - addClassFilePaths: function( classSet ){ |
| 1183 | + addClassFilePaths: function( classSet ) { |
1184 | 1184 | var prefix = ( mw.getConfig( 'loaderContext' ) )? |
1185 | 1185 | mw.getConfig( 'loaderContext' ): ''; |
1186 | 1186 | |
1187 | | - for( var i in classSet ){ |
| 1187 | + for( var i in classSet ) { |
1188 | 1188 | this.classPaths[ i ] = prefix + classSet[ i ]; |
1189 | 1189 | } |
1190 | 1190 | }, |
— | — | @@ -1192,7 +1192,7 @@ |
1193 | 1193 | * Get a class path forom a className |
1194 | 1194 | * if no class found return false |
1195 | 1195 | */ |
1196 | | - getClassPath: function( className ){ |
| 1196 | + getClassPath: function( className ) { |
1197 | 1197 | if( this.classPaths[ className ] ) |
1198 | 1198 | return this.classPaths[ className ] |
1199 | 1199 | return false; |
— | — | @@ -1206,8 +1206,8 @@ |
1207 | 1207 | * |
1208 | 1208 | * @param {Object} sheetSet ClassKey : sheet location key value paris |
1209 | 1209 | */ |
1210 | | - addClassStyleSheets: function( sheetSet ){ |
1211 | | - for(var i in sheetSet ){ |
| 1210 | + addClassStyleSheets: function( sheetSet ) { |
| 1211 | + for(var i in sheetSet ) { |
1212 | 1212 | this.stylePaths[ i ] = sheetSet[ i ]; |
1213 | 1213 | } |
1214 | 1214 | } |
— | — | @@ -1219,16 +1219,16 @@ |
1220 | 1220 | */ |
1221 | 1221 | mw.loadDone = function( requestName ) { |
1222 | 1222 | //mw.log( "LoadDone: " + requestName + ' run callback '); |
1223 | | - if( !mwLoadDoneCB[ requestName ] ){ |
| 1223 | + if( !mwLoadDoneCB[ requestName ] ) { |
1224 | 1224 | return true; |
1225 | 1225 | } |
1226 | | - while( mwLoadDoneCB[ requestName ].length ){ |
| 1226 | + while( mwLoadDoneCB[ requestName ].length ) { |
1227 | 1227 | if( typeof mwLoadDoneCB[ requestName ] != 'object' ) |
1228 | 1228 | { |
1229 | 1229 | break; |
1230 | 1230 | } |
1231 | 1231 | var func = mwLoadDoneCB[ requestName ].pop(); |
1232 | | - if( typeof func == 'function' ){ |
| 1232 | + if( typeof func == 'function' ) { |
1233 | 1233 | func( requestName ); |
1234 | 1234 | }else{ |
1235 | 1235 | mw.log('mwLoadDoneCB: Error non callback function on stack'); |
— | — | @@ -1243,13 +1243,13 @@ |
1244 | 1244 | * @param {String} requestName Name of class or request set |
1245 | 1245 | * @param {Function} callback Function called once requestName is ready |
1246 | 1246 | */ |
1247 | | - mw.setLoadDoneCB = function( requestName, callback ){ |
| 1247 | + mw.setLoadDoneCB = function( requestName, callback ) { |
1248 | 1248 | // If the requestName is already done loading just callback |
1249 | | - if( mwLoadDoneCB[ requestName ] == 'done' ){ |
| 1249 | + if( mwLoadDoneCB[ requestName ] == 'done' ) { |
1250 | 1250 | callback( requestName ) |
1251 | 1251 | } |
1252 | 1252 | // Setup the function queue if unset |
1253 | | - if( ! mwLoadDoneCB[ requestName ] ){ |
| 1253 | + if( ! mwLoadDoneCB[ requestName ] ) { |
1254 | 1254 | mwLoadDoneCB[ requestName ] = []; |
1255 | 1255 | } |
1256 | 1256 | mwLoadDoneCB[ requestName ].push( callback ); |
— | — | @@ -1263,7 +1263,7 @@ |
1264 | 1264 | /** |
1265 | 1265 | * Load Object entry point: Loads a requested set of javascript |
1266 | 1266 | */ |
1267 | | - mw.load = function( loadRequest, callback ){ |
| 1267 | + mw.load = function( loadRequest, callback ) { |
1268 | 1268 | return mw.loader.load( loadRequest, callback ); |
1269 | 1269 | } |
1270 | 1270 | |
— | — | @@ -1271,7 +1271,7 @@ |
1272 | 1272 | /** |
1273 | 1273 | * Add module entry point: Adds a module to the mwLoader object |
1274 | 1274 | */ |
1275 | | - mw.addModuleLoader = function ( name, loaderFunction ){ |
| 1275 | + mw.addModuleLoader = function ( name, loaderFunction ) { |
1276 | 1276 | return mw.loader.addModuleLoader( name, loaderFunction ); |
1277 | 1277 | } |
1278 | 1278 | |
— | — | @@ -1290,7 +1290,7 @@ |
1291 | 1291 | /** |
1292 | 1292 | * Add Class Style Sheet entry point: |
1293 | 1293 | */ |
1294 | | - mw.addClassStyleSheets = function( sheetSet ){ |
| 1294 | + mw.addClassStyleSheets = function( sheetSet ) { |
1295 | 1295 | return mw.loader.addClassStyleSheets( sheetSet ); |
1296 | 1296 | } |
1297 | 1297 | |
— | — | @@ -1315,9 +1315,9 @@ |
1316 | 1316 | * {Boolean} false if no page found |
1317 | 1317 | * {String} text of wiki page |
1318 | 1318 | */ |
1319 | | - mw.getTitleText = function( apiUrl, title, callback ){ |
| 1319 | + mw.getTitleText = function( apiUrl, title, callback ) { |
1320 | 1320 | // Check if optional apiURL was not included |
1321 | | - if( !callback ){ |
| 1321 | + if( !callback ) { |
1322 | 1322 | title = apiUrl; |
1323 | 1323 | callback = title; |
1324 | 1324 | apiUrl = mw.getLocalApiUrl(); |
— | — | @@ -1329,13 +1329,13 @@ |
1330 | 1330 | 'rvprop' : 'content' |
1331 | 1331 | }; |
1332 | 1332 | mw.getJSON( apiUrl , request, function( data ) { |
1333 | | - if( !data || !data.query || !data.query.pages ){ |
| 1333 | + if( !data || !data.query || !data.query.pages ) { |
1334 | 1334 | callback( false ); |
1335 | 1335 | } |
1336 | 1336 | var pages = data.query.pages; |
1337 | | - for(var i in pages){ |
| 1337 | + for(var i in pages) { |
1338 | 1338 | page = pages[ i ]; |
1339 | | - if( page[ 'revisions' ] && page[ 'revisions' ][0]['*'] ){ |
| 1339 | + if( page[ 'revisions' ] && page[ 'revisions' ][0]['*'] ) { |
1340 | 1340 | callback( page[ 'revisions' ][0]['*'] ); |
1341 | 1341 | } |
1342 | 1342 | } |
— | — | @@ -1363,7 +1363,7 @@ |
1364 | 1364 | * @param {Mixed} callbcak |
1365 | 1365 | * |
1366 | 1366 | */ |
1367 | | - mw.getJSON = function( arg1, arg2, arg3 ){ |
| 1367 | + mw.getJSON = function( arg1, arg2, arg3 ) { |
1368 | 1368 | // Set up the url |
1369 | 1369 | var url = false; |
1370 | 1370 | url = ( typeof arg1 == 'string' ) ? arg1 : mw.getLocalApiUrl(); |
— | — | @@ -1371,40 +1371,40 @@ |
1372 | 1372 | // Set up the data: |
1373 | 1373 | var data = null; |
1374 | 1374 | data = ( typeof arg1 == 'object' ) ? arg1 : null; |
1375 | | - if( !data && typeof arg2 == 'object' ){ |
| 1375 | + if( !data && typeof arg2 == 'object' ) { |
1376 | 1376 | data = arg2; |
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | // Setup the callback |
1380 | 1380 | var callback = false; |
1381 | 1381 | callback = ( typeof arg2 == 'function') ? arg2 : false; |
1382 | | - if( ! callback && ( typeof arg3 == 'function') ){ |
| 1382 | + if( ! callback && ( typeof arg3 == 'function') ) { |
1383 | 1383 | callback = arg3; |
1384 | 1384 | } |
1385 | 1385 | |
1386 | 1386 | // Make sure we got a url: |
1387 | | - if( !url ){ |
| 1387 | + if( !url ) { |
1388 | 1388 | mw.log( 'Error: no api url for api request' ); |
1389 | 1389 | return false; |
1390 | 1390 | } |
1391 | 1391 | |
1392 | 1392 | // Add default action if unset: |
1393 | | - if( !data['action'] ){ |
| 1393 | + if( !data['action'] ) { |
1394 | 1394 | data['action'] = 'query'; |
1395 | 1395 | } |
1396 | 1396 | |
1397 | 1397 | // Add default format if not set: |
1398 | | - if( !data['format'] ){ |
| 1398 | + if( !data['format'] ) { |
1399 | 1399 | data['format'] = 'json'; |
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | mw.log("run getJSON: " + mw.replaceUrlParams( url, data ) ); |
1403 | 1403 | // Check if the request requires a "post" (that does not work with callbacks cross domain) |
1404 | | - if( mw.checkRequestPost( data ) ){ |
| 1404 | + if( mw.checkRequestPost( data ) ) { |
1405 | 1405 | // Check if we need to setup a proxy |
1406 | | - if( ! mw.isLocalDomain( url ) ){ |
| 1406 | + if( ! mw.isLocalDomain( url ) ) { |
1407 | 1407 | // Load the proxy and issue the request |
1408 | | - mw.load( 'ApiProxy', function(){ |
| 1408 | + mw.load( 'ApiProxy', function() { |
1409 | 1409 | mw.ApiProxy.doRequest( url, data, callback ); |
1410 | 1410 | }); |
1411 | 1411 | }else{ |
— | — | @@ -1414,8 +1414,8 @@ |
1415 | 1415 | return ; |
1416 | 1416 | } |
1417 | 1417 | // If cross domain setup a callback: |
1418 | | - if( ! mw.isLocalDomain( url ) ){ |
1419 | | - if( url.indexOf( 'callback=' ) == -1 || data[ 'callback' ] == -1 ){ |
| 1418 | + if( ! mw.isLocalDomain( url ) ) { |
| 1419 | + if( url.indexOf( 'callback=' ) == -1 || data[ 'callback' ] == -1 ) { |
1420 | 1420 | // jQuery specific: ( second ? is replaced with the callback ) |
1421 | 1421 | url += ( url.indexOf('?') == -1 ) ? '?callback=?' : '&callback=?'; |
1422 | 1422 | } |
— | — | @@ -1431,14 +1431,14 @@ |
1432 | 1432 | * true if the request requires a post request |
1433 | 1433 | * false if the request does not |
1434 | 1434 | */ |
1435 | | - mw.checkRequestPost = function ( data ){ |
1436 | | - if( $j.inArray( data['action'], mw.getConfig( 'apiPostActions' ) ) != -1 ){ |
| 1435 | + mw.checkRequestPost = function ( data ) { |
| 1436 | + if( $j.inArray( data['action'], mw.getConfig( 'apiPostActions' ) ) != -1 ) { |
1437 | 1437 | return true; |
1438 | 1438 | } |
1439 | | - if( data['prop'] == 'info' && data['intoken'] ){ |
| 1439 | + if( data['prop'] == 'info' && data['intoken'] ) { |
1440 | 1440 | return true; |
1441 | 1441 | } |
1442 | | - if( data['meta'] == 'userinfo' ){ |
| 1442 | + if( data['meta'] == 'userinfo' ) { |
1443 | 1443 | return true; |
1444 | 1444 | } |
1445 | 1445 | return false; |
— | — | @@ -1455,7 +1455,7 @@ |
1456 | 1456 | */ |
1457 | 1457 | mw.isLocalDomain = function( url ) { |
1458 | 1458 | if( mw.parseUri( document.URL ).host == mw.parseUri( url ).host || |
1459 | | - url.indexOf( '://' ) == -1 ){ |
| 1459 | + url.indexOf( '://' ) == -1 ) { |
1460 | 1460 | return true; |
1461 | 1461 | } |
1462 | 1462 | return false; |
— | — | @@ -1470,7 +1470,7 @@ |
1471 | 1471 | */ |
1472 | 1472 | mw.getToken = function( api_url, title, callback ) { |
1473 | 1473 | // Make the api_url be optional: |
1474 | | - if( typeof title == 'function' ){ |
| 1474 | + if( typeof title == 'function' ) { |
1475 | 1475 | callback = title; |
1476 | 1476 | title = api_url; |
1477 | 1477 | api_url = mw.getLocalApiUrl(); |
— | — | @@ -1514,7 +1514,7 @@ |
1515 | 1515 | /*mw.status = function( status ) |
1516 | 1516 | |
1517 | 1517 | |
1518 | | - var Status = function(){ |
| 1518 | + var Status = function() { |
1519 | 1519 | |
1520 | 1520 | }*/ |
1521 | 1521 | |
— | — | @@ -1616,27 +1616,27 @@ |
1617 | 1617 | * number of times waitForObject has been called |
1618 | 1618 | */ |
1619 | 1619 | var waitTime = 1200; // About 30 seconds |
1620 | | - mw.waitForObject = function( objectName, callback, _callNumber){ |
| 1620 | + mw.waitForObject = function( objectName, callback, _callNumber) { |
1621 | 1621 | //mw.log( 'waitForObject: ' + objectName + ' cn: ' + _callNumber); |
1622 | 1622 | |
1623 | 1623 | // Increment callNumber: |
1624 | | - if( !_callNumber ){ |
| 1624 | + if( !_callNumber ) { |
1625 | 1625 | _callNumber = 1; |
1626 | 1626 | } else { |
1627 | 1627 | _callNumber++; |
1628 | 1628 | } |
1629 | 1629 | |
1630 | | - if( _callNumber > waitTime ){ |
| 1630 | + if( _callNumber > waitTime ) { |
1631 | 1631 | mw.log( "Error: waiting for object: " + objectName + ' timeout ' ); |
1632 | 1632 | callback( false ); |
1633 | 1633 | return ; |
1634 | 1634 | } |
1635 | 1635 | |
1636 | 1636 | // If the object is defined ( or we are done loading from a callback ) |
1637 | | - if ( mw.isset( objectName ) || mwLoadDoneCB[ objectName ] == 'done' ){ |
| 1637 | + if ( mw.isset( objectName ) || mwLoadDoneCB[ objectName ] == 'done' ) { |
1638 | 1638 | callback( objectName ) |
1639 | 1639 | }else{ |
1640 | | - setTimeout( function( ){ |
| 1640 | + setTimeout( function( ) { |
1641 | 1641 | mw.waitForObject( objectName, callback, _callNumber); |
1642 | 1642 | }, 25); |
1643 | 1643 | } |
— | — | @@ -1648,7 +1648,7 @@ |
1649 | 1649 | * @param {Object} object Object to be checked |
1650 | 1650 | */ |
1651 | 1651 | mw.isEmpty = function( object ) { |
1652 | | - if( typeof object == 'string' ){ |
| 1652 | + if( typeof object == 'string' ) { |
1653 | 1653 | if( object == '' ) return true; |
1654 | 1654 | // Non empty string: |
1655 | 1655 | return false; |
— | — | @@ -1656,12 +1656,12 @@ |
1657 | 1657 | |
1658 | 1658 | // If an array check length: |
1659 | 1659 | if( Object.prototype.toString.call( object ) === "[object Array]" |
1660 | | - && object.length == 0 ){ |
| 1660 | + && object.length == 0 ) { |
1661 | 1661 | return true; |
1662 | 1662 | } |
1663 | 1663 | |
1664 | 1664 | // Else check as an object: |
1665 | | - for( var i in object ){ return false; } |
| 1665 | + for( var i in object ) { return false; } |
1666 | 1666 | |
1667 | 1667 | // Else object is empty: |
1668 | 1668 | return true; |
— | — | @@ -1690,7 +1690,7 @@ |
1691 | 1691 | /* |
1692 | 1692 | |
1693 | 1693 | var log_elm = document.getElementById('mv_js_log'); |
1694 | | - if(!log_elm){ |
| 1694 | + if(!log_elm) { |
1695 | 1695 | document.getElementsByTagName("body")[0].innerHTML = document.getElementsByTagName("body")[0].innerHTML + |
1696 | 1696 | '<div style="position:absolute;z-index:500;bottom:0px;left:0px;right:0px;height:200px;">'+ |
1697 | 1697 | '<textarea id="mv_js_log" cols="120" rows="12"></textarea>'+ |
— | — | @@ -1698,7 +1698,7 @@ |
1699 | 1699 | |
1700 | 1700 | var log_elm = document.getElementById('mv_js_log'); |
1701 | 1701 | } |
1702 | | - if(log_elm){ |
| 1702 | + if(log_elm) { |
1703 | 1703 | log_elm.value+=string+"\n"; |
1704 | 1704 | } |
1705 | 1705 | */ |
— | — | @@ -1735,15 +1735,15 @@ |
1736 | 1736 | * |
1737 | 1737 | * @param {Function} callback Function to run once DOM and jQuery are ready |
1738 | 1738 | */ |
1739 | | - mw.ready = function( callback ){ |
1740 | | - if( mwReadyFlag === false ){ |
| 1739 | + mw.ready = function( callback ) { |
| 1740 | + if( mwReadyFlag === false ) { |
1741 | 1741 | |
1742 | 1742 | // Add the callbcak to the onLoad function stack |
1743 | 1743 | mwOnLoadFunctions.push ( callback ); |
1744 | 1744 | |
1745 | 1745 | // Set the mwSetup flag. So that onLoad functions can |
1746 | 1746 | // be called once mwEmbed interfaces are setup. |
1747 | | - if( !mwDomReadyFlag ){ |
| 1747 | + if( !mwDomReadyFlag ) { |
1748 | 1748 | //mw.log( 'set config flag' ); |
1749 | 1749 | mw.setConfig( 'runSetupMwEmbed', true ); |
1750 | 1750 | }else{ |
— | — | @@ -1761,9 +1761,9 @@ |
1762 | 1762 | /** |
1763 | 1763 | * Runs all the queued functions |
1764 | 1764 | */ |
1765 | | - mw.runReadyHooks = function ( ){ |
| 1765 | + mw.runReadyHooks = function ( ) { |
1766 | 1766 | // Run all the queued functions: |
1767 | | - while( mwOnLoadFunctions.length ){ |
| 1767 | + while( mwOnLoadFunctions.length ) { |
1768 | 1768 | mwOnLoadFunctions.pop()(); |
1769 | 1769 | } |
1770 | 1770 | |
— | — | @@ -1781,7 +1781,7 @@ |
1782 | 1782 | * @param {String} scriptRequest The requested path or classNames for the scriptLoader |
1783 | 1783 | * @param {Function} callback Function to call once script is loaded |
1784 | 1784 | */ |
1785 | | - mw.getScript = function( scriptRequest, callback ){ |
| 1785 | + mw.getScript = function( scriptRequest, callback ) { |
1786 | 1786 | |
1787 | 1787 | // Set the base url based scriptLoader availability & type of scriptRequest |
1788 | 1788 | // ( presently script loader only handles "classes" not relative urls: |
— | — | @@ -1807,7 +1807,7 @@ |
1808 | 1808 | // If jQuery is available and debug is off load the scirpt via jQuery |
1809 | 1809 | //( will use XHR if on same domain ) |
1810 | 1810 | if( mw.isset( 'window.jQuery' ) && mw.getConfig( 'debug' ) === false ) { |
1811 | | - $j.getScript( url, function(){ |
| 1811 | + $j.getScript( url, function() { |
1812 | 1812 | if( callback ) |
1813 | 1813 | callback( scriptRequest ); |
1814 | 1814 | }); |
— | — | @@ -1825,9 +1825,9 @@ |
1826 | 1826 | script.setAttribute( 'src', url ); |
1827 | 1827 | |
1828 | 1828 | // Attach handlers ( if using script loader it issues onDone callback as well ) |
1829 | | - script.onload = script.onreadystatechange = function(){ |
| 1829 | + script.onload = script.onreadystatechange = function() { |
1830 | 1830 | if (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") { |
1831 | | - if( callback ){ |
| 1831 | + if( callback ) { |
1832 | 1832 | callback( scriptRequest ); |
1833 | 1833 | } |
1834 | 1834 | } |
— | — | @@ -1838,10 +1838,8 @@ |
1839 | 1839 | } |
1840 | 1840 | |
1841 | 1841 | /** |
1842 | | - * "Get" a style sheet. |
| 1842 | + * Get a style sheet and append the style sheet to the DOM |
1843 | 1843 | * |
1844 | | - * Appends a style sheet to the DOM is called "getStyleSheet" to mirror wraping of jqueries getScript |
1845 | | - * |
1846 | 1844 | * @param {Mixed} |
1847 | 1845 | * {Array} url List of urls to be loaded |
1848 | 1846 | * {String} url Url of the style sheet to be loaded |
— | — | @@ -1862,21 +1860,21 @@ |
1863 | 1861 | |
1864 | 1862 | // Check if style sheet is already included: |
1865 | 1863 | var foundSheet = false; |
1866 | | - $j( 'link' ).each( function(){ |
| 1864 | + $j( 'link' ).each( function() { |
1867 | 1865 | var currentSheet = $j( this) .attr( 'href' ); |
1868 | 1866 | var sheetParts = currentSheet.split('?'); |
1869 | 1867 | var urlParts = url.split('?'); |
1870 | 1868 | //if the base url's match check the parameters: |
1871 | | - if( sheetParts[0] == urlParts[0] && sheetParts[1]){ |
| 1869 | + if( sheetParts[0] == urlParts[0] && sheetParts[1]) { |
1872 | 1870 | //mw.log(" sheet compare: " + sheetParts[1].split( '&' ).sort().join('') + ' != ' + urlParts[1].split('&').sort().join('')); |
1873 | 1871 | //Check if url params match ( sort to do string compare ) |
1874 | 1872 | if( sheetParts[1].split( '&' ).sort().join('') == |
1875 | | - urlParts[1].split('&').sort().join('') ){ |
| 1873 | + urlParts[1].split('&').sort().join('') ) { |
1876 | 1874 | foundSheet = true; |
1877 | 1875 | } |
1878 | 1876 | } |
1879 | 1877 | } ); |
1880 | | - if( foundSheet ){ |
| 1878 | + if( foundSheet ) { |
1881 | 1879 | mw.log( 'skiped sheet: ' + url); |
1882 | 1880 | return ; |
1883 | 1881 | } |
— | — | @@ -1898,8 +1896,8 @@ |
1899 | 1897 | * local wiki api if no apiProvider is set |
1900 | 1898 | * false if no local wiki api found |
1901 | 1899 | */ |
1902 | | - mw.getApiProviderURL = function( provider_id ){ |
1903 | | - if( mw.getConfig( provider_id + '_apiurl') ){ |
| 1900 | + mw.getApiProviderURL = function( provider_id ) { |
| 1901 | + if( mw.getConfig( provider_id + '_apiurl') ) { |
1904 | 1902 | return mw.getConfig( provider_id + '_apiurl'); |
1905 | 1903 | } |
1906 | 1904 | return mw.getLocalApiUrl(); |
— | — | @@ -1944,12 +1942,12 @@ |
1945 | 1943 | } |
1946 | 1944 | |
1947 | 1945 | // Script-loader has jsScriptLoader name when local: |
1948 | | - if( src.indexOf( 'jsScriptLoader.php' ) !== -1 ){ |
| 1946 | + if( src.indexOf( 'jsScriptLoader.php' ) !== -1 ) { |
1949 | 1947 | mwpath = src.substr( 0, src.indexOf( 'jsScriptLoader.php' ) ); |
1950 | 1948 | } |
1951 | 1949 | |
1952 | 1950 | // Error out if we could not get the path: |
1953 | | - if( ! mwpath ){ |
| 1951 | + if( ! mwpath ) { |
1954 | 1952 | mw.log( "Error could not get mwEmbed path " ); |
1955 | 1953 | return ; |
1956 | 1954 | } |
— | — | @@ -2069,7 +2067,7 @@ |
2070 | 2068 | && |
2071 | 2069 | src.indexOf( 'mwEmbed' ) !== -1 |
2072 | 2070 | ) |
2073 | | - ){ |
| 2071 | + ) { |
2074 | 2072 | mwEmbedSrc = src; |
2075 | 2073 | return mwEmbedSrc; |
2076 | 2074 | } |
— | — | @@ -2138,7 +2136,7 @@ |
2139 | 2137 | } |
2140 | 2138 | |
2141 | 2139 | // Merge new params: |
2142 | | - for( var key in newParams ){ |
| 2140 | + for( var key in newParams ) { |
2143 | 2141 | parsedUrl.queryKey[ key ] = newParams[ key ]; |
2144 | 2142 | } |
2145 | 2143 | |
— | — | @@ -2205,14 +2203,14 @@ |
2206 | 2204 | return src; |
2207 | 2205 | |
2208 | 2206 | // Get parent Url location the context URL |
2209 | | - if( contextUrl){ |
| 2207 | + if( contextUrl) { |
2210 | 2208 | var parsedUrl = mw.parseUri( contextUrl ); |
2211 | 2209 | } else { |
2212 | 2210 | var parsedUrl = mw.parseUri( document.URL ); |
2213 | 2211 | } |
2214 | 2212 | |
2215 | 2213 | // Check for leading slash: |
2216 | | - if( src.indexOf( '/' ) === 0 ){ |
| 2214 | + if( src.indexOf( '/' ) === 0 ) { |
2217 | 2215 | return parsedUrl.protocol + '://' + parsedUrl.authority + src; |
2218 | 2216 | }else{ |
2219 | 2217 | return parsedUrl.protocol + '://' + parsedUrl.authority + parsedUrl.directory + src; |
— | — | @@ -2271,7 +2269,7 @@ |
2272 | 2270 | try{ |
2273 | 2271 | xmldata.loadXML( str ); |
2274 | 2272 | return xmldata; |
2275 | | - } catch (e){ |
| 2273 | + } catch (e) { |
2276 | 2274 | mw.log( 'XML parse ERROR: ' + e.message ); |
2277 | 2275 | return false; |
2278 | 2276 | } |
— | — | @@ -2320,7 +2318,7 @@ |
2321 | 2319 | mw.log( 'mw:setupMwEmbed :: ' + mw.getMwEmbedSrc() ); |
2322 | 2320 | |
2323 | 2321 | // Set the User language |
2324 | | - if( typeof wgUserLanguage != 'undefined' && mw.isValidLang( wgUserLanguage) ){ |
| 2322 | + if( typeof wgUserLanguage != 'undefined' && mw.isValidLang( wgUserLanguage) ) { |
2325 | 2323 | mw.setConfig( 'userLanguage', wgUserLanguage ) |
2326 | 2324 | }else{ |
2327 | 2325 | // Grab it from the included url |
— | — | @@ -2331,7 +2329,7 @@ |
2332 | 2330 | } |
2333 | 2331 | |
2334 | 2332 | // Make sure we have jQuery: |
2335 | | - mw.load( 'window.jQuery', function(){ |
| 2333 | + mw.load( 'window.jQuery', function() { |
2336 | 2334 | if ( !window['$j'] ) { |
2337 | 2335 | window['$j'] = jQuery.noConflict(); |
2338 | 2336 | } |
— | — | @@ -2339,7 +2337,7 @@ |
2340 | 2338 | |
2341 | 2339 | // Only load jquery ui theme sheet if ui-widget does not exist. |
2342 | 2340 | // NOTE: disabled as style sheets are cross domain and it behaves differently across browsers |
2343 | | - //if( ! mw.styleRuleExists( 'ui-widget' ) ){ |
| 2341 | + //if( ! mw.styleRuleExists( 'ui-widget' ) ) { |
2344 | 2342 | mw.getStyleSheet( mw.getConfig( 'jquery_skin_path' ) + 'jquery-ui-1.7.1.custom.css' ); |
2345 | 2343 | //} |
2346 | 2344 | |
— | — | @@ -2361,8 +2359,8 @@ |
2362 | 2360 | |
2363 | 2361 | // Run all the setup function hooks |
2364 | 2362 | // Once complete we can run .ready queued functions |
2365 | | - function runSetupFunctions(){ |
2366 | | - if( mwSetupFunctions.length ){ |
| 2363 | + function runSetupFunctions() { |
| 2364 | + if( mwSetupFunctions.length ) { |
2367 | 2365 | mwSetupFunctions.pop()( function() { |
2368 | 2366 | runSetupFunctions(); |
2369 | 2367 | } ); |
— | — | @@ -2381,28 +2379,28 @@ |
2382 | 2380 | * Note if using a scriptLoader all the loaders and localization converters |
2383 | 2381 | * are included automatically. |
2384 | 2382 | */ |
2385 | | - mw.moduleLoaderCheck = function( callback ){ |
| 2383 | + mw.moduleLoaderCheck = function( callback ) { |
2386 | 2384 | mw.log( 'doLoaderCheck::' ); |
2387 | 2385 | // Check if we are using scriptloader ( handles loader include automatically ) |
2388 | | - if( mw.getScriptLoaderPath() ){ |
| 2386 | + if( mw.getScriptLoaderPath() ) { |
2389 | 2387 | // Do a async call to callback in cases where DOM is ready before we get to |
2390 | 2388 | // loader config code in the same file. |
2391 | | - setTimeout(function(){ |
| 2389 | + setTimeout(function() { |
2392 | 2390 | callback(); |
2393 | 2391 | }, 1000); |
2394 | 2392 | return ; |
2395 | 2393 | } |
2396 | 2394 | // Add the Core loader to the request |
2397 | | - mw.load( 'loader.js', function(){ |
| 2395 | + mw.load( 'loader.js', function() { |
2398 | 2396 | // Load all the "loaders" of the enabled modules: |
2399 | 2397 | var loaderRequest = []; |
2400 | 2398 | var enabledModules = mw.getConfig( 'enabledModules' ); |
2401 | | - for(var i=0; i < enabledModules.length; i++ ){ |
| 2399 | + for(var i=0; i < enabledModules.length; i++ ) { |
2402 | 2400 | loaderRequest.push( 'modules/' + enabledModules[ i ] + '/loader.js' ); |
2403 | 2401 | }; |
2404 | 2402 | |
2405 | 2403 | // Add the language ( if set ) |
2406 | | - if( mw.getConfig( 'userLanguage' ) ){ |
| 2404 | + if( mw.getConfig( 'userLanguage' ) ) { |
2407 | 2405 | var langCode = mw.getConfig( 'userLanguage' ); |
2408 | 2406 | // Upper case the first letter: |
2409 | 2407 | langCode = langCode.substr(0,1).toUpperCase() + langCode.substr( 1, langCode.length ); |
— | — | @@ -2411,7 +2409,7 @@ |
2412 | 2410 | } |
2413 | 2411 | |
2414 | 2412 | mw.setConfig('loaderContext', '' ); |
2415 | | - mw.load( loaderRequest, function(){ |
| 2413 | + mw.load( loaderRequest, function() { |
2416 | 2414 | mw.log( 'Done moduleLoaderCheck request' ); |
2417 | 2415 | // Set the mwModuleLoaderCheckFlag flag to true |
2418 | 2416 | mwModuleLoaderCheckFlag = true; |
— | — | @@ -2444,13 +2442,13 @@ |
2445 | 2443 | rules = document.styleSheets[i].cssRules |
2446 | 2444 | else if (document.styleSheets[0].rules) |
2447 | 2445 | rules = document.styleSheets[i].rules |
2448 | | - for(var j=0 ; j < rules.length ; j++ ){ |
| 2446 | + for(var j=0 ; j < rules.length ; j++ ) { |
2449 | 2447 | var rule = rules[j].selectorText; |
2450 | 2448 | if( rule && rule.indexOf( styleRule ) != -1 ) { |
2451 | 2449 | return true; |
2452 | 2450 | } |
2453 | 2451 | } |
2454 | | - }catch ( e ){ |
| 2452 | + }catch ( e ) { |
2455 | 2453 | mw.log( 'Error: cant check rule on cross domain style sheet:' + document.styleSheets[i].href ); |
2456 | 2454 | } |
2457 | 2455 | } |
— | — | @@ -2490,7 +2488,7 @@ |
2491 | 2489 | * Will check configuration and issue a mw.setupMwEmbed call if needed |
2492 | 2490 | */ |
2493 | 2491 | mw.domReady = function ( ) { |
2494 | | - if( mwDomReadyFlag ){ |
| 2492 | + if( mwDomReadyFlag ) { |
2495 | 2493 | return ; |
2496 | 2494 | } |
2497 | 2495 | mw.log( 'run:domReady:: ' + document.getElementsByTagName('video').length ); |
— | — | @@ -2513,7 +2511,7 @@ |
2514 | 2512 | } |
2515 | 2513 | |
2516 | 2514 | // Check for queued functions that use mw interfaces: |
2517 | | - if ( mwOnLoadFunctions.length ){ |
| 2515 | + if ( mwOnLoadFunctions.length ) { |
2518 | 2516 | mw.setupMwEmbed(); |
2519 | 2517 | return ; |
2520 | 2518 | } |
— | — | @@ -2537,10 +2535,10 @@ |
2538 | 2536 | var minVersionParts = minVersion.split('.') |
2539 | 2537 | var clientVersionParts = clientVersion.split('.'); |
2540 | 2538 | for( var i =0; i < minVersionParts.length; i++ ) { |
2541 | | - if( parseInt( clientVersionParts[i] ) > parseInt( minVersionParts[i] ) ){ |
| 2539 | + if( parseInt( clientVersionParts[i] ) > parseInt( minVersionParts[i] ) ) { |
2542 | 2540 | return true; |
2543 | 2541 | } |
2544 | | - if( parseInt( clientVersionParts[i] ) < parseInt( minVersionParts[i] ) ){ |
| 2542 | + if( parseInt( clientVersionParts[i] ) < parseInt( minVersionParts[i] ) ) { |
2545 | 2543 | return false; |
2546 | 2544 | } |
2547 | 2545 | } |
— | — | @@ -2620,11 +2618,11 @@ |
2621 | 2619 | .attr('href', '#') |
2622 | 2620 | .addClass( 'ui-state-default ui-corner-all ui-icon_link' ); |
2623 | 2621 | // Add css if set: |
2624 | | - if( options.css ){ |
| 2622 | + if( options.css ) { |
2625 | 2623 | $btn.css( options.css ) |
2626 | 2624 | } |
2627 | 2625 | |
2628 | | - if( options['class'] ){ |
| 2626 | + if( options['class'] ) { |
2629 | 2627 | $btn.addClass( options['class'] ) |
2630 | 2628 | } |
2631 | 2629 | |
— | — | @@ -2723,7 +2721,7 @@ |
2724 | 2722 | var ie = /*@cc_on!@*/false; |
2725 | 2723 | if (/webkit/.test(u)) { |
2726 | 2724 | // safari |
2727 | | - timeout = setTimeout(function(){ |
| 2725 | + timeout = setTimeout(function() { |
2728 | 2726 | if ( document.readyState == "loaded" || |
2729 | 2727 | document.readyState == "complete" ) { |
2730 | 2728 | i(); |
— | — | @@ -2734,7 +2732,7 @@ |
2735 | 2733 | } else if ((/mozilla/.test(u) && !/(compatible)/.test(u)) || |
2736 | 2734 | (/opera/.test(u))) { |
2737 | 2735 | // opera/moz |
2738 | | - document.addEventListener("DOMContentLoaded",i,false); |
| 2736 | + document.addEventListener("DOMContentLoaded", i, false); |
2739 | 2737 | } else if ( ie ) { |
2740 | 2738 | // IE |
2741 | 2739 | (function ( ) { |
— | — | @@ -2755,7 +2753,7 @@ |
2756 | 2754 | // As a backup check if "body" is not null ( for dynamic inserts ) |
2757 | 2755 | // ( mw.domReady ignores multiple ready calls ) |
2758 | 2756 | var mwCheckBody = function( ) { |
2759 | | - if( document.getElementsByTagName( 'body' )[0] ){ |
| 2757 | + if( document.getElementsByTagName( 'body' )[0] ) { |
2760 | 2758 | mw.domReady(); |
2761 | 2759 | }else{ |
2762 | 2760 | setTimeout( function( ) { |