Index: branches/js2-work/phase3/js/mwEmbed/skins/ctrlBuilder.js |
— | — | @@ -175,15 +175,16 @@ |
176 | 176 | // Add recommend firefox if we have non-native playback: |
177 | 177 | if ( _this.doNativeWarningCheck() ) { |
178 | 178 | $j( '#dc_' + embedPlayer.id ).hover( |
179 | | - function() { |
| 179 | + function() { |
180 | 180 | if ( $j( '#gnp_' + embedPlayer.id ).length == 0 ) { |
181 | 181 | var toppos = ( embedPlayer.instanceOf == 'mvPlayList' ) ? 25 : 10; |
| 182 | + |
182 | 183 | $j( this ).append( |
183 | 184 | $j('<div />') |
184 | 185 | .attr({ |
185 | | - 'id': "gnp_" + embedPlayer.id, |
| 186 | + 'id': "gnp_" + embedPlayer.id |
186 | 187 | }) |
187 | | - .addClass('ui-state-highlight ui-corner-all') |
| 188 | + .addClass( 'ui-state-highlight ui-corner-all' ) |
188 | 189 | .css({ |
189 | 190 | 'position':'absolute', |
190 | 191 | 'display':'none', |
— | — | @@ -193,13 +194,22 @@ |
194 | 195 | 'left' : '10px', |
195 | 196 | 'right' : '10px' |
196 | 197 | }) |
197 | | - .html( gM( 'mwe-for_best_experience' ) ), |
198 | | - $j('<br />'), |
199 | | - $j('<input />') |
| 198 | + .html( gM( 'mwe-for_best_experience' ) ) |
| 199 | + ); |
| 200 | + $target_warning = $j( '#gnp_' + embedPlayer.id ); |
| 201 | + |
| 202 | + $target_warning.append( |
| 203 | + $j('<br />') |
| 204 | + ); |
| 205 | + |
| 206 | + |
| 207 | + $target_warning.append( |
| 208 | + $j( '<input />' ) |
200 | 209 | .attr({ |
201 | 210 | 'id' : 'ffwarn_' + embedPlayer.id, |
202 | | - }) |
203 | | - .text( gM( 'mwe-do_not_warn_again' ) ) |
| 211 | + 'type' : "checkbox", |
| 212 | + 'name' : 'ffwarn_' + embedPlayer.id |
| 213 | + }) |
204 | 214 | .click( function() { |
205 | 215 | if ( $j( this ).is( ':checked' ) ) { |
206 | 216 | // Set up a cookie for 7 days: |
— | — | @@ -211,12 +221,18 @@ |
212 | 222 | mw.setConfig( 'show_player_warning', true ); |
213 | 223 | $j.cookie( 'show_player_warning', true ); |
214 | 224 | } |
215 | | - } ) |
| 225 | + } ) |
216 | 226 | ); |
217 | | - } |
| 227 | + $target_warning.append( |
| 228 | + $j('<span />') |
| 229 | + .text( gM( 'mwe-do_not_warn_again' ) ) |
| 230 | + ) |
| 231 | + } |
| 232 | + |
218 | 233 | // Only show the warning if cookie and config are true |
219 | | - if ( mw.getConfig( 'show_player_warning' ) === true ) |
| 234 | + if ( mw.getConfig( 'show_player_warning' ) === true ){ |
220 | 235 | $j( '#gnp_' + embedPlayer.id ).fadeIn( 'slow' ); |
| 236 | + } |
221 | 237 | }, |
222 | 238 | function() { |
223 | 239 | $j( '#gnp_' + embedPlayer.id ).fadeOut( 'slow' ); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -45,6 +45,7 @@ |
46 | 46 | "mwe-credits" : "Credits", |
47 | 47 | "mwe-clip_linkback" : "Clip source page", |
48 | 48 | "mwe-chose_player" : "Choose video player", |
| 49 | + "mwe-no-player" : "No player available for $1", |
49 | 50 | "mwe-share_this_video" : "Share this video", |
50 | 51 | "mwe-video_credits" : "Video credits", |
51 | 52 | "mwe-menu_btn" : "Menu", |
— | — | @@ -2247,7 +2248,7 @@ |
2248 | 2249 | .css({ |
2249 | 2250 | 'position' : 'relative', |
2250 | 2251 | 'width' : this.getPlayerWidth() + 'px', |
2251 | | - 'height' : this.getPlayerHeight() + 'px', |
| 2252 | + 'height' : this.getPlayerHeight() + 'px' |
2252 | 2253 | }) |
2253 | 2254 | .attr({ |
2254 | 2255 | 'id' : 'img_thumb_' + this.id, |
— | — | @@ -2533,42 +2534,58 @@ |
2534 | 2535 | } |
2535 | 2536 | // Get id (in case where we have a parent container) |
2536 | 2537 | var _this = this; |
2537 | | - var o = ''; |
2538 | | - o += '<h2>' + gM( 'mwe-chose_player' ) + '</h2>'; |
| 2538 | + |
| 2539 | + $target |
| 2540 | + .empty() |
| 2541 | + .append( |
| 2542 | + $j( '<h2 />' ) |
| 2543 | + .text( gM( 'mwe-chose_player' ) ) |
| 2544 | + ); |
| 2545 | + |
2539 | 2546 | var _this = this; |
2540 | 2547 | $j.each( this.mediaElement.getPlayableSources(), function( source_id, source ) { |
2541 | 2548 | var playable = mw.EmbedTypes.players.defaultPlayer( source.getMIMEType() ); |
2542 | 2549 | |
2543 | 2550 | var is_selected = ( source == _this.mediaElement.selected_source ); |
2544 | 2551 | |
2545 | | - o += '<h2>' + source.getTitle() + '</h2>'; |
| 2552 | + $target.append( |
| 2553 | + $j( '<h2 />' ) |
| 2554 | + .text( source.getTitle() ) |
| 2555 | + ); |
2546 | 2556 | |
2547 | 2557 | if ( playable ) { |
2548 | | - o += '<ul>'; |
| 2558 | + $playerList = $j('<ul />'); |
2549 | 2559 | // output the player select code: |
2550 | 2560 | var supporting_players = mw.EmbedTypes.players.getMIMETypePlayers( source.getMIMEType() ); |
2551 | 2561 | |
2552 | | - for ( var i = 0; i < supporting_players.length ; i++ ) { |
| 2562 | + for ( var i = 0; i < supporting_players.length ; i++ ) { |
| 2563 | + var $playerLink = $j( '<a />') |
| 2564 | + .attr({ |
| 2565 | + 'href' : '#', |
| 2566 | + 'rel' : 'sel_source', |
| 2567 | + 'id' : 'sc_' + source_id + '_' + supporting_players[i].id |
| 2568 | + }) |
| 2569 | + .text( supporting_players[i].getName() ); |
| 2570 | + |
2553 | 2571 | if ( _this.selected_player.id == supporting_players[i].id && is_selected ) { |
2554 | | - o += '<li>' + |
2555 | | - '<a href="#" class="active" rel="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id + '">' + |
2556 | | - supporting_players[i].getName() + |
2557 | | - '</a>' + |
2558 | | - '</li>'; |
2559 | | - } else { |
2560 | | - o += '<li>' + |
2561 | | - '<a href="#" rel="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id + '">' + |
2562 | | - supporting_players[i].getName() + |
2563 | | - '</a>' + |
2564 | | - '</li>'; |
| 2572 | + $playerLink |
| 2573 | + .addClass('active' ); |
2565 | 2574 | } |
| 2575 | + $playerList.append( |
| 2576 | + $j( '<li />' ).append( |
| 2577 | + $playerLink |
| 2578 | + ) |
| 2579 | + ); |
2566 | 2580 | } |
2567 | | - o += '</ul>'; |
| 2581 | + |
| 2582 | + // Append the player list: |
| 2583 | + $target.append( $playerList ); |
| 2584 | + |
2568 | 2585 | } else { |
2569 | | - o += source.getTitle() + ' - no player available'; |
| 2586 | + // No player avaliable: |
| 2587 | + $target.append( gM( 'mwe-no-player', source.getTitle() ) ) |
2570 | 2588 | } |
2571 | | - } ); |
2572 | | - $target.html( o ); |
| 2589 | + } ); |
2573 | 2590 | |
2574 | 2591 | // Set up the click bindings: |
2575 | 2592 | $target.find( "[rel='sel_source']" ).each( function() { |
— | — | @@ -2621,7 +2638,7 @@ |
2622 | 2639 | $target.append( |
2623 | 2640 | $j('<div />') |
2624 | 2641 | .css({ |
2625 | | - "color":"white", |
| 2642 | + "color":"white" |
2626 | 2643 | }) |
2627 | 2644 | ); |
2628 | 2645 | var $mediaList = $j( '<ul />' ); |
— | — | @@ -2631,7 +2648,7 @@ |
2632 | 2649 | var $dl_line = $j( '<li />').append( |
2633 | 2650 | $j('<a />'). |
2634 | 2651 | css({ |
2635 | | - "color" : "white", |
| 2652 | + "color" : "white" |
2636 | 2653 | }) |
2637 | 2654 | .attr( 'href', source.getSrc()) |
2638 | 2655 | .text( source.getTitle() ) |
— | — | @@ -2711,6 +2728,11 @@ |
2712 | 2729 | } ) |
2713 | 2730 | .attr( 'title', gM( 'mwe-pause_clip' ) ); |
2714 | 2731 | |
| 2732 | + // Do play tracking if enabled |
| 2733 | + if( mw.getConfig( 'playTracking' ) ){ |
| 2734 | + this.doPlayTracking(); |
| 2735 | + } |
| 2736 | + |
2715 | 2737 | //Run play hook: |
2716 | 2738 | this.runHook( 'play' ); |
2717 | 2739 | }, |
— | — | @@ -2799,7 +2821,7 @@ |
2800 | 2822 | * Base Embed mute |
2801 | 2823 | * |
2802 | 2824 | * Handles interface updates for toggling mute. |
2803 | | - * Plug-in / player interface must handle updateing the actual media player |
| 2825 | + * Plug-in / player interface must handle the actual media player update |
2804 | 2826 | */ |
2805 | 2827 | toggleMute:function() { |
2806 | 2828 | if ( this.muted ) { |
— | — | @@ -2816,6 +2838,7 @@ |
2817 | 2839 | |
2818 | 2840 | /** |
2819 | 2841 | * Abstract Update volumen Method must be overided by plug-in / player interface |
| 2842 | + * @param {float} prec Percet of full volume |
2820 | 2843 | */ |
2821 | 2844 | updateVolumen:function( perc ) { |
2822 | 2845 | mw.log( 'update volume not supported with current playback type' ); |
— | — | @@ -2876,6 +2899,23 @@ |
2877 | 2900 | return this.thumbnail_disp; |
2878 | 2901 | }, |
2879 | 2902 | |
| 2903 | + /** |
| 2904 | + * Checks if we are monitoring play requests |
| 2905 | + * presently this function is mediaWiki api specific. |
| 2906 | + */ |
| 2907 | + doPlayTracking: function(){ |
| 2908 | + var playTrackingRate = mw.getConfig( 'playTrackingRate' ); |
| 2909 | + // Math.floor ( Math.random() * playTrackingRate ) == 0 |
| 2910 | + if( true ){ |
| 2911 | + mw.getJSON( { |
| 2912 | + 'action' : 'playtracking', |
| 2913 | + 'filename' : this.apiTitleKey, |
| 2914 | + 'client' : this.selected_player.library + ' && ' + navigator.userAgent |
| 2915 | + }, function( data ){ |
| 2916 | + mw.log( 'done logging play request' ); |
| 2917 | + } ); |
| 2918 | + } |
| 2919 | + }, |
2880 | 2920 | |
2881 | 2921 | /** |
2882 | 2922 | * Monitor playback and update interface components. |
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js |
— | — | @@ -1009,7 +1009,7 @@ |
1010 | 1010 | * Groups the loadSet into a single sequential array |
1011 | 1011 | * |
1012 | 1012 | * Groups the scriptRequest where possible: |
1013 | | - * Modules include "loader code" so they are seperated |
| 1013 | + * Modules include "loader code" so they are separated |
1014 | 1014 | * into pre-condition code to be run for subsequent requests |
1015 | 1015 | * |
1016 | 1016 | * @param {Object} loadSet Loadset to return grouped |
— | — | @@ -2250,7 +2250,7 @@ |
2251 | 2251 | re = new RegExp("\\n","g"); |
2252 | 2252 | text = text.replace(re,"\\n"); |
2253 | 2253 | return escapeQuotesHTML(text); |
2254 | | - } |
| 2254 | + }; |
2255 | 2255 | |
2256 | 2256 | /** |
2257 | 2257 | * Escape an HTML text string |
— | — | @@ -2268,7 +2268,7 @@ |
2269 | 2269 | re = new RegExp('>',"g"); |
2270 | 2270 | text = text.replace(re,">"); |
2271 | 2271 | return text; |
2272 | | - } |
| 2272 | + }; |
2273 | 2273 | |
2274 | 2274 | /** |
2275 | 2275 | * Takes in a string returns an xml dom object |