r59940 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59939‎ | r59940 | r59941 >
Date:00:28, 11 December 2009
Author:dale
Status:deferred
Tags:
Comment:
* added scriptloader support for "mw.load" system
* do_api_request -> mw.getJSON()
* js_log -> mw.log()
* comment updates
* fixes for dynamic includes of mwEmbed with calls to mw.addLoadHook
* fixed embedPlayer k-skin display of menu / credits
* remoteMwEmbed updates
Modified paths:
  • /branches/js2-work/phase3/js2/editPage.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/example_usage/Player_Themable.html (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/jsScriptLoader.php (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/dragDropFile.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvAdvFirefogg.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/flickrSearch.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libClipEdit/mvClipEdit.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/embedPlayer.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/flowplayerEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/htmlEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/javaEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/kplayerEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/nativeEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/omtkEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/vlcEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libMwApi/mw.proxy.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvFirefoggRender.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvPlayList.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvSequencer.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvTimedEffectsEdit.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libSequencer/seqRemoteSearchDriver.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libTimedText/mvTextInterface.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libTimedText/mvTimeTextEdit.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/mwEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/skins/ctrlBuilder.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/skins/kskin/kskin.js (deleted) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/skins/kskin/kskinConfig.js (added) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/skins/mvpcf/mvpcf.js (deleted) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/skins/mvpcf/mvpcfConfig.js (added) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/tests/testApiProxy.html (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/tests/testLang.html (modified) (history)
  • /branches/js2-work/phase3/js2/remoteMwEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js2/uploadPage.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js2/remoteMwEmbed.js
@@ -5,8 +5,8 @@
66
77 var urlparts = getRemoteEmbedPath();
88 var mwEmbedHostPath = urlparts[0];
9 -var mwRemoteVersion = '1.10';
10 -var mwUseScriptLoader = false;
 9+var mwRemoteVersion = '1.1b';
 10+var mwUseScriptLoader = true;
1111
1212 // setup up request Params:
1313 var reqParts = urlparts[1].substring( 1 ).split( '&' );
@@ -16,7 +16,8 @@
1717 if ( p.length == 2 )
1818 mwReqParam[ p[0] ] = p[1];
1919 }
20 -//use wikibits onLoad hook:
 20+
 21+// Use wikibits onLoad hook: ( since we don't have js2 / mw object loaded )
2122 addOnloadHook( function() {
2223 // Only do rewrites if mwEmbed / js2 is "off"
2324 if ( typeof mwEmbed_VERSION == 'undefined' ) {
@@ -31,14 +32,13 @@
3233 if ( wgAction == 'edit' || wgAction == 'submit' ) {
3334 var jsSetEdit =
3435 loadMwEmbed( [
35 - 'remoteSearchDriver',
36 - '$j.fn.textSelection',
37 - '$j.ui',
38 - '$j.ui.sortable'
39 - ], function() {
40 - loadExternalJs( mwEmbedHostPath + '/editPage.js?' + mwGetReqArgs() );
41 - }
42 - );
 36+ 'remoteSearchDriver',
 37+ '$j.fn.textSelection',
 38+ '$j.ui',
 39+ '$j.ui.sortable'
 40+ ], function() {
 41+ loadExternalJs( mwEmbedHostPath + '/editPage.js?' + mwGetReqArgs() );
 42+ } );
4343 }
4444
4545 // Timed text display:
@@ -52,7 +52,7 @@
5353 }
5454
5555 // Firefogg integration
56 - if ( wgPageName == "Special:Upload" ) {
 56+ if ( wgPageName == "Special:Upload" ) {
5757 loadMwEmbed([
5858 'mvBaseUploadInterface',
5959 'mvFirefogg',
@@ -82,7 +82,7 @@
8383 vidIdList.push( divs[i].getAttribute( "id" ) );
8484 }
8585 }
86 - if ( vidIdList.length > 0 ) {
 86+ if ( vidIdList.length > 0 ) {
8787 var jsSetVideo = [ 'embedPlayer', '$j.ui', 'ctrlBuilder', '$j.cookie', '$j.ui.slider', 'kskinConfig' ];
8888 // Quick sniff use java if IE and native if firefox
8989 // ( other browsers will run detect and get on-demand )
@@ -102,13 +102,12 @@
103103 }
104104 // This will be depreciated in favour of updates to OggHandler
105105 function rewrite_for_OggHandler( vidIdList ) {
106 - function procVidId( vidId ) {
107 -
 106+ function procVidId( vidId ) {
108107 // Don't process empty vids
109108 if ( !vidId )
110109 return ;
111110
112 - js_log( 'vidIdList on: ' + vidId + ' length: ' + vidIdList.length + ' left in the set: ' + vidIdList );
 111+ mw.log( 'vidIdList on: ' + vidId + ' length: ' + vidIdList.length + ' left in the set: ' + vidIdList );
113112
114113 tag_type = 'video';
115114
@@ -178,7 +177,7 @@
179178
180179 }
181180 };
182 - // process each item in the vidIdList (with setTimeout to avoid locking)
 181+ // process each item in the vidIdList (with setTimeout to avoid locking)
183182 procVidId( vidIdList.pop() );
184183 }
185184 function getRemoteEmbedPath() {
@@ -229,7 +228,7 @@
230229
231230 // Inject mwEmbed if needed
232231 if ( typeof mw == 'undefined' ) {
233 - if ( ( mwReqParam['uselang'] || mwReqParam['useloader'] ) && mwUseScriptLoader ) {
 232+ if ( ( mwReqParam['uselang'] || mwReqParam[ 'useloader' ] ) && mwUseScriptLoader ) {
234233 var rurl = mwEmbedHostPath + '/mwEmbed/jsScriptLoader.php?class=mwEmbed';
235234
236235 // Add jQuery too if we need it:
@@ -246,8 +245,7 @@
247246 }
248247
249248 // Add the remaining arguments
250 - rurl += '&' + mwGetReqArgs();
251 -
 249+ rurl += '&' + mwGetReqArgs();
252250 importScriptURI( rurl );
253251 } else {
254252 // Ingore classSet (will be loaded onDemand )
@@ -266,7 +264,7 @@
267265 }, 25 );
268266 } else {
269267 // Make sure mwEmbed is "setup" by using the addOnLoadHook:
270 - mw.addOnloadHook( function(){
 268+ mw.addOnloadHook( function(){
271269 callback();
272270 })
273271 }
@@ -290,4 +288,3 @@
291289 this.cur_path = cur_path;
292290 return true;
293291 };
294 -
Index: branches/js2-work/phase3/js2/uploadPage.js
@@ -91,7 +91,7 @@
9292 * Fill in a destination file-name based on a source asset name.
9393 */
9494 doDestinationFill: function( targetElm ) {
95 - js_log( "doDestinationFill" )
 95+ mw.log( "doDestinationFill" )
9696 // Remove any previously flagged errors
9797 $j( '#mw-upload-permitted,#mw-upload-prohibited' ).hide();
9898
Index: branches/js2-work/phase3/js2/editPage.js
@@ -21,7 +21,7 @@
2222 };
2323
2424 mw.addOnloadHook( function() {
25 - js_log( "edit page mw.addOnloadHook::" );
 25+ mw.log( "edit page mw.addOnloadHook::" );
2626 var amwConf = $j.extend( true, defaultAddMediaConfig, mwAddMediaConfig );
2727 // Kind of tricky, it would be nice to use run on ready "loader" call here
2828 var didWikiEditorBind = false;
@@ -39,7 +39,7 @@
4040 section.groups.insert.tools.file.action = {
4141 'type': 'callback',
4242 'execute': function() {
43 - js_log( 'click add media wiz' );
 43+ mw.log( 'click add media wiz' );
4444 $j.addMediaWiz( amwConf );
4545 }
4646 };
@@ -50,7 +50,7 @@
5151 // Add to old toolbar if wikiEditor did not remove '#toolbar' from the page:
5252 setTimeout( function() {
5353 if ( $j( '#btn-add-media-wiz' ).length == 0 && $j( '#toolbar' ).length != 0 ) {
54 - js_log( 'Do old toolbar bind:' );
 54+ mw.log( 'Do old toolbar bind:' );
5555 didWikiEditorBind = true;
5656 $j( '#toolbar' ).append( '<img style="cursor:pointer" id="btn-add-media-wiz" src="' +
5757 mw.getConfig( 'skin_img_path' ) + 'Button_add_media.png">' );
@@ -62,7 +62,7 @@
6363 } else {
6464 // Make sure the wikieditor got binded:
6565 if ( !didWikiEditorBind ) {
66 - js_log( 'Failed to bind via build section bind via target:' );
 66+ mw.log( 'Failed to bind via build section bind via target:' );
6767 $j( ".tool[rel='file']" ).unbind().addMediaWiz( amwConf );
6868 }
6969 }
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/nativeEmbed.js
@@ -41,7 +41,7 @@
4242 */
4343 getEmbedHTML : function () {
4444 var embed_code = this.getEmbedObj();
45 - js_log( "embed code: " + embed_code )
 45+ mw.log( "embed code: " + embed_code )
4646 setTimeout( '$j(\'#' + this.id + '\').get(0).postEmbedJS()', 150 );
4747 return this.wrapEmebedContainer( embed_code );
4848 },
@@ -53,7 +53,7 @@
5454 // We want to let mwEmbed handle the controls so notice the absence of control attribute
5555 // controls=false results in controls being displayed:
5656 // http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-August/016159.html
57 - js_log( "native play url:" + this.getSrc() + ' startOffset: ' + this.start_ntp + ' end: ' + this.end_ntp );
 57+ mw.log( "native play url:" + this.getSrc() + ' startOffset: ' + this.start_ntp + ' end: ' + this.end_ntp );
5858 var eb = '<video ' +
5959 'id="' + this.pid + '" ' +
6060 'style="width:' + this.width + 'px;height:' + this.height + 'px;" ' +
@@ -68,7 +68,7 @@
6969 */
7070 postEmbedJS:function() {
7171 var _this = this;
72 - js_log( "f:native:postEmbedJS:" );
 72+ mw.log( "f:native:postEmbedJS:" );
7373 this.getPlayerElement();
7474 if ( typeof this.playerElement != 'undefined' ) {
7575
@@ -98,10 +98,10 @@
9999
100100 } else {
101101 // False inserts don't seem to be as much of a problem as before:
102 - js_log( 'Could not grab vid obj trying again:' + typeof this.playerElement );
 102+ mw.log( 'Could not grab vid obj trying again:' + typeof this.playerElement );
103103 this.grab_try_count++;
104104 if ( this.grab_count == 20 ) {
105 - js_log( 'Could not get vid object after 20 tries re-run: getEmbedObj() ?' ) ;
 105+ mw.log( 'Could not get vid object after 20 tries re-run: getEmbedObj() ?' ) ;
106106 } else {
107107 setTimeout( function(){
108108 _this.postEmbedJS();
@@ -117,12 +117,12 @@
118118 * @param {Float} percentage
119119 */
120120 doSeek:function( percentage ) {
121 - js_log( 'native:seek:p: ' + percentage + ' : ' + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );
 121+ mw.log( 'native:seek:p: ' + percentage + ' : ' + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );
122122 // @@todo check if the clip is loaded here (if so we can do a local seek)
123123 if ( this.supportsURLTimeEncoding() ) {
124124 // Make sure we could not do a local seek instead:
125125 if ( percentage < this.bufferedPercent && this.playerElement.duration && !this.didSeekJump ) {
126 - js_log( "do local seek " + percentage + ' is already buffered < ' + this.bufferedPercent );
 126+ mw.log( "do local seek " + percentage + ' is already buffered < ' + this.bufferedPercent );
127127 this.doNativeSeek( percentage );
128128 } else {
129129 // We support URLTimeEncoding call parent seek:
@@ -141,7 +141,7 @@
142142 * Do a native seek by updating the currentTime
143143 */
144144 doNativeSeek:function( percentage ) {
145 - js_log( 'native::doNativeSeek::' + percentage );
 145+ mw.log( 'native::doNativeSeek::' + percentage );
146146 this.seek_time_sec = 0;
147147 this.playerElement.currentTime = percentage * this.duration;
148148 this.monitor();
@@ -155,7 +155,7 @@
156156 * @param {Float} percentage Percentage of the stream to seek to between 0 and 1
157157 */
158158 doPlayThenSeek:function( percentage ) {
159 - js_log( 'native::doPlayThenSeek::' );
 159+ mw.log( 'native::doPlayThenSeek::' );
160160 var _this = this;
161161 this.play();
162162 var rfsCount = 0;
@@ -171,7 +171,7 @@
172172 setTimeout( readyForSeek, 50 );
173173 rfsCount++;
174174 } else {
175 - js_log( 'error:doPlayThenSeek failed' );
 175+ mw.log( 'error:doPlayThenSeek failed' );
176176 }
177177 }
178178 }
@@ -183,7 +183,7 @@
184184 */
185185 setCurrentTime: function( position , callback ) {
186186 var _this = this;
187 - js_log( 'native:setCurrentTime::: ' + position + ' : dur: ' + _this.getDuration() );
 187+ mw.log( 'native:setCurrentTime::: ' + position + ' : dur: ' + _this.getDuration() );
188188 this.getPlayerElement();
189189 if ( !this.playerElement ) {
190190 this.load( function() {
@@ -203,7 +203,7 @@
204204 var _this = this;
205205 this.getPlayerElement();
206206 var once = function( event ) {
207 - js_log("did seek callback");
 207+ mw.log("did seek callback");
208208 callback();
209209 _this.playerElement.removeEventListener( 'seeked', once, false );
210210 };
@@ -218,7 +218,7 @@
219219 monitor: function() {
220220 this.getPlayerElement(); // make sure we have .vid obj
221221 if ( !this.playerElement ) {
222 - js_log( 'could not find video embed: ' + this.id + ' stop monitor' );
 222+ mw.log( 'could not find video embed: ' + this.id + ' stop monitor' );
223223 this.stopMonitor();
224224 return false;
225225 }
@@ -239,8 +239,7 @@
240240 // update currentTime
241241 this.currentTime = this.playerElement.currentTime;
242242
243 - // js_log('currentTime:' + this.currentTime);
244 - // js_log('this.currentTime: ' + this.currentTime );
 243+ //mw.log('currentTime:' + this.currentTime);
245244 // once currentTime is updated call parent_monitor
246245 this.parent_monitor();
247246 },
@@ -334,7 +333,7 @@
335334 this.getPlayerElement();
336335 if ( !this.playerElement ) {
337336 // No vid loaded
338 - js_log( 'native::load() ... doEmbed' );
 337+ mw.log( 'native::load() ... doEmbed' );
339338 this.onlyLoadFlag = true;
340339 this.doEmbedHTML();
341340 this.onLoadedCallback = callback;
@@ -362,7 +361,7 @@
363362 * fired when "seeking"
364363 */
365364 onseeking:function() {
366 - js_log( "onseeking" );
 365+ mw.log( "onseeking" );
367366 this.seeking = true;
368367 this.setStatus( gM( 'mwe-seeking' ) );
369368 },
@@ -372,7 +371,7 @@
373372 * fired when done seeking
374373 */
375374 onseeked: function() {
376 - js_log("onseeked");
 375+ mw.log("onseeked");
377376 this.seeking = false;
378377 },
379378
@@ -381,7 +380,7 @@
382381 * fired when done video can play through without re-buffering
383382 */
384383 oncanplaythrough : function() {
385 - js_log('f:oncanplaythrough');
 384+ mw.log('f:oncanplaythrough');
386385 this.getPlayerElement();
387386 if ( ! this.paused )
388387 this.playerElement.play();
@@ -396,10 +395,10 @@
397396 */
398397 onloadedmetadata: function() {
399398 this.getPlayerElement();
400 - js_log( 'f:onloadedmetadata metadata ready (update duration)' );
 399+ mw.log( 'f:onloadedmetadata metadata ready (update duration)' );
401400 // update duration if not set (for now trust the getDuration more than this.playerElement.duration
402401 if ( this.getDuration() == 0 && ! isNaN( this.playerElement.duration ) ) {
403 - js_log( 'updaed duration via native video duration: ' + this.playerElement.duration )
 402+ mw.log( 'updaed duration via native video duration: ' + this.playerElement.duration )
404403 this.duration = this.playerElement.duration;
405404 }
406405
@@ -428,10 +427,10 @@
429428 onended: function() {
430429 var _this = this
431430 this.getPlayerElement();
432 - js_log( 'native:onended:' + this.playerElement.currentTime + ' real dur:' + this.getDuration() );
 431+ mw.log( 'native:onended:' + this.playerElement.currentTime + ' real dur:' + this.getDuration() );
433432 // if we just started (under 1 second played) & duration is much longer.. don't run onClipDone just yet . (bug in firefox native sending onended event early)
434433 if ( this.playerElement.currentTime < 1 && this.getDuration() > 1 && this.grab_try_count < 5 ) {
435 - js_log( 'native on ended called with time:' + this.playerElement.currentTime + ' of total real dur: ' + this.getDuration() + ' attempting to reload src...' );
 434+ mw.log( 'native on ended called with time:' + this.playerElement.currentTime + ' of total real dur: ' + this.getDuration() + ' attempting to reload src...' );
436435 var doRetry = function() {
437436 _this.urlAppend = 'retry_src=' + _this.grab_try_count;
438437 _this.doEmbedHTML();
@@ -439,7 +438,7 @@
440439 }
441440 setTimeout( doRetry, 100 );
442441 } else {
443 - js_log( 'native onClipDone done call' );
 442+ mw.log( 'native onClipDone done call' );
444443 this.onClipDone();
445444 }
446445 }
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/kplayerEmbed.js
@@ -27,7 +27,7 @@
2828 setTimeout(function(){
2929 _this.postEmbedJS();
3030 }, 50);
31 - js_log( "return embed html" );
 31+ mw.log( "return embed html" );
3232 return this.wrapEmebedContainer( embed_code );
3333 },
3434
@@ -76,7 +76,7 @@
7777
7878 // KDP player likes an absolute url for the src:
7979 var src = mw.absoluteUrl( _this.getSrc() );
80 - js_log('play src: ' + src);
 80+ mw.log('play src: ' + src);
8181
8282 // Insert the src:
8383 this.playerElement.insertMedia( "-1", src, 'true' );
@@ -85,7 +85,7 @@
8686 // Start the monitor
8787 this.monitor();
8888 }else{
89 - js_log('insert media: not defiend' + typeof this.playerElement.insertMedia );
 89+ mw.log('insert media: not defiend' + typeof this.playerElement.insertMedia );
9090 setTimeout( function(){
9191 _this.postEmbedJS();
9292 }, 25);
@@ -180,5 +180,5 @@
181181 * NOTE: playerID is not always passed so we can't use this:
182182 */
183183 function onKdpReady( playerId ) {
184 - js_log( "player is ready::" + playerId);
 184+ mw.log( "player is ready::" + playerId);
185185 }
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/omtkEmbed.js
@@ -34,7 +34,7 @@
3535 getEmbedObj:function() {
3636 var player_path = mw.getMwEmbedPath() + 'libEmbedPlayer/binPlayers/omtk-fx/omtkp.swf';
3737 // player_path = 'omtkp.swf';
38 - js_log( "player path: " + player_path );
 38+ mw.log( "player path: " + player_path );
3939 return '<object id="' + this.pid + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1" height="1">' +
4040 '<param name="movie" value="' + player_path + '" />' + "\n" +
4141 '<!--[if !IE]>-->' + "\n" +
@@ -53,7 +53,7 @@
5454 postEmbedJS:function() {
5555 this.getPlayerElement();
5656 // play the url:
57 - js_log( "play: pid:" + this.pid + ' src:' + this.src );
 57+ mw.log( "play: pid:" + this.pid + ' src:' + this.src );
5858
5959 this.playerElement.play( this.src );
6060
@@ -88,15 +88,15 @@
8989 this.playerElement = $j( '#' + this.pid + '_ie' ).get( 0 );
9090
9191 if ( this.playerElement.play ) {
92 - // js_log('omtk obj is missing .play (probably not omtk obj)');
 92+ // mw.log('omtk obj is missing .play (probably not omtk obj)');
9393 }
9494 },
9595 }
9696 // Some auto-called globals (bad)
9797 function OMTK_P_complete() {
98 - js_log( 'OMTK_P_complete' );
 98+ mw.log( 'OMTK_P_complete' );
9999 }
100100
101101 function OMTK_P_metadataUpdate() {
102 - js_log( 'OMTK_P_metadataUpdate' );
 102+ mw.log( 'OMTK_P_metadataUpdate' );
103103 }
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/embedPlayer.js
@@ -217,6 +217,17 @@
218218 */
219219 ( function( $ ) {
220220
 221+ /*
 222+ * embeds all players that match the rewrite player tags config
 223+ * Passes off request to the embedPlayer selector:
 224+ *
 225+ * @param {Object} attributes Attributes to apply to embed players
 226+ * @param {Function} callback Function to call once embeding is done
 227+ */
 228+ $.embedPlayers = function( attributes, callback){
 229+ $j( mw.getConfig( 'rewritePlayerTags' ) ).embedPlayer( attributes, callbcak );
 230+ }
 231+
221232 /**
222233 * Selector based embedPlayer jQuery binding
223234 *
@@ -332,7 +343,7 @@
333344 }
334345 var element_id = $j( element ).attr( "id" );
335346
336 - js_log( "mvEmbed::rewrite:: " + $j( element ).attr( "id" ) + ' tag: ' + element.tagName.toLowerCase() );
 347+ mw.log( "mvEmbed::rewrite:: " + $j( element ).attr( "id" ) + ' tag: ' + element.tagName.toLowerCase() );
337348
338349 // Add the element id to playerList
339350 this.playerList.push( $j( element ).attr( "id" ) );
@@ -448,7 +459,7 @@
449460 */
450461 waitPlayersReadyCallback : function() {
451462 var _this = this;
452 - // js_log('checkClipsReady');
 463+ // mw.log('checkClipsReady');
453464 var is_ready = true;
454465 for ( var i = 0; i < this.playerList.length; i++ ) {
455466 if ( $j( '#' + this.playerList[i] ).length != 0 ) {
@@ -504,7 +515,7 @@
505516 URLTimeEncoding:false,
506517
507518 // Start offset of the requested segment
508 - startOffset:null,
 519+ startOffset: 0,
509520
510521 // Duration of the requested segment (0 if not known)
511522 duration:0,
@@ -525,7 +536,7 @@
526537 * MediaSource constructor:
527538 */
528539 init : function( element ) {
529 - // js_log('adding mediaSource: ' + element);
 540+ // mw.log('adding mediaSource: ' + element);
530541 this.src = $j( element ).attr( 'src' );
531542 this.marked_default = false;
532543 if ( element.tagName.toLowerCase() == 'video' )
@@ -572,8 +583,8 @@
573584 * @param {String} end_time: in NPT format
574585 */
575586 updateSrcTime:function ( start_npt, end_npt ) {
576 - // js_log("f:updateSrcTime: "+ start_npt+'/'+ end_npt + ' from org: ' + this.start_npt+ '/'+this.end_npt);
577 - // js_log("pre uri:" + this.src);
 587+ // mw.log("f:updateSrcTime: "+ start_npt+'/'+ end_npt + ' from org: ' + this.start_npt+ '/'+this.end_npt);
 588+ // mw.log("pre uri:" + this.src);
578589 // if we have time we can use:
579590 if ( this.URLTimeEncoding ) {
580591 // make sure its a valid start time / end time (else set default)
@@ -768,7 +779,7 @@
769780 */
770781 init: function( video_element ) {
771782 var _this = this;
772 - js_log( 'Initializing mediaElement...' );
 783+ mw.log( 'Initializing mediaElement...' );
773784 this.sources = new Array();
774785
775786 if ( $j( video_element ).attr( 'thumbnail' ) )
@@ -864,7 +875,7 @@
865876 * @param {Number} index Index of source element to set as selected_source
866877 */
867878 selectSource:function( index ) {
868 - js_log( 'f:selectSource:' + index );
 879+ mw.log( 'f:selectSource:' + index );
869880 var playable_sources = this.getPlayableSources();
870881 for ( var i = 0; i < playable_sources.length; i++ ) {
871882 if ( i == index ) {
@@ -880,7 +891,7 @@
881892 * Selects the default source via cookie preference, default marked, or by id order
882893 */
883894 autoSelectSource:function() {
884 - js_log( 'f:autoSelectSource:' );
 895+ mw.log( 'f:autoSelectSource:' );
885896 // Select the default source
886897 var playable_sources = this.getPlayableSources();
887898 var flash_flag = ogg_flag = false;
@@ -888,13 +899,13 @@
889900 for ( var source = 0; source < playable_sources.length; source++ ) {
890901 var mime_type = playable_sources[source].mime_type;
891902 if ( playable_sources[source].marked_default ) {
892 - js_log( 'set via marked default: ' + playable_sources[source].marked_default );
 903+ mw.log( 'set via marked default: ' + playable_sources[source].marked_default );
893904 this.selected_source = playable_sources[source];
894905 return true;
895906 }
896907 // Set via user-preference
897908 if ( embedTypes.players.preference['format_preference'] == mime_type ) {
898 - js_log( 'set via preference: ' + playable_sources[source].mime_type );
 909+ mw.log( 'set via preference: ' + playable_sources[source].mime_type );
899910 this.selected_source = playable_sources[source];
900911 return true;
901912 }
@@ -902,14 +913,14 @@
903914
904915 // Set Ogg if client supports it
905916 for ( var source = 0; source < playable_sources.length; source++ ) {
906 - js_log( 'f:autoSelectSource:' + playable_sources[source].mime_type );
 917+ mw.log( 'f:autoSelectSource:' + playable_sources[source].mime_type );
907918 var mime_type = playable_sources[source].mime_type;
908919 // set source via player
909920 if ( mime_type == 'video/ogg' || mime_type == 'ogg/video' || mime_type == 'video/annodex' || mime_type == 'application/ogg' ) {
910921 for ( var i = 0; i < embedTypes.players.players.length; i++ ) { // for in loop on object oky
911922 var player = embedTypes.players.players[i];
912923 if ( player.library == 'vlc' || player.library == 'native' ) {
913 - js_log( 'set via ogg via order' );
 924+ mw.log( 'set via ogg via order' );
914925 this.selected_source = playable_sources[source];
915926 return true;
916927 }
@@ -921,7 +932,7 @@
922933 for ( var source = 0; source < playable_sources.length; source++ ) {
923934 var mime_type = playable_sources[source].mime_type;
924935 if ( mime_type == 'video/x-flv' ) {
925 - js_log( 'set via by player preference normal flash' )
 936+ mw.log( 'set via by player preference normal flash' )
926937 this.selected_source = playable_sources[source];
927938 return true;
928939 }
@@ -930,14 +941,14 @@
931942 for ( var source = 0; source < playable_sources.length; source++ ) {
932943 var mime_type = playable_sources[source].mime_type;
933944 if ( mime_type == 'video/h264' ) {
934 - js_log( 'set via playable_sources preference h264 flash' )
 945+ mw.log( 'set via playable_sources preference h264 flash' )
935946 this.selected_source = playable_sources[source];
936947 return true;
937948 }
938949 }
939950 // Select first source
940951 if ( !this.selected_source ){
941 - js_log( 'set via first source:' + playable_sources[0] );
 952+ mw.log( 'set via first source:' + playable_sources[0] );
942953 this.selected_source = playable_sources[0];
943954 return true;
944955 }
@@ -985,13 +996,13 @@
986997 * @param {Element} element <video>, <source> or <mediaSource> <text> element.
987998 */
988999 tryAddSource: function( element ) {
989 - js_log( 'f:tryAddSource:' + $j( element ).attr( "src" ) );
 1000+ mw.log( 'f:tryAddSource:' + $j( element ).attr( "src" ) );
9901001 if ( $j( element ).attr( "src" ) ) {
9911002 var new_src = $j( element ).attr( 'src' );
9921003 // make sure an existing element with the same src does not already exist:
9931004 for ( var i = 0; i < this.sources.length; i++ ) {
9941005 if ( this.sources[i].src == new_src ) {
995 - // js_log('checking existing: '+this.sources[i].getSrc() + ' != '+ new_src);
 1006+ // mw.log('checking existing: '+this.sources[i].getSrc() + ' != '+ new_src);
9961007 // can't add it all but try to update any additional attr:
9971008 this.sources[i].updateSource( element );
9981009 }
@@ -1003,9 +1014,9 @@
10041015 source.duration = this.duration;
10051016
10061017 if ( !source.startOffset && this.startOffset )
1007 - source.startOffset = this.startOffset;
 1018+ source.startOffset = praserFloat( this.startOffset );
10081019
1009 - js_log( 'pushed source to stack' + source + 'sl:' + this.sources.length );
 1020+ mw.log( 'pushed source to stack' + source + 'sl:' + this.sources.length );
10101021 this.sources.push( source );
10111022 },
10121023
@@ -1020,7 +1031,7 @@
10211032 if ( this.isPlayableType( this.sources[i].mime_type ) ) {
10221033 playable_sources.push( this.sources[i] );
10231034 } else {
1024 - js_log( "type " + this.sources[i].mime_type + 'is not playable' );
 1035+ mw.log( "type " + this.sources[i].mime_type + 'is not playable' );
10251036 }
10261037 };
10271038 return playable_sources;
@@ -1031,13 +1042,13 @@
10321043 * @param roe_data ROE data.
10331044 */
10341045 addROE: function( roe_data ) {
1035 - js_log( 'f:addROE' );
 1046+ mw.log( 'f:addROE' );
10361047 this.addedROEData = true;
10371048 var _this = this;
10381049 if ( typeof roe_data == 'string' )
10391050 {
10401051 var parser = new DOMParser();
1041 - js_log( 'ROE data:' + roe_data );
 1052+ mw.log( 'ROE data:' + roe_data );
10421053 roe_data = parser.parseFromString( roe_data, "text/xml" );
10431054 }
10441055 if ( roe_data ) {
@@ -1047,19 +1058,19 @@
10481059 // set the thumbnail:
10491060 $j.each( roe_data.getElementsByTagName( 'img' ), function( inx, n ) {
10501061 if ( $j( n ).attr( "id" ) == "stream_thumb" ) {
1051 - js_log( 'roe:set thumb to ' + $j( n ).attr( "src" ) );
 1062+ mw.log( 'roe:set thumb to ' + $j( n ).attr( "src" ) );
10521063 _this['thumbnail'] = $j( n ).attr( "src" );
10531064 }
10541065 } );
10551066 // set the linkback:
10561067 $j.each( roe_data.getElementsByTagName( 'link' ), function( inx, n ) {
10571068 if ( $j( n ).attr( 'id' ) == 'html_linkback' ) {
1058 - js_log( 'roe:set linkback to ' + $j( n ).attr( "href" ) );
 1069+ mw.log( 'roe:set linkback to ' + $j( n ).attr( "href" ) );
10591070 _this['linkback'] = $j( n ).attr( 'href' );
10601071 }
10611072 } );
10621073 } else {
1063 - js_log( 'ROE data empty.' );
 1074+ mw.log( 'ROE data empty.' );
10641075 }
10651076 }
10661077 };
@@ -1158,9 +1169,9 @@
11591170 this.skin_name = mw.getConfig( 'skin_name' );
11601171
11611172
1162 - // Make sure startOffset is cast as an int
 1173+ // Make sure startOffset is cast as an float:
11631174 if ( this.startOffset && this.startOffset.split( ':' ).length >= 2 )
1164 - this.startOffset = mw.npt2seconds( this.startOffset );
 1175+ this.startOffset = parseFloat( mw.npt2seconds( this.startOffset ) );
11651176
11661177 // Make sure offset is in float:
11671178 this.startOffset = parseFloat( this.startOffset );
@@ -1170,7 +1181,7 @@
11711182
11721183 // Make sure duration is in float:
11731184 this.duration = parseFloat( this.duration );
1174 - js_log( "duration is: " + this.duration );
 1185+ mw.log( "duration is: " + this.duration );
11751186
11761187
11771188 this.setDimSize( element, 'width' );
@@ -1182,7 +1193,7 @@
11831194 // Grab any innerHTML and set it to missing_plugin_html
11841195 // @@todo we should strip source tags instead of checking and skipping
11851196 if ( element.innerHTML != '' && element.getElementsByTagName( 'source' ).length == 0 ) {
1186 - js_log( 'innerHTML: ' + element.innerHTML );
 1197+ mw.log( 'innerHTML: ' + element.innerHTML );
11871198 this.user_missing_plugin_html = element.innerHTML;
11881199 }
11891200
@@ -1248,19 +1259,19 @@
12491260 * form an external file that request is issued here
12501261 */
12511262 checkPlayerSources: function() {
1252 - js_log( 'f:checkPlayerSources' );
 1263+ mw.log( 'f:checkPlayerSources' );
12531264 var _this = this;
12541265 // Process the provided ROE file. If we don't yet have sources
12551266 // ( the ROE file provides xml list of sources )
12561267 if ( this.roe && this.media_element.sources.length == 0 ) {
1257 - js_log( 'checkPlayerSources: loading external data' );
 1268+ mw.log( 'checkPlayerSources: loading external data' );
12581269 this.loading_external_data = true;
12591270 do_request( this.roe, function( data ){
12601271 // Continue
12611272 _this.media_element.addROE( data );
1262 - js_log( 'added_roe::' + _this.media_element.sources.length );
 1273+ mw.log( 'added_roe::' + _this.media_element.sources.length );
12631274
1264 - js_log( 'set loading_external_data=false' );
 1275+ mw.log( 'set loading_external_data=false' );
12651276 _this.loading_external_data = false;
12661277
12671278 _this.sourcesReadyInit();
@@ -1278,7 +1289,7 @@
12791290 * Sets load error if no source is playable
12801291 */
12811292 sourcesReadyInit: function(){
1282 - js_log( 'f:sourcesReadyInit' );
 1293+ mw.log( 'f:sourcesReadyInit' );
12831294
12841295 // Autoseletct the source
12851296 this.media_element.autoSelectSource();
@@ -1287,19 +1298,19 @@
12881299 if ( !this.media_element.selected_source ){
12891300 // check for parent clip:
12901301 if ( typeof this.pc != 'undefined' ) {
1291 - js_log( 'no sources, type:' + this.type + ' check for html' );
 1302+ mw.log( 'no sources, type:' + this.type + ' check for html' );
12921303 // debugger;
12931304 // do load player if just displaying innerHTML:
12941305 if ( this.pc.type == 'text/html' ) {
12951306 this.selected_player = embedTypes.players.defaultPlayer( 'text/html' );
1296 - js_log( 'set selected player:' + this.selected_player.mime_type );
 1307+ mw.log( 'set selected player:' + this.selected_player.mime_type );
12971308 }
12981309 }
12991310 } else {
13001311 this.selected_player = embedTypes.players.defaultPlayer( this.media_element.selected_source.mime_type );
13011312 }
13021313 if ( this.selected_player ) {
1303 - js_log( "Playback system: " + this.selected_player.library );
 1314+ mw.log( "Playback system: " + this.selected_player.library );
13041315
13051316 // Inherit the playback system of the selected player:
13061317 this.inheritEmbedPlayer();
@@ -1315,7 +1326,7 @@
13161327 if ( this.pc )
13171328 var missing_type = this.pc.type;
13181329
1319 - js_log( 'No player found for given source type ' + missing_type );
 1330+ mw.log( 'No player found for given source type ' + missing_type );
13201331 this.load_error = this.getPluginMissingHTML( missing_type );
13211332 }
13221333 },
@@ -1326,7 +1337,7 @@
13271338 * @param {Function} callback Function to be called once playback-system has been inherited
13281339 */
13291340 inheritEmbedPlayer: function( callback ) {
1330 - js_log( "inheritEmbedPlayer:duration is: " + this.getDuration() );
 1341+ mw.log( "inheritEmbedPlayer:duration is: " + this.getDuration() );
13311342
13321343 // Clear out any non-base embedObj methods:
13331344 if ( this.instanceOf ) {
@@ -1341,7 +1352,7 @@
13421353 }
13431354
13441355 // Set up the new embedObj
1345 - js_log( 'f: inheritEmbedPlayer: embedding with ' + this.selected_player.library );
 1356+ mw.log( 'f: inheritEmbedPlayer: embedding with ' + this.selected_player.library );
13461357 var _this = this;
13471358
13481359 // Load the selected player
@@ -1405,8 +1416,8 @@
14061417 getDuration:function() {
14071418 // Update some local pointers for the selected source:
14081419 if ( this.media_element && this.media_element.selected_source && this.media_element.selected_source.duration ) {
1409 - this.duration = this.media_element.selected_source.duration;
1410 - this.startOffset = this.media_element.selected_source.startOffset;
 1420+ this.duration = parseFloat( this.media_element.selected_source.duration );
 1421+ this.startOffset = parseFloat( this.media_element.selected_source.startOffset );
14111422 this.start_npt = this.media_element.selected_source.start_npt;
14121423 this.end_npt = this.media_element.selected_source.end_npt;
14131424 }
@@ -1451,7 +1462,7 @@
14521463 if ( this.supportsURLTimeEncoding() ) {
14531464 // Make sure this.seek_time_sec is up-to-date:
14541465 this.seek_time_sec = mw.npt2seconds( this.start_npt ) + parseFloat( percent * this.getDuration() );
1455 - js_log( 'updated seek_time_sec: ' + mw.seconds2npt ( this.seek_time_sec ) );
 1466+ mw.log( 'updated seek_time_sec: ' + mw.seconds2npt ( this.seek_time_sec ) );
14561467 this.stop();
14571468 this.didSeekJump = true;
14581469 // Update the slider
@@ -1468,7 +1479,7 @@
14691480 * (should be overwritten by client that supports frame serving)
14701481 */
14711482 setCurrentTime:function( time, callback ) {
1472 - js_log( 'Error: base embed setCurrentTime can not frame serve (override via plugin)' );
 1483+ mw.log( 'Error: base embed setCurrentTime can not frame serve (override via plugin)' );
14731484 },
14741485
14751486 /**
@@ -1476,8 +1487,8 @@
14771488 * issues a loading request
14781489 */
14791490 setupEmbedPlayer:function() {
1480 - js_log( 'f:setupEmbedPlayer' );
1481 - js_log( 'thum disp:' + this.thumbnail_disp );
 1491+ mw.log( 'f:setupEmbedPlayer' );
 1492+ mw.log( 'thum disp:' + this.thumbnail_disp );
14821493 var _this = this;
14831494
14841495 // Set "loading" here:
@@ -1488,9 +1499,9 @@
14891500 );
14901501
14911502 // Make sure the player is
1492 - js_log( 'performing embed for ' + _this.id );
 1503+ mw.log( 'performing embed for ' + _this.id );
14931504 var embed_code = _this.getEmbedHTML();
1494 - // js_log('shopuld embed:' + embed_code);
 1505+ // mw.log('shopuld embed:' + embed_code);
14951506 $j( '#mv_embedded_player_' + _this.id ).html( embed_code );
14961507 },
14971508
@@ -1499,18 +1510,13 @@
15001511 */
15011512 getRelatedFromTitleKey:function() {
15021513 var _this = this;
1503 - var reqObj = {
1504 - 'action' : 'query',
 1514+ var request = {
15051515 //normalize the File NS (ie sometimes its present in wikiTitleKey other times not
15061516 'titles' : 'File:' + this.wikiTitleKey.replace(/File:|Image:/,''),
15071517 'generator' : 'categories'
1508 - };
1509 - var req_categories = new Array();
1510 - do_api_req( {
1511 - 'url' : mw.commons_api_url,
1512 - 'data' : reqObj
1513 - }, function( data ) {
1514 - req_categories = Array();
 1518+ };
 1519+ mw.getJSON( mw.commons_api_url, request, function( data ) {
 1520+ var req_categories = [];
15151521 if ( data.query && data.query.pages ) {
15161522 for ( var pageid in data.query.pages ) {
15171523 if ( data.query.pages[pageid].title )
@@ -1529,23 +1535,19 @@
15301536 * @parma {Object} catlist List of categories
15311537 */
15321538 getRelatedFromCat:function( catlist ) {
1533 - js_log( 'getRelatedFromCat' );
 1539+ mw.log( 'getRelatedFromCat' );
15341540 var _this = this;
15351541 for ( var i = 0 ; i <= catlist.length ; i++ ) {
15361542 if ( !catlist[i] )
15371543 continue;
1538 - var reqObj = {
1539 - 'action' : 'query',
 1544+ var request = {
15401545 'generator' : 'categorymembers' ,
15411546 'gcmtitle' : catlist[i],
15421547 'prop' : 'imageinfo',
15431548 'iiprop' : 'url',
15441549 'iiurlwidth': '80'
15451550 };
1546 - do_api_req( {
1547 - 'data':reqObj,
1548 - 'url': mw.commons_api_url
1549 - }, function( data ) {
 1551+ mw.getJSON( mw.commons_api_url, request, function( data ) {
15501552 // empty the videos:
15511553 $j( '#dc_' + _this.id + ' .related_vids ul' ).html( ' ' );
15521554
@@ -1581,7 +1583,7 @@
15821584 * On clip done action. Called once a clip is done playing
15831585 */
15841586 onClipDone:function() {
1585 - js_log( 'base:onClipDone' );
 1587+ mw.log( 'base:onClipDone' );
15861588 // stop the clip (load the thumbnail etc)
15871589 this.stop();
15881590 this.seek_time_sec = 0;
@@ -1593,6 +1595,8 @@
15941596 }
15951597 this.thumbnail_disp = true;
15961598
 1599+ //if k-attribution and k-skin show the "credits" screen:
 1600+
15971601 // make sure we are not in preview mode( no end clip actions in preview mode)
15981602 if ( this.preview_mode )
15991603 return ;
@@ -1669,7 +1673,7 @@
16701674 * Mostly metavid specific ( should be factored into a separate module )
16711675 */
16721676 getNearbyClipLinks:function() {
1673 - js_log( 'f:getNextPrevLinks' );
 1677+ mw.log( 'f:getNextPrevLinks' );
16741678 var anno_track_url = null;
16751679 var _this = this;
16761680 // check for annoative track
@@ -1682,13 +1686,13 @@
16831687 } );
16841688
16851689 if ( !anno_track_url ) {
1686 - js_log( 'no annotative track url found' );
 1690+ mw.log( 'no annotative track url found' );
16871691 // $j('#liks_info_'+this.id).html('no metadata found for related links');
16881692 _this.showThumbnail();
16891693 return ;
16901694 }
16911695
1692 - js_log( 'we have annotative track:' + anno_track_url );
 1696+ mw.log( 'we have annotative track:' + anno_track_url );
16931697 // Zero out seconds (should improve cache hit rate and generally expands metadata search)
16941698 // @@todo this could be replaced with a regExp
16951699 var annoURL = mw.parseUri( anno_track_url );
@@ -1711,14 +1715,14 @@
17121716 // check the anno_data cache:
17131717 // @@todo search cache see if current is in range.
17141718 if ( this.cmmlData ) {
1715 - js_log( 'anno data found in cache: ' + request_key );
 1719+ mw.log( 'anno data found in cache: ' + request_key );
17161720 this.showNextPrevLinks();
17171721 } else {
17181722 do_request( new_anno_track_url, function( cmml_data ) {
1719 - js_log( 'raw response: ' + cmml_data );
 1723+ mw.log( 'raw response: ' + cmml_data );
17201724 if ( typeof cmml_data == 'string' ) {
17211725 var parser = new DOMParser();
1722 - js_log( 'Parse CMML data:' + cmml_data );
 1726+ mw.log( 'Parse CMML data:' + cmml_data );
17231727 cmml_data = parser.parseFromString( cmml_data, "text/xml" );
17241728 }
17251729 // init cmmlData
@@ -1734,7 +1738,7 @@
17351739 // grab all its meta
17361740 _this.cmmlData[ $j( clip ).attr( "id" ) ]['meta'] = { };
17371741 $j.each( clip.getElementsByTagName( 'meta' ), function( imx, meta ) {
1738 - // js_log('adding meta: '+ $j(meta).attr("name")+ ' = '+ $j(meta).attr("content"));
 1742+ // mw.log('adding meta: '+ $j(meta).attr("name")+ ' = '+ $j(meta).attr("content"));
17391743 _this.cmmlData[$j( clip ).attr( "id" )]['meta'][$j( meta ).attr( "name" )] = $j( meta ).attr( "content" );
17401744 } );
17411745 } );
@@ -1749,7 +1753,7 @@
17501754 * Mostly metavid specific ( should be factored into a separate module )
17511755 */
17521756 showNearbyClipLinks:function() {
1753 - // js_log('f:showNextPrevLinks');
 1757+ // mw.log('f:showNextPrevLinks');
17541758 // int requested links:
17551759 var link = {
17561760 'prev':'',
@@ -1759,16 +1763,16 @@
17601764 var curTime = this.getTimeRange().split( '/' );
17611765 var s_sec = mw.npt2seconds( curTime[0] );
17621766 var e_sec = mw.npt2seconds( curTime[1] );
1763 - js_log( 'showNextPrevLinks: req time: ' + s_sec + ' to ' + e_sec );
 1767+ mw.log( 'showNextPrevLinks: req time: ' + s_sec + ' to ' + e_sec );
17641768 // now we have all the data in cmmlData
17651769 var current_done = false;
17661770 for ( var clip_id in this.cmmlData ) { // for in loop oky for object
17671771 var clip = this.cmmlData[clip_id];
1768 - // js_log('on clip:'+ clip_id);
 1772+ // mw.log('on clip:'+ clip_id);
17691773 // set prev_link (if cur_link is still empty)
17701774 if ( s_sec > clip.end_time_sec ) {
17711775 link.prev = clip_id;
1772 - js_log( 'showNextPrevLinks: ' + s_sec + ' < ' + clip.end_time_sec + ' set prev' );
 1776+ mw.log( 'showNextPrevLinks: ' + s_sec + ' < ' + clip.end_time_sec + ' set prev' );
17731777 }
17741778
17751779 if ( e_sec == clip.end_time_sec && s_sec == clip.start_time_sec )
@@ -1776,13 +1780,13 @@
17771781 // current clip is not done:
17781782 if ( e_sec < clip.end_time_sec && link.current == '' && !current_done ) {
17791783 link.current = clip_id;
1780 - js_log( 'showNextPrevLinks: ' + e_sec + ' < ' + clip.end_time_sec + ' set current' );
 1784+ mw.log( 'showNextPrevLinks: ' + e_sec + ' < ' + clip.end_time_sec + ' set current' );
17811785 }
17821786
17831787 // set end clip (first clip where start time is > end_time of req
17841788 if ( e_sec < clip.start_time_sec && link.next == '' ) {
17851789 link.next = clip_id;
1786 - js_log( 'showNextPrevLinks: ' + e_sec + ' < ' + clip.start_time_sec + ' && ' + link.next );
 1790+ mw.log( 'showNextPrevLinks: ' + e_sec + ' < ' + clip.start_time_sec + ' && ' + link.next );
17871791 }
17881792 }
17891793 var html = '';
@@ -1833,7 +1837,7 @@
18341838 */
18351839 showThumbnail: function() {
18361840 var _this = this;
1837 - js_log( 'f:showThumbnail' + this.thumbnail_disp );
 1841+ mw.log( 'f:showThumbnail' + this.thumbnail_disp );
18381842 this.closeDisplayedHTML();
18391843 $j( '#mv_embedded_player_' + this.id ).html( this.getThumbnailHTML() );
18401844 this.paused = true;
@@ -1848,7 +1852,7 @@
18491853 */
18501854 refreshControls:function() {
18511855 if ( $j( '#' + this.id + ' .control-bar' ).length == 0 ) {
1852 - js_log( 'refreshControls::control-bar not present, no refresh' );
 1856+ mw.log( 'refreshControls::control-bar not present, no refresh' );
18531857 return ;
18541858 }
18551859 // Do update controls:
@@ -1867,7 +1871,7 @@
18681872
18691873 /**
18701874 * Show the player
1871 - * NOTE: the player area is dobbule <div> encapulsated will be factored shortly
 1875+ * NOTE: the player area is dobule <div> encapsulation will be factored out shortly
18721876 */
18731877 showPlayer : function () {
18741878 // set-up the local ctrlBuilder instance:
@@ -1882,7 +1886,7 @@
18831887 '</div>';
18841888
18851889 if ( this.controls ) {
1886 - js_log( "f:showPlayer:AddControls" );
 1890+ mw.log( "f:showPlayer:AddControls" );
18871891 html_code += '<div class="ui-state-default ui-widget-header ui-helper-clearfix control-bar" >';
18881892 html_code += this.getControls();
18891893 html_code += '</div>';
@@ -1893,7 +1897,7 @@
18941898
18951899 html_code += '</div>'; // videoPlayer div close
18961900
1897 - // js_log('should set: '+this.id);
 1901+ // mw.log('should set: '+this.id);
18981902 $j( this ).html( html_code );
18991903
19001904 // Add hooks once Controls are in DOM
@@ -1901,7 +1905,7 @@
19021906
19031907
19041908 if ( this.autoplay ) {
1905 - js_log( 'showPlayer::activating autoplay' );
 1909+ mw.log( 'showPlayer::activating autoplay' );
19061910 this.play();
19071911 }
19081912 },
@@ -1922,7 +1926,7 @@
19231927 return out + '</div>';
19241928 },
19251929 updateVideoTimeReq:function( time_req ) {
1926 - js_log( 'f:updateVideoTimeReq' );
 1930+ mw.log( 'f:updateVideoTimeReq' );
19271931 var time_parts = time_req.split( '/' );
19281932 this.updateVideoTime( time_parts[0], time_parts[1] );
19291933 },
@@ -1988,7 +1992,7 @@
19891993 * @param {Float} float_sec Time to update the thumb to
19901994 */
19911995 updateThumbTime:function( float_sec ) {
1992 - // js_log('updateThumbTime:'+float_sec);
 1996+ // mw.log('updateThumbTime:'+float_sec);
19931997 var _this = this;
19941998 if ( typeof this.org_thum_src == 'undefined' ) {
19951999 this.org_thum_src = this.media_element.getThumbnailURL();
@@ -2030,7 +2034,7 @@
20312035 if ( this.thumbnail_updating && $j( '#new_img_thumb_' + this.id ).attr( 'src' ) == src )
20322036 return false;
20332037
2034 - js_log( 'update thumb: ' + src );
 2038+ mw.log( 'update thumb: ' + src );
20352039
20362040 if ( quick_switch ) {
20372041 $j( '#img_thumb_' + this.id ).attr( 'src', src );
@@ -2041,20 +2045,20 @@
20422046 $j( '#new_img_thumb_' + this.id ).stop().remove();
20432047
20442048 if ( this.thumbnail_disp ) {
2045 - js_log( 'set to thumb:' + src );
 2049+ mw.log( 'set to thumb:' + src );
20462050 this.thumbnail_updating = true;
20472051 $j( '#dc_' + this.id ).append( '<img src="' + src + '" ' +
20482052 'style="display:none;position:absolute;zindex:2;top:0px;left:0px;" ' +
20492053 'width="' + this.width + '" height="' + this.height + '" ' +
20502054 'id = "new_img_thumb_' + this.id + '" />' );
2051 - // js_log('appended: new_img_thumb_');
 2055+ // mw.log('appended: new_img_thumb_');
20522056 $j( '#new_img_thumb_' + this.id ).fadeIn( "slow", function() {
20532057 // once faded in remove org and rename new:
20542058 $j( '#img_thumb_' + _this.id ).remove();
20552059 $j( '#new_img_thumb_' + _this.id ).attr( 'id', 'img_thumb_' + _this.id );
20562060 $j( '#img_thumb_' + _this.id ).css( 'zindex', '1' );
20572061 _this.thumbnail_updating = false;
2058 - // js_log("done fadding in "+ $j('#img_thumb_'+_this.id).attr("src"));
 2062+ // mw.log("done fadding in "+ $j('#img_thumb_'+_this.id).attr("src"));
20592063
20602064 // if we have a thumb queued update to that
20612065 if ( _this.last_thumb_url ) {
@@ -2074,7 +2078,7 @@
20752079 * download, and embed code.
20762080 */
20772081 getThumbnailHTML : function () {
2078 - js_log( 'embedPlayer:getThumbnailHTML::' + this.id );
 2082+ mw.log( 'embedPlayer:getThumbnailHTML::' + this.id );
20792083 var thumb_html = '';
20802084 var class_atr = '';
20812085 var style_atr = '';
@@ -2103,7 +2107,7 @@
21042108 if ( thumbnail.substring( 0, 1 ) == '/' ) {
21052109 eURL = mw.parseUri( mw.getMwEmbedPath() );
21062110 embed_thumb_url = eURL.protocol + '://' + eURL.host + thumbnail;
2107 - // js_log('set from mwEmbed_path:'+embed_thumb_html);
 2111+ // mw.log('set from mwEmbed_path:'+embed_thumb_html);
21082112 } else {
21092113 embed_thumb_url = ( thumbnail.indexOf( 'http://' ) != -1 ) ? thumbnail : mw.getMwEmbedPath() + thumbnail;
21102114 }
@@ -2138,7 +2142,7 @@
21392143 var pos = $j( '#' + sel_id + ' .options-btn' ).offset();
21402144 pos['top'] = pos['top'] + 24;
21412145 pos['left'] = pos['left'] -124;
2142 - // js_log('pos of options button: t:'+pos['top']+' l:'+ pos['left']);
 2146+ // mw.log('pos of options button: t:'+pos['top']+' l:'+ pos['left']);
21432147 $j( '#mv_vid_options_' + sel_id ).css( pos ).toggle();
21442148 return;
21452149 },
@@ -2252,7 +2256,7 @@
22532257 * Close the text interface
22542258 */
22552259 closeTextInterface:function() {
2256 - js_log( 'closeTextInterface ' + typeof this.textInterface );
 2260+ mw.log( 'closeTextInterface ' + typeof this.textInterface );
22572261 if ( typeof this.textInterface !== 'undefined' ) {
22582262 this.textInterface.close();
22592263 }
@@ -2367,7 +2371,7 @@
23682372 var iparts = $j( this ).attr( 'id' ).replace(/sc_/ , '' ).split( '_' );
23692373 var source_id = iparts[0];
23702374 var default_player_id = iparts[1];
2371 - js_log( 'source id: ' + source_id + ' player id: ' + default_player_id );
 2375+ mw.log( 'source id: ' + source_id + ' player id: ' + default_player_id );
23722376
23732377 $j( '#' + this_id ).get( 0 ).closeDisplayedHTML();
23742378 $j( '#' + _this.id ).get( 0 ).media_element.selectSource( source_id );
@@ -2414,7 +2418,7 @@
24152419 out += '</div>';
24162420 return out;
24172421 }
2418 - // js_log('f:showDownload '+ this.roe + ' ' + this.media_element.addedROEData);
 2422+ // mw.log('f:showDownload '+ this.roe + ' ' + this.media_element.addedROEData);
24192423 if ( this.roe && this.media_element.addedROEData == false ) {
24202424 var _this = this;
24212425 $target.html( gM( 'loading_txt' ) );
@@ -2445,7 +2449,7 @@
24462450 // check if thumbnail is being displayed and embed html
24472451 if ( this.thumbnail_disp ) {
24482452 if ( !this.selected_player ) {
2449 - js_log( 'no selected_player' );
 2453+ mw.log( 'no selected_player' );
24502454 // this.innerHTML = this.getPluginMissingHTML();
24512455 $j( '#' + this.id ).html( this.getPluginMissingHTML() );
24522456 } else {
@@ -2472,7 +2476,7 @@
24732477 */
24742478 load:function() {
24752479 // should be done by child (no base way to pre-buffer video)
2476 - js_log( 'baseEmbed:load call' );
 2480+ mw.log( 'baseEmbed:load call' );
24772481 },
24782482
24792483 /**
@@ -2485,7 +2489,7 @@
24862490 pause: function() {
24872491 var _this = this;
24882492 var eid = ( this.pc != null ) ? this.pc.pp.id:this.id;
2489 - // js_log('mwEmbed:do pause');
 2493+ // mw.log('mwEmbed:do pause');
24902494 // (playing) do pause
24912495 this.paused = true;
24922496 var $pt = $j( '#' + eid);
@@ -2507,7 +2511,7 @@
25082512 */
25092513 stop: function() {
25102514 var _this = this;
2511 - js_log( 'mvEmbed:stop:' + this.id );
 2515+ mw.log( 'mvEmbed:stop:' + this.id );
25122516
25132517 // no longer seeking:
25142518 this.didSeekJump = false;
@@ -2524,7 +2528,7 @@
25252529 // check if thumbnail is being displayed in which case do nothing
25262530 if ( this.thumbnail_disp ) {
25272531 // already in stooped state
2528 - js_log( 'already in stopped state' );
 2532+ mw.log( 'already in stopped state' );
25292533 } else {
25302534 // rewrite the html to thumbnail disp
25312535 this.showThumbnail();
@@ -2562,14 +2566,14 @@
25632567 $j( '#' + eid + ' .volume-slider' ).slider( 'value', 0 );
25642568 this.updateVolumen( 0 );
25652569 }
2566 - js_log( 'f:toggleMute::' + this.muted );
 2570+ mw.log( 'f:toggleMute::' + this.muted );
25672571 },
25682572
25692573 /**
25702574 * Abstract Update volumen Method must be overided by plug-in / player interface
25712575 */
25722576 updateVolumen:function( perc ) {
2573 - js_log( 'update volume not supported with current playback type' );
 2577+ mw.log( 'update volume not supported with current playback type' );
25742578 return ;
25752579 },
25762580
@@ -2577,7 +2581,7 @@
25782582 * Abstract fullscreen Method must be overided by plug-in / player interface
25792583 */
25802584 fullscreen:function() {
2581 - js_log( 'fullscreen not supported with current playback type' );
 2585+ mw.log( 'fullscreen not supported with current playback type' );
25822586 return ;
25832587 },
25842588
@@ -2633,16 +2637,16 @@
26342638 * underling plugin objects are responsible for updating currentTime
26352639 */
26362640 monitor: function() {
2637 - var _this = this;
2638 - //js_log(' ct: ' + this.currentTime + ' dur: ' + ( parseInt( this.duration ) + 1 ) + ' is seek: ' + this.seeking );
2639 - if ( this.currentTime && this.currentTime > 0 && this.duration ) {
 2641+ var _this = this;
 2642+ //mw.log(' ct: ' + this.currentTime + ' dur: ' + ( parseInt( this.duration ) + 1 ) + ' is seek: ' + this.seeking );
 2643+ if ( this.currentTime && this.currentTime > 0 && this.duration ) {
26402644 if ( !this.userSlide && !this.seeking ) {
2641 - if ( this.startOffset ) {
 2645+ if ( parseInt( this.startOffset ) != 0 ) {
26422646 // If start offset include that calculation
26432647 this.updatePlayHead( ( this.currentTime - this.startOffset ) / this.duration );
26442648 var et = ( this.ctrlBuilder.long_time_disp ) ? '/' + mw.seconds2npt( parseFloat( this.startOffset ) + parseFloat( this.duration ) ) : '';
26452649 this.setStatus( mw.seconds2npt( this.currentTime ) + et );
2646 - } else {
 2650+ } else {
26472651 this.updatePlayHead( this.currentTime / this.duration );
26482652 var et = ( this.ctrlBuilder.long_time_disp ) ? '/' + mw.seconds2npt( this.duration ):'';
26492653 this.setStatus( mw.seconds2npt( this.currentTime ) + et );
@@ -2651,12 +2655,11 @@
26522656 // Check if we are "done"
26532657 var end_presentation_time = ( this.startOffset ) ? ( this.startOffset + this.duration ) : this.duration;
26542658 if ( this.currentTime > end_presentation_time ) {
2655 - js_log( "should run clip done :: " + this.currentTime + ' > ' + end_presentation_time );
 2659+ mw.log( "should run clip done :: " + this.currentTime + ' > ' + end_presentation_time );
26562660 this.onClipDone();
26572661 }
26582662 } else {
2659 - // Media lacks duration just show end time
2660 - // js_log(' ct:' + this.currentTime + ' dur: ' + this.duration);
 2663+ // Media lacks duration just show end time
26612664 if ( this.isStoped() ) {
26622665 this.setStatus( this.getTimeRange() );
26632666 } else if ( this.isPaused() ) {
@@ -2709,7 +2712,7 @@
27102713
27112714 // Update the buffer progress bar (if available )
27122715 if ( this.bufferedPercent != 0 ) {
2713 - // js_log('bufferedPercent: ' + this.bufferedPercent);
 2716+ // mw.log('bufferedPercent: ' + this.bufferedPercent);
27142717 if ( this.bufferedPercent > 1 )
27152718 this.bufferedPercent = 1;
27162719
@@ -2725,13 +2728,11 @@
27262729 * @param {Float} perc Value between 0 and 1 for position of playhead
27272730 */
27282731 updatePlayHead: function( perc ) {
2729 - var eid = ( this.pc ) ? this.pc.pp.id:this.id;
 2732+ var eid = ( this.pc ) ? this.pc.pp.id:this.id;
27302733 if ( this.controls && $j( '#' + eid + ' .play_head' ).length != 0 ) {
27312734 var val = parseInt( perc * 1000 );
27322735 $j( '#' + eid + ' .play_head' ).slider( 'value', val );
2733 - }
2734 - // js_log('set#mv_seeker_slider_'+eid + ' perc in: ' + perc + ' * ' + $j('#mv_seeker_'+eid).width() + ' = set to: '+ val + ' - '+ Math.round(this.mv_seeker_width*perc) );
2735 - // js_log('op:' + offset_perc + ' *('+perc+' * ' + $j('#slider_'+id).width() + ')');
 2736+ }
27362737 },
27372738
27382739 /**
@@ -2740,7 +2741,7 @@
27412742 * @param {Object} options Provides "start" time & "end" time to highlight
27422743 */
27432744 highlightPlaySection:function( options ) {
2744 - js_log( 'highlightPlaySection' );
 2745+ mw.log( 'highlightPlaySection' );
27452746 var eid = ( this.pc ) ? this.pc.pp.id:this.id;
27462747 var dur = this.getDuration();
27472748 // set the left percet and update the slider:
@@ -2760,7 +2761,7 @@
27612762 slider_perc = ( left_perc / 100 );
27622763 }
27632764
2764 - js_log( "slider perc:" + slider_perc );
 2765+ mw.log( "slider perc:" + slider_perc );
27652766 if ( ! this.isPlaying() ) {
27662767 this.updatePlayHead( slider_perc );
27672768 }
@@ -2769,7 +2770,7 @@
27702771 if ( ( width_perc + left_perc ) > 100 ) {
27712772 width_perc = 100 - left_perc;
27722773 }
2773 - // js_log('should hl: '+rel_start_sec+ '/' + dur + ' re:' + rel_end_sec+' lp:' + left_perc + ' width: ' + width_perc);
 2774+ // mw.log('should hl: '+rel_start_sec+ '/' + dur + ' re:' + rel_end_sec+' lp:' + left_perc + ' width: ' + width_perc);
27742775 $j( '#mv_seeker_' + eid + ' .mv_highlight' ).css( {
27752776 'left' : left_perc + '%',
27762777 'width' : width_perc + '%'
@@ -2779,7 +2780,7 @@
27802781 this.seek_time_sec = mw.npt2seconds( options['start'] );
27812782 // trim output to
27822783 this.setStatus( gM( 'mwe-seek_to', mw.seconds2npt( this.seek_time_sec ) ) );
2783 - js_log( 'DO update: ' + this.jump_time );
 2784+ mw.log( 'DO update: ' + this.jump_time );
27842785 this.updateThumbTime( rel_start_sec );
27852786 },
27862787
@@ -3021,7 +3022,7 @@
30223023 * null if no player found
30233024 */
30243025 defaultPlayer : function( mime_type ) {
3025 - js_log( "get defaultPlayer for " + mime_type );
 3026+ mw.log( "get defaultPlayer for " + mime_type );
30263027 var mime_players = this.getMIMETypePlayers( mime_type );
30273028 if ( mime_players.length > 0 )
30283029 {
@@ -3034,7 +3035,7 @@
30353036 // (it will be chosen according to the default_players list
30363037 return mime_players[0];
30373038 }
3038 - js_log( 'No default player found for ' + mime_type );
 3039+ mw.log( 'No default player found for ' + mime_type );
30393040 return null;
30403041 },
30413042
@@ -3059,7 +3060,7 @@
30603061 for ( var i = 0; i < this.players.length; i++ ) {
30613062 if ( this.players[i].id == player_id ) {
30623063 selected_player = this.players[i];
3063 - js_log( 'choosing ' + player_id + ' for ' + mime_type );
 3064+ mw.log( 'choosing ' + player_id + ' for ' + mime_type );
30643065 this.preference[mime_type] = player_id;
30653066 this.savePreferences();
30663067 break;
@@ -3071,7 +3072,7 @@
30723073 if ( embed.media_element.selected_source && ( embed.media_element.selected_source.mime_type == mime_type ) )
30733074 {
30743075 embed.selectPlayer( selected_player );
3075 - js_log( 'using ' + embed.selected_player.getName() + ' for ' + embed.media_element.selected_source.getTitle() );
 3076+ mw.log( 'using ' + embed.selected_player.getName() + ' for ' + embed.media_element.selected_source.getTitle() );
30763077 }
30773078 }
30783079 }
@@ -3090,7 +3091,7 @@
30913092 {
30923093 var name_value = pairs[i].split( '=' );
30933094 this.preference[name_value[0]] = name_value[1];
3094 - // js_log('load preference for ' + name_value[0] + ' is ' + name_value[1]);
 3095+ // mw.log('load preference for ' + name_value[0] + ' is ' + name_value[1]);
30953096 }
30963097 }
30973098 },
@@ -3150,7 +3151,7 @@
31513152 * Detects what plug-ins the client supports
31523153 */
31533154 detect: function() {
3154 - js_log( "embedPlayer: running detect" );
 3155+ mw.log( "embedPlayer: running detect" );
31553156 this.players = new mediaPlayers();
31563157 // every browser supports html rendering:
31573158 this.players.addPlayer( htmlPlayer );
@@ -3218,7 +3219,7 @@
32193220 // @@todo add some user nagging to install the xiph qt
32203221 }
32213222 } catch ( e ) {
3222 - js_log( 'could not run canPlayType in safari' );
 3223+ mw.log( 'could not run canPlayType in safari' );
32233224 }
32243225 } else {
32253226 this.players.addPlayer( videoElementPlayer );
@@ -3233,7 +3234,7 @@
32343235 if ( semicolonPos > -1 ) {
32353236 type = type.substr( 0, semicolonPos );
32363237 }
3237 - // js_log('on type: '+type);
 3238+ // mw.log('on type: '+type);
32383239 var pluginName = navigator.mimeTypes[i].enabledPlugin ? navigator.mimeTypes[i].enabledPlugin.name : '';
32393240 if ( !pluginName ) {
32403241 // In case it is null or undefined
@@ -3278,7 +3279,7 @@
32793280 var descArray = flashDescription.split( " " );
32803281 var tempArrayMajor = descArray[2].split( "." );
32813282 var versionMajor = tempArrayMajor[0];
3282 - // js_log("version of flash: " + versionMajor);
 3283+ // mw.log("version of flash: " + versionMajor);
32833284 if ( versionMajor >= 10 ) {
32843285 this.players.addPlayer( omtkPlayer );
32853286 }
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/javaEmbed.js
@@ -37,7 +37,7 @@
3838 * Get the embed html code:
3939 */
4040 getEmbedObj: function() {
41 - js_log( "java play url:" + this.getSrc( this.seek_time_sec ) );
 41+ mw.log( "java play url:" + this.getSrc( this.seek_time_sec ) );
4242 // get the duration
4343 this.getDuration();
4444 // if still unset set to an arbitrary time 60 seconds:
@@ -108,15 +108,15 @@
109109 if ( this.playerElement && this.playerElement.getPlayPosition ) {
110110 try {
111111 // java reads ogg media time.. so no need to add the start or seek offset:
112 - // js_log(' ct: ' + this.playerElement.getPlayPosition() + ' ' + this.supportsURLTimeEncoding());
 112+ // mw.log(' ct: ' + this.playerElement.getPlayPosition() + ' ' + this.supportsURLTimeEncoding());
113113 this.currentTime = this.playerElement.getPlayPosition();
114114 if ( this.playerElement.getPlayPosition() < 0 ) {
115 - js_log( 'pp:' + this.playerElement.getPlayPosition() );
 115+ mw.log( 'pp:' + this.playerElement.getPlayPosition() );
116116 // probably reached clip end
117117 this.onClipDone();
118118 }
119119 } catch ( e ) {
120 - js_log( 'could not get time from jPlayer: ' + e );
 120+ mw.log( 'could not get time from jPlayer: ' + e );
121121 }
122122 }
123123 }
@@ -130,7 +130,7 @@
131131 * @param {Float} percentage Percentage to seek into the stream
132132 */
133133 doSeek:function( percentage ) {
134 - js_log( 'java:seek:p: ' + percentage + ' : ' + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );
 134+ mw.log( 'java:seek:p: ' + percentage + ' : ' + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );
135135 this.getPlayerElement();
136136
137137 if ( this.supportsURLTimeEncoding() ) {
@@ -140,7 +140,7 @@
141141 // this.playerElement.restart();
142142 } else if ( this.playerElement ) {
143143 // do a (generally broken) local seek:
144 - js_log( "cortado javascript seems to always fail ... but here we go... doSeek(" + ( percentage * parseFloat( this.getDuration() ) ) );
 144+ mw.log( "cortado javascript seems to always fail ... but here we go... doSeek(" + ( percentage * parseFloat( this.getDuration() ) ) );
145145 this.playerElement.doSeek( percentage * parseFloat( this.getDuration() ) );
146146 } else {
147147 this.doPlayThenSeek( percentage );
@@ -152,7 +152,7 @@
153153 * @param {Float} percentage Percentage to seek into the stream
154154 */
155155 doPlayThenSeek: function( percentage ) {
156 - js_log( 'doPlayThenSeek' );
 156+ mw.log( 'doPlayThenSeek' );
157157 var _this = this;
158158 this.play();
159159 var rfsCount = 0;
@@ -167,7 +167,7 @@
168168 setTimeout( readyForSeek, 50 );
169169 rfsCount++;
170170 } else {
171 - js_log( 'error:doPlayThenSeek failed' );
 171+ mw.log( 'error:doPlayThenSeek failed' );
172172 }
173173 }
174174 }
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/flowplayerEmbed.js
@@ -339,7 +339,7 @@
340340 extend( self, json );
341341 return self;
342342 } catch ( e ) {
343 - js_log( 'flow player could not set css: ' + json );
 343+ mw.log( 'flow player could not set css: ' + json );
344344 }
345345 },
346346 show: function() {
@@ -626,7 +626,7 @@
627627 var ret = ( arg === undefined ) ? api["fp_" + name]() : api["fp_" + name]( arg );
628628 return ret == 'undefined' ? self : ret;
629629 } catch ( e ) {
630 - js_log( 'flowplayer could not access fp_ ' + name );
 630+ mw.log( 'flowplayer could not access fp_ ' + name );
631631 }
632632 };
633633 }
@@ -1472,7 +1472,7 @@
14731473 postEmbedJS: function()
14741474 {
14751475 var _this = this;
1476 - js_log( 'embedFlow: uri:' + this.getSrc() + "\n" + mw.getMwEmbedPath() + 'libEmbedPlayer/binPlayers/flowplayer/flowplayer-3.0.1.swf' ) ;
 1476+ mw.log( 'embedFlow: uri:' + this.getSrc() + "\n" + mw.getMwEmbedPath() + 'libEmbedPlayer/binPlayers/flowplayer/flowplayer-3.0.1.swf' ) ;
14771477 var flowConfig = {
14781478 clip: {
14791479 url: this.getSrc(),
@@ -1556,7 +1556,7 @@
15571557 if ( this.fla ) {
15581558 this.fla.fullscreen();
15591559 } else {
1560 - js_log( 'must be playing before you can go fullscreen' );
 1560+ mw.log( 'must be playing before you can go fullscreen' );
15611561 }
15621562 },
15631563 pause : function()
@@ -1565,10 +1565,10 @@
15661566 if ( !this.thumbnail_disp ) {
15671567 this.parent_pause();
15681568 if ( this.fla ) {
1569 - js_log( "Flash:Pause: " + this.fla.isPaused() );
 1569+ mw.log( "Flash:Pause: " + this.fla.isPaused() );
15701570 if ( this.fla['pause'] ) {
15711571 if ( ! this.fla.isPaused() ) {
1572 - js_log( 'calling plugin pause' );
 1572+ mw.log( 'calling plugin pause' );
15731573 this.fla.pause();
15741574
15751575 // restore volume and opacity
@@ -1601,7 +1601,7 @@
16021602 if ( !this.duration || this.duration == 0 ) {
16031603 if ( this.fla.getClip() ) {
16041604 this.duration = this.fla.getClip().fullDuration;
1605 - js_log( 'set duration via clip value: ' + this.getDuration() );
 1605+ mw.log( 'set duration via clip value: ' + this.getDuration() );
16061606 }
16071607 }
16081608 // update the duration ntp values:
@@ -1621,12 +1621,12 @@
16221622 // set the current Time (based on timeFormat)
16231623 if ( this.supportsURLTimeEncoding() ) {
16241624 this.currentTime = flash_state.time;
1625 - // js_log('set buffer: ' + flash_state.bufferEnd + ' at time: ' + flash_state.time +' of total dur: ' + this.getDuration());
 1625+ // mw.log('set buffer: ' + flash_state.bufferEnd + ' at time: ' + flash_state.time +' of total dur: ' + this.getDuration());
16261626 } else {
16271627 this.currentTime = flash_state.time + this.startOffset;
16281628 // stop buffering if greater than the duration:
16291629 if ( flash_state.bufferEnd > this.getDuration() + 5 ) {
1630 - // js_log('should stop buffering (does not seem to work)' + flash_state.bufferEnd + ' > dur: ' + this.getDuration() );
 1630+ // mw.log('should stop buffering (does not seem to work)' + flash_state.bufferEnd + ' > dur: ' + this.getDuration() );
16311631 this.fla.stopBuffering();
16321632 }
16331633 }
@@ -1639,7 +1639,7 @@
16401640 }
16411641 catch ( err )
16421642 {
1643 - js_log( 'failed to set values' );
 1643+ mw.log( 'failed to set values' );
16441644 fail = true;
16451645 }
16461646 if ( !fail )
@@ -1649,7 +1649,7 @@
16501650 /* to support local seeks */
16511651 if ( this.currentTime > 1 && this.seek_time_sec != 0 && !this.supportsURLTimeEncoding() )
16521652 {
1653 - js_log( 'flashEmbed: _local_ Seeking to ' + this.seek_time_sec );
 1653+ mw.log( 'flashEmbed: _local_ Seeking to ' + this.seek_time_sec );
16541654 this.fla.seek( this.seek_time_sec );
16551655 this.seek_time_sec = 0;
16561656 }
@@ -1661,7 +1661,7 @@
16621662 ( this.currentTime > ( mw.npt2seconds( this.end_ntp ) - 1 )
16631663 && this.prevTime == this.currentTime ) )
16641664 ) {
1665 - js_log( 'prbally reached end of stream: ' + mw.seconds2npt( this.currentTime ) );
 1665+ mw.log( 'prbally reached end of stream: ' + mw.seconds2npt( this.currentTime ) );
16661666 this.onClipDone();
16671667 }
16681668
@@ -1670,13 +1670,13 @@
16711671
16721672
16731673 this.prevTime = this.currentTime;
1674 - // js_log('cur perc loaded: ' + this.fla.getPercentLoaded() +' cur time : ' + (this.currentTime - mw.npt2seconds(this.start_ntp)) +' / ' +(mw.npt2seconds(this.end_ntp)-mw.npt2seconds(this.start_ntp)));
 1674+ // mw.log('cur perc loaded: ' + this.fla.getPercentLoaded() +' cur time : ' + (this.currentTime - mw.npt2seconds(this.start_ntp)) +' / ' +(mw.npt2seconds(this.end_ntp)-mw.npt2seconds(this.start_ntp)));
16751675 },
16761676 restorePlayer:function() {
16771677 if ( !this.fla )
16781678 this.getFLA();
16791679 if ( this.fla ) {
1680 - js_log( 'f:do restorePlayer' );
 1680+ mw.log( 'f:do restorePlayer' );
16811681 this.fla.setVolume( 90 );
16821682 $f().getPlugin( 'screen' ).css( { 'opacity':'1.0' } );
16831683 // set the fallback date restore flag to true:
@@ -1688,7 +1688,7 @@
16891689 this.fla = $f( this.pid );
16901690 },
16911691 stop : function() {
1692 - js_log( 'f:flashEmbed:stop' );
 1692+ mw.log( 'f:flashEmbed:stop' );
16931693 this.startedTimedPlayback = false;
16941694 if ( this.monitorTimerId != 0 )
16951695 {
@@ -1700,7 +1700,7 @@
17011701 this.parent_stop();
17021702 },
17031703 onStop: function() {
1704 - js_log( 'f:onStop' );
 1704+ mw.log( 'f:onStop' );
17051705 // stop updates:
17061706 if ( this.monitorTimerId != 0 )
17071707 {
@@ -1709,13 +1709,13 @@
17101710 }
17111711 },
17121712 onClipDone: function() {
1713 - js_log( 'f:flash:onClipDone' );
 1713+ mw.log( 'f:flash:onClipDone' );
17141714 if ( ! this.startedTimedPlayback ) {
1715 - js_log( 'clip done before timed playback started .. not good. (ignoring) ' );
 1715+ mw.log( 'clip done before timed playback started .. not good. (ignoring) ' );
17161716 // keep monitoring:
17171717 this.monitor();
17181718 } else {
1719 - js_log( 'clip done and ' + this.startedTimedPlayback );
 1719+ mw.log( 'clip done and ' + this.startedTimedPlayback );
17201720 // stop the clip if its not stopped already:
17211721 this.stop();
17221722 this.setStatus( "Clip Done..." );
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/htmlEmbed.js
@@ -45,7 +45,7 @@
4646 // call the parent
4747 this.parent_play();
4848
49 - js_log( 'f:play: htmlEmbedWrapper' );
 49+ mw.log( 'f:play: htmlEmbedWrapper' );
5050 var ct = new Date();
5151 this.clockStartTime = ct.getTime();
5252
@@ -65,10 +65,10 @@
6666 * Preserves the pause time across for timed playback
6767 */
6868 pause:function() {
69 - js_log( 'f:pause: htmlEmbedWrapper' );
 69+ mw.log( 'f:pause: htmlEmbedWrapper' );
7070 var ct = new Date();
7171 this.pauseTime = this.currentTime;
72 - js_log( 'pause time: ' + this.pauseTime );
 72+ mw.log( 'pause time: ' + this.pauseTime );
7373
7474 window.clearInterval( this.monitorTimerId );
7575 },
@@ -99,11 +99,11 @@
100100 * Monitor tracks of virtual player time
101101 */
102102 monitor:function() {
103 - //js_log('html:monitor: '+ this.currentTime);
 103+ //mw.log('html:monitor: '+ this.currentTime);
104104 var ct = new Date();
105105 this.currentTime = ( ( ct.getTime() - this.clockStartTime ) / 1000 ) + this.pauseTime;
106106 var ct = new Date();
107 - // js_log('mvPlayList:monitor trueTime: '+ this.currentTime);
 107+ // mw.log('mvPlayList:monitor trueTime: '+ this.currentTime);
108108
109109 // Once currentTime is updated call parent_monitor
110110 this.parent_monitor();
@@ -140,7 +140,7 @@
141141 * @param {Object} options Thumbnail options
142142 */
143143 renderTimelineThumbnail:function( options ) {
144 - js_log( "HTMLembed req w, height: " + options.width + ' ' + options.height );
 144+ mw.log( "HTMLembed req w, height: " + options.width + ' ' + options.height );
145145 // generate a scaled down version _that_ we can clone if nessisary
146146 // add a not vissiable container to the body:
147147 var do_refresh = ( typeof options['refresh'] != 'undefined' ) ? true:false;
@@ -151,7 +151,7 @@
152152 // Set the font scale down percentage: (kind of arbitrary)
153153 var scale_perc = options.width / this.pc.pp.width;
154154
155 - js_log( 'scale_perc:' + options.width + ' / ' + $j( this ).width() + ' = ' + scale_perc );
 155+ mw.log( 'scale_perc:' + options.width + ' / ' + $j( this ).width() + ' = ' + scale_perc );
156156
157157 // Min scale font percent of 70 (overflow is hidden)
158158 var font_perc = ( Math.round( scale_perc * 100 ) < 80 ) ? 80 : Math.round( scale_perc * 100 );
@@ -200,7 +200,7 @@
201201 * Get the "embed" html for the html player
202202 */
203203 getEmbedHTML:function() {
204 - js_log( 'f:html:getEmbedHTML: ' + this.id );
 204+ mw.log( 'f:html:getEmbedHTML: ' + this.id );
205205 // set up the css for our parent div:
206206 $j( this ).css( {
207207 'width':this.pc.pp.width,
@@ -223,14 +223,14 @@
224224 opt = { };
225225 var height = ( opt.height ) ? opt.height:this.pc.pp.height;
226226 var width = ( opt.width ) ? opt.width: this.pc.pp.width;
227 - js_log( '1req ' + opt.height + ' but got: ' + height );
 227+ mw.log( '1req ' + opt.height + ' but got: ' + height );
228228 if ( this.pc.type == 'image/jpeg' || this.pc.type == 'image/png' ) {
229 - js_log( 'should put src: ' + this.pc.src );
 229+ mw.log( 'should put src: ' + this.pc.src );
230230 out = '<img style="width:' + width + 'px;height:' + height + 'px" src="' + this.pc.src + '">';
231231 } else {
232232 out = this.pc.wholeText;
233233 }
234 - // js_log('f:getThumbnailHTML: got thumb: '+out);
 234+ // mw.log('f:getThumbnailHTML: got thumb: '+out);
235235 return out;
236236 },
237237
@@ -238,7 +238,7 @@
239239 * re-show the Thumbnail
240240 */
241241 showThumbnail:function() {
242 - js_log( 'htmlEmbed:showThumbnail()' );
 242+ mw.log( 'htmlEmbed:showThumbnail()' );
243243 this.getEmbedHTML();
244244 },
245245
@@ -246,7 +246,7 @@
247247 * Display the "embed" html right away
248248 */
249249 getHTML:function() {
250 - js_log( 'htmlEmbed::getHTML() ' + this.id );
 250+ mw.log( 'htmlEmbed::getHTML() ' + this.id );
251251 this.getEmbedHTML();
252252 },
253253
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/vlcEmbed.js
@@ -46,7 +46,7 @@
4747 'style="width:' + this.width + 'px;height:' + this.height + 'px;" ' +
4848 '>' +
4949 '</object>';
50 - js_log( 'embed with: ' + embed_code );
 50+ mw.log( 'embed with: ' + embed_code );
5151 return embed_code;
5252 },
5353
@@ -63,13 +63,13 @@
6464 this.vlc.playlist.items.clear();
6565 var src = mw.absoluteUrl( this.getSrc() ) ;
6666 // @@todo if client supports seeking no need to send seek_offset to URI
67 - js_log( 'vlc play::' + src );
 67+ mw.log( 'vlc play::' + src );
6868 var itemId = this.vlc.playlist.add( src );
6969 if ( itemId != -1 ) {
7070 // play
7171 this.vlc.playlist.playItem( itemId );
7272 } else {
73 - js_log( "error:cannot play at the moment !" );
 73+ mw.log( "error:cannot play at the moment !" );
7474 }
7575 // if controls enabled start up javascript interface and monitor:
7676 if ( this.controls ) {
@@ -79,12 +79,12 @@
8080 }
8181 setTimeout( '$j(\'#' + this.id + '\').get(0).monitor()', 100 );
8282 } else {
83 - js_log( 'postEmbedJS:vlc not ready' );
 83+ mw.log( 'postEmbedJS:vlc not ready' );
8484 this.pejs_count++;
8585 if ( this.pejs_count < 10 ) {
8686 setTimeout( 'document.getElementById(\'' + this.id + '\').postEmbedJS()', 100 );
8787 } else {
88 - js_log( 'vlc never ready' );
 88+ mw.log( 'vlc never ready' );
8989 }
9090 }
9191 },
@@ -95,7 +95,7 @@
9696 this.parent_doSeek( perc );
9797 } else if ( this.vlc ) {
9898 this.seeking = true;
99 - js_log( "do vlc http seek to: " + perc )
 99+ mw.log( "do vlc http seek to: " + perc )
100100 if ( ( this.vlc.input.state == 3 ) && ( this.vlc.input.position != perc ) )
101101 {
102102 this.vlc.input.position = perc;
@@ -107,7 +107,7 @@
108108 this.parent_monitor();
109109 },
110110 doPlayThenSeek:function( perc ) {
111 - js_log( 'doPlayThenSeekHack' );
 111+ mw.log( 'doPlayThenSeekHack' );
112112 var _this = this;
113113 this.play();
114114 var rfsCount = 0;
@@ -123,7 +123,7 @@
124124 setTimeout( readyForSeek, 50 );
125125 rfsCount++;
126126 } else {
127 - js_log( 'error:doPlayThenSeek failed' );
 127+ mw.log( 'error:doPlayThenSeek failed' );
128128 }
129129 }
130130 }
@@ -141,9 +141,9 @@
142142 if ( !this.vlc )
143143 return ;
144144 if ( this.vlc.log ) {
145 - // js_log( 'state:' + this.vlc.input.state);
146 - // js_log('time: ' + this.vlc.input.time);
147 - // js_log('pos: ' + this.vlc.input.position);
 145+ // mw.log( 'state:' + this.vlc.input.state);
 146+ // mw.log('time: ' + this.vlc.input.time);
 147+ // mw.log('pos: ' + this.vlc.input.position);
148148 if ( this.vlc.log.messages.count > 0 ) {
149149 // there is one or more messages in the log
150150 var iter = this.vlc.log.messages.iterator();
@@ -152,7 +152,7 @@
153153 var msgtype = msg.type.toString();
154154 if ( ( msg.severity == 1 ) && ( msgtype == "input" ) )
155155 {
156 - js_log( msg.message );
 156+ mw.log( msg.message );
157157 }
158158 }
159159 // clear the log once finished to avoid clogging
@@ -210,7 +210,7 @@
211211 // for now trust the duration from url over vlc input.length
212212 if ( !this.getDuration() && this.vlc.input.length > 0 )
213213 {
214 - // js_log('setting duration to ' + this.vlc.input.length /1000);
 214+ // mw.log('setting duration to ' + this.vlc.input.length /1000);
215215 this.duration = this.vlc.input.length / 1000;
216216 }
217217 this.currentTime = this.vlc.input.time / 1000;
@@ -219,13 +219,13 @@
220220 this.parent_pause(); // update the inteface if paused via native control
221221 },
222222 onStop: function() {
223 - js_log( 'vlc:onStop:' );
 223+ mw.log( 'vlc:onStop:' );
224224 if ( !this.seeking )
225225 this.onClipDone();
226226 },
227227 /* js hooks/controls */
228228 play : function() {
229 - js_log( 'f:vlcPlay' );
 229+ mw.log( 'f:vlcPlay' );
230230 this.getVLC();
231231 // call the parent
232232 this.parent_play();
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvPlayList.js
@@ -89,7 +89,7 @@
9090 'playlist_swap_loader':true // if the object supports playlist functions
9191 },
9292 init : function( element ) {
93 - js_log( 'mvPlayList:init:' );
 93+ mw.log( 'mvPlayList:init:' );
9494 this.tracks = { };
9595 this.default_track = null;
9696
@@ -102,10 +102,10 @@
103103 for ( var attr in mv_default_playlist_attributes ) {
104104 if ( element.getAttribute( attr ) ) {
105105 this[attr] = element.getAttribute( attr );
106 - // js_log('attr:' + attr + ' val: ' + video_attributes[attr] +" "+'elm_val:' + element.getAttribute(attr) + "\n (set by elm)");
 106+ // mw.log('attr:' + attr + ' val: ' + video_attributes[attr] +" "+'elm_val:' + element.getAttribute(attr) + "\n (set by elm)");
107107 } else {
108108 this[attr] = mv_default_playlist_attributes[attr];
109 - // js_log('attr:' + attr + ' val: ' + video_attributes[attr] +" "+ 'elm_val:' + element.getAttribute(attr) + "\n (set by attr)");
 109+ // mw.log('attr:' + attr + ' val: ' + video_attributes[attr] +" "+ 'elm_val:' + element.getAttribute(attr) + "\n (set by attr)");
110110 }
111111 }
112112 // make sure height and width are int:
@@ -185,7 +185,7 @@
186186 },
187187
188188 getPlaylist:function() {
189 - js_log( "f:getPlaylist: " + this.srcType );
 189+ mw.log( "f:getPlaylist: " + this.srcType );
190190
191191 // Playlist:
192192 eval( 'var plObj = ' + this.srcType + 'Playlist;' );
@@ -194,11 +194,11 @@
195195 // js parent preservation for local overwritten methods
196196 if ( this[method] )this['parent_' + method] = this[method];
197197 this[method] = plObj[method];
198 - js_log( 'inherit:' + method );
 198+ mw.log( 'inherit:' + method );
199199 }
200200
201201 if ( typeof this.doParse != 'function' ) {
202 - js_log( 'error: method doParse not found in plObj' + this.srcType );
 202+ mw.log( 'error: method doParse not found in plObj' + this.srcType );
203203 return false;
204204 }
205205
@@ -206,7 +206,7 @@
207207 if ( this.doParse() ) {
208208 this.doWhenParseDone();
209209 } else {
210 - js_log( "error: failed to parse playlist" );
 210+ mw.log( "error: failed to parse playlist" );
211211 return false;
212212 // error or parse needs to do ajax requests
213213 }
@@ -221,7 +221,7 @@
222222 },
223223
224224 doWhenParseDone: function() {
225 - js_log( 'f:doWhenParseDone' );
 225+ mw.log( 'f:doWhenParseDone' );
226226 // do additional init for clips:
227227 var _this = this;
228228 var error = false;
@@ -237,7 +237,7 @@
238238 _this.clip_ready_count++;
239239 continue;
240240 }
241 - // js_log('clip sources count: '+ clip.embed.media_element.sources.length);
 241+ // mw.log('clip sources count: '+ clip.embed.media_element.sources.length);
242242 clip.embed.checkPlayerSources();
243243 if ( clip.embed.loading_external_data == false &&
244244 clip.embed.init_with_sources_loadedDone == false ) {
@@ -253,23 +253,23 @@
254254 this.load_error = error;
255255 this.is_ready = false;
256256 } else if ( _this.clip_ready_count == _this.getClipCount() ) {
257 - js_log( "done init all clips: " + _this.clip_ready_count + ' = ' + _this.getClipCount() );
 257+ mw.log( "done init all clips: " + _this.clip_ready_count + ' = ' + _this.getClipCount() );
258258 this.doWhenClipLoadDone();
259259 } else {
260 - js_log( "only " + _this.clip_ready_count + " clips done, scheduling callback:" );
 260+ mw.log( "only " + _this.clip_ready_count + " clips done, scheduling callback:" );
261261 setTimeout( function(){
262262 _this.doWhenParseDone()
263263 }, 100 );
264264 }
265265 },
266266 doWhenClipLoadDone:function() {
267 - js_log( 'mvPlaylist:doWhenClipLoadDone' );
 267+ mw.log( 'mvPlaylist:doWhenClipLoadDone' );
268268 this.ready_to_play = true;
269269 this.loading = false;
270270 this.showPlayer();
271271 },
272272 getDuration:function( regen ) {
273 - // js_log("GET PL DURRATION for : "+ this.tracks[this.default_track_id].clips.length + 'clips');
 273+ // mw.log("GET PL DURRATION for : "+ this.tracks[this.default_track_id].clips.length + 'clips');
274274 if ( !regen && this.pl_duration )
275275 return this.pl_duration;
276276
@@ -285,11 +285,11 @@
286286 durSum += clip.getDuration();
287287 }
288288 } else {
289 - js_log( "ERROR: clip " + clip.id + " not ready" );
 289+ mw.log( "ERROR: clip " + clip.id + " not ready" );
290290 }
291291 } );
292292 this.pl_duration = durSum;
293 - // js_log("return dur: " + this.pl_duration);
 293+ // mw.log("return dur: " + this.pl_duration);
294294 return this.pl_duration;
295295 },
296296 getTimeRange:function() {
@@ -297,7 +297,7 @@
298298 return '0:0:0/' + mw.seconds2npt( this.getDuration() );
299299 },
300300 getDataSource:function() {
301 - js_log( "f:getDataSource " + this.src );
 301+ mw.log( "f:getDataSource " + this.src );
302302 // determine the type / first is it m3u or xml?
303303 var pl_parent = this;
304304 this.makeURLAbsolute();
@@ -312,12 +312,12 @@
313313 return this.src;
314314 },
315315 getSourceType:function() {
316 - js_log( 'data type of: ' + this.src + ' = ' + typeof ( this.data ) + "\n" + this.data );
 316+ mw.log( 'data type of: ' + this.src + ' = ' + typeof ( this.data ) + "\n" + this.data );
317317 this.srcType = null;
318318 // if not external use different detection matrix
319319 if ( this.loading_external_data ) {
320320 if ( typeof this.data == 'object' ) {
321 - js_log( 'object' );
 321+ mw.log( 'object' );
322322 // object assume xml (either xspf or rss)
323323 plElm = this.data.getElementsByTagName( 'playlist' )[0];
324324 if ( plElm ) {
@@ -339,10 +339,10 @@
340340 this.srcType = 'smil';
341341 }
342342 } else if ( typeof this.data == 'string' ) {
343 - js_log( 'String' );
 343+ mw.log( 'String' );
344344 // look at the first line:
345345 var first_line = this.data.substring( 0, this.data.indexOf( "\n" ) );
346 - js_log( 'first line: ' + first_line );
 346+ mw.log( 'first line: ' + first_line );
347347 // string
348348 if ( first_line.indexOf( '#EXTM3U' ) != -1 ) {
349349 this.srcType = 'm3u';
@@ -353,11 +353,11 @@
354354 }
355355 }
356356 if ( this.srcType ) {
357 - js_log( 'is of type:' + this.srcType );
 357+ mw.log( 'is of type:' + this.srcType );
358358 this.getPlaylist();
359359 } else {
360360 // unknown playlist type
361 - js_log( 'unknown playlist type?' );
 361+ mw.log( 'unknown playlist type?' );
362362 if ( this.src ) {
363363 this.innerHTML = 'error: unknown playlist type at url:<br> ' + this.src;
364364 } else {
@@ -393,7 +393,7 @@
394394 // inherits all the properties
395395 // swaps in the playlist object html/interface div
396396 showPlayer:function() {
397 - js_log( 'mvPlaylist:showPlayer: loading:' + this.loading );
 397+ mw.log( 'mvPlaylist:showPlayer: loading:' + this.loading );
398398 if ( this.loading ) {
399399 $j( '#' + this.id ).html( 'loading playlist...' );
400400 if ( this.loading_external_data ) {
@@ -414,7 +414,7 @@
415415 }
416416 },
417417 renderDisplay:function() {
418 - js_log( 'mvPlaylist:renderDisplay:: track length: ' + this.default_track.getClipCount() );
 418+ mw.log( 'mvPlaylist:renderDisplay:: track length: ' + this.default_track.getClipCount() );
419419 var _this = this;
420420
421421 // append container and videoPlayer;
@@ -452,7 +452,7 @@
453453 this.doSmilActions();
454454 },
455455 setupClipDisplay:function() {
456 - js_log( 'mvPlaylist:setupClipDisplay:: clip len:' + this.default_track.clips.length );
 456+ mw.log( 'mvPlaylist:setupClipDisplay:: clip len:' + this.default_track.clips.length );
457457 var _this = this;
458458 $j.each( this.default_track.clips, function( i, clip ) {
459459 var cout = '<div class="clip_container cc_" id="clipDesc_' + clip.id + '" ' +
@@ -478,10 +478,10 @@
479479 'left':"0px"
480480 } );
481481 if ( $j( '#clipDesc_' + clip.id ).length != 0 ) {
482 - js_log( "should set: #clipDesc_" + clip.id + ' to: ' + $j( clip.embed ).html() )
 482+ mw.log( "should set: #clipDesc_" + clip.id + ' to: ' + $j( clip.embed ).html() )
483483 $j( '#clipDesc_' + clip.id ).append( clip.embed );
484484 } else {
485 - js_log( 'cound not find: clipDesc_' + clip.id );
 485+ mw.log( 'cound not find: clipDesc_' + clip.id );
486486 }
487487 } );
488488 if ( this.cur_clip )
@@ -496,7 +496,7 @@
497497 // update display & cur_clip:
498498 var pl_sum_time = 0;
499499 var clip_float_sec = 0;
500 - // js_log('seeking clip: ');
 500+ // mw.log('seeking clip: ');
501501 for ( var i in this.default_track.clips ) {
502502 var clip = this.default_track.clips[i];
503503 if ( ( clip.getDuration() + pl_sum_time ) >= float_sec ) {
@@ -522,7 +522,7 @@
523523 },
524524 updateBaseStatus:function() {
525525 var _this = this;
526 - js_log( 'Playlist:updateBaseStatus' );
 526+ mw.log( 'Playlist:updateBaseStatus' );
527527
528528 $j( '#ptitle_' + this.id ).html( '' +
529529 '<b>' + this.title + '</b> ' +
@@ -552,13 +552,13 @@
553553 updatePlayHead:function( value ) {
554554 // slider is on 1000 scale:
555555 var val = parseInt( value * 1000 );
556 - //js_log( 'update slider: #' + this.id + ' .play_head to ' + val );
 556+ //mw.log( 'update slider: #' + this.id + ' .play_head to ' + val );
557557 $j( '#' + this.id + ' .play_head' ).slider( 'value', val );
558558 },
559559 getPlayHeadPos: function( prec_done ) {
560560 var _this = this;
561561 if ( $j( '#mv_seeker_' + this.id ).length == 0 ) {
562 - js_log( 'no playhead so we can\'t get playhead pos' );
 562+ mw.log( 'no playhead so we can\'t get playhead pos' );
563563 return 0;
564564 }
565565 var track_len = $j( '#mv_seeker_' + this.id ).css( 'width' ).replace( /px/ , '' );
@@ -585,12 +585,12 @@
586586 // handle offset hack @@todo fix so this is not needed:
587587 if ( perc_offset > .66 )
588588 perc_offset += ( 8 / track_len );
589 - // js_log('perc:'+ perc_offset +' c:'+ clip_perc + '*' + prec_done + ' v:'+(clip_perc*prec_done));
 589+ // mw.log('perc:'+ perc_offset +' c:'+ clip_perc + '*' + prec_done + ' v:'+(clip_perc*prec_done));
590590 return perc_offset + ( clip_perc * prec_done );
591591 },
592592 // attempts to load the embed object with the playlist
593593 loadEmbedPlaylist: function() {
594 - // js_log('load playlist');
 594+ // mw.log('load playlist');
595595 },
596596 /** mannages the loading of future clips
597597 * called regurally while we are playing clips
@@ -609,9 +609,9 @@
610610 if(curBuffredTime < 0)
611611 curBuffredTime = 0;
612612
613 - js_log( "curBuffredTime:: " + curBuffredTime );
 613+ mw.log( "curBuffredTime:: " + curBuffredTime );
614614 if( curBuffredTime < this.playlist_buffer_time ){
615 - js_log(" we only have " + curBuffredTime + ' buffed but we need: ' + this.playlist_buffer_time);
 615+ mw.log(" we only have " + curBuffredTime + ' buffed but we need: ' + this.playlist_buffer_time);
616616
617617 for(var inx = this.cur_clip.order + 1; inx < this.default_track.clips.length; inx++ ){
618618 var cClip = this.default_track.getClip( inx );
@@ -638,7 +638,7 @@
639639 var next_clip = this.getNextClip();
640640
641641 if ( !next_clip ) {
642 - js_log( 'play next with no next clip... must be done:' );
 642+ mw.log( 'play next with no next clip... must be done:' );
643643 this.onClipDone();
644644 return ;
645645 }
@@ -651,17 +651,17 @@
652652 this.cur_clip.embed.play();
653653 },
654654 onClipDone:function() {
655 - js_log( "pl onClipDone" );
 655+ mw.log( "pl onClipDone" );
656656 this.cur_clip.embed.stop();
657657 },
658658 updateCurrentClip : function( new_clip , into_perc) {
659 - js_log( 'f:updateCurrentClip:' + new_clip.id );
 659+ mw.log( 'f:updateCurrentClip:' + new_clip.id );
660660
661661 // keep the active play clip in sync (stop the other clip)
662662 if ( this.cur_clip ) {
663663 // make sure we are not switching to the current
664664 if ( this.cur_clip.id == new_clip.id ) {
665 - js_log( 'trying to updateCurrentClip to same clip' );
 665+ mw.log( 'trying to updateCurrentClip to same clip' );
666666 return false;
667667 }
668668
@@ -693,7 +693,7 @@
694694 // advance the playhead to the previous clip
695695 var prev_clip = this.getPrevClip();
696696 if ( !prev_clip ) {
697 - js_log( "tried to play PrevClip with no prev Clip.. setting prev_clip to start clip" );
 697+ mw.log( "tried to play PrevClip with no prev Clip.. setting prev_clip to start clip" );
698698 prev_clip = this.start_clip;
699699 }
700700 // @@todo we could do something fancy like use playlist for sets of clips where supported.
@@ -706,7 +706,7 @@
707707 this.updateCurrentClip( prev_clip );
708708 this.cur_clip.embed.play();
709709 } else {
710 - js_log( 'do prev hard embed swap' );
 710+ mw.log( 'do prev hard embed swap' );
711711 this.switchPlayingClip( prev_clip );
712712 }
713713 },
@@ -715,7 +715,7 @@
716716 $j( '#mv_ebct_' + this.id ).empty();
717717 new_clip.embed.width = this.width;
718718 new_clip.embed.height = this.height;
719 - // js_log('set embed to: '+ new_clip.embed.getEmbedObj());
 719+ // mw.log('set embed to: '+ new_clip.embed.getEmbedObj());
720720 $j( '#mv_ebct_' + this.id ).html( new_clip.embed.getEmbedObj() );
721721 this.cur_clip = new_clip;
722722 // run js code:
@@ -724,7 +724,7 @@
725725 // playlist play
726726 play: function() {
727727 var _this = this;
728 - js_log( 'pl play' );
 728+ mw.log( 'pl play' );
729729 // hide the playlist play button:
730730 $j( this.id + ' .play-btn-large' ).hide();
731731
@@ -743,19 +743,19 @@
744744 // navtive support:
745745 // * pre-loads clips
746746 // * mv_playlist smil extension, manages transitions animations overlays etc.
747 - // js_log('clip obj supports playlist swap_loader (ie playlist controlled playback)');
 747+ // mw.log('clip obj supports playlist swap_loader (ie playlist controlled playback)');
748748 // @@todo pre-load each clip:
749749 // play all active clips (playlist_swap_loader can have more than one clip active)
750750 $j.each( this.activeClipList.getClipList(), function( inx, clip ) {
751751 clip.embed.play();
752752 } );
753753 } else if ( this.cur_clip.embed.supports['playlist_driver'] ) {
754 - // js_log('playlist_driver');
 754+ // mw.log('playlist_driver');
755755 // embedObject is feed the playlist info directly and manages next/prev
756756 this.cur_clip.embed.playMovieAt( this.cur_clip.order );
757757 } else {
758758 // not much playlist support just play the first clip:
759 - // js_log('basic play');
 759+ // mw.log('basic play');
760760 // play cur_clip
761761 this.cur_clip.embed.play();
762762 }
@@ -773,11 +773,11 @@
774774 this.cur_clip.embed.toggleMute();
775775 },
776776 pause:function() {
777 - // js_log('f:pause: playlist');
 777+ // mw.log('f:pause: playlist');
778778 var ct = new Date();
779779 this.pauseTime = this.currentTime;
780780 this.paused = true;
781 - // js_log('pause time: '+ this.pauseTime + ' call embed pause:');
 781+ // mw.log('pause time: '+ this.pauseTime + ' call embed pause:');
782782
783783 // pause all the active clips:
784784 $j.each( this.activeClipList.getClipList(), function( inx, clip ) {
@@ -798,10 +798,10 @@
799799 $j( '#volume_bar_' + this_id ).slider( 'value', 0 );
800800 this.updateVolumen( 0 );
801801 }
802 - js_log( 'f:toggleMute::' + this.muted );
 802+ mw.log( 'f:toggleMute::' + this.muted );
803803 },
804804 updateVolumen:function( perc ) {
805 - js_log( 'update volume not supported with current playback type' );
 805+ mw.log( 'update volume not supported with current playback type' );
806806 },
807807 fullscreen:function() {
808808 this.cur_clip.embed.fullscreen();
@@ -809,7 +809,7 @@
810810 // playlist stops playback for the current clip (and resets state for start clips)
811811 stop:function() {
812812 var _this = this;
813 - /*js_log("pl stop:"+ this.start_clip.id + ' c:'+this.cur_clip.id);
 813+ /*mw.log("pl stop:"+ this.start_clip.id + ' c:'+this.cur_clip.id);
814814 //if start clip
815815 if(this.start_clip.id!=this.cur_clip.id){
816816 //restore clipDesc visibility & hide desc for start clip:
@@ -858,7 +858,7 @@
859859 // FIXME still some issues with "stoping" and reseting the playlist
860860 },
861861 doSeek:function( v ) {
862 - js_log( 'pl:doSeek:' + v + ' sts:' + this.seek_time_sec );
 862+ mw.log( 'pl:doSeek:' + v + ' sts:' + this.seek_time_sec );
863863 var _this = this;
864864
865865 var time = v * this.getDuration()
@@ -872,7 +872,7 @@
873873 return '';
874874 },
875875 setCurrentTime: function( time, callback ) {
876 - js_log( 'pl:setCurrentTime:' + time );
 876+ mw.log( 'pl:setCurrentTime:' + time );
877877 var _this = this;
878878 _this.currentTime = time;
879879
@@ -903,9 +903,9 @@
904904 for ( var i in _this.default_track.clips ) {
905905 var clip = _this.default_track.clips[i];
906906 next_perc_offset += ( clip.getDuration() / _this.getDuration() ) ;
907 - // js_log('on ' + clip.getDuration() +' next_perc_offset:'+ next_perc_offset);
 907+ // mw.log('on ' + clip.getDuration() +' next_perc_offset:'+ next_perc_offset);
908908 if ( next_perc_offset > pt ) {
909 - // js_log('seek:'+ pt +' - '+perc_offset + ') / (' + next_perc_offset +' - '+ perc_offset);
 909+ // mw.log('seek:'+ pt +' - '+perc_offset + ') / (' + next_perc_offset +' - '+ perc_offset);
910910 var relative_perc = ( pt - perc_offset ) / ( next_perc_offset - perc_offset );
911911 // update the current clip:
912912 _this.updateCurrentClip( clip, relative_perc );
@@ -940,12 +940,12 @@
941941 var cur_pixle = 0;
942942 // set up _this
943943
944 - // js_log("do play head total dur: "+pl_duration );
 944+ // mw.log("do play head total dur: "+pl_duration );
945945 $j.each( this.default_track.clips, function( i, clip ) {
946946 // (use getSoloDuration to not include transitions and such)
947947 var perc = ( clip.getSoloDuration() / pl_duration );
948948 var pwidth = Math.round( perc * _this.track_len );
949 - // js_log('pstatus:c:'+ clip.getDuration() + ' of '+ pl_duration+' %:' + perc + ' width: '+ pwidth + ' of total: ' + _this.track_len);
 949+ // mw.log('pstatus:c:'+ clip.getDuration() + ' of '+ pl_duration+' %:' + perc + ' width: '+ pwidth + ' of total: ' + _this.track_len);
950950 // var pwidth = Math.round( perc * _this.track_len - (_this.mv_seeker_width*perc) );
951951
952952 // add the buffer child indicator:
@@ -967,13 +967,13 @@
968968
969969 $j( '#' + _this.id + ' .play_head' ).append( barHtml );
970970
971 - // js_log('offset:' + cur_pixle +' width:'+pwidth+' add clip'+ clip.id + ' is '+clip.embed.getDuration() +' = ' + perc +' of ' + _this.track_len);
 971+ // mw.log('offset:' + cur_pixle +' width:'+pwidth+' add clip'+ clip.id + ' is '+clip.embed.getDuration() +' = ' + perc +' of ' + _this.track_len);
972972 cur_pixle += pwidth;
973973 } );
974974 },
975975 // @@todo currently not really in use
976976 setUpHover:function() {
977 - js_log( 'Setup Hover' );
 977+ mw.log( 'Setup Hover' );
978978 // set up hover for prev,next
979979 var th = 50;
980980 var tw = th * this.pl_layout.clip_aspect;
@@ -981,10 +981,10 @@
982982 $j( '#mv_prev_link_' + _this.id + ',#mv_next_link_' + _this.id ).hover( function() {
983983 var clip = ( this.id == 'mv_prev_link_' + _this.id ) ? _this.getPrevClip() : _this.getNextClip();
984984 if ( !clip )
985 - return js_log( 'missing clip for Hover' );
 985+ return mw.log( 'missing clip for Hover' );
986986 // get the position of #mv_perv|next_link:
987987 var loc = getAbsolutePos( this.id );
988 - // js_log('Hover: x:'+loc.x + ' y:' + loc.y + ' :'+clip.img);
 988+ // mw.log('Hover: x:'+loc.x + ' y:' + loc.y + ' :'+clip.img);
989989 $j( "body" ).append( '<div id="mv_Athub" style="position:absolute;' +
990990 'top:' + loc.y + 'px;left:' + loc.x + 'px;width:' + tw + 'px;height:' + th + 'px;">' +
991991 '<img style="border:solid 2px ' + clip.getColor() + ';position:absolute;top:0px;left:0px;" width="' + tw + '" height="' + th + '" src="' + clip.img + '"/>' +
@@ -1022,7 +1022,7 @@
10231023 } else {
10241024 var track = this.tracks[ clipObj.track_id ]
10251025 }
1026 - js_log( 'add clip:' + clipObj.id + ' to track: at:' + pos );
 1026+ mw.log( 'add clip:' + clipObj.id + ' to track: at:' + pos );
10271027 // set the first clip to current (maybe deprecated )
10281028 if ( clipObj.order == 0 ) {
10291029 if ( !this.cur_clip )this.cur_clip = clipObj;
@@ -1032,9 +1032,9 @@
10331033 swapClipDesc: function( req_clipID, callback ) {
10341034 // hide all but the requested
10351035 var _this = this;
1036 - js_log( 'r:' + req_clipID + ' cur:' + _this.id );
 1036+ mw.log( 'r:' + req_clipID + ' cur:' + _this.id );
10371037 if ( req_clipID == _this.cur_clip.id ) {
1038 - js_log( 'no swap to same clip' );
 1038+ mw.log( 'no swap to same clip' );
10391039 } else {
10401040 // fade out clips
10411041 req_clip = null;
@@ -1058,7 +1058,7 @@
10591059 },
10601060 // this is pretty outdated:
10611061 getPLControls: function() {
1062 - js_log( 'getPL cont' );
 1062+ mw.log( 'getPL cont' );
10631063 return '<a id="mv_prev_link_' + this.id + '" title="Previus Clip" onclick="document.getElementById(\'' + this.id + '\').playPrev();return false;" href="#">' +
10641064 getTransparentPng( { id:'mv_prev_btn_' + this.id, style:'float:left', width:'27', height:'27', border:"0",
10651065 src: mw.getConfig( 'skin_img_path' ) + 'vid_prev_sm.png' } ) +
@@ -1120,14 +1120,14 @@
11211121 for ( var i in o ) {
11221122 this[i] = o[i];
11231123 };
1124 - js_log( 'id is: ' + this.id );
 1124+ mw.log( 'id is: ' + this.id );
11251125 },
11261126 // setup the embed object:
11271127 setUpEmbedObj:function() {
1128 - js_log( 'mvClip:setUpEmbedObj()' );
 1128+ mw.log( 'mvClip:setUpEmbedObj()' );
11291129
11301130 this.embed = null;
1131 - // js_log('setup embed for clip '+ this.id + ':id is a function?');
 1131+ // mw.log('setup embed for clip '+ this.id + ':id is a function?');
11321132 // set up the pl_mwEmbed object:
11331133 var init_pl_embed = { id:'e_' + this.id,
11341134 pc:this, // parent clip
@@ -1152,12 +1152,12 @@
11531153
11541154 this.embed = new PlMvEmbed( init_pl_embed );
11551155
1156 - // js_log('media Duration:' + this.embed.getDuration() );
1157 - // js_log('media element:'+ this.embed.media_element.length);
1158 - // js_log('type of embed:' + typeof(this.embed) + ' seq:' + this.pp.sequencer+' pb:'+ this.embed.play_button);
 1156+ // mw.log('media Duration:' + this.embed.getDuration() );
 1157+ // mw.log('media element:'+ this.embed.media_element.length);
 1158+ // mw.log('type of embed:' + typeof(this.embed) + ' seq:' + this.pp.sequencer+' pb:'+ this.embed.play_button);
11591159 },
11601160 doAdjust:function( side, delta ) {
1161 - js_log( "f:doAdjust: " + side + ' , ' + delta );
 1161+ mw.log( "f:doAdjust: " + side + ' , ' + delta );
11621162 if ( this.embed ) {
11631163 if ( side == 'start' ) {
11641164 var startOffset = parseInt( this.embed.startOffset ) + parseInt( delta * -1 );
@@ -1169,7 +1169,7 @@
11701170 // update everything:
11711171 this.pp.refresh();
11721172 /*var base_src = this.src.substr(0,this.src.indexOf('?'));
1173 - js_log("delta:"+ delta);
 1173+ mw.log("delta:"+ delta);
11741174 if(side=='start'){
11751175 //since we adjust start invert the delta:
11761176 var startOffset =parseInt(this.embed.startOffset/1000)+parseInt(delta*-1);
@@ -1201,7 +1201,7 @@
12021202 // output the detail view:
12031203 // @@todo
12041204 /*getDetail:function(){
1205 - //js_log('get detail:' + this.pp.title);
 1205+ //mw.log('get detail:' + this.pp.title);
12061206 var th=Math.round( this.pl_layout.clip_desc * this.pp.height );
12071207 var tw=Math.round( th * this.pl_layout.clip_aspect );
12081208
@@ -1216,7 +1216,7 @@
12171217
12181218 $j(this.embed).css({ 'position':"absolute",'top':"0px", 'left':"0px"});
12191219
1220 - //js_log('append child to:#clipDesc_'+this.id);
 1220+ //mw.log('append child to:#clipDesc_'+this.id);
12211221 if($j('#clipDesc_'+this.id).get(0)){
12221222 $j('#clipDesc_'+this.id).get(0).appendChild(this.embed);
12231223
@@ -1235,7 +1235,7 @@
12361236 return 'untitled clip ' + this.order;
12371237 },
12381238 getClipImg:function( startOffset, size ) {
1239 - js_log( 'f:getClipImg ' + startOffset + ' s:' + size );
 1239+ mw.log( 'f:getClipImg ' + startOffset + ' s:' + size );
12401240 if ( !this.img ) {
12411241 return mv_default_thumb_url;
12421242 } else {
@@ -1244,9 +1244,9 @@
12451245 } else {
12461246 // if a metavid image (has request parameters) use size and time args
12471247 if ( this.img.indexOf( '?' ) != -1 ) {
1248 - js_log( 'get with offset: ' + startOffset );
 1248+ mw.log( 'get with offset: ' + startOffset );
12491249 var time = mw.seconds2npt( startOffset + ( this.embed.startOffset / 1000 ) );
1250 - js_log( "time is: " + time );
 1250+ mw.log( "time is: " + time );
12511251 this.img = this.img.replace( /t\=[^&]*/gi, "t=" + time );
12521252 if ( this.img.indexOf( '&size=' ) != -1 ) {
12531253 this.img = this.img.replace( /size=[^&]*/gi, "size=" + size );
@@ -1259,7 +1259,7 @@
12601260 }
12611261 },
12621262 getColor: function() {
1263 - // js_log('get color:'+ num +' : '+ num.toString().substr(num.length-1, 1) + ' : '+colors[ num.toString().substr(num.length-1, 1)] );
 1263+ // mw.log('get color:'+ num +' : '+ num.toString().substr(num.length-1, 1) + ' : '+colors[ num.toString().substr(num.length-1, 1)] );
12641264 var num = this.id.substr( this.id.length - 1, 1 );
12651265 if ( !isNaN( num ) ) {
12661266 num = num.charCodeAt( 0 );
@@ -1270,7 +1270,7 @@
12711271 }
12721272 /* mwEmbed extensions for playlists */
12731273 var PlMvEmbed = function( vid_init ) {
1274 - // js_log('PlMvEmbed: '+ vid_init.id);
 1274+ // mw.log('PlMvEmbed: '+ vid_init.id);
12751275 // create the div container
12761276 var ve = document.createElement( 'div' );
12771277 // extend ve with all this
@@ -1280,7 +1280,7 @@
12811281 ve[method] = this[method];
12821282 }
12831283 }
1284 - js_log( 've src len:' + ve.media_element.sources.length );
 1284+ mw.log( 've src len:' + ve.media_element.sources.length );
12851285 return ve;
12861286 }
12871287 // all the overwritten and new methods for playlist extension of baseEmbed
@@ -1313,12 +1313,12 @@
13141314 }
13151315 },
13161316 onClipDone:function() {
1317 - js_log( 'pl onClipDone (should go to next)' );
 1317+ mw.log( 'pl onClipDone (should go to next)' );
13181318 // go to next in playlist:
13191319 this.pc.pp.playNext();
13201320 },
13211321 stop:function() {
1322 - js_log( 'pl:do stop' );
 1322+ mw.log( 'pl:do stop' );
13231323 // set up convenience pointer to parent playlist
13241324 var _this = this.pc.pp;
13251325
@@ -1332,7 +1332,7 @@
13331333 this.showPlayer();
13341334 },
13351335 play:function() {
1336 - // js_log('pl eb play');
 1336+ // mw.log('pl eb play');
13371337 var _this = this.pc.pp;
13381338 // check if we are already playing
13391339 if ( !this.thumbnail_disp ) {
@@ -1363,7 +1363,7 @@
13641364 // status updates handled by playlist obj
13651365 },
13661366 updatePlayHead:function( value ) {
1367 - //js_log( 'PlMvEmbed:updatePlayHead:' + value );
 1367+ //mw.log( 'PlMvEmbed:updatePlayHead:' + value );
13681368 // updatePlayHead handled by playlist obj
13691369 }
13701370 }
@@ -1376,17 +1376,17 @@
13771377 // for each line not # add as clip
13781378 var inx = 0;
13791379 var this_pl = this;
1380 - // js_log('data:'+ this.data.toString());
 1380+ // mw.log('data:'+ this.data.toString());
13811381 $j.each( this.data.split( "\n" ), function( i, n ) {
1382 - // js_log('on line '+i+' val:'+n+' len:'+n.length);
 1382+ // mw.log('on line '+i+' val:'+n+' len:'+n.length);
13831383 if ( n.charAt( 0 ) != '#' ) {
13841384 if ( n.length > 3 ) {
13851385 // @@todo make sure its a valid url
1386 - // js_log('add url: '+i + ' '+ n);
 1386+ // mw.log('add url: '+i + ' '+ n);
13871387 var cur_clip = new mvClip( { type:'srcClip', id:'p_' + this_pl.id + '_c_' + inx, pp:this_pl, src:n, order:inx } );
13881388 // setup the embed object
13891389 cur_clip.setUpEmbedObj();
1390 - js_log( 'm3uPlaylist len:' + thisClip.embed.media_element.sources.length );
 1390+ mw.log( 'm3uPlaylist len:' + thisClip.embed.media_element.sources.length );
13911391 this_pl.addCliptoTrack( cur_clip );
13921392 inx++;
13931393 }
@@ -1406,7 +1406,7 @@
14071407 tmpElm = this.data.getElementsByTagName( properties[i] )[0];
14081408 if ( tmpElm ) {
14091409 this[i] = tmpElm.childNodes[0].nodeValue;
1410 - // js_log('set '+i+' to '+this[i]);
 1410+ // mw.log('set '+i+' to '+this[i]);
14111411 }
14121412 }
14131413 // image src is nested in itunes rss:
@@ -1426,7 +1426,7 @@
14271427 tmpElm = clips[i].getElementsByTagName( properties[j] )[0];
14281428 if ( tmpElm != null ) {
14291429 cur_clip[j] = tmpElm.childNodes[0].nodeValue;
1430 - // js_log('set clip property: ' + j+' to '+cur_clip[j]);
 1430+ // mw.log('set clip property: ' + j+' to '+cur_clip[j]);
14311431 }
14321432 }
14331433 // image is nested
@@ -1453,36 +1453,36 @@
14541454 */
14551455 var xspfPlaylist = {
14561456 doParse:function() {
1457 - // js_log('do xsfp parse: '+ this.data.innerHTML);
 1457+ // mw.log('do xsfp parse: '+ this.data.innerHTML);
14581458 var properties = { title:'title', linkback:'info',
14591459 author:'creator', desc:'annotation',
14601460 poster:'image', date:'date' };
14611461 var tmpElm = null;
14621462 // get the first instance of any of the meta tags (ok that may be the meta on the first clip)
1463 - // js_log('do loop on properties:' + properties);
 1463+ // mw.log('do loop on properties:' + properties);
14641464 for ( i in properties ) {
1465 - js_log( 'on property: ' + i );
 1465+ mw.log( 'on property: ' + i );
14661466 tmpElm = this.data.getElementsByTagName( properties[i] )[0];
14671467 if ( tmpElm ) {
14681468 if ( tmpElm.childNodes[0] ) {
14691469 this[i] = tmpElm.childNodes[0].nodeValue;
1470 - js_log( 'set pl property: ' + i + ' to ' + this[i] );
 1470+ mw.log( 'set pl property: ' + i + ' to ' + this[i] );
14711471 }
14721472 }
14731473 }
14741474 var clips = this.data.getElementsByTagName( "track" );
1475 - js_log( 'found clips:' + clips.length );
 1475+ mw.log( 'found clips:' + clips.length );
14761476 // add any clip specific properties
14771477 properties.src = 'location';
14781478 for ( var i = 0; i < clips.length; i++ ) {
14791479 var cur_clip = new mvClip( { id:'p_' + this.id + '_c_' + i, pp:this, order:i } );
1480 - // js_log('cur clip:'+ cur_clip.id);
 1480+ // mw.log('cur clip:'+ cur_clip.id);
14811481 for ( var j in properties ) {
14821482 tmpElm = clips[i].getElementsByTagName( properties[j] )[0];
14831483 if ( tmpElm != null ) {
14841484 if ( tmpElm.childNodes.length != 0 ) {
14851485 cur_clip[j] = tmpElm.childNodes[0].nodeValue;
1486 - js_log( 'set clip property: ' + j + ' to ' + cur_clip[j] );
 1486+ mw.log( 'set clip property: ' + j + ' to ' + cur_clip[j] );
14871487 }
14881488 }
14891489 }
@@ -1500,7 +1500,7 @@
15011501 // add the current clip to the clip list
15021502 this.addCliptoTrack( cur_clip );
15031503 }
1504 - // js_log('done with parse');
 1504+ // mw.log('done with parse');
15051505 return true;
15061506 }
15071507 }
@@ -1509,13 +1509,13 @@
15101510 *****************************/
15111511 /*playlist driver extensions to the playlist object*/
15121512 mvPlayList.prototype.monitor = function() {
1513 - // js_log('pl:monitor');
 1513+ // mw.log('pl:monitor');
15141514 // if paused stop updates
15151515 if ( this.paused ) {
15161516 // clearInterval( this.smil_monitorTimerId );
15171517 return ;
15181518 }
1519 - // js_log("pl check: " + this.currentTime + ' > '+this.getDuration());
 1519+ // mw.log("pl check: " + this.currentTime + ' > '+this.getDuration());
15201520 // check if we should be done:
15211521 if ( this.currentTime > this.getDuration() )
15221522 this.stop();
@@ -1549,7 +1549,7 @@
15501550 // @@todo could be lazy loaded if necessary
15511551 mvPlayList.prototype.doSmilActions = function( callback ) {
15521552 var _this = this;
1553 - // js_log('f:doSmilActions: ' + this.cur_clip.id + ' tid: ' + this.cur_clip.transOut );
 1553+ // mw.log('f:doSmilActions: ' + this.cur_clip.id + ' tid: ' + this.cur_clip.transOut );
15541554 var offSetTime = 0; // offset time should let us start a transition later on if we have to.
15551555 var _clip = this.cur_clip; // setup a local pointer to cur_clip
15561556
@@ -1562,7 +1562,7 @@
15631563 if ( _clip.dur <= _clip.embed.currentTime
15641564 && _clip.order != _clip.pp.getClipCount() - 1 ) {
15651565 // force next clip
1566 - js_log( 'order:' + _clip.order + ' != count:' + ( _clip.pp.getClipCount() - 1 ) +
 1566+ mw.log( 'order:' + _clip.order + ' != count:' + ( _clip.pp.getClipCount() - 1 ) +
15671567 ' smil dur: ' + _clip.dur + ' <= curTime: ' + _clip.embed.currentTime + ' go to next clip..' );
15681568 // do a _play next:
15691569 _clip.pp.playNext();
@@ -1588,7 +1588,7 @@
15891589 eval( 'var tObj = _clip.' + tid );
15901590 if ( !tObj )
15911591 return;
1592 - // js_log('f:doSmilActions: ' + _clip.id + ' tid:'+tObj.id + ' tclip_id:'+ tObj.pClip.id);
 1592+ // mw.log('f:doSmilActions: ' + _clip.id + ' tid:'+tObj.id + ' tclip_id:'+ tObj.pClip.id);
15931593 // Check if we are in range:
15941594 if ( tid == 'transIn' )
15951595 in_range = ( _clip.embed.currentTime <= tObj.dur ) ? true : false;
@@ -1609,13 +1609,13 @@
16101610 callback );
16111611 }
16121612 } else if ( tObj.animation_state == 0 ) {
1613 - js_log( 'init/run_transition ' );
 1613+ mw.log( 'init/run_transition ' );
16141614 tObj.run_transition();
16151615 }
16161616 } else {
16171617 // Close up transition if done & still onDispaly
16181618 if ( tObj.overlay_selector_id ) {
1619 - js_log( 'close up transition :' + tObj.overlay_selector_id );
 1619+ mw.log( 'close up transition :' + tObj.overlay_selector_id );
16201620 mvTransLib.doCloseTransition( tObj );
16211621 }
16221622 }
@@ -1641,24 +1641,24 @@
16421642 * @param offSetTime default value 0 if we need to start rendering from a given time
16431643 */
16441644 doInitTransition:function( tObj ) {
1645 - js_log( 'mvTransLib:f:doInitTransition' );
 1645+ mw.log( 'mvTransLib:f:doInitTransition' );
16461646 if ( !tObj.type ) {
1647 - js_log( 'transition is missing type attribute' );
 1647+ mw.log( 'transition is missing type attribute' );
16481648 return false;
16491649 }
16501650
16511651 if ( !tObj.subtype ) {
1652 - js_log( 'transition is missing subtype attribute' );
 1652+ mw.log( 'transition is missing subtype attribute' );
16531653 return false;
16541654 }
16551655
16561656 if ( !this['type'][tObj.type] ) {
1657 - js_log( 'mvTransLib does not support type: ' + tObj.type );
 1657+ mw.log( 'mvTransLib does not support type: ' + tObj.type );
16581658 return false;
16591659 }
16601660
16611661 if ( !this['type'][tObj.type][tObj.subtype] ) {
1662 - js_log( 'mvTransLib does not support subType: ' + tObj.subtype );
 1662+ mw.log( 'mvTransLib does not support subType: ' + tObj.subtype );
16631663 return false;
16641664 }
16651665
@@ -1670,7 +1670,7 @@
16711671 var other_pClip = tObj.pClip.pp.getNextClip();
16721672
16731673 if ( typeof( other_pClip ) == 'undefined' || other_pClip === false || other_pClip.id == tObj.pClip.pp.cur_clip.id )
1674 - js_log( 'Error: crossfade without target media asset' );
 1674+ mw.log( 'Error: crossfade without target media asset' );
16751675 // if not sliding start playback:
16761676 if ( !tObj.pClip.pp.userSlide && !tObj.pClip.pp.paused) {
16771677 other_pClip.embed.play();
@@ -1686,13 +1686,13 @@
16871687 }
16881688
16891689 // all good call function with tObj param
1690 - js_log( 'should call: ' + tObj.type + ' ' + tObj.subtype );
 1690+ mw.log( 'should call: ' + tObj.type + ' ' + tObj.subtype );
16911691 this['type'][tObj.type][tObj.subtype].init( tObj );
16921692 },
16931693 doCloseTransition:function( tObj ) {
16941694 if ( tObj.subtype == 'crossfade' ) {
16951695 // close up crossfade
1696 - js_log( "close up crossfade" );
 1696+ mw.log( "close up crossfade" );
16971697 } else {
16981698 $j( '#' + tObj.overlay_selector_id ).remove();
16991699 }
@@ -1701,7 +1701,7 @@
17021702 },
17031703 getOverlaySelector:function( tObj ) {
17041704 var overlay_selector_id = tObj.transAttrType + tObj.pClip.id;
1705 - js_log( 'f:getOverlaySelector: ' + overlay_selector_id + ' append to: ' + '#videoPlayer_' + tObj.pClip.embed.id );
 1705+ mw.log( 'f:getOverlaySelector: ' + overlay_selector_id + ' append to: ' + '#videoPlayer_' + tObj.pClip.embed.id );
17061706 // make sure overlay_selector_id not already here:
17071707 if ( $j( '#' + overlay_selector_id ).length == 0 ) {
17081708 $j( '#videoPlayer_' + tObj.pClip.embed.id ).prepend( '' +
@@ -1724,7 +1724,7 @@
17251725 $j( '#' + tObj.overlay_selector_id ).show();
17261726
17271727 // do update:
1728 - /* js_log('doing update for: '+ tObj.pClip.id +
 1728+ /* mw.log('doing update for: '+ tObj.pClip.id +
17291729 ' type:' + tObj.transAttrType +
17301730 ' t_type:'+ tObj.type +
17311731 ' subypte:'+ tObj.subtype +
@@ -1744,11 +1744,11 @@
17451745 fadeFromColor: {
17461746 'attr' : ['fadeColor'],
17471747 'init' : function( tObj ) {
1748 - // js_log('f:fadeFromColor: '+tObj.overlay_selector_id +' to color: '+ tObj.fadeColor);
 1748+ // mw.log('f:fadeFromColor: '+tObj.overlay_selector_id +' to color: '+ tObj.fadeColor);
17491749 if ( !tObj.fadeColor )
1750 - js_log( 'missing fadeColor' );
 1750+ mw.log( 'missing fadeColor' );
17511751 if ( $j( '#' + tObj.overlay_selector_id ).length == 0 ) {
1752 - js_log( "ERROR can't find: " + tObj.overlay_selector_id );
 1752+ mw.log( "ERROR can't find: " + tObj.overlay_selector_id );
17531753 }
17541754 // set the initial state
17551755 $j( '#' + tObj.overlay_selector_id ).css( {
@@ -1757,7 +1757,7 @@
17581758 } );
17591759 },
17601760 'u' : function( tObj, percent ) {
1761 - // js_log(':fadeFromColor:update: '+ percent);
 1761+ // mw.log(':fadeFromColor:update: '+ percent);
17621762 // fade from color (invert the percent)
17631763 var percent = 1 - percent;
17641764 $j( '#' + tObj.overlay_selector_id ).css( {
@@ -1769,9 +1769,9 @@
17701770 crossfade: {
17711771 "attr" : [],
17721772 "init" : function( tObj ) {
1773 - js_log( 'f:crossfade: ' + tObj.overlay_selector_id );
 1773+ mw.log( 'f:crossfade: ' + tObj.overlay_selector_id );
17741774 if ( $j( '#' + tObj.overlay_selector_id ).length == 0 )
1775 - js_log( "ERROR overlay selector not found: " + tObj.overlay_selector_id );
 1775+ mw.log( "ERROR overlay selector not found: " + tObj.overlay_selector_id );
17761776
17771777 // set the initial state show the zero opacity animation
17781778 $j( '#' + tObj.overlay_selector_id ).css( { 'opacity':0 } ).show();
@@ -1844,7 +1844,7 @@
18451845 * the main animation loop called every MV_ANIMATION_CB_RATE or 34ms ~around 30frames per second~
18461846 */
18471847 run_transition:function() {
1848 - // js_log('f:run_transition:' + this.interValCount);
 1848+ // mw.log('f:run_transition:' + this.interValCount);
18491849
18501850 // update the time from the video if native:
18511851 if ( typeof this.pClip.embed.vid != 'undefined' ) {
@@ -1881,16 +1881,16 @@
18821882 - ( this.pClip.dur - this.dur )
18831883 ) / this.dur ;
18841884
1885 - /*js_log('percentage = ct:'+this.pClip.embed.currentTime + ' + ic:'+this.interValCount +' * cb:'+MV_ANIMATION_CB_RATE +
 1885+ /*mw.log('percentage = ct:'+this.pClip.embed.currentTime + ' + ic:'+this.interValCount +' * cb:'+MV_ANIMATION_CB_RATE +
18861886 ' / ' + this.dur + ' = ' + percentage );
18871887 */
18881888
1889 - // js_log('cur percentage of transition: '+percentage);
 1889+ // mw.log('cur percentage of transition: '+percentage);
18901890 // update state based on current time + cur_time_offset (for now just use pClip.embed.currentTime)
18911891 mvTransLib.doUpdate( this, percentage );
18921892
18931893 if ( percentage >= 1 ) {
1894 - js_log( "transition done update with percentage " + percentage );
 1894+ mw.log( "transition done update with percentage " + percentage );
18951895 this.animation_state = 2;
18961896 clearInterval( this.timerId );
18971897 mvTransLib.doCloseTransition( this )
@@ -1926,7 +1926,7 @@
19271927 transitions: { },
19281928 doParse:function() {
19291929 var _this = this;
1930 - js_log( 'f:doParse smilPlaylist' );
 1930+ mw.log( 'f:doParse smilPlaylist' );
19311931 // @@todo get/parse meta that we are interested in:
19321932 var meta_tags = this.data.getElementsByTagName( 'meta' );
19331933 var metaNames = {
@@ -1938,7 +1938,7 @@
19391939 'mTouchedTime':""
19401940 };
19411941 $j.each( meta_tags, function( i, meta_elm ) {
1942 - // js_log( "on META tag: "+ $j(meta_elm).attr('name') );
 1942+ // mw.log( "on META tag: "+ $j(meta_elm).attr('name') );
19431943 if ( $j( meta_elm ).attr( 'name' ) in metaNames ) {
19441944 _this[ $j( meta_elm ).attr( 'name' ) ] = $j( meta_elm ).attr( 'content' );
19451945 }
@@ -1954,10 +1954,10 @@
19551955 if ( $j( trans_elm ).attr( "id" ) ) {
19561956 _this.transitions[ $j( trans_elm ).attr( "id" )] = new transitionObj( trans_elm );
19571957 } else {
1958 - js_log( 'skipping transition: (missing id) ' + trans_elm );
 1958+ mw.log( 'skipping transition: (missing id) ' + trans_elm );
19591959 }
19601960 } );
1961 - js_log( 'loaded transitions:' + _this.transitions.length );
 1961+ mw.log( 'loaded transitions:' + _this.transitions.length );
19621962
19631963 // Add seq (latter we will have support more than one seq tag) / more than one "track"
19641964 var seq_tags = this.data.getElementsByTagName( 'seq' );
@@ -1966,7 +1966,7 @@
19671967 // get all the clips for the given seq:
19681968 $j.each( seq_elm.childNodes, function( i, mediaElement ) {
19691969 // ~complex~ @@todo to handle a lot like "switch" "region" etc
1970 - // js_log('process: ' + mediaElemnt.tagName);
 1970+ // mw.log('process: ' + mediaElemnt.tagName);
19711971 if ( typeof mediaElement.tagName != 'undefined' ) {
19721972 if ( _this.tryAddMedia( mediaElement, inx ) ) {
19731973 inx++;
@@ -1974,11 +1974,11 @@
19751975 }
19761976 } );
19771977 } );
1978 - js_log( "done proc seq tags" );
 1978+ mw.log( "done proc seq tags" );
19791979 return true;
19801980 },
19811981 tryAddMediaObj:function( mConfig, order, track_id ) {
1982 - js_log( 'tryAddMediaObj::' );
 1982+ mw.log( 'tryAddMediaObj::' );
19831983 var mediaElement = document.createElement( 'div' );
19841984 for ( var i = 0; i < mv_smil_ref_supported_attributes.length; i++ ) {
19851985 var attr = mv_smil_ref_supported_attributes[i];
@@ -1988,7 +1988,7 @@
19891989 this.tryAddMedia( mediaElement, order, track_id );
19901990 },
19911991 tryAddMedia:function( mediaElement, order, track_id ) {
1992 - js_log( 'SMIL:tryAddMedia:' + mediaElement );
 1992+ mw.log( 'SMIL:tryAddMedia:' + mediaElement );
19931993
19941994 var _this = this;
19951995 // Set up basic mvSMILClip send it the mediaElemnt & mvClip init:
@@ -2073,7 +2073,7 @@
20742074
20752075 if ( sClipElm.firstChild ) {
20762076 this['wholeText'] = sClipElm.firstChild.nodeValue;
2077 - js_log( "SET wholeText for: " + this['tagName'] + ' ' + this['wholeText'] );
 2077+ mw.log( "SET wholeText for: " + this['tagName'] + ' ' + this['wholeText'] );
20782078 }
20792079 // debugger;
20802080 // mwEmbed specific property:
@@ -2147,7 +2147,7 @@
21482148 if ( this.transOut )
21492149 fulldur -= this.transOut.getDuration();
21502150
2151 - // js_log("getSoloDuration:: td: " + this.getDuration() + ' sd:' + fulldur);
 2151+ // mw.log("getSoloDuration:: td: " + this.getDuration() + ' sd:' + fulldur);
21522152 return fulldur;
21532153 },
21542154 // Get the duration of the original media asset (usefull for bounding setting of in-out-points)
@@ -2246,14 +2246,14 @@
22472247 return elmObj;
22482248 },
22492249 addClip:function( clipObj, pos ) {
2250 - js_log( 'pl_Track: AddClip at:' + pos + ' clen: ' + this.clips.length );
 2250+ mw.log( 'pl_Track: AddClip at:' + pos + ' clen: ' + this.clips.length );
22512251 if ( typeof pos == 'undefined' )
22522252 pos = this.clips.length;
22532253 // get everything after pos
22542254 this.clips.splice( pos, 0, clipObj );
22552255 // keep the clip order values accurate:
22562256 this.reOrderClips();
2257 - js_log( "did add now cLen: " + this.clips.length );
 2257+ mw.log( "did add now cLen: " + this.clips.length );
22582258 },
22592259 getClip:function( inx ) {
22602260 if ( !this.clips[inx] )
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/seqRemoteSearchDriver.js
@@ -10,7 +10,7 @@
1111 sequence_add_target:false,
1212 init:function( mySequence ) {
1313 var _this = this;
14 - js_log( "init:seqRemoteSearchDriver" );
 14+ mw.log( "init:seqRemoteSearchDriver" );
1515
1616 // Setup remote search driver with a seq parent:
1717 this.pSeq = mySequence;
@@ -40,7 +40,7 @@
4141 if ( !this.pSeq.parent_do_refresh_timeline ) {
4242 this.pSeq.parent_do_refresh_timeline = this.pSeq.do_refresh_timeline;
4343 this.pSeq.do_refresh_timeline = function() {
44 - js_log( "seqRemoteSearchDriver::" + _this.pSeq.disp_menu_item );
 44+ mw.log( "seqRemoteSearchDriver::" + _this.pSeq.disp_menu_item );
4545 // call the parent
4646 _this.pSeq.parent_do_refresh_timeline();
4747 //Add our local bindings
@@ -57,7 +57,7 @@
5858
5959 // Add an additional click binding
6060 $j( '.rsd_res_item' ).click( function() {
61 - js_log( 'SeqRemoteSearch: rsd_res_item: click (remove sequence_add_target)' );
 61+ mw.log( 'SeqRemoteSearch: rsd_res_item: click (remove sequence_add_target)' );
6262 _this.sequence_add_target = false;
6363 } );
6464
@@ -68,13 +68,13 @@
6969 },
7070 revert:'invalid',
7171 start:function() {
72 - js_log( 'start drag' );
 72+ mw.log( 'start drag' );
7373 }
7474 } );
7575 $j( ".mv_clip_drag" ).droppable( 'destroy' ).droppable( {
7676 accept: '.rsd_res_item',
7777 over:function( event, ui ) {
78 - // js_log("over : mv_clip_drag: " + $j(this).attr('id') );
 78+ // mw.log("over : mv_clip_drag: " + $j(this).attr('id') );
7979 $j( this ).css( 'border-right', 'solid thick red' );
8080 },
8181 out:function( event, ui ) {
@@ -82,7 +82,7 @@
8383 },
8484 drop: function( event, ui ) {
8585 $j( this ).css( 'border-right', 'solid thin white' );
86 - js_log( "Droped: " + $j( ui.draggable ).attr( 'id' ) + ' on ' + $j( this ).attr( 'id' ) );
 86+ mw.log( "Droped: " + $j( ui.draggable ).attr( 'id' ) + ' on ' + $j( this ).attr( 'id' ) );
8787 _this.sequence_add_target = $j( this ).attr( 'id' );
8888 // load the original draged item
8989 var rObj = _this.getResourceFromId( $j( ui.draggable ).attr( 'id' ) );
@@ -93,7 +93,7 @@
9494 },
9595 insertResource:function( rObj ) {
9696 var _this = this;
97 - js_log( "SEQ insert resource after:" + _this.sequence_add_target + ' of type: ' + rObj.mime );
 97+ mw.log( "SEQ insert resource after:" + _this.sequence_add_target + ' of type: ' + rObj.mime );
9898 if ( _this.sequence_add_target ) {
9999 var tClip = _this.pSeq.getClipFromSeqID( _this.sequence_add_target );
100100 var target_order = false;
@@ -126,7 +126,7 @@
127127
128128 // Refresh the timeline:
129129 _this.pSeq.do_refresh_timeline();
130 - js_log( "run close all: " );
 130+ mw.log( "run close all: " );
131131 _this.closeAll();
132132 } );
133133 },
@@ -164,7 +164,7 @@
165165 this.parent_showResourceEditor( rObj, rsdElement );
166166 },
167167 closeAll:function() {
168 - js_log( 'should close: seq_resource_import' );
 168+ mw.log( 'should close: seq_resource_import' );
169169 $j( '#seq_resource_import' ).dialog( 'close' ).dialog( 'destroy' ).remove();
170170 // Unhide the results container
171171 $j( '#rsd_results_container' ).show();
@@ -178,7 +178,7 @@
179179 }
180180 },
181181 cancelClipEditCB:function() {
182 - js_log( 'seqRSD:cancelClipEditCB' );
 182+ mw.log( 'seqRSD:cancelClipEditCB' );
183183 $j( '#seq_resource_import' ).dialog( 'close' ).dialog( 'destroy' ).remove();
184184 }
185185 };
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvFirefoggRender.js
@@ -63,7 +63,7 @@
6464 // Should be externally controlled
6565 if ( options.target_startRender ) {
6666 $j( options.target_startRender ).click( function() {
67 - js_log( "Start render" );
 67+ mw.log( "Start render" );
6868 _this.startRender();
6969 } )
7070 this.target_startRender = options.target_startRender;
@@ -111,7 +111,7 @@
112112 if ( _this.continue_rendering ) {
113113 doNextFrame();
114114 } else {
115 - js_log('done with render');
 115+ mw.log('done with render');
116116 // else quit:
117117 //_this.doFinalRender();
118118 }
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvTimedEffectsEdit.js
@@ -79,7 +79,7 @@
8080 this.doEditMenu();
8181 },
8282 doEditMenu:function() {
83 - js_log( 'mvTimedEffects : doEditMenu::' );
 83+ mw.log( 'mvTimedEffects : doEditMenu::' );
8484 var _this = this;
8585 // add in subMenus if set
8686 // check for submenu and add to item container
@@ -112,7 +112,7 @@
113113 o += '</div>';
114114 // add sub menu container with menu html:
115115 $j( '#' + this.control_ct ).html( o ) ;
116 - js_log( 'should have set: #' + this.control_ct + ' to: ' + o );
 116+ mw.log( 'should have set: #' + this.control_ct + ' to: ' + o );
117117 // set up bindins:
118118 $j( '#mv_submenu_timedeffect' ).tabs( {
119119 selected: selected_tab,
@@ -126,9 +126,9 @@
127127 },
128128 showEditUI:function( tab_id ) {
129129 // @@todo fix the double display of showEditUI
130 - js_log( "showEditUI::" );
 130+ mw.log( "showEditUI::" );
131131 if ( !this.menu_items[ tab_id ] ) {
132 - js_log( 'error: showEditUI missing item:' + tab_id );
 132+ mw.log( 'error: showEditUI missing item:' + tab_id );
133133 } else {
134134 // use the menu_item config to map to function display
135135 this.menu_items[tab_id].doEdit( this );
@@ -137,7 +137,7 @@
138138 doEditEffectDisplayEdit:function() {
139139 var _this = this;
140140 var appendTarget = '#te_effects';
141 - js_log( 'type:' + _this.rObj['type'] );
 141+ mw.log( 'type:' + _this.rObj['type'] );
142142 $j( appendTarget ).html( gM( 'mwe-loading_txt' ) );
143143 // @@todo integrate into core and loading system:
144144 loadExternalJs( mw.getMwEmbedPath() + 'libClipEdit/pixastic-editor/editor.js?' + getMwReqParam() );
@@ -162,7 +162,7 @@
163163 },
164164 doTransitionDisplayEdit:function( target_item ) {
165165 var _this = this;
166 - js_log( "doTransitionDisplayEdit: " + target_item );
 166+ mw.log( "doTransitionDisplayEdit: " + target_item );
167167 var apendTarget = '#te_' + target_item;
168168 // check if we have a transition of type clip_attr
169169 if ( !this.rObj[ this.menu_items[ target_item ].clip_attr ] ) {
@@ -232,7 +232,7 @@
233233 case 'fadeColor':
234234 var cColor = ( cTran['fadeColor'] ) ? cTran['fadeColor']:'';
235235 $j( htmlTarget ).append( 'Select Color: <div class="colorSelector"><div class="colorIndicator" style="background-color: ' + cColor + '"></div></div>' );
236 - js_log( 'cs target: ' + htmlTarget + ' .colorSelector' );
 236+ mw.log( 'cs target: ' + htmlTarget + ' .colorSelector' );
237237
238238
239239 $j( htmlTarget + ' .colorSelector' ).ColorPicker( {
@@ -246,7 +246,7 @@
247247 onHide: function ( colpkr ) {
248248 $j( colpkr ).fadeOut( 500 );
249249 _this.pSeq.plObj.setCurrentTime( 0, function() {
250 - js_log( "render ready" );
 250+ mw.log( "render ready" );
251251 } );
252252 return false;
253253 },
@@ -263,10 +263,10 @@
264264
265265 },
266266 getTransitionListControl : function( target_out ) {
267 - js_log( "getTransitionListControl" );
 267+ mw.log( "getTransitionListControl" );
268268 var o = '<h3>' + gM( 'mwe-add-transition' ) + '</h3>';
269269 for ( var type in mvTransLib['type'] ) {
270 - js_log( 'on tran type: ' + type );
 270+ mw.log( 'on tran type: ' + type );
271271 var tLibSet = mvTransLib['type'][ type ];
272272 for ( var subtype in tLibSet ) {
273273 o += '<img style="float:left;padding:10px;" ' +
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvSequencer.js
@@ -204,7 +204,7 @@
205205 this[ i ] = sequencerDefaultValues[i];
206206 }
207207 for ( var i in iObj ) {
208 - // js_log('on '+ i + ' :' + iObj[i]);
 208+ // mw.log('on '+ i + ' :' + iObj[i]);
209209 if ( typeof sequencerDefaultValues[i] != 'undefined' ) { // make sure its a valid property
210210 this[i] = iObj[i];
211211 }
@@ -212,7 +212,7 @@
213213
214214 // check for sequence_container
215215 if ( $j( this.target_sequence_container ).length === 0 ) {
216 - js_log( "Error: missing target_sequence_container" );
 216+ mw.log( "Error: missing target_sequence_container" );
217217 return false;
218218 }
219219
@@ -241,17 +241,17 @@
242242 'min-width':'850px'
243243 } );
244244
245 - /*js_log('set: '+this.target_sequence_container + ' html to:'+ "\n"+
 245+ /*mw.log('set: '+this.target_sequence_container + ' html to:'+ "\n"+
246246 $j(this.target_sequence_container).html()
247247 );*/
248248
249249 // first check if we got a cloned PL object:
250250 // (when the editor is invoked with the plalylist already on the page)
251251 /*if( this.plObj != 'null' ){
252 - js_log('found plObj clone');
 252+ mw.log('found plObj clone');
253253 //extend with mvSeqPlayList object:
254254 this.plObj = new mvSeqPlayList(this.plObj);
255 - js_log('mvSeqPlayList added: ' + this.plObj.org_control_height );
 255+ mw.log('mvSeqPlayList added: ' + this.plObj.org_control_height );
256256 $j('#'+this.video_container_id).get(0).attachNode( this.plObj );
257257 this.plObj.getHTML();
258258 this.checkReadyPlObj();
@@ -260,10 +260,10 @@
261261
262262 // else check for source based sequence editor (a clean page load of the editor)
263263 if ( this.mv_pl_src != 'null' ) {
264 - js_log( ' pl src:: ' + this.mv_pl_src );
 264+ mw.log( ' pl src:: ' + this.mv_pl_src );
265265 var src_attr = ' src="' + this.mv_pl_src + '" ';
266266 } else {
267 - js_log( ' null playlist src .. (start empty) ' );
 267+ mw.log( ' null playlist src .. (start empty) ' );
268268 var src_attr = '';
269269 }
270270 $j( '#' + this.video_container_id ).html( '<playlist ' + src_attr +
@@ -327,10 +327,7 @@
328328 value: 100
329329 } );
330330 // run the Seq Save Request:
331 - do_api_req( {
332 - 'data': saveReq,
333 - 'url' : _this.getLocalApiUrl()
334 - }, function( data ) {
 331+ mw.getJSON( _this.getLocalApiUrl(), saveReq, function( data ) {
335332 $j( '#seq_save_dialog' ).html( gM( 'mwe-save_done' ) );
336333 $j( '#seq_save_dialog' ).dialog( 'option',
337334 'buttons', {
@@ -355,7 +352,7 @@
356353 },
357354 // display a menu item (hide the rest)
358355 disp:function( item, dispCall ) {
359 - js_log( 'menu_item disp: ' + item );
 356+ mw.log( 'menu_item disp: ' + item );
360357 this.disp_menu_item = item;
361358 // update the display and item state:
362359 if ( this.menu_items[item] ) {
@@ -371,7 +368,7 @@
372369 },
373370 // setup the menu items:
374371 setupMenuItems:function() {
375 - js_log( 'loadInitMenuItems' );
 372+ mw.log( 'loadInitMenuItems' );
376373 var _this = this;
377374 // do all the menu_items setup: @@we could defer this to once the menu item is requested
378375 for ( var i in this.menu_items ) {
@@ -413,7 +410,7 @@
414411 // add tracks:
415412 for ( var i in this.plObj.tracks ) {
416413 var track = this.plObj.tracks[i];
417 - // js_log("on track: "+ i + ' t:'+ $j('#'+this.timeline_id+'_left_cnt').html() );
 414+ // mw.log("on track: "+ i + ' t:'+ $j('#'+this.timeline_id+'_left_cnt').html() );
418415 // set up track based on disp type
419416 switch( track.disp_mode ) {
420417 case 'timeline_thumb':
@@ -482,7 +479,7 @@
483480 // else keep checking for the playlist to be ready
484481 if ( this.plObj.loading ) {
485482 if ( this.plReadyTimeout == 200 ) {
486 - js_error( 'error playlist never ready' );
 483+ mw.log( 'error playlist never ready' );
487484 } else {
488485 this.plReadyTimeout++;
489486 setTimeout( this.instance_name + '.checkReadyPlObj()', 25 );
@@ -494,8 +491,8 @@
495492 },
496493 plReadyInit:function() {
497494 var _this = this;
498 - js_log( 'plReadyInit' );
499 - js_log( this.plObj );
 495+ mw.log( 'plReadyInit' );
 496+ mw.log( this.plObj );
500497 // give the playlist a pointer to its parent seq:
501498 this.plObj['seqObj'] = this;
502499
@@ -602,7 +599,7 @@
603600
604601 // Set up key bidnings
605602 $j( window ).keydown( function( e ) {
606 - js_log( 'pushed down on:' + e.which );
 603+ mw.log( 'pushed down on:' + e.which );
607604 if ( e.which == 16 )
608605 _this.key_shift_down = true;
609606
@@ -621,7 +618,7 @@
622619
623620 } );
624621 $j( window ).keyup( function( e ) {
625 - js_log( 'key up on ' + e.which );
 622+ mw.log( 'key up on ' + e.which );
626623 // User let go of "shift" turn off multi-select
627624 if ( e.which == 16 )
628625 _this.key_shift_down = false;
@@ -646,11 +643,11 @@
647644 var _this = this;
648645 // if an input or text area has focus disable delete key binding
649646 $j( "input,textarea" ).focus( function () {
650 - js_log( "inputFocus:true" );
 647+ mw.log( "inputFocus:true" );
651648 _this.inputFocus = true;
652649 } );
653650 $j( "input,textarea" ).blur( function () {
654 - js_log( "inputFocus:blur" );
 651+ mw.log( "inputFocus:blur" );
655652 _this.inputFocus = false;
656653 } )
657654 },
@@ -666,13 +663,13 @@
667664 'left',
668665 Math.round( jh_time_sec_float / this.timeline_scale ) + 'px'
669666 );
670 - // js_log('at time:'+ jh_time_sec + ' px:'+ Math.round(jh_time_sec_float/this.timeline_scale));
 667+ // mw.log('at time:'+ jh_time_sec + ' px:'+ Math.round(jh_time_sec_float/this.timeline_scale));
671668 },
672669 /*
673670 * Returns a xml or json representation of the current sequence
674671 */
675672 getSeqOutputJSON:function() {
676 - js_log( 'json output:' );
 673+ mw.log( 'json output:' );
677674 },
678675
679676 /**
@@ -744,7 +741,7 @@
745742 * Handles cases where no clips are selected or multiple clips are selected.
746743 */
747744 doEditSelectedClip:function() {
748 - js_log( "f:doEditSelectedClip:" );
 745+ mw.log( "f:doEditSelectedClip:" );
749746 // And only one clip selected
750747 if ( $j( '.mv_selected_clip' ).length == 1 ) {
751748 this.doEditClip( this.getClipFromSeqID( $j( '.mv_selected_clip' ).parent().attr( 'id' ) ) );
@@ -761,7 +758,7 @@
762759 */
763760 doEditTransitionSelectedClip:function() {
764761 var _this = this;
765 - js_log( "f:doEditTransitionSelectedClip:" + $j( '.mv_selected_clip' ).length );
 762+ mw.log( "f:doEditTransitionSelectedClip:" + $j( '.mv_selected_clip' ).length );
766763 if ( $j( '.mv_selected_clip' ).length == 1 ) {
767764 _this.doEditTransition( _this.getClipFromSeqID( $j( '.mv_selected_clip' ).parent().attr( 'id' ) ) );
768765 } else if ( $j( '.mv_selected_clip' ).length === 0 ) {
@@ -777,7 +774,7 @@
778775 * displays the transition edit interface.
779776 */
780777 doEditTransition:function( cObj ) {
781 - js_log( "sequence:doEditTransition" );
 778+ mw.log( "sequence:doEditTransition" );
782779 var _this = this;
783780 // Add a loading image
784781 mw.loading_spiner( '#transitions_ic' );
@@ -799,7 +796,7 @@
800797 * Updates the clip details div if edit resource is set
801798 */
802799 doEditClip:function( resource ) {
803 - js_log( 'seq:doEditClip' );
 800+ mw.log( 'seq:doEditClip' );
804801 var _this = this;
805802
806803 mw.loading_spiner( '#clipedit_ic' );
@@ -858,7 +855,7 @@
859856
860857 // Upload clipboard to the server (if possible)
861858 if ( mw.parseUri( document.URL ).host != mw.parseUri( _this.plObj.interface_url ).host ) {
862 - js_log( 'error: presently we can\'t copy clips across domains' );
 859+ mw.log( 'error: presently we can\'t copy clips across domains' );
863860 } else {
864861 // FIXME we need to add an api entry point to store a "clipboard"
865862 // right now this is dependent on a custom hook:
@@ -872,11 +869,11 @@
873870 "clipboardEditToken": _this.clipboardEditToken
874871 } ),
875872 success:function( data ) {
876 - js_log( 'did clipboard push ' + $j.toJSON( _this.clipboard ) );
 873+ mw.log( 'did clipboard push ' + $j.toJSON( _this.clipboard ) );
877874 }
878875 } );
879876 } else {
880 - js_log( 'error: no clipboardEditToken to uplaod clipboard to server' );
 877+ mw.log( 'error: no clipboardEditToken to uplaod clipboard to server' );
881878 }
882879 }
883880 },
@@ -884,7 +881,7 @@
885882 * Paste the clipboard clips into the sequence
886883 */
887884 pasteClipBoardClips:function() {
888 - js_log( 'f:pasteClipBoardClips' );
 885+ mw.log( 'f:pasteClipBoardClips' );
889886 // @@todo query the server for updated clipboard
890887 // paste before the "current clip"
891888 this.addClips( this.clipboard, this.plObj.cur_clip.order );
@@ -934,13 +931,13 @@
935932 if ( !before_clip_pos )
936933 before_clip_pos = this.plObj.default_track.getClipCount();
937934
938 - js_log( "seq: add clip: at: " + before_clip_pos + ' in track: ' + track_inx );
 935+ mw.log( "seq: add clip: at: " + before_clip_pos + ' in track: ' + track_inx );
939936 var cur_pos = before_clip_pos;
940937
941938 $j.each( clipSet, function( inx, clipInitDom ) {
942939 var mediaElement = document.createElement( 'ref' );
943940 for ( var i in clipInitDom ) {
944 - js_log( "set: " + i + ' to ' + clipInitDom[i] );
 941+ mw.log( "set: " + i + ' to ' + clipInitDom[i] );
945942 if ( i != 'id' )
946943 $j( mediaElement ).attr( i, clipInitDom[i] );
947944 }
@@ -957,7 +954,7 @@
958955 removeClips:function( remove_clip_ary ) {
959956 var _this = this;
960957 var jselect = coma = '';
961 - js_log( 'clip count before removal : ' + _this.plObj.default_track.clips.length + ' should remove ' + remove_clip_ary.length );
 958+ mw.log( 'clip count before removal : ' + _this.plObj.default_track.clips.length + ' should remove ' + remove_clip_ary.length );
962959 var afected_tracks = new Array();
963960 // add order to track_clip before we start removing:
964961 $j.each( remove_clip_ary, function( inx, track_clip ) {
@@ -967,7 +964,7 @@
968965 var track_inx = track_clip[0];
969966 var clip_inx = track_clip[1];
970967 var clip_rm_order = track_clip['order'];
971 - js_log( 'remove t:' + track_inx + ' c:' + clip_inx + ' id:' + ' #track_' + track_inx + '_clip_' + clip_inx + ' order:' + clip_rm_order );
 968+ mw.log( 'remove t:' + track_inx + ' c:' + clip_inx + ' id:' + ' #track_' + track_inx + '_clip_' + clip_inx + ' order:' + clip_rm_order );
972969 // remove the clips from the base tracks
973970 for ( var i in _this.plObj.tracks[ track_inx ].clips ) {
974971 cur_clip = _this.plObj.tracks[ track_inx ].clips[i]
@@ -985,7 +982,7 @@
986983 _this.plObj.tracks[track_inx].reOrderClips();
987984 } );
988985
989 - js_log( 'clip count after removal : ' + _this.plObj.default_track.clips.length );
 986+ mw.log( 'clip count after removal : ' + _this.plObj.default_track.clips.length );
990987 // animate the removal (@@todo should be able to call the resulting fadeOut only once without a flag)
991988 var done_with_refresh = false;
992989 $j( jselect ).fadeOut( "slow", function() {
@@ -1013,7 +1010,7 @@
10141011 this.plObj.tracks[e.track_inx].clips[e.clip_inx].doAdjust( 'end', e.delta );
10151012 break;
10161013 }
1017 - js_log( 're render: ' + e.track_inx );
 1014+ mw.log( 're render: ' + e.track_inx );
10181015 // refresh the playlist after adjustment
10191016 this.do_refresh_timeline();
10201017 },
@@ -1050,7 +1047,7 @@
10511048 },
10521049 // toggle cut mode (change icon to cut)
10531050 cut_mode:function() {
1054 - js_log( 'do cut mode' );
 1051+ mw.log( 'do cut mode' );
10551052 // add cut layer ontop of clips
10561053 },
10571054 doAdvancedTl:function() {
@@ -1067,7 +1064,7 @@
10681065 },
10691066 // renders updates the timeline based on the current scale
10701067 render_tracks:function( track_inx ) {
1071 - js_log( "f::render track: " + track_inx );
 1068+ mw.log( "f::render track: " + track_inx );
10721069 var _this = this;
10731070 // inject the tracks into the timeline (if not already there)
10741071 for ( var track_id in this.plObj.tracks ) {
@@ -1141,7 +1138,7 @@
11421139 clip.left_px = Math.round( cur_clip_time / this.timeline_scale );
11431140 clip.width_px = Math.round( Math.round( clip.getDuration() ) / this.timeline_scale );
11441141 clip.height_px = 60;
1145 - js_log( 'at time:' + cur_clip_time + ' left: ' + clip.left_px + ' clip dur: ' + Math.round( clip.getDuration() ) + ' clip width:' + clip.width_px );
 1142+ mw.log( 'at time:' + cur_clip_time + ' left: ' + clip.left_px + ' clip dur: ' + Math.round( clip.getDuration() ) + ' clip width:' + clip.width_px );
11461143
11471144 // for every clip_width pixle output image
11481145 if ( track.disp_mode == 'timeline_thumb' ) {
@@ -1172,7 +1169,7 @@
11731170
11741171 }
11751172
1176 - // js_log("new htmL for track i: "+track_id + ' html:'+track_html);
 1173+ // mw.log("new htmL for track i: "+track_id + ' html:'+track_html);
11771174 $j( '#container_track_' + track_id ).html( track_html );
11781175
11791176 // apply transition click action
@@ -1225,7 +1222,7 @@
12261223 var cur_clip_click = this;
12271224 // if not in multi select mode remove all existing selections
12281225 // (except for the current click which is handled down below)
1229 - js_log( ' ks: ' + _this.key_shift_down + ' ctrl_down:' + _this.key_ctrl_down );
 1226+ mw.log( ' ks: ' + _this.key_shift_down + ' ctrl_down:' + _this.key_ctrl_down );
12301227 if ( ! _this.key_shift_down && ! _this.key_ctrl_down ) {
12311228 $j( '.mv_selected_clip' ).each( function( inx, selected_clip ) {
12321229 if ( $j( this ).parent().attr( 'id' ) != $j( cur_clip_click ).parent().attr( 'id' )
@@ -1259,7 +1256,7 @@
12601257 max_order = cur_clip.order;
12611258 } );
12621259 // select all non-selected between max or min
1263 - js_log( 'sOrder: ' + sClipObj.order + ' min:' + min_order + ' max:' + max_order );
 1260+ mw.log( 'sOrder: ' + sClipObj.order + ' min:' + min_order + ' max:' + max_order );
12641261 if ( sClipObj.order <= min_order ) {
12651262 for ( var i = sClipObj.order; i <= max_order; i++ ) {
12661263 $j( '#track_' + track_id + '_clip_' + i + ' > .mv_clip_thumb' ).addClass( 'mv_selected_clip' );
@@ -1277,7 +1274,7 @@
12781275 // debugger;
12791276 if ( this.timeline_mode == 'time' ) {
12801277 $j( '.ui-resizable-handle' ).mousedown( function() {
1281 - js_log( 'hid: ' + $j( this ).attr( 'class' ) );
 1278+ mw.log( 'hid: ' + $j( this ).attr( 'class' ) );
12821279 _this.resize_mode = ( $j( this ).attr( 'class' ).indexOf( 'ui-resizable-e' ) != -1 ) ?
12831280 'resize_end':'resize_start';
12841281 } );
@@ -1297,7 +1294,7 @@
12981295 insert_key = _this.clipDragUpdate( ui, this );
12991296 },
13001297 start:function( e, ui ) {
1301 - js_log( 'start drag:' + this.id );
 1298+ mw.log( 'start drag:' + this.id );
13021299 // make sure we are ontop
13031300 $j( this ).css( { top:'0px', zindex:10 } );
13041301 },
@@ -1336,11 +1333,11 @@
13371334 $j( this ).css( { 'border':'solid thin red' } );
13381335 // fade In Time stats (end or start based on handle)
13391336 // dragging east (adjusting end time)
1340 - js_log( 'append to: ' + this.id );
 1337+ mw.log( 'append to: ' + this.id );
13411338 $j( '#' + this.id + ' > .mv_clip_stats' ).fadeIn( "fast" );
13421339 },
13431340 stop: function( e, ui ) {
1344 - js_log( 'stop resize' );
 1341+ mw.log( 'stop resize' );
13451342 // restore border
13461343 $j( this ).css( 'border', 'solid thin white' );
13471344 // remove stats
@@ -1374,7 +1371,7 @@
13751372
13761373 var insert_key = 'na';
13771374 // animate re-arrange by left position:
1378 - // js_log('left: '+ui.position.left);
 1375+ // mw.log('left: '+ui.position.left);
13791376 // locate clip (based on clip duration not animate)
13801377 var id_parts = clipElm.id.split( '_' );
13811378 var track_inx = id_parts[1];
@@ -1423,22 +1420,22 @@
14241421 }
14251422 },
14261423 getClipFromSeqID:function( clip_seq_id ) {
1427 - js_log( 'get id from: ' + clip_seq_id );
 1424+ mw.log( 'get id from: ' + clip_seq_id );
14281425 var ct = clip_seq_id.replace( 'track_', '' ).replace( 'clip_', '' ).split( '_' );
14291426 return this.plObj.tracks[ ct[0] ].clips[ ct[1] ];
14301427 },
14311428 // renders clip frames
14321429 render_clip_frames:function( clip, frame_offset_count ) {
1433 - js_log( 'f:render_clip_frames: ' + clip.id + ' foc:' + frame_offset_count );
 1430+ mw.log( 'f:render_clip_frames: ' + clip.id + ' foc:' + frame_offset_count );
14341431 var clip_frames_html = '';
14351432 var frame_width = Math.round( this.track_thumb_height * 1.3333333 );
14361433
14371434 var pint = ( frame_offset_count == null ) ? 0:frame_offset_count * frame_width;
14381435
1439 - // js_log("pinit: "+ pint+ ' < '+clip.width_px+' ++'+frame_width);
 1436+ // mw.log("pinit: "+ pint+ ' < '+clip.width_px+' ++'+frame_width);
14401437 for ( var p = pint; p < clip.width_px; p += frame_width ) {
14411438 var clip_time = ( p == 0 ) ? 0:Math.round( p * this.timeline_scale );
1442 - js_log( 'rendering clip frames: p:' + p + ' pts:' + ( p * this.timeline_scale ) + ' time:' + clip_time + ' height:' + this.track_thumb_height );
 1439+ mw.log( 'rendering clip frames: p:' + p + ' pts:' + ( p * this.timeline_scale ) + ' time:' + clip_time + ' height:' + this.track_thumb_height );
14431440 clip_frames_html += clip.embed.renderTimelineThumbnail( {
14441441 'width': frame_width,
14451442 'thumb_class':'mv_tl_thumb',
@@ -1447,11 +1444,11 @@
14481445 'time': clip_time
14491446 } );
14501447 }
1451 - js_log( 'render_clip_frames:' + clip_frames_html );
 1448+ mw.log( 'render_clip_frames:' + clip_frames_html );
14521449 return clip_frames_html;
14531450 },
14541451 update_clip_resize:function( clip_element ) {
1455 - // js_log('update_clip_resize');
 1452+ // mw.log('update_clip_resize');
14561453 var _this = this;
14571454 var id_parts = clip_element.id.split( '_' );
14581455 track_inx = id_parts[1];
@@ -1478,12 +1475,12 @@
14791476 var new_end = mw.seconds2npt( mw.npt2seconds( clip.embed.end_ntp ) + clip_dif );
14801477 clip_desc += '<br>end time: ' + new_end;
14811478 // also shift all the other clips (after the current)
1482 - // js_log("track_inx: " + track_inx + ' clip inx:'+clip_inx);
 1479+ // mw.log("track_inx: " + track_inx + ' clip inx:'+clip_inx);
14831480 // $j('#container_track_'+track_inx+' > .mv_clip_drag :gt('+clip_inx+')').each(function(){
14841481 $j( '#container_track_' + track_inx + ' > :gt(' + clip_inx + ')' ).each( function() {
14851482 var move_id_parts = this.id.split( '_' );
14861483 var move_clip = _this.plObj.tracks[move_id_parts[1]].clips[move_id_parts[3]];
1487 - // js_log('should move:'+ this.id);
 1484+ // mw.log('should move:'+ this.id);
14881485 $j( this ).css( 'left', move_clip.left_px + width_dif );
14891486 } );
14901487 } else {
@@ -1499,13 +1496,13 @@
15001497 var frame_count = $j( '#' + clip_element.id + ' > img' ).length;
15011498 if ( clip.width_px > ( frame_count * frame_width ) ) {
15021499 // if dragging left append
1503 - js_log( 'width_px:' + clip.width_px + ' framecount:' + frame_count + ' Xcw=' + ( frame_count * frame_width ) );
 1500+ mw.log( 'width_px:' + clip.width_px + ' framecount:' + frame_count + ' Xcw=' + ( frame_count * frame_width ) );
15041501 $j( '#' + clip_element.id ).append( this.render_clip_frames( clip, frame_count ) );
15051502 }
15061503 },
15071504 // renders cnt_time
15081505 render_playheadhead_seeker:function() {
1509 - js_log( 'render_playheadhead_seeker' );
 1506+ mw.log( 'render_playheadhead_seeker' );
15101507 // render out time stamps and time "jump" links
15111508 // first get total width
15121509
@@ -1544,10 +1541,10 @@
15451542 }
15461543 },
15471544 jt:function( jh_time ) {
1548 - js_log( 'jt:' + jh_time );
 1545+ mw.log( 'jt:' + jh_time );
15491546 var _this = this;
15501547 this.playline_time = jh_time;
1551 - js_log( 'time: ' + mw.seconds2npt( jh_time ) + ' ' + Math.round( jh_time / this.timeline_scale ) );
 1548+ mw.log( 'time: ' + mw.seconds2npt( jh_time ) + ' ' + Math.round( jh_time / this.timeline_scale ) );
15521549 // render playline at given time
15531550 $j( '#' + this.timeline_id + '_playline' ).css( 'left', Math.round( jh_time / this.timeline_scale ) + 'px' );
15541551 cur_pl_time = 0;
@@ -1558,15 +1555,15 @@
15591556 zoom_in:function() {
15601557 this.timeline_scale = this.timeline_scale * .75;
15611558 this.do_refresh_timeline();
1562 - js_log( 'zoomed in:' + this.timeline_scale );
 1559+ mw.log( 'zoomed in:' + this.timeline_scale );
15631560 },
15641561 zoom_out:function() {
15651562 this.timeline_scale = this.timeline_scale * ( 1 + ( 1 / 3 ) );
15661563 this.do_refresh_timeline();
1567 - js_log( 'zoom out: ' + this.timeline_scale );
 1564+ mw.log( 'zoom out: ' + this.timeline_scale );
15681565 },
15691566 do_refresh_timeline:function( preserve_selection ) {
1570 - js_log( 'Sequencer:do_refresh_timeline()' );
 1567+ mw.log( 'Sequencer:do_refresh_timeline()' );
15711568 // @@todo should "lock" interface while refreshing timeline
15721569 var pSelClips = [];
15731570 if ( preserve_selection ) {
@@ -1614,7 +1611,7 @@
16151612 this.pl_layout.control_height = 0;
16161613 },
16171614 setSliderValue:function( perc ) {
1618 - js_log( 'setSliderValue::' + perc );
 1615+ mw.log( 'setSliderValue::' + perc );
16191616 // get the track_clipThumb_height from parent mvSequencer
16201617 var frame_width = Math.round( this.pSeq.track_clipThumb_height * 1.3333333 );
16211618 var container_width = frame_width + 60;
@@ -1622,7 +1619,7 @@
16231620 var perc_clip = this.cur_clip.embed.currentTime / this.cur_clip.getDuration();
16241621
16251622 var left_px = parseInt( ( this.cur_clip.order * container_width ) + ( frame_width * perc_clip ) ) + 'px';
1626 - js_log( "set " + perc + ' of cur_clip: ' + this.cur_clip.order + ' lp:' + left_px );
 1623+ mw.log( "set " + perc + ' of cur_clip: ' + this.cur_clip.order + ' lp:' + left_px );
16271624
16281625
16291626 // update the timeline playhead and
@@ -1639,7 +1636,7 @@
16401637 },
16411638 // override renderDisplay
16421639 renderDisplay:function() {
1643 - js_log( 'mvSequence:renderDisplay' );
 1640+ mw.log( 'mvSequence:renderDisplay' );
16441641 // setup layout for title and dc_ clip container
16451642 $j( this ).html( '<div id="dc_' + this.id + '" style="width:' + this.width + 'px;' +
16461643 'height:' + ( this.height ) + 'px;position:relative;" />' );
Index: branches/js2-work/phase3/js2/mwEmbed/tests/testLang.html
@@ -231,15 +231,13 @@
232232 var tkey = mKey + '_' + numKey + '_' + langKey;
233233 testCount++;
234234 $j('#score_card').html('Running Tests <span id="perc_done">0</sapn>% done');
235 - var msgparam = (typeof numVal== 'object')? numVal.join( '|' ) : numVal;
236 - do_api_req({
237 - 'data': {
238 - 'action' : 'parse',
239 - 'uselang' : langKey,
240 - 'text' : '{{int:' + mKey + '|' + msgparam + '}}'
241 - },
242 - 'url' : '../../../api.php'
243 - }, function( data ) {
 235+ var msgparam = (typeof numVal== 'object')? numVal.join( '|' ) : numVal;
 236+ var request = {
 237+ 'action' : 'parse',
 238+ 'uselang' : langKey,
 239+ 'text' : '{{int:' + mKey + '|' + msgparam + '}}'
 240+ };
 241+ mw.getJSON('../../../api.php', request, function( data ) {
244242 var t = '#'+ tkey ;
245243 if(data.parse && data.parse.text && data.parse.text['*']){
246244 $j(t).html( data.parse.text['*'] );
Index: branches/js2-work/phase3/js2/mwEmbed/tests/testApiProxy.html
@@ -28,7 +28,7 @@
2929 );
3030 });
3131 function doHello(){
32 - js_log('to a hello user');
 32+ mw.log('to a hello user');
3333 $j('#helloTarget').html( mw.loading_spiner() );
3434 //first get the user name:
3535 getUserName(function( user_name ){
@@ -46,7 +46,7 @@
4747 function( data ){
4848 //now we get the data back for that domain
4949 if( !data.query || !data.query.userinfo ){
50 - js_log("Error no query.userinfo ");
 50+ mw.log("Error no query.userinfo ");
5151 return false;
5252 }
5353 callback( data.query.userinfo.name );
@@ -62,18 +62,15 @@
6363 var eTitle = 'User_talk:' + userName;
6464 //get a edit token
6565 get_mw_token(eTitle, 'proxy', function( token ){
66 - js_log("got token: " + token) ;
67 - var aReq = {
 66+ mw.log("got token: " + token) ;
 67+ var request = {
6868 'action':'edit',
6969 'title': eTitle,
7070 'summary': "Api proxy test edit",
7171 'appendtext': "\n\n==== Hello from Api proxy At: " + Date() + " ====",
7272 'token': token
7373 }
74 - do_api_req({
75 - 'data': aReq,
76 - 'url': 'proxy'
77 - },function(result){
 74+ mw.getJSON('proxy', request, function( result ){
7875 if(result.edit && result.edit.newrevid){
7976 $j('#appendTarget').html( "success: " + JSON.stringify ( result) );
8077 url = remote_wiki_host + remote_script_path + '/index.php/';
Index: branches/js2-work/phase3/js2/mwEmbed/libClipEdit/mvClipEdit.js
@@ -117,7 +117,7 @@
118118 this.showEditUI();
119119 } else {
120120 // check the media_type:
121 - // js_log('mvClipEdit:: media type:' + this.media_type + ' base width: ' + this.resource.width + ' bh: ' + this.resource.height);
 121+ // mw.log('mvClipEdit:: media type:' + this.media_type + ' base width: ' + this.resource.width + ' bh: ' + this.resource.height);
122122 // could separate out into media Types objects for now just call method
123123 if ( this.getMediaType() == 'image' ) {
124124 this.showImageControls();
@@ -168,7 +168,7 @@
169169 'media' : ['image', 'template'],
170170 'doEdit':function( _this, target ) {
171171 function doUpdateDur( inputElm ) {
172 - js_log( "update duration:" + $j( inputElm ).val() );
 172+ mw.log( "update duration:" + $j( inputElm ).val() );
173173 // update the parent sequence object:
174174 _this.resource.dur = smilParseTime( $j( inputElm ).val() );
175175 // update the playlist:
@@ -235,7 +235,7 @@
236236 // if media type is template we have to query to get its URI to get its parameters
237237 if ( _this.getMediaType() == 'template' && !_this.resource.tVars ) {
238238 $j( '#sub_cliplib_ic' ).loadingSpiner()
239 - var reqObj = {
 239+ var request = {
240240 'action':'query',
241241 'prop':'revisions',
242242 'titles': _this.resource.uri,
@@ -244,26 +244,22 @@
245245 // get the interface uri from the plObject
246246 var api_url = _this.parentSequence.plObj.interface_url;
247247 // first check
248 - do_api_req( {
249 - 'data':reqObj,
250 - 'url':api_url
251 - }, function( data ) {
252 - if ( typeof data.query.pages == 'undefined' )
 248+ mw.getJSON( api_url, request, function( data ) {
 249+ if ( typeof data.query.pages == 'undefined' )
 250+ return _this.showEditOptions( target );
 251+ for ( var i in data.query.pages ) {
 252+ var page = data.query.pages[i];
 253+ if ( !page['revisions'] || !page['revisions'][0]['*'] ) {
253254 return _this.showEditOptions( target );
254 - for ( var i in data.query.pages ) {
255 - var page = data.query.pages[i];
256 - if ( !page['revisions'] || !page['revisions'][0]['*'] ) {
257 - return _this.showEditOptions( target );
258 - } else {
259 - var template_rev = page['revisions'][0]['*'];
260 - }
 255+ } else {
 256+ var template_rev = page['revisions'][0]['*'];
261257 }
262 - var parserObj = mw.parser.pNew( template_rev );
263 - _this.resource.tVars = parserObj.getTemplateVars();
264 - // Run the editor now that we have updated the template variables:
265 - _this.showEditOptions( target );
266258 }
267 - );
 259+ var parserObj = mw.parser.pNew( template_rev );
 260+ _this.resource.tVars = parserObj.getTemplateVars();
 261+ // Run the editor now that we have updated the template variables:
 262+ _this.showEditOptions( target );
 263+ } );
268264 } else {
269265 _this.showEditOptions( target );
270266 }
@@ -374,7 +370,7 @@
375371
376372 // Add update bindings
377373 $j( target + ' .ic_tparam' ).change( function() {
378 - js_log( "updated tparam::" + $j( this ).attr( "name" ) );
 374+ mw.log( "updated tparam::" + $j( this ).attr( "name" ) );
379375 // Update param value:
380376 _this.resource.params[ $j( this ).attr( "name" ) ] = $j( this ).val();
381377 // Re-parse & update template
@@ -384,7 +380,7 @@
385381 template_wiki_text += "\n|" + _this.resource.tVars[i] + ' = ' + _this.resource.params[ _this.resource.tVars[i] ] ;
386382 }
387383 template_wiki_text += "\n}}";
388 - var reqObj = {
 384+ var request = {
389385 'action':'parse',
390386 'title' : _this.parentSequence.plObj.mTitle,
391387 'text' : template_wiki_text
@@ -392,15 +388,12 @@
393389 $j( _this.resource.embed ).html( mw.loading_spiner() );
394390
395391 var api_url = _this.parentSequence.plObj.interface_url;
396 - do_api_req( {
397 - 'data':reqObj,
398 - 'url':api_url
399 - }, function( data ) {
 392+ mw.getJSON( api_url, request, function( data ) {
400393 if ( data.parse.text['*'] ) {
401394 // update the target
402395 $j( _this.resource.embed ).html( data.parse.text['*'] );
403396 }
404 - } )
 397+ } );
405398 } )
406399
407400 // Update doFocusBindings
@@ -465,7 +458,7 @@
466459 showEditUI:function( edit_type ) {
467460 if ( !edit_type )
468461 return false;
469 - js_log( 'showEditUI: ' + edit_type );
 462+ mw.log( 'showEditUI: ' + edit_type );
470463 if ( this.edit_types[ edit_type ].doEdit )
471464 this.edit_types[ edit_type ].doEdit( this, '#sc_' + edit_type );
472465 },
@@ -474,7 +467,7 @@
475468 * Show Video Controls for the resource edit
476469 */
477470 showVideoControls:function() {
478 - js_log( 'showVideoControls:f' );
 471+ mw.log( 'showVideoControls:f' );
479472 var _this = this;
480473 var eb = $j( '#embed_vid' ).get( 0 );
481474 // turn on preview to avoid onDone actions
@@ -525,7 +518,7 @@
526519 animate: true,
527520 values: [start_sec, end_sec],
528521 slide: function( event, ui ) {
529 - // js_log(" vals:"+ mw.seconds2npt( ui.values[0] ) + ' : ' + mw.seconds2npt( ui.values[1]) );
 522+ // mw.log(" vals:"+ mw.seconds2npt( ui.values[0] ) + ' : ' + mw.seconds2npt( ui.values[1]) );
530523 $target.find( '.startInOut' ).val( mw.seconds2npt( ui.values[0] ) );
531524 $target.find( '.endInOut' ).val( mw.seconds2npt( ui.values[1] ) );
532525 },
@@ -543,13 +536,13 @@
544537
545538 // Update the slider:
546539 var values = $target.find( '.inOutSlider' ).slider( 'option', 'values' );
547 - js_log( 'in slider len: ' + $target.find( '.inOutSlider' ).length );
 540+ mw.log( 'in slider len: ' + $target.find( '.inOutSlider' ).length );
548541
549542 $target.find( '.inOutSlider' ).slider( 'value', 10 );
550543 debugger;
551544 $target.find( '.inOutSlider' ).slider( 'option', 'values', [s_sec, e_sec] );
552545 var values = $target.find( '.inOutSlider' ).slider( 'option', 'values' );
553 - js_log( 'values (after update):' + values );
 546+ mw.log( 'values (after update):' + values );
554547 } );
555548
556549 $target.find( '.endInOut' ).upDownTimeInputBind( function( inputElm ) {
@@ -581,7 +574,7 @@
582575 if ( ebvid ) {
583576 ebvid.stop();
584577 ebvid.updateVideoTime( start_time, end_time );
585 - js_log( 'update thumb: ' + start_time );
 578+ mw.log( 'update thumb: ' + start_time );
586579 ebvid.updateThumbTimeNPT( start_time );
587580 }
588581 },
@@ -624,7 +617,7 @@
625618 o += this.resource.pSobj.getInlineDescWiki( this.resource );
626619 }
627620 o += '</textarea><br>';
628 - // js_log('getInsertHtml: ' + o );
 621+ // mw.log('getInsertHtml: ' + o );
629622 return o;
630623 },
631624
@@ -686,7 +679,7 @@
687680 */
688681 applyEdit:function() {
689682 var _this = this;
690 - js_log( 'applyEdit::' + this.getMediaType() );
 683+ mw.log( 'applyEdit::' + this.getMediaType() );
691684 if ( this.getMediaType() == 'image' ) {
692685 this.applyCrop();
693686 } else if ( this.getMediaType() == 'video' ) {
@@ -746,11 +739,11 @@
747740 );
748741 // Add binding:
749742 $j( '#mv_crop_button,.mv_crop_msg,.mv_apply_crop' ).click( function() {
750 - js_log( 'click:mv_crop_button: base width: ' + _this.resource.width + ' bh: ' + _this.resource.height );
 743+ mw.log( 'click:mv_crop_button: base width: ' + _this.resource.width + ' bh: ' + _this.resource.height );
751744 if ( $j( '#mv_crop_button' ).hasClass( 'mv_crop_button_selected' ) ) {
752745 _this.applyCrop();
753746 } else {
754 - js_log( 'click:turn on' );
 747+ mw.log( 'click:turn on' );
755748 _this.doCropInterface();
756749 }
757750 } );
@@ -838,7 +831,7 @@
839832 * Apply the video Start End Adjustments to the resource
840833 */
841834 applyVideoStartEnd:function() {
842 - js_log( 'apply Video StartEnd updates::' );
 835+ mw.log( 'apply Video StartEnd updates::' );
843836 $target = $j( '#' + this.target_control_display );
844837
845838 // Be sure to "stop the video (some plugins can't have DOM elements on top of them)
@@ -879,7 +872,7 @@
880873 $j( '#mv_crop_button' ).removeClass( 'mv_crop_button_base' ).addClass( 'mv_crop_button_selected' ).attr( 'title', gM( 'mwe-crop_done' ) );
881874 $j( '#' + _this.target_clip_display + ' img' ).Jcrop( {
882875 onSelect: function( c ) {
883 - js_log( 'on select:' + c.x + ',' + c.y + ',' + c.x2 + ',' + c.y2 + ',' + c.w + ',' + c.h );
 876+ mw.log( 'on select:' + c.x + ',' + c.y + ',' + c.x2 + ',' + c.y2 + ',' + c.w + ',' + c.h );
884877 _this.resource.crop = c;
885878 },
886879 onChange: function( c ) {
Index: branches/js2-work/phase3/js2/mwEmbed/libMwApi/mw.proxy.js
@@ -71,7 +71,7 @@
7272 }
7373
7474 if ( mw.parseUri( $.proxy.server_frame ).host == mw.parseUri( document.URL ).host ) {
75 - js_log( "Error: trying to proxy local domain? " );
 75+ mw.log( "Error: trying to proxy local domain? " );
7676 return false;
7777 }
7878 return true;
@@ -93,7 +93,7 @@
9494 'request' : requestQuery
9595 }
9696
97 - js_log( "Do frame proxy request on src: \n" + $.proxy.server_frame + "\n" + JSON.stringify( requestQuery ) );
 97+ mw.log( "Do frame proxy request on src: \n" + $.proxy.server_frame + "\n" + JSON.stringify( requestQuery ) );
9898
9999 // We can't update src's so we have to remove and add all the time :(
100100 // @@todo we should support frame msg system
@@ -109,7 +109,7 @@
110110 setTimeout( function() {
111111 if ( !frameProxyOk ) {
112112 // we timmed out no api proxy (should make sure the user is "logged in")
113 - js_log( "Error:: api proxy timeout are we logged in? mwEmbed is on?" );
 113+ mw.log( "Error:: api proxy timeout are we logged in? mwEmbed is on?" );
114114 $.proxy.proxyNotReadyDialog();
115115 }
116116 }, 5000 );
@@ -154,7 +154,7 @@
155155 * @param {Function} callback Function called once the request is complete
156156 */
157157 $.proxy.doRequest = function( requestQuery, callback ) {
158 - js_log( "doRequest:: " + JSON.stringify( requestQuery ) );
 158+ mw.log( "doRequest:: " + JSON.stringify( requestQuery ) );
159159 lastApiReq = requestQuery;
160160 // setup the callback:
161161 $.proxy.callback = callback;
@@ -172,14 +172,14 @@
173173 $.proxy.nested = function( hashResult ) {
174174 // Close the loader if present:
175175 $j.closeLoaderDialog();
176 - js_log( '$.proxy.nested callback :: ' + unescape( hashResult ) );
 176+ mw.log( '$.proxy.nested callback :: ' + unescape( hashResult ) );
177177 frameProxyOk = true;
178178
179179 // Try to parse the hash result
180180 try {
181181 var resultObject = JSON.parse( unescape( hashResult ) );
182182 } catch ( e ) {
183 - js_log( "Error could not parse hashResult" );
 183+ mw.log( "Error could not parse hashResult" );
184184 }
185185
186186 // Special callback to frameProxyOk flag
@@ -259,11 +259,11 @@
260260 try {
261261 var clientRequest = JSON.parse( hashMsg );
262262 } catch ( e ) {
263 - js_log( "ProxyServer:: could not parse anchor" );
 263+ mw.log( "ProxyServer:: could not parse anchor" );
264264 }
265265
266266 if ( !clientRequest || !clientRequest.clientFrame ) {
267 - js_log( "Error: no client domain provided " );
 267+ mw.log( "Error: no client domain provided " );
268268 $j( 'body' ).append( "no client frame provided" );
269269 return false;
270270 }
@@ -271,12 +271,12 @@
272272 // Make sure we are logged in
273273 // (its a normal mediaWiki page so all site vars should be defined)
274274 if ( !wgUserName ) {
275 - js_log( 'Error Not logged in' );
 275+ mw.log( 'Error Not logged in' );
276276 return false;
277277 }
278278
279 - js_log( "Setup server on: " + mw.parseUri( document.URL ).host );
280 - js_log('Client frame: ' + clientRequest.clientFrame );
 279+ mw.log( "Setup server on: " + mw.parseUri( document.URL ).host );
 280+ mw.log('Client frame: ' + clientRequest.clientFrame );
281281
282282 var clientDomain = mw.parseUri( clientRequest.clientFrame ).host ;
283283 /**
@@ -292,7 +292,7 @@
293293 // Check master blacklist
294294 for ( var i in proxyConfig.master_blacklist ) {
295295 if ( clientDomain == proxyConfig.master_blacklist ) {
296 - js_log( 'domain: ' + clientDomain + ' is blacklisted ( no request )' );
 296+ mw.log( 'domain: ' + clientDomain + ' is blacklisted ( no request )' );
297297 return false;
298298 }
299299 }
Index: branches/js2-work/phase3/js2/mwEmbed/skins/mvpcf/mvpcf.js
@@ -1,7 +0,0 @@
2 -/*
3 -mvpcf skin config
4 -*/
5 -
6 -var mvpcfConfig = {
7 - parentClass : 'mv-player'
8 -};
\ No newline at end of file
Index: branches/js2-work/phase3/js2/mwEmbed/skins/mvpcf/mvpcfConfig.js
@@ -0,0 +1,7 @@
 2+/*
 3+mvpcf skin config
 4+*/
 5+
 6+var mvpcfConfig = {
 7+ parentClass : 'mv-player'
 8+};
\ No newline at end of file
Property changes on: branches/js2-work/phase3/js2/mwEmbed/skins/mvpcf/mvpcfConfig.js
___________________________________________________________________
Added: svn:mergeinfo
19 Merged /branches/REL1_15/phase3/js2/mwEmbed/skins/mvpcf/mvpcf.js:r51646
210 Merged /branches/sqlite/js2/mwEmbed/skins/mvpcf/mvpcf.js:r58211-58321
Added: svn:eol-style
311 + native
Index: branches/js2-work/phase3/js2/mwEmbed/skins/kskin/kskin.js
@@ -1,245 +0,0 @@
2 -/*
3 -* skin js allows you to override contrlBuilder html/class output
4 -*/
5 -
6 -mw.addMessages( {
7 - "mwe-credit-title" : "Title: $1",
8 - "mwe-kaltura-platform-title" : "Kaltura open source video platform"
9 -} );
10 -
11 -var kskinConfig = {
12 - // The parent class for all kskin css:
13 - parentClass: 'k-player',
14 -
15 - // Display time string length
16 - long_time_disp: false,
17 -
18 - // Options are hanndled internnaly
19 - external_options: false,
20 -
21 - // Volume control layout is horizontal
22 - volume_layout: 'horizontal',
23 -
24 - // Menu items for the kskin:
25 - menu_items:[
26 - 'playerSelect',
27 - 'download',
28 - 'share',
29 - 'credits',
30 - ],
31 - components: {
32 - 'play-btn-large' : {
33 - 'h' : 55
34 - },
35 - 'options': {
36 - 'w':50,
37 - 'o':function() {
38 - return '<div class="ui-state-default ui-corner-bl rButton k-options" title="' + gM( 'mwe-player_options' ) + '" >' +
39 - '<span>' + gM( 'mwe-menu_btn' ) + '</span>' +
40 - '</div>'
41 - }
42 - },
43 - 'time_display': {
44 - 'w':70
45 - },
46 - 'mv_embedded_options': {
47 - 'w':0,
48 - 'o':function( ctrlObj ) {
49 - var embedObj = ctrlObj.embedObj;
50 - var o = '' +
51 - '<div class="k-menu ui-widget-content" ' +
52 - 'style="width:' + embedObj.getPlayerWidth() + 'px; height:' + embedObj.getPlayerHeight() + 'px;">' +
53 - '<ul class="k-menu-bar">';
54 - // output menu item containers:
55 - for ( i = 0; i < ctrlObj.menu_items.length; i++ ) {
56 - var mk = ctrlObj.menu_items[i];
57 - o += '<li class="k-' + mk + '-btn" rel="' + mk + '">' +
58 - '<a href="#" title="' + gM( 'mwe-' + mk ) + '">' + gM( 'mwe-' + mk ) + '</a></li>';
59 - }
60 - o += '</ul>' +
61 - // We have to subtract the width of the k-menu-bar
62 - '<div class="k-menu-screens" style="width:' + ( embedObj.getPlayerWidth() - 75 ) +
63 - 'px; height:' + ( embedObj.getPlayerHeight() - ctrlBuilder.height ) + 'px;">';
64 -
65 - // Output menu item containers:
66 - for ( i = 0; i < ctrlObj.menu_items.length; i++ ) {
67 - o += '<div class="menu-screen menu-' + ctrlObj.menu_items[i] + '"></div>';
68 - }
69 - '</div>' +
70 - '</div>';
71 - return o;
72 - }
73 - }
74 - },
75 - /**
76 - * Adds the skin Control Bindings
77 - */
78 - addSkinControlBindings: function() {
79 - var embedObj = this.embedObj;
80 - var _this = this;
81 - var $tp = $j( '#' + embedObj.id );
82 -
83 - // Adds options and bindings: (we do this onClick )
84 - var addMvOptions = function() {
85 - if ( $j( '#' + embedObj.id + ' .k-menu' ).length != 0 )
86 - return false;
87 -
88 - $j( '#' + embedObj.id + ' .' + _this.pClass ).prepend(
89 - _this.components['mv_embedded_options'].o( $tp.get( 0 ).ctrlBuilder )
90 - );
91 -
92 - // By default its hidden:
93 - $tp.find( '.k-menu' ).hide();
94 -
95 - // Output menu-items:
96 - for ( i = 0; i < _this.menu_items.length ; i++ ) {
97 - $tp.find( '.k-' + _this.menu_items[i] + '-btn' ).click( function() {
98 - var mk = $j( this ).attr( 'rel' );
99 - $target = $j( '#' + embedObj.id + ' .menu-' + mk ).hide();
100 - // Generate the menu html not already done:
101 - if ( $target.children().length == 0 ) {
102 - // call the function show{Menuitem} with target:
103 - _this.showMenuItem( mk );
104 - }
105 - // Slide out the others
106 - $j( '#' + embedObj.id + ' .menu-screen' ).hide();
107 - $target.fadeIn( "fast" );
108 - // don't follow the # link
109 - return false;
110 - } );
111 - }
112 - }
113 -
114 - // Options menu display:
115 - $tp.find( '.k-options' ).click( function() {
116 - if ( $j( '#' + embedObj.id + ' .k-menu' ).length == 0 ) {
117 - // Stop the player if it does not support overlays:
118 - if ( !embedObj.supports['overlay'] )
119 - $tp.get( 0 ).stop();
120 - // Add the options
121 - addMvOptions();
122 - }
123 - // Set up the text and menu:
124 - var $ktxt = $j( this );
125 - var $kmenu = $tp.find( '.k-menu' );
126 - if ( $kmenu.is( ':visible' ) ) {
127 - $kmenu.fadeOut( "fast", function() {
128 - $ktxt.find( 'span' ).html ( gM( 'mwe-menu_btn' ) );
129 - } );
130 - $tp.find( '.play-btn-large' ).fadeIn( 'fast' );
131 - } else {
132 - $kmenu.fadeIn( "fast", function() {
133 - $ktxt.find( 'span' ).html ( gM( 'mwe-close_btn' ) );
134 - } );
135 - $tp.find( '.play-btn-large' ).fadeOut( 'fast' );
136 - }
137 - } );
138 -
139 - },
140 - showMenuItem:function( menu_item ) {
141 - //handle special k-skin specific display;
142 - if( menu_item == 'credits'){
143 - this.showCredits();
144 - }else{
145 - //call the base embedObj "show{Item}"
146 - this.embedObj['show' + menu_item.charAt( 0 ).toUpperCase() + menu_item.substring( 1 )](
147 - $j( '#' + this.embedObj.id + ' .menu-' + menu_item )
148 - );
149 - }
150 - },
151 - // Do the credit screen (presently specific to kaltura skin:)
152 - showCredits:function() {
153 - //set up the shortcuts:
154 - embedObj = this.embedObj;
155 - var _this = this;
156 - $target = $j( '#' + embedObj.id + ' .menu-credits' );
157 -
158 - $target.html( '<h2>' + gM( 'mwe-credits' ) + '</h2>' +
159 - '<div class="credits_box ui-corner-all">' +
160 - mw.loading_spiner() +
161 - '</div>'
162 - );
163 -
164 - if( mw.getConfig( 'k_attribution' ) == true ){
165 - $target.append(
166 - $j('<div/>').addClass( 'k-attribution' )
167 - .attr({
168 - 'title': gM('mwe-kaltura-platform-title')
169 - })
170 - .click( function(){
171 - window.location = 'http://kaltura.com';
172 - })
173 - );
174 - }
175 -
176 - if( !embedObj.wikiTitleKey ){
177 - $target.find('.credits_box').text(
178 - 'Error: no title key to grab credits with'
179 - );
180 - return ;
181 - }
182 - // Do the api request to populate the credits via the wikiTitleKey ( tied to "commons" )
183 - var reqObj = {
184 - 'action' : 'query',
185 - // Normalize the File NS (ie sometimes its present in wikiTitleKey other times not
186 - 'titles' : 'File:' + embedObj.wikiTitleKey.replace(/File:|Image:/, '' ),
187 - 'prop' : 'revisions',
188 - 'rvprop' : 'content'
189 - };
190 - var req_categories = new Array();
191 - do_api_req( {
192 - 'url' : mw.commons_api_url,
193 - 'data' : reqObj
194 - }, function( data ) {
195 - if( !data || !data.query || !data.query.pages ){
196 - $target.find('.credits_box').text(
197 - 'Error: title key: ' + embedObj.wikiTitleKey + ' not found'
198 - );
199 - return false;
200 - }
201 - var pages = data.query.pages;
202 - for(var i in pages){
203 - page = pages[ i ];
204 - if( page[ 'revisions' ] && page[ 'revisions' ][0]['*'] ){
205 - $target.find('.credits_box').html(
206 - _this.doCreditLineFromWikiText( page[ 'revisions' ][0]['*'] )
207 - );
208 - }
209 - }
210 - } );
211 - },
212 - doCreditLineFromWikiText:function ( wikiText ){
213 - var embedObj = this.embedObj;
214 -
215 - // Get the title str
216 - var titleStr = embedObj.wikiTitleKey.replace(/_/g, ' ');
217 - var titleLink = 'http://commons.wikimedia.org/wiki/File:' + embedObj.wikiTitleKey;
218 -
219 - // @@FIXME Do a quick check for source line:
220 - return $j( '<div/>' ).addClass( 'creditline' )
221 - .append(
222 - $j('<a/>').attr({
223 - 'href' : titleLink,
224 - 'title' : titleStr
225 - }).html(
226 - $j('<img/>').attr( {
227 - 'border': 0,
228 - 'src' : embedObj.thumbnail,
229 - } )
230 - )
231 - )
232 - .append(
233 - $j('<span>').html(
234 - gM( 'mwe-credit-title' ,
235 - // We use a div container to easialy get at the built out link
236 - $j('<div>').html(
237 - $j('<a/>').attr({
238 - 'href' : titleLink,
239 - 'title' : titleStr
240 - }).text( titleStr )
241 - ).html()
242 - )
243 - )
244 - );
245 - }
246 -}
\ No newline at end of file
Index: branches/js2-work/phase3/js2/mwEmbed/skins/kskin/kskinConfig.js
@@ -0,0 +1,271 @@
 2+/*
 3+* skin js allows you to override contrlBuilder html/class output
 4+*/
 5+
 6+mw.addMessages( {
 7+ "mwe-credit-title" : "Title: $1",
 8+ "mwe-kaltura-platform-title" : "Kaltura open source video platform"
 9+} );
 10+
 11+var kskinConfig = {
 12+ // The parent class for all kskin css:
 13+ parentClass: 'k-player',
 14+
 15+ // Display time string length
 16+ long_time_disp: false,
 17+
 18+ // Options are hanndled internnaly
 19+ external_options: false,
 20+
 21+ // Volume control layout is horizontal
 22+ volume_layout: 'horizontal',
 23+
 24+ // Menu items for the kskin:
 25+ menu_items:[
 26+ 'playerSelect',
 27+ 'download',
 28+ 'share',
 29+ 'credits',
 30+ ],
 31+
 32+ // Extends base components with kskin specifc options:
 33+ components: {
 34+ 'play-btn-large' : {
 35+ 'h' : 55
 36+ },
 37+ 'options': {
 38+ 'w':50,
 39+ 'o':function() {
 40+ return '<div class="ui-state-default ui-corner-bl rButton k-options" title="' + gM( 'mwe-player_options' ) + '" >' +
 41+ '<span>' + gM( 'mwe-menu_btn' ) + '</span>' +
 42+ '</div>'
 43+ }
 44+ },
 45+ 'time_display': {
 46+ 'w':70
 47+ },
 48+ 'options_menu': {
 49+ 'w':0,
 50+ 'o':function( ctrlObj ) {
 51+ var embedObj = ctrlObj.embedObj;
 52+ var o = '' +
 53+ '<div class="k-menu ui-widget-content" ' +
 54+ 'style="width:' + embedObj.getPlayerWidth() + 'px; height:' + embedObj.getPlayerHeight() + 'px;">' +
 55+ '<ul class="k-menu-bar">';
 56+ // Output menu item containers:
 57+ for ( i = 0; i < ctrlObj.menu_items.length; i++ ) {
 58+ var mk = ctrlObj.menu_items[i];
 59+ o += '<li class="k-' + mk + '-btn" rel="' + mk + '">' +
 60+ '<a href="#" title="' + gM( 'mwe-' + mk ) + '">' + gM( 'mwe-' + mk ) + '</a></li>';
 61+ }
 62+ o += '</ul>' +
 63+ // We have to subtract the width of the k-menu-bar
 64+ '<div class="k-menu-screens" style="width:' + ( embedObj.getPlayerWidth() - 75 ) +
 65+ 'px; height:' + ( embedObj.getPlayerHeight() - ctrlBuilder.height ) + 'px;">';
 66+
 67+ // Output menu item containers:
 68+ for ( i = 0; i < ctrlObj.menu_items.length; i++ ) {
 69+ o += '<div class="menu-screen menu-' + ctrlObj.menu_items[i] + '"></div>';
 70+ }
 71+ '</div>' +
 72+ '</div>';
 73+ return o;
 74+ }
 75+ }
 76+ },
 77+
 78+ /**
 79+ * Adds the skin Control Bindings
 80+ */
 81+ addSkinControlBindings: function() {
 82+ var embedObj = this.embedObj;
 83+ var _this = this;
 84+ var $tp = $j( '#' + embedObj.id );
 85+
 86+ // Adds options and bindings: (we do this onClick )
 87+
 88+
 89+ // Options menu display:
 90+ $tp.find( '.k-options' ).click( function() {
 91+ if ( $j( '#' + embedObj.id + ' .k-menu' ).length == 0 ) {
 92+ // Stop the player if it does not support overlays:
 93+ if ( !embedObj.supports['overlay'] )
 94+ $tp.get( 0 ).stop();
 95+ // Add the options
 96+ _this.addOptionsBinding( $tp );
 97+ }
 98+ // Set up the text and menu:
 99+ var $ktxt = $j( this );
 100+ var $kmenu = $tp.find( '.k-menu' );
 101+ if ( $kmenu.is( ':visible' ) ) {
 102+ $kmenu.fadeOut( "fast", function() {
 103+ $ktxt.find( 'span' ).html ( gM( 'mwe-menu_btn' ) );
 104+ } );
 105+ $tp.find( '.play-btn-large' ).fadeIn( 'fast' );
 106+ } else {
 107+ $kmenu.fadeIn( "fast", function() {
 108+ $ktxt.find( 'span' ).html ( gM( 'mwe-close_btn' ) );
 109+ } );
 110+ $tp.find( '.play-btn-large' ).fadeOut( 'fast' );
 111+ }
 112+ } );
 113+
 114+ },
 115+
 116+ /**
 117+ * Adds binding for the options menu
 118+ *
 119+ * @param {Object} $tp Target video container for
 120+ */
 121+ addOptionsBinding: function( $tp ) {
 122+ var _this = this;
 123+ var embedObj = this.embedObj;
 124+ if ( $j( '#' + embedObj.id + ' .k-menu' ).length != 0 )
 125+ return false;
 126+
 127+ $tp.find( '.' + _this.parentClass ).prepend(
 128+ _this.components[ 'options_menu' ].o( _this )
 129+ );
 130+
 131+ // By default its hidden:
 132+ $tp.find( '.k-menu' ).hide();
 133+
 134+ // Output menu-items:
 135+ for ( i = 0; i < _this.menu_items.length ; i++ ) {
 136+ $tp.find( '.k-' + _this.menu_items[i] + '-btn' ).click( function() {
 137+ var mk = $j( this ).attr( 'rel' );
 138+ $target = $j( '#' + embedObj.id + ' .menu-' + mk ).hide();
 139+ // Generate the menu html not already done:
 140+ if ( $target.children().length == 0 ) {
 141+ // call the function show{Menuitem} with target:
 142+ _this.showMenuItem( mk );
 143+ }
 144+
 145+ // Slide out the others
 146+ $j( '#' + embedObj.id + ' .menu-screen' ).hide();
 147+ $target.fadeIn( "fast" );
 148+
 149+ // Don't follow the # link
 150+ return false;
 151+ } );
 152+ }
 153+ },
 154+ /**
 155+ * Shows a selected menu_item
 156+ *
 157+ * @param {String} menu_itme Menu item key to display
 158+ */
 159+ showMenuItem:function( menu_item ) {
 160+ //handle special k-skin specific display;
 161+ if( menu_item == 'credits'){
 162+ this.showCredits();
 163+ }else{
 164+ //call the base embedObj "show{Item}"
 165+ this.embedObj['show' + menu_item.charAt( 0 ).toUpperCase() + menu_item.substring( 1 )](
 166+ $j( '#' + this.embedObj.id + ' .menu-' + menu_item )
 167+ );
 168+ }
 169+ },
 170+
 171+ /**
 172+ * Do the credit screen (presently specific to kaltura skin:)
 173+ */
 174+ showCredits:function() {
 175+ //set up the shortcuts:
 176+ embedObj = this.embedObj;
 177+ var _this = this;
 178+ $target = $j( '#' + embedObj.id + ' .menu-credits' );
 179+
 180+ $target.html( '<h2>' + gM( 'mwe-credits' ) + '</h2>' +
 181+ '<div class="credits_box ui-corner-all">' +
 182+ mw.loading_spiner() +
 183+ '</div>'
 184+ );
 185+
 186+ if( mw.getConfig( 'k_attribution' ) == true ){
 187+ $target.append(
 188+ $j('<div/>').addClass( 'k-attribution' )
 189+ .attr({
 190+ 'title': gM('mwe-kaltura-platform-title')
 191+ })
 192+ .click( function(){
 193+ window.location = 'http://kaltura.com';
 194+ })
 195+ );
 196+ }
 197+
 198+ if( !embedObj.wikiTitleKey ){
 199+ $target.find('.credits_box').text(
 200+ 'Error: no title key to grab credits with'
 201+ );
 202+ return ;
 203+ }
 204+ // Do the api request to populate the credits via the wikiTitleKey ( tied to "commons" )
 205+ var request = {
 206+ // Normalize the File NS (ie sometimes its present in wikiTitleKey other times not
 207+ 'titles' : 'File:' + embedObj.wikiTitleKey.replace(/File:|Image:/, '' ),
 208+ 'prop' : 'revisions',
 209+ 'rvprop' : 'content'
 210+ };
 211+ var req_categories = new Array();
 212+ mw.getJSON( mw.commons_api_url, request, function( data ) {
 213+ if( !data || !data.query || !data.query.pages ){
 214+ $target.find('.credits_box').text(
 215+ 'Error: title key: ' + embedObj.wikiTitleKey + ' not found'
 216+ );
 217+ return false;
 218+ }
 219+ var pages = data.query.pages;
 220+ for(var i in pages){
 221+ page = pages[ i ];
 222+ if( page[ 'revisions' ] && page[ 'revisions' ][0]['*'] ){
 223+ $target.find('.credits_box').html(
 224+ _this.doCreditLineFromWikiText( page[ 'revisions' ][0]['*'] )
 225+ );
 226+ }
 227+ }
 228+ } );
 229+ },
 230+
 231+ /**
 232+ * Build a clip credit from the resource wikiText page
 233+ *
 234+ * NOTE: in the future this should parse the resource page template
 235+ *
 236+ * @parm {String} wikiText Resource wiki text page contents
 237+ */
 238+ doCreditLineFromWikiText: function ( wikiText ){
 239+ var embedObj = this.embedObj;
 240+
 241+ // Get the title str
 242+ var titleStr = embedObj.wikiTitleKey.replace(/_/g, ' ');
 243+ var titleLink = 'http://commons.wikimedia.org/wiki/File:' + embedObj.wikiTitleKey;
 244+
 245+ // @@FIXME Do a quick check for source line:
 246+ return $j( '<div/>' ).addClass( 'creditline' )
 247+ .append(
 248+ $j('<a/>').attr({
 249+ 'href' : titleLink,
 250+ 'title' : titleStr
 251+ }).html(
 252+ $j('<img/>').attr( {
 253+ 'border': 0,
 254+ 'src' : embedObj.thumbnail,
 255+ } )
 256+ )
 257+ )
 258+ .append(
 259+ $j('<span>').html(
 260+ gM( 'mwe-credit-title' ,
 261+ // We use a div container to easialy get at the built out link
 262+ $j('<div>').html(
 263+ $j('<a/>').attr({
 264+ 'href' : titleLink,
 265+ 'title' : titleStr
 266+ }).text( titleStr )
 267+ ).html()
 268+ )
 269+ )
 270+ );
 271+ }
 272+};
Property changes on: branches/js2-work/phase3/js2/mwEmbed/skins/kskin/kskinConfig.js
___________________________________________________________________
Added: svn:mergeinfo
1273 Merged /branches/sqlite/js2/mwEmbed/skins/kskin/kskin.js:r58211-58321
2274 Merged /branches/REL1_15/phase3/js2/mwEmbed/skins/kskin/kskin.js:r51646
Added: svn:eol-style
3275 + native
Index: branches/js2-work/phase3/js2/mwEmbed/skins/ctrlBuilder.js
@@ -39,8 +39,10 @@
4040
4141 /**
4242 * Initialization Object for the control builder
 43+ *
 44+ * @param {Object} embedObj EmbedPlayer interface
4345 */
44 - init:function( embedObj, options ) {
 46+ init: function( embedObj ) {
4547 var _this = this;
4648 this.embedObj = embedObj;
4749
@@ -60,13 +62,13 @@
6163 * Get the controls html
6264 * @return {String} html output of controls
6365 */
64 - getControls:function() {
 66+ getControls: function() {
6567 // Set up local pointer to the embedObj
6668 var embedObj = this.embedObj;
6769 // set up local ctrlBuilder
6870 var _this = this;
6971
70 - js_log( 'f:controlsBuilder:: opt:' + this.options );
 72+ mw.log( 'f:controlsBuilder:: opt:' + this.options );
7173 this.id = ( embedObj.pc ) ? embedObj.pc.pp.id:embedObj.id;
7274 this.available_width = embedObj.getPlayerWidth();
7375
@@ -87,8 +89,8 @@
8890
8991
9092 // Append options to body (if not already there)
91 - if ( _this.body_options && $j( '#mv_vid_options_' + this.id ).length == 0 )
92 - $j( 'body' ).append( this.components['mv_embedded_options'].o( this ) );
 93+ if ( _this.external_options && $j( '#mv_vid_options_' + this.id ).length == 0 )
 94+ $j( 'body' ).append( this.components[ 'options_menu' ].o( this ) );
9395
9496 var o = '';
9597 for ( var i in this.components ) {
@@ -100,23 +102,24 @@
101103 o += this.components[i].o( this );
102104 this.available_width -= this.components[i].w;
103105 } else {
104 - js_log( 'not enough space for control component:' + i );
 106+ mw.log( 'not enough space for control component:' + i );
105107 }
106108 }
107109 }
108110 return o;
109111 },
110112
111 - /*
112 - * addControlHooks
113 - * to be run once controls are attached to the dom
114 - * @param {jQueryObject} $target The target hook position
115 - */
 113+ /**
 114+ * addControlHooks
 115+ * to be run once controls are attached to the dom
 116+ *
 117+ * @param {jQueryObject} $target The target hook position
 118+ */
116119 addControlHooks:function( $target ) {
117120 // Set up local pointer to the embedObj
118121 var embedObj = this.embedObj;
119122 var _this = this;
120 -
 123+
121124 if ( !$target )
122125 $target = $j( '#' + embedObj.id );
123126
@@ -130,7 +133,7 @@
131134 $j( '#dc_' + embedObj.id ).hover(
132135 function() {
133136 if ( $j( '#gnp_' + embedObj.id ).length == 0 ) {
134 - var toppos = ( embedObj.instanceOf == 'mvPlayList' ) ? 25:10;
 137+ var toppos = ( embedObj.instanceOf == 'mvPlayList' ) ? 25 : 10;
135138 $j( this ).append( '<div id="gnp_' + embedObj.id + '" class="ui-state-highlight ui-corner-all" ' +
136139 'style="position:absolute;display:none;background:#FFF;top:' + toppos + 'px;left:10px;right:10px;">' +
137140 gM( 'mwe-for_best_experience' ) +
@@ -151,7 +154,7 @@
152155
153156 } );
154157 }
155 - // Only show the warrning if cookie and config are true
 158+ // Only show the warning if cookie and config are true
156159 if ( mw.getConfig( 'show_player_warning' ) === true )
157160 $j( '#gnp_' + embedObj.id ).fadeIn( 'slow' );
158161 },
@@ -182,7 +185,7 @@
183186 } );
184187
185188 // Playhead binding
186 - js_log( " should add slider binding: " + $target.find( '.play_head' ).length );
 189+ mw.log( " should add slider binding: " + $target.find( '.play_head' ).length );
187190 $target.find( '.play_head' ).slider( {
188191 range: "min",
189192 value: 0,
@@ -199,7 +202,7 @@
200203 slide: function( event, ui ) {
201204 var perc = ui.value / 1000;
202205 embedObj.jump_time = mw.seconds2npt( parseFloat( parseFloat( embedObj.getDuration() ) * perc ) + embedObj.start_time_sec );
203 - // js_log('perc:' + perc + ' * ' + embedObj.getDuration() + ' jt:'+ this.jump_time);
 206+ // mw.log('perc:' + perc + ' * ' + embedObj.getDuration() + ' jt:'+ this.jump_time);
204207 if ( _this.long_time_disp ) {
205208 embedObj.setStatus( gM( 'mwe-seek_to', embedObj.jump_time ) );
206209 } else {
@@ -222,7 +225,7 @@
223226 var perc = ui.value / 1000;
224227 // set seek time (in case we have to do a url seek)
225228 embedObj.seek_time_sec = mw.npt2seconds( embedObj.jump_time, true );
226 - js_log( 'do jump to: ' + embedObj.jump_time + ' perc:' + perc + ' sts:' + embedObj.seek_time_sec );
 229+ mw.log( 'do jump to: ' + embedObj.jump_time + ' perc:' + perc + ' sts:' + embedObj.seek_time_sec );
227230 embedObj.setStatus( gM( 'mwe-seeking' ) );
228231 embedObj.doSeek( perc );
229232 }
@@ -306,6 +309,7 @@
307310 }
308311 return true;
309312 },
 313+
310314 /**
311315 * Binds the volume controls
312316 */
@@ -314,7 +318,7 @@
315319 var _this = this;
316320 var $target = $j( '#' + embedObj.id );
317321 $target.find( '.volume_control' ).unbind().btnBind().click( function() {
318 - js_log( 'clicked volume control' );
 322+ mw.log( 'clicked volume control' );
319323 $j( '#' + embedObj.id ).get( 0 ).toggleMute();
320324 } );
321325
@@ -352,7 +356,7 @@
353357 max: 100,
354358 slide: function( event, ui ) {
355359 var perc = ui.value / 100;
356 - // js_log('update volume:' + perc);
 360+ // mw.log('update volume:' + perc);
357361 embedObj.updateVolumen( perc );
358362 },
359363 change:function( event, ui ) {
@@ -383,9 +387,9 @@
384388 },
385389
386390 /**
387 - * Accessor to get component
 391+ * Get component
388392 *
389 - * @param {String} compoent Component key to grab html output
 393+ * @param {String} component Component key to grab html output
390394 */
391395 getComponent:function( component ) {
392396 if ( this.components[ component ] ) {
@@ -432,7 +436,7 @@
433437 * The options for the player, includes player selection,
434438 * download, and share options
435439 */
436 - 'mv_embedded_options': {
 440+ 'options_menu': {
437441 'w':0,
438442 'o':function( ctrlObj ) {
439443 var o = '<div id="mv_vid_options_' + ctrlObj.id + '" class="videoOptions">' +
Index: branches/js2-work/phase3/js2/mwEmbed/mwEmbed.js
@@ -5,7 +5,8 @@
66 * All MediaWiki code is released under the GPL2.
77 * For more information visit http://metavid.org/wiki/Code
88 *
9 - * @author Michael Dale
 9+ * @author Michael Dale ( mdale at wikimedia.org )
 10+ * @author and many others, see svn log for details
1011 *
1112 * mwEmbed uses the following libraries:
1213 *
@@ -66,8 +67,8 @@
6768 // If the k-skin video player should attribute kaltura
6869 'k_attribution' : true,
6970
70 - // The path of mvEmbed in mediaWiki folder
71 - 'mediaWikiPath' : 'js2/mwEmbed/',
 71+ // The mediaWiki path of mvEmbed
 72+ 'mediaWiki_mwEmbedPath' : 'js2/mwEmbed/',
7273
7374 //If we are in debug mode ( results in fresh debugg javascript includes )
7475 'debug' : false
@@ -83,20 +84,22 @@
8485 * Any global functions/classes that are not jQuery plugins should make
8586 * there way into the mw namespace
8687 */
87 -( function( $ ) {
88 - // list valid skins here:
 88+( function( $ ) {
 89+
 90+ // List valid skins here:
8991 $.valid_skins = [ 'mvpcf', 'kskin' ];
90 - // the version of mwEmbed
 92+
 93+ // The version of mwEmbed
9194 $.version = '1.1';
9295
93 - // special case of commons api url
94 - // (used for default subtitles server for media with a "wikiTitleKey" atm)
95 - // (@@todo eventually we should have wikiTitleKey be namespaced with interwiki ns
 96+ // Special case of commons api url
 97+ // ( used for default subtitles and related video server for "wikiTitleKey" where no api is provided)
 98+ // NOTE: we need to fix that with a standard "roe" jsonp url source ( instead of a non-standard custom attribute )
9699 $.commons_api_url = 'http://commons.wikimedia.org/w/api.php';
97100
98101 /**
99102 * Some global containers flags
100 - */
 103+ */
101104 $.skin_list = new Array();
102105 $.init_done = false;
103106 $.cb_count = 0;
@@ -108,7 +111,7 @@
109112 *
110113 * Simple system of inherit defauts, with getter setter functions:
111114 */
112 -
 115+
113116 // Local scope configuration var:
114117 mwConfig = { };
115118
@@ -141,7 +144,6 @@
142145 }
143146
144147
145 -
146148 /**
147149 * Language classes mw.lang
148150 *
@@ -215,6 +217,7 @@
216218 // return the transformed msg
217219 return pObj.getHTML();
218220 }
 221+
219222 /**
220223 * gMsgSwap
221224 *
@@ -282,7 +285,7 @@
283286 * Plural matchRuleTest
284287 */
285288 function matchRuleTest( cRule, val ) {
286 - js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val );
 289+ mw.log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val );
287290 function checkValue( compare, val ) {
288291 if ( typeof compare == 'string' ) {
289292 range = compare.split( '-' );
@@ -339,7 +342,7 @@
340343 * @param
341344 */
342345 function getTempParamFromRuleInx( tObj, ruleInx ) {
343 - // js_log('getTempParamFromRuleInx: ruleInx: ' + ruleInx + ' tempParamLength ' + tObj.param.length );
 346+ // mw.log('getTempParamFromRuleInx: ruleInx: ' + ruleInx + ' tempParamLength ' + tObj.param.length );
344347 if ( ruleInx >= tObj.param.length )
345348 return tObj.param[ tObj.param.length - 1 ];
346349 // else return the requested index:
@@ -350,12 +353,12 @@
351354 for ( var ruleInx in rs ) {
352355 cRule = rs[ruleInx];
353356 if ( matchRuleTest( cRule, tObj.arg ) ) {
354 - js_log("matched rule: " + ruleInx );
 357+ mw.log("matched rule: " + ruleInx );
355358 return getTempParamFromRuleInx( tObj, rCount );
356359 }
357360 rCount ++;
358361 }
359 - js_log('no match found for: ' + tObj.arg + ' using last/other : ' + tObj.param [ tObj.param.length -1 ] );
 362+ mw.log('no match found for: ' + tObj.arg + ' using last/other : ' + tObj.param [ tObj.param.length -1 ] );
360363 //debugger;
361364 // return the last /"other" template param
362365 return tObj.param [ tObj.param.length - 1 ];
@@ -377,15 +380,14 @@
378381 ammessages += msgSet;
379382 }
380383 if ( ammessages == '' ) {
381 - js_log( 'gMsgLoadRemote: no message set requested' );
 384+ mw.log( 'gMsgLoadRemote: no message set requested' );
382385 return false;
383386 }
384 - do_api_req( {
385 - 'data': {
386 - 'meta': 'allmessages',
387 - 'ammessages': ammessages
388 - }
389 - }, function( data ) {
 387+ var request = {
 388+ 'meta': 'allmessages',
 389+ 'ammessages': ammessages
 390+ }
 391+ mw.getJSON( request, function( data ) {
390392 if ( data.query.allmessages ) {
391393 var msgs = data.query.allmessages;
392394 for ( var i in msgs ) {
@@ -670,7 +672,7 @@
671673 * NOTE: should be integrated with the parser
672674 */
673675 getTemplateVars: function(){
674 - //js_log('matching against: ' + wikiText);
 676+ //mw.log('matching against: ' + wikiText);
675677 templateVars = new Array();
676678 var tempVars = wikiText.match(/\{\{\{([^\}]*)\}\}\}/gi);
677679
@@ -785,15 +787,20 @@
786788 }
787789
788790 // Check if its a multi-part request:
789 - if( typeof loadRequest == 'object' ){
790 - this.loadMany ( loadRequest, callback );
791 - return ;
 791+ if( typeof loadRequest == 'object' ){
 792+ if( loadRequest.length > 1 ){
 793+ this.loadMany ( loadRequest, callback );
 794+ return ;
 795+ }else{
 796+ loadRequest = loadRequest[0];
 797+ }
792798 }
793799
794800 // Check for the module name loader function
795801 if( this.moduleLoaders[ loadRequest ] &&
796802 typeof ( this.moduleLoaders[ loadRequest ] ) == 'function'
797803 ){
 804+ mw.log("loadModule:" + loadRequest );
798805 //Run the module with the parent callback
799806 this.moduleLoaders[ loadRequest ]( callback );
800807 return ;
@@ -812,7 +819,7 @@
813820 }
814821
815822 //possible error?
816 - js_log( "Error could not handle load request" );
 823+ mw.log( "Error could not handle load request" );
817824 },
818825
819826
@@ -823,43 +830,102 @@
824831 * @param {Object} loadSet Set of scripts to be loaded
825832 * @param {Function} callback Function to call once all scripts are loaded.
826833 */
827 - loadMany: function( loadSet, callback ){
828 -
829 - //Setup up the local "loadState"
830 - var loadState = { };
 834+ loadMany: function( loadSet, callback ) {
 835+ //mw.log("LoadMany:: " + loadSet );
 836+
 837+ // Setup up the local "loadStates"
 838+ var loadStates = { };
831839
832 - // Check if its a dependency set ( nested objects )
833 - if( typeof loadSet [ 0 ] == 'object' ){
834 - //Load sets of classes ( to preserver order for some browsers )
835 - this.loadDependencyChain( loadSet, callback );
836 - return ;
837 - }
 840+ // Check if we can load via the "script-loader" ( mwEmbed was included via scriptLoader )
 841+ if( $.getScriptLoaderPath() ){
 842+ loadStates = this.getGroupLoadState( loadSet );
 843+ }else{
 844+ // Check if its a dependency set ( nested objects )
 845+ if( typeof loadSet [ 0 ] == 'object' ){
 846+ //Load sets of classes ( to preserver order for some browsers )
 847+ this.loadDependencyChain( loadSet, callback );
 848+ return ;
 849+ }
 850+
 851+ // Set the initial load state for every item in the loadSet
 852+ for( var i in loadSet ){
 853+ var loadName = loadSet[ i ];
 854+ loadStates[ loadName ] = 0;
 855+ }
 856+ }
838857
839 - // Set the initial load state for every item in the loadSet
840 - for( var i in loadSet ){
841 - var loadName = loadSet[ i ];
842 - loadState[ loadName ] = 0;
843 - }
844 -
845 - // Issue the load request check check loadState to see if we are "done"
846 - for( var i in loadSet ){
847 - var loadName = loadSet[ i ];
848 - $.load( loadName, function ( loadName ){
849 - loadState[ loadName ] = 1;
850 - //js_log( loadName + ' finished of: ' + JSON.stringify( loadState ) );
 858+ // Issue the load request check check loadStates to see if we are "done"
 859+ for( var loadName in loadStates ){
 860+ //mw.log("loadMany: load: " + loadName );
 861+ this.load( loadName, function ( loadName ){
 862+ loadStates[ loadName ] = 1;
 863+ //mw.log( loadName + ' finished of: ' + JSON.stringify( loadStates ) );
851864 //Check if all load request states are set 1
852865 var loadDone = true;
853 - for( var j in loadState ){
854 - if( loadState[ j ] === 0 )
 866+ for( var j in loadStates ){
 867+ if( loadStates[ j ] === 0 )
855868 loadDone = false;
856869 }
857870 // Run the parent scope callback for "loadMany"
858 - if( loadDone )
859 - callback();
 871+ if( loadDone ){
 872+ callback( loadName );
 873+ }
860874 } );
861875 }
862876 },
 877+
 878+ /**
 879+ * Get grouped load state for script loader.
 880+ * Groups the loadSet into a single sequential array
 881+ *
 882+ * Groups the scriptRequest where possible:
 883+ * Modules include "loader code" so they are seperated
 884+ * into pre-condition code to be run for subsequent requests
 885+ *
 886+ * @param {Object} loadSet Loadset to return grouped
 887+ * @return {Object}
 888+ * grouped loadSet
 889+ */
 890+ getGroupLoadState: function( loadSet ){
 891+ var groupedLoadSet = [];
 892+ var loadStates = { };
 893+ // Merge load set into new groupedLoadSet
 894+ if( typeof loadSet[0] == 'object' ){
 895+ for( var i in loadSet ){
 896+ for( var j in loadSet[i] ){
 897+ groupedLoadSet.push( loadSet[i][j] );
 898+ }
 899+ }
 900+ }
 901+
 902+ // Setup grouped loadStates Set:
 903+ var groupClassKey = '';
 904+ var coma = '';
 905+ for( var i=0; i < groupedLoadSet.length; i++ ) {
 906+ var loadName = groupedLoadSet[ i ];
 907+ if( this.classPaths[ loadName ] ) {
 908+ groupClassKey += coma + loadName
 909+ coma = ',';
 910+ }else if( moduleLoaders[ loadName ] ) {
 911+ // Module loaders break up grouped script requests ( add the current groupClassKey )
 912+ if( groupClassKey != '' ){
 913+ loadStates[ groupClassKey ] = 0;
 914+ groupClassKey = coma = '';
 915+ }
 916+ // Add the module to the loadSate
 917+ loadStates[ loadName ] = 0;
 918+ }
 919+ }
 920+
 921+ // Add groupClassKey if set:
 922+ if( groupClassKey != '' ){
 923+ loadStates [ groupClassKey ] = 0;
 924+ }
 925+
 926+ return loadStates;
 927+ },
863928
 929+
864930 /**
865931 * Load a sets of scripts satisfy dependency order for browsers that execute out of order
866932 *
@@ -867,9 +933,9 @@
868934 * Sets are requested in array order.
869935 */
870936 loadDependencyChain: function( loadChain, callback ){
871 - var _this = this;
 937+ var _this = this;
872938 // Load with dependency checks
873 - this.load( loadChain.shift(), function() {
 939+ this.load( loadChain.shift(), function() {
874940 if ( loadChain.length != 0 ) {
875941 _this.loadDependencyChain( loadChain, callback );
876942 } else {
@@ -889,28 +955,32 @@
890956
891957 // Make sure the class is not already defined:
892958 if ( $.isset( className ) ){
893 - js_log( 'Class ( ' + className + ' ) already defined ' );
 959+ mw.log( 'Class ( ' + className + ' ) already defined ' );
894960 callback( className );
895961 return ;
896962 }
897963
898 - // Get the class url:
899 - var baseClassPath = this.classPaths[ className ];
900 -
901 - var url = null;
 964+ // Setup the Script Request var:
 965+ var scriptRequest = null;
902966
903 - // Add the mwEmbed path if not a root path or a full url
904 - if( baseClassPath.indexOf( '/' ) !== 0 &&
905 - baseClassPath.indexOf('://') === -1 ){
906 - url = $.getMwEmbedPath() + baseClassPath;
 967+ // If the scriptloader is enabled use the className as the scriptRequest:
 968+ if( $.getScriptLoaderPath() ){
 969+ scriptRequest = className;
907970 }else{
908 - url = baseClassPath;
909 - }
910 -
911 - if( ! url ){
912 - js_log( "Could not get url for class " + className );
913 - return ;
914 - }
 971+ // Get the class url:
 972+ var baseClassPath = this.classPaths[ className ];
 973+ // Add the mwEmbed path if not a root path or a full url
 974+ if( baseClassPath.indexOf( '/' ) !== 0 &&
 975+ baseClassPath.indexOf('://') === -1 ){
 976+ scriptRequest = $.getMwEmbedPath() + baseClassPath;
 977+ }else{
 978+ scriptRequest = baseClassPath;
 979+ }
 980+ if( ! scriptRequest ){
 981+ mw.log( "Could not get url for class " + className );
 982+ return ;
 983+ }
 984+ }
915985
916986 // Check for any associated style sheets that should be loaded
917987 if( typeof this.stylePaths[ className ] != 'undefined' ){
@@ -918,7 +988,7 @@
919989 }
920990
921991 // Issue the request to load the class (include class name in result callback:
922 - $.getScript( url, function( ) {
 992+ $.getScript( scriptRequest, function( ) {
923993 callback( className );
924994 } );
925995
@@ -997,7 +1067,73 @@
9981068 return $.loader.addClassStyleSheets( sheetSet );
9991069 }
10001070
 1071+
10011072 /**
 1073+ * API Helper functions
 1074+ */
 1075+
 1076+ /*
 1077+ * Get mediaWiki JSON a wrapper for jQuery getJSON:
 1078+ * $j.getJSON( url, [data], [callback] )
 1079+ *
 1080+ * The mediaWiki version lets you skip the url part
 1081+ * mw.getJSON( [url], data, callback );
 1082+ *
 1083+ * Lets you assume a few options:
 1084+ * url is optional
 1085+ * ( If the first argument is not a string we assume a local mediaWiki api request )
 1086+ * callback paramater is not needed we setup the callback automatically
 1087+ * url param 'action'=>'query' is assumed ( if not set to something else in the "data" parma
 1088+ * format is set to "json" automatically
 1089+ *
 1090+ * @param {Mixed} url or data request
 1091+ * @param {Mixed} data or callback
 1092+ * @param {Mixed} callbcak
 1093+ *
 1094+ */
 1095+ $.getJSON = function( arg1, arg2, arg3 ){
 1096+
 1097+ // Set up the url
 1098+ var url = false;
 1099+ url = ( typeof arg1 == 'string' ) ? arg1 : mw.getLocalApiUrl();
 1100+
 1101+ // Set up the data:
 1102+ var data = { };
 1103+ data = ( typeof arg1 == 'object' ) ? arg1 : { };
 1104+ data = ( typeof arg2 == 'object' ) ? arg2 : { };
 1105+
 1106+ // Setup the callback
 1107+ var callback = false;
 1108+ callbcak = ( typeof arg2 == 'function') ? arg2 : false;
 1109+ callback = ( typeof arg3 == 'function') ? arg3 : false;
 1110+
 1111+ // Make sure we got a url:
 1112+ if( !url ){
 1113+ mw.log( 'Error: no api url for api request' );
 1114+ return false;
 1115+ }
 1116+
 1117+ // Add the callback to the url if unset
 1118+ if( url.indexOf( 'callback=' ) == -1 || data[ 'callback' ] == -1 ){
 1119+ // jQuery specific: ( second ? is replaced with the callback )
 1120+ url += ( url.indexOf('?') == -1 ) ? '?callback=?' : '&callback=?';
 1121+ }
 1122+
 1123+ // Add default action if unset:
 1124+ if( !data['action'] )
 1125+ data['action'] = 'query';
 1126+
 1127+ // Add default format if not set:
 1128+ if( !data['format'] )
 1129+ data['format'] = 'json';
 1130+
 1131+ mw.log("run getJSON: " + url + ' data: ' + data);
 1132+ // Pass off the jQuery getJSON request:
 1133+ $j.getJSON( url, data, callback );
 1134+ }
 1135+
 1136+
 1137+ /**
10021138 * Utility Functions
10031139 */
10041140
@@ -1039,6 +1175,40 @@
10401176 }
10411177
10421178 /**
 1179+ * Log a string msg to the console
 1180+ *
 1181+ * all mw.log statements will be removed on minification so
 1182+ * lots of js_log calls will not impact performance in non debug mode
 1183+ *
 1184+ * @param {String} string String to output to console
 1185+ */
 1186+ $.log = function( string ) {
 1187+ // Add any prepend debug strings if necessary
 1188+ if ( mw.getConfig( 'pre-append-log' ) )
 1189+ string = mw.getConfig( 'pre-append-log' ) + string;
 1190+
 1191+ if ( window.console ) {
 1192+ window.console.log( string );
 1193+ } else {
 1194+ /**
 1195+ * Old IE and non-Firebug debug: ( commented out for now )
 1196+ */
 1197+ /*var log_elm = document.getElementById('mv_js_log');
 1198+ if(!log_elm){
 1199+ document.getElementsByTagName("body")[0].innerHTML = document.getElementsByTagName("body")[0].innerHTML +
 1200+ '<div style="position:absolute;z-index:500;top:0px;left:0px;right:0px;height:10px;">'+
 1201+ '<textarea id="mv_js_log" cols="120" rows="5"></textarea>'+
 1202+ '</div>';
 1203+
 1204+ var log_elm = document.getElementById('mv_js_log');
 1205+ }
 1206+ if(log_elm){
 1207+ log_elm.value+=string+"\n";
 1208+ }*/
 1209+ }
 1210+ }
 1211+
 1212+ /**
10431213 * Get a loading spiner html
10441214 * @param {String} [Optional] style Style string to apply to the spiner
10451215 */
@@ -1061,32 +1231,32 @@
10621232 *
10631233 * @param {Function} callback Function to run once DOM and jQuery are ready
10641234 */
1065 - $.addOnloadHook = function( callback ){
1066 - if( mwReadyFlag == false ){
 1235+ $.addOnloadHook = function( callback ){
 1236+ if( mwReadyFlag === false ){
 1237+
 1238+ // Add the callbcak to the onLoad function stack
10671239 mwOnLoadFuncitons.push ( callback );
 1240+
 1241+ // Run the setup call ( won't run if already called earlier)
 1242+ $.setupMwEmbed();
10681243
1069 - // If the dom is ready but we have not run mwSetup::
1070 - // Have a rare case where a dynamically included script is calling mw.addOnloadHook ::
1071 - if ( mwDomReadyFlag && !mwSetupFlag ){
1072 - $.setupMwEmbed();
1073 - }
10741244 return ;
10751245 }
10761246 // If mwReadyFlag is already "ready" call the callback directly:
1077 - callback();
 1247+ callback();
10781248 }
10791249
10801250 /**
10811251 * Runs all the queued functions
10821252 */
1083 - $.runLoadHooks = function ( ){
1084 - // Sets mwReadyFlag to true so that future addOnLoadHook calls
1085 - // know to call the callback directly
1086 - mwReadyFlag = true;
1087 -
 1253+ $.runLoadHooks = function ( ){
10881254 // Run all the queued functions:
10891255 while( mwOnLoadFuncitons.length )
10901256 mwOnLoadFuncitons.pop()();
 1257+
 1258+ // Sets mwReadyFlag to true so that future addOnLoadHook calls
 1259+ // know to call the callback directly
 1260+ mwReadyFlag = true;
10911261 }
10921262
10931263 /**
@@ -1097,13 +1267,13 @@
10981268 // Flag to ensure setup is only run once:
10991269 var mwSetupFlag = false;
11001270
1101 - $.setupMwEmbed = function ( ) {
 1271+ $.setupMwEmbed = function ( ) {
11021272 // Only run the setup once:
11031273 if( mwSetupFlag )
11041274 return ;
11051275 mwSetupFlag = true;
11061276
1107 - js_log( 'mw:setupMwEmbed' );
 1277+ mw.log( 'mw:setupMwEmbed' );
11081278
11091279 // Make sure jQuery is loaded:
11101280 $.load( 'window.jQuery', function(){
@@ -1154,7 +1324,7 @@
11551325 $.domReady = function ( ) {
11561326 if( mwDomReadyFlag )
11571327 return ;
1158 - js_log( 'run:domReady' );
 1328+ mw.log( 'run:domReady' );
11591329 // Set the onDomReady Flag
11601330 mwDomReadyFlag = true;
11611331
@@ -1174,23 +1344,7 @@
11751345 if ( mwOnLoadFuncitons.length ){
11761346 $.setupMwEmbed();
11771347 return ;
1178 - }
1179 -
1180 - // If we have any queued functions we need to run setup as well:
1181 -
1182 - /*
1183 - // Load libs and process videos
1184 - mvJsLoader.embedPlayerCheck( function() {
1185 - // Convert all supported elements into embed players:
1186 - $j.embedPlayers( function(){
1187 - // Run any queued global events:
1188 - mvJsLoader.runQueuedFunctions();
1189 - });
1190 - } );
1191 - } else {
1192 - mvJsLoader.runQueuedFunctions();
1193 - }
1194 - */
 1348+ }
11951349 }
11961350
11971351 /**
@@ -1229,26 +1383,37 @@
12301384 }
12311385
12321386 /**
1233 - * Wrapper for jQuery getScript
 1387+ * Wrapper for jQuery getScript,
 1388+ * Uses the scriptLoader if enabled
12341389 *
12351390 * If jQuery is not ready load it.
12361391 *
1237 - * @param {String} url Url of script
 1392+ * @param {String} scriptRequest The requested path or classNames for the scriptLoader
12381393 * @param {Function} callback Function to call once script is loaded
12391394 */
1240 - $.getScript = function( url, callback ){
 1395+ $.getScript = function( scriptRequest, callback ){
12411396
 1397+ // Set the base url based scriptLoader availability & type of scriptRequest
 1398+ // ( presently script loader only handles "classes" not relative urls:
 1399+ var slpath = $.getScriptLoaderPath();
 1400+ if( slpath && scriptRequest.indexOf('://') == -1 && scriptRequest.indexOf('/') !== 0 ) {
 1401+ url = slpath + '?class=' + scriptRequest;
 1402+ }else{
 1403+ url = scriptRequest;
 1404+ }
 1405+
12421406 // Add on the request parameters to the url:
1243 - url += ( url.indexOf( '?' ) === -1 )? '?' : '&';
1244 -
1245 - // Get url Param also updates the "debug" var
 1407+ url += ( url.indexOf( '?' ) === -1 )? '?' : '&';
12461408 url += $.getUrlParam();
12471409
1248 - js_log( 'mw.getScript: ' + url );
 1410+ mw.log( 'mw.getScript: ' + url );
12491411
12501412 // If jQuery is available and debug is off get the scirpt j
12511413 if( $.isset( 'window.jQuery' ) && $.getConfig( 'debug' ) === false ) {
1252 - $j.getScript( url, callback );
 1414+ $j.getScript( url, function(){
 1415+ if( callback )
 1416+ callback( scriptRequest );
 1417+ });
12531418 return ;
12541419 }
12551420
@@ -1269,10 +1434,12 @@
12701435 if ( !done && (!this.readyState ||
12711436 this.readyState == "loaded" || this.readyState == "complete") ) {
12721437 done = true;
1273 - callback();
 1438+ if( callback )
 1439+ callback( scriptRequest );
12741440 }
1275 - };
1276 -
 1441+ };
 1442+ // Note: we could check for "className" here
 1443+
12771444 // Append the script to the DOM:
12781445 head.appendChild( script );
12791446 }
@@ -1307,11 +1474,11 @@
13081475 foundSheet = true;
13091476 } );
13101477 if( foundSheet ){
1311 - js_log( 'sheet: ' + url + ' already included ' );
 1478+ mw.log( 'sheet: ' + url + ' already included ' );
13121479 return ;
13131480 }
13141481
1315 - js_log( ' add css: ' + url );
 1482+ mw.log( ' add css: ' + url );
13161483 $j( 'head' ).append(
13171484 $j('<link>').attr( {
13181485 'rel' : 'stylesheet',
@@ -1333,7 +1500,7 @@
13341501
13351502 // Local mwEmbedPath variable ( for cache of $.getMwEmbedPath )
13361503 var mwEmbedPath = null;
1337 -
 1504+
13381505 /**
13391506 * Gets the path to the mwEmbed folder
13401507 */
@@ -1353,7 +1520,7 @@
13541521 // Check for scriptLoader include of mwEmbed:
13551522 if ( src.indexOf( 'mwScriptLoader.php' ) !== -1 ) {
13561523 // Script loader is in the root of MediaWiki, Include the default mwEmbed extension path:
1357 - mwpath = src.substr( 0, src.indexOf( 'mwScriptLoader.php' ) ) + $.getConfig( 'mediaWikiPath' );
 1524+ mwpath = src.substr( 0, src.indexOf( 'mwScriptLoader.php' ) ) + $.getConfig( 'mediaWiki_mwEmbedPath' );
13581525 }
13591526
13601527 // Script-loader has jsScriptLoader name when local:
@@ -1363,15 +1530,33 @@
13641531
13651532 // Error out if we could not get the path:
13661533 if( ! mwpath ){
1367 - js_log( "Error could not get mwEmbed path " );
 1534+ mw.log( "Error could not get mwEmbed path " );
13681535 return ;
13691536 }
13701537 // Update the cached var with the absolute path:
13711538 mwEmbedPath = $.absoluteUrl( mwpath ) ;
13721539 return mwEmbedPath;
13731540 }
1374 -
 1541+
13751542 /**
 1543+ * Get Script loader path
 1544+ *
 1545+ * @returns {String}|{Boolean}
 1546+ * Url of the scriptLodaer
 1547+ * false if the scriptLoader is not used
 1548+ */
 1549+ $.getScriptLoaderPath = function(){
 1550+ var src = $.getMwEmbedSrc();
 1551+ if ( src.indexOf( 'mwScriptLoader.php' ) !== -1 ||
 1552+ src.indexOf( 'jsScriptLoader.php' ) !== -1 )
 1553+ {
 1554+ // Return just the script part:
 1555+ return src.split('?')[0];
 1556+ }
 1557+ return false;
 1558+ }
 1559+
 1560+ /**
13761561 * Given a float number of seconds, returns npt format response.
13771562 *
13781563 * @param {Float} sec Seconds
@@ -1379,7 +1564,7 @@
13801565 */
13811566 $.seconds2npt = function( sec, show_ms ) {
13821567 if ( isNaN( sec ) ) {
1383 - // js_log("warning: trying to get npt time on NaN:" + sec);
 1568+ // mw.log("warning: trying to get npt time on NaN:" + sec);
13841569 return '0:0:0';
13851570 }
13861571 var hours = Math.floor( sec / 3600 );
@@ -1400,13 +1585,13 @@
14011586 }
14021587
14031588 /**
1404 - * Take hh:mm:ss,ms or hh:mm:ss.ms input, return the number of seconds
1405 - *
1406 - * @param {String} npt_str NPT time string
1407 - */
 1589+ * Take hh:mm:ss,ms or hh:mm:ss.ms input, return the number of seconds
 1590+ *
 1591+ * @param {String} npt_str NPT time string
 1592+ */
14081593 $.npt2seconds = function ( npt_str ) {
14091594 if ( !npt_str ) {
1410 - // js_log('npt2seconds:not valid ntp:'+ntp);
 1595+ // mw.log('npt2seconds:not valid ntp:'+ntp);
14111596 return false;
14121597 }
14131598 // Strip {npt:}01:02:20 or 32{s} from time if present
@@ -1460,7 +1645,7 @@
14611646 }
14621647 }
14631648 }
1464 - js_log( 'Error: getMwEmbedScriptURL failed to get script path' );
 1649+ mw.log( 'Error: getMwEmbedScriptURL failed to get script path' );
14651650 return false;
14661651 }
14671652
@@ -1504,6 +1689,39 @@
15051690 return mwUrlParam;
15061691 }
15071692
 1693+ /**
 1694+ * Replace url parameters via newParams key value pairs
 1695+ *
 1696+ * @param {String} url Source url to be updated
 1697+ * @param {Object} newParams key, value paris to swap in
 1698+ * @return {String}
 1699+ * the updated url
 1700+ */
 1701+ $.replaceUrlParams = function( url, newParams ) {
 1702+ var parsedUrl = mw.parseUri( url );
 1703+
 1704+
 1705+ if ( parsedUrl.protocol != '' ) {
 1706+ var new_url = parsedUrl.protocol + '://' + parsedUrl.authority + parsedUrl.path + '?';
 1707+ } else {
 1708+ var new_url = parsedUrl.path + '?';
 1709+ }
 1710+
 1711+ // Merge new params:
 1712+ for( var key in newParams ){
 1713+ parsedUrl.queryKey[ key ] = newParams[ key ];
 1714+ }
 1715+
 1716+ // Output to new_url
 1717+ var amp = '';
 1718+ for ( var key in parsedUrl.queryKey ) {
 1719+ var val = parsedUrl.queryKey[ key ];
 1720+ new_url += amp + key + '=' + val;
 1721+ amp = '&';
 1722+ }
 1723+ return new_url;
 1724+ }
 1725+
15081726 /**
15091727 * parseUri 1.2.2
15101728 * (c) Steven Levithan <stevenlevithan.com>
@@ -1569,40 +1787,9 @@
15701788 }else{
15711789 return parsedUrl.protocol + '://' + parsedUrl.authority + parsedUrl.directory + src;
15721790 }
1573 - };
 1791+ };
15741792
1575 - /**
1576 - * Replace url parameters via newParams key value pairs
1577 - *
1578 - * @param {String} url Source url to be updated
1579 - * @param {Object} newParams key, value paris to swap in
1580 - * @return {String}
1581 - * the updated url
1582 - */
1583 - $.replaceUrlParams = function( url, newParams ) {
1584 - var parsedUrl = mw.parseUri( url );
1585 -
1586 -
1587 - if ( parsedUrl.protocol != '' ) {
1588 - var new_url = parsedUrl.protocol + '://' + parsedUrl.authority + parsedUrl.path + '?';
1589 - } else {
1590 - var new_url = parsedUrl.path + '?';
1591 - }
1592 -
1593 - // Merge new params:
1594 - $j.merge( parsedUrl.queryKey, newParams );
1595 -
1596 - // Output to new_url
1597 - var amp = '';
1598 - for ( var key in parsedUrl.queryKey ) {
1599 - var val = parsedUrl.queryKey[ val ];
1600 - new_url += amp + key + '=' + val;
1601 - amp = '&';
1602 - }
1603 - return new_url;
1604 - }
16051793
1606 -
16071794 /**
16081795 * Takes in a string returns an xml dom object
16091796 *
@@ -1621,7 +1808,7 @@
16221809 xmldata.loadXML( str );
16231810 return xmldata;
16241811 } catch (e){
1625 - js_log( 'XML parse ERROR: ' + e.message );
 1812+ mw.log( 'XML parse ERROR: ' + e.message );
16261813 return false;
16271814 }
16281815 }
@@ -1631,14 +1818,14 @@
16321819 try {
16331820 var xmldata = ( new DOMParser() ).parseFromString( str, "text/xml" );
16341821 } catch ( e ) {
1635 - js_log( 'XML parse ERROR: ' + e.message );
 1822+ mw.log( 'XML parse ERROR: ' + e.message );
16361823 return false;
16371824 }
16381825 return xmldata;
16391826 }
16401827 } )( window.mw );
16411828
1642 -// load in js2 stopgap into proper location:
 1829+// Load in js2 stopgap into proper location:
16431830 if ( typeof gMsg != 'undefined' ) {
16441831 mw.addMessages( gMsg )
16451832 }
@@ -1678,8 +1865,8 @@
16791866 "mw.testLang" : "tests/testLang.js",
16801867
16811868 "ctrlBuilder" : "skins/ctrlBuilder.js",
1682 - "kskinConfig" : "skins/kskin/kskin.js",
1683 - "mvpcfConfig" : "skins/mvpcf/mvpcf.js",
 1869+ "kskinConfig" : "skins/kskin/kskinConfig.js",
 1870+ "mvpcfConfig" : "skins/mvpcf/mvpcfConfig.js",
16841871
16851872 "JSON" : "libMwApi/json2.js",
16861873 "$j.cookie" : "jquery/plugins/jquery.cookie.js",
@@ -1775,7 +1962,7 @@
17761963 // Add the module loader function:
17771964 mw.addModuleLoader( 'player', function( callback ){
17781965 var _this = this;
1779 - js_log( 'loadModule: player :' );
 1966+ mw.log( 'loadModule: player :' );
17801967
17811968 // Set module specific class videonojs to loading:
17821969 $j( '.videonojs' ).html( gM( 'mwe-loading_txt' ) );
@@ -1810,7 +1997,7 @@
18111998 dependencyRequest[0].push( '$j.fn.pngFix' );
18121999
18132000 // Do short detection, to avoid extra player library request in ~most~ cases.
1814 - //( ie if browser is firefox include native, if browser is ie include java )
 2001+ //( If browser is firefox include native, if browser is IE include java )
18152002 if( $j.browser.msie )
18162003 dependencyRequest[0].push( 'javaEmbed' )
18172004
@@ -1826,10 +2013,11 @@
18272014
18282015 // Remove no video html elements:
18292016 $j( '.videonojs' ).remove();
1830 - //js_log(" run callback: " + callback );
 2017+ //mw.log(" run callback: " + callback );
18312018
18322019 // Run the callback with name of the module
1833 - callback( 'player' );
 2020+ if( callback )
 2021+ callback( 'player' );
18342022 } );
18352023
18362024 } ); // done with embedPlayer loader.js
@@ -1878,273 +2066,9 @@
18792067 mw.domReady();
18802068 }
18812069
1882 -/**
1883 -* mvJsLoader class handles initialization and js file loads
1884 -
1885 -var mvJsLoader = {
1886 - libreq : { },
1887 - libs : { },
1888 -
1889 - // Base lib flags
1890 - onReadyEvents: new Array(),
1891 - doneReadyEvents: false,
1892 - jQuerySetupFlag: false,
1893 -
1894 - // To keep consistency across threads
1895 - ptime: 0,
1896 - ctime: 0,
1897 -
1898 - load_error: false, // Load error flag (false by default)
1899 - load_time: 0,
1900 - callbacks: new Array(),
1901 - cur_path: null,
1902 - missing_path : null,
1903 - doLoad: function( loadLibs, callback ) {
1904 - this.ctime++;
1905 - if ( loadLibs && loadLibs.length != 0 ) {
1906 - // js_log("doLoad setup::" + JSON.stringify( loadLibs ) );
1907 - // Set up this.libs
1908 - // First check if we already have this library loaded
1909 - var all_libs_loaded = true;
1910 - for ( var i = 0; i < loadLibs.length; i++ ) {
1911 - // Check if the library is already loaded
1912 - if ( ! this.checkObjPath( loadLibs[i] ) ) {
1913 - all_libs_loaded = false;
1914 - }
1915 - }
1916 -
1917 - if ( all_libs_loaded ) {
1918 - js_log( 'Libraries ( ' + loadLibs + ') already loaded... skipping load request' );
1919 - callback();
1920 - return;
1921 - }
1922 -
1923 - // Do a check for any CSS we may need and get it
1924 - for ( var i = 0; i < loadLibs.length; i++ ) {
1925 - if ( typeof mvCssPaths[ loadLibs[i] ] != 'undefined' ) {
1926 - mw.getStyleSheet( mw.getMwEmbedPath() + mvCssPaths[ loadLibs[i] ] );
1927 - }
1928 - }
1929 -
1930 - // Check if we should use the script loader to combine all the requests into one
1931 - // ( the scriptloader defines the mwSlScript global )
1932 - if ( typeof mwSlScript != 'undefined' ) {
1933 - var class_set = '';
1934 - var last_class = '';
1935 - var coma = '';
1936 - for ( var i = 0; i < loadLibs.length; i++ ) {
1937 - var curLib = loadLibs[i];
1938 - // Only add if not included yet:
1939 - if ( ! this.checkObjPath( curLib ) ) {
1940 - class_set += coma + curLib;
1941 - last_class = curLib;
1942 - coma = ',';
1943 - }
1944 - }
1945 - // Build the url to the scriptServer striping its request parameters:
1946 - var puri = mw.parseUri( getMwEmbedURL() );
1947 - if ( ( getMwEmbedURL().indexOf( '://' ) != -1 )
1948 - && puri.host != mw.parseUri( document.URL ).host )
1949 - {
1950 - var scriptPath = puri.protocol + '://' + puri.authority + puri.path;
1951 - } else {
1952 - var scriptPath = puri.path;
1953 - }
1954 - // js_log('scriptServer Path is: ' + scriptPath + "\n host script path:" + getMwEmbedURL() );
1955 - this.libs[ last_class ] = scriptPath + '?class=' + class_set +
1956 - '&' + mw.getUrlParam();
1957 -
1958 - } else {
1959 - // Do many requests
1960 - for ( var i = 0; i < loadLibs.length; i++ ) {
1961 - var curLib = loadLibs[i];
1962 - if ( curLib ) {
1963 - var libLoc = mvGetClassPath( curLib );
1964 - // Do a direct load of the file (pass along unique request id from
1965 - // request or mwEmbed Version )
1966 - var qmark = ( libLoc.indexOf( '?' ) !== true ) ? '?' : '&';
1967 - this.libs[curLib] = mw.getMwEmbedPath() + libLoc + qmark + mw.getUrlParam();
1968 - }
1969 - }
1970 - }
1971 - }
1972 -
1973 - if ( callback ) {
1974 - this.callbacks.push( callback );
1975 - }
1976 - if ( this.checkLoading() ) {
1977 - // @@todo we should check the <script> Element .onLoad property to
1978 - // make sure its just not a very slow connection
1979 - // (even though the class is not loaded)
1980 - if ( this.load_time++ > 4000 ) { // Time out after ~80 seconds
1981 - js_log( gM( 'mwe-error_load_lib', [mvGetClassPath( this.missing_path ), this.missing_path] ) );
1982 - this.load_error = true;
1983 - } else {
1984 - setTimeout( 'mw.load()', 20 );
1985 - }
1986 - } else {
1987 - // js_log('checkLoading passed. Running callbacks...');
1988 - // Only do callbacks if we are in the same instance (weird concurrency issue)
1989 - var cb_count = 0;
1990 - for ( var i = 0; i < this.callbacks.length; i++ )
1991 - cb_count++;
1992 - // js_log('RESET LIBS: loading is: '+ loading + ' callback count: '+cb_count +
1993 - // ' p:'+ this.ptime +' c:'+ this.ctime);
1994 -
1995 - // Reset the libs
1996 - this.libs = { };
1997 - // js_log('done loading, do call: ' + this.callbacks[0] );
1998 - while ( this.callbacks.length != 0 ) {
1999 - if ( this.ptime == this.ctime - 1 ) { // Enforce thread consistency
2000 - this.callbacks.pop()();
2001 - // func = this.callbacks.pop();
2002 - // js_log(' run: '+this.ctime+ ' p: ' + this.ptime + ' ' +loading+ ' :'+ func);
2003 - // func();
2004 - } else {
2005 - // Re-issue doLoad ( ptime will be set to ctime so we should catch up)
2006 - setTimeout( 'mw.load()', 25 );
2007 - break;
2008 - }
2009 - }
2010 - }
2011 - this.ptime = this.ctime;
2012 - },
2013 - doLoadDepMode: function( loadChain, callback ) {
2014 - // Firefox executes JS in the order in which it is included, so just directly issue the request
2015 - if ( $j.browser.firefox ) {
2016 - var loadSet = [];
2017 - for ( var i = 0; i < loadChain.length; i++ ) {
2018 - for ( var j = 0; j < loadChain[i].length; j++ ) {
2019 - loadSet.push( loadChain[i][j] );
2020 - }
2021 - }
2022 - mw.load( loadSet, callback );
2023 - } else {
2024 - // Safari and IE tend to execute out of order so load with dependency checks
2025 - mw.load( loadChain.shift(), function() {
2026 - if ( loadChain.length != 0 ) {
2027 - mw.load( loadChain, callback );
2028 - } else {
2029 - callback();
2030 - }
2031 - } );
2032 - }
2033 - },
2034 - checkLoading: function() {
2035 - var loading = 0;
2036 - var i = null;
2037 - for ( var i in this.libs ) { // for/in loop is OK on an object
2038 - if ( !this.checkObjPath( i ) ) {
2039 - if ( !this.libreq[i] ) {
2040 - loadExternalJs( this.libs[i] );
2041 - }
2042 - this.libreq[i] = 1;
2043 - // js_log("has not yet loaded: " + i);
2044 - loading = 1;
2045 - }
2046 - }
2047 - return loading;
2048 - },
2049 - checkObjPath: function( libVar ) {
2050 - if ( !libVar )
2051 - return false;
2052 - var objPath = libVar.split( '.' )
2053 - var cur_path = '';
2054 - for ( var p = 0; p < objPath.length; p++ ) {
2055 - cur_path = ( cur_path == '' ) ? cur_path + objPath[p] : cur_path + '.' + objPath[p];
2056 - eval( 'var ptest = typeof ( ' + cur_path + ' ); ' );
2057 - if ( ptest == 'undefined' ) {
2058 - this.missing_path = cur_path;
2059 - return false;
2060 - }
2061 - }
2062 - this.cur_path = cur_path;
2063 - return true;
2064 - },
2065 - //
2066 - // checks for jQuery and adds the $j noConflict var
2067 - //
2068 - jQueryCheck: function( callback ) {
2069 - // js_log( 'jQueryCheck::' + this.jQuerySetupFlag);
2070 - var _this = this;
2071 - if ( _global['$j'] && _this.jQuerySetupFlag ) {
2072 - callback(); // call the callback now
2073 - }
2074 - // Load jQuery
2075 - _this.doLoad( [
2076 - 'window.jQuery'
2077 - ], function() {
2078 -
2079 - } );
2080 - },
2081 - embedPlayerCheck:function( callback ) {
2082 - var _this = this;
2083 - js_log( 'embedPlayerCheck:' );
2084 - // Make sure we have jQuery
2085 - _this.jQueryCheck( function() {
2086 - // set class videonojs to loading
2087 - $j( '.videonojs' ).html( gM( 'mwe-loading_txt' ) );
2088 - // Set up the embed video player class request: (include the skin js as well)
2089 - var depReq = [
2090 - [
2091 - '$j.ui',
2092 - 'embedPlayer',
2093 - 'ctrlBuilder',
2094 - '$j.cookie'
2095 - ],
2096 - [
2097 - '$j.ui.slider'
2098 - ]
2099 - ];
2100 -
2101 - // add any requested skins (supports multiple skins per single page)
2102 - if ( mw.skin_list ) {
2103 - for ( var i in mw.skin_list ) {
2104 - depReq[0].push( mw.skin_list[i] + 'Config' );
2105 - }
2106 - }
2107 -
2108 - // Add PNG fix if needed:
2109 - if ( $j.browser.msie || $j.browser.version < 7 )
2110 - depReq[0].push( '$j.fn.pngFix' );
2111 -
2112 - // load the video libs:
2113 - _this.doLoadDepMode( depReq, function() {
2114 - embedTypes.init();
2115 - callback();
2116 - $j( '.videonojs' ).remove();
2117 - } );
2118 - } );
2119 - },
2120 - addLoadEvent: function( fn ) {
2121 - // js_log('add ready event: ' + fn );
2122 - this.onReadyEvents.push( fn );
2123 - },
2124 - // Check the jQuery flag. This way, when remote embedding, we don't load jQuery
2125 - // unless mw.addOnloadHook was used or there is video on the page.
2126 - runQueuedFunctions: function() {
2127 - js_log( "runQueuedFunctions" );
2128 - var _this = this;
2129 - this.jQueryCheck( function() {
2130 - _this.runReadyEvents();
2131 - _this.doneReadyEvents = true;
2132 - } );
2133 - },
2134 - runReadyEvents: function() {
2135 - js_log( "runReadyEvents" + this.onReadyEvents.length );
2136 - while ( this.onReadyEvents.length ) {
2137 - var func = this.onReadyEvents.shift();
2138 - // js_log('run onReady:: ' + func );
2139 - func();
2140 - }
2141 - }
2142 -}
2143 -*/
2144 -
2145 -
21462070 /*
21472071 * Store all the mwEmbed jQuery-specific bindings
2148 - * (set up after jQuery is available).
 2072+ * ( to be run after jQuery is available ).
21492073 *
21502074 * These functions are generally are loaders that do the dynamic mapping of
21512075 * dependencies for a given component
@@ -2154,7 +2078,7 @@
21552079 *
21562080 */
21572081 function mwDojQueryBindings() {
2158 - js_log( 'mv_jqueryBindings' );
 2082+ mw.log( 'mv_jqueryBindings' );
21592083 ( function( $ ) {
21602084
21612085 /**
@@ -2186,7 +2110,7 @@
21872111 * @param {Object} proxyConfig
21882112 */
21892113 $.apiProxy = function( mode, proxyConfig, callback ) {
2190 - js_log( 'do apiProxy setup' );
 2114+ mw.log( 'do apiProxy setup' );
21912115 mw.load( [
21922116 'mw.proxy',
21932117 'JSON'
@@ -2206,7 +2130,7 @@
22072131
22082132 // non selector based add-media-wizard direct invocation with loader
22092133 $.addMediaWiz = function( options, callback ) {
2210 - js_log( ".addMediaWiz call" );
 2134+ mw.log( ".addMediaWiz call" );
22112135 // check if already loaded:
22122136 if ( window['rsdMVRS'] ) {
22132137 window['rsdMVRS'].showDialog();
@@ -2295,13 +2219,13 @@
22962220 '$j.ui.tabs'
22972221 ]
22982222 ], function() {
2299 - js_log( 'calling new mvSequencer' );
 2223+ mw.log( 'calling new mvSequencer' );
23002224 // Initialise the sequence object (it will take over from there)
23012225 // No more than one mvSeq obj for now:
23022226 if ( !mw['mvSeq'] ) {
23032227 mw['mvSeq'] = new mvSequencer( options );
23042228 } else {
2305 - js_log( 'mvSeq already init' );
 2229+ mw.log( 'mvSeq already init' );
23062230 }
23072231 } );
23082232 }
@@ -2323,14 +2247,14 @@
23242248 var sElm = $j( this.selector ).get( 0 );
23252249 if ( sElm['firefogg'] ) {
23262250 if ( sElm['firefogg'] == 'loading' ) {
2327 - js_log( "Queued firefogg operations ( firefogg " +
 2251+ mw.log( "Queued firefogg operations ( firefogg " +
23282252 "not done loading ) " );
23292253 $j.extend( queuedFirefoggConf, options );
23302254 return false;
23312255 }
23322256 // Update properties
23332257 for ( var i in options ) {
2334 - js_log( "firefogg::updated: " + i + ' to ' + options[i] );
 2258+ mw.log( "firefogg::updated: " + i + ' to ' + options[i] );
23352259 sElm['firefogg'][i] = options[i];
23362260 }
23372261 return sElm['firefogg'];
@@ -2364,7 +2288,7 @@
23652289 }
23662290 // Make sure we have everything loaded that we need:
23672291 mw.load( loadSet, function() {
2368 - js_log( 'firefogg libs loaded. target select:' + options.selector );
 2292+ mw.log( 'firefogg libs loaded. target select:' + options.selector );
23692293 // Select interface provider based on whether we want to include the
23702294 // encoder interface or not
23712295 if ( options.encoder_interface ) {
@@ -2377,10 +2301,10 @@
23782302 var selectorElement = $j( options.selector ).get( 0 );
23792303 selectorElement['firefogg'] = myFogg;
23802304
2381 - js_log( 'pre:' + selectorElement['firefogg']['firefogg_form_action'] )
 2305+ mw.log( 'pre:' + selectorElement['firefogg']['firefogg_form_action'] )
23822306 if ( queuedFirefoggConf )
23832307 $j.extend( selectorElement['firefogg'], queuedFirefoggConf );
2384 - js_log( 'post:' + selectorElement['firefogg']['firefogg_form_action'] )
 2308+ mw.log( 'post:' + selectorElement['firefogg']['firefogg_form_action'] )
23852309 }
23862310 } );
23872311 }
@@ -2391,7 +2315,7 @@
23922316 //add a special attribute to the selector:
23932317 if ( sElm['fogg_render'] ) {
23942318 if ( sElm['fogg_render'] == 'loading' ) {
2395 - js_log( "Error: called firefoggRender while loading" );
 2319+ mw.log( "Error: called firefoggRender while loading" );
23962320 return false;
23972321 }
23982322 // Call or update the property:
@@ -2550,7 +2474,7 @@
25512475 * @param callback The callback function to pass the token to
25522476 */
25532477 function get_mw_token( title, api_url, callback ) {
2554 - js_log( ':get_mw_token:' );
 2478+ mw.log( ':get_mw_token:' );
25552479 if ( !title && wgUserName ) {
25562480 title = 'User:' + wgUserName;
25572481 }
@@ -2575,74 +2499,13 @@
25762500 }
25772501 );
25782502 }
2579 -// Do a remote or local API request based on request URL
2580 -// @param options: url, data, cbParam, callback
2581 -function do_api_req( options, callback ) {
2582 - if ( typeof options.data != 'object' ) {
2583 - return js_error( 'Error: request paramaters must be an object' );
2584 - }
2585 - // Generate the URL if it's missing
2586 - if ( typeof options.url == 'undefined' || !options.url ) {
2587 - if ( typeof wgServer == 'undefined' ) {
2588 - return js_error( 'Error: no api url for api request' );
2589 - }
2590 - options.url = mw.getLocalApiUrl();
2591 - }
2592 - if ( typeof options.data == 'undefined' )
2593 - options.data = { };
25942503
2595 - // Force format to JSON
2596 - options.data['format'] = 'json';
2597 -
2598 - // If action is not set, assume query
2599 - if ( ! options.data['action'] )
2600 - options.data['action'] = 'query';
2601 -
2602 - // js_log('do api req: ' + options.url +'?' + jQuery.param(options.data) );
2603 - if ( options.url == 'proxy' && mw.proxy ) {
2604 - // assume the proxy is already "setup" since mw.proxy is defined.
2605 - // @@todo should probably integrate that setup into the api call
2606 - mw.proxy.doRequest( options.data, callback );
2607 - } else if ( mw.parseUri( document.URL ).host == mw.parseUri( options.url ).host ) {
2608 - // Local request: do API request directly
2609 - $j.ajax( {
2610 - type: "POST",
2611 - url: options.url,
2612 - data: options.data,
2613 - dataType: 'json', // API requests _should_ always return JSON data:
2614 - async: false,
2615 - success: function( data ) {
2616 - callback( data );
2617 - },
2618 - error: function( e ) {
2619 - js_error( ' error' + e + ' in getting: ' + options.url );
2620 - }
2621 - } );
2622 - } else {
2623 - // Remote request
2624 - // Set the callback param if it's not already set
2625 - if ( typeof options.jsonCB == 'undefined' )
2626 - options.jsonCB = 'callback';
2627 -
2628 - var req_url = options.url;
2629 - var paramAnd = ( req_url.indexOf( '?' ) == -1 ) ? '?' : '&';
2630 - // Put all the parameters into the URL
2631 - for ( var i in options.data ) {
2632 - req_url += paramAnd + encodeURIComponent( i ) + '=' + encodeURIComponent( options.data[i] );
2633 - paramAnd = '&';
2634 - }
2635 - var fname = 'mycpfn_' + ( mw.cb_count++ );
2636 - window[ fname ] = callback;
2637 - req_url += '&' + options.jsonCB + '=' + fname;
2638 - loadExternalJs( req_url );
2639 - }
2640 -}
2641 -// Do a request:
2642 -// @@note this contains metavid specific local vs remote api remapping.
2643 -// this should be depreciated and we should use "$j.get" or an explicate api call
 2504+// Do a metavid callback request:
 2505+// NOTE: this contains metavid specific local vs remote api remapping will be removed shortly
 2506+// this should be depreciated and we should use "$j.get" or an api call
26442507 // (we should not mix the two request types)
26452508 function do_request( req_url, callback ) {
2646 - js_log( 'do_request::req_url:' + mw.parseUri( document.URL ) + ' != ' + mw.parseUri( req_url ).host );
 2509+ mw.log( 'do_request::req_url:' + mw.parseUri( document.URL ) + ' != ' + mw.parseUri( req_url ).host );
26472510 // If we are doing a request to the same domain or relative link, do a normal GET
26482511 if ( mw.parseUri( document.URL ).host == mw.parseUri( req_url ).host ||
26492512 req_url.indexOf( '://' ) == -1 ){ // if its a relative url go directly as well
@@ -2661,19 +2524,19 @@
26622525 // Prepend json_ to feed_format if not already requesting json format (metavid specific)
26632526 if ( req_url.indexOf( "feed_format=" ) != -1 && req_url.indexOf( "feed_format=json" ) == -1 )
26642527 req_url = req_url.replace( /feed_format=/, 'feed_format=json_' );
2665 - loadExternalJs( req_url + '&cb=mv_jsdata_cb&cb_inx=' + ( global_req_cb.length -1 ) );
 2528+ $j.getScript( req_url + '&cb=mv_jsdata_cb&cb_inx=' + ( global_req_cb.length -1 ) );
26662529 }
26672530 }
26682531
26692532 function mv_jsdata_cb( response ) {
2670 - js_log( 'f:mv_jsdata_cb:' + response['cb_inx'] );
 2533+ mw.log( 'f:mv_jsdata_cb:' + response['cb_inx'] );
26712534 // Run the callback from the global request callback object
26722535 if ( !global_req_cb[response['cb_inx']] ) {
2673 - js_log( 'missing req cb index' );
 2536+ mw.log( 'missing req cb index' );
26742537 return false;
26752538 }
26762539 if ( !response['pay_load'] ) {
2677 - js_log( "missing pay load" );
 2540+ mw.log( "missing pay load" );
26782541 return false;
26792542 }
26802543 switch( response['content-type'] ) {
@@ -2685,33 +2548,12 @@
26862549 }
26872550 break
26882551 default:
2689 - js_log( 'bad response type' + response['content-type'] );
 2552+ mw.log( 'bad response type' + response['content-type'] );
26902553 return false;
26912554 break;
26922555 }
26932556 global_req_cb[response['cb_inx']]( response['pay_load'] );
26942557 }
2695 -// Load external JS via DOM injection
2696 -function loadExternalJs( url, callback ) {
2697 - js_log( 'load js: ' + url );
2698 - // if(window['$j']) // use jquery call:
2699 - /*$j.ajax({
2700 - type: "GET",
2701 - url: url,
2702 - dataType: 'script',
2703 - cache: true
2704 - });*/
2705 - // else{
2706 - var e = document.createElement( "script" );
2707 - e.setAttribute( 'src', url );
2708 - e.setAttribute( 'type', "text/javascript" );
2709 - /*if(callback)
2710 - e.onload = callback;
2711 - */
2712 - // e.setAttribute('defer', true);
2713 - document.getElementsByTagName( "head" )[0].appendChild( e );
2714 - // }
2715 -}
27162558
27172559 if ( typeof DOMParser == "undefined" ) {
27182560 DOMParser = function () { }
@@ -2735,34 +2577,4 @@
27362578 /*
27372579 * Utility functions
27382580 */
2739 -function js_log( string ) {
2740 - // Add any prepend debug strings if necessary
2741 - if ( mw.getConfig( 'pre-append-log' ) )
2742 - string = mw.getConfig( 'pre-append-log' ) + string;
2743 -
2744 - if ( window.console ) {
2745 - window.console.log( string );
2746 - } else {
2747 - /**
2748 - * old IE and non-Firebug debug:
2749 - */
2750 - /*var log_elm = document.getElementById('mv_js_log');
2751 - if(!log_elm){
2752 - document.getElementsByTagName("body")[0].innerHTML = document.getElementsByTagName("body")[0].innerHTML +
2753 - '<div style="position:absolute;z-index:500;top:0px;left:0px;right:0px;height:10px;">'+
2754 - '<textarea id="mv_js_log" cols="120" rows="5"></textarea>'+
2755 - '</div>';
27562581
2757 - var log_elm = document.getElementById('mv_js_log');
2758 - }
2759 - if(log_elm){
2760 - log_elm.value+=string+"\n";
2761 - }*/
2762 - }
2763 - return false;
2764 -}
2765 -
2766 -function js_error( string ) {
2767 - alert( string );
2768 - return false;
2769 -}
Index: branches/js2-work/phase3/js2/mwEmbed/jsScriptLoader.php
@@ -26,14 +26,16 @@
2727 var $rKey = ''; // the request key
2828 var $error_msg = '';
2929 var $debug = false;
30 - var $jsvarurl = false; // whether we should include generated JS (special class '-')
 30+
 31+ // Whether we should include generated JS (special class '-')
 32+ var $jsvarurl = false;
3133 var $doProcReqFlag = true;
3234
3335 function outputFromCache(){
3436 // Process the request
35 - $this->rKey = $this->preProcRequestVars();
 37+ $this->requestKey = $this->preProcRequestVars();
3638 // Setup file cache object
37 - $this->sFileCache = new simpleFileCache( $this->rKey );
 39+ $this->sFileCache = new simpleFileCache( $this->requestKey );
3840 if ( $this->sFileCache->isFileCached() ) {
3941 // Just output headers so we can use PHP's @readfile::
4042 $this->outputJsHeaders();
@@ -47,30 +49,26 @@
4850 global $wgJSAutoloadClasses, $wgJSAutoloadLocalClasses, $IP,
4951 $wgEnableScriptMinify, $wgUseFileCache, $wgExtensionMessagesFiles;
5052
51 - //load the ExtensionMessagesFiles
52 - $wgExtensionMessagesFiles['mwEmbed'] = realpath( dirname( __FILE__ ) ) . '/php/languages/mwEmbed.i18n.php';
 53+ // Load the ExtensionMessagesFiles
 54+ $wgExtensionMessagesFiles[ 'mwEmbed' ] = realpath( dirname( __FILE__ ) ) . '/php/languages/mwEmbed.i18n.php';
5355
54 - //reset the rKey:
55 - $this->rKey = '';
 56+ // Reset the requestKey:
 57+ $this->requestKey = '';
5658 //do the post proc request with configuration vars:
5759 $this->postProcRequestVars();
5860 //update the filename (if gzip is on)
5961 $this->sFileCache->getCacheFileName();
6062
61 - // Setup script loader header info
62 - // @@todo we might want to put these into the mw var per class request set
63 - // and or include a callback to avoid pulling in old browsers that don't support
64 - // the onLoad attribute for script elements.
65 - $this->jsout .= 'var mwSlScript = "' . $_SERVER['SCRIPT_NAME'] . '";' . "\n";
66 - $this->jsout .= 'var mwSlGenISODate = "' . date( 'c' ) . '";' . "\n";
67 - $this->jsout .= 'var mwSlURID = "' . htmlspecialchars( $this->urid ) . '";' . "\n";
 63+ // Setup script loader header:
 64+ $this->jsout .= 'var mwScriptLoaderDate = "' . date( 'c' ) . '";' . "\n";
 65+ $this->jsout .= 'var mwScriptLoaderRequestKey = "' . htmlspecialchars( $this->requestKey ) . '";' . "\n";
6866 $this->jsout .= 'var mwLang = "' . htmlspecialchars( $this->langCode ) . '";' . "\n";
6967 // Build the output
7068
7169 // Swap in the appropriate language per js_file
7270 foreach ( $this->jsFileList as $classKey => $file_name ) {
73 - //get the script content
74 - $jstxt = $this->getScriptText($classKey, $file_name);
 71+ // Get the script content
 72+ $jstxt = $this->getScriptText( $classKey, $file_name );
7573 if( $jstxt ){
7674 $this->jsout .= $this->doProcessJs( $jstxt );
7775 }
@@ -176,10 +174,14 @@
177175 // Output JS MIME type:
178176 header( 'Content-Type: text/javascript' );
179177 header( 'Pragma: public' );
180 - // Cache for 1 day ( we should always change the request URL
181 - // based on the SVN or article version.
182 - $one_day = 60 * 60 * 24;
183 - header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $one_day ) . " GM" );
 178+ if( $this->debug ){
 179+ header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
 180+ header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
 181+ }else{
 182+ // Cache for 2 days ( we should always change the request URL so this could be higher in my opinion)
 183+ $one_day = 60 * 60 * 24 * 2;
 184+ header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $one_day ) . " GM" );
 185+ }
184186 }
185187
186188 function outputJsWithHeaders() {
@@ -269,7 +271,7 @@
270272 }
271273 if( $doAddWT ){
272274 $this->jsFileList[$reqClass] = true;
273 - $this->rKey .= $reqClass;
 275+ $this->requestKey .= $reqClass;
274276 $this->jsvarurl = true;
275277 }
276278 continue;
@@ -282,7 +284,7 @@
283285 $this->error_msg .= 'Requested class: ' . htmlspecialchars( $reqClass ) . ' not found' . "\n";
284286 }else{
285287 $this->jsFileList[ $reqClass ] = $jsFilePath;
286 - $this->rKey .= $reqClass;
 288+ $this->requestKey .= $reqClass;
287289 }
288290 }
289291 }
@@ -290,14 +292,14 @@
291293
292294
293295 // Add the language code to the rKey:
294 - $this->rKey .= '_' . $wgContLanguageCode;
 296+ $this->requestKey .= '_' . $wgContLanguageCode;
295297
296298 // Add the unique rid
297 - $this->rKey .= $this->urid;
 299+ $this->requestKey .= $this->urid;
298300
299301 // Add a minify flag
300302 if ( $wgEnableScriptMinify ) {
301 - $this->rKey .= '_min';
 303+ $this->requestKey .= '_min';
302304 }
303305 }
304306 /**
@@ -404,7 +406,7 @@
405407 global $wgEnableScriptLocalization;
406408 // Strip out js_log debug lines (if not in debug mode)
407409 if( !$this->debug )
408 - $str = preg_replace('/\n\s*js_log\(([^\)]*\))*\s*[\;\n]/U', "\n", $str);
 410+ $str = preg_replace('/\n\s*mw\.log\(([^\)]*\))*\s*[\;\n]/U', "\n", $str);
409411
410412 // Do language swap by index:
411413 if ( $wgEnableScriptLocalization ){
@@ -431,7 +433,8 @@
432434 }
433435 $ignorenext = false;
434436 $inquote = false;
435 - //look for closing } not inside quotes::
 437+
 438+ // Look for closing } not inside quotes::
436439 for ( $i = $returnIndex['s']; $i < strlen( $str ); $i++ ) {
437440 $char = $str[$i];
438441 if ( $ignorenext ) {
@@ -478,22 +481,23 @@
479482
480483 static public function getMsgKeys(& $jmsg, $langCode = false){
481484 global $wgContLanguageCode;
482 - //check the langCode
 485+ // Check the langCode
483486 if(!$langCode)
484487 $langCode = $wgContLanguageCode;
485488
486489 // Get the msg keys for the a json array
487490 foreach ( $jmsg as $msgKey => $default_en_value ) {
488 - $jmsg[$msgKey] = wfMsgGetKey( $msgKey, true, $langCode, false );
 491+ $jmsg[ $msgKey ] = wfMsgGetKey( $msgKey, true, $langCode, false );
489492 }
490493 }
491494 function languageMsgReplace( $json_str ) {
492495 $jmsg = FormatJson::decode( '{' . $json_str . '}', true );
493496 // Do the language lookup
494497 if ( $jmsg ) {
495 - //see if any msgKey has the PLURAL template tag
 498+
 499+ // See if any msgKey has the PLURAL template tag
496500 //package in PLURAL mapping
497 - self::getMsgKeys($jmsg, $this->langCode);
 501+ self::getMsgKeys( $jmsg, $this->langCode );
498502
499503 // Return the updated loadGM JSON with updated msgs:
500504 return FormatJson::encode( $jmsg );
@@ -517,20 +521,20 @@
518522 var $rKey = null;
519523
520524 public function __construct( &$rKey ) {
521 - $this->rKey = $rKey;
 525+ $this->requestKey = $rKey;
522526 $this->getCacheFileName();
523527 }
524528
525529 public function getCacheFileName() {
526530 global $wgUseGzip, $wgScriptCacheDirectory;
527531
528 - $hash = md5( $this->rKey );
 532+ $hash = md5( $this->requestKey );
529533 # Avoid extension confusion
530 - $key = str_replace( '.', '%2E', urlencode( $this->rKey ) );
 534+ $key = str_replace( '.', '%2E', urlencode( $this->requestKey ) );
531535
532536 $hash1 = substr( $hash, 0, 1 );
533537 $hash2 = substr( $hash, 0, 2 );
534 - $this->filename = "{$wgScriptCacheDirectory}/{$hash1}/{$hash2}/{$this->rKey}.js";
 538+ $this->filename = "{$wgScriptCacheDirectory}/{$hash1}/{$hash2}/{$this->requestKey}.js";
535539
536540 // Check for defined files::
537541 if( is_file( $this->filename ) )
Index: branches/js2-work/phase3/js2/mwEmbed/libTimedText/mvTextInterface.js
@@ -33,7 +33,7 @@
3434 },
3535 // @@todo separate out data loader & data display
3636 getTextTracks:function() {
37 - // js_log("load timed text from roe: "+ this.pe.roe);
 37+ // mw.log("load timed text from roe: "+ this.pe.roe);
3838 var _this = this;
3939 // if roe not yet loaded do load it:
4040 if ( this.pe.roe || _this.pe.wikiTitleKey ) {
@@ -50,14 +50,14 @@
5151 _this.getTextTracksWikiTitle()
5252 }
5353 } else {
54 - js_log( 'row data ready (no roe request)' );
 54+ mw.log( 'row data ready (no roe request)' );
5555 _this.getParseTimedText_rowReady();
5656 }
5757 } else {
5858 if ( this.pe.media_element.textSourceExists() ) {
5959 _this.getParseTimedText_rowReady();
6060 } else {
61 - js_log( 'no roe data or timed text sources' );
 61+ mw.log( 'no roe data or timed text sources' );
6262 }
6363 }
6464 },
@@ -69,23 +69,19 @@
7070 if ( typeof wgNamespaceIds != 'undefined' && wgNamespaceIds['timedtext'] ) {
7171 timedtext_ns = wgNamespaceIds['timedtext'];
7272 }
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 ) {
 73+ var request = {
 74+ 'list' : 'allpages',
 75+ 'apprefix' : _this.pe.wikiTitleKey,
 76+ 'apnamespace' : timedtext_ns,
 77+ 'prop':'revisions'
 78+ }'
 79+ mw.getJSON( apiUrl, request, function( subData ) {
8280 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 ) {
 81+ var request = {
 82+ 'list' : 'allpages',
 83+ 'apprefix' : 'TimedText:' + _this.pe.wikiTitleKey
 84+ };
 85+ mw.getJSON( apiUrl, request, function( subData ) {
9086 _this.doProcSubPages( subData, wgServer + wgScriptPath );
9187 } );
9288 } else {
@@ -98,79 +94,74 @@
9995 // look for text tracks:
10096 var foundTextTracks = false;
10197
 98+ var request ={
 99+ 'meta' : 'siteinfo',
 100+ 'siprop' : 'languages'
 101+ }
 102+ var url = hostPath + '/api.php';
102103 // get all the known languages:
103 - do_api_req( {
104 - 'url': hostPath + '/api.php',
105 - 'data': {
106 - 'meta' : 'siteinfo',
107 - 'siprop' : 'languages'
 104+ mw.getJSON(url , request, function( langDataRaw ) {
 105+ var langData = { };
 106+ var lagRaw = langDataRaw.query.languages;
 107+ for ( var j in lagRaw ) {
 108+ langData[ lagRaw[j].code ] = lagRaw[j]['*'];
108109 }
109 - }, function( langDataRaw ) {
110 - var langData = { };
111 - var lagRaw = langDataRaw.query.languages;
112 - for ( var j in lagRaw ) {
113 - langData[ lagRaw[j].code ] = lagRaw[j]['*'];
 110+ for ( var i in subData.query.allpages ) {
 111+ var subPage = subData.query.allpages[i];
 112+ var langKey = subPage.title.split( '.' );
 113+ var extension = langKey.pop();
 114+ langKey = langKey.pop();
 115+ if ( ! _this.suportedMime[ extension ] ) {
 116+ mw.log( 'Error: unknown extension:' + extension );
 117+ continue;
114118 }
115 - for ( var i in subData.query.allpages ) {
116 - var subPage = subData.query.allpages[i];
117 - var langKey = subPage.title.split( '.' );
118 - var extension = langKey.pop();
119 - langKey = langKey.pop();
120 - if ( ! _this.suportedMime[ extension ] ) {
121 - js_log( 'Error: unknown extension:' + extension );
122 - continue;
123 - }
124119
125 - if ( !langData[ langKey] ) {
126 - js_log( 'Error: langkey:' + langKey + ' not found' );
127 - } else {
128 - var textElm = document.createElement( 'text' );
129 - $j( textElm ).attr( {
130 - 'category' : 'SUB',
131 - 'lang' : langKey,
132 - 'type' : _this.suportedMime[ extension ],
133 - 'title' : langData[ langKey]
134 - } );
135 - // We use the api since ?action raw on the real title has cache issues
136 - $j( textElm ).attr( {
137 - 'apisrc' : hostPath + '/api.php',
138 - 'titleKey' : subPage.title
139 - } );
140 - _this.pe.media_element.tryAddSource( textElm );
141 - foundTextTracks = true;
142 - }
143 - }
144 - // after all text loaded (or we have allready checked commons
145 - if ( foundTextTracks || hostPath.indexOf( 'commons.wikimedia' ) !== -1 ) {
146 - // alert('calling getParseTimedText_rowReady ');
147 - _this.getParseTimedText_rowReady();
 120+ if ( !langData[ langKey] ) {
 121+ mw.log( 'Error: langkey:' + langKey + ' not found' );
148122 } else {
149 - _this.checkSharedRepo();
 123+ var textElm = document.createElement( 'text' );
 124+ $j( textElm ).attr( {
 125+ 'category' : 'SUB',
 126+ 'lang' : langKey,
 127+ 'type' : _this.suportedMime[ extension ],
 128+ 'title' : langData[ langKey]
 129+ } );
 130+ // We use the api since ?action raw on the real title has cache issues
 131+ $j( textElm ).attr( {
 132+ 'apisrc' : hostPath + '/api.php',
 133+ 'titleKey' : subPage.title
 134+ } );
 135+ _this.pe.media_element.tryAddSource( textElm );
 136+ foundTextTracks = true;
150137 }
151 - } ); // do_api_req({
 138+ }
 139+ // after all text loaded (or we have allready checked commons
 140+ if ( foundTextTracks || hostPath.indexOf( 'commons.wikimedia' ) !== -1 ) {
 141+ // alert('calling getParseTimedText_rowReady ');
 142+ _this.getParseTimedText_rowReady();
 143+ } else {
 144+ _this.checkSharedRepo();
 145+ }
 146+ } );
152147 },
153148 checkSharedRepo:function() {
154149 var _this = this;
155 - js_log( 'checking for shared value of image' );
 150+ mw.log( 'checking for shared value of image' );
156151 // check if its a shared repo
157 - do_api_req( {
158 - 'data': {
159 - 'action':'query',
160 - 'titles': 'File:' + _this.pe.wikiTitleKey,
161 - 'prop' : 'imageinfo'
162 - }
163 - }, function( data ) {
 152+ var request = {
 153+ 'titles': 'File:' + _this.pe.wikiTitleKey,
 154+ 'prop' : 'imageinfo'
 155+ };
 156+ mw.getJSON( request, function( data ) {
164157 if ( data.query.pages && data.query.pages['-1'] && data.query.pages['-1'].imagerepository == 'shared' ) {
165 - js_log( 'image is shared checking commons for subtitles' );
166 - // found shared repo assume commons:
167 - do_api_req( {
168 - 'url': mw.commons_api_url,
169 - 'data': {
170 - 'list' : 'allpages',
171 - 'apprefix' : _this.pe.wikiTitleKey,
172 - 'apnamespace' : 102
173 - }
174 - }, function( data ) {
 158+ mw.log( 'image is shared checking commons for subtitles' );
 159+ // found shared repo assume commons:
 160+ var request = {
 161+ 'list' : 'allpages',
 162+ 'apprefix' : _this.pe.wikiTitleKey,
 163+ 'apnamespace' : 102
 164+ };
 165+ mw.getJSON( mw.commons_api_url, request, function( data ) {
175166 _this.editlink = 'http://commons.wikimedia.org/wiki/TimedText:' + _this.pe.wikiTitleKey + '.' + wgUserLanguage + '.srt';
176167 _this.doProcSubPages( data, 'http://commons.wikimedia.org/w/' );
177168 } );
@@ -184,7 +175,7 @@
185176 var _this = this;
186177 var found_tracks = false;
187178 // create timedTextObj
188 - js_log( "mv_txt_load_:SHOW mv_txt_load_" );
 179+ mw.log( "mv_txt_load_:SHOW mv_txt_load_" );
189180 $j( '#mv_txt_load_' + _this.pe.id ).show(); // show the loading icon
190181
191182 // setup edit link:
@@ -242,13 +233,13 @@
243234 } );
244235 },
245236 addTrack: function( track_id ) {
246 - js_log( 'f:displayTrack:' + track_id );
 237+ mw.log( 'f:displayTrack:' + track_id );
247238 var _this = this;
248239 // set the display flag to true:
249240 _this.availableTracks[ track_id ].display = true;
250241 // setup the layout:
251242 this.setup_layout();
252 - js_log( "SHOULD ADD: track:" + track_id + ' count:' + _this.availableTracks[ track_id ].textNodes.length );
 243+ mw.log( "SHOULD ADD: track:" + track_id + ' count:' + _this.availableTracks[ track_id ].textNodes.length );
253244
254245 // a flag to avoid checking all clips if we know we are adding to the end:
255246 _this.add_to_end_on_this_pass = false;
@@ -296,7 +287,7 @@
297288 }
298289 } );
299290 }
300 - // js_log('should just add to end: '+insertHTML);
 291+ // mw.log('should just add to end: '+insertHTML);
301292 if ( !inserted ) {
302293 $j( '#mmbody_' + this.pe.id ).append( insertHTML );
303294 }
@@ -309,7 +300,7 @@
310301 interval:200, // polling interval
311302 timeout:200, // delay before onMouseOut
312303 over:function () {
313 - js_log( 'mvttseek: over' );
 304+ mw.log( 'mvttseek: over' );
314305 $j( this ).parent().addClass( 'tt_highlight' );
315306 // do section highlight
316307 _this.pe.highlightPlaySection( {
@@ -318,7 +309,7 @@
319310 } );
320311 },
321312 out:function () {
322 - js_log( 'mvttseek: out' );
 313+ mw.log( 'mvttseek: out' );
323314 $j( this ).parent().removeClass( 'tt_highlight' );
324315 // de highlight section
325316 _this.pe.hideHighlight();
@@ -367,7 +358,7 @@
368359 },
369360 getTsSelect:function() {
370361 var _this = this;
371 - js_log( 'getTsSelect' );
 362+ mw.log( 'getTsSelect' );
372363 var selHTML = '<div id="mvtsel_' + this.pe.id + '" style="position:absolute;background:#FFF;top:30px;left:0px;right:0px;bottom:0px;overflow:auto;">';
373364 selHTML += '<b>' + gM( 'mwe-select_transcript_set' ) + '</b><ul>';
374365 // debugger;
@@ -418,7 +409,7 @@
419410 var curhl = $j( '#mmbody_' + this.pe.id + ' .tt_scroll_highlight' ).get( 0 );
420411 if ( mw.npt2seconds( $j( curhl ).attr( 'start' ) ) < cur_time &&
421412 mw.npt2seconds( $j( curhl ).attr( 'end' ) ) > cur_time ) {
422 - /*js_log('in range of current hl: ' +
 413+ /*mw.log('in range of current hl: ' +
423414 mw.npt2seconds($j(curhl).attr('start')) + ' to ' + mw.npt2seconds($j(curhl).attr('end')));
424415 */
425416 search_for_range = false;
@@ -428,7 +419,7 @@
429420 $j( '#mmbody_' + this.pe.id + ' .tt_scroll_highlight' ).removeClass( 'tt_scroll_highlight' );
430421 }
431422 };
432 - /*js_log('search_for_range:'+search_for_range + ' for: '+ cur_time);*/
 423+ /*mw.log('search_for_range:'+search_for_range + ' for: '+ cur_time);*/
433424 if ( search_for_range ) {
434425 // search for current time: add tt_scroll_highlight to clip
435426 // optimize:
@@ -442,7 +433,7 @@
443434 scrollTop: $j( this ).get( 0 ).offsetTop
444435 }, 'slow' );
445436 $j( this ).addClass( 'tt_scroll_highlight' );
446 - // js_log('should add class to: ' + $j(this).attr('id'));
 437+ // mw.log('should add class to: ' + $j(this).attr('id'));
447438 // done with loop
448439 return false;
449440 }
@@ -462,7 +453,7 @@
463454 }
464455 // jump to the current position:
465456 var cur_time = parseInt ( this.pe.currentTime );
466 - js_log( 'cur time: ' + cur_time );
 457+ mw.log( 'cur time: ' + cur_time );
467458
468459 _this = this;
469460 var scroll_to_id = '';
@@ -534,7 +525,7 @@
535526 this.lib = 'SRT';
536527 break;
537528 default:
538 - js_log( source.mime_type + ' is not suported timed text fromat' );
 529+ mw.log( source.mime_type + ' is not suported timed text fromat' );
539530 return ;
540531 break;
541532 }
@@ -570,7 +561,7 @@
571562 timedTextCMML = {
572563 load: function( range, callback ) {
573564 var _this = this;
574 - js_log( 'textCMML: loading track: ' + this.src );
 565+ mw.log( 'textCMML: loading track: ' + this.src );
575566
576567 // :: Load transcript range ::
577568 var pcurl = mw.parseUri( _this.getSRC() );
@@ -602,7 +593,7 @@
603594 }
604595 } );
605596 do_request( url, function( data ) {
606 - js_log( "load track clip count:" + data.getElementsByTagName( 'clip' ).length );
 597+ mw.log( "load track clip count:" + data.getElementsByTagName( 'clip' ).length );
607598 _this.doParse( data );
608599 _this.loaded = true;
609600 callback();
@@ -611,7 +602,7 @@
612603 doParse: function( data ) {
613604 var _this = this;
614605 $j.each( data.getElementsByTagName( 'clip' ), function( inx, clip ) {
615 - // js_log(' on clip ' + clip.id);
 606+ // mw.log(' on clip ' + clip.id);
616607 var text_clip = {
617608 start: $j( clip ).attr( 'start' ).replace( 'npt:', '' ),
618609 end: $j( clip ).attr( 'end' ).replace( 'npt:', '' ),
@@ -632,7 +623,7 @@
633624 timedTextSRT = {
634625 load: function( range, callback ) {
635626 var _this = this;
636 - js_log( 'textSRT: loading : ' + _this.getSRC() );
 627+ mw.log( 'textSRT: loading : ' + _this.getSRC() );
637628 if ( _this.getSRC() ) {
638629 do_request( _this.getSRC() , function( data ) {
639630 _this.doParse( data );
@@ -640,14 +631,12 @@
641632 callback();
642633 } );
643634 } else if ( _this.source.apisrc ) {
644 - do_api_req( {
645 - 'url' : _this.source.apisrc,
646 - 'data': {
647 - 'titles': _this.source.titleKey,
648 - 'prop':'revisions',
649 - 'rvprop':'content'
650 - }
651 - }, function( data ) {
 635+ var request = {
 636+ 'titles': _this.source.titleKey,
 637+ 'prop':'revisions',
 638+ 'rvprop':'content'
 639+ };
 640+ mw.getJSON( _this.source.apisrc,request, function( data ) {
652641 if ( data && data.query && data.query.pages ) {
653642 for ( var i in data.query.pages ) {
654643 var page = data.query.pages[i];
Index: branches/js2-work/phase3/js2/mwEmbed/libTimedText/mvTimeTextEdit.js
@@ -33,29 +33,27 @@
3434 return videoTitle;
3535 }
3636 function uploadSubtitles() {
37 - do_api_req( {
38 - 'data': {
39 - 'meta' : 'siteinfo',
40 - 'siprop' : 'languages'
41 - }
42 - }, function( langDataRaw ) {
 37+ var request = {
 38+ 'meta' : 'siteinfo',
 39+ 'siprop' : 'languages'
 40+ };
 41+ mw.getJSON( request, function( langDataRaw ) {
4342 var apprefix = wgTitle.split( '.' );
4443 apprefix.pop();
4544 apprefix.pop();
4645 apprefix = apprefix.join( '.' );
47 - do_api_req( {
48 - 'data': {
49 - 'list' : 'allpages',
50 - 'apprefix' : apprefix
51 - }
52 - }, function( subData ) {
53 - var availableSubtitles = { };
54 - for ( var i in subData.query.allpages ) {
55 - var subPage = subData.query.allpages[i];
56 - var langKey = subPage.title.split( '.' );
57 - var extension = langKey.pop();
58 - langKey = langKey.pop();
59 - availableSubtitles[langKey] = subPage.title;
 46+ var request = {
 47+ 'list' : 'allpages',
 48+ 'apprefix' : apprefix
 49+ };
 50+ mw.getJSON(request, function( subData ) {
 51+ var availableSubtitles = { };
 52+ for ( var i in subData.query.allpages ) {
 53+ var subPage = subData.query.allpages[i];
 54+ var langKey = subPage.title.split( '.' );
 55+ var extension = langKey.pop();
 56+ langKey = langKey.pop();
 57+ availableSubtitles[langKey] = subPage.title;
6058 }
6159 var langData = { };
6260 var languageSelect = '<select id="timed_text_language">';
@@ -100,7 +98,7 @@
10199 'cmml': 'text/cmml'
102100 }
103101 if ( !mimeTypes[ extension ] ) {
104 - js_log( 'Error: unknown extension:' + extension );
 102+ mw.log( 'Error: unknown extension:' + extension );
105103 }
106104
107105
@@ -110,20 +108,18 @@
111109 $j( '.ui-dialog-buttonpane' ).remove();
112110
113111 var editToken = $j( 'input[name=wpEditToken]' ).val();
114 -
115 - do_api_req( {
116 - 'data': {
 112+ var request = {
117113 'action' : 'edit',
118114 'title' : title,
119115 'text' : srt,
120116 'token': editToken
121 - }
122 - }, function( dialog ) {
 117+ };
 118+ mw.getJSON( request, function( dialog ) {
123119 return function( result ) {
124120 document.location.href = wgArticlePath.replace( '/$1', '?title=' + title + '&action=edit' );
125121 $j( dialog ).dialog( 'close' );
126 - } }( this )
127 - );
 122+ }
 123+ }( this ) );
128124 } else {
129125 $j( this ).html( gM( "mwe-error-only-srt" ) );
130126 }
Index: branches/js2-work/phase3/js2/mwEmbed/example_usage/Player_Themable.html
@@ -3,8 +3,8 @@
44 <html>
55 <head>
66 <title>Sample Themed Player</title>
7 - <!-- <script type="text/javascript" src="../jsScriptLoader.php?class=mwEmbed,embedVideo&urid=1"></script> -->
8 - <script type="text/javascript" src="../mwEmbed.js?debug=true"></script>
 7+ <script type="text/javascript" src="../jsScriptLoader.php?class=mwEmbed&debug=true"></script>
 8+ <!-- <script type="text/javascript" src="../mwEmbed.js?debug=true"></script> -->
99 </head>
1010 <script type="text/javascript">
1111 </script>
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js
@@ -375,7 +375,7 @@
376376 */
377377 init: function( options ) {
378378 var _this = this;
379 - js_log( 'remoteSearchDriver:init' );
 379+ mw.log( 'remoteSearchDriver:init' );
380380 // Add in a local "id" reference to each provider
381381 for ( var cp_id in this.content_providers ) {
382382 this.content_providers[ cp_id ].id = cp_id;
@@ -443,7 +443,7 @@
444444
445445 // Set up the "add media wizard" button, which invokes this object
446446 if ( $j( this.target_invoke_button ).length == 0 ) {
447 - js_log( "RemoteSearchDriver:: no target invocation provided " +
 447+ mw.log( "RemoteSearchDriver:: no target invocation provided " +
448448 "(will have to run your own createUI() )" );
449449 } else {
450450 if ( this.target_invoke_button ) {
@@ -462,7 +462,7 @@
463463 * @param license_key the license key (ie "by-sa" or "by-nc-sa" etc)
464464 */
465465 getLicenseIconHtml: function( licenseObj ) {
466 - // js_log('output images: '+ imgs);
 466+ // mw.log('output images: '+ imgs);
467467 return '<div class="rsd_license" title="' + licenseObj.title + '" >' +
468468 '<a target="_new" href="' + licenseObj.lurl + '" ' +
469469 'title="' + licenseObj.title + '">' +
@@ -484,7 +484,7 @@
485485 for ( var i = 0; i < license_set.length; i++ ) {
486486 var lkey = license_set[i];
487487 if ( !cl.license_images[ lkey ] ) {
488 - js_log( "MISSING::" + lkey );
 488+ mw.log( "MISSING::" + lkey );
489489 }
490490
491491 title += ' ' + gM( 'mwe-cc_' + lkey + '_title' );
@@ -558,7 +558,7 @@
559559 }
560560
561561 if ( type == 'unk' ) {
562 - js_log( "unkown ftype: " + mimetype );
 562+ mw.log( "unkown ftype: " + mimetype );
563563 return '';
564564 }
565565
@@ -590,7 +590,7 @@
591591 $j( this.target_invoke_button )
592592 .unbind()
593593 .click( function() {
594 - js_log( "createUI:target_invoke_button: click showDialog" );
 594+ mw.log( "createUI:target_invoke_button: click showDialog" );
595595 _this.showDialog();
596596 } );
597597 }
@@ -602,7 +602,7 @@
603603 */
604604 showDialog: function() {
605605 var _this = this;
606 - js_log( "showDialog::" );
 606+ mw.log( "showDialog::" );
607607 _this.clearTextboxCache();
608608 var query = _this.getDefaultQuery();
609609 if ( query != $j( '#rsd_q' ).val() ) {
@@ -676,11 +676,11 @@
677677 * Creates the dialog container
678678 */
679679 createDialogContainer: function() {
680 - js_log( "createDialogContainer" );
 680+ mw.log( "createDialogContainer" );
681681 var _this = this;
682682 // add the parent target_container if not provided or missing
683683 if ( _this.target_container && $j( _this.target_container ).length != 0 ) {
684 - js_log( 'dialog already exists' );
 684+ mw.log( 'dialog already exists' );
685685 return;
686686 }
687687
@@ -693,7 +693,7 @@
694694 '</div>' );
695695
696696 // Get layout
697 - js_log( 'width: ' + $j( window ).width() + ' height: ' + $j( window ).height() );
 697+ mw.log( 'width: ' + $j( window ).width() + ' height: ' + $j( window ).height() );
698698
699699 // Build cancel button
700700 var cancelButton = {};
@@ -730,9 +730,9 @@
731731 * Sets up the initial html interface
732732 */
733733 initDialog: function() {
734 - js_log( 'initDialog' );
 734+ mw.log( 'initDialog' );
735735 var _this = this;
736 - js_log( 'f::initDialog' );
 736+ mw.log( 'f::initDialog' );
737737
738738 var o = '<div class="rsd_control_container" style="width:100%">' +
739739 '<form id="rsd_form" action="javascript:return false;" method="GET">' +
@@ -801,7 +801,7 @@
802802 * Shows the upload tab loader and issues a call to showUploadForm
803803 */
804804 showUploadTab: function() {
805 - js_log( "showUploadTab::" );
 805+ mw.log( "showUploadTab::" );
806806 var _this = this;
807807 // set it to loading:
808808 $j( '#tab-upload' ).loadingSpiner();
@@ -921,7 +921,7 @@
922922 * @param {Bollean} resetPaging if the pagging should be reset
923923 */
924924 showSearchTab: function( providerName, resetPaging ) {
925 - js_log( "f:showSearchTab::" + providerName );
 925+ mw.log( "f:showSearchTab::" + providerName );
926926
927927 var draw_direct_flag = true;
928928
@@ -933,10 +933,10 @@
934934 if ( provider.sObj.last_query == $j( '#rsd_q' ).val()
935935 && provider.sObj.last_offset == provider.offset )
936936 {
937 - js_log( 'last query is: ' + provider.sObj.last_query +
 937+ mw.log( 'last query is: ' + provider.sObj.last_query +
938938 ' matches: ' + $j( '#rsd_q' ).val() );
939939 } else {
940 - js_log( 'last query is: ' + provider.sObj.last_query +
 940+ mw.log( 'last query is: ' + provider.sObj.last_query +
941941 ' not match: ' + $j( '#rsd_q' ).val() );
942942 draw_direct_flag = false;
943943 }
@@ -966,31 +966,27 @@
967967 */
968968 checkForCopyURLSupport: function ( callback ) {
969969 var _this = this;
970 - js_log( 'checkForCopyURLSupport:: ' );
 970+ mw.log( 'checkForCopyURLSupport:: ' );
971971
972972 // See if we already have the import mode:
973973 if ( this.import_url_mode != 'autodetect' ) {
974 - js_log( 'import mode: ' + _this.import_url_mode );
 974+ mw.log( 'import mode: ' + _this.import_url_mode );
975975 callback();
976976 }
977977 // If we don't have the local wiki api defined we can't auto-detect use "link"
978978 if ( ! _this.upload_api_target ) {
979 - js_log( 'import mode: remote link (no import_wiki_api_url)' );
 979+ mw.log( 'import mode: remote link (no import_wiki_api_url)' );
980980 _this.import_url_mode = 'remote_link';
981981 callback();
982982 }
983983 if ( this.import_url_mode == 'autodetect' ) {
984 - do_api_req(
985 - {
986 - 'url': _this.upload_api_target,
987 - 'data': {
988 - 'action': 'paraminfo',
989 - 'modules': 'upload'
990 - }
991 - }, function( data ) {
 984+ var request = {
 985+ 'action': 'paraminfo',
 986+ 'modules': 'upload'
 987+ }
 988+ mw.getJSON( _this.upload_api_target, request, function( data ) {
992989 _this.checkCopyURLApiResult( data, callback )
993 - }
994 - );
 990+ } );
995991 }
996992 },
997993
@@ -1006,16 +1002,16 @@
10071003 for ( var i in data.paraminfo.modules[0].parameters ) {
10081004 var pname = data.paraminfo.modules[0].parameters[i].name;
10091005 if ( pname == 'url' ) {
1010 - js_log( 'Autodetect Upload Mode: api: copy by url:: ' );
 1006+ mw.log( 'Autodetect Upload Mode: api: copy by url:: ' );
10111007 // Check permission too:
10121008 _this.checkForCopyURLPermission( function( canCopyUrl ) {
10131009 if ( canCopyUrl ) {
10141010 _this.import_url_mode = 'api';
1015 - js_log( 'import mode: ' + _this.import_url_mode );
 1011+ mw.log( 'import mode: ' + _this.import_url_mode );
10161012 callback();
10171013 } else {
10181014 _this.import_url_mode = 'none';
1019 - js_log( 'import mode: ' + _this.import_url_mode );
 1015+ mw.log( 'import mode: ' + _this.import_url_mode );
10201016 callback();
10211017 }
10221018 } );
@@ -1031,30 +1027,28 @@
10321028 * if the user lacks permission. or $wgAllowCopyUploads is set to false
10331029 * (use this function if we want to issue a warning up front)
10341030 *
1035 - * @param {Function} callback Function to call with URL permision
 1031+ * @param {Function} callback Function to call with URL permission
10361032 * @return
1037 - * false callback user does not have permision
 1033+ * false callback user does not have permission
10381034 */
10391035 checkForCopyURLPermission: function( callback ) {
10401036 var _this = this;
10411037 // do api check:
1042 - do_api_req(
1043 - {
1044 - 'data': { 'action' : 'query', 'meta' : 'userinfo', 'uiprop' : 'rights' },
1045 - 'url': _this.upload_api_target,
1046 - 'userinfo' : true
1047 - }, function( data ) {
1048 - for ( var i in data.query.userinfo.rights ) {
1049 - var right = data.query.userinfo.rights[i];
1050 - // js_log('checking: ' + right ) ;
1051 - if ( right == 'upload_by_url' ) {
1052 - callback( true );
1053 - return true; // break out of the function
1054 - }
 1038+ var request = {
 1039+ 'meta' : 'userinfo',
 1040+ 'uiprop' : 'rights'
 1041+ };
 1042+ mw.getJSON( _this.upload_api_target, request, function( data ) {
 1043+ for ( var i in data.query.userinfo.rights ) {
 1044+ var right = data.query.userinfo.rights[i];
 1045+ // mw.log('checking: ' + right ) ;
 1046+ if ( right == 'upload_by_url' ) {
 1047+ callback( true );
 1048+ return true; // break out of the function
10551049 }
1056 - callback( false );
1057 - }
1058 - );
 1050+ }
 1051+ callback( false );
 1052+ } );
10591053 },
10601054
10611055 /**
@@ -1110,7 +1104,7 @@
11111105 'baseRemoteSearch',
11121106 provider.lib + 'Search'
11131107 ], function() {
1114 - js_log( "loaded lib:: " + provider.lib );
 1108+ mw.log( "loaded lib:: " + provider.lib );
11151109 // else we need to run the search:
11161110 var options = {
11171111 'provider': provider,
@@ -1118,7 +1112,7 @@
11191113 };
11201114 eval( 'provider.sObj = new ' + provider.lib + 'Search( options );' );
11211115 if ( !provider.sObj ) {
1122 - js_log( 'Error: could not find search lib for ' + cp_id );
 1116+ mw.log( 'Error: could not find search lib for ' + cp_id );
11231117 return false;
11241118 }
11251119
@@ -1135,7 +1129,7 @@
11361130 * @param {Function} callback called once loading is done
11371131 */
11381132 waitForResults: function( callback ) {
1139 - // js_log('rsd:waitForResults');
 1133+ // mw.log('rsd:waitForResults');
11401134 var _this = this;
11411135 var loading_done = true;
11421136
@@ -1212,7 +1206,7 @@
12131207 // Output the respective results holders
12141208 $j( '#rsd_results_container' ).html( s );
12151209 // Setup bindings for tabs make them sortable: (@@todo remember order)
1216 - js_log( 'selected tab is: ' + selected_tab );
 1210+ mw.log( 'selected tab is: ' + selected_tab );
12171211 $j( "#rsd_tabs_container" )
12181212 .tabs( {
12191213 selected: selected_tab,
@@ -1244,7 +1238,7 @@
12451239 if ( provider && provider['sObj'] && provider.sObj.resultsObj[resIndex] ) {
12461240 return provider.sObj.resultsObj[resIndex];
12471241 }
1248 - js_log( "ERROR: could not find " + resIndex );
 1242+ mw.log( "ERROR: could not find " + resIndex );
12491243 return false;
12501244 },
12511245
@@ -1252,7 +1246,7 @@
12531247 * Show Results for the currentProvider
12541248 */
12551249 showResults: function() {
1256 - js_log( 'f:showResults::' + this.currentProvider );
 1250+ mw.log( 'f:showResults::' + this.currentProvider );
12571251 var _this = this;
12581252 var o = '';
12591253 var tabSelector = '';
@@ -1285,13 +1279,13 @@
12861280 $j( tabSelector ).append( o + '<div style="clear:both"/>' );
12871281 }
12881282
1289 - js_log( 'did numResults :: ' + numResults +
 1283+ mw.log( 'did numResults :: ' + numResults +
12901284 ' append: ' + $j( '#rsd_q' ).val() );
12911285
12921286 // Remove any old search res
12931287 $j( '#rsd_no_search_res' ).remove();
12941288 if ( numResults == 0 ) {
1295 - $j( '#tab-' + cp_id ).append(
 1289+ $j( '#tab-' + provider.id ).append(
12961290 '<span style="padding:10px">' +
12971291 gM( 'rsd_no_results', $j( '#rsd_q' ).val() ) +
12981292 '</span>' );
@@ -1494,7 +1488,7 @@
14951489 * Show the resource editor
14961490 */
14971491 showResourceEditor: function( resource, rsdElement ) {
1498 - js_log( 'f:showResourceEditor:' + resource.title );
 1492+ mw.log( 'f:showResourceEditor:' + resource.title );
14991493 var _this = this;
15001494
15011495 // Remove any existing resource edit interface
@@ -1511,7 +1505,7 @@
15121506 var dialogTitle = gM( 'mwe-add_media_wizard' ) + ': ' +
15131507 gM( 'rsd_resource_edit', resource.title );
15141508 $j( _this.target_container ).dialog( 'option', 'title', dialogTitle );
1515 - js_log( 'did append to: ' + _this.target_container );
 1509+ mw.log( 'did append to: ' + _this.target_container );
15161510
15171511 // Left side holds the image right size the controls /
15181512 $j( rsdElement )
@@ -1531,13 +1525,13 @@
15321526 try {
15331527 imageRatio = $j( rsdElement ).get(0).height / $j( rsdElement ).get(0).width;
15341528 } catch( e ) {
1535 - js_log( 'Errro: browser could not read height or width attribute' ) ;
 1529+ mw.log( 'Errro: browser could not read height or width attribute' ) ;
15361530 }
15371531 if ( !imageRatio ) {
15381532 var imageRatio = 1; // set ratio to 1 if tRatio did not work.
15391533 }
15401534
1541 - js_log( 'Set from ' + imageRatio + ' to init thumbimage to ' +
 1535+ mw.log( 'Set from ' + imageRatio + ' to init thumbimage to ' +
15421536 maxWidth + ' x ' + parseInt( imageRatio * maxWidth ) );
15431537 // Scale up image and to swap with high res version
15441538 $j( '#rsd_edit_img' ).animate(
@@ -1588,21 +1582,21 @@
15891583 resource.pSobj.getImageObj( resource, size, function( imObj ) {
15901584 resource['edit_url'] = imObj.url;
15911585
1592 - js_log( "edit url: " + resource.edit_url );
 1586+ mw.log( "edit url: " + resource.edit_url );
15931587 // Update the resource
15941588 resource['width'] = imObj.width;
15951589 resource['height'] = imObj.height;
15961590
15971591 // See if we need to animate some transition
15981592 if ( size.width != imObj.width ) {
1599 - js_log( 'loadHighQualityImage:size mismatch: ' + size.width + ' != ' + imObj.width );
 1593+ mw.log( 'loadHighQualityImage:size mismatch: ' + size.width + ' != ' + imObj.width );
16001594 // Set the target id to the new size:
16011595 $j( '#' + target_img_id ).animate( {
16021596 'width': imObj.width + 'px',
16031597 'height': imObj.height + 'px'
16041598 });
16051599 } else {
1606 - js_log( 'use req size: ' + imObj.width + 'x' + imObj.height );
 1600+ mw.log( 'use req size: ' + imObj.width + 'x' + imObj.height );
16071601 $j( '#' + target_img_id ).animate( {
16081602 'width': imObj.width + 'px',
16091603 'height': imObj.height + 'px'
@@ -1616,7 +1610,7 @@
16171611 // Let the caller know we are done and what size we ended up with:
16181612 callback();
16191613 } ).error( function () {
1620 - js_log( "Error with: " + resource.edit_url );
 1614+ mw.log( "Error with: " + resource.edit_url );
16211615 } ).attr( 'src', resource.edit_url );
16221616 } );
16231617 },
@@ -1626,7 +1620,7 @@
16271621 */
16281622 onCancelClipEdit: function() {
16291623 var _this = this;
1630 - js_log( 'onCancelClipEdit' );
 1624+ mw.log( 'onCancelClipEdit' );
16311625 var b_target = _this.target_container + '~ .ui-dialog-buttonpane';
16321626 $j( '#rsd_resource_edit' ).remove();
16331627
@@ -1638,7 +1632,7 @@
16391633
16401634 // Restore the title:
16411635 $j( _this.target_container ).dialog( 'option', 'title', gM( 'mwe-add_media_wizard' ) );
1642 - js_log( "should update: " + b_target + ' with: cancel' );
 1636+ mw.log( "should update: " + b_target + ' with: cancel' );
16431637 // Restore the buttons:
16441638 $j( b_target )
16451639 .html( $j.btnHtml( gM( 'mwe-cancel' ) , 'mv_cancel_rsd', 'close' ) )
@@ -1712,50 +1706,46 @@
17131707 var options = _this.getClipEditOptions( resource );
17141708 var mediaType = this.getMediaType( resource );
17151709
1716 - js_log( 'media type:: ' + mediaType );
 1710+ mw.log( 'media type:: ' + mediaType );
17171711
17181712 // Get any additional embedding helper meta data prior to doing the actual embed
17191713 // normally this meta should be provided in the search result
17201714 // (but archive.org has another query for more media meta)
1721 - resource.pSobj.addResourceInfoCallback( resource, function() {
1722 - // Make sure we have the embedPlayer libs:
 1715+ resource.pSobj.addResourceInfoCallback( resource, function() {
17231716 var runFlag = false;
1724 - mvJsLoader.embedPlayerCheck( function() {
 1717+ // Make sure we have the 'player' module:
 1718+ mw.load( 'player', function() {
17251719 // Strange concurrency issue with callbacks
17261720 // @@todo try and figure out why this callback is fired twice
17271721 if ( !runFlag ) {
17281722 runFlag = true;
17291723 } else {
1730 - js_log( 'Error: embedPlayerCheck run twice' );
 1724+ mw.log( 'Error: embedPlayerCheck run twice' );
17311725 return false;
17321726 }
17331727 var embedHtml = resource.pSobj.getEmbedHTML( resource,
17341728 { id : 'embed_vid' } );
1735 - js_log( 'append html: ' + embedHtml );
 1729+ mw.log( 'append html: ' + embedHtml );
17361730 $j( '#clip_edit_disp' ).html( embedHtml );
17371731
1738 - js_log( "about to call $j.embedPlayer::embed_vid" );
 1732+ mw.log( "about to call $j.embedPlayer::embed_vid" );
 1733+ // Rewrite by id
 1734+ $j( '#embed_vid').embedPlayer ( function() {
17391735
1740 - //Make sure we have embedPlayer libs:
1741 - mvJsLoader.embedPlayerCheck( function() {
1742 - // Rewrite by id
1743 - $j( '#embed_vid').embedPlayer ( function() {
1744 -
1745 - // Grab information available from the embed instance
1746 - resource.pSobj.addEmbedInfo( resource, 'embed_vid' );
1747 -
1748 - // Add libraries resizable and hoverIntent to support video edit tools
1749 - var librarySet = [
1750 - 'mvClipEdit',
1751 - '$j.ui.resizable',
1752 - '$j.fn.hoverIntent'
1753 - ]
1754 - mw.load( librarySet, function() {
1755 - // Make sure the rsd_edit_img is removed:
1756 - $j( '#rsd_edit_img' ).remove();
1757 - // Run the image clip tools
1758 - _this.clipEdit = new mvClipEdit( options );
1759 - } );
 1736+ // Grab information available from the embed instance
 1737+ resource.pSobj.addEmbedInfo( resource, 'embed_vid' );
 1738+
 1739+ // Add libraries resizable and hoverIntent to support video edit tools
 1740+ var librarySet = [
 1741+ 'mvClipEdit',
 1742+ '$j.ui.resizable',
 1743+ '$j.fn.hoverIntent'
 1744+ ]
 1745+ mw.load( librarySet, function() {
 1746+ // Make sure the rsd_edit_img is removed:
 1747+ $j( '#rsd_edit_img' ).remove();
 1748+ // Run the image clip tools
 1749+ _this.clipEdit = new mvClipEdit( options );
17601750 } );
17611751 } );
17621752 } );
@@ -1857,7 +1847,7 @@
18581848 * will be false.
18591849 */
18601850 isFileAlreadyImported: function( resource, callback ) {
1861 - js_log( '::isFileAlreadyImported:: ' );
 1851+ mw.log( '::isFileAlreadyImported:: ' );
18621852 var _this = this;
18631853
18641854 // Clone the resource
@@ -1894,7 +1884,7 @@
18951885 */
18961886 showImportUI: function( resource, callback ) {
18971887 var _this = this;
1898 - js_log( "showImportUI:: update:" + _this.canonicalFileNS + ':' +
 1888+ mw.log( "showImportUI:: update:" + _this.canonicalFileNS + ':' +
18991889 resource.target_resource_title );
19001890
19011891 // setup the resource description from resource description:
@@ -2004,14 +1994,14 @@
20051995 $j( _this.target_container + ' .rsd_import_apreview' )
20061996 .btnBind()
20071997 .click( function() {
2008 - js_log( " Do preview asset update" );
 1998+ mw.log( " Do preview asset update" );
20091999 $j( '#rsd_import_desc' ).html( mw.loading_spiner() );
20102000 // load the preview text:
20112001 _this.parse(
20122002 $j( '#rsd_import_ta' ).val(),
20132003 _this.canonicalFileNS + ':' + resource.target_resource_title,
20142004 function( o ) {
2015 - js_log( 'got updated preview: ' );
 2005+ mw.log( 'got updated preview: ' );
20162006 $j( '#rsd_import_desc' ).html( o );
20172007 }
20182008 );
@@ -2020,7 +2010,7 @@
20212011 $j( buttonPaneSelector + ' .rsd_import_doimport' )
20222012 .btnBind()
20232013 .click( function() {
2024 - js_log( "do import asset:" + _this.import_url_mode );
 2014+ mw.log( "do import asset:" + _this.import_url_mode );
20252015 // check import mode:
20262016 if ( _this.import_url_mode == 'api' ) {
20272017 if ( _this.upload_api_target == 'proxy' ) {
@@ -2031,7 +2021,7 @@
20322022 _this.doApiImport( resource, callback );
20332023 }
20342024 } else {
2035 - js_log( "Error: import mode is not form or API (can not copy asset)" );
 2025+ mw.log( "Error: import mode is not form or API (can not copy asset)" );
20362026 }
20372027 } );
20382028 $j( buttonPaneSelector + ' .rsd_import_acancel' )
@@ -2061,7 +2051,7 @@
20622052 }
20632053 // setup the the proxy via $j.apiProxy loader:
20642054 if ( !_this.upload_api_proxy_frame ) {
2065 - js_log( "Error:: remote api but no proxy frame target" );
 2055+ mw.log( "Error:: remote api but no proxy frame target" );
20662056 return false;
20672057 } else {
20682058 $j.apiProxy(
@@ -2086,7 +2076,7 @@
20872077 * Callback is called with "false" if the file is not found
20882078 */
20892079 findFileInLocalWiki: function( fileName, callback ) {
2090 - js_log( "findFileInLocalWiki::" + fileName );
 2080+ mw.log( "findFileInLocalWiki::" + fileName );
20912081 var _this = this;
20922082 var request = {
20932083 'action': 'query',
@@ -2096,29 +2086,24 @@
20972087 'iiurlwidth': '400'
20982088 };
20992089 // First check the api for imagerepository
2100 - do_api_req(
2101 - {
2102 - 'data': request,
2103 - 'url': this.local_wiki_api_url
2104 - }, function( data ) {
2105 - if ( data.query.pages ) {
2106 - for ( var i in data.query.pages ) {
2107 - for ( var j in data.query.pages[i] ) {
2108 - if ( j == 'missing'
2109 - && data.query.pages[i].imagerepository != 'shared' )
2110 - {
2111 - js_log( fileName + " not found" );
2112 - callback( false );
2113 - return;
2114 - }
 2090+ mw.getJSON( this.local_wiki_api_url, request, function( data ) {
 2091+ if ( data.query.pages ) {
 2092+ for ( var i in data.query.pages ) {
 2093+ for ( var j in data.query.pages[i] ) {
 2094+ if ( j == 'missing'
 2095+ && data.query.pages[i].imagerepository != 'shared' )
 2096+ {
 2097+ mw.log( fileName + " not found" );
 2098+ callback( false );
 2099+ return;
21152100 }
2116 - // else page is found:
2117 - js_log( fileName + " found" );
2118 - callback( data.query.pages[i] );
21192101 }
 2102+ // else page is found:
 2103+ mw.log( fileName + " found" );
 2104+ callback( data.query.pages[i] );
21202105 }
21212106 }
2122 - );
 2107+ } );
21232108 },
21242109
21252110 /**
@@ -2129,7 +2114,7 @@
21302115 */
21312116 doApiImport: function( resource, callback ) {
21322117 var _this = this;
2133 - js_log( ":doApiImport:" );
 2118+ mw.log( ":doApiImport:" );
21342119 $j.addLoaderDialog( gM( 'mwe-importing_asset' ) );
21352120
21362121 // Load the BaseUploadInterface:
@@ -2139,13 +2124,13 @@
21402125 '$j.ui.progressbar'
21412126 ],
21422127 function() {
2143 - js_log( 'mvBaseUploadInterface ready' );
 2128+ mw.log( 'mvBaseUploadInterface ready' );
21442129 // Initiate a upload object ( similar to url copy ):
21452130 // ( mvBaseUploadInterface handles upload errors )
21462131 var uploader = new mvBaseUploadInterface( {
21472132 'api_url' : _this.upload_api_target,
21482133 'done_upload_cb':function() {
2149 - js_log( 'doApiImport:: run callback::' );
 2134+ mw.log( 'doApiImport:: run callback::' );
21502135 // We have finished the upload:
21512136
21522137 // Close up the rsd_resource_import
@@ -2264,7 +2249,7 @@
22652250 */
22662251 getEmbedCode: function( resource ) {
22672252 if ( this.import_url_mode == 'remote_link' ) {
2268 - return resource.pSobj.getEmbedHTML( resource );
 2253+ return resource.pSobj.getEmbedHTML( resource, {'insert_description': true } );
22692254 } else {
22702255 return resource.pSobj.getEmbedWikiCode( resource );
22712256 }
@@ -2333,7 +2318,7 @@
23342319 * @param {Object} resource Resource to be inserted
23352320 */
23362321 insertResource: function( resource ) {
2337 - js_log( 'insertResource: ' + resource.title );
 2322+ mw.log( 'insertResource: ' + resource.title );
23382323 var _this = this;
23392324 // Double check that the resource is present:
23402325 this.isFileLocallyAvailable( resource, function( status ) {
@@ -2373,7 +2358,8 @@
23742359 resource.mime.indexOf( 'video' ) != -1 ||
23752360 resource.mime.indexOf( '/ogg' ) != -1 )
23762361 {
2377 - mvJsLoader.embedPlayerCheck();
 2362+ // Re-load the player module ( will scan page for mw.getConfig( 'rewritePlayerTags' ) )
 2363+ $j.embedPlayers();
23782364 }
23792365 }
23802366
@@ -2386,7 +2372,7 @@
23872373 */
23882374 closeAll: function() {
23892375 var _this = this;
2390 - js_log( "close all:: " + _this.target_container );
 2376+ mw.log( "close all:: " + _this.target_container );
23912377 _this.onCancelClipEdit();
23922378 // Give a chance for the events to complete
23932379 // (somehow at least in firefox a rare condition occurs where
@@ -2489,7 +2475,7 @@
24902476 var provider = _this.content_providers[ _this.currentProvider ];
24912477 }
24922478 var search = provider.sObj;
2493 - js_log( 'showPagingHeader:' + _this.currentProvider + ' len: ' + search.num_results );
 2479+ mw.log( 'showPagingHeader:' + _this.currentProvider + ' len: ' + search.num_results );
24942480 var to_num = ( provider.limit > search.num_results ) ?
24952481 ( parseInt( provider.offset ) + parseInt( search.num_results ) ) :
24962482 ( parseInt( provider.offset ) + parseInt( provider.limit ) );
@@ -2534,7 +2520,7 @@
25352521 * @param {String} provider_id Provider id to select and display
25362522 */
25372523 selectTab: function( provider_id ) {
2538 - js_log( 'select tab: ' + provider_id );
 2524+ mw.log( 'select tab: ' + provider_id );
25392525 this.currentProvider = provider_id;
25402526 if ( this.currentProvider == 'upload' ) {
25412527 this.showUploadTab();
@@ -2549,7 +2535,7 @@
25502536 * @param {String} mode Either "box" or "list"
25512537 */
25522538 setDisplayMode: function( mode ) {
2553 - js_log( 'setDisplayMode:' + mode );
 2539+ mw.log( 'setDisplayMode:' + mode );
25542540 this.displayMode = mode;
25552541 // run /update search display:
25562542 this.showResults();
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/dragDropFile.js
@@ -9,7 +9,7 @@
1010
1111 ( function( $ ) {
1212 $.fn.dragDropFile = function () {
13 - js_log( "drag drop: " + this.selector );
 13+ mw.log( "drag drop: " + this.selector );
1414 // setup drag binding and highlight
1515 var dC = $j( this.selector ).get( 0 );
1616 dC.addEventListener( "dragenter",
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js
@@ -64,7 +64,7 @@
6565 if ( !options )
6666 options = {};
6767 $j.extend( this, default_bui_options, options );
68 - js_log( "init mvBaseUploadInterface:: " + this.api_url );
 68+ mw.log( "init mvBaseUploadInterface:: " + this.api_url );
6969 },
7070
7171 /**
@@ -72,12 +72,12 @@
7373 * May remap it to use the API field names.
7474 */
7575 setupForm: function() {
76 - js_log( "Base::setupForm::" );
 76+ mw.log( "Base::setupForm::" );
7777 var _this = this;
7878 // Set up the local pointer to the edit form:
7979 this.form = this.getForm();
8080 if ( !this.form ) {
81 - js_log( "Upload form not found!" );
 81+ mw.log( "Upload form not found!" );
8282 return;
8383 }
8484
@@ -102,7 +102,7 @@
103103 */
104104 onSubmit: function() {
105105 var _this = this;
106 - js_log( 'Base::onSubmit:' );
 106+ mw.log( 'Base::onSubmit:' );
107107 // Run the original onsubmit (if not run yet set flag to avoid excessive chaining)
108108 if ( typeof( this.orig_onsubmit ) == 'function' ) {
109109 if ( ! this.orig_onsubmit() ) {
@@ -112,12 +112,12 @@
113113 }
114114 // Check for post action override
115115 if ( this.form_post_override ) {
116 - js_log( 'form_post_override is true, do ordinary form submit' );
 116+ mw.log( 'form_post_override is true, do ordinary form submit' );
117117 return true;
118118 }
119119
120120 // Get the input form data into an array
121 - js_log( 'update formData::' );
 121+ mw.log( 'update formData::' );
122122 var data = $j( this.form ).serializeArray();
123123 this.formData = {};
124124 for ( var i = 0; i < data.length; i++ ) {
@@ -139,7 +139,7 @@
140140 _this.doUpload();
141141 } );
142142 } catch( e ) {
143 - js_log( '::error in displayProgressOverlay or doUpload' );
 143+ mw.log( '::error in displayProgressOverlay or doUpload' );
144144 }
145145
146146 // Don't submit the form we will do the post in ajax
@@ -157,16 +157,16 @@
158158 */
159159 detectUploadMode: function( callback ) {
160160 var _this = this;
161 - js_log( 'detectUploadMode::' + _this.upload_mode );
 161+ mw.log( 'detectUploadMode::' + _this.upload_mode );
162162 // Check the upload mode
163163 if ( _this.upload_mode == 'detect_in_progress' ) {
164164 // Don't send another request, wait for the pending one.
165165 } else if ( !_this.isCopyUpload() ) {
166166 callback( 'post' );
167167 } else if ( _this.upload_mode == 'autodetect' ) {
168 - js_log( 'detectUploadMode::' + _this.upload_mode + ' api:' + _this.api_url );
 168+ mw.log( 'detectUploadMode::' + _this.upload_mode + ' api:' + _this.api_url );
169169 if( !_this.api_url ) {
170 - js_error( 'Error: can\'t autodetect mode without api url' );
 170+ mw.log( 'Error: can\'t autodetect mode without api url' );
171171 return;
172172 }
173173
@@ -174,29 +174,24 @@
175175 _this.upload_mode = 'detect_in_progress';
176176
177177 // FIXME: move this to configuration and avoid this API request
178 - do_api_req(
179 - {
180 - 'data': { 'action' : 'paraminfo', 'modules' : 'upload' },
181 - 'url' : _this.api_url
182 - },
183 - function( data ) {
 178+ mw.getJSON( _this.api_url, { 'action' : 'paraminfo', 'modules' : 'upload' }, function( data ) {
184179 if ( typeof data.paraminfo == 'undefined'
185180 || typeof data.paraminfo.modules == 'undefined' )
186181 {
187 - return js_error( 'Error: bad api results' );
 182+ return mw.log( 'Error: bad api results' );
188183 }
189184 if ( typeof data.paraminfo.modules[0].classname == 'undefined' ) {
190 - js_log( 'Autodetect Upload Mode: \'post\' ' );
 185+ mw.log( 'Autodetect Upload Mode: \'post\' ' );
191186 _this.upload_mode = 'post';
192187 callback( 'post' );
193188 } else {
194 - js_log( 'Autodetect Upload Mode: api ' );
 189+ mw.log( 'Autodetect Upload Mode: api ' );
195190 _this.upload_mode = 'api';
196191 // Check to see if chunks are supported
197192 for ( var i in data.paraminfo.modules[0].parameters ) {
198193 var pname = data.paraminfo.modules[0].parameters[i].name;
199194 if( pname == 'enablechunks' ) {
200 - js_log( 'this.chunks_supported = true' );
 195+ mw.log( 'this.chunks_supported = true' );
201196 _this.chunks_supported = true;
202197 break;
203198 }
@@ -210,7 +205,7 @@
211206 } else if ( _this.upload_mode == 'post' ) {
212207 callback( 'post' );
213208 } else {
214 - js_error( 'Error: unrecongized upload mode: ' + _this.upload_mode );
 209+ mw.log( 'Error: unrecongized upload mode: ' + _this.upload_mode );
215210 }
216211 },
217212
@@ -223,7 +218,7 @@
224219 } else if ( this.upload_mode == 'post' ) {
225220 this.doPostUpload();
226221 } else {
227 - js_error( 'Error: unrecongized upload mode: ' + this.upload_mode );
 222+ mw.log( 'Error: unrecongized upload mode: ' + this.upload_mode );
228223 }
229224 },
230225
@@ -282,7 +277,7 @@
283278 doPostUpload: function() {
284279 var _this = this;
285280 var form = $j( _this.form );
286 - js_log( 'mvBaseUploadInterface.doPostUpload' );
 281+ mw.log( 'mvBaseUploadInterface.doPostUpload' );
287282
288283 // Issue a normal post request
289284 // Get the token from the page
@@ -307,8 +302,8 @@
308303 // Set the action to the API URL:
309304 form.attr( 'action', _this.api_url );
310305
311 - js_log( 'Do iframe form submit to: ' + form.attr( 'target' ) );
312 - js_log( ' destName:' + form.find( "[name='filename']" ).val() );
 306+ mw.log( 'Do iframe form submit to: ' + form.attr( 'target' ) );
 307+ mw.log( ' destName:' + form.find( "[name='filename']" ).val() );
313308
314309 // Do post override
315310 _this.form_post_override = true;
@@ -322,8 +317,8 @@
323318 * Do an upload by submitting an API request
324319 */
325320 doApiCopyUpload: function() {
326 - js_log( 'mvBaseUploadInterface.doApiCopyUpload' );
327 - js_log( 'doHttpUpload (no form submit) ' );
 321+ mw.log( 'mvBaseUploadInterface.doApiCopyUpload' );
 322+ mw.log( 'doHttpUpload (no form submit) ' );
328323 var httpUpConf = {
329324 'url' : $j( '#wpUploadFileURL' ).val(),
330325 'filename' : $j( '#wpDestFile' ).val(),
@@ -358,7 +353,7 @@
359354 } else if ( doc.body ) {
360355 // Get the json string
361356 json = $j( doc.body ).find( 'pre' ).text();
362 - //js_log( 'iframe:json::' + json_str + "\nbody:" + $j( doc.body ).html() );
 357+ //mw.log( 'iframe:json::' + json_str + "\nbody:" + $j( doc.body ).html() );
363358 if ( json ) {
364359 response = window["eval"]( "(" + json + ")" );
365360 } else {
@@ -400,7 +395,7 @@
401396
402397 // Add the edit token (if available)
403398 if( !_this.editToken && _this.api_url ) {
404 - js_log( 'Error:doHttpUpload: missing token' );
 399+ mw.log( 'Error:doHttpUpload: missing token' );
405400 } else {
406401 request['token'] =_this.editToken;
407402 }
@@ -409,10 +404,7 @@
410405 _this.action_done = false;
411406
412407 //do the api request
413 - do_api_req({
414 - 'data': request,
415 - 'url' : _this.api_url
416 - }, function( data ) {
 408+ mw.getJSON(_this.api_url, request, function( data ) {
417409 _this.processApiResult( data );
418410 });
419411 },
@@ -445,15 +437,9 @@
446438 onAjaxUploadStatusTimer: function() {
447439 var _this = this;
448440 //do the api request:
449 - do_api_req(
450 - {
451 - 'data': this.upload_status_request,
452 - 'url' : this.api_url
453 - },
454 - function ( data ) {
455 - _this.onAjaxUploadStatusResponse( data );
456 - }
457 - );
 441+ mw.getJSON( this.api_url, this.upload_status_request, function ( data ) {
 442+ _this.onAjaxUploadStatusResponse( data );
 443+ } );
458444 },
459445
460446 /**
@@ -475,7 +461,7 @@
476462 apiResult = JSON.parse( data.upload['apiUploadResult'] ) ;
477463 } catch ( e ) {
478464 //could not parse api result
479 - js_log( 'errro: could not parse apiUploadResult' )
 465+ mw.log( 'errro: could not parse apiUploadResult' )
480466 }
481467 _this.processApiResult( apiResult );
482468 });
@@ -499,7 +485,7 @@
500486 );
501487 } else if( data.upload['loaded'] ) {
502488 _this.updateProgress( 1 );
503 - js_log( 'just have loaded (no cotent length: ' + data.upload['loaded'] );
 489+ mw.log( 'just have loaded (no cotent length: ' + data.upload['loaded'] );
504490 //for lack of content-length requests:
505491 $j( '#up-status-container' ).html(
506492 gM( 'mwe-upload-stats-fileprogress',
@@ -609,7 +595,7 @@
610596
611597 if ( !error_code || error_code == 'unknown-error' ) {
612598 if ( typeof JSON != 'undefined' ) {
613 - js_log( 'Error: apiRes: ' + JSON.stringify( apiRes ) );
 599+ mw.log( 'Error: apiRes: ' + JSON.stringify( apiRes ) );
614600 }
615601 if ( apiRes.upload.error == 'internal-error' ) {
616602 // Do a remote message load
@@ -650,20 +636,20 @@
651637 return false;
652638 }
653639
654 - js_log( 'get key: ' + error_msg_key[ error_code ] )
 640+ mw.log( 'get key: ' + error_msg_key[ error_code ] )
655641 gMsgLoadRemote( error_msg_key[ error_code ], function() {
656642 _this.updateProgressWin(
657643 gM( 'mwe-uploaderror' ),
658644 gM( error_msg_key[ error_code ], errorReplaceArg ),
659645 buttons );
660646 });
661 - js_log( "api.error" );
 647+ mw.log( "api.error" );
662648 return false;
663649 }
664650
665651 // Check upload.error
666652 if ( apiRes.upload && apiRes.upload.error ) {
667 - js_log( ' apiRes.upload.error: ' + apiRes.upload.error );
 653+ mw.log( ' apiRes.upload.error: ' + apiRes.upload.error );
668654 _this.updateProgressWin(
669655 gM( 'mwe-uploaderror' ),
670656 gM( 'mwe-unknown-error' ) + '<br>',
@@ -709,7 +695,7 @@
710696 //set to "loading"
711697 $j( '#upProgressDialog' ).html( mw.loading_spiner() );
712698 //setup loading:
713 - var req = {
 699+ var request = {
714700 'action': 'upload',
715701 'sessionkey': _this.warnings_sessionkey,
716702 'ignorewarnings': 1,
@@ -717,17 +703,11 @@
718704 'token' : _this.editToken
719705 };
720706 //run the upload from stash request
721 - do_api_req(
722 - {
723 - 'data': req,
724 - 'url' : _this.api_url
725 - },
726 - function( data ) {
 707+ mw.getJSON(_this.api_url, request, function( data ) {
727708 _this.processApiResult( data );
728 - }
729 - );
 709+ } );
730710 } else {
731 - js_log( 'No session key re-sending upload' )
 711+ mw.log( 'No session key re-sending upload' )
732712 //do a stashed upload
733713 $j( '#wpIgnoreWarning' ).attr( 'checked', true );
734714 $j( _this.editForm ).submit();
@@ -755,7 +735,7 @@
756736 */
757737 processApiResult: function( apiRes ) {
758738 var _this = this;
759 - js_log( 'processApiResult::' );
 739+ mw.log( 'processApiResult::' );
760740 if ( !_this.isApiSuccess( apiRes ) ) {
761741 // Error detected, show it to the user
762742 _this.showApiError( apiRes );
@@ -765,7 +745,7 @@
766746 // Async upload, do AJAX status polling
767747 _this.upload_session_key = apiRes.upload.upload_session_key;
768748 _this.doAjaxUploadStatus();
769 - js_log( "set upload_session_key: " + _this.upload_session_key );
 749+ mw.log( "set upload_session_key: " + _this.upload_session_key );
770750 return;
771751 }
772752
@@ -775,7 +755,7 @@
776756 // Upload complete.
777757 // Call the completion callback if available.
778758 if ( _this.done_upload_cb && typeof _this.done_upload_cb == 'function' ) {
779 - js_log( "call done_upload_cb" );
 759+ mw.log( "call done_upload_cb" );
780760 // This overrides our normal completion handling so we close the
781761 // dialog immediately.
782762 $j( '#upProgressDialog' ).dialog( 'destroy' ).remove();
@@ -798,7 +778,7 @@
799779 gM( 'mwe-successfulupload' ),
800780 gM( 'mwe-upload_done', url),
801781 buttons );
802 - js_log( 'apiRes.upload.imageinfo::' + url );
 782+ mw.log( 'apiRes.upload.imageinfo::' + url );
803783 return true;
804784 }
805785 },
@@ -847,7 +827,7 @@
848828 if ( this.form_selector && $j( this.form_selector ).length != 0 ) {
849829 return $j( this.form_selector ).get( 0 );
850830 } else {
851 - js_log( "mvBaseUploadInterface.getForm(): no form_selector" );
 831+ mw.log( "mvBaseUploadInterface.getForm(): no form_selector" );
852832 return false;
853833 }
854834 },
@@ -856,7 +836,7 @@
857837 * Update the progress bar to a given completion fraction (between 0 and 1)
858838 */
859839 updateProgress: function( fraction ) {
860 - //js_log('update progress: ' + fraction);
 840+ //mw.log('update progress: ' + fraction);
861841 $j( '#up-progressbar' ).progressbar( 'value', parseInt( fraction * 100 ) );
862842 $j( '#up-pstatus' ).html( parseInt( fraction * 100 ) + '% - ' );
863843 },
@@ -945,7 +925,7 @@
946926 */
947927 $.fn.doDestCheck = function( opt ) {
948928 var _this = this;
949 - js_log( 'doDestCheck::' + _this.selector );
 929+ mw.log( 'doDestCheck::' + _this.selector );
950930
951931 // Set up option defaults
952932 if ( !opt.warn_target )
@@ -964,19 +944,16 @@
965945 $j( _this.selector )
966946 .append( '<img id="mw-spinner-wpDestFile" ' +
967947 'src ="' + stylepath + '/common/images/spinner.gif" />' );
968 -
969 - // Do the destination check
970 - do_api_req(
971 - {
972 - 'data': {
973 - //@@todo we may need a more clever way to get a the filename
974 - 'titles': 'File:' + $j( _this.selector ).val(),
975 - 'prop': 'imageinfo',
976 - 'iiprop': 'url|mime|size',
977 - 'iiurlwidth': 150
978 - }
979 - },
980 - function( data ) {
 948+
 949+ var request = {
 950+ 'titles': 'File:' + $j( _this.selector ).val(),
 951+ 'prop': 'imageinfo',
 952+ 'iiprop': 'url|mime|size',
 953+ 'iiurlwidth': 150
 954+ };
 955+
 956+ // Do the destination check ( on the local wiki )
 957+ mw.getJSON( request, function( data ) {
981958 // Remove spinner
982959 $j( '#mw-spinner-wpDestFile' ).remove();
983960
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js
@@ -30,28 +30,24 @@
3131 */
3232 addByTitle:function( title , callback, redirect_count ) {
3333
34 - js_log( "AddByTitle::" + title );
 34+ mw.log( "AddByTitle::" + title );
3535
3636 var _this = this;
3737 if ( !redirect_count )
3838 redirect_count = 0;
3939 if ( redirect_count > 5 ) {
40 - js_log( 'Error: addByTitle too many redirects' );
 40+ mw.log( 'Error: addByTitle too many redirects' );
4141 callback( false );
4242 return false;
4343 }
4444 var request = {
45 - 'action':'query',
4645 'titles':'File:' + title,
4746 'prop':'imageinfo|revisions|categories',
4847 'iiprop':'url|mime|size',
4948 'iiurlwidth': parseInt( this.rsd.thumb_width ),
5049 'rvprop':'content'
5150 }
52 - do_api_req( {
53 - 'data':request,
54 - 'url':this.provider.api_url
55 - }, function( data ) {
 51+ mw.getJSON(this.provider.api_url, request, function( data ) {
5652 // check for redirect
5753 for ( var i in data.query.pages ) {
5854 var page = data.query.pages[i];
@@ -62,7 +58,7 @@
6359 _this.addByTitle( pt[1], callback, redirect_count++ );
6460 return ;
6561 } else {
66 - js_log( 'Error: addByTitle could not proccess redirect' );
 62+ mw.log( 'Error: addByTitle could not proccess redirect' );
6763 callback( false );
6864 return false;
6965 }
@@ -82,16 +78,13 @@
8379 */
8480 getUserRecentUploads: function( user, callback ) {
8581 var _this = this;
86 - do_api_req( {
87 - 'url':this.provider.api_url,
88 - 'data': {
89 - 'action':'query',
90 - 'list':'recentchanges',
91 - 'rcnamespace':6, // only files
92 - 'rcuser': user,
93 - 'rclimit':15 // get last 15 uploaded files
94 - }
95 - }, function( data ) {
 82+ var request = {
 83+ 'list':'recentchanges',
 84+ 'rcnamespace':6, // only files
 85+ 'rcuser': user,
 86+ 'rclimit':15 // get last 15 uploaded files
 87+ };
 88+ mw.getJSON( this.provider.api_url, request, function( data ) {
9689 var titleSet = { };
9790 var titleStr = ''
9891 var pound = '';
@@ -108,17 +101,14 @@
109102 }
110103 // Run the actual query ( too bad we can't use recentchanges as a generator )
111104 // bug 20563
112 - do_api_req( {
113 - 'data' : {
114 - 'action' : 'query',
115 - 'titles' : titleStr,
116 - 'prop' : 'imageinfo|revisions|categories',
117 - 'iiprop' : 'url|mime|size',
118 - 'iiurlwidth': parseInt( _this.rsd.thumb_width ),
119 - 'rvprop':'content'
120 - },
121 - 'url': _this.provider.api_url
122 - }, function( data ) {
 105+ var resourceQuery = {
 106+ 'titles' : titleStr,
 107+ 'prop' : 'imageinfo|revisions|categories',
 108+ 'iiprop' : 'url|mime|size',
 109+ 'iiurlwidth': parseInt( _this.rsd.thumb_width ),
 110+ 'rvprop':'content'
 111+ };
 112+ mw.getJSON( _this.provider.api_url, resourceQuery, function( data ) {
123113 _this.clearResults();
124114 _this.addResults( data );
125115 if ( callback )
@@ -138,7 +128,7 @@
139129 // Set local ref:
140130 var _this = this;
141131
142 - js_log( 'f:getSearchResults for:' + search_query );
 132+ mw.log( 'f:getSearchResults for:' + search_query );
143133
144134 // Build the image request
145135 var request = {
@@ -156,10 +146,7 @@
157147 };
158148
159149 // Do the api request:
160 - do_api_req( {
161 - 'data':request,
162 - 'url': this.provider.api_url
163 - }, function( data ) {
 150+ mw.getJSON( this.provider.api_url, request, function( data ) {
164151 // Add result data:
165152 _this.addResults( data );
166153 _this.loading = false;
@@ -182,7 +169,7 @@
183170 * @param {Boolean} returnFirst Flag to return the first added resource
184171 */
185172 addResults:function( data, returnFirst ) {
186 - js_log( "f:addResults" );
 173+ mw.log( "f:addResults" );
187174 var _this = this
188175 // check if we have
189176 if ( typeof data['query-continue'] != 'undefined' ) {
@@ -218,8 +205,8 @@
219206 'poster' : page.imageinfo[0].thumburl,
220207 'thumbwidth' : page.imageinfo[0].thumbwidth,
221208 'thumbheight': page.imageinfo[0].thumbheight,
222 - 'orgwidth' : page.imageinfo[0].width,
223 - 'orgheight' : page.imageinfo[0].height,
 209+ 'width' : page.imageinfo[0].width,
 210+ 'height' : page.imageinfo[0].height,
224211 'mime' : page.imageinfo[0].mime,
225212 'src' : page.imageinfo[0].url,
226213 'desc' : page.revisions[0]['*'],
@@ -228,7 +215,7 @@
229216 'meta': {
230217 'categories':page.categories
231218 }
232 - };
 219+ };
233220
234221 /*
235222 //to use once we get the wiki-text parser in shape
@@ -277,11 +264,11 @@
278265
279266 this.num_results++;
280267 // for(var i in this.resultsObj[page_id]){
281 - // js_log('added: '+ i +' '+ this.resultsObj[page_id][i]);
 268+ // mw.log('added: '+ i +' '+ this.resultsObj[page_id][i]);
282269 // }
283270 }
284271 } else {
285 - js_log( 'no results:' + data );
 272+ mw.log( 'no results:' + data );
286273 }
287274 },
288275
@@ -319,30 +306,29 @@
320307 // Set the width:
321308 if ( size.width )
322309 request['iiurlwidth'] = size.width;
323 - js_log( 'going to do req: ' + this.provider.api_url + ' ' + request );
324 - do_api_req( {
325 - 'data':request,
326 - 'url' : this.provider.api_url
327 - }, function( data ) {
328 - var imObj = { };
329 - for ( var page_id in data.query.pages ) {
330 - var iminfo = data.query.pages[ page_id ].imageinfo[0];
331 - // store the orginal width:
332 - imObj['org_width'] = iminfo.width;
333 - // check if thumb size > than image size and is jpeg or png (it will not scale well above its max res)
334 - if ( ( iminfo.mime == 'image/jpeg' || iminfo == 'image/png' ) &&
335 - iminfo.thumbwidth > iminfo.width ) {
336 - imObj['url'] = iminfo.url;
337 - imObj['width'] = iminfo.width;
338 - imObj['height'] = iminfo.height;
339 - } else {
340 - imObj['url'] = iminfo.thumburl;
341 - imObj['width'] = iminfo.thumbwidth;
342 - imObj['height'] = iminfo.thumbheight;
343 - }
 310+
 311+ mw.log( 'going to do req: ' + this.provider.api_url + ' ' + request );
 312+
 313+ mw.getJSON( this.provider.api_url, request, function( data ) {
 314+ var imObj = { };
 315+ for ( var page_id in data.query.pages ) {
 316+ var iminfo = data.query.pages[ page_id ].imageinfo[0];
 317+ // store the orginal width:
 318+ imObj['org_width'] = iminfo.width;
 319+ // check if thumb size > than image size and is jpeg or png (it will not scale well above its max res)
 320+ if ( ( iminfo.mime == 'image/jpeg' || iminfo == 'image/png' ) &&
 321+ iminfo.thumbwidth > iminfo.width ) {
 322+ imObj['url'] = iminfo.url;
 323+ imObj['width'] = iminfo.width;
 324+ imObj['height'] = iminfo.height;
 325+ } else {
 326+ imObj['url'] = iminfo.thumburl;
 327+ imObj['width'] = iminfo.thumbwidth;
 328+ imObj['height'] = iminfo.thumbheight;
344329 }
345 - js_log( 'getImageObj: get: ' + size.width + ' got url:' + imObj.url );
346 - callback( imObj );
 330+ }
 331+ mw.log( 'getImageObj: get: ' + size.width + ' got url:' + imObj.url );
 332+ callback( imObj );
347333 } );
348334 },
349335
@@ -374,7 +360,7 @@
375361 desc = desc.replace( /\=\=[^\=]*\=\=/gi, '' );
376362
377363 // else return the title since we could not find the desc:
378 - js_log( 'Error: No Description Tag, Using::' + desc );
 364+ mw.log( 'Error: No Description Tag, Using::' + desc );
379365 return desc;
380366 },
381367
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js
@@ -60,7 +60,7 @@
6161 * @param {Object} options The set of options for the remote search class
6262 */
6363 init: function( options ) {
64 - js_log( 'mvBaseRemoteSearch:init' );
 64+ mw.log( 'mvBaseRemoteSearch:init' );
6565 for ( var i in options ) {
6666 this[i] = options[i];
6767 }
@@ -99,7 +99,7 @@
100100 * @param {String} provider_url the source url (used to generate absolute links)
101101 */
102102 addRSSData:function( data , provider_url ) {
103 - js_log( 'f:addRSSData' );
 103+ mw.log( 'f:addRSSData' );
104104 var _this = this;
105105 var http_host = '';
106106 var http_path = '';
@@ -109,13 +109,13 @@
110110 http_path = pUrl.directory;
111111 }
112112 var items = data.getElementsByTagName( 'item' );
113 - // js_log('found ' + items.length );
114 - $j.each( items, function( inx, item ) {
 113+ // mw.log('found ' + items.length );
 114+ $j.each( items, function( inx, item ) {
115115 var resource = { };
116116 for ( var attr in rsd_default_rss_item_mapping ) {
117117 _this.mapAttributeToResource( resource, item, attr );
118118 }
119 - // make relative urls absolute:
 119+ // Make relative urls absolute:
120120 var url_param = new Array( 'src', 'poster' );
121121 for ( var j = 0; j < url_param.length; j++ ) {
122122 var p = url_param[j];
@@ -123,7 +123,7 @@
124124 if ( resource[p].substr( 0, 1 ) == '/' ) {
125125 resource[p] = http_host + resource[p];
126126 }
127 - if ( mw.parseUri( resource[i] ).host == resource[p] ) {
 127+ if ( mw.parseUri( resource[ j ] ).host == resource[p] ) {
128128 resource[p] = http_host + http_path + resource[p];
129129 }
130130 }
@@ -210,13 +210,14 @@
211211 if(! options.width )
212212 options.width = resource.width;
213213 if(! options.height )
214 - options.height = resource.height
 214+ options.height = resource.height;
215215
216216 var outHtml = '';
217217 if ( options['max_height'] ) {
218218 options.height = ( options.max_height > resource.height ) ? resource.height : options.max_height;
219 - options.width = ( resource.width / resource.height ) * options.height;
220 - }
 219+ options.width = ( resource.width / resource.height ) * options.height;
 220+ }
 221+
221222 options.style = '';
222223 if( options.height )
223224 options.style += 'height:' + options.height + 'px;';
@@ -243,14 +244,14 @@
244245 }
245246 }
246247
247 - // Return the output. Wrap with a description div if remote_insert_description is on.
 248+ // Return the output. Wrap with a description div if insert_description is on.
248249 if( outHtml != '')
249 - return ( this.rsd['remote_insert_description'] ) ?
250 - this.wrapHtmlDesc(resource, options, outHtml) :
251 - outHtml;
 250+ return ( options['insert_description'] ) ?
 251+ this.wrapHtmlDesc(resource, options, outHtml) :
 252+ outHtml;
252253
253254 // No output give error:
254 - js_log( "ERROR:: no embed code for mime type: " + resource.mime );
 255+ mw.log( "ERROR:: no embed code for mime type: " + resource.mime );
255256 return 'Error missing embed code for: ' + escape( resource.mime );
256257 },
257258 wrapHtmlDesc: function( resource, options, outHtml ) {
@@ -263,8 +264,7 @@
264265 'title="' + cpTitle + '">' +
265266 cpTitle + '</a>';
266267 return '<div class="mw-imported-resource" '+
267 - 'style="width:' + options.width + 'px;' +
268 - 'height:' + ( options.height + 20 ) + 'px;">' +
 268+ 'style="width:' + options.width + 'px;">' +
269269 outHtml +
270270 gM( 'mwe-import-description', [titleLink, remoteProviderLink]) +
271271 '</div>';
@@ -426,7 +426,9 @@
427427 * @parma {Object} resource Resource to update title on.
428428 */
429429 updateTargetResourceTitle:function( resource ) {
430 - resource.target_resource_title = resource.titleKey.replace( /^(File:|Image:)/ , '' );
431 - resource.target_resource_title = this.provider.resource_prefix + resource.target_resource_title;
 430+ if( resource.titleKey ){
 431+ resource.target_resource_title = resource.titleKey.replace( /^(File:|Image:)/ , '' );
 432+ resource.target_resource_title = this.provider.resource_prefix + resource.target_resource_title;
 433+ }
432434 }
433435 }
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js
@@ -39,7 +39,7 @@
4040 this.parent_getSearchResults();
4141
4242 var _this = this;
43 - js_log( 'f:getSearchResults for:' + search_query );
 43+ mw.log( 'f:getSearchResults for:' + search_query );
4444
4545
4646 // For now force (Ogg video) & url based license
@@ -47,22 +47,17 @@
4848 search_query += ' licenseurl:(http\\:\\/\\/*)';
4949
5050 // Build the request Object
51 - var reqObj = {
 51+ var request = {
5252 'q': search_query, // just search for video atm
5353 'fl':"description,title,identifier,licenseurl,format,license,thumbnail",
5454 'wt':'json',
5555 'rows' : this.provider.limit,
5656 'start' : this.provider.offset
5757 }
58 - do_api_req( {
59 - 'data':reqObj,
60 - 'url':this.provider.api_url,
61 - 'jsonCB':'json.wrf'
62 - }, function( data ) {
63 - _this.addResults( data );
64 - _this.loading = false;
65 - }
66 - );
 58+ $j.getJSON( this.provider.api_url + '?json.wrf=?', request, function( data ) {
 59+ _this.addResults( data );
 60+ _this.loading = false;
 61+ } );
6762 },
6863 /**
6964 * Adds the search results to the local resultsObj
@@ -107,18 +102,18 @@
108103 */
109104 addResourceInfoCallback:function( resource, callback ) {
110105 var _this = this;
111 - do_api_req( {
112 - 'data': { 'avinfo' : 1 },
113 - 'url':_this.downloadUrl + resource.resourceKey + '/format=Ogg+video'
114 - }, function( data ) {
115 - if ( data['length'] )
116 - resource.duration = data['length'];
117 - if ( data['width'] )
118 - resource.width = data['width'];
119 - if ( data['height'] )
120 - resource.height = data['height'];
121 -
122 - callback();
 106+ $j.getJSON(
 107+ _this.downloadUrl + resource.resourceKey + '/format=Ogg+video&callback=?',
 108+ { 'avinfo' : 1 },
 109+ function( data ) {
 110+ if ( data['length'] )
 111+ resource.duration = data['length'];
 112+ if ( data['width'] )
 113+ resource.width = data['width'];
 114+ if ( data['height'] )
 115+ resource.height = data['height'];
 116+
 117+ callback();
123118 } );
124119 },
125120
@@ -128,7 +123,7 @@
129124 * @parma {Object} options Options for the embeding.
130125 */
131126 getEmbedHTML: function( resource , options ) {
132 - js_log( 'getEmbedHTML:: ' + resource.poster );
 127+ mw.log( 'getEmbedHTML:: ' + resource.poster );
133128 if ( !options )
134129 options = { };
135130 var id_attr = ( options['id'] ) ? ' id = "' + options['id'] + '" ': '';
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js
@@ -38,24 +38,20 @@
3939 // Set local ref:
4040 var _this = this;
4141
42 - js_log( 'metavidSearch::getSearchResults()' );
 42+ mw.log( 'metavidSearch::getSearchResults()' );
4343
4444 // Process all options
4545 var url = this.provider.api_url;
46 - var reqObj = $j.extend({}, this.defaultReq);
47 - reqObj[ 'f[0][t]' ] = 'match';
48 - reqObj[ 'f[0][v]' ] = search_query;
 46+ var request = $j.extend( {}, this.defaultReq );
 47+ request[ 'f[0][t]' ] = 'match';
 48+ request[ 'f[0][v]' ] = search_query;
4949
5050 // add offset limit:
51 - reqObj[ 'limit' ] = this.provider.limit;
52 - reqObj[ 'offset' ] = this.provider.offset;
53 -
54 - do_api_req({
55 - 'url' : url,
56 - 'jsonCB' : 'cb',
57 - 'data' : reqObj
58 - }, function( data ) {
59 - js_log( 'mvSearch: got data response::' );
 51+ request[ 'limit' ] = this.provider.limit;
 52+ request[ 'offset' ] = this.provider.offset;
 53+ mw.log("getJSON: " + url + '&cb=?' );
 54+ $j.getJSON( url + '&cb=?&cb_inx=1', request, function( data ) {
 55+ mw.log( 'mvSearch: got data response::' );
6056 var xmldata = ( data && data['pay_load'] ) ? mw.parseXML( data['pay_load'] ) : false;
6157 if( !xmldata ){
6258 // XML Error or No results:
@@ -172,7 +168,7 @@
173169 * @param {Object} resource Resource to be updated
174170 */
175171 applyVideoAdj: function( resource ) {
176 - js_log( 'mv ApplyVideoAdj::' );
 172+ mw.log( 'mv ApplyVideoAdj::' );
177173
178174 // Update the titleKey:
179175 resource['titleKey'] = this.getTitleKey( resource );
@@ -181,17 +177,17 @@
182178 resource['title'] = this.getTitle( resource );
183179
184180 // update the interface:
185 - js_log( 'update title to: ' + resource['title'] );
 181+ mw.log( 'update title to: ' + resource['title'] );
186182 $j( '#rsd_resource_title' ).html( gM( 'rsd_resource_edit', resource['title'] ) );
187183
188184 // if the video is "roe" based select the ogg stream
189185 if ( resource.roe_url && resource.pSobj.provider.stream_import_key ) {
190186 var source = $j( '#embed_vid' ).get( 0 ).media_element.getSourceById( resource.pSobj.provider.stream_import_key );
191187 if ( !source ) {
192 - js_error( 'Error::could not find source: ' + resource.pSobj.provider.stream_import_key );
 188+ mw.log( 'Error::could not find source: ' + resource.pSobj.provider.stream_import_key );
193189 } else {
194190 resource['src'] = source.getSrc();
195 - js_log( "g src_key: " + resource.pSobj.provider.stream_import_key + ' src:' + resource['src'] ) ;
 191+ mw.log( "g src_key: " + resource.pSobj.provider.stream_import_key + ' src:' + resource['src'] ) ;
196192 return true;
197193 }
198194 }
@@ -222,15 +218,15 @@
223219 */
224220 getImageTransform:function( resource, opt ) {
225221 if ( opt.width <= 80 ) {
226 - return getURLParamReplace( resource.poster, { 'size' : "icon" } )
 222+ return mw.replaceUrlParams( resource.poster, { 'size' : "icon" } )
227223 } else if ( opt.width <= 160 ) {
228 - return getURLParamReplace( resource.poster, { 'size' : "small" } )
 224+ return mw.replaceUrlParams( resource.poster, { 'size' : "small" } )
229225 } else if ( opt.width <= 320 ) {
230 - return getURLParamReplace( resource.poster, { 'size' : 'medium' } )
 226+ return mw.replaceUrlParams( resource.poster, { 'size' : 'medium' } )
231227 } else if ( opt.width <= 512 ) {
232 - return getURLParamReplace( resource.poster, { 'size' : 'large' } )
 228+ return mw.replaceUrlParams( resource.poster, { 'size' : 'large' } )
233229 } else {
234 - return getURLParamReplace( resource.poster, { 'size' : 'full' } )
 230+ return mw.replaceUrlParams( resource.poster, { 'size' : 'full' } )
235231 }
236232 },
237233
@@ -248,7 +244,7 @@
249245 if ( cur_source.id == this.provider.target_source_id )
250246 resource['url'] = cur_source.getSrc();
251247 }
252 - // js_log('set url to: ' + resource['url']);
 248+ // mw.log('set url to: ' + resource['url']);
253249 return resource;
254250 },
255251
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/flickrSearch.js
@@ -53,13 +53,13 @@
5454 */
5555 getSearchResults:function( search_query ) {
5656 var _this = this;
57 - js_log( "flickr::getSearchResults" );
 57+ mw.log( "flickr::getSearchResults" );
5858
5959 // call parent for common initialisation:
6060 this.parent_getSearchResults();
6161
6262 // setup the flickr request:
63 - var reqObj = {
 63+ var request = {
6464 'method':'flickr.photos.search',
6565 'format':'json',
6666 'license':this._license_keys,
@@ -69,11 +69,7 @@
7070 'text': search_query,
7171 'extras' : 'license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_m, url_o'
7272 }
73 - do_api_req( {
74 - 'data': reqObj,
75 - 'url': this.provider.api_url,
76 - 'jsonCB':'jsoncallback',
77 - }, function( data ) {
 73+ $j.getJSON( this.provider.api_url + '?jsoncallback=?', request, function( data ) {
7874 _this.addResults( data );
7975 _this.loading = false;
8076 } );
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvAdvFirefogg.js
@@ -303,7 +303,7 @@
304304 },
305305
306306 createControls: function() {
307 - js_log( "adv createControls" );
 307+ mw.log( "adv createControls" );
308308 var _this = this;
309309 // Load presets from the cookie
310310 this.loadEncSettings();
@@ -383,7 +383,7 @@
384384 'class="text ui-widget-content ui-corner-all ' + target + '" ' +
385385 'type="text" value="' + text + '" size="60" /> ';
386386 default:
387 - js_log( 'call : basefogg_getTargetHtml for:' + target );
 387+ mw.log( 'call : basefogg_getTargetHtml for:' + target );
388388 return this.basefogg_getControlHtml( target );
389389 }
390390 },
@@ -391,7 +391,7 @@
392392 getPresetControlHtml: function() {
393393 var out = '';
394394 var _this = this;
395 - js_log( 'getPresetControlHtml::' );
 395+ mw.log( 'getPresetControlHtml::' );
396396 if ( typeof this.local_settings.presets != 'undefined' ) {
397397 out += '<select class="_preset_select">';
398398 $j.each( this.local_settings.presets, function( presetKey, preset ) {
@@ -527,7 +527,7 @@
528528
529529 var helpState = {};
530530 // Do some display tweaks
531 - js_log( 'tw:' + $j( this.selector ).width() +
 531+ mw.log( 'tw:' + $j( this.selector ).width() +
532532 ' ssf:' + $j( this.target_btn_select_new_file ).width() +
533533 ' sf:' + $j( this.target_btn_save_local_file ).width() );
534534
@@ -578,7 +578,7 @@
579579 $j( this.selector + ' .helpClose_' + configKey )
580580 .click(
581581 function() {
582 - js_log( "close help: " + configKey );
 582+ mw.log( "close help: " + configKey );
583583 // get the config key (assume it's the last class)
584584 var configKey = _this.getClassId( this, 'helpClose_' );
585585 $j( _this.selector + ' .helpRow_' + configKey ).hide( 'slow' );
@@ -665,7 +665,7 @@
666666 // Change it to the validated value
667667 $j( this ).val( validValue );
668668 // update the slider
669 - js_log( "update: " + _this.selector + ' .slider' + classId );
 669+ mw.log( "update: " + _this.selector + ' .slider' + classId );
670670 $j( _this.selector + ' .slider' + classId )
671671 .slider( 'option', 'value', validValue );
672672 });
@@ -690,7 +690,7 @@
691691 updatePresetSelection: function( presetKey ) {
692692 // Update the local configuration
693693 this.local_settings['default'] = presetKey;
694 - // js_log( 'update preset desc: ' + presetKey );
 694+ // mw.log( 'update preset desc: ' + presetKey );
695695 var presetDesc = '';
696696 if ( this.local_settings.presets[presetKey].desc ) {
697697 presetDesc = this.local_settings.presets[presetKey].desc;
@@ -714,7 +714,7 @@
715715 }
716716 // Look up the type
717717 if ( typeof this.default_encoder_config[confKey] == 'undefined' ) {
718 - js_error( 'error: missing default key: ' + confKey );
 718+ mw.log( 'error: missing default key: ' + confKey );
719719 return false;
720720 }
721721
@@ -741,7 +741,7 @@
742742 */
743743 updateLocalValue: function( confKey, value ) {
744744 if ( typeof this.default_encoder_config[confKey] == 'undefined' ) {
745 - js_log( "Error: could not update conf key: " + confKey )
 745+ mw.log( "Error: could not update conf key: " + confKey )
746746 return value;
747747 }
748748 var confEntry = this.default_encoder_config[confKey];
@@ -765,7 +765,7 @@
766766 }
767767 }*/
768768
769 - js_log( 'update:local_settings:custom:conf:' + confKey + ' = ' + value );
 769+ mw.log( 'update:local_settings:custom:conf:' + confKey + ' = ' + value );
770770 this.local_settings.presets['custom']['conf'][confKey] = value;
771771
772772 return value;
@@ -832,7 +832,7 @@
833833
834834 // In passthrough mode, hide encoder controls
835835 if ( settings['passthrough'] ) {
836 - js_log( "in passthrough mode (hide control)" );
 836+ mw.log( "in passthrough mode (hide control)" );
837837 $j( this.target_control_container ).hide( 'slow' );
838838 $j( this.target_passthrough_mode ).show( 'slow' );
839839 return;
@@ -935,7 +935,7 @@
936936 * Set the HTML control values to whatever is currently present in this.local_settings
937937 */
938938 updateValuesInHtml: function() {
939 - js_log( 'updateValuesInHtml::' );
 939+ mw.log( 'updateValuesInHtml::' );
940940 var _this = this;
941941 var pKey = this.local_settings[ 'default' ];
942942 this.updatePresetSelection( pKey );
@@ -953,14 +953,14 @@
954954 */
955955 loadEncSettings: function( ) {
956956 if ( $j.cookie( 'fogg_encoder_config' ) ) {
957 - js_log( "load:fogg_encoder_config from cookie " );
 957+ mw.log( "load:fogg_encoder_config from cookie " );
958958 this.local_settings = JSON.parse( $j.cookie( 'fogg_settings' ) );
959959 }
960960 // set to default if not loaded yet:
961961 if ( this.local_settings && this.local_settings.presets
962962 && this.local_settings.presets['custom']['conf'] )
963963 {
964 - js_log( 'local settings already populated' );
 964+ mw.log( 'local settings already populated' );
965965 } else {
966966 this.local_settings = this.default_local_settings;
967967 }
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js
@@ -146,7 +146,7 @@
147147 }
148148
149149 if ( !this.selector ) {
150 - js_log('firefogg: missing selector ');
 150+ mw.log('firefogg: missing selector ');
151151 }
152152 },
153153
@@ -156,7 +156,7 @@
157157 */
158158 doRewrite: function( callback ) {
159159 var _this = this;
160 - js_log( 'sel len: ' + this.selector + '::' + $j( this.selector ).length +
 160+ mw.log( 'sel len: ' + this.selector + '::' + $j( this.selector ).length +
161161 ' tag:' + $j( this.selector ).get( 0 ).tagName );
162162 if ( $j( this.selector ).length >= 0 ) {
163163 if ( $j( this.selector ).get( 0 ).tagName.toLowerCase() == 'input' ) {
@@ -218,7 +218,7 @@
219219 var msg = gM( target.replace( /^target_/, 'fogg-' ) );
220220 return '<div style="" class="' + target + '" >' + msg + '</div> ';
221221 } else {
222 - js_error( 'Invalid target: ' + target );
 222+ mw.log( 'Invalid target: ' + target );
223223 return '';
224224 }
225225 },
@@ -270,7 +270,7 @@
271271
272272 // Show the "use latest Firefox" message if necessary
273273 if ( !( $j.browser.mozilla && $j.browser.version >= '1.9.1' ) ) {
274 - js_log( 'show use latest::' + _this.target_use_latest_firefox );
 274+ mw.log( 'show use latest::' + _this.target_use_latest_firefox );
275275 if ( _this.target_use_latest_firefox ) {
276276 if ( _this.form_type == 'upload' )
277277 $j( _this.target_use_latest_firefox )
@@ -340,7 +340,7 @@
341341 * Set up the upload form
342342 */
343343 setupForm: function() {
344 - js_log( 'firefogg::setupForm::' );
 344+ mw.log( 'firefogg::setupForm::' );
345345
346346 // Set up the parent if we are in upload mode
347347 if ( this.form_type == 'upload' ) {
@@ -377,7 +377,7 @@
378378 var id = $j( this.selector ).attr( 'name' ) + '_firefogg-control';
379379 inputTag += '/><span id="' + id + '"></span>';
380380
381 - js_log( 'set input: ' + inputTag );
 381+ mw.log( 'set input: ' + inputTag );
382382
383383 $j( this.selector ).replaceWith( inputTag );
384384
@@ -445,7 +445,7 @@
446446 onPreviewClick: function( sourceNode ) {
447447 var button = $j( sourceNode );
448448 var icon = button.children( '.ui-icon' );
449 - js_log( "click .fogg_preview" + icon.attr( 'class' ) );
 449+ mw.log( "click .fogg_preview" + icon.attr( 'class' ) );
450450
451451 if ( icon.hasClass( 'ui-icon-triangle-1-e' ) ) {
452452 // Show preview
@@ -495,7 +495,7 @@
496496 // Initialize the video if it is not set up already
497497 var v = $j( '#fogg_preview_vid' ).get( 0 );
498498 if ( v.src != _this.fogg.previewUrl ) {
499 - js_log( 'init preview with url:' + _this.fogg.previewUrl );
 499+ mw.log( 'init preview with url:' + _this.fogg.previewUrl );
500500 v.src = _this.fogg.previewUrl;
501501
502502 // Once it's loaded, seek to the end
@@ -557,11 +557,11 @@
558558 * Update the UI due to the source file changing
559559 */
560560 updateSourceFileUI: function() {
561 - js_log( 'videoSelectReady' );
 561+ mw.log( 'videoSelectReady' );
562562 var _this = this;
563563 if ( !_this.fogg.sourceInfo || !_this.fogg.sourceFilename ) {
564564 // Something wrong with the source file?
565 - js_log( 'selectSourceFile: sourceInfo/sourceFilename missing' );
 565+ mw.log( 'selectSourceFile: sourceInfo/sourceFilename missing' );
566566 return;
567567 }
568568
@@ -589,7 +589,7 @@
590590 }
591591
592592 // Update the input file name box and show it
593 - js_log( " should update: " + _this.target_input_file_name +
 593+ mw.log( " should update: " + _this.target_input_file_name +
594594 ' to: ' + _this.fogg.sourceFilename );
595595
596596 $j( _this.target_input_file_name )
@@ -619,13 +619,13 @@
620620 getSourceFileInfo: function() {
621621 if ( this.sourceFileInfo == null ) {
622622 if ( !this.fogg.sourceInfo ) {
623 - js_error( 'No firefogg source info is available' );
 623+ mw.log( 'No firefogg source info is available' );
624624 return false;
625625 }
626626 try {
627627 this.sourceFileInfo = JSON.parse( this.fogg.sourceInfo );
628628 } catch ( e ) {
629 - js_error( 'error could not parse fogg sourceInfo' );
 629+ mw.log( 'error could not parse fogg sourceInfo' );
630630 return false;
631631 }
632632 }
@@ -647,7 +647,7 @@
648648 doLocalEncodeAndSave: function() {
649649 var _this = this;
650650 if ( !this.fogg ) {
651 - js_error( 'doLocalEncodeAndSave: no Firefogg object!' );
 651+ mw.log( 'doLocalEncodeAndSave: no Firefogg object!' );
652652 return false;
653653 }
654654
@@ -665,7 +665,7 @@
666666 _this.updateProgress( progress );
667667 },
668668 function /* onDone */ () {
669 - js_log( "done with encoding (no upload) " );
 669+ mw.log( "done with encoding (no upload) " );
670670 // Set status to 100% for one second
671671 // FIXME: this is either a hack or a waste of time, not sure which
672672 _this.updateProgress( 1 );
@@ -731,7 +731,7 @@
732732 // Grab the extension
733733 var sf = this.fogg.sourceFilename;
734734 if ( !sf ) {
735 - js_error( 'getEncoderSettings(): No Firefogg source filename is available!' );
 735+ mw.log( 'getEncoderSettings(): No Firefogg source filename is available!' );
736736 return false;
737737 }
738738 var ext = '';
@@ -750,7 +750,7 @@
751751 settings['passthrough'] = true;
752752 }
753753
754 - js_log( 'base setupAutoEncoder::' + this.getSourceFileInfo().contentType +
 754+ mw.log( 'base setupAutoEncoder::' + this.getSourceFileInfo().contentType +
755755 ' passthrough:' + settings['passthrough'] );
756756 this.current_encoder_settings = settings;
757757 }
@@ -779,7 +779,7 @@
780780 * Get the default title of the progress window
781781 */
782782 getProgressTitle: function() {
783 - js_log( "fogg:getProgressTitle f:" + ( this.getFirefogg() ? 'on' : 'off' ) +
 783+ mw.log( "fogg:getProgressTitle f:" + ( this.getFirefogg() ? 'on' : 'off' ) +
784784 ' mode:' + this.form_type );
785785 // Return the parent's title if we don't have Firefogg turned on
786786 if ( !this.getFirefogg() || !this.firefogg_form_action ) {
@@ -796,7 +796,7 @@
797797 */
798798 doUpload: function() {
799799 var _this = this;
800 - js_log( "firefogg: doUpload:: " +
 800+ mw.log( "firefogg: doUpload:: " +
801801 ( this.getFirefogg() ? 'on' : 'off' ) +
802802 ' up mode:' + _this.upload_mode );
803803
@@ -815,7 +815,7 @@
816816 _this.updateProgress( progress );
817817 },
818818 function /* onDone */ () {
819 - js_log( 'done with encoding do POST upload:' + _this.form.action );
 819+ mw.log( 'done with encoding do POST upload:' + _this.form.action );
820820 // ignore warnings & set source type
821821 //_this.formData[ 'wpIgnoreWarning' ]='true';
822822 _this.formData['wpSourceType'] = 'upload';
@@ -830,7 +830,7 @@
831831 }
832832 );
833833 } else {
834 - js_error( 'Error: unrecongized upload mode: ' + _this.upload_mode );
 834+ mw.log( 'Error: unrecongized upload mode: ' + _this.upload_mode );
835835 }
836836 },
837837
@@ -839,7 +839,7 @@
840840 * they become ready.
841841 */
842842 doChunkUpload : function() {
843 - js_log( 'firefogg::doChunkUpload' );
 843+ mw.log( 'firefogg::doChunkUpload' );
844844 var _this = this;
845845 _this.action_done = false;
846846
@@ -864,7 +864,7 @@
865865 }
866866
867867 if( _this.editToken ) {
868 - js_log( 'we already have an edit token: ' + _this.editToken );
 868+ mw.log( 'we already have an edit token: ' + _this.editToken );
869869 _this.doChunkUploadWithFormData();
870870 return;
871871 }
@@ -889,7 +889,7 @@
890890 */
891891 doChunkUploadWithFormData: function() {
892892 var _this = this;
893 - js_log( "firefogg::doChunkUploadWithFormData" + _this.editToken );
 893+ mw.log( "firefogg::doChunkUploadWithFormData" + _this.editToken );
894894 // Build the API URL
895895 var aReq = {
896896 'action': 'upload',
@@ -909,8 +909,8 @@
910910 aReq['ignorewarnings'] = _this.formData['ignorewarnings'];
911911
912912 var encoderSettings = this.getEncoderSettings();
913 - js_log( 'do fogg upload/encode call: ' + _this.api_url + ' :: ' + JSON.stringify( aReq ) );
914 - js_log( 'foggEncode: ' + JSON.stringify( encoderSettings ) );
 913+ mw.log( 'do fogg upload/encode call: ' + _this.api_url + ' :: ' + JSON.stringify( aReq ) );
 914+ mw.log( 'foggEncode: ' + JSON.stringify( encoderSettings ) );
915915 _this.fogg.upload( JSON.stringify( encoderSettings ), _this.api_url,
916916 JSON.stringify( aReq ) );
917917
@@ -931,7 +931,7 @@
932932 _this.action_done = false;
933933 _this.displayProgressOverlay();
934934 var encoderSettings = this.getEncoderSettings();
935 - js_log( 'doEncode: with: ' + JSON.stringify( encoderSettings ) );
 935+ mw.log( 'doEncode: with: ' + JSON.stringify( encoderSettings ) );
936936 _this.fogg.encode( JSON.stringify( encoderSettings ) );
937937
938938 //show transcode status:
@@ -957,7 +957,7 @@
958958 doneCallback();
959959 } else if ( _this.fogg.state == 'encoding fail' ) {
960960 //@@todo error handling:
961 - js_error( 'encoding failed' );
 961+ mw.log( 'encoding failed' );
962962 }
963963 }
964964 encodingStatus();
@@ -982,18 +982,18 @@
983983 var pstatus = JSON.parse( _this.fogg.uploadstatus() );
984984 response_text = pstatus["responseText"];
985985 } catch( e ) {
986 - js_log( "could not parse uploadstatus / could not get responseText" );
 986+ mw.log( "could not parse uploadstatus / could not get responseText" );
987987 }
988988 }
989989
990990 if ( _this.oldResponseText != response_text ) {
991 - js_log( 'new result text:' + response_text + ' state:' + _this.fogg.state );
 991+ mw.log( 'new result text:' + response_text + ' state:' + _this.fogg.state );
992992 _this.oldResponseText = response_text;
993993 // Parse the response text and check for errors
994994 try {
995995 var apiResult = JSON.parse( response_text );
996996 } catch( e ) {
997 - js_log( "could not parse response_text::" + response_text +
 997+ mw.log( "could not parse response_text::" + response_text +
998998 ' ...for now try with eval...' );
999999 try {
10001000 var apiResult = eval( response_text );
@@ -1026,7 +1026,7 @@
10271027
10281028 // Upload done?
10291029 if ( -1 == $j.inArray( _this.fogg.state, [ 'upload done', 'done', 'encoding done' ] ) ) {
1030 - js_log( 'Error:firefogg upload error: ' + _this.fogg.state );
 1030+ mw.log( 'Error:firefogg upload error: ' + _this.fogg.state );
10311031 return;
10321032 }
10331033 if ( apiResult && apiResult.resultUrl ) {
@@ -1050,7 +1050,7 @@
10511051 }
10521052 } else {
10531053 // Done state with error? Not really possible given how firefogg works...
1054 - js_log( " Upload done in chunks mode, but no resultUrl!" );
 1054+ mw.log( " Upload done in chunks mode, but no resultUrl!" );
10551055 }
10561056
10571057 }
@@ -1064,7 +1064,7 @@
10651065 if ( !this.have_firefogg ) {
10661066 return this.pe_cancel_action();
10671067 }
1068 - js_log( 'firefogg:cancel' )
 1068+ mw.log( 'firefogg:cancel' )
10691069 if ( confirm( gM( 'mwe-cancel-confim' ) ) ) {
10701070 // FIXME: sillyness ( upstream firefogg cancel fix needed )
10711071 if ( navigator.oscpu && navigator.oscpu.search( 'Win' ) >= 0 ) {

Status & tagging log