Index: branches/MwEmbedStandAlone/mwEmbedFrame.php |
— | — | @@ -73,7 +73,7 @@ |
74 | 74 | // ( uses kaltura standard entry_id/{entryId} request ) |
75 | 75 | // normalize to the REQUEST object |
76 | 76 | // @@FIXME: this should be moved over to a kaltura specific iframe implementation |
77 | | - if( $_SERVER['PATH_INFO'] ){ |
| 77 | + if( isset( $_SERVER['PATH_INFO'] ) ){ |
78 | 78 | $kalturaUrlMap = Array( |
79 | 79 | 'entry_id' => 'kentryid', |
80 | 80 | 'uiconf_id' => 'kuiconfid', |
Index: branches/MwEmbedStandAlone/mwEmbed.js |
— | — | @@ -90,8 +90,36 @@ |
91 | 91 | |
92 | 92 | // Apply any pre-setup config: |
93 | 93 | mw.setConfig( preMwEmbedConfig ); |
94 | | - |
| 94 | + |
95 | 95 | /** |
| 96 | + * Merge in a configuration value: |
| 97 | + */ |
| 98 | + mw.mergeConfig = function( name, value ){ |
| 99 | + if( typeof name == 'object' ) { |
| 100 | + $j.each( name, function( inx, val) { |
| 101 | + mw.setConfig( inx, val ); |
| 102 | + }); |
| 103 | + return ; |
| 104 | + } |
| 105 | + // Check if we should "merge" the config |
| 106 | + if( typeof value == 'object' && typeof mwConfig[ name ] == 'object' ) { |
| 107 | + if ( value.constructor.toString().indexOf("Array") != -1 && |
| 108 | + mwConfig[ name ].constructor.toString().indexOf("Array") != -1 ){ |
| 109 | + // merge in the array |
| 110 | + mwConfig[ name ] = $j.merge( mwConfig[ name ], value ); |
| 111 | + } else { |
| 112 | + for( var i in value ){ |
| 113 | + mwConfig[ name ][ i ] = value[ i ]; |
| 114 | + } |
| 115 | + } |
| 116 | + return ; |
| 117 | + } |
| 118 | + // else do a normal setConfig |
| 119 | + mwConfig[ name ] = value; |
| 120 | + mwNonDefaultConfigList.push( name ); |
| 121 | + }; |
| 122 | + |
| 123 | + /** |
96 | 124 | * Set a default config value Will only update configuration if no value is |
97 | 125 | * present |
98 | 126 | * |
Index: branches/MwEmbedStandAlone/modules/MediaWikiSupport/mw.LanguageSelect.js |
— | — | @@ -0,0 +1,16 @@ |
| 2 | +/** |
| 3 | + * Simple language selection uses. |
| 4 | + */ |
| 5 | + |
| 6 | +mw.LanguageSelect = { |
| 7 | + /** |
| 8 | + * Get the language box ( note this c |
| 9 | + */ |
| 10 | + get: function( options ){ |
| 11 | + // Build a select object |
| 12 | + // TODO test string construction instead of jQuery build out for performance |
| 13 | + $j('<select id="combobox"> |
| 14 | + |
| 15 | + return $langSelect; |
| 16 | + } |
| 17 | +}; |
\ No newline at end of file |
Property changes on: branches/MwEmbedStandAlone/modules/MediaWikiSupport/mw.LanguageSelect.js |
___________________________________________________________________ |
Added: svn:mime-type |
1 | 18 | + text/plain |
Index: branches/MwEmbedStandAlone/modules/MediaWikiSupport/jQueryPlugins/jquery.ui.combobox.js |
— | — | @@ -0,0 +1,100 @@ |
| 2 | +// Ui combobox copied: |
| 3 | +// http://jqueryui.com/demos/autocomplete/#combobox |
| 4 | +(function( $ ) { |
| 5 | + $.widget( "ui.combobox", { |
| 6 | + _create: function() { |
| 7 | + var self = this, |
| 8 | + select = this.element.hide(), |
| 9 | + selected = select.children( ":selected" ), |
| 10 | + value = selected.val() ? selected.text() : ""; |
| 11 | + var input = this.input = $( "<input>" ) |
| 12 | + .insertAfter( select ) |
| 13 | + .val( value ) |
| 14 | + .autocomplete({ |
| 15 | + delay: 0, |
| 16 | + minLength: 0, |
| 17 | + source: function( request, response ) { |
| 18 | + var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" ); |
| 19 | + response( select.children( "option" ).map(function() { |
| 20 | + var text = $( this ).text(); |
| 21 | + if ( this.value && ( !request.term || matcher.test(text) ) ) |
| 22 | + return { |
| 23 | + label: text.replace( |
| 24 | + new RegExp( |
| 25 | + "(?![^&;]+;)(?!<[^<>]*)(" + |
| 26 | + $.ui.autocomplete.escapeRegex(request.term) + |
| 27 | + ")(?![^<>]*>)(?![^&;]+;)", "gi" |
| 28 | + ), "<strong>$1</strong>" ), |
| 29 | + value: text, |
| 30 | + option: this |
| 31 | + }; |
| 32 | + }) ); |
| 33 | + }, |
| 34 | + select: function( event, ui ) { |
| 35 | + ui.item.option.selected = true; |
| 36 | + self._trigger( "selected", event, { |
| 37 | + item: ui.item.option |
| 38 | + }); |
| 39 | + }, |
| 40 | + change: function( event, ui ) { |
| 41 | + if ( !ui.item ) { |
| 42 | + var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ), |
| 43 | + valid = false; |
| 44 | + select.children( "option" ).each(function() { |
| 45 | + if ( $( this ).text().match( matcher ) ) { |
| 46 | + this.selected = valid = true; |
| 47 | + return false; |
| 48 | + } |
| 49 | + }); |
| 50 | + if ( !valid ) { |
| 51 | + // remove invalid value, as it didn't match anything |
| 52 | + $( this ).val( "" ); |
| 53 | + select.val( "" ); |
| 54 | + input.data( "autocomplete" ).term = ""; |
| 55 | + return false; |
| 56 | + } |
| 57 | + } |
| 58 | + } |
| 59 | + }) |
| 60 | + .addClass( "ui-widget ui-widget-content ui-corner-left" ); |
| 61 | + |
| 62 | + input.data( "autocomplete" )._renderItem = function( ul, item ) { |
| 63 | + return $( "<li></li>" ) |
| 64 | + .data( "item.autocomplete", item ) |
| 65 | + .append( "<a>" + item.label + "</a>" ) |
| 66 | + .appendTo( ul ); |
| 67 | + }; |
| 68 | + |
| 69 | + this.button = $( "<button> </button>" ) |
| 70 | + .attr( "tabIndex", -1 ) |
| 71 | + .attr( "title", "Show All Items" ) |
| 72 | + .insertAfter( input ) |
| 73 | + .button({ |
| 74 | + icons: { |
| 75 | + primary: "ui-icon-triangle-1-s" |
| 76 | + }, |
| 77 | + text: false |
| 78 | + }) |
| 79 | + .removeClass( "ui-corner-all" ) |
| 80 | + .addClass( "ui-corner-right ui-button-icon" ) |
| 81 | + .click(function() { |
| 82 | + // close if already visible |
| 83 | + if ( input.autocomplete( "widget" ).is( ":visible" ) ) { |
| 84 | + input.autocomplete( "close" ); |
| 85 | + return; |
| 86 | + } |
| 87 | + |
| 88 | + // pass empty string as value to search for, displaying all results |
| 89 | + input.autocomplete( "search", "" ); |
| 90 | + input.focus(); |
| 91 | + }); |
| 92 | + }, |
| 93 | + |
| 94 | + destroy: function() { |
| 95 | + this.input.remove(); |
| 96 | + this.button.remove(); |
| 97 | + this.element.show(); |
| 98 | + $.Widget.prototype.destroy.call( this ); |
| 99 | + } |
| 100 | + }); |
| 101 | + })( jQuery ); |
Property changes on: branches/MwEmbedStandAlone/modules/MediaWikiSupport/jQueryPlugins/jquery.ui.combobox.js |
___________________________________________________________________ |
Added: svn:mime-type |
1 | 102 | + text/plain |
Index: branches/MwEmbedStandAlone/modules/MediaWikiSupport/loader.js |
— | — | @@ -0,0 +1,9 @@ |
| 2 | + |
| 3 | +// Wrap in mw |
| 4 | +( function( mw ) { |
| 5 | + // Add as loader dependency 'mw.style.mirosubsMenu' |
| 6 | + mw.addResourcePaths({ |
| 7 | + "mw.LanguageSelectBox" : "mw.LanguageSelectBox.js" |
| 8 | + }); |
| 9 | + |
| 10 | +} )( window.mw ); |
\ No newline at end of file |
Property changes on: branches/MwEmbedStandAlone/modules/MediaWikiSupport/loader.js |
___________________________________________________________________ |
Added: svn:mime-type |
1 | 11 | + text/plain |
Index: branches/MwEmbedStandAlone/modules/MediaWikiSupport/README |
— | — | @@ -0,0 +1,4 @@ |
| 2 | +This folder should contain all the mediaWiki specific helpers. |
| 3 | + |
| 4 | +* Related to the embedPlayer this allows you to use mediaWiki title keys to pull in video assets. |
| 5 | +* Any utilities that are not part of core resource loader components ( api helper ) |
Index: branches/MwEmbedStandAlone/modules/MiroSubs/mw.TranslateSubsVolunteerlet.js |
— | — | @@ -0,0 +1,12 @@ |
| 2 | +/** |
| 3 | +* A volenteerlet is a small bit of code that can be invoked to do a small a few minutes of work |
| 4 | +* |
| 5 | +* I hope to generalize the concept into a separate module / extension, and let modules extend the |
| 6 | +* base volteerlet object with specific tasks. |
| 7 | +* |
| 8 | +* This voletnerlet is designed to help people rapidly crowd source subtitles translation. |
| 9 | +*/ |
| 10 | + |
| 11 | +mw.TranslateSubsVolunteerlet = function(){ |
| 12 | + |
| 13 | +}; |
\ No newline at end of file |
Property changes on: branches/MwEmbedStandAlone/modules/MiroSubs/mw.TranslateSubsVolunteerlet.js |
___________________________________________________________________ |
Added: svn:mime-type |
1 | 14 | + text/plain |
Index: branches/MwEmbedStandAlone/modules/MiroSubs/loader.js |
— | — | @@ -43,12 +43,13 @@ |
44 | 44 | mw.addLoaderDialog( gM('mwe-mirosubs-loading-universal-subtitles') ); |
45 | 45 | // Load miro subs: |
46 | 46 | mw.load( 'MiroSubs', function(){ |
| 47 | + // Close loader dialog |
| 48 | + mw.closeLoaderDialog(); |
| 49 | + |
47 | 50 | // Open the mirosubs dialog: |
48 | | - mw.MiroSubsConfig.openDialog( embedPlayer, function(){ |
49 | | - // dialog Ready close loader |
50 | | - mw.closeLoaderDialog(); |
51 | | - }); |
| 51 | + mw.MiroSubsConfig.openDialog( embedPlayer ); |
52 | 52 | }); |
| 53 | + // don't follow the line item # link |
53 | 54 | return false; |
54 | 55 | }) |
55 | 56 | ); |
Index: branches/MwEmbedStandAlone/modules/MiroSubs/mw.MiroSubsConfig.js |
— | — | @@ -7,19 +7,14 @@ |
8 | 8 | */ |
9 | 9 | mw.MiroSubsConfig = { |
10 | 10 | config : null, |
11 | | - openDialog: function( embedPlayer, dialogReadyCallback ){ |
| 11 | + openDialog: function( embedPlayer ){ |
12 | 12 | var _this = this; |
13 | 13 | this.getConfig( embedPlayer , function( config ){ |
14 | 14 | if( !config ){ |
15 | 15 | return ; |
16 | | - } |
17 | | - // xxx NOTE there are some weird async display issues |
18 | | - // that only seem to be resolvable with timeouts for DOM actions |
| 16 | + } |
| 17 | + // Show the dialog ( wait 500ms because of weird async DOM issues with mirosub wiget |
19 | 18 | setTimeout(function(){ |
20 | | - dialogReadyCallback(); |
21 | | - }, 100); |
22 | | - // Show the dialog |
23 | | - setTimeout(function(){ |
24 | 19 | _this.mirosubs = mirosubs.api.openDialog( config ); |
25 | 20 | }, 800); |
26 | 21 | }); |
— | — | @@ -44,11 +39,22 @@ |
45 | 40 | |
46 | 41 | // Check both the user name and subtitles have been set: |
47 | 42 | var isConfigReady = function(){ |
48 | | - if( _this.config.username && _this.config.subtitles ){ |
| 43 | + if( _this.config.username |
| 44 | + && |
| 45 | + _this.config.subtitles |
| 46 | + && |
| 47 | + _this.config.languageKey |
| 48 | + ){ |
49 | 49 | callback( _this.config ); |
50 | 50 | } |
51 | 51 | }; |
52 | 52 | |
| 53 | + // Get the language selection from user input ( dialog ) |
| 54 | + _this.getContentLanguage( function( langKey ){ |
| 55 | + _this.config.languageKey = langKey; |
| 56 | + isConfigReady(); |
| 57 | + }); |
| 58 | + |
53 | 59 | // Make sure we are logged in:: |
54 | 60 | mw.getUserName( function( userName ){ |
55 | 61 | mw.log( "MiroSubsConfig::getUserName: " + userName ); |
— | — | @@ -71,6 +77,22 @@ |
72 | 78 | isConfigReady(); |
73 | 79 | }); |
74 | 80 | }, |
| 81 | + |
| 82 | + getContentLanguage: function(){ |
| 83 | + var $dialog = mw.addDialog( { |
| 84 | + 'title' : gM("mwe-mirosubs-content-language"), |
| 85 | + 'width' : 450, |
| 86 | + 'content' : $j('<div />').append( |
| 87 | + $j('<h3 />').text( gM("mwe-mirosubs-content-language") ), |
| 88 | + $j('<input/>').attr({ |
| 89 | + 'id' : 'mwe-mirosubs-save-summary', |
| 90 | + 'size': '35' |
| 91 | + }).val( gM('mwe-mirosubs-save-default') ) |
| 92 | + ), |
| 93 | + 'buttons' : buttons |
| 94 | + }); |
| 95 | + }, |
| 96 | + |
75 | 97 | /** |
76 | 98 | * Present a dialog to get the target language |
77 | 99 | */ |
— | — | @@ -84,9 +106,6 @@ |
85 | 107 | // By default the config status is 'ok' |
86 | 108 | 'status' : 'ok', |
87 | 109 | |
88 | | - // Default language key 'en': |
89 | | - 'languageKey' : 'en', |
90 | | - |
91 | 110 | 'closeListener': function(){ |
92 | 111 | // close event refresh page? |
93 | 112 | // make sure any close dialog is 'closed' |
Index: branches/MwEmbedStandAlone/modules/MiroSubs/MiroSubs.i18n.php |
— | — | @@ -19,5 +19,6 @@ |
20 | 20 | 'mwe-mirosubs-thankyou-contribution' => 'Thank you for your subtitle contribution', |
21 | 21 | 'mwe-mirosubs-subs-saved-error' => 'Error in saving subtitles', |
22 | 22 | 'mwe-mirosubs-subs-please-login' => 'Please login', |
23 | | - 'mwe-mirosubs-subs-please-login-desc' => 'Please login, to use the universal subtitles editor' |
| 23 | + 'mwe-mirosubs-subs-please-login-desc' => 'Please login, to use the universal subtitles editor', |
| 24 | + 'mwe-mirosubs-content-language' => 'Set content language', |
24 | 25 | ); |
\ No newline at end of file |
Index: branches/MwEmbedStandAlone/modules/SwarmTransport/mw.SwarmTransport.js |
— | — | @@ -19,10 +19,14 @@ |
20 | 20 | // Confirm SwarmTransport add-on is available ( defines swarmTransport var ) |
21 | 21 | if( _this.getPluginLibrary() ){ |
22 | 22 | // Add the swarm source |
23 | | - _this.addSwarmSource( embedPlayer, function(){ |
24 | | - // Update the source if paused |
25 | | - if( embedPlayer.paused ) { |
26 | | - embedPlayer.setupSourcePlayer(); |
| 23 | + _this.addSwarmSource( embedPlayer, function( status ){ |
| 24 | + // Check if the status returned true |
| 25 | + if( status ){ |
| 26 | + // Update the source if paused |
| 27 | + if( embedPlayer.paused ) { |
| 28 | + // Resetup sources |
| 29 | + embedPlayer.setupSourcePlayer(); |
| 30 | + } |
27 | 31 | } |
28 | 32 | }); |
29 | 33 | } |
— | — | @@ -116,7 +120,7 @@ |
117 | 121 | // Check if the torrent is ready: |
118 | 122 | if( !data.torrent ){ |
119 | 123 | mw.log( "SwarmTransport: Torrent not ready status: " + data.status.text ); |
120 | | - callback(); |
| 124 | + callback( false ); |
121 | 125 | return ; |
122 | 126 | } |
123 | 127 | mw.log( 'SwarmTransport: addSwarmSource for: ' + source.getSrc() + "\n\nGot:" + data.torrent ); |
— | — | @@ -131,7 +135,7 @@ |
132 | 136 | } ) |
133 | 137 | .get( 0 ) |
134 | 138 | ); |
135 | | - callback(); |
| 139 | + callback( true ); |
136 | 140 | } |
137 | 141 | ); |
138 | 142 | }, |
Index: branches/MwEmbedStandAlone/modules/TimedText/mw.TimedTextEdit.js |
— | — | @@ -371,6 +371,7 @@ |
372 | 372 | }); |
373 | 373 | }) |
374 | 374 | }, |
| 375 | + |
375 | 376 | /** |
376 | 377 | * Gets the language set. |
377 | 378 | * |
— | — | @@ -400,10 +401,11 @@ |
401 | 402 | // call out to "anonymous" function to variable scope the langKey |
402 | 403 | $langMenu.append( |
403 | 404 | _this.getLangMenuItem( langKey , source_icon) |
404 | | - ) |
| 405 | + ); |
405 | 406 | } |
406 | 407 | return $langMenu; |
407 | 408 | }, |
| 409 | + |
408 | 410 | getLangMenuItem: function( langKey , source_icon) { |
409 | 411 | return $j.getLineItem( |
410 | 412 | langKey + ' - ' + mw.Language.names[ langKey ], |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -2374,6 +2374,10 @@ |
2375 | 2375 | if( this.isPersistentNativePlayer() && mw.getConfig('EmbedPlayer.EnableIpadHTMLControls') ){ |
2376 | 2376 | return false; |
2377 | 2377 | } else { |
| 2378 | + // Set warning that your trying to do iPad controls without persistent native player: |
| 2379 | + if( mw.getConfig('EmbedPlayer.EnableIpadHTMLControls') ){ |
| 2380 | + mw.log("Error:: Trying to set EnableIpadHTMLControls without Persistent Native Player"); |
| 2381 | + } |
2378 | 2382 | return true; |
2379 | 2383 | } |
2380 | 2384 | } |
— | — | @@ -2673,25 +2677,24 @@ |
2674 | 2678 | } |
2675 | 2679 | } |
2676 | 2680 | |
2677 | | - // If we previously finished playing this clip run the "replay hook" |
2678 | | - if( this.donePlayingCount > 0 && !this.paused) { |
2679 | | - mw.log("replayEvent"); |
2680 | | - $j( this ).trigger( 'replayEvent' ); |
2681 | | - } |
2682 | | - |
2683 | 2681 | |
2684 | 2682 | if( this.paused === true ){ |
2685 | | - this.paused = false; |
2686 | | - |
| 2683 | + this.paused = false; |
2687 | 2684 | // Check if we should Trigger the play event |
2688 | 2685 | if( this.bubbleEventCheck() ) { |
2689 | 2686 | mw.log("EmbedPlayer:: trigger play even::" + !this.paused); |
2690 | | - if( this._propagateEvents ){ |
| 2687 | + if( this._propagateEvents ){ |
2691 | 2688 | $j( this ).trigger( 'play' ); |
2692 | 2689 | _this.tempDisableEvents(); |
2693 | 2690 | } |
2694 | 2691 | } |
2695 | 2692 | } |
| 2693 | + |
| 2694 | + // If we previously finished playing this clip run the "replay hook" |
| 2695 | + if( this.donePlayingCount > 0 && !this.paused) { |
| 2696 | + mw.log("replayEvent"); |
| 2697 | + $j( this ).trigger( 'replayEvent' ); |
| 2698 | + } |
2696 | 2699 | |
2697 | 2700 | this.$interface.find('.play-btn span') |
2698 | 2701 | .removeClass( 'ui-icon-play' ) |
— | — | @@ -2737,7 +2740,7 @@ |
2738 | 2741 | if( this.bubbleEventCheck() ){ |
2739 | 2742 | mw.log('EmbedPlayer:trigger pause:' + this.paused); |
2740 | 2743 | if( this._propagateEvents ){ |
2741 | | - $j( this ).trigger('pause' ); |
| 2744 | + $j( this ).trigger( 'pause' ); |
2742 | 2745 | _this.tempDisableEvents(); |
2743 | 2746 | } |
2744 | 2747 | } |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js |
— | — | @@ -567,24 +567,41 @@ |
568 | 568 | |
569 | 569 | // Remove any old interface bindings |
570 | 570 | $interface.unbind(); |
571 | | - |
572 | | - // Play & Pause on Click |
573 | | - var bindFirstPlay = false; |
574 | | - $j(embedPlayer).bind('play', function() { //Only bind once played |
| 571 | + |
| 572 | + var bindFirstPlay = false; |
| 573 | + // Bind into play.ctrl namespace ( so we can unbind without affecting other play bindings ) |
| 574 | + $j(embedPlayer).unbind('play.ctrl').bind('play.ctrl', function() { //Only bind once played |
575 | 575 | if(bindFirstPlay) { |
576 | 576 | return ; |
577 | 577 | } |
578 | 578 | bindFirstPlay = true; |
579 | | - $j(embedPlayer).click( function() { |
580 | | - if(embedPlayer.getPlayerElement().controls) { |
| 579 | + var dblClickTime = 300; |
| 580 | + var lastClickTime = 0; |
| 581 | + var didDblClick = false; |
| 582 | + // Remove parent dbl click ( so we can handle play clicks ) |
| 583 | + $j( embedPlayer ).unbind("dblclick").click( function() { |
| 584 | + // Don't bind anything if native controls displayed: |
| 585 | + if( embedPlayer.getPlayerElement().controls ) { |
581 | 586 | return ; |
| 587 | + } |
| 588 | + var clickTime = new Date().getTime(); |
| 589 | + if( clickTime -lastClickTime < dblClickTime ) { |
| 590 | + embedPlayer.fullscreen(); |
| 591 | + didDblClick = true; |
| 592 | + setTimeout( function(){ didDblClick = false; }, dblClickTime + 10 ); |
582 | 593 | } |
| 594 | + lastClickTime = clickTime; |
| 595 | + setTimeout( function(){ |
| 596 | + // check if no click has since the time we called the setTimeout |
| 597 | + if( !didDblClick ){ |
| 598 | + if( embedPlayer.paused ) { |
| 599 | + embedPlayer.play(); |
| 600 | + } else { |
| 601 | + embedPlayer.pause(); |
| 602 | + } |
| 603 | + } |
| 604 | + }, dblClickTime ); |
583 | 605 | |
584 | | - if(embedPlayer.paused) { |
585 | | - embedPlayer.play(); |
586 | | - } else { |
587 | | - embedPlayer.pause(); |
588 | | - } |
589 | 606 | }); |
590 | 607 | }); |
591 | 608 | |