r60425 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60424‎ | r60425 | r60426 >
Date:09:00, 27 December 2009
Author:dale
Status:deferred
Tags:
Comment:
* language updates
* sequence stub support
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/includes/languages/mwEmbed.i18n.php (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/remotes/RemoteMwSequencer.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/TimedText/remotes/RemoteMwTimedText.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/includes/languages/mwEmbed.i18n.php
@@ -67,6 +67,12 @@
6868 '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>).',
6969
7070 /*
 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+ /*
7177 * js file: /modules/TimedText/old_mvTimeTextEdit.js
7278 */
7379 'mwe-upload-subs-file' => 'Upload subtitle',
@@ -131,8 +137,8 @@
132138 /*
133139 * js file: /modules/TimedText/remotes/RemoteMwTimedText.js
134140 */
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',
137143
138144 /*
139145 * js file: /modules/EmbedPlayer/mw.EmbedPlayer.js
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js
@@ -830,7 +830,10 @@
831831
832832 /**
833833 * 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 )
835838 */
836839 TextSource = function( source , textProvider){
837840 return this.init( source, textProvider );
@@ -844,7 +847,7 @@
845848 // captions include "start", "end" and "content" fields
846849 captions: [],
847850
848 - // The previus index of the timed text served
 851+ // The previous index of the timed text served
849852 // Avoids searching the entire array on time updates.
850853 prevIndex: 0,
851854
@@ -901,7 +904,7 @@
902905 }
903906 // Try to load src via src attr:
904907 if( this.getSrc() ){
905 - // Issue the load request ( if we can )
 908+ // Issue the direct load request ( if we can )
906909 if ( mw.parseUri( document.URL ).host != mw.parseUri( this.getSrc() ).host ){
907910 mw.log("Error: host mis-match: " + mw.parseUri( document.URL ).host != mw.parseUri( this.getSrc() ).host )
908911 return ;
@@ -918,7 +921,7 @@
919922 return ;
920923 }
921924
922 - // Try to load src via provider:
 925+ // Try to load src via textProvider:
923926 if( this.textProvider && this.titleKey ){
924927 this.textProvider.loadTitleKey( this.titleKey, function( data ){
925928 if( data ){
@@ -962,15 +965,16 @@
963966 }
964967 /**
965968 * parse mediaWiki html srt
 969+ * @param {Object} data XML data string to be parsed
966970 */
967971 function parseMwSrt( data ){
968972 var captions = [ ];
969973 var curentCap = [];
970974 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:
972976 $j( '<div>' + data + '</div>' ).find('p').each( function(){
973977 currentPtext = $j(this).html();
974 - mw.log( currentPtext );
 978+ //mw.log( currentPtext );
975979
976980 //Check if the p matches the "all in one line" match:
977981 var m = currentPtext.replace('--&gt;', '-->').match(/\d+\s(\d+):(\d+):(\d+)(?:,(\d+))?\s*--?>\s*(\d+):(\d+):(\d+)(?:,(\d+))?(.*)/);
@@ -1027,7 +1031,7 @@
10281032 return captions;
10291033 }
10301034 /**
1031 - * srt timed text parse hanndle:
 1035+ * srt timed text parse handle:
10321036 * @param {String} data Srt string to be parsed
10331037 */
10341038 function parseSrt( data ) {
@@ -1116,8 +1120,8 @@
11171121 /**
11181122 * Text Providers
11191123 *
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
11221126 *
11231127
11241128 // 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 @@
1111 "mwe-language-subtitles-for-clip": "$1 subtitles for clip: $2",
1212 "mwe-language-no-subtitles-for-clip": "No $1 subtitles where found for clip: $2"
1313 });
14 -var RemoteMwTimedText = function( options ){
 14+
 15+RemoteMwTimedText = function( options ){
1516 return this.init( options );
1617 }
1718 RemoteMwTimedText.prototype = {
@@ -139,7 +140,7 @@
140141 var pt = page.revisions[0]['*'].match( re );
141142 if ( pt[1] ) {
142143 mw.log( 'found redirect tyring: ' + pt[1] )
143 - RemoteMwTimedText.embedByTitle( pt[1], callback);
 144+ _this.embedByTitle( pt[1], callback);
144145 return ;
145146 } else {
146147 mw.log( 'Error: addByTitle could not process redirect' );
@@ -170,9 +171,11 @@
171172 }
172173 }
173174
 175+
 176+// Setup config on init: ( remotes drive page actions on init )
174177 mw.ready( function(){
175178 //Setup the remote configuration
176 - myRemote = new RemoteMwTimedText( {
 179+ var myRemote = new RemoteMwTimedText( {
177180 'action': wgAction,
178181 'title' : wgTitle,
179182 'target': '#bodyContent'
Index: branches/js2-work/phase3/js/mwEmbed/modules/Sequencer/remotes/RemoteMwSequencer.js
@@ -1,23 +1,79 @@
22 /**
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
55 *
66 * Supports basic "sequencer" functionality as a javascript rewrite system.
77 */
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+ },
1026
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+ }
1552
 53+ // Check page type
1654
1755 // "view" page
 56+
1857 // set page content to "loading"
1958 // get wikitext of page via api
2059 // grab xml
2160 // 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+};
2368
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 @@
5151 // Timed text display:
5252 if ( wgPageName.indexOf( "TimedText" ) === 0 ) {
5353 if( wgAction == 'view' ){
54 - mwSetPageToloading();
 54+ mwSetPageToLoading();
5555 }
5656 //load the "player" ( includes call to loadMwEmbed )
5757 mwLoadPlayer(function(){
@@ -60,13 +60,14 @@
6161 }
6262
6363 // Remote Sequencer
64 - if( wgPageName.indexOf( "Sequence" ) === 0 ){
 64+ if( wgPageName.indexOf( "Sequence" ) === 0 ){
 65+ console.log( 'spl: ' + typeof mwSetPageToLoading );
6566 // If on a view page set content to "loading"
6667 mwSetPageToLoading();
6768 // Loading with loadMwEmbed not so big a deal since "sequencer is huge
6869 loadMwEmbed( function(){
6970 mw.load( 'Sequencer', function(){
70 - mw.load( mwEmbedHostPath + '/mwEmbed/Sequencer/mw.Sequencer.js?' + mwGetReqArgs() );
 71+ mw.load( 'RemoteMwSequencer' );
7172 } );
7273 } );
7374 }
@@ -104,7 +105,7 @@
105106 }
106107 }
107108 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:
109110 vidIdList = vidIdList.reverse();
110111 mwLoadPlayer(function(){
111112 //Load the "EmbedPlayer" module:
@@ -120,10 +121,11 @@
121122 /*
122123 * Sets the mediaWiki content to "loading"
123124 */
124 -function mwSetPageToloading(){
 125+function mwSetPageToLoading(){
125126 importStylesheetURI( mwEmbedHostPath + '/mwEmbed/skins/mvpcf/styles.css?' + mwGetReqArgs() );
126127 var body = document.getElementById('bodyContent');
127128 body.innerHTML = '<div class="loading_spinner"></div>';
 129+ return ;
128130 }
129131 /**
130132 * Similar to the player loader in /modules/embedPlayer/loader.js

Status & tagging log