Index: branches/js2-work/phase3/js/mwEmbed/includes/languages/mwEmbed.i18n.php |
— | — | @@ -67,6 +67,12 @@ |
68 | 68 | 'mwe-sequencer_credit_line' => 'Developed by <a href="http://kaltura.com">Kaltura, Inc.</a> in partnership with the <a href="http://wikimediafoundation.org/wiki/Home">Wikimedia Foundation</a> (<a href="#">more information</a>).', |
69 | 69 | |
70 | 70 | /* |
| 71 | + * js file: /modules/Sequencer/remotes/RemoteMwSequencer.js |
| 72 | + */ |
| 73 | + 'mwe-no-sequence-create' => 'No sequence exists named $1, You can $2', |
| 74 | + 'mwe-sequence-create-one' => 'start a sequence', |
| 75 | + |
| 76 | + /* |
71 | 77 | * js file: /modules/TimedText/old_mvTimeTextEdit.js |
72 | 78 | */ |
73 | 79 | 'mwe-upload-subs-file' => 'Upload subtitle', |
— | — | @@ -131,8 +137,8 @@ |
132 | 138 | /* |
133 | 139 | * js file: /modules/TimedText/remotes/RemoteMwTimedText.js |
134 | 140 | */ |
135 | | - 'mwe-language-subtiles-for-clip' => '$1 subtitles for clip: $2', |
136 | | - 'mwe-language-no-subtiles-for-clip' => 'No $1 subtitles where found for clip: $2', |
| 141 | + 'mwe-language-subtitles-for-clip' => '$1 subtitles for clip: $2', |
| 142 | + 'mwe-language-no-subtitles-for-clip' => 'No $1 subtitles where found for clip: $2', |
137 | 143 | |
138 | 144 | /* |
139 | 145 | * js file: /modules/EmbedPlayer/mw.EmbedPlayer.js |
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js |
— | — | @@ -830,7 +830,10 @@ |
831 | 831 | |
832 | 832 | /** |
833 | 833 | * TextSource object extends a base mediaSource object |
834 | | - * with some timedText features |
| 834 | + * with some timedText features |
| 835 | + * |
| 836 | + * @param {Object} source Source object to extend |
| 837 | + * @param {Object} {Optional} textProvider The text provider interface ( to load source from api ) |
835 | 838 | */ |
836 | 839 | TextSource = function( source , textProvider){ |
837 | 840 | return this.init( source, textProvider ); |
— | — | @@ -844,7 +847,7 @@ |
845 | 848 | // captions include "start", "end" and "content" fields |
846 | 849 | captions: [], |
847 | 850 | |
848 | | - // The previus index of the timed text served |
| 851 | + // The previous index of the timed text served |
849 | 852 | // Avoids searching the entire array on time updates. |
850 | 853 | prevIndex: 0, |
851 | 854 | |
— | — | @@ -901,7 +904,7 @@ |
902 | 905 | } |
903 | 906 | // Try to load src via src attr: |
904 | 907 | if( this.getSrc() ){ |
905 | | - // Issue the load request ( if we can ) |
| 908 | + // Issue the direct load request ( if we can ) |
906 | 909 | if ( mw.parseUri( document.URL ).host != mw.parseUri( this.getSrc() ).host ){ |
907 | 910 | mw.log("Error: host mis-match: " + mw.parseUri( document.URL ).host != mw.parseUri( this.getSrc() ).host ) |
908 | 911 | return ; |
— | — | @@ -918,7 +921,7 @@ |
919 | 922 | return ; |
920 | 923 | } |
921 | 924 | |
922 | | - // Try to load src via provider: |
| 925 | + // Try to load src via textProvider: |
923 | 926 | if( this.textProvider && this.titleKey ){ |
924 | 927 | this.textProvider.loadTitleKey( this.titleKey, function( data ){ |
925 | 928 | if( data ){ |
— | — | @@ -962,15 +965,16 @@ |
963 | 966 | } |
964 | 967 | /** |
965 | 968 | * parse mediaWiki html srt |
| 969 | + * @param {Object} data XML data string to be parsed |
966 | 970 | */ |
967 | 971 | function parseMwSrt( data ){ |
968 | 972 | var captions = [ ]; |
969 | 973 | var curentCap = []; |
970 | 974 | var parseNextAsTime = false; |
971 | | - // Optimize: we could use javascript strings instead of XML parsing |
| 975 | + // Optimize: we could use javascript strings functions instead of jQuery XML parsing: |
972 | 976 | $j( '<div>' + data + '</div>' ).find('p').each( function(){ |
973 | 977 | currentPtext = $j(this).html(); |
974 | | - mw.log( currentPtext ); |
| 978 | + //mw.log( currentPtext ); |
975 | 979 | |
976 | 980 | //Check if the p matches the "all in one line" match: |
977 | 981 | var m = currentPtext.replace('-->', '-->').match(/\d+\s(\d+):(\d+):(\d+)(?:,(\d+))?\s*--?>\s*(\d+):(\d+):(\d+)(?:,(\d+))?(.*)/); |
— | — | @@ -1027,7 +1031,7 @@ |
1028 | 1032 | return captions; |
1029 | 1033 | } |
1030 | 1034 | /** |
1031 | | - * srt timed text parse hanndle: |
| 1035 | + * srt timed text parse handle: |
1032 | 1036 | * @param {String} data Srt string to be parsed |
1033 | 1037 | */ |
1034 | 1038 | function parseSrt( data ) { |
— | — | @@ -1116,8 +1120,8 @@ |
1117 | 1121 | /** |
1118 | 1122 | * Text Providers |
1119 | 1123 | * |
1120 | | - * text provier objects let you map your player to a timed text provier |
1121 | | - * can provide discovery, and contirbution push back |
| 1124 | + * text provider objects let you map your player to a timed text provider |
| 1125 | + * can provide discovery, and contribution push back |
1122 | 1126 | * |
1123 | 1127 | |
1124 | 1128 | // Will add a base class once we are serving more than just mediaWiki "commons" |
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/remotes/RemoteMwTimedText.js |
— | — | @@ -10,7 +10,8 @@ |
11 | 11 | "mwe-language-subtitles-for-clip": "$1 subtitles for clip: $2", |
12 | 12 | "mwe-language-no-subtitles-for-clip": "No $1 subtitles where found for clip: $2" |
13 | 13 | }); |
14 | | -var RemoteMwTimedText = function( options ){ |
| 14 | + |
| 15 | +RemoteMwTimedText = function( options ){ |
15 | 16 | return this.init( options ); |
16 | 17 | } |
17 | 18 | RemoteMwTimedText.prototype = { |
— | — | @@ -139,7 +140,7 @@ |
140 | 141 | var pt = page.revisions[0]['*'].match( re ); |
141 | 142 | if ( pt[1] ) { |
142 | 143 | mw.log( 'found redirect tyring: ' + pt[1] ) |
143 | | - RemoteMwTimedText.embedByTitle( pt[1], callback); |
| 144 | + _this.embedByTitle( pt[1], callback); |
144 | 145 | return ; |
145 | 146 | } else { |
146 | 147 | mw.log( 'Error: addByTitle could not process redirect' ); |
— | — | @@ -170,9 +171,11 @@ |
171 | 172 | } |
172 | 173 | } |
173 | 174 | |
| 175 | + |
| 176 | +// Setup config on init: ( remotes drive page actions on init ) |
174 | 177 | mw.ready( function(){ |
175 | 178 | //Setup the remote configuration |
176 | | - myRemote = new RemoteMwTimedText( { |
| 179 | + var myRemote = new RemoteMwTimedText( { |
177 | 180 | 'action': wgAction, |
178 | 181 | 'title' : wgTitle, |
179 | 182 | 'target': '#bodyContent' |
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/remotes/RemoteMwSequencer.js |
— | — | @@ -1,23 +1,79 @@ |
2 | 2 | /** |
3 | | -* Stop-gap for php sequencer support does some tranformations |
4 | | -* to normal page views to pretend the support sequences. |
| 3 | +* Stop-gap for php sequencer support does some transformations |
| 4 | +* to normal page views to support sequences edits |
5 | 5 | * |
6 | 6 | * Supports basic "sequencer" functionality as a javascript rewrite system. |
7 | 7 | */ |
8 | | -mw.ready( function(){ |
9 | | - // Check page type |
| 8 | + |
| 9 | +mw.addMessages( { |
| 10 | + "mwe-no-sequence-create" : "No sequence exists named $1, You can $2", |
| 11 | + "mwe-sequence-create-one" : "start a sequence" |
| 12 | +}); |
| 13 | + |
| 14 | +RemoteMwSequencer = function( options ){ |
| 15 | + return this.init( options ); |
| 16 | +}; |
| 17 | +RemoteMwSequencer.prototype = { |
| 18 | + /** |
| 19 | + * @constructor |
| 20 | + */ |
| 21 | + init: function( options ) { |
| 22 | + this.action = ( options.action )? options.action : this.action; |
| 23 | + this.title = ( options.title )? options.title : this.title; |
| 24 | + this.target = ( options.target )? options.target : this.target; |
| 25 | + }, |
10 | 26 | |
11 | | - //"edit" page |
12 | | - // grab textbox text, |
13 | | - // set page to loading |
14 | | - // display sequence editor in "body" with -> full-screen link |
| 27 | + updateUI: function(){ |
| 28 | + // Check page type |
| 29 | + if( this.action == 'view' ){ |
| 30 | + this.showViewUI(); |
| 31 | + } |
| 32 | + }, |
| 33 | + /* |
| 34 | + * Check page for sequence |
| 35 | + * if not present give link to "create" one. |
| 36 | + */ |
| 37 | + showViewUI: function(){ |
| 38 | + if( wgArticleId == 0 ){ |
| 39 | + $startLink = $j('<div>').append( |
| 40 | + $j('<a>') |
| 41 | + .text( gM('mwe-sequence-create-one') ) |
| 42 | + .attr('id', 'mwe-sequence-create') |
| 43 | + ); |
| 44 | + $j( this.target ).html( |
| 45 | + gM("mwe-no-sequence-create", [this.title, $startLink.html() ]) |
| 46 | + ); |
| 47 | + $j('#mwe-sequence-create').click(function(){ |
| 48 | + alert(' new sequence here' ); |
| 49 | + }); |
| 50 | + } |
| 51 | + } |
15 | 52 | |
| 53 | + // Check page type |
16 | 54 | |
17 | 55 | // "view" page |
| 56 | + |
18 | 57 | // set page content to "loading" |
19 | 58 | // get wikitext of page via api |
20 | 59 | // grab xml |
21 | 60 | // update page with sequence and |
22 | | -}); |
| 61 | + |
| 62 | + |
| 63 | + //"edit" page |
| 64 | + // grab textbox text, |
| 65 | + // set page to loading |
| 66 | + // display sequence editor in "body" with -> full-screen link |
| 67 | +}; |
23 | 68 | |
24 | | -var RemoteMwSequencer = { }; |
\ No newline at end of file |
| 69 | + |
| 70 | +mw.ready( function(){ |
| 71 | + //Setup the remote configuration |
| 72 | + var myRemote = new RemoteMwSequencer( { |
| 73 | + 'action': wgAction, |
| 74 | + 'title' : wgTitle, |
| 75 | + 'target': '#bodyContent' |
| 76 | + }); |
| 77 | + // Update the UI |
| 78 | + myRemote.updateUI(); |
| 79 | + |
| 80 | +}); |
\ No newline at end of file |
Index: branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | // Timed text display: |
52 | 52 | if ( wgPageName.indexOf( "TimedText" ) === 0 ) { |
53 | 53 | if( wgAction == 'view' ){ |
54 | | - mwSetPageToloading(); |
| 54 | + mwSetPageToLoading(); |
55 | 55 | } |
56 | 56 | //load the "player" ( includes call to loadMwEmbed ) |
57 | 57 | mwLoadPlayer(function(){ |
— | — | @@ -60,13 +60,14 @@ |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Remote Sequencer |
64 | | - if( wgPageName.indexOf( "Sequence" ) === 0 ){ |
| 64 | + if( wgPageName.indexOf( "Sequence" ) === 0 ){ |
| 65 | + console.log( 'spl: ' + typeof mwSetPageToLoading ); |
65 | 66 | // If on a view page set content to "loading" |
66 | 67 | mwSetPageToLoading(); |
67 | 68 | // Loading with loadMwEmbed not so big a deal since "sequencer is huge |
68 | 69 | loadMwEmbed( function(){ |
69 | 70 | mw.load( 'Sequencer', function(){ |
70 | | - mw.load( mwEmbedHostPath + '/mwEmbed/Sequencer/mw.Sequencer.js?' + mwGetReqArgs() ); |
| 71 | + mw.load( 'RemoteMwSequencer' ); |
71 | 72 | } ); |
72 | 73 | } ); |
73 | 74 | } |
— | — | @@ -104,7 +105,7 @@ |
105 | 106 | } |
106 | 107 | } |
107 | 108 | if ( vidIdList.length > 0 ) { |
108 | | - //reverse order the array so videos at the "top" get swaped first: |
| 109 | + // Reverse order the array so videos at the "top" get swaped first: |
109 | 110 | vidIdList = vidIdList.reverse(); |
110 | 111 | mwLoadPlayer(function(){ |
111 | 112 | //Load the "EmbedPlayer" module: |
— | — | @@ -120,10 +121,11 @@ |
121 | 122 | /* |
122 | 123 | * Sets the mediaWiki content to "loading" |
123 | 124 | */ |
124 | | -function mwSetPageToloading(){ |
| 125 | +function mwSetPageToLoading(){ |
125 | 126 | importStylesheetURI( mwEmbedHostPath + '/mwEmbed/skins/mvpcf/styles.css?' + mwGetReqArgs() ); |
126 | 127 | var body = document.getElementById('bodyContent'); |
127 | 128 | body.innerHTML = '<div class="loading_spinner"></div>'; |
| 129 | + return ; |
128 | 130 | } |
129 | 131 | /** |
130 | 132 | * Similar to the player loader in /modules/embedPlayer/loader.js |