r58939 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58938‎ | r58939 | r58940 >
Date:09:59, 12 November 2009
Author:dale
Status:deferred
Tags:
Comment:
* replaced global $mw with mw ($ in front of a var should mean jQuery object)
Modified paths:
  • /trunk/phase3/js2/apiProxyPage.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/example_usage/Add_Media_Wizard.html (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/flickrSearch.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libEmbedVideo/nativeEmbed.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libMwApi/mw.proxy.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libTimedText/mvTextInterface.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/mv_embed.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/skins/ctrlBuilder.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/skins/kskin/kskin.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/skins/mvpcf/styles.css (modified) (history)
  • /trunk/phase3/js2/mwEmbed/tests/testLang.js (modified) (history)
  • /trunk/phase3/js2/remoteMwEmbed.js (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/example_usage/Add_Media_Wizard.html
@@ -14,7 +14,7 @@
1515 <script type="text/javascript" src="../mv_embed.js?debug=true"></script>
1616 <!--<script type="text/javascript" src="../jsScriptLoader.php?class=window.jQuery,mv_embed,remoteSearchDriver,$j.ui,$j.ui.resizable,$j.ui.draggable,$j.ui.dialog,$j.ui.tabs,$j.ui.sortable,$j.cookie,baseRemoteSearch&urid=1257728132531&debug=true&uselang=en"></script> -->
1717 <script type="text/javascript">
18 - js2AddOnloadHook(function(){
 18+ js2AddOnloadHook(function(){
1919 $j('#add_media_link').addMediaWiz( {
2020 'profile':'html_edit',
2121 'target_textbox': '#wpTextbox1',
Index: trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js
@@ -202,7 +202,7 @@
203203 };
204204 /*
205205 //to use once we get the wiki-text parser in shape
206 - var pObj = $mw.parser.pNew( rObj.desc );
 206+ var pObj = mw.parser.pNew( rObj.desc );
207207 //structured data on commons is based on the "information" template:
208208 var tmplInfo = pObj.templates( 'information' );
209209 */
Index: trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js
@@ -6,11 +6,11 @@
77 return this.init( iObj );
88 }
99 archiveOrgSearch.prototype = {
10 - //archive.org constants:
 10+ // Archive.org constants:
1111 dnUrl:'http://www.archive.org/download/',
1212 dtUrl:'http://www.archive.org/details/',
1313 init:function( iObj ){
14 - //init base class and inherit:
 14+ // Init base class and inherit:
1515 var baseSearch = new baseRemoteSearch( iObj );
1616 for(var i in baseSearch){
1717 if(typeof this[i] =='undefined'){
@@ -19,7 +19,7 @@
2020 this['parent_'+i] = baseSearch[i];
2121 }
2222 }
23 - //inherit the cp settings for
 23+ // Inherit the cp settings for
2424 },
2525 getSearchResults:function(){
2626 //call parent:
Index: trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/flickrSearch.js
@@ -80,8 +80,8 @@
8181 var resource = data.photos.photo[resource_id];
8282
8383 var rObj = {
84 - 'titleKey' : resource.title + '.jpg',
85 - 'resourceKey': resource.id,
 84+ 'titleKey' : resource.title + '.jpg',
 85+ 'resourceKey': resource.id,
8686 'link' : _this.dtUrl + resource.pathalias + '/'+ resource.id,
8787 'title' : resource.title,
8888 'thumbwidth' : resource.width_t,
Index: trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js
@@ -449,8 +449,10 @@
450450 break;
451451 }
452452
453 - if(typestr=='unk')
 453+ if(typestr=='unk'){
454454 js_log("unkown ftype: " + mimetype );
 455+ return '';
 456+ }
455457
456458 return '<div class="rsd_file_type ui-corner-all ui-state-default ui-widget-content" title="' + gM('mwe-ftype-' + typestr) + '">' +
457459 typestr +
@@ -1789,7 +1791,7 @@
17901792 //@@todo we should instead support the wiki number format template system instead of inline calls
17911793 if( cp.sObj.num_results != 0 ){
17921794 if( cp.sObj.num_results > cp.limit){
1793 - out+= gM( 'rsd_results_desc_total', [(cp.offset+1), to_num, $mw.lang.formatNumber( cp.sObj.num_results )] );
 1795+ out+= gM( 'rsd_results_desc_total', [(cp.offset+1), to_num, mw.lang.formatNumber( cp.sObj.num_results )] );
17941796 }else{
17951797 out+= gM( 'rsd_results_desc', [(cp.offset+1), to_num] );
17961798 }
Index: trunk/phase3/js2/mwEmbed/tests/testLang.js
@@ -7,9 +7,9 @@
88 "mwe-upload-multi" : "Upload {{PLURAL:$1|file|files}}"
99 });
1010
11 -$mw.lang.loadRS({
 11+mw.lang.loadRS({
1212 'PLURAL' : { "one" : 1 }
1313 });
1414
1515 //define a class by the name of this file:
16 -$mw.testLang = {};
\ No newline at end of file
 16+mw.testLang = {};
\ No newline at end of file
Index: trunk/phase3/js2/mwEmbed/libMwApi/mw.proxy.js
@@ -246,4 +246,4 @@
247247 }
248248 }
249249
250 -})(window.$mw);
 250+})(window.mw);
Index: trunk/phase3/js2/mwEmbed/skins/kskin/kskin.js
@@ -4,7 +4,7 @@
55
66 var kskinConfig = {
77 pClass: 'k-player',
8 - //display time progres
 8+ //display time progress
99 long_time_disp: false,
1010 body_options: false,
1111 volume_layout: 'horizontal',
@@ -38,11 +38,11 @@
3939 '<a href="#" title="' + gM( 'mwe-' + mk ) +'">' + gM( 'mwe-' + mk ) +'</a></li>';
4040 }
4141 o+='</ul>' +
42 - //we have to substract the width of the k-menu-bar
 42+ // We have to subtract the width of the k-menu-bar
4343 '<div class="k-menu-screens" style="width:' + ( embedObj.playerPixelWidth() -75) +
4444 'px; height:' + (embedObj.playerPixelHeight() - ctrlBuilder.height) + 'px;">';
4545
46 - //output menu item containers:
 46+ // Output menu item containers:
4747 for(i=0; i < ctrlObj.menu_items.length; i++){
4848 o+= '<div class="menu-screen menu-' + ctrlObj.menu_items[i] + '"></div>';
4949 }
@@ -57,46 +57,49 @@
5858 var _this = this;
5959 var $tp=$j('#' + embedObj.id);
6060
61 - //adds options and bindings: (we do this onClick for faster vidoe tag startup times)
 61+ // Adds options and bindings: (we do this onClick )
6262 var addMvOptions = function(){
63 - if($j('#' + embedObj.id + ' .k-menu').length != 0 )
 63+ if( $j('#' + embedObj.id + ' .k-menu').length != 0 )
6464 return false;
6565
66 - $j('#' + embedObj.id + ' .' + _this.pClass).prepend( _this.components['mv_embedded_options'].o( $tp.get(0).ctrlBuilder ));
 66+ $j('#' + embedObj.id + ' .' + _this.pClass).prepend(
 67+ _this.components['mv_embedded_options'].o( $tp.get(0).ctrlBuilder )
 68+ );
6769
68 - //by default its hidden:
 70+ // By default its hidden:
6971 $tp.find('.k-menu').hide();
7072
71 - //output menu-items:
 73+ // Output menu-items:
7274 for(i=0; i < _this.menu_items.length ; i++){
7375 $tp.find('.k-' + _this.menu_items[i] + '-btn').click(function(){
7476 var mk = $j(this).attr('rel');
7577 $target = $j('#' + embedObj.id + ' .menu-'+mk).hide();
76 - //gennerate the menu html not already done:
 78+ // Generate the menu html not already done:
7779 if( $target.children().length == 0 ){
7880 //call the function show{Menuitem} with target:
7981 embedObj['show' + mk.charAt(0).toUpperCase() + mk.substring(1)](
8082 $j('#' + embedObj.id + ' .menu-'+mk)
8183 );
8284 }
83 - //slide out the others
 85+ // Slide out the others
8486 $j('#' + embedObj.id + ' .menu-screen').hide();
8587 $target.fadeIn("fast");
8688 //don't follow the # link
8789 return false;
8890 });
8991 }
90 - }
91 - //options menu display:
 92+ }
 93+
 94+ // Options menu display:
9295 $tp.find('.k-options').click(function(){
9396 if($j('#' + embedObj.id + ' .k-menu').length == 0 ){
9497 //stop the player if it does not support overlays:
9598 if(!embedObj.supports['overlays'])
9699 $tp.get(0).stop();
97 - //add the options
 100+ // Add the options
98101 addMvOptions();
99102 }
100 - //set up the text and menu:
 103+ // Set up the text and menu:
101104 var $ktxt = $j(this);
102105 var $kmenu = $tp.find('.k-menu');
103106 if( $kmenu.is(':visible') ){
Index: trunk/phase3/js2/mwEmbed/skins/ctrlBuilder.js
@@ -180,7 +180,7 @@
181181 start: function(event, ui){
182182 var id = (embedObj.pc!=null)?embedObj.pc.pp.id:embedObj.id;
183183 embedObj.userSlide=true;
184 - $j(id + ' .play-btn-large').fadeOut('fast');
 184+ $j( id + ' .play-btn-large').fadeOut('fast');
185185 //if playlist always start at 0
186186 embedObj.start_time_sec = (embedObj.instanceOf == 'mvPlayList')?0:
187187 npt2seconds(embedObj.getTimeReq().split('/')[0]);
@@ -201,7 +201,7 @@
202202 },
203203 change:function(event, ui){
204204 //only run the onChange event if done by a user slide:
205 - if(embedObj.userSlide){
 205+ if( embedObj.userSlide ){
206206 embedObj.userSlide=false;
207207 embedObj.seeking=true;
208208 //stop the monitor timer (if we can)
@@ -220,7 +220,7 @@
221221 //up the z-index of the default status indicator:
222222 $tp.find('.play_head .ui-slider-handle').css('z-index', 4);
223223 $tp.find('.play_head .ui-slider-range').addClass('ui-corner-all').css('z-index', 2);
224 - //extended class list for jQuery ui themeing (we can probably refactor this with custom buffering highliter)
 224+ //extended class list for jQuery ui themeing (we can probably refactor this with custom buffering highlighter)
225225 $tp.find('.play_head').append( this.getMvBufferHtml() );
226226
227227 $opt = $j('#mv_vid_options_'+embedObj.id);
Index: trunk/phase3/js2/mwEmbed/skins/mvpcf/styles.css
@@ -560,7 +560,7 @@
561561 font-size:20px;
562562 margin:4px 0px 4px 11px;
563563 padding:0;
564 - color:#F0F0F0;
 564+ color:#FFF;
565565 font-family:arial,sans-serif;
566566 }
567567
Index: trunk/phase3/js2/mwEmbed/mv_embed.js
@@ -41,6 +41,7 @@
4242 return false;
4343 }
4444 }
 45+
4546 if( typeof mvCssPaths == 'undefined' )
4647 mvCssPaths = {};
4748
@@ -76,9 +77,9 @@
7778 "$j.Jcrop" : "libClipEdit/Jcrop/js/jquery.Jcrop.js",
7879 "$j.fn.simpleUploadForm" : "libAddMedia/simpleUploadForm.js",
7980
80 - "$mw.proxy" : "libMwApi/mw.proxy.js",
 81+ "mw.proxy" : "libMwApi/mw.proxy.js",
8182
82 - "$mw.testLang" : "tests/testLang.js",
 83+ "mw.testLang" : "tests/testLang.js",
8384
8485 "ctrlBuilder" : "skins/ctrlBuilder.js",
8586 "kskinConfig" : "skins/kskin/kskin.js",
@@ -191,19 +192,19 @@
192193 // For use when mv_embed with script-loader is in the root MediaWiki path
193194 var mediaWiki_mvEmbed_path = 'js2/mwEmbed/';
194195
195 -//The global scope: will be depreciated once we get everything into $mw
 196+//The global scope: will be depreciated once we get everything into mw
196197 var _global = this;
197198
198199 /*
199 -* setup the empty global $mw object
 200+* setup the empty global mw object
200201 * will ensure all our functions and variables are properly namespaced
201202 * reducing chance of conflicts
202203 */
203 -if(!window['$mw']){
204 - window['$mw'] = {}
 204+if(!window['mw']){
 205+ window['mw'] = {}
205206 }
206207
207 -//@@todo move these into $mw
 208+//@@todo move these into mw
208209 var global_req_cb = new Array(); // The global request callback array
209210
210211 // Get the mv_embed location if it has not been set
@@ -211,10 +212,10 @@
212213 var mv_embed_path = getMvEmbedPath();
213214 }
214215 /**
215 -* The global $mw object:
 216+* The global mw object:
216217 *
217218 * Any global functions/classes that are not jQuery plugins should make
218 -* there way into the $mw namespace
 219+* there way into the mw namespace
219220 */
220221 (function( $ ) {
221222 /*
@@ -230,6 +231,10 @@
231232 // the version of mwEmbed
232233 $.version = '1.0r21';
233234
 235+ //special case of commons api url
 236+ //(used for default subtitles server for media with a "wikiTitleKey" atm)
 237+ //(@@todo eventually we should have wikiTitleKey be namespaced with interwiki ns
 238+ $.commons_api_url = 'http://commons.wikimedia.org/w/api.php';
234239 /*
235240 * some global containers flags
236241 */
@@ -240,7 +245,7 @@
241246 $.req_cb = new Array() // The global request callback array
242247
243248 /*
244 - * Language classes $mw.lang
 249+ * Language classes mw.lang
245250 *
246251 * Localized Language support attempts to mirror the functionality of Language.php in MediaWiki
247252 * It contains methods for loading and transforming msg text
@@ -602,9 +607,9 @@
603608
604609 // ~ probably a better algorithm out there / should mirror php parser flow ~
605610 // (we are already running white-space issues ie php parse strips whitespace differently)
 611+ // or at least expose something similar to: http://www.mediawiki.org/wiki/Extension:Page_Object_Model
606612
607613 // ... but I am having fun with recursion so here it is...
608 - // or at least mirror: http://www.mediawiki.org/wiki/Extension:Page_Object_Model
609614 function rdpp ( txt , cn){
610615 var node = {};
611616 //inspect each char
@@ -649,8 +654,7 @@
650655 tObj["name"] = tname.split(':').shift();
651656 tObj["arg"] = tname.split(':').pop();
652657 }
653 -
654 - //js_log("TNAME::" + tObj["name"] + ' from:: ' + ts);
 658+
655659 var pSet = ts.split('\|');
656660 pSet.splice(0,1);
657661 if( pSet.length ){
@@ -780,21 +784,31 @@
781785 //return the parserObj
782786 return new parseObj( wikiText, opt) ;
783787 }
784 -
785 -})(window.$mw);
 788+
 789+ /*
 790+ * API and request functions
 791+ */
 792+ $.getLocalApiUrl = function() {
 793+ if ( typeof wgServer != 'undefined' && typeof wgScriptPath != 'undefined') {
 794+ return wgServer + wgScriptPath + '/api.php';
 795+ }
 796+ return false;
 797+ }
 798+
 799+})(window.mw);
786800
787801 //load in js2 stopgap into proper location:
788802 if( typeof gMsg != 'undefined'){
789 - $mw.lang.loadGM( gMsg )
 803+ mw.lang.loadGM( gMsg )
790804 }
791805
792806 //setup legacy global shortcuts:
793 -var loadGM = $mw.lang.loadGM;
794 -var loadRS = $mw.lang.loadRS;
795 -var gM = $mw.lang.gM;
 807+var loadGM = mw.lang.loadGM;
 808+var loadRS = mw.lang.loadRS;
 809+var gM = mw.lang.gM;
796810
797811 // All default messages in [English] should be overwritten by the CMS language message system.
798 -$mw.lang.loadGM({
 812+mw.lang.loadGM({
799813 "mwe-loading_txt" : "Loading ...",
800814 "mwe-size-gigabytes" : "$1 GB",
801815 "mwe-size-megabytes" : "$1 MB",
@@ -1008,13 +1022,13 @@
10091023 * checks for jQuery and adds the $j noConflict var
10101024 */
10111025 jQueryCheck: function( callback ) {
1012 - //js_log( 'jQueryCheck::' );
 1026+ //js_log( 'jQueryCheck::' + this.jQuerySetupFlag);
10131027 var _this = this;
10141028 // Skip stuff if $j is already loaded:
10151029 if( _global['$j'] ){
10161030 callback(); //call the callback now
10171031 callback=null;
1018 - // Check if we have jquery-ui css loaded and assigned skin globals
 1032+ // This is tricky because js2stopgap registers $j without doing the "setup"
10191033 if( _this.jQuerySetupFlag )
10201034 return ;
10211035 }
@@ -1031,13 +1045,13 @@
10321046 // Setup our global settings using the (jQuery helper)
10331047
10341048 // Set up the skin path
1035 - _global['mv_jquery_skin_path'] = mv_embed_path + 'jquery/jquery.ui/themes/' + $mw.conf['jui_skin'] + '/';
1036 - _global['mv_skin_img_path'] = mv_embed_path + 'skins/' + $mw.conf['skin_name'] + '/images/';
 1049+ _global['mv_jquery_skin_path'] = mv_embed_path + 'jquery/jquery.ui/themes/' + mw.conf['jui_skin'] + '/';
 1050+ _global['mv_skin_img_path'] = mv_embed_path + 'skins/' + mw.conf['skin_name'] + '/images/';
10371051 _global['mv_default_thumb_url'] = mv_skin_img_path + 'vid_default_thumb.jpg';
10381052
10391053 // Make sure the skin/style sheets are always available:
10401054 loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
1041 - loadExternalCss( mv_embed_path + 'skins/' + $mw.conf['skin_name'] + '/styles.css' );
 1055+ loadExternalCss( mv_embed_path + 'skins/' + mw.conf['skin_name'] + '/styles.css' );
10421056
10431057 // Set up AJAX to not send dynamic URLs for loading scripts (we control that with
10441058 // the scriptLoader)
@@ -1050,6 +1064,7 @@
10511065 mv_jqueryBindings();
10521066 _this.jQuerySetupFlag = true;
10531067
 1068+ //js_log('should run callback: ' + callback);
10541069 // Run the callback if not already run above
10551070 if( callback ) {
10561071 callback();
@@ -1078,9 +1093,9 @@
10791094 ];
10801095
10811096 //add any requested skins (supports multiple skins per single page)
1082 - if( $mw.skin_list ){
1083 - for(var i in $mw.skin_list ){
1084 - depReq[0].push( $mw.skin_list[i] + 'Config' );
 1097+ if( mw.skin_list ){
 1098+ for(var i in mw.skin_list ){
 1099+ depReq[0].push( mw.skin_list[i] + 'Config' );
10851100 }
10861101 }
10871102
@@ -1124,8 +1139,8 @@
11251140 function mwLoad( loadSet, callback ) {
11261141 mvJsLoader.doLoad( loadSet, callback );
11271142 }
1128 -//$mw.shortcut
1129 -$mw.load = mwLoad;
 1143+//mw.shortcut
 1144+mw.load = mwLoad;
11301145
11311146 // Load an external JS file. Similar to jquery .require plugin,
11321147 // but checks for object availability rather than load state.
@@ -1139,11 +1154,11 @@
11401155 * $j(document).ready( function(){ */
11411156 function mwdomReady( force ) {
11421157 js_log( 'f:mwdomReady:' );
1143 - if( !force && $mw.init_done ) {
 1158+ if( !force && mw.init_done ) {
11441159 js_log( "mw done, do nothing..." );
11451160 return false;
11461161 }
1147 - $mw.init_done = true;
 1162+ mw.init_done = true;
11481163 // Handle the execution of queued functions with jQuery "ready"
11491164
11501165 // Check if this page has a video, audio or playlist tag
@@ -1159,9 +1174,9 @@
11601175 if(e[j][k] && typeof( e[j][k]) == 'object'){
11611176 var sn = e[j][k].getAttribute('class');
11621177 if( sn && sn != ''){
1163 - for(var n=0;n< $mw.valid_skins.length;n++){
1164 - if( sn.indexOf($mw.valid_skins[n]) !== -1){
1165 - $mw.skin_list.push( $mw.valid_skins[n] );
 1178+ for(var n=0;n< mw.valid_skins.length;n++){
 1179+ if( sn.indexOf(mw.valid_skins[n]) !== -1){
 1180+ mw.skin_list.push( mw.valid_skins[n] );
11661181 }
11671182 }
11681183 }
@@ -1183,15 +1198,14 @@
11841199 //js2AddOnloadHook: ensure jQuery and the DOM are ready
11851200 function js2AddOnloadHook( func ) {
11861201 //js_log('js2AddOnloadHook:: jquery:' +func);
1187 - //check for jQuery then add the load event (to run after video tag rewrites (if present)
1188 - mvJsLoader.jQueryCheck( function() {
1189 - if( mvJsLoader.doneReadyEvents ) {
1190 - //js_log('run queued event: ' + func);
1191 - func();
1192 - } else {
1193 - mvJsLoader.addLoadEvent( func );
1194 - }
1195 - });
 1202+ // If we are ready run directly else add load event:
 1203+ if( mvJsLoader.doneReadyEvents ) {
 1204+ js_log('run queued event: ' + func);
 1205+ func();
 1206+ } else {
 1207+ js_log('add to load event: ' + func);
 1208+ mvJsLoader.addLoadEvent( func );
 1209+ }
11961210 }
11971211 // Deprecated mwAddOnloadHook in favour of js2 naming (for clear separation of js2 code from old MW code
11981212 var mwAddOnloadHook = js2AddOnloadHook;
@@ -1244,7 +1258,7 @@
12451259 if( this.selector ){
12461260 var _this = this;
12471261 //load the dragger and "setup"
1248 - $mw.load( ['$j.fn.dragDropFile'], function(){
 1262+ mw.load( ['$j.fn.dragDropFile'], function(){
12491263 $j(_this.selector).dragDropFile();
12501264 });
12511265 }
@@ -1257,18 +1271,18 @@
12581272 $.apiProxy = function( mode, pConf, callback ){
12591273 js_log('do apiProxy setup');
12601274 mvJsLoader.doLoad( [
1261 - '$mw.proxy',
 1275+ 'mw.proxy',
12621276 'JSON'
12631277 ], function(){
12641278 //do the proxy setup or
12651279 if( mode == 'client'){
12661280 //just do the setup (no callbcak for client setup)
1267 - $mw.proxy.client( pConf );
 1281+ mw.proxy.client( pConf );
12681282 if( callback )
12691283 callback();
12701284 }else if( mode=='server' ){
12711285 //do the request with the callback
1272 - $mw.proxy.server( pConf , callback );
 1286+ mw.proxy.server( pConf , callback );
12731287 }
12741288 });
12751289 }
@@ -1306,7 +1320,7 @@
13071321
13081322 // Load the mv_embed_base skin:
13091323 loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
1310 - loadExternalCss( mv_embed_path + 'skins/' + $mw.conf['skin_name'] + '/styles.css' );
 1324+ loadExternalCss( mv_embed_path + 'skins/' + mw.conf['skin_name'] + '/styles.css' );
13111325 // Load all the required libs:
13121326 mvJsLoader.jQueryCheck( function() {
13131327 // Load with staged dependencies (for IE that does not execute in order)
@@ -1340,7 +1354,7 @@
13411355 iObj['target_sequence_container'] = this.selector;
13421356 // Issue a request to get the CSS file (if not already included):
13431357 loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
1344 - loadExternalCss( mv_embed_path + 'skins/' + $mw.conf['skin_name'] + '/mv_sequence.css' );
 1358+ loadExternalCss( mv_embed_path + 'skins/' + mw.conf['skin_name'] + '/mv_sequence.css' );
13451359 // Make sure we have the required mv_embed libs (they are not loaded when no video
13461360 // element is on the page)
13471361 mvJsLoader.embedVideoCheck( function() {
@@ -1386,7 +1400,7 @@
13871401 iObj = {};
13881402 // Add the base theme CSS:
13891403 loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
1390 - loadExternalCss( mv_embed_path + 'skins/' + $mw.conf['skin_name'] + '/styles.css' );
 1404+ loadExternalCss( mv_embed_path + 'skins/' + mw.conf['skin_name'] + '/styles.css' );
13911405
13921406 // Check if we already have Firefogg loaded (the call just updates the element's
13931407 // properties)
@@ -1594,9 +1608,9 @@
15951609 }
15961610
15971611 $.mwProxy = function( apiConf ){
1598 - mvJsLoader.doLoad( ['$mw.apiProxy'],
 1612+ mvJsLoader.doLoad( ['mw.apiProxy'],
15991613 function(){
1600 - $mw.apiProxy( apiConf );
 1614+ mw.apiProxy( apiConf );
16011615 });
16021616 }
16031617 })(jQuery);
@@ -1729,10 +1743,10 @@
17301744 }
17311745 // Generate the URL if it's missing
17321746 if( typeof options.url == 'undefined' || !options.url ) {
1733 - if( !wgServer || ! wgScriptPath ) {
 1747+ if( typeof wgServer == 'undefined' ) {
17341748 return js_error('Error: no api url for api request');
17351749 }
1736 - options.url = mwGetLocalApiUrl();
 1750+ options.url = mw.getLocalApiUrl();
17371751 }
17381752 if( typeof options.data == 'undefined' )
17391753 options.data = {};
@@ -1745,10 +1759,10 @@
17461760 options.data['action'] = 'query';
17471761
17481762 // js_log('do api req: ' + options.url +'?' + jQuery.param(options.data) );
1749 - if( options.url == 'proxy' && $mw.proxy){
1750 - //assume the proxy is already "setup" since $mw.proxy is defined.
 1763+ if( options.url == 'proxy' && mw.proxy){
 1764+ //assume the proxy is already "setup" since mw.proxy is defined.
17511765 // @@todo we probably integrate that setup into the api call
1752 - $mw.proxy.doRequest( options.data, callback);
 1766+ mw.proxy.doRequest( options.data, callback);
17531767 }else if( parseUri( document.URL ).host == parseUri( options.url ).host ) {
17541768 // Local request: do API request directly
17551769 $j.ajax({
@@ -1777,18 +1791,12 @@
17781792 req_url += paramAnd + encodeURIComponent( i ) + '=' + encodeURIComponent( options.data[i] );
17791793 paramAnd = '&';
17801794 }
1781 - var fname = 'mycpfn_' + ( $mw.cb_count++ );
 1795+ var fname = 'mycpfn_' + ( mw.cb_count++ );
17821796 _global[ fname ] = callback;
17831797 req_url += '&' + options.jsonCB + '=' + fname;
17841798 loadExternalJs( req_url );
17851799 }
17861800 }
1787 -function mwGetLocalApiUrl( url ) {
1788 - if ( typeof wgServer != 'undefined' && typeof wgScriptPath != 'undefined') {
1789 - return wgServer + wgScriptPath + '/api.php';
1790 - }
1791 - return false;
1792 -}
17931801 // Do a "normal" request
17941802 function do_request( req_url, callback ) {
17951803 js_log( 'do_request::req_url:' + req_url + ' != ' + parseUri( req_url ).host );
@@ -1950,7 +1958,7 @@
19511959 req_param += 'urid=' + urid;
19521960 }else{
19531961 // Otherwise, just use the mv_embed version
1954 - req_param += 'urid=' + $mw.version;
 1962+ req_param += 'urid=' + mw.version;
19551963 }
19561964 //add the lang param:
19571965 var langKey = parseUri( mv_embed_url ).queryKey['uselang'];
@@ -2017,8 +2025,8 @@
20182026 */
20192027 function js_log( string ) {
20202028 // Add any prepend debug strings if necessary (used for cross browser)
2021 - if( $mw.conf['debug_pre'] )
2022 - string = $mw.conf['debug_pre']+ string;
 2029+ if( mw.conf['debug_pre'] )
 2030+ string = mw.conf['debug_pre']+ string;
20232031
20242032 if( window.console ) {
20252033 window.console.log( string );
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js
@@ -54,9 +54,6 @@
5555 "mwe-copy-code" : "Copy code"
5656 });
5757
58 -//set the globals:
59 -var commons_api_url = 'http://commons.wikimedia.org/w/api.php';
60 -
6158 var default_video_attributes = {
6259 "id" : null,
6360 "class" : null,
@@ -134,7 +131,7 @@
135132 mvEmbed.flist.push( swap_done_callback );
136133
137134 //get mv_embed location if it has not been set
138 - js_log('mv_video_embed:: ' + $mw.version);
 135+ js_log('mv_video_embed:: ' + mw.version);
139136
140137 var loadPlaylistLib=false;
141138
@@ -142,10 +139,10 @@
143140 js_log( "Do SWAP: " + $j(this_elm).attr("id") + ' tag: '+ this_elm.tagName.toLowerCase() );
144141
145142 if( $j(this_elm).attr("id") == '' ){
146 - $j(this_elm).attr("id", 'v'+ $mw.player_list.length);
 143+ $j(this_elm).attr("id", 'v'+ mw.player_list.length);
147144 }
148145 //store a global reference to the id
149 - $mw.player_list.push( $j(this_elm).attr("id") );
 146+ mw.player_list.push( $j(this_elm).attr("id") );
150147
151148 //if video doSwap
152149 switch( this_elm.tagName.toLowerCase()){
@@ -248,16 +245,16 @@
249246 $j('#'+embed_video.id).get(0).init_with_sources_loaded();
250247 }
251248
252 - js_log('done with child: ' + embed_video.id + ' len:' + $mw.player_list.length);
 249+ js_log('done with child: ' + embed_video.id + ' len:' + mw.player_list.length);
253250 return true;
254251 },
255252 //this should not be needed.
256253 checkClipsReady : function(){
257254 //js_log('checkClipsReady');
258255 var is_ready=true;
259 - for(var i=0; i < $mw.player_list.length; i++){
260 - if( $j('#'+$mw.player_list[i]).length !=0){
261 - var cur_vid = $j('#'+$mw.player_list[i]).get(0);
 256+ for(var i=0; i < mw.player_list.length; i++){
 257+ if( $j('#'+mw.player_list[i]).length !=0){
 258+ var cur_vid = $j('#'+mw.player_list[i]).get(0);
262259 is_ready = ( cur_vid.ready_to_play ) ? is_ready : false;
263260 if( !is_ready && cur_vid.load_error ){
264261 is_ready=true;
@@ -855,15 +852,15 @@
856853 //set the skin name from the class
857854 var sn = element.getAttribute('class');
858855 if( sn && sn != ''){
859 - for(var n=0;n< $mw.valid_skins.length;n++){
860 - if( sn.indexOf($mw.valid_skins[n]) !== -1){
861 - this.skin_name = $mw.valid_skins[n];
 856+ for(var n=0;n< mw.valid_skins.length;n++){
 857+ if( sn.indexOf(mw.valid_skins[n]) !== -1){
 858+ this.skin_name = mw.valid_skins[n];
862859 }
863860 }
864861 }
865862 //set the default if unset:
866863 if(!this.skin_name)
867 - this.skin_name = $mw.conf.skin_name;
 864+ this.skin_name = mw.conf.skin_name;
868865
869866 //make sure startOffset is cast as an int
870867 if( this.startOffset && this.startOffset.split(':').length >= 2)
@@ -878,7 +875,7 @@
879876 js_log("duration is: " + this.duration);
880877
881878 //get defaults
882 - var dwh = $mw.conf['video_size'].split('x');
 879+ var dwh = mw.conf['video_size'].split('x');
883880 this.width = element.style.width ? element.style.width : dwh[0];
884881 if( element.tagName == 'AUDIO' ){
885882 this.height = element.style.height ? element.style.height : 0;
@@ -1189,7 +1186,7 @@
11901187 };
11911188 do_api_req({
11921189 'data':reqObj,
1193 - 'url': commons_api_url
 1190+ 'url': mw.commons_api_url
11941191 }, function(data){
11951192 //empty the videos:
11961193 $j('#dc_'+ _this.id + ' .related_vids ul').html(' ');
@@ -2457,9 +2454,9 @@
24582455 }
24592456 if( selected_player )
24602457 {
2461 - for(var i=0; i < $mw.player_list.length; i++)
 2458+ for(var i=0; i < mw.player_list.length; i++)
24622459 {
2463 - var embed = $j('#'+$mw.player_list[i]).get(0);
 2460+ var embed = $j('#'+mw.player_list[i]).get(0);
24642461 if(embed.media_element.selected_source && (embed.media_element.selected_source.mime_type == mime_type))
24652462 {
24662463 embed.selectPlayer(selected_player);
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/nativeEmbed.js
@@ -157,13 +157,14 @@
158158 }
159159 },
160160 monitor : function(){
161 - this.getVID(); //make shure we have .vid obj
 161+ this.getVID(); //make sure we have .vid obj
162162 if(!this.vid){
163163 js_log('could not find video embed: '+this.id + ' stop monitor');
164164 this.stopMonitor();
165165 return false;
166166 }
167 - //don't update status if we are not the current clip (playlist leekage?) .. should move to playlist overwite of monitor?
 167+ //don't update status if we are not the current clip
 168+ //(playlist leakage?) .. should move to playlist overwrite of monitor?
168169 if(this.pc){
169170 if(this.pc.pp.cur_clip.id != this.pc.id)
170171 return true;
Index: trunk/phase3/js2/mwEmbed/libTimedText/mvTextInterface.js
@@ -27,15 +27,14 @@
2828 //init a new availableTracks obj:
2929 this.availableTracks = new Array();
3030 //set the parent embed object:
31 - this.pe=parentEmbed;
 31+ this.pe = parentEmbed;
3232 //parse roe if not already done:
33 - this.getTimedTextTracks();
 33+ this.getTextTracks();
3434 },
3535 //@@todo separate out data loader & data display
36 - getTimedTextTracks:function(){
 36+ getTextTracks:function(){
3737 //js_log("load timed text from roe: "+ this.pe.roe);
3838 var _this = this;
39 - var apiUrl = mwGetLocalApiUrl();
4039 //if roe not yet loaded do load it:
4140 if(this.pe.roe || _this.pe.wikiTitleKey ){
4241 if(!this.pe.media_element.addedROEData){
@@ -46,35 +45,9 @@
4746 _this.pe.media_element.addROE(data);
4847 _this.getParseTimedText_rowReady();
4948 });
50 - }else if( _this.pe.wikiTitleKey ){
 49+ }else if( _this.pe.wikiTitleKey ){
5150 //check for a clear namespace key:
52 - var timedtext_ns = 102;
53 - if( wgNamespaceIds && wgNamespaceIds['timedtext']){
54 - timedtext_ns = wgNamespaceIds['timedtext'];
55 - }
56 - do_api_req({
57 - 'url' : apiUrl,
58 - 'data': {
59 - 'list' : 'allpages',
60 - 'apprefix' : _this.pe.wikiTitleKey,
61 - 'apnamespace' : timedtext_ns,
62 - 'prop':'revisions'
63 - }
64 - }, function( subData ) {
65 - if( subData.error && subData.error.code == 'apunknown_apnamespace'){
66 - do_api_req({
67 - 'url' : apiUrl,
68 - 'data': {
69 - 'list' : 'allpages',
70 - 'apprefix' : 'TimedText:' + _this.pe.wikiTitleKey,
71 - }
72 - }, function( subData ) {
73 - _this.doProcSubPages( subData, wgServer + wgScriptPath);
74 - });
75 - }else{
76 - _this.doProcSubPages( subData, wgServer + wgScriptPath);
77 - }
78 - });
 51+ _this.getTextTracksWikiTitle()
7952 }
8053 }else{
8154 js_log('row data ready (no roe request)');
@@ -88,6 +61,38 @@
8962 }
9063 }
9164 },
 65+ getTextTracksWikiTitle:function(){
 66+ var apiUrl = mw.getLocalApiUrl();
 67+ var _this = this;
 68+
 69+ var timedtext_ns = 102;
 70+ if( typeof wgNamespaceIds != 'undefined' && wgNamespaceIds['timedtext']){
 71+ timedtext_ns = wgNamespaceIds['timedtext'];
 72+ }
 73+ do_api_req({
 74+ 'url' : apiUrl,
 75+ 'data': {
 76+ 'list' : 'allpages',
 77+ 'apprefix' : _this.pe.wikiTitleKey,
 78+ 'apnamespace' : timedtext_ns,
 79+ 'prop':'revisions'
 80+ }
 81+ }, function( subData ) {
 82+ if( subData.error && subData.error.code == 'apunknown_apnamespace'){
 83+ do_api_req({
 84+ 'url' : apiUrl,
 85+ 'data': {
 86+ 'list' : 'allpages',
 87+ 'apprefix' : 'TimedText:' + _this.pe.wikiTitleKey,
 88+ }
 89+ }, function( subData ) {
 90+ _this.doProcSubPages( subData, wgServer + wgScriptPath);
 91+ });
 92+ }else{
 93+ _this.doProcSubPages( subData, wgServer + wgScriptPath);
 94+ }
 95+ });
 96+ },
9297 doProcSubPages: function( subData, hostPath ){
9398 var _this = this;
9499 //look for text tracks:
@@ -159,7 +164,7 @@
160165 js_log('image is shared checking commons for subtitles');
161166 //found shared repo assume commons:
162167 do_api_req({
163 - 'url': 'http://commons.wikimedia.org/w/api.php',
 168+ 'url': mw.commons_api_url,
164169 'data':{
165170 'list' : 'allpages',
166171 'apprefix' : _this.pe.wikiTitleKey,
Index: trunk/phase3/js2/apiProxyPage.js
@@ -8,7 +8,7 @@
99 * Since this is proxy server set a pre-append debug flag to know which debug msgs are coming from where
1010 */
1111
12 -$mw.conf['debug_pre'] = 'Proxy';
 12+mw.conf['debug_pre'] = 'Proxy';
1313
1414 if( !mwApiProxyConfig )
1515 var mwApiProxyConfig = {};
Index: trunk/phase3/js2/remoteMwEmbed.js
@@ -36,7 +36,7 @@
3737 if(wgPageName.indexOf("TimedText") === 0){
3838 load_mv_embed(function(){
3939 // Load with mw loader to get localized interface:
40 - $mw.load( ['mvTimeTextEdit'],function(){
 40+ mw.load( ['mvTimeTextEdit'],function(){
4141 //could run init here (but mvTimeTextEdit included onLoad actions)
4242 });
4343 });
@@ -184,7 +184,7 @@
185185 }
186186 function load_mv_embed( callback ) {
187187 // Inject mv_embed if needed
188 - if( typeof $mw == 'undefined' ) {
 188+ if( typeof mw == 'undefined' ) {
189189 if( ( mwReqParam['uselang'] || mwReqParam['useloader'] ) && mwUseScriptLoader){
190190 var rurl = mwEmbedHostPath + '/mwEmbed/jsScriptLoader.php?class=mv_embed';
191191 // Add jQuery too if we need it:
@@ -202,7 +202,7 @@
203203 }
204204
205205 function check_for_mv_embed( callback ) {
206 - if( typeof $mw == 'undefined' ) {
 206+ if( typeof mw == 'undefined' ) {
207207 setTimeout( function(){
208208 check_for_mv_embed( callback );
209209 }, 25 );

Status & tagging log