Index: branches/js2-work/phase3/js2/remoteMwEmbed.js |
— | — | @@ -5,8 +5,8 @@ |
6 | 6 | |
7 | 7 | var urlparts = getRemoteEmbedPath(); |
8 | 8 | var mwEmbedHostPath = urlparts[0]; |
9 | | -var mwRemoteVersion = '1.10'; |
10 | | -var mwUseScriptLoader = false; |
| 9 | +var mwRemoteVersion = '1.1b'; |
| 10 | +var mwUseScriptLoader = true; |
11 | 11 | |
12 | 12 | // setup up request Params: |
13 | 13 | var reqParts = urlparts[1].substring( 1 ).split( '&' ); |
— | — | @@ -16,7 +16,8 @@ |
17 | 17 | if ( p.length == 2 ) |
18 | 18 | mwReqParam[ p[0] ] = p[1]; |
19 | 19 | } |
20 | | -//use wikibits onLoad hook: |
| 20 | + |
| 21 | +// Use wikibits onLoad hook: ( since we don't have js2 / mw object loaded ) |
21 | 22 | addOnloadHook( function() { |
22 | 23 | // Only do rewrites if mwEmbed / js2 is "off" |
23 | 24 | if ( typeof mwEmbed_VERSION == 'undefined' ) { |
— | — | @@ -31,14 +32,13 @@ |
32 | 33 | if ( wgAction == 'edit' || wgAction == 'submit' ) { |
33 | 34 | var jsSetEdit = |
34 | 35 | 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 | + } ); |
43 | 43 | } |
44 | 44 | |
45 | 45 | // Timed text display: |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Firefogg integration |
56 | | - if ( wgPageName == "Special:Upload" ) { |
| 56 | + if ( wgPageName == "Special:Upload" ) { |
57 | 57 | loadMwEmbed([ |
58 | 58 | 'mvBaseUploadInterface', |
59 | 59 | 'mvFirefogg', |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | vidIdList.push( divs[i].getAttribute( "id" ) ); |
84 | 84 | } |
85 | 85 | } |
86 | | - if ( vidIdList.length > 0 ) { |
| 86 | + if ( vidIdList.length > 0 ) { |
87 | 87 | var jsSetVideo = [ 'embedPlayer', '$j.ui', 'ctrlBuilder', '$j.cookie', '$j.ui.slider', 'kskinConfig' ]; |
88 | 88 | // Quick sniff use java if IE and native if firefox |
89 | 89 | // ( other browsers will run detect and get on-demand ) |
— | — | @@ -102,13 +102,12 @@ |
103 | 103 | } |
104 | 104 | // This will be depreciated in favour of updates to OggHandler |
105 | 105 | function rewrite_for_OggHandler( vidIdList ) { |
106 | | - function procVidId( vidId ) { |
107 | | - |
| 106 | + function procVidId( vidId ) { |
108 | 107 | // Don't process empty vids |
109 | 108 | if ( !vidId ) |
110 | 109 | return ; |
111 | 110 | |
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 ); |
113 | 112 | |
114 | 113 | tag_type = 'video'; |
115 | 114 | |
— | — | @@ -178,7 +177,7 @@ |
179 | 178 | |
180 | 179 | } |
181 | 180 | }; |
182 | | - // process each item in the vidIdList (with setTimeout to avoid locking) |
| 181 | + // process each item in the vidIdList (with setTimeout to avoid locking) |
183 | 182 | procVidId( vidIdList.pop() ); |
184 | 183 | } |
185 | 184 | function getRemoteEmbedPath() { |
— | — | @@ -229,7 +228,7 @@ |
230 | 229 | |
231 | 230 | // Inject mwEmbed if needed |
232 | 231 | if ( typeof mw == 'undefined' ) { |
233 | | - if ( ( mwReqParam['uselang'] || mwReqParam['useloader'] ) && mwUseScriptLoader ) { |
| 232 | + if ( ( mwReqParam['uselang'] || mwReqParam[ 'useloader' ] ) && mwUseScriptLoader ) { |
234 | 233 | var rurl = mwEmbedHostPath + '/mwEmbed/jsScriptLoader.php?class=mwEmbed'; |
235 | 234 | |
236 | 235 | // Add jQuery too if we need it: |
— | — | @@ -246,8 +245,7 @@ |
247 | 246 | } |
248 | 247 | |
249 | 248 | // Add the remaining arguments |
250 | | - rurl += '&' + mwGetReqArgs(); |
251 | | - |
| 249 | + rurl += '&' + mwGetReqArgs(); |
252 | 250 | importScriptURI( rurl ); |
253 | 251 | } else { |
254 | 252 | // Ingore classSet (will be loaded onDemand ) |
— | — | @@ -266,7 +264,7 @@ |
267 | 265 | }, 25 ); |
268 | 266 | } else { |
269 | 267 | // Make sure mwEmbed is "setup" by using the addOnLoadHook: |
270 | | - mw.addOnloadHook( function(){ |
| 268 | + mw.addOnloadHook( function(){ |
271 | 269 | callback(); |
272 | 270 | }) |
273 | 271 | } |
— | — | @@ -290,4 +288,3 @@ |
291 | 289 | this.cur_path = cur_path; |
292 | 290 | return true; |
293 | 291 | }; |
294 | | - |
Index: branches/js2-work/phase3/js2/uploadPage.js |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | * Fill in a destination file-name based on a source asset name. |
93 | 93 | */ |
94 | 94 | doDestinationFill: function( targetElm ) { |
95 | | - js_log( "doDestinationFill" ) |
| 95 | + mw.log( "doDestinationFill" ) |
96 | 96 | // Remove any previously flagged errors |
97 | 97 | $j( '#mw-upload-permitted,#mw-upload-prohibited' ).hide(); |
98 | 98 | |
Index: branches/js2-work/phase3/js2/editPage.js |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | }; |
23 | 23 | |
24 | 24 | mw.addOnloadHook( function() { |
25 | | - js_log( "edit page mw.addOnloadHook::" ); |
| 25 | + mw.log( "edit page mw.addOnloadHook::" ); |
26 | 26 | var amwConf = $j.extend( true, defaultAddMediaConfig, mwAddMediaConfig ); |
27 | 27 | // Kind of tricky, it would be nice to use run on ready "loader" call here |
28 | 28 | var didWikiEditorBind = false; |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | section.groups.insert.tools.file.action = { |
41 | 41 | 'type': 'callback', |
42 | 42 | 'execute': function() { |
43 | | - js_log( 'click add media wiz' ); |
| 43 | + mw.log( 'click add media wiz' ); |
44 | 44 | $j.addMediaWiz( amwConf ); |
45 | 45 | } |
46 | 46 | }; |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | // Add to old toolbar if wikiEditor did not remove '#toolbar' from the page: |
52 | 52 | setTimeout( function() { |
53 | 53 | 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:' ); |
55 | 55 | didWikiEditorBind = true; |
56 | 56 | $j( '#toolbar' ).append( '<img style="cursor:pointer" id="btn-add-media-wiz" src="' + |
57 | 57 | mw.getConfig( 'skin_img_path' ) + 'Button_add_media.png">' ); |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | } else { |
64 | 64 | // Make sure the wikieditor got binded: |
65 | 65 | 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:' ); |
67 | 67 | $j( ".tool[rel='file']" ).unbind().addMediaWiz( amwConf ); |
68 | 68 | } |
69 | 69 | } |
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/nativeEmbed.js |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | */ |
43 | 43 | getEmbedHTML : function () { |
44 | 44 | var embed_code = this.getEmbedObj(); |
45 | | - js_log( "embed code: " + embed_code ) |
| 45 | + mw.log( "embed code: " + embed_code ) |
46 | 46 | setTimeout( '$j(\'#' + this.id + '\').get(0).postEmbedJS()', 150 ); |
47 | 47 | return this.wrapEmebedContainer( embed_code ); |
48 | 48 | }, |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | // We want to let mwEmbed handle the controls so notice the absence of control attribute |
55 | 55 | // controls=false results in controls being displayed: |
56 | 56 | // 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 ); |
58 | 58 | var eb = '<video ' + |
59 | 59 | 'id="' + this.pid + '" ' + |
60 | 60 | 'style="width:' + this.width + 'px;height:' + this.height + 'px;" ' + |
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | */ |
70 | 70 | postEmbedJS:function() { |
71 | 71 | var _this = this; |
72 | | - js_log( "f:native:postEmbedJS:" ); |
| 72 | + mw.log( "f:native:postEmbedJS:" ); |
73 | 73 | this.getPlayerElement(); |
74 | 74 | if ( typeof this.playerElement != 'undefined' ) { |
75 | 75 | |
— | — | @@ -98,10 +98,10 @@ |
99 | 99 | |
100 | 100 | } else { |
101 | 101 | // 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 ); |
103 | 103 | this.grab_try_count++; |
104 | 104 | 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() ?' ) ; |
106 | 106 | } else { |
107 | 107 | setTimeout( function(){ |
108 | 108 | _this.postEmbedJS(); |
— | — | @@ -117,12 +117,12 @@ |
118 | 118 | * @param {Float} percentage |
119 | 119 | */ |
120 | 120 | 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 ); |
122 | 122 | // @@todo check if the clip is loaded here (if so we can do a local seek) |
123 | 123 | if ( this.supportsURLTimeEncoding() ) { |
124 | 124 | // Make sure we could not do a local seek instead: |
125 | 125 | 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 ); |
127 | 127 | this.doNativeSeek( percentage ); |
128 | 128 | } else { |
129 | 129 | // We support URLTimeEncoding call parent seek: |
— | — | @@ -141,7 +141,7 @@ |
142 | 142 | * Do a native seek by updating the currentTime |
143 | 143 | */ |
144 | 144 | doNativeSeek:function( percentage ) { |
145 | | - js_log( 'native::doNativeSeek::' + percentage ); |
| 145 | + mw.log( 'native::doNativeSeek::' + percentage ); |
146 | 146 | this.seek_time_sec = 0; |
147 | 147 | this.playerElement.currentTime = percentage * this.duration; |
148 | 148 | this.monitor(); |
— | — | @@ -155,7 +155,7 @@ |
156 | 156 | * @param {Float} percentage Percentage of the stream to seek to between 0 and 1 |
157 | 157 | */ |
158 | 158 | doPlayThenSeek:function( percentage ) { |
159 | | - js_log( 'native::doPlayThenSeek::' ); |
| 159 | + mw.log( 'native::doPlayThenSeek::' ); |
160 | 160 | var _this = this; |
161 | 161 | this.play(); |
162 | 162 | var rfsCount = 0; |
— | — | @@ -171,7 +171,7 @@ |
172 | 172 | setTimeout( readyForSeek, 50 ); |
173 | 173 | rfsCount++; |
174 | 174 | } else { |
175 | | - js_log( 'error:doPlayThenSeek failed' ); |
| 175 | + mw.log( 'error:doPlayThenSeek failed' ); |
176 | 176 | } |
177 | 177 | } |
178 | 178 | } |
— | — | @@ -183,7 +183,7 @@ |
184 | 184 | */ |
185 | 185 | setCurrentTime: function( position , callback ) { |
186 | 186 | var _this = this; |
187 | | - js_log( 'native:setCurrentTime::: ' + position + ' : dur: ' + _this.getDuration() ); |
| 187 | + mw.log( 'native:setCurrentTime::: ' + position + ' : dur: ' + _this.getDuration() ); |
188 | 188 | this.getPlayerElement(); |
189 | 189 | if ( !this.playerElement ) { |
190 | 190 | this.load( function() { |
— | — | @@ -203,7 +203,7 @@ |
204 | 204 | var _this = this; |
205 | 205 | this.getPlayerElement(); |
206 | 206 | var once = function( event ) { |
207 | | - js_log("did seek callback"); |
| 207 | + mw.log("did seek callback"); |
208 | 208 | callback(); |
209 | 209 | _this.playerElement.removeEventListener( 'seeked', once, false ); |
210 | 210 | }; |
— | — | @@ -218,7 +218,7 @@ |
219 | 219 | monitor: function() { |
220 | 220 | this.getPlayerElement(); // make sure we have .vid obj |
221 | 221 | 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' ); |
223 | 223 | this.stopMonitor(); |
224 | 224 | return false; |
225 | 225 | } |
— | — | @@ -239,8 +239,7 @@ |
240 | 240 | // update currentTime |
241 | 241 | this.currentTime = this.playerElement.currentTime; |
242 | 242 | |
243 | | - // js_log('currentTime:' + this.currentTime); |
244 | | - // js_log('this.currentTime: ' + this.currentTime ); |
| 243 | + //mw.log('currentTime:' + this.currentTime); |
245 | 244 | // once currentTime is updated call parent_monitor |
246 | 245 | this.parent_monitor(); |
247 | 246 | }, |
— | — | @@ -334,7 +333,7 @@ |
335 | 334 | this.getPlayerElement(); |
336 | 335 | if ( !this.playerElement ) { |
337 | 336 | // No vid loaded |
338 | | - js_log( 'native::load() ... doEmbed' ); |
| 337 | + mw.log( 'native::load() ... doEmbed' ); |
339 | 338 | this.onlyLoadFlag = true; |
340 | 339 | this.doEmbedHTML(); |
341 | 340 | this.onLoadedCallback = callback; |
— | — | @@ -362,7 +361,7 @@ |
363 | 362 | * fired when "seeking" |
364 | 363 | */ |
365 | 364 | onseeking:function() { |
366 | | - js_log( "onseeking" ); |
| 365 | + mw.log( "onseeking" ); |
367 | 366 | this.seeking = true; |
368 | 367 | this.setStatus( gM( 'mwe-seeking' ) ); |
369 | 368 | }, |
— | — | @@ -372,7 +371,7 @@ |
373 | 372 | * fired when done seeking |
374 | 373 | */ |
375 | 374 | onseeked: function() { |
376 | | - js_log("onseeked"); |
| 375 | + mw.log("onseeked"); |
377 | 376 | this.seeking = false; |
378 | 377 | }, |
379 | 378 | |
— | — | @@ -381,7 +380,7 @@ |
382 | 381 | * fired when done video can play through without re-buffering |
383 | 382 | */ |
384 | 383 | oncanplaythrough : function() { |
385 | | - js_log('f:oncanplaythrough'); |
| 384 | + mw.log('f:oncanplaythrough'); |
386 | 385 | this.getPlayerElement(); |
387 | 386 | if ( ! this.paused ) |
388 | 387 | this.playerElement.play(); |
— | — | @@ -396,10 +395,10 @@ |
397 | 396 | */ |
398 | 397 | onloadedmetadata: function() { |
399 | 398 | this.getPlayerElement(); |
400 | | - js_log( 'f:onloadedmetadata metadata ready (update duration)' ); |
| 399 | + mw.log( 'f:onloadedmetadata metadata ready (update duration)' ); |
401 | 400 | // update duration if not set (for now trust the getDuration more than this.playerElement.duration |
402 | 401 | 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 ) |
404 | 403 | this.duration = this.playerElement.duration; |
405 | 404 | } |
406 | 405 | |
— | — | @@ -428,10 +427,10 @@ |
429 | 428 | onended: function() { |
430 | 429 | var _this = this |
431 | 430 | 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() ); |
433 | 432 | // 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) |
434 | 433 | 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...' ); |
436 | 435 | var doRetry = function() { |
437 | 436 | _this.urlAppend = 'retry_src=' + _this.grab_try_count; |
438 | 437 | _this.doEmbedHTML(); |
— | — | @@ -439,7 +438,7 @@ |
440 | 439 | } |
441 | 440 | setTimeout( doRetry, 100 ); |
442 | 441 | } else { |
443 | | - js_log( 'native onClipDone done call' ); |
| 442 | + mw.log( 'native onClipDone done call' ); |
444 | 443 | this.onClipDone(); |
445 | 444 | } |
446 | 445 | } |
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/kplayerEmbed.js |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | setTimeout(function(){ |
29 | 29 | _this.postEmbedJS(); |
30 | 30 | }, 50); |
31 | | - js_log( "return embed html" ); |
| 31 | + mw.log( "return embed html" ); |
32 | 32 | return this.wrapEmebedContainer( embed_code ); |
33 | 33 | }, |
34 | 34 | |
— | — | @@ -76,7 +76,7 @@ |
77 | 77 | |
78 | 78 | // KDP player likes an absolute url for the src: |
79 | 79 | var src = mw.absoluteUrl( _this.getSrc() ); |
80 | | - js_log('play src: ' + src); |
| 80 | + mw.log('play src: ' + src); |
81 | 81 | |
82 | 82 | // Insert the src: |
83 | 83 | this.playerElement.insertMedia( "-1", src, 'true' ); |
— | — | @@ -85,7 +85,7 @@ |
86 | 86 | // Start the monitor |
87 | 87 | this.monitor(); |
88 | 88 | }else{ |
89 | | - js_log('insert media: not defiend' + typeof this.playerElement.insertMedia ); |
| 89 | + mw.log('insert media: not defiend' + typeof this.playerElement.insertMedia ); |
90 | 90 | setTimeout( function(){ |
91 | 91 | _this.postEmbedJS(); |
92 | 92 | }, 25); |
— | — | @@ -180,5 +180,5 @@ |
181 | 181 | * NOTE: playerID is not always passed so we can't use this: |
182 | 182 | */ |
183 | 183 | function onKdpReady( playerId ) { |
184 | | - js_log( "player is ready::" + playerId); |
| 184 | + mw.log( "player is ready::" + playerId); |
185 | 185 | } |
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/omtkEmbed.js |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | getEmbedObj:function() { |
36 | 36 | var player_path = mw.getMwEmbedPath() + 'libEmbedPlayer/binPlayers/omtk-fx/omtkp.swf'; |
37 | 37 | // player_path = 'omtkp.swf'; |
38 | | - js_log( "player path: " + player_path ); |
| 38 | + mw.log( "player path: " + player_path ); |
39 | 39 | return '<object id="' + this.pid + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1" height="1">' + |
40 | 40 | '<param name="movie" value="' + player_path + '" />' + "\n" + |
41 | 41 | '<!--[if !IE]>-->' + "\n" + |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | postEmbedJS:function() { |
55 | 55 | this.getPlayerElement(); |
56 | 56 | // play the url: |
57 | | - js_log( "play: pid:" + this.pid + ' src:' + this.src ); |
| 57 | + mw.log( "play: pid:" + this.pid + ' src:' + this.src ); |
58 | 58 | |
59 | 59 | this.playerElement.play( this.src ); |
60 | 60 | |
— | — | @@ -88,15 +88,15 @@ |
89 | 89 | this.playerElement = $j( '#' + this.pid + '_ie' ).get( 0 ); |
90 | 90 | |
91 | 91 | 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)'); |
93 | 93 | } |
94 | 94 | }, |
95 | 95 | } |
96 | 96 | // Some auto-called globals (bad) |
97 | 97 | function OMTK_P_complete() { |
98 | | - js_log( 'OMTK_P_complete' ); |
| 98 | + mw.log( 'OMTK_P_complete' ); |
99 | 99 | } |
100 | 100 | |
101 | 101 | function OMTK_P_metadataUpdate() { |
102 | | - js_log( 'OMTK_P_metadataUpdate' ); |
| 102 | + mw.log( 'OMTK_P_metadataUpdate' ); |
103 | 103 | } |
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/embedPlayer.js |
— | — | @@ -217,6 +217,17 @@ |
218 | 218 | */ |
219 | 219 | ( function( $ ) { |
220 | 220 | |
| 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 | + |
221 | 232 | /** |
222 | 233 | * Selector based embedPlayer jQuery binding |
223 | 234 | * |
— | — | @@ -332,7 +343,7 @@ |
333 | 344 | } |
334 | 345 | var element_id = $j( element ).attr( "id" ); |
335 | 346 | |
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() ); |
337 | 348 | |
338 | 349 | // Add the element id to playerList |
339 | 350 | this.playerList.push( $j( element ).attr( "id" ) ); |
— | — | @@ -448,7 +459,7 @@ |
449 | 460 | */ |
450 | 461 | waitPlayersReadyCallback : function() { |
451 | 462 | var _this = this; |
452 | | - // js_log('checkClipsReady'); |
| 463 | + // mw.log('checkClipsReady'); |
453 | 464 | var is_ready = true; |
454 | 465 | for ( var i = 0; i < this.playerList.length; i++ ) { |
455 | 466 | if ( $j( '#' + this.playerList[i] ).length != 0 ) { |
— | — | @@ -504,7 +515,7 @@ |
505 | 516 | URLTimeEncoding:false, |
506 | 517 | |
507 | 518 | // Start offset of the requested segment |
508 | | - startOffset:null, |
| 519 | + startOffset: 0, |
509 | 520 | |
510 | 521 | // Duration of the requested segment (0 if not known) |
511 | 522 | duration:0, |
— | — | @@ -525,7 +536,7 @@ |
526 | 537 | * MediaSource constructor: |
527 | 538 | */ |
528 | 539 | init : function( element ) { |
529 | | - // js_log('adding mediaSource: ' + element); |
| 540 | + // mw.log('adding mediaSource: ' + element); |
530 | 541 | this.src = $j( element ).attr( 'src' ); |
531 | 542 | this.marked_default = false; |
532 | 543 | if ( element.tagName.toLowerCase() == 'video' ) |
— | — | @@ -572,8 +583,8 @@ |
573 | 584 | * @param {String} end_time: in NPT format |
574 | 585 | */ |
575 | 586 | 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); |
578 | 589 | // if we have time we can use: |
579 | 590 | if ( this.URLTimeEncoding ) { |
580 | 591 | // make sure its a valid start time / end time (else set default) |
— | — | @@ -768,7 +779,7 @@ |
769 | 780 | */ |
770 | 781 | init: function( video_element ) { |
771 | 782 | var _this = this; |
772 | | - js_log( 'Initializing mediaElement...' ); |
| 783 | + mw.log( 'Initializing mediaElement...' ); |
773 | 784 | this.sources = new Array(); |
774 | 785 | |
775 | 786 | if ( $j( video_element ).attr( 'thumbnail' ) ) |
— | — | @@ -864,7 +875,7 @@ |
865 | 876 | * @param {Number} index Index of source element to set as selected_source |
866 | 877 | */ |
867 | 878 | selectSource:function( index ) { |
868 | | - js_log( 'f:selectSource:' + index ); |
| 879 | + mw.log( 'f:selectSource:' + index ); |
869 | 880 | var playable_sources = this.getPlayableSources(); |
870 | 881 | for ( var i = 0; i < playable_sources.length; i++ ) { |
871 | 882 | if ( i == index ) { |
— | — | @@ -880,7 +891,7 @@ |
881 | 892 | * Selects the default source via cookie preference, default marked, or by id order |
882 | 893 | */ |
883 | 894 | autoSelectSource:function() { |
884 | | - js_log( 'f:autoSelectSource:' ); |
| 895 | + mw.log( 'f:autoSelectSource:' ); |
885 | 896 | // Select the default source |
886 | 897 | var playable_sources = this.getPlayableSources(); |
887 | 898 | var flash_flag = ogg_flag = false; |
— | — | @@ -888,13 +899,13 @@ |
889 | 900 | for ( var source = 0; source < playable_sources.length; source++ ) { |
890 | 901 | var mime_type = playable_sources[source].mime_type; |
891 | 902 | 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 ); |
893 | 904 | this.selected_source = playable_sources[source]; |
894 | 905 | return true; |
895 | 906 | } |
896 | 907 | // Set via user-preference |
897 | 908 | 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 ); |
899 | 910 | this.selected_source = playable_sources[source]; |
900 | 911 | return true; |
901 | 912 | } |
— | — | @@ -902,14 +913,14 @@ |
903 | 914 | |
904 | 915 | // Set Ogg if client supports it |
905 | 916 | 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 ); |
907 | 918 | var mime_type = playable_sources[source].mime_type; |
908 | 919 | // set source via player |
909 | 920 | if ( mime_type == 'video/ogg' || mime_type == 'ogg/video' || mime_type == 'video/annodex' || mime_type == 'application/ogg' ) { |
910 | 921 | for ( var i = 0; i < embedTypes.players.players.length; i++ ) { // for in loop on object oky |
911 | 922 | var player = embedTypes.players.players[i]; |
912 | 923 | if ( player.library == 'vlc' || player.library == 'native' ) { |
913 | | - js_log( 'set via ogg via order' ); |
| 924 | + mw.log( 'set via ogg via order' ); |
914 | 925 | this.selected_source = playable_sources[source]; |
915 | 926 | return true; |
916 | 927 | } |
— | — | @@ -921,7 +932,7 @@ |
922 | 933 | for ( var source = 0; source < playable_sources.length; source++ ) { |
923 | 934 | var mime_type = playable_sources[source].mime_type; |
924 | 935 | 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' ) |
926 | 937 | this.selected_source = playable_sources[source]; |
927 | 938 | return true; |
928 | 939 | } |
— | — | @@ -930,14 +941,14 @@ |
931 | 942 | for ( var source = 0; source < playable_sources.length; source++ ) { |
932 | 943 | var mime_type = playable_sources[source].mime_type; |
933 | 944 | 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' ) |
935 | 946 | this.selected_source = playable_sources[source]; |
936 | 947 | return true; |
937 | 948 | } |
938 | 949 | } |
939 | 950 | // Select first source |
940 | 951 | if ( !this.selected_source ){ |
941 | | - js_log( 'set via first source:' + playable_sources[0] ); |
| 952 | + mw.log( 'set via first source:' + playable_sources[0] ); |
942 | 953 | this.selected_source = playable_sources[0]; |
943 | 954 | return true; |
944 | 955 | } |
— | — | @@ -985,13 +996,13 @@ |
986 | 997 | * @param {Element} element <video>, <source> or <mediaSource> <text> element. |
987 | 998 | */ |
988 | 999 | tryAddSource: function( element ) { |
989 | | - js_log( 'f:tryAddSource:' + $j( element ).attr( "src" ) ); |
| 1000 | + mw.log( 'f:tryAddSource:' + $j( element ).attr( "src" ) ); |
990 | 1001 | if ( $j( element ).attr( "src" ) ) { |
991 | 1002 | var new_src = $j( element ).attr( 'src' ); |
992 | 1003 | // make sure an existing element with the same src does not already exist: |
993 | 1004 | for ( var i = 0; i < this.sources.length; i++ ) { |
994 | 1005 | 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); |
996 | 1007 | // can't add it all but try to update any additional attr: |
997 | 1008 | this.sources[i].updateSource( element ); |
998 | 1009 | } |
— | — | @@ -1003,9 +1014,9 @@ |
1004 | 1015 | source.duration = this.duration; |
1005 | 1016 | |
1006 | 1017 | if ( !source.startOffset && this.startOffset ) |
1007 | | - source.startOffset = this.startOffset; |
| 1018 | + source.startOffset = praserFloat( this.startOffset ); |
1008 | 1019 | |
1009 | | - js_log( 'pushed source to stack' + source + 'sl:' + this.sources.length ); |
| 1020 | + mw.log( 'pushed source to stack' + source + 'sl:' + this.sources.length ); |
1010 | 1021 | this.sources.push( source ); |
1011 | 1022 | }, |
1012 | 1023 | |
— | — | @@ -1020,7 +1031,7 @@ |
1021 | 1032 | if ( this.isPlayableType( this.sources[i].mime_type ) ) { |
1022 | 1033 | playable_sources.push( this.sources[i] ); |
1023 | 1034 | } 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' ); |
1025 | 1036 | } |
1026 | 1037 | }; |
1027 | 1038 | return playable_sources; |
— | — | @@ -1031,13 +1042,13 @@ |
1032 | 1043 | * @param roe_data ROE data. |
1033 | 1044 | */ |
1034 | 1045 | addROE: function( roe_data ) { |
1035 | | - js_log( 'f:addROE' ); |
| 1046 | + mw.log( 'f:addROE' ); |
1036 | 1047 | this.addedROEData = true; |
1037 | 1048 | var _this = this; |
1038 | 1049 | if ( typeof roe_data == 'string' ) |
1039 | 1050 | { |
1040 | 1051 | var parser = new DOMParser(); |
1041 | | - js_log( 'ROE data:' + roe_data ); |
| 1052 | + mw.log( 'ROE data:' + roe_data ); |
1042 | 1053 | roe_data = parser.parseFromString( roe_data, "text/xml" ); |
1043 | 1054 | } |
1044 | 1055 | if ( roe_data ) { |
— | — | @@ -1047,19 +1058,19 @@ |
1048 | 1059 | // set the thumbnail: |
1049 | 1060 | $j.each( roe_data.getElementsByTagName( 'img' ), function( inx, n ) { |
1050 | 1061 | 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" ) ); |
1052 | 1063 | _this['thumbnail'] = $j( n ).attr( "src" ); |
1053 | 1064 | } |
1054 | 1065 | } ); |
1055 | 1066 | // set the linkback: |
1056 | 1067 | $j.each( roe_data.getElementsByTagName( 'link' ), function( inx, n ) { |
1057 | 1068 | 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" ) ); |
1059 | 1070 | _this['linkback'] = $j( n ).attr( 'href' ); |
1060 | 1071 | } |
1061 | 1072 | } ); |
1062 | 1073 | } else { |
1063 | | - js_log( 'ROE data empty.' ); |
| 1074 | + mw.log( 'ROE data empty.' ); |
1064 | 1075 | } |
1065 | 1076 | } |
1066 | 1077 | }; |
— | — | @@ -1158,9 +1169,9 @@ |
1159 | 1170 | this.skin_name = mw.getConfig( 'skin_name' ); |
1160 | 1171 | |
1161 | 1172 | |
1162 | | - // Make sure startOffset is cast as an int |
| 1173 | + // Make sure startOffset is cast as an float: |
1163 | 1174 | if ( this.startOffset && this.startOffset.split( ':' ).length >= 2 ) |
1164 | | - this.startOffset = mw.npt2seconds( this.startOffset ); |
| 1175 | + this.startOffset = parseFloat( mw.npt2seconds( this.startOffset ) ); |
1165 | 1176 | |
1166 | 1177 | // Make sure offset is in float: |
1167 | 1178 | this.startOffset = parseFloat( this.startOffset ); |
— | — | @@ -1170,7 +1181,7 @@ |
1171 | 1182 | |
1172 | 1183 | // Make sure duration is in float: |
1173 | 1184 | this.duration = parseFloat( this.duration ); |
1174 | | - js_log( "duration is: " + this.duration ); |
| 1185 | + mw.log( "duration is: " + this.duration ); |
1175 | 1186 | |
1176 | 1187 | |
1177 | 1188 | this.setDimSize( element, 'width' ); |
— | — | @@ -1182,7 +1193,7 @@ |
1183 | 1194 | // Grab any innerHTML and set it to missing_plugin_html |
1184 | 1195 | // @@todo we should strip source tags instead of checking and skipping |
1185 | 1196 | if ( element.innerHTML != '' && element.getElementsByTagName( 'source' ).length == 0 ) { |
1186 | | - js_log( 'innerHTML: ' + element.innerHTML ); |
| 1197 | + mw.log( 'innerHTML: ' + element.innerHTML ); |
1187 | 1198 | this.user_missing_plugin_html = element.innerHTML; |
1188 | 1199 | } |
1189 | 1200 | |
— | — | @@ -1248,19 +1259,19 @@ |
1249 | 1260 | * form an external file that request is issued here |
1250 | 1261 | */ |
1251 | 1262 | checkPlayerSources: function() { |
1252 | | - js_log( 'f:checkPlayerSources' ); |
| 1263 | + mw.log( 'f:checkPlayerSources' ); |
1253 | 1264 | var _this = this; |
1254 | 1265 | // Process the provided ROE file. If we don't yet have sources |
1255 | 1266 | // ( the ROE file provides xml list of sources ) |
1256 | 1267 | if ( this.roe && this.media_element.sources.length == 0 ) { |
1257 | | - js_log( 'checkPlayerSources: loading external data' ); |
| 1268 | + mw.log( 'checkPlayerSources: loading external data' ); |
1258 | 1269 | this.loading_external_data = true; |
1259 | 1270 | do_request( this.roe, function( data ){ |
1260 | 1271 | // Continue |
1261 | 1272 | _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 ); |
1263 | 1274 | |
1264 | | - js_log( 'set loading_external_data=false' ); |
| 1275 | + mw.log( 'set loading_external_data=false' ); |
1265 | 1276 | _this.loading_external_data = false; |
1266 | 1277 | |
1267 | 1278 | _this.sourcesReadyInit(); |
— | — | @@ -1278,7 +1289,7 @@ |
1279 | 1290 | * Sets load error if no source is playable |
1280 | 1291 | */ |
1281 | 1292 | sourcesReadyInit: function(){ |
1282 | | - js_log( 'f:sourcesReadyInit' ); |
| 1293 | + mw.log( 'f:sourcesReadyInit' ); |
1283 | 1294 | |
1284 | 1295 | // Autoseletct the source |
1285 | 1296 | this.media_element.autoSelectSource(); |
— | — | @@ -1287,19 +1298,19 @@ |
1288 | 1299 | if ( !this.media_element.selected_source ){ |
1289 | 1300 | // check for parent clip: |
1290 | 1301 | 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' ); |
1292 | 1303 | // debugger; |
1293 | 1304 | // do load player if just displaying innerHTML: |
1294 | 1305 | if ( this.pc.type == 'text/html' ) { |
1295 | 1306 | 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 ); |
1297 | 1308 | } |
1298 | 1309 | } |
1299 | 1310 | } else { |
1300 | 1311 | this.selected_player = embedTypes.players.defaultPlayer( this.media_element.selected_source.mime_type ); |
1301 | 1312 | } |
1302 | 1313 | if ( this.selected_player ) { |
1303 | | - js_log( "Playback system: " + this.selected_player.library ); |
| 1314 | + mw.log( "Playback system: " + this.selected_player.library ); |
1304 | 1315 | |
1305 | 1316 | // Inherit the playback system of the selected player: |
1306 | 1317 | this.inheritEmbedPlayer(); |
— | — | @@ -1315,7 +1326,7 @@ |
1316 | 1327 | if ( this.pc ) |
1317 | 1328 | var missing_type = this.pc.type; |
1318 | 1329 | |
1319 | | - js_log( 'No player found for given source type ' + missing_type ); |
| 1330 | + mw.log( 'No player found for given source type ' + missing_type ); |
1320 | 1331 | this.load_error = this.getPluginMissingHTML( missing_type ); |
1321 | 1332 | } |
1322 | 1333 | }, |
— | — | @@ -1326,7 +1337,7 @@ |
1327 | 1338 | * @param {Function} callback Function to be called once playback-system has been inherited |
1328 | 1339 | */ |
1329 | 1340 | inheritEmbedPlayer: function( callback ) { |
1330 | | - js_log( "inheritEmbedPlayer:duration is: " + this.getDuration() ); |
| 1341 | + mw.log( "inheritEmbedPlayer:duration is: " + this.getDuration() ); |
1331 | 1342 | |
1332 | 1343 | // Clear out any non-base embedObj methods: |
1333 | 1344 | if ( this.instanceOf ) { |
— | — | @@ -1341,7 +1352,7 @@ |
1342 | 1353 | } |
1343 | 1354 | |
1344 | 1355 | // 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 ); |
1346 | 1357 | var _this = this; |
1347 | 1358 | |
1348 | 1359 | // Load the selected player |
— | — | @@ -1405,8 +1416,8 @@ |
1406 | 1417 | getDuration:function() { |
1407 | 1418 | // Update some local pointers for the selected source: |
1408 | 1419 | 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 ); |
1411 | 1422 | this.start_npt = this.media_element.selected_source.start_npt; |
1412 | 1423 | this.end_npt = this.media_element.selected_source.end_npt; |
1413 | 1424 | } |
— | — | @@ -1451,7 +1462,7 @@ |
1452 | 1463 | if ( this.supportsURLTimeEncoding() ) { |
1453 | 1464 | // Make sure this.seek_time_sec is up-to-date: |
1454 | 1465 | 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 ) ); |
1456 | 1467 | this.stop(); |
1457 | 1468 | this.didSeekJump = true; |
1458 | 1469 | // Update the slider |
— | — | @@ -1468,7 +1479,7 @@ |
1469 | 1480 | * (should be overwritten by client that supports frame serving) |
1470 | 1481 | */ |
1471 | 1482 | 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)' ); |
1473 | 1484 | }, |
1474 | 1485 | |
1475 | 1486 | /** |
— | — | @@ -1476,8 +1487,8 @@ |
1477 | 1488 | * issues a loading request |
1478 | 1489 | */ |
1479 | 1490 | 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 ); |
1482 | 1493 | var _this = this; |
1483 | 1494 | |
1484 | 1495 | // Set "loading" here: |
— | — | @@ -1488,9 +1499,9 @@ |
1489 | 1500 | ); |
1490 | 1501 | |
1491 | 1502 | // Make sure the player is |
1492 | | - js_log( 'performing embed for ' + _this.id ); |
| 1503 | + mw.log( 'performing embed for ' + _this.id ); |
1493 | 1504 | var embed_code = _this.getEmbedHTML(); |
1494 | | - // js_log('shopuld embed:' + embed_code); |
| 1505 | + // mw.log('shopuld embed:' + embed_code); |
1495 | 1506 | $j( '#mv_embedded_player_' + _this.id ).html( embed_code ); |
1496 | 1507 | }, |
1497 | 1508 | |
— | — | @@ -1499,18 +1510,13 @@ |
1500 | 1511 | */ |
1501 | 1512 | getRelatedFromTitleKey:function() { |
1502 | 1513 | var _this = this; |
1503 | | - var reqObj = { |
1504 | | - 'action' : 'query', |
| 1514 | + var request = { |
1505 | 1515 | //normalize the File NS (ie sometimes its present in wikiTitleKey other times not |
1506 | 1516 | 'titles' : 'File:' + this.wikiTitleKey.replace(/File:|Image:/,''), |
1507 | 1517 | '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 = []; |
1515 | 1521 | if ( data.query && data.query.pages ) { |
1516 | 1522 | for ( var pageid in data.query.pages ) { |
1517 | 1523 | if ( data.query.pages[pageid].title ) |
— | — | @@ -1529,23 +1535,19 @@ |
1530 | 1536 | * @parma {Object} catlist List of categories |
1531 | 1537 | */ |
1532 | 1538 | getRelatedFromCat:function( catlist ) { |
1533 | | - js_log( 'getRelatedFromCat' ); |
| 1539 | + mw.log( 'getRelatedFromCat' ); |
1534 | 1540 | var _this = this; |
1535 | 1541 | for ( var i = 0 ; i <= catlist.length ; i++ ) { |
1536 | 1542 | if ( !catlist[i] ) |
1537 | 1543 | continue; |
1538 | | - var reqObj = { |
1539 | | - 'action' : 'query', |
| 1544 | + var request = { |
1540 | 1545 | 'generator' : 'categorymembers' , |
1541 | 1546 | 'gcmtitle' : catlist[i], |
1542 | 1547 | 'prop' : 'imageinfo', |
1543 | 1548 | 'iiprop' : 'url', |
1544 | 1549 | 'iiurlwidth': '80' |
1545 | 1550 | }; |
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 ) { |
1550 | 1552 | // empty the videos: |
1551 | 1553 | $j( '#dc_' + _this.id + ' .related_vids ul' ).html( ' ' ); |
1552 | 1554 | |
— | — | @@ -1581,7 +1583,7 @@ |
1582 | 1584 | * On clip done action. Called once a clip is done playing |
1583 | 1585 | */ |
1584 | 1586 | onClipDone:function() { |
1585 | | - js_log( 'base:onClipDone' ); |
| 1587 | + mw.log( 'base:onClipDone' ); |
1586 | 1588 | // stop the clip (load the thumbnail etc) |
1587 | 1589 | this.stop(); |
1588 | 1590 | this.seek_time_sec = 0; |
— | — | @@ -1593,6 +1595,8 @@ |
1594 | 1596 | } |
1595 | 1597 | this.thumbnail_disp = true; |
1596 | 1598 | |
| 1599 | + //if k-attribution and k-skin show the "credits" screen: |
| 1600 | + |
1597 | 1601 | // make sure we are not in preview mode( no end clip actions in preview mode) |
1598 | 1602 | if ( this.preview_mode ) |
1599 | 1603 | return ; |
— | — | @@ -1669,7 +1673,7 @@ |
1670 | 1674 | * Mostly metavid specific ( should be factored into a separate module ) |
1671 | 1675 | */ |
1672 | 1676 | getNearbyClipLinks:function() { |
1673 | | - js_log( 'f:getNextPrevLinks' ); |
| 1677 | + mw.log( 'f:getNextPrevLinks' ); |
1674 | 1678 | var anno_track_url = null; |
1675 | 1679 | var _this = this; |
1676 | 1680 | // check for annoative track |
— | — | @@ -1682,13 +1686,13 @@ |
1683 | 1687 | } ); |
1684 | 1688 | |
1685 | 1689 | if ( !anno_track_url ) { |
1686 | | - js_log( 'no annotative track url found' ); |
| 1690 | + mw.log( 'no annotative track url found' ); |
1687 | 1691 | // $j('#liks_info_'+this.id).html('no metadata found for related links'); |
1688 | 1692 | _this.showThumbnail(); |
1689 | 1693 | return ; |
1690 | 1694 | } |
1691 | 1695 | |
1692 | | - js_log( 'we have annotative track:' + anno_track_url ); |
| 1696 | + mw.log( 'we have annotative track:' + anno_track_url ); |
1693 | 1697 | // Zero out seconds (should improve cache hit rate and generally expands metadata search) |
1694 | 1698 | // @@todo this could be replaced with a regExp |
1695 | 1699 | var annoURL = mw.parseUri( anno_track_url ); |
— | — | @@ -1711,14 +1715,14 @@ |
1712 | 1716 | // check the anno_data cache: |
1713 | 1717 | // @@todo search cache see if current is in range. |
1714 | 1718 | if ( this.cmmlData ) { |
1715 | | - js_log( 'anno data found in cache: ' + request_key ); |
| 1719 | + mw.log( 'anno data found in cache: ' + request_key ); |
1716 | 1720 | this.showNextPrevLinks(); |
1717 | 1721 | } else { |
1718 | 1722 | do_request( new_anno_track_url, function( cmml_data ) { |
1719 | | - js_log( 'raw response: ' + cmml_data ); |
| 1723 | + mw.log( 'raw response: ' + cmml_data ); |
1720 | 1724 | if ( typeof cmml_data == 'string' ) { |
1721 | 1725 | var parser = new DOMParser(); |
1722 | | - js_log( 'Parse CMML data:' + cmml_data ); |
| 1726 | + mw.log( 'Parse CMML data:' + cmml_data ); |
1723 | 1727 | cmml_data = parser.parseFromString( cmml_data, "text/xml" ); |
1724 | 1728 | } |
1725 | 1729 | // init cmmlData |
— | — | @@ -1734,7 +1738,7 @@ |
1735 | 1739 | // grab all its meta |
1736 | 1740 | _this.cmmlData[ $j( clip ).attr( "id" ) ]['meta'] = { }; |
1737 | 1741 | $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")); |
1739 | 1743 | _this.cmmlData[$j( clip ).attr( "id" )]['meta'][$j( meta ).attr( "name" )] = $j( meta ).attr( "content" ); |
1740 | 1744 | } ); |
1741 | 1745 | } ); |
— | — | @@ -1749,7 +1753,7 @@ |
1750 | 1754 | * Mostly metavid specific ( should be factored into a separate module ) |
1751 | 1755 | */ |
1752 | 1756 | showNearbyClipLinks:function() { |
1753 | | - // js_log('f:showNextPrevLinks'); |
| 1757 | + // mw.log('f:showNextPrevLinks'); |
1754 | 1758 | // int requested links: |
1755 | 1759 | var link = { |
1756 | 1760 | 'prev':'', |
— | — | @@ -1759,16 +1763,16 @@ |
1760 | 1764 | var curTime = this.getTimeRange().split( '/' ); |
1761 | 1765 | var s_sec = mw.npt2seconds( curTime[0] ); |
1762 | 1766 | 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 ); |
1764 | 1768 | // now we have all the data in cmmlData |
1765 | 1769 | var current_done = false; |
1766 | 1770 | for ( var clip_id in this.cmmlData ) { // for in loop oky for object |
1767 | 1771 | var clip = this.cmmlData[clip_id]; |
1768 | | - // js_log('on clip:'+ clip_id); |
| 1772 | + // mw.log('on clip:'+ clip_id); |
1769 | 1773 | // set prev_link (if cur_link is still empty) |
1770 | 1774 | if ( s_sec > clip.end_time_sec ) { |
1771 | 1775 | 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' ); |
1773 | 1777 | } |
1774 | 1778 | |
1775 | 1779 | if ( e_sec == clip.end_time_sec && s_sec == clip.start_time_sec ) |
— | — | @@ -1776,13 +1780,13 @@ |
1777 | 1781 | // current clip is not done: |
1778 | 1782 | if ( e_sec < clip.end_time_sec && link.current == '' && !current_done ) { |
1779 | 1783 | 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' ); |
1781 | 1785 | } |
1782 | 1786 | |
1783 | 1787 | // set end clip (first clip where start time is > end_time of req |
1784 | 1788 | if ( e_sec < clip.start_time_sec && link.next == '' ) { |
1785 | 1789 | 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 ); |
1787 | 1791 | } |
1788 | 1792 | } |
1789 | 1793 | var html = ''; |
— | — | @@ -1833,7 +1837,7 @@ |
1834 | 1838 | */ |
1835 | 1839 | showThumbnail: function() { |
1836 | 1840 | var _this = this; |
1837 | | - js_log( 'f:showThumbnail' + this.thumbnail_disp ); |
| 1841 | + mw.log( 'f:showThumbnail' + this.thumbnail_disp ); |
1838 | 1842 | this.closeDisplayedHTML(); |
1839 | 1843 | $j( '#mv_embedded_player_' + this.id ).html( this.getThumbnailHTML() ); |
1840 | 1844 | this.paused = true; |
— | — | @@ -1848,7 +1852,7 @@ |
1849 | 1853 | */ |
1850 | 1854 | refreshControls:function() { |
1851 | 1855 | 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' ); |
1853 | 1857 | return ; |
1854 | 1858 | } |
1855 | 1859 | // Do update controls: |
— | — | @@ -1867,7 +1871,7 @@ |
1868 | 1872 | |
1869 | 1873 | /** |
1870 | 1874 | * 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 |
1872 | 1876 | */ |
1873 | 1877 | showPlayer : function () { |
1874 | 1878 | // set-up the local ctrlBuilder instance: |
— | — | @@ -1882,7 +1886,7 @@ |
1883 | 1887 | '</div>'; |
1884 | 1888 | |
1885 | 1889 | if ( this.controls ) { |
1886 | | - js_log( "f:showPlayer:AddControls" ); |
| 1890 | + mw.log( "f:showPlayer:AddControls" ); |
1887 | 1891 | html_code += '<div class="ui-state-default ui-widget-header ui-helper-clearfix control-bar" >'; |
1888 | 1892 | html_code += this.getControls(); |
1889 | 1893 | html_code += '</div>'; |
— | — | @@ -1893,7 +1897,7 @@ |
1894 | 1898 | |
1895 | 1899 | html_code += '</div>'; // videoPlayer div close |
1896 | 1900 | |
1897 | | - // js_log('should set: '+this.id); |
| 1901 | + // mw.log('should set: '+this.id); |
1898 | 1902 | $j( this ).html( html_code ); |
1899 | 1903 | |
1900 | 1904 | // Add hooks once Controls are in DOM |
— | — | @@ -1901,7 +1905,7 @@ |
1902 | 1906 | |
1903 | 1907 | |
1904 | 1908 | if ( this.autoplay ) { |
1905 | | - js_log( 'showPlayer::activating autoplay' ); |
| 1909 | + mw.log( 'showPlayer::activating autoplay' ); |
1906 | 1910 | this.play(); |
1907 | 1911 | } |
1908 | 1912 | }, |
— | — | @@ -1922,7 +1926,7 @@ |
1923 | 1927 | return out + '</div>'; |
1924 | 1928 | }, |
1925 | 1929 | updateVideoTimeReq:function( time_req ) { |
1926 | | - js_log( 'f:updateVideoTimeReq' ); |
| 1930 | + mw.log( 'f:updateVideoTimeReq' ); |
1927 | 1931 | var time_parts = time_req.split( '/' ); |
1928 | 1932 | this.updateVideoTime( time_parts[0], time_parts[1] ); |
1929 | 1933 | }, |
— | — | @@ -1988,7 +1992,7 @@ |
1989 | 1993 | * @param {Float} float_sec Time to update the thumb to |
1990 | 1994 | */ |
1991 | 1995 | updateThumbTime:function( float_sec ) { |
1992 | | - // js_log('updateThumbTime:'+float_sec); |
| 1996 | + // mw.log('updateThumbTime:'+float_sec); |
1993 | 1997 | var _this = this; |
1994 | 1998 | if ( typeof this.org_thum_src == 'undefined' ) { |
1995 | 1999 | this.org_thum_src = this.media_element.getThumbnailURL(); |
— | — | @@ -2030,7 +2034,7 @@ |
2031 | 2035 | if ( this.thumbnail_updating && $j( '#new_img_thumb_' + this.id ).attr( 'src' ) == src ) |
2032 | 2036 | return false; |
2033 | 2037 | |
2034 | | - js_log( 'update thumb: ' + src ); |
| 2038 | + mw.log( 'update thumb: ' + src ); |
2035 | 2039 | |
2036 | 2040 | if ( quick_switch ) { |
2037 | 2041 | $j( '#img_thumb_' + this.id ).attr( 'src', src ); |
— | — | @@ -2041,20 +2045,20 @@ |
2042 | 2046 | $j( '#new_img_thumb_' + this.id ).stop().remove(); |
2043 | 2047 | |
2044 | 2048 | if ( this.thumbnail_disp ) { |
2045 | | - js_log( 'set to thumb:' + src ); |
| 2049 | + mw.log( 'set to thumb:' + src ); |
2046 | 2050 | this.thumbnail_updating = true; |
2047 | 2051 | $j( '#dc_' + this.id ).append( '<img src="' + src + '" ' + |
2048 | 2052 | 'style="display:none;position:absolute;zindex:2;top:0px;left:0px;" ' + |
2049 | 2053 | 'width="' + this.width + '" height="' + this.height + '" ' + |
2050 | 2054 | 'id = "new_img_thumb_' + this.id + '" />' ); |
2051 | | - // js_log('appended: new_img_thumb_'); |
| 2055 | + // mw.log('appended: new_img_thumb_'); |
2052 | 2056 | $j( '#new_img_thumb_' + this.id ).fadeIn( "slow", function() { |
2053 | 2057 | // once faded in remove org and rename new: |
2054 | 2058 | $j( '#img_thumb_' + _this.id ).remove(); |
2055 | 2059 | $j( '#new_img_thumb_' + _this.id ).attr( 'id', 'img_thumb_' + _this.id ); |
2056 | 2060 | $j( '#img_thumb_' + _this.id ).css( 'zindex', '1' ); |
2057 | 2061 | _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")); |
2059 | 2063 | |
2060 | 2064 | // if we have a thumb queued update to that |
2061 | 2065 | if ( _this.last_thumb_url ) { |
— | — | @@ -2074,7 +2078,7 @@ |
2075 | 2079 | * download, and embed code. |
2076 | 2080 | */ |
2077 | 2081 | getThumbnailHTML : function () { |
2078 | | - js_log( 'embedPlayer:getThumbnailHTML::' + this.id ); |
| 2082 | + mw.log( 'embedPlayer:getThumbnailHTML::' + this.id ); |
2079 | 2083 | var thumb_html = ''; |
2080 | 2084 | var class_atr = ''; |
2081 | 2085 | var style_atr = ''; |
— | — | @@ -2103,7 +2107,7 @@ |
2104 | 2108 | if ( thumbnail.substring( 0, 1 ) == '/' ) { |
2105 | 2109 | eURL = mw.parseUri( mw.getMwEmbedPath() ); |
2106 | 2110 | 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); |
2108 | 2112 | } else { |
2109 | 2113 | embed_thumb_url = ( thumbnail.indexOf( 'http://' ) != -1 ) ? thumbnail : mw.getMwEmbedPath() + thumbnail; |
2110 | 2114 | } |
— | — | @@ -2138,7 +2142,7 @@ |
2139 | 2143 | var pos = $j( '#' + sel_id + ' .options-btn' ).offset(); |
2140 | 2144 | pos['top'] = pos['top'] + 24; |
2141 | 2145 | 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']); |
2143 | 2147 | $j( '#mv_vid_options_' + sel_id ).css( pos ).toggle(); |
2144 | 2148 | return; |
2145 | 2149 | }, |
— | — | @@ -2252,7 +2256,7 @@ |
2253 | 2257 | * Close the text interface |
2254 | 2258 | */ |
2255 | 2259 | closeTextInterface:function() { |
2256 | | - js_log( 'closeTextInterface ' + typeof this.textInterface ); |
| 2260 | + mw.log( 'closeTextInterface ' + typeof this.textInterface ); |
2257 | 2261 | if ( typeof this.textInterface !== 'undefined' ) { |
2258 | 2262 | this.textInterface.close(); |
2259 | 2263 | } |
— | — | @@ -2367,7 +2371,7 @@ |
2368 | 2372 | var iparts = $j( this ).attr( 'id' ).replace(/sc_/ , '' ).split( '_' ); |
2369 | 2373 | var source_id = iparts[0]; |
2370 | 2374 | 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 ); |
2372 | 2376 | |
2373 | 2377 | $j( '#' + this_id ).get( 0 ).closeDisplayedHTML(); |
2374 | 2378 | $j( '#' + _this.id ).get( 0 ).media_element.selectSource( source_id ); |
— | — | @@ -2414,7 +2418,7 @@ |
2415 | 2419 | out += '</div>'; |
2416 | 2420 | return out; |
2417 | 2421 | } |
2418 | | - // js_log('f:showDownload '+ this.roe + ' ' + this.media_element.addedROEData); |
| 2422 | + // mw.log('f:showDownload '+ this.roe + ' ' + this.media_element.addedROEData); |
2419 | 2423 | if ( this.roe && this.media_element.addedROEData == false ) { |
2420 | 2424 | var _this = this; |
2421 | 2425 | $target.html( gM( 'loading_txt' ) ); |
— | — | @@ -2445,7 +2449,7 @@ |
2446 | 2450 | // check if thumbnail is being displayed and embed html |
2447 | 2451 | if ( this.thumbnail_disp ) { |
2448 | 2452 | if ( !this.selected_player ) { |
2449 | | - js_log( 'no selected_player' ); |
| 2453 | + mw.log( 'no selected_player' ); |
2450 | 2454 | // this.innerHTML = this.getPluginMissingHTML(); |
2451 | 2455 | $j( '#' + this.id ).html( this.getPluginMissingHTML() ); |
2452 | 2456 | } else { |
— | — | @@ -2472,7 +2476,7 @@ |
2473 | 2477 | */ |
2474 | 2478 | load:function() { |
2475 | 2479 | // should be done by child (no base way to pre-buffer video) |
2476 | | - js_log( 'baseEmbed:load call' ); |
| 2480 | + mw.log( 'baseEmbed:load call' ); |
2477 | 2481 | }, |
2478 | 2482 | |
2479 | 2483 | /** |
— | — | @@ -2485,7 +2489,7 @@ |
2486 | 2490 | pause: function() { |
2487 | 2491 | var _this = this; |
2488 | 2492 | var eid = ( this.pc != null ) ? this.pc.pp.id:this.id; |
2489 | | - // js_log('mwEmbed:do pause'); |
| 2493 | + // mw.log('mwEmbed:do pause'); |
2490 | 2494 | // (playing) do pause |
2491 | 2495 | this.paused = true; |
2492 | 2496 | var $pt = $j( '#' + eid); |
— | — | @@ -2507,7 +2511,7 @@ |
2508 | 2512 | */ |
2509 | 2513 | stop: function() { |
2510 | 2514 | var _this = this; |
2511 | | - js_log( 'mvEmbed:stop:' + this.id ); |
| 2515 | + mw.log( 'mvEmbed:stop:' + this.id ); |
2512 | 2516 | |
2513 | 2517 | // no longer seeking: |
2514 | 2518 | this.didSeekJump = false; |
— | — | @@ -2524,7 +2528,7 @@ |
2525 | 2529 | // check if thumbnail is being displayed in which case do nothing |
2526 | 2530 | if ( this.thumbnail_disp ) { |
2527 | 2531 | // already in stooped state |
2528 | | - js_log( 'already in stopped state' ); |
| 2532 | + mw.log( 'already in stopped state' ); |
2529 | 2533 | } else { |
2530 | 2534 | // rewrite the html to thumbnail disp |
2531 | 2535 | this.showThumbnail(); |
— | — | @@ -2562,14 +2566,14 @@ |
2563 | 2567 | $j( '#' + eid + ' .volume-slider' ).slider( 'value', 0 ); |
2564 | 2568 | this.updateVolumen( 0 ); |
2565 | 2569 | } |
2566 | | - js_log( 'f:toggleMute::' + this.muted ); |
| 2570 | + mw.log( 'f:toggleMute::' + this.muted ); |
2567 | 2571 | }, |
2568 | 2572 | |
2569 | 2573 | /** |
2570 | 2574 | * Abstract Update volumen Method must be overided by plug-in / player interface |
2571 | 2575 | */ |
2572 | 2576 | 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' ); |
2574 | 2578 | return ; |
2575 | 2579 | }, |
2576 | 2580 | |
— | — | @@ -2577,7 +2581,7 @@ |
2578 | 2582 | * Abstract fullscreen Method must be overided by plug-in / player interface |
2579 | 2583 | */ |
2580 | 2584 | fullscreen:function() { |
2581 | | - js_log( 'fullscreen not supported with current playback type' ); |
| 2585 | + mw.log( 'fullscreen not supported with current playback type' ); |
2582 | 2586 | return ; |
2583 | 2587 | }, |
2584 | 2588 | |
— | — | @@ -2633,16 +2637,16 @@ |
2634 | 2638 | * underling plugin objects are responsible for updating currentTime |
2635 | 2639 | */ |
2636 | 2640 | 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 ) { |
2640 | 2644 | if ( !this.userSlide && !this.seeking ) { |
2641 | | - if ( this.startOffset ) { |
| 2645 | + if ( parseInt( this.startOffset ) != 0 ) { |
2642 | 2646 | // If start offset include that calculation |
2643 | 2647 | this.updatePlayHead( ( this.currentTime - this.startOffset ) / this.duration ); |
2644 | 2648 | var et = ( this.ctrlBuilder.long_time_disp ) ? '/' + mw.seconds2npt( parseFloat( this.startOffset ) + parseFloat( this.duration ) ) : ''; |
2645 | 2649 | this.setStatus( mw.seconds2npt( this.currentTime ) + et ); |
2646 | | - } else { |
| 2650 | + } else { |
2647 | 2651 | this.updatePlayHead( this.currentTime / this.duration ); |
2648 | 2652 | var et = ( this.ctrlBuilder.long_time_disp ) ? '/' + mw.seconds2npt( this.duration ):''; |
2649 | 2653 | this.setStatus( mw.seconds2npt( this.currentTime ) + et ); |
— | — | @@ -2651,12 +2655,11 @@ |
2652 | 2656 | // Check if we are "done" |
2653 | 2657 | var end_presentation_time = ( this.startOffset ) ? ( this.startOffset + this.duration ) : this.duration; |
2654 | 2658 | 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 ); |
2656 | 2660 | this.onClipDone(); |
2657 | 2661 | } |
2658 | 2662 | } 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 |
2661 | 2664 | if ( this.isStoped() ) { |
2662 | 2665 | this.setStatus( this.getTimeRange() ); |
2663 | 2666 | } else if ( this.isPaused() ) { |
— | — | @@ -2709,7 +2712,7 @@ |
2710 | 2713 | |
2711 | 2714 | // Update the buffer progress bar (if available ) |
2712 | 2715 | if ( this.bufferedPercent != 0 ) { |
2713 | | - // js_log('bufferedPercent: ' + this.bufferedPercent); |
| 2716 | + // mw.log('bufferedPercent: ' + this.bufferedPercent); |
2714 | 2717 | if ( this.bufferedPercent > 1 ) |
2715 | 2718 | this.bufferedPercent = 1; |
2716 | 2719 | |
— | — | @@ -2725,13 +2728,11 @@ |
2726 | 2729 | * @param {Float} perc Value between 0 and 1 for position of playhead |
2727 | 2730 | */ |
2728 | 2731 | 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; |
2730 | 2733 | if ( this.controls && $j( '#' + eid + ' .play_head' ).length != 0 ) { |
2731 | 2734 | var val = parseInt( perc * 1000 ); |
2732 | 2735 | $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 | + } |
2736 | 2737 | }, |
2737 | 2738 | |
2738 | 2739 | /** |
— | — | @@ -2740,7 +2741,7 @@ |
2741 | 2742 | * @param {Object} options Provides "start" time & "end" time to highlight |
2742 | 2743 | */ |
2743 | 2744 | highlightPlaySection:function( options ) { |
2744 | | - js_log( 'highlightPlaySection' ); |
| 2745 | + mw.log( 'highlightPlaySection' ); |
2745 | 2746 | var eid = ( this.pc ) ? this.pc.pp.id:this.id; |
2746 | 2747 | var dur = this.getDuration(); |
2747 | 2748 | // set the left percet and update the slider: |
— | — | @@ -2760,7 +2761,7 @@ |
2761 | 2762 | slider_perc = ( left_perc / 100 ); |
2762 | 2763 | } |
2763 | 2764 | |
2764 | | - js_log( "slider perc:" + slider_perc ); |
| 2765 | + mw.log( "slider perc:" + slider_perc ); |
2765 | 2766 | if ( ! this.isPlaying() ) { |
2766 | 2767 | this.updatePlayHead( slider_perc ); |
2767 | 2768 | } |
— | — | @@ -2769,7 +2770,7 @@ |
2770 | 2771 | if ( ( width_perc + left_perc ) > 100 ) { |
2771 | 2772 | width_perc = 100 - left_perc; |
2772 | 2773 | } |
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); |
2774 | 2775 | $j( '#mv_seeker_' + eid + ' .mv_highlight' ).css( { |
2775 | 2776 | 'left' : left_perc + '%', |
2776 | 2777 | 'width' : width_perc + '%' |
— | — | @@ -2779,7 +2780,7 @@ |
2780 | 2781 | this.seek_time_sec = mw.npt2seconds( options['start'] ); |
2781 | 2782 | // trim output to |
2782 | 2783 | 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 ); |
2784 | 2785 | this.updateThumbTime( rel_start_sec ); |
2785 | 2786 | }, |
2786 | 2787 | |
— | — | @@ -3021,7 +3022,7 @@ |
3022 | 3023 | * null if no player found |
3023 | 3024 | */ |
3024 | 3025 | defaultPlayer : function( mime_type ) { |
3025 | | - js_log( "get defaultPlayer for " + mime_type ); |
| 3026 | + mw.log( "get defaultPlayer for " + mime_type ); |
3026 | 3027 | var mime_players = this.getMIMETypePlayers( mime_type ); |
3027 | 3028 | if ( mime_players.length > 0 ) |
3028 | 3029 | { |
— | — | @@ -3034,7 +3035,7 @@ |
3035 | 3036 | // (it will be chosen according to the default_players list |
3036 | 3037 | return mime_players[0]; |
3037 | 3038 | } |
3038 | | - js_log( 'No default player found for ' + mime_type ); |
| 3039 | + mw.log( 'No default player found for ' + mime_type ); |
3039 | 3040 | return null; |
3040 | 3041 | }, |
3041 | 3042 | |
— | — | @@ -3059,7 +3060,7 @@ |
3060 | 3061 | for ( var i = 0; i < this.players.length; i++ ) { |
3061 | 3062 | if ( this.players[i].id == player_id ) { |
3062 | 3063 | selected_player = this.players[i]; |
3063 | | - js_log( 'choosing ' + player_id + ' for ' + mime_type ); |
| 3064 | + mw.log( 'choosing ' + player_id + ' for ' + mime_type ); |
3064 | 3065 | this.preference[mime_type] = player_id; |
3065 | 3066 | this.savePreferences(); |
3066 | 3067 | break; |
— | — | @@ -3071,7 +3072,7 @@ |
3072 | 3073 | if ( embed.media_element.selected_source && ( embed.media_element.selected_source.mime_type == mime_type ) ) |
3073 | 3074 | { |
3074 | 3075 | 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() ); |
3076 | 3077 | } |
3077 | 3078 | } |
3078 | 3079 | } |
— | — | @@ -3090,7 +3091,7 @@ |
3091 | 3092 | { |
3092 | 3093 | var name_value = pairs[i].split( '=' ); |
3093 | 3094 | 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]); |
3095 | 3096 | } |
3096 | 3097 | } |
3097 | 3098 | }, |
— | — | @@ -3150,7 +3151,7 @@ |
3151 | 3152 | * Detects what plug-ins the client supports |
3152 | 3153 | */ |
3153 | 3154 | detect: function() { |
3154 | | - js_log( "embedPlayer: running detect" ); |
| 3155 | + mw.log( "embedPlayer: running detect" ); |
3155 | 3156 | this.players = new mediaPlayers(); |
3156 | 3157 | // every browser supports html rendering: |
3157 | 3158 | this.players.addPlayer( htmlPlayer ); |
— | — | @@ -3218,7 +3219,7 @@ |
3219 | 3220 | // @@todo add some user nagging to install the xiph qt |
3220 | 3221 | } |
3221 | 3222 | } catch ( e ) { |
3222 | | - js_log( 'could not run canPlayType in safari' ); |
| 3223 | + mw.log( 'could not run canPlayType in safari' ); |
3223 | 3224 | } |
3224 | 3225 | } else { |
3225 | 3226 | this.players.addPlayer( videoElementPlayer ); |
— | — | @@ -3233,7 +3234,7 @@ |
3234 | 3235 | if ( semicolonPos > -1 ) { |
3235 | 3236 | type = type.substr( 0, semicolonPos ); |
3236 | 3237 | } |
3237 | | - // js_log('on type: '+type); |
| 3238 | + // mw.log('on type: '+type); |
3238 | 3239 | var pluginName = navigator.mimeTypes[i].enabledPlugin ? navigator.mimeTypes[i].enabledPlugin.name : ''; |
3239 | 3240 | if ( !pluginName ) { |
3240 | 3241 | // In case it is null or undefined |
— | — | @@ -3278,7 +3279,7 @@ |
3279 | 3280 | var descArray = flashDescription.split( " " ); |
3280 | 3281 | var tempArrayMajor = descArray[2].split( "." ); |
3281 | 3282 | var versionMajor = tempArrayMajor[0]; |
3282 | | - // js_log("version of flash: " + versionMajor); |
| 3283 | + // mw.log("version of flash: " + versionMajor); |
3283 | 3284 | if ( versionMajor >= 10 ) { |
3284 | 3285 | this.players.addPlayer( omtkPlayer ); |
3285 | 3286 | } |
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/javaEmbed.js |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | * Get the embed html code: |
39 | 39 | */ |
40 | 40 | 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 ) ); |
42 | 42 | // get the duration |
43 | 43 | this.getDuration(); |
44 | 44 | // if still unset set to an arbitrary time 60 seconds: |
— | — | @@ -108,15 +108,15 @@ |
109 | 109 | if ( this.playerElement && this.playerElement.getPlayPosition ) { |
110 | 110 | try { |
111 | 111 | // 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()); |
113 | 113 | this.currentTime = this.playerElement.getPlayPosition(); |
114 | 114 | if ( this.playerElement.getPlayPosition() < 0 ) { |
115 | | - js_log( 'pp:' + this.playerElement.getPlayPosition() ); |
| 115 | + mw.log( 'pp:' + this.playerElement.getPlayPosition() ); |
116 | 116 | // probably reached clip end |
117 | 117 | this.onClipDone(); |
118 | 118 | } |
119 | 119 | } catch ( e ) { |
120 | | - js_log( 'could not get time from jPlayer: ' + e ); |
| 120 | + mw.log( 'could not get time from jPlayer: ' + e ); |
121 | 121 | } |
122 | 122 | } |
123 | 123 | } |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | * @param {Float} percentage Percentage to seek into the stream |
132 | 132 | */ |
133 | 133 | 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 ); |
135 | 135 | this.getPlayerElement(); |
136 | 136 | |
137 | 137 | if ( this.supportsURLTimeEncoding() ) { |
— | — | @@ -140,7 +140,7 @@ |
141 | 141 | // this.playerElement.restart(); |
142 | 142 | } else if ( this.playerElement ) { |
143 | 143 | // 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() ) ) ); |
145 | 145 | this.playerElement.doSeek( percentage * parseFloat( this.getDuration() ) ); |
146 | 146 | } else { |
147 | 147 | this.doPlayThenSeek( percentage ); |
— | — | @@ -152,7 +152,7 @@ |
153 | 153 | * @param {Float} percentage Percentage to seek into the stream |
154 | 154 | */ |
155 | 155 | doPlayThenSeek: function( percentage ) { |
156 | | - js_log( 'doPlayThenSeek' ); |
| 156 | + mw.log( 'doPlayThenSeek' ); |
157 | 157 | var _this = this; |
158 | 158 | this.play(); |
159 | 159 | var rfsCount = 0; |
— | — | @@ -167,7 +167,7 @@ |
168 | 168 | setTimeout( readyForSeek, 50 ); |
169 | 169 | rfsCount++; |
170 | 170 | } else { |
171 | | - js_log( 'error:doPlayThenSeek failed' ); |
| 171 | + mw.log( 'error:doPlayThenSeek failed' ); |
172 | 172 | } |
173 | 173 | } |
174 | 174 | } |
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/flowplayerEmbed.js |
— | — | @@ -339,7 +339,7 @@ |
340 | 340 | extend( self, json ); |
341 | 341 | return self; |
342 | 342 | } catch ( e ) { |
343 | | - js_log( 'flow player could not set css: ' + json ); |
| 343 | + mw.log( 'flow player could not set css: ' + json ); |
344 | 344 | } |
345 | 345 | }, |
346 | 346 | show: function() { |
— | — | @@ -626,7 +626,7 @@ |
627 | 627 | var ret = ( arg === undefined ) ? api["fp_" + name]() : api["fp_" + name]( arg ); |
628 | 628 | return ret == 'undefined' ? self : ret; |
629 | 629 | } catch ( e ) { |
630 | | - js_log( 'flowplayer could not access fp_ ' + name ); |
| 630 | + mw.log( 'flowplayer could not access fp_ ' + name ); |
631 | 631 | } |
632 | 632 | }; |
633 | 633 | } |
— | — | @@ -1472,7 +1472,7 @@ |
1473 | 1473 | postEmbedJS: function() |
1474 | 1474 | { |
1475 | 1475 | 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' ) ; |
1477 | 1477 | var flowConfig = { |
1478 | 1478 | clip: { |
1479 | 1479 | url: this.getSrc(), |
— | — | @@ -1556,7 +1556,7 @@ |
1557 | 1557 | if ( this.fla ) { |
1558 | 1558 | this.fla.fullscreen(); |
1559 | 1559 | } else { |
1560 | | - js_log( 'must be playing before you can go fullscreen' ); |
| 1560 | + mw.log( 'must be playing before you can go fullscreen' ); |
1561 | 1561 | } |
1562 | 1562 | }, |
1563 | 1563 | pause : function() |
— | — | @@ -1565,10 +1565,10 @@ |
1566 | 1566 | if ( !this.thumbnail_disp ) { |
1567 | 1567 | this.parent_pause(); |
1568 | 1568 | if ( this.fla ) { |
1569 | | - js_log( "Flash:Pause: " + this.fla.isPaused() ); |
| 1569 | + mw.log( "Flash:Pause: " + this.fla.isPaused() ); |
1570 | 1570 | if ( this.fla['pause'] ) { |
1571 | 1571 | if ( ! this.fla.isPaused() ) { |
1572 | | - js_log( 'calling plugin pause' ); |
| 1572 | + mw.log( 'calling plugin pause' ); |
1573 | 1573 | this.fla.pause(); |
1574 | 1574 | |
1575 | 1575 | // restore volume and opacity |
— | — | @@ -1601,7 +1601,7 @@ |
1602 | 1602 | if ( !this.duration || this.duration == 0 ) { |
1603 | 1603 | if ( this.fla.getClip() ) { |
1604 | 1604 | 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() ); |
1606 | 1606 | } |
1607 | 1607 | } |
1608 | 1608 | // update the duration ntp values: |
— | — | @@ -1621,12 +1621,12 @@ |
1622 | 1622 | // set the current Time (based on timeFormat) |
1623 | 1623 | if ( this.supportsURLTimeEncoding() ) { |
1624 | 1624 | 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()); |
1626 | 1626 | } else { |
1627 | 1627 | this.currentTime = flash_state.time + this.startOffset; |
1628 | 1628 | // stop buffering if greater than the duration: |
1629 | 1629 | 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() ); |
1631 | 1631 | this.fla.stopBuffering(); |
1632 | 1632 | } |
1633 | 1633 | } |
— | — | @@ -1639,7 +1639,7 @@ |
1640 | 1640 | } |
1641 | 1641 | catch ( err ) |
1642 | 1642 | { |
1643 | | - js_log( 'failed to set values' ); |
| 1643 | + mw.log( 'failed to set values' ); |
1644 | 1644 | fail = true; |
1645 | 1645 | } |
1646 | 1646 | if ( !fail ) |
— | — | @@ -1649,7 +1649,7 @@ |
1650 | 1650 | /* to support local seeks */ |
1651 | 1651 | if ( this.currentTime > 1 && this.seek_time_sec != 0 && !this.supportsURLTimeEncoding() ) |
1652 | 1652 | { |
1653 | | - js_log( 'flashEmbed: _local_ Seeking to ' + this.seek_time_sec ); |
| 1653 | + mw.log( 'flashEmbed: _local_ Seeking to ' + this.seek_time_sec ); |
1654 | 1654 | this.fla.seek( this.seek_time_sec ); |
1655 | 1655 | this.seek_time_sec = 0; |
1656 | 1656 | } |
— | — | @@ -1661,7 +1661,7 @@ |
1662 | 1662 | ( this.currentTime > ( mw.npt2seconds( this.end_ntp ) - 1 ) |
1663 | 1663 | && this.prevTime == this.currentTime ) ) |
1664 | 1664 | ) { |
1665 | | - js_log( 'prbally reached end of stream: ' + mw.seconds2npt( this.currentTime ) ); |
| 1665 | + mw.log( 'prbally reached end of stream: ' + mw.seconds2npt( this.currentTime ) ); |
1666 | 1666 | this.onClipDone(); |
1667 | 1667 | } |
1668 | 1668 | |
— | — | @@ -1670,13 +1670,13 @@ |
1671 | 1671 | |
1672 | 1672 | |
1673 | 1673 | 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))); |
1675 | 1675 | }, |
1676 | 1676 | restorePlayer:function() { |
1677 | 1677 | if ( !this.fla ) |
1678 | 1678 | this.getFLA(); |
1679 | 1679 | if ( this.fla ) { |
1680 | | - js_log( 'f:do restorePlayer' ); |
| 1680 | + mw.log( 'f:do restorePlayer' ); |
1681 | 1681 | this.fla.setVolume( 90 ); |
1682 | 1682 | $f().getPlugin( 'screen' ).css( { 'opacity':'1.0' } ); |
1683 | 1683 | // set the fallback date restore flag to true: |
— | — | @@ -1688,7 +1688,7 @@ |
1689 | 1689 | this.fla = $f( this.pid ); |
1690 | 1690 | }, |
1691 | 1691 | stop : function() { |
1692 | | - js_log( 'f:flashEmbed:stop' ); |
| 1692 | + mw.log( 'f:flashEmbed:stop' ); |
1693 | 1693 | this.startedTimedPlayback = false; |
1694 | 1694 | if ( this.monitorTimerId != 0 ) |
1695 | 1695 | { |
— | — | @@ -1700,7 +1700,7 @@ |
1701 | 1701 | this.parent_stop(); |
1702 | 1702 | }, |
1703 | 1703 | onStop: function() { |
1704 | | - js_log( 'f:onStop' ); |
| 1704 | + mw.log( 'f:onStop' ); |
1705 | 1705 | // stop updates: |
1706 | 1706 | if ( this.monitorTimerId != 0 ) |
1707 | 1707 | { |
— | — | @@ -1709,13 +1709,13 @@ |
1710 | 1710 | } |
1711 | 1711 | }, |
1712 | 1712 | onClipDone: function() { |
1713 | | - js_log( 'f:flash:onClipDone' ); |
| 1713 | + mw.log( 'f:flash:onClipDone' ); |
1714 | 1714 | 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) ' ); |
1716 | 1716 | // keep monitoring: |
1717 | 1717 | this.monitor(); |
1718 | 1718 | } else { |
1719 | | - js_log( 'clip done and ' + this.startedTimedPlayback ); |
| 1719 | + mw.log( 'clip done and ' + this.startedTimedPlayback ); |
1720 | 1720 | // stop the clip if its not stopped already: |
1721 | 1721 | this.stop(); |
1722 | 1722 | this.setStatus( "Clip Done..." ); |
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/htmlEmbed.js |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | // call the parent |
47 | 47 | this.parent_play(); |
48 | 48 | |
49 | | - js_log( 'f:play: htmlEmbedWrapper' ); |
| 49 | + mw.log( 'f:play: htmlEmbedWrapper' ); |
50 | 50 | var ct = new Date(); |
51 | 51 | this.clockStartTime = ct.getTime(); |
52 | 52 | |
— | — | @@ -65,10 +65,10 @@ |
66 | 66 | * Preserves the pause time across for timed playback |
67 | 67 | */ |
68 | 68 | pause:function() { |
69 | | - js_log( 'f:pause: htmlEmbedWrapper' ); |
| 69 | + mw.log( 'f:pause: htmlEmbedWrapper' ); |
70 | 70 | var ct = new Date(); |
71 | 71 | this.pauseTime = this.currentTime; |
72 | | - js_log( 'pause time: ' + this.pauseTime ); |
| 72 | + mw.log( 'pause time: ' + this.pauseTime ); |
73 | 73 | |
74 | 74 | window.clearInterval( this.monitorTimerId ); |
75 | 75 | }, |
— | — | @@ -99,11 +99,11 @@ |
100 | 100 | * Monitor tracks of virtual player time |
101 | 101 | */ |
102 | 102 | monitor:function() { |
103 | | - //js_log('html:monitor: '+ this.currentTime); |
| 103 | + //mw.log('html:monitor: '+ this.currentTime); |
104 | 104 | var ct = new Date(); |
105 | 105 | this.currentTime = ( ( ct.getTime() - this.clockStartTime ) / 1000 ) + this.pauseTime; |
106 | 106 | var ct = new Date(); |
107 | | - // js_log('mvPlayList:monitor trueTime: '+ this.currentTime); |
| 107 | + // mw.log('mvPlayList:monitor trueTime: '+ this.currentTime); |
108 | 108 | |
109 | 109 | // Once currentTime is updated call parent_monitor |
110 | 110 | this.parent_monitor(); |
— | — | @@ -140,7 +140,7 @@ |
141 | 141 | * @param {Object} options Thumbnail options |
142 | 142 | */ |
143 | 143 | 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 ); |
145 | 145 | // generate a scaled down version _that_ we can clone if nessisary |
146 | 146 | // add a not vissiable container to the body: |
147 | 147 | var do_refresh = ( typeof options['refresh'] != 'undefined' ) ? true:false; |
— | — | @@ -151,7 +151,7 @@ |
152 | 152 | // Set the font scale down percentage: (kind of arbitrary) |
153 | 153 | var scale_perc = options.width / this.pc.pp.width; |
154 | 154 | |
155 | | - js_log( 'scale_perc:' + options.width + ' / ' + $j( this ).width() + ' = ' + scale_perc ); |
| 155 | + mw.log( 'scale_perc:' + options.width + ' / ' + $j( this ).width() + ' = ' + scale_perc ); |
156 | 156 | |
157 | 157 | // Min scale font percent of 70 (overflow is hidden) |
158 | 158 | var font_perc = ( Math.round( scale_perc * 100 ) < 80 ) ? 80 : Math.round( scale_perc * 100 ); |
— | — | @@ -200,7 +200,7 @@ |
201 | 201 | * Get the "embed" html for the html player |
202 | 202 | */ |
203 | 203 | getEmbedHTML:function() { |
204 | | - js_log( 'f:html:getEmbedHTML: ' + this.id ); |
| 204 | + mw.log( 'f:html:getEmbedHTML: ' + this.id ); |
205 | 205 | // set up the css for our parent div: |
206 | 206 | $j( this ).css( { |
207 | 207 | 'width':this.pc.pp.width, |
— | — | @@ -223,14 +223,14 @@ |
224 | 224 | opt = { }; |
225 | 225 | var height = ( opt.height ) ? opt.height:this.pc.pp.height; |
226 | 226 | 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 ); |
228 | 228 | 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 ); |
230 | 230 | out = '<img style="width:' + width + 'px;height:' + height + 'px" src="' + this.pc.src + '">'; |
231 | 231 | } else { |
232 | 232 | out = this.pc.wholeText; |
233 | 233 | } |
234 | | - // js_log('f:getThumbnailHTML: got thumb: '+out); |
| 234 | + // mw.log('f:getThumbnailHTML: got thumb: '+out); |
235 | 235 | return out; |
236 | 236 | }, |
237 | 237 | |
— | — | @@ -238,7 +238,7 @@ |
239 | 239 | * re-show the Thumbnail |
240 | 240 | */ |
241 | 241 | showThumbnail:function() { |
242 | | - js_log( 'htmlEmbed:showThumbnail()' ); |
| 242 | + mw.log( 'htmlEmbed:showThumbnail()' ); |
243 | 243 | this.getEmbedHTML(); |
244 | 244 | }, |
245 | 245 | |
— | — | @@ -246,7 +246,7 @@ |
247 | 247 | * Display the "embed" html right away |
248 | 248 | */ |
249 | 249 | getHTML:function() { |
250 | | - js_log( 'htmlEmbed::getHTML() ' + this.id ); |
| 250 | + mw.log( 'htmlEmbed::getHTML() ' + this.id ); |
251 | 251 | this.getEmbedHTML(); |
252 | 252 | }, |
253 | 253 | |
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/vlcEmbed.js |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | 'style="width:' + this.width + 'px;height:' + this.height + 'px;" ' + |
48 | 48 | '>' + |
49 | 49 | '</object>'; |
50 | | - js_log( 'embed with: ' + embed_code ); |
| 50 | + mw.log( 'embed with: ' + embed_code ); |
51 | 51 | return embed_code; |
52 | 52 | }, |
53 | 53 | |
— | — | @@ -63,13 +63,13 @@ |
64 | 64 | this.vlc.playlist.items.clear(); |
65 | 65 | var src = mw.absoluteUrl( this.getSrc() ) ; |
66 | 66 | // @@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 ); |
68 | 68 | var itemId = this.vlc.playlist.add( src ); |
69 | 69 | if ( itemId != -1 ) { |
70 | 70 | // play |
71 | 71 | this.vlc.playlist.playItem( itemId ); |
72 | 72 | } else { |
73 | | - js_log( "error:cannot play at the moment !" ); |
| 73 | + mw.log( "error:cannot play at the moment !" ); |
74 | 74 | } |
75 | 75 | // if controls enabled start up javascript interface and monitor: |
76 | 76 | if ( this.controls ) { |
— | — | @@ -79,12 +79,12 @@ |
80 | 80 | } |
81 | 81 | setTimeout( '$j(\'#' + this.id + '\').get(0).monitor()', 100 ); |
82 | 82 | } else { |
83 | | - js_log( 'postEmbedJS:vlc not ready' ); |
| 83 | + mw.log( 'postEmbedJS:vlc not ready' ); |
84 | 84 | this.pejs_count++; |
85 | 85 | if ( this.pejs_count < 10 ) { |
86 | 86 | setTimeout( 'document.getElementById(\'' + this.id + '\').postEmbedJS()', 100 ); |
87 | 87 | } else { |
88 | | - js_log( 'vlc never ready' ); |
| 88 | + mw.log( 'vlc never ready' ); |
89 | 89 | } |
90 | 90 | } |
91 | 91 | }, |
— | — | @@ -95,7 +95,7 @@ |
96 | 96 | this.parent_doSeek( perc ); |
97 | 97 | } else if ( this.vlc ) { |
98 | 98 | this.seeking = true; |
99 | | - js_log( "do vlc http seek to: " + perc ) |
| 99 | + mw.log( "do vlc http seek to: " + perc ) |
100 | 100 | if ( ( this.vlc.input.state == 3 ) && ( this.vlc.input.position != perc ) ) |
101 | 101 | { |
102 | 102 | this.vlc.input.position = perc; |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | this.parent_monitor(); |
109 | 109 | }, |
110 | 110 | doPlayThenSeek:function( perc ) { |
111 | | - js_log( 'doPlayThenSeekHack' ); |
| 111 | + mw.log( 'doPlayThenSeekHack' ); |
112 | 112 | var _this = this; |
113 | 113 | this.play(); |
114 | 114 | var rfsCount = 0; |
— | — | @@ -123,7 +123,7 @@ |
124 | 124 | setTimeout( readyForSeek, 50 ); |
125 | 125 | rfsCount++; |
126 | 126 | } else { |
127 | | - js_log( 'error:doPlayThenSeek failed' ); |
| 127 | + mw.log( 'error:doPlayThenSeek failed' ); |
128 | 128 | } |
129 | 129 | } |
130 | 130 | } |
— | — | @@ -141,9 +141,9 @@ |
142 | 142 | if ( !this.vlc ) |
143 | 143 | return ; |
144 | 144 | 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); |
148 | 148 | if ( this.vlc.log.messages.count > 0 ) { |
149 | 149 | // there is one or more messages in the log |
150 | 150 | var iter = this.vlc.log.messages.iterator(); |
— | — | @@ -152,7 +152,7 @@ |
153 | 153 | var msgtype = msg.type.toString(); |
154 | 154 | if ( ( msg.severity == 1 ) && ( msgtype == "input" ) ) |
155 | 155 | { |
156 | | - js_log( msg.message ); |
| 156 | + mw.log( msg.message ); |
157 | 157 | } |
158 | 158 | } |
159 | 159 | // clear the log once finished to avoid clogging |
— | — | @@ -210,7 +210,7 @@ |
211 | 211 | // for now trust the duration from url over vlc input.length |
212 | 212 | if ( !this.getDuration() && this.vlc.input.length > 0 ) |
213 | 213 | { |
214 | | - // js_log('setting duration to ' + this.vlc.input.length /1000); |
| 214 | + // mw.log('setting duration to ' + this.vlc.input.length /1000); |
215 | 215 | this.duration = this.vlc.input.length / 1000; |
216 | 216 | } |
217 | 217 | this.currentTime = this.vlc.input.time / 1000; |
— | — | @@ -219,13 +219,13 @@ |
220 | 220 | this.parent_pause(); // update the inteface if paused via native control |
221 | 221 | }, |
222 | 222 | onStop: function() { |
223 | | - js_log( 'vlc:onStop:' ); |
| 223 | + mw.log( 'vlc:onStop:' ); |
224 | 224 | if ( !this.seeking ) |
225 | 225 | this.onClipDone(); |
226 | 226 | }, |
227 | 227 | /* js hooks/controls */ |
228 | 228 | play : function() { |
229 | | - js_log( 'f:vlcPlay' ); |
| 229 | + mw.log( 'f:vlcPlay' ); |
230 | 230 | this.getVLC(); |
231 | 231 | // call the parent |
232 | 232 | this.parent_play(); |
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvPlayList.js |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | 'playlist_swap_loader':true // if the object supports playlist functions |
91 | 91 | }, |
92 | 92 | init : function( element ) { |
93 | | - js_log( 'mvPlayList:init:' ); |
| 93 | + mw.log( 'mvPlayList:init:' ); |
94 | 94 | this.tracks = { }; |
95 | 95 | this.default_track = null; |
96 | 96 | |
— | — | @@ -102,10 +102,10 @@ |
103 | 103 | for ( var attr in mv_default_playlist_attributes ) { |
104 | 104 | if ( element.getAttribute( attr ) ) { |
105 | 105 | 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)"); |
107 | 107 | } else { |
108 | 108 | 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)"); |
110 | 110 | } |
111 | 111 | } |
112 | 112 | // make sure height and width are int: |
— | — | @@ -185,7 +185,7 @@ |
186 | 186 | }, |
187 | 187 | |
188 | 188 | getPlaylist:function() { |
189 | | - js_log( "f:getPlaylist: " + this.srcType ); |
| 189 | + mw.log( "f:getPlaylist: " + this.srcType ); |
190 | 190 | |
191 | 191 | // Playlist: |
192 | 192 | eval( 'var plObj = ' + this.srcType + 'Playlist;' ); |
— | — | @@ -194,11 +194,11 @@ |
195 | 195 | // js parent preservation for local overwritten methods |
196 | 196 | if ( this[method] )this['parent_' + method] = this[method]; |
197 | 197 | this[method] = plObj[method]; |
198 | | - js_log( 'inherit:' + method ); |
| 198 | + mw.log( 'inherit:' + method ); |
199 | 199 | } |
200 | 200 | |
201 | 201 | 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 ); |
203 | 203 | return false; |
204 | 204 | } |
205 | 205 | |
— | — | @@ -206,7 +206,7 @@ |
207 | 207 | if ( this.doParse() ) { |
208 | 208 | this.doWhenParseDone(); |
209 | 209 | } else { |
210 | | - js_log( "error: failed to parse playlist" ); |
| 210 | + mw.log( "error: failed to parse playlist" ); |
211 | 211 | return false; |
212 | 212 | // error or parse needs to do ajax requests |
213 | 213 | } |
— | — | @@ -221,7 +221,7 @@ |
222 | 222 | }, |
223 | 223 | |
224 | 224 | doWhenParseDone: function() { |
225 | | - js_log( 'f:doWhenParseDone' ); |
| 225 | + mw.log( 'f:doWhenParseDone' ); |
226 | 226 | // do additional init for clips: |
227 | 227 | var _this = this; |
228 | 228 | var error = false; |
— | — | @@ -237,7 +237,7 @@ |
238 | 238 | _this.clip_ready_count++; |
239 | 239 | continue; |
240 | 240 | } |
241 | | - // js_log('clip sources count: '+ clip.embed.media_element.sources.length); |
| 241 | + // mw.log('clip sources count: '+ clip.embed.media_element.sources.length); |
242 | 242 | clip.embed.checkPlayerSources(); |
243 | 243 | if ( clip.embed.loading_external_data == false && |
244 | 244 | clip.embed.init_with_sources_loadedDone == false ) { |
— | — | @@ -253,23 +253,23 @@ |
254 | 254 | this.load_error = error; |
255 | 255 | this.is_ready = false; |
256 | 256 | } 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() ); |
258 | 258 | this.doWhenClipLoadDone(); |
259 | 259 | } 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:" ); |
261 | 261 | setTimeout( function(){ |
262 | 262 | _this.doWhenParseDone() |
263 | 263 | }, 100 ); |
264 | 264 | } |
265 | 265 | }, |
266 | 266 | doWhenClipLoadDone:function() { |
267 | | - js_log( 'mvPlaylist:doWhenClipLoadDone' ); |
| 267 | + mw.log( 'mvPlaylist:doWhenClipLoadDone' ); |
268 | 268 | this.ready_to_play = true; |
269 | 269 | this.loading = false; |
270 | 270 | this.showPlayer(); |
271 | 271 | }, |
272 | 272 | 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'); |
274 | 274 | if ( !regen && this.pl_duration ) |
275 | 275 | return this.pl_duration; |
276 | 276 | |
— | — | @@ -285,11 +285,11 @@ |
286 | 286 | durSum += clip.getDuration(); |
287 | 287 | } |
288 | 288 | } else { |
289 | | - js_log( "ERROR: clip " + clip.id + " not ready" ); |
| 289 | + mw.log( "ERROR: clip " + clip.id + " not ready" ); |
290 | 290 | } |
291 | 291 | } ); |
292 | 292 | this.pl_duration = durSum; |
293 | | - // js_log("return dur: " + this.pl_duration); |
| 293 | + // mw.log("return dur: " + this.pl_duration); |
294 | 294 | return this.pl_duration; |
295 | 295 | }, |
296 | 296 | getTimeRange:function() { |
— | — | @@ -297,7 +297,7 @@ |
298 | 298 | return '0:0:0/' + mw.seconds2npt( this.getDuration() ); |
299 | 299 | }, |
300 | 300 | getDataSource:function() { |
301 | | - js_log( "f:getDataSource " + this.src ); |
| 301 | + mw.log( "f:getDataSource " + this.src ); |
302 | 302 | // determine the type / first is it m3u or xml? |
303 | 303 | var pl_parent = this; |
304 | 304 | this.makeURLAbsolute(); |
— | — | @@ -312,12 +312,12 @@ |
313 | 313 | return this.src; |
314 | 314 | }, |
315 | 315 | 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 ); |
317 | 317 | this.srcType = null; |
318 | 318 | // if not external use different detection matrix |
319 | 319 | if ( this.loading_external_data ) { |
320 | 320 | if ( typeof this.data == 'object' ) { |
321 | | - js_log( 'object' ); |
| 321 | + mw.log( 'object' ); |
322 | 322 | // object assume xml (either xspf or rss) |
323 | 323 | plElm = this.data.getElementsByTagName( 'playlist' )[0]; |
324 | 324 | if ( plElm ) { |
— | — | @@ -339,10 +339,10 @@ |
340 | 340 | this.srcType = 'smil'; |
341 | 341 | } |
342 | 342 | } else if ( typeof this.data == 'string' ) { |
343 | | - js_log( 'String' ); |
| 343 | + mw.log( 'String' ); |
344 | 344 | // look at the first line: |
345 | 345 | 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 ); |
347 | 347 | // string |
348 | 348 | if ( first_line.indexOf( '#EXTM3U' ) != -1 ) { |
349 | 349 | this.srcType = 'm3u'; |
— | — | @@ -353,11 +353,11 @@ |
354 | 354 | } |
355 | 355 | } |
356 | 356 | if ( this.srcType ) { |
357 | | - js_log( 'is of type:' + this.srcType ); |
| 357 | + mw.log( 'is of type:' + this.srcType ); |
358 | 358 | this.getPlaylist(); |
359 | 359 | } else { |
360 | 360 | // unknown playlist type |
361 | | - js_log( 'unknown playlist type?' ); |
| 361 | + mw.log( 'unknown playlist type?' ); |
362 | 362 | if ( this.src ) { |
363 | 363 | this.innerHTML = 'error: unknown playlist type at url:<br> ' + this.src; |
364 | 364 | } else { |
— | — | @@ -393,7 +393,7 @@ |
394 | 394 | // inherits all the properties |
395 | 395 | // swaps in the playlist object html/interface div |
396 | 396 | showPlayer:function() { |
397 | | - js_log( 'mvPlaylist:showPlayer: loading:' + this.loading ); |
| 397 | + mw.log( 'mvPlaylist:showPlayer: loading:' + this.loading ); |
398 | 398 | if ( this.loading ) { |
399 | 399 | $j( '#' + this.id ).html( 'loading playlist...' ); |
400 | 400 | if ( this.loading_external_data ) { |
— | — | @@ -414,7 +414,7 @@ |
415 | 415 | } |
416 | 416 | }, |
417 | 417 | renderDisplay:function() { |
418 | | - js_log( 'mvPlaylist:renderDisplay:: track length: ' + this.default_track.getClipCount() ); |
| 418 | + mw.log( 'mvPlaylist:renderDisplay:: track length: ' + this.default_track.getClipCount() ); |
419 | 419 | var _this = this; |
420 | 420 | |
421 | 421 | // append container and videoPlayer; |
— | — | @@ -452,7 +452,7 @@ |
453 | 453 | this.doSmilActions(); |
454 | 454 | }, |
455 | 455 | 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 ); |
457 | 457 | var _this = this; |
458 | 458 | $j.each( this.default_track.clips, function( i, clip ) { |
459 | 459 | var cout = '<div class="clip_container cc_" id="clipDesc_' + clip.id + '" ' + |
— | — | @@ -478,10 +478,10 @@ |
479 | 479 | 'left':"0px" |
480 | 480 | } ); |
481 | 481 | 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() ) |
483 | 483 | $j( '#clipDesc_' + clip.id ).append( clip.embed ); |
484 | 484 | } else { |
485 | | - js_log( 'cound not find: clipDesc_' + clip.id ); |
| 485 | + mw.log( 'cound not find: clipDesc_' + clip.id ); |
486 | 486 | } |
487 | 487 | } ); |
488 | 488 | if ( this.cur_clip ) |
— | — | @@ -496,7 +496,7 @@ |
497 | 497 | // update display & cur_clip: |
498 | 498 | var pl_sum_time = 0; |
499 | 499 | var clip_float_sec = 0; |
500 | | - // js_log('seeking clip: '); |
| 500 | + // mw.log('seeking clip: '); |
501 | 501 | for ( var i in this.default_track.clips ) { |
502 | 502 | var clip = this.default_track.clips[i]; |
503 | 503 | if ( ( clip.getDuration() + pl_sum_time ) >= float_sec ) { |
— | — | @@ -522,7 +522,7 @@ |
523 | 523 | }, |
524 | 524 | updateBaseStatus:function() { |
525 | 525 | var _this = this; |
526 | | - js_log( 'Playlist:updateBaseStatus' ); |
| 526 | + mw.log( 'Playlist:updateBaseStatus' ); |
527 | 527 | |
528 | 528 | $j( '#ptitle_' + this.id ).html( '' + |
529 | 529 | '<b>' + this.title + '</b> ' + |
— | — | @@ -552,13 +552,13 @@ |
553 | 553 | updatePlayHead:function( value ) { |
554 | 554 | // slider is on 1000 scale: |
555 | 555 | 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 ); |
557 | 557 | $j( '#' + this.id + ' .play_head' ).slider( 'value', val ); |
558 | 558 | }, |
559 | 559 | getPlayHeadPos: function( prec_done ) { |
560 | 560 | var _this = this; |
561 | 561 | 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' ); |
563 | 563 | return 0; |
564 | 564 | } |
565 | 565 | var track_len = $j( '#mv_seeker_' + this.id ).css( 'width' ).replace( /px/ , '' ); |
— | — | @@ -585,12 +585,12 @@ |
586 | 586 | // handle offset hack @@todo fix so this is not needed: |
587 | 587 | if ( perc_offset > .66 ) |
588 | 588 | 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)); |
590 | 590 | return perc_offset + ( clip_perc * prec_done ); |
591 | 591 | }, |
592 | 592 | // attempts to load the embed object with the playlist |
593 | 593 | loadEmbedPlaylist: function() { |
594 | | - // js_log('load playlist'); |
| 594 | + // mw.log('load playlist'); |
595 | 595 | }, |
596 | 596 | /** mannages the loading of future clips |
597 | 597 | * called regurally while we are playing clips |
— | — | @@ -609,9 +609,9 @@ |
610 | 610 | if(curBuffredTime < 0) |
611 | 611 | curBuffredTime = 0; |
612 | 612 | |
613 | | - js_log( "curBuffredTime:: " + curBuffredTime ); |
| 613 | + mw.log( "curBuffredTime:: " + curBuffredTime ); |
614 | 614 | 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); |
616 | 616 | |
617 | 617 | for(var inx = this.cur_clip.order + 1; inx < this.default_track.clips.length; inx++ ){ |
618 | 618 | var cClip = this.default_track.getClip( inx ); |
— | — | @@ -638,7 +638,7 @@ |
639 | 639 | var next_clip = this.getNextClip(); |
640 | 640 | |
641 | 641 | 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:' ); |
643 | 643 | this.onClipDone(); |
644 | 644 | return ; |
645 | 645 | } |
— | — | @@ -651,17 +651,17 @@ |
652 | 652 | this.cur_clip.embed.play(); |
653 | 653 | }, |
654 | 654 | onClipDone:function() { |
655 | | - js_log( "pl onClipDone" ); |
| 655 | + mw.log( "pl onClipDone" ); |
656 | 656 | this.cur_clip.embed.stop(); |
657 | 657 | }, |
658 | 658 | updateCurrentClip : function( new_clip , into_perc) { |
659 | | - js_log( 'f:updateCurrentClip:' + new_clip.id ); |
| 659 | + mw.log( 'f:updateCurrentClip:' + new_clip.id ); |
660 | 660 | |
661 | 661 | // keep the active play clip in sync (stop the other clip) |
662 | 662 | if ( this.cur_clip ) { |
663 | 663 | // make sure we are not switching to the current |
664 | 664 | 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' ); |
666 | 666 | return false; |
667 | 667 | } |
668 | 668 | |
— | — | @@ -693,7 +693,7 @@ |
694 | 694 | // advance the playhead to the previous clip |
695 | 695 | var prev_clip = this.getPrevClip(); |
696 | 696 | 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" ); |
698 | 698 | prev_clip = this.start_clip; |
699 | 699 | } |
700 | 700 | // @@todo we could do something fancy like use playlist for sets of clips where supported. |
— | — | @@ -706,7 +706,7 @@ |
707 | 707 | this.updateCurrentClip( prev_clip ); |
708 | 708 | this.cur_clip.embed.play(); |
709 | 709 | } else { |
710 | | - js_log( 'do prev hard embed swap' ); |
| 710 | + mw.log( 'do prev hard embed swap' ); |
711 | 711 | this.switchPlayingClip( prev_clip ); |
712 | 712 | } |
713 | 713 | }, |
— | — | @@ -715,7 +715,7 @@ |
716 | 716 | $j( '#mv_ebct_' + this.id ).empty(); |
717 | 717 | new_clip.embed.width = this.width; |
718 | 718 | 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()); |
720 | 720 | $j( '#mv_ebct_' + this.id ).html( new_clip.embed.getEmbedObj() ); |
721 | 721 | this.cur_clip = new_clip; |
722 | 722 | // run js code: |
— | — | @@ -724,7 +724,7 @@ |
725 | 725 | // playlist play |
726 | 726 | play: function() { |
727 | 727 | var _this = this; |
728 | | - js_log( 'pl play' ); |
| 728 | + mw.log( 'pl play' ); |
729 | 729 | // hide the playlist play button: |
730 | 730 | $j( this.id + ' .play-btn-large' ).hide(); |
731 | 731 | |
— | — | @@ -743,19 +743,19 @@ |
744 | 744 | // navtive support: |
745 | 745 | // * pre-loads clips |
746 | 746 | // * 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)'); |
748 | 748 | // @@todo pre-load each clip: |
749 | 749 | // play all active clips (playlist_swap_loader can have more than one clip active) |
750 | 750 | $j.each( this.activeClipList.getClipList(), function( inx, clip ) { |
751 | 751 | clip.embed.play(); |
752 | 752 | } ); |
753 | 753 | } else if ( this.cur_clip.embed.supports['playlist_driver'] ) { |
754 | | - // js_log('playlist_driver'); |
| 754 | + // mw.log('playlist_driver'); |
755 | 755 | // embedObject is feed the playlist info directly and manages next/prev |
756 | 756 | this.cur_clip.embed.playMovieAt( this.cur_clip.order ); |
757 | 757 | } else { |
758 | 758 | // not much playlist support just play the first clip: |
759 | | - // js_log('basic play'); |
| 759 | + // mw.log('basic play'); |
760 | 760 | // play cur_clip |
761 | 761 | this.cur_clip.embed.play(); |
762 | 762 | } |
— | — | @@ -773,11 +773,11 @@ |
774 | 774 | this.cur_clip.embed.toggleMute(); |
775 | 775 | }, |
776 | 776 | pause:function() { |
777 | | - // js_log('f:pause: playlist'); |
| 777 | + // mw.log('f:pause: playlist'); |
778 | 778 | var ct = new Date(); |
779 | 779 | this.pauseTime = this.currentTime; |
780 | 780 | this.paused = true; |
781 | | - // js_log('pause time: '+ this.pauseTime + ' call embed pause:'); |
| 781 | + // mw.log('pause time: '+ this.pauseTime + ' call embed pause:'); |
782 | 782 | |
783 | 783 | // pause all the active clips: |
784 | 784 | $j.each( this.activeClipList.getClipList(), function( inx, clip ) { |
— | — | @@ -798,10 +798,10 @@ |
799 | 799 | $j( '#volume_bar_' + this_id ).slider( 'value', 0 ); |
800 | 800 | this.updateVolumen( 0 ); |
801 | 801 | } |
802 | | - js_log( 'f:toggleMute::' + this.muted ); |
| 802 | + mw.log( 'f:toggleMute::' + this.muted ); |
803 | 803 | }, |
804 | 804 | 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' ); |
806 | 806 | }, |
807 | 807 | fullscreen:function() { |
808 | 808 | this.cur_clip.embed.fullscreen(); |
— | — | @@ -809,7 +809,7 @@ |
810 | 810 | // playlist stops playback for the current clip (and resets state for start clips) |
811 | 811 | stop:function() { |
812 | 812 | 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); |
814 | 814 | //if start clip |
815 | 815 | if(this.start_clip.id!=this.cur_clip.id){ |
816 | 816 | //restore clipDesc visibility & hide desc for start clip: |
— | — | @@ -858,7 +858,7 @@ |
859 | 859 | // FIXME still some issues with "stoping" and reseting the playlist |
860 | 860 | }, |
861 | 861 | 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 ); |
863 | 863 | var _this = this; |
864 | 864 | |
865 | 865 | var time = v * this.getDuration() |
— | — | @@ -872,7 +872,7 @@ |
873 | 873 | return ''; |
874 | 874 | }, |
875 | 875 | setCurrentTime: function( time, callback ) { |
876 | | - js_log( 'pl:setCurrentTime:' + time ); |
| 876 | + mw.log( 'pl:setCurrentTime:' + time ); |
877 | 877 | var _this = this; |
878 | 878 | _this.currentTime = time; |
879 | 879 | |
— | — | @@ -903,9 +903,9 @@ |
904 | 904 | for ( var i in _this.default_track.clips ) { |
905 | 905 | var clip = _this.default_track.clips[i]; |
906 | 906 | 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); |
908 | 908 | 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); |
910 | 910 | var relative_perc = ( pt - perc_offset ) / ( next_perc_offset - perc_offset ); |
911 | 911 | // update the current clip: |
912 | 912 | _this.updateCurrentClip( clip, relative_perc ); |
— | — | @@ -940,12 +940,12 @@ |
941 | 941 | var cur_pixle = 0; |
942 | 942 | // set up _this |
943 | 943 | |
944 | | - // js_log("do play head total dur: "+pl_duration ); |
| 944 | + // mw.log("do play head total dur: "+pl_duration ); |
945 | 945 | $j.each( this.default_track.clips, function( i, clip ) { |
946 | 946 | // (use getSoloDuration to not include transitions and such) |
947 | 947 | var perc = ( clip.getSoloDuration() / pl_duration ); |
948 | 948 | 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); |
950 | 950 | // var pwidth = Math.round( perc * _this.track_len - (_this.mv_seeker_width*perc) ); |
951 | 951 | |
952 | 952 | // add the buffer child indicator: |
— | — | @@ -967,13 +967,13 @@ |
968 | 968 | |
969 | 969 | $j( '#' + _this.id + ' .play_head' ).append( barHtml ); |
970 | 970 | |
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); |
972 | 972 | cur_pixle += pwidth; |
973 | 973 | } ); |
974 | 974 | }, |
975 | 975 | // @@todo currently not really in use |
976 | 976 | setUpHover:function() { |
977 | | - js_log( 'Setup Hover' ); |
| 977 | + mw.log( 'Setup Hover' ); |
978 | 978 | // set up hover for prev,next |
979 | 979 | var th = 50; |
980 | 980 | var tw = th * this.pl_layout.clip_aspect; |
— | — | @@ -981,10 +981,10 @@ |
982 | 982 | $j( '#mv_prev_link_' + _this.id + ',#mv_next_link_' + _this.id ).hover( function() { |
983 | 983 | var clip = ( this.id == 'mv_prev_link_' + _this.id ) ? _this.getPrevClip() : _this.getNextClip(); |
984 | 984 | if ( !clip ) |
985 | | - return js_log( 'missing clip for Hover' ); |
| 985 | + return mw.log( 'missing clip for Hover' ); |
986 | 986 | // get the position of #mv_perv|next_link: |
987 | 987 | 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); |
989 | 989 | $j( "body" ).append( '<div id="mv_Athub" style="position:absolute;' + |
990 | 990 | 'top:' + loc.y + 'px;left:' + loc.x + 'px;width:' + tw + 'px;height:' + th + 'px;">' + |
991 | 991 | '<img style="border:solid 2px ' + clip.getColor() + ';position:absolute;top:0px;left:0px;" width="' + tw + '" height="' + th + '" src="' + clip.img + '"/>' + |
— | — | @@ -1022,7 +1022,7 @@ |
1023 | 1023 | } else { |
1024 | 1024 | var track = this.tracks[ clipObj.track_id ] |
1025 | 1025 | } |
1026 | | - js_log( 'add clip:' + clipObj.id + ' to track: at:' + pos ); |
| 1026 | + mw.log( 'add clip:' + clipObj.id + ' to track: at:' + pos ); |
1027 | 1027 | // set the first clip to current (maybe deprecated ) |
1028 | 1028 | if ( clipObj.order == 0 ) { |
1029 | 1029 | if ( !this.cur_clip )this.cur_clip = clipObj; |
— | — | @@ -1032,9 +1032,9 @@ |
1033 | 1033 | swapClipDesc: function( req_clipID, callback ) { |
1034 | 1034 | // hide all but the requested |
1035 | 1035 | var _this = this; |
1036 | | - js_log( 'r:' + req_clipID + ' cur:' + _this.id ); |
| 1036 | + mw.log( 'r:' + req_clipID + ' cur:' + _this.id ); |
1037 | 1037 | if ( req_clipID == _this.cur_clip.id ) { |
1038 | | - js_log( 'no swap to same clip' ); |
| 1038 | + mw.log( 'no swap to same clip' ); |
1039 | 1039 | } else { |
1040 | 1040 | // fade out clips |
1041 | 1041 | req_clip = null; |
— | — | @@ -1058,7 +1058,7 @@ |
1059 | 1059 | }, |
1060 | 1060 | // this is pretty outdated: |
1061 | 1061 | getPLControls: function() { |
1062 | | - js_log( 'getPL cont' ); |
| 1062 | + mw.log( 'getPL cont' ); |
1063 | 1063 | return '<a id="mv_prev_link_' + this.id + '" title="Previus Clip" onclick="document.getElementById(\'' + this.id + '\').playPrev();return false;" href="#">' + |
1064 | 1064 | getTransparentPng( { id:'mv_prev_btn_' + this.id, style:'float:left', width:'27', height:'27', border:"0", |
1065 | 1065 | src: mw.getConfig( 'skin_img_path' ) + 'vid_prev_sm.png' } ) + |
— | — | @@ -1120,14 +1120,14 @@ |
1121 | 1121 | for ( var i in o ) { |
1122 | 1122 | this[i] = o[i]; |
1123 | 1123 | }; |
1124 | | - js_log( 'id is: ' + this.id ); |
| 1124 | + mw.log( 'id is: ' + this.id ); |
1125 | 1125 | }, |
1126 | 1126 | // setup the embed object: |
1127 | 1127 | setUpEmbedObj:function() { |
1128 | | - js_log( 'mvClip:setUpEmbedObj()' ); |
| 1128 | + mw.log( 'mvClip:setUpEmbedObj()' ); |
1129 | 1129 | |
1130 | 1130 | 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?'); |
1132 | 1132 | // set up the pl_mwEmbed object: |
1133 | 1133 | var init_pl_embed = { id:'e_' + this.id, |
1134 | 1134 | pc:this, // parent clip |
— | — | @@ -1152,12 +1152,12 @@ |
1153 | 1153 | |
1154 | 1154 | this.embed = new PlMvEmbed( init_pl_embed ); |
1155 | 1155 | |
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); |
1159 | 1159 | }, |
1160 | 1160 | doAdjust:function( side, delta ) { |
1161 | | - js_log( "f:doAdjust: " + side + ' , ' + delta ); |
| 1161 | + mw.log( "f:doAdjust: " + side + ' , ' + delta ); |
1162 | 1162 | if ( this.embed ) { |
1163 | 1163 | if ( side == 'start' ) { |
1164 | 1164 | var startOffset = parseInt( this.embed.startOffset ) + parseInt( delta * -1 ); |
— | — | @@ -1169,7 +1169,7 @@ |
1170 | 1170 | // update everything: |
1171 | 1171 | this.pp.refresh(); |
1172 | 1172 | /*var base_src = this.src.substr(0,this.src.indexOf('?')); |
1173 | | - js_log("delta:"+ delta); |
| 1173 | + mw.log("delta:"+ delta); |
1174 | 1174 | if(side=='start'){ |
1175 | 1175 | //since we adjust start invert the delta: |
1176 | 1176 | var startOffset =parseInt(this.embed.startOffset/1000)+parseInt(delta*-1); |
— | — | @@ -1201,7 +1201,7 @@ |
1202 | 1202 | // output the detail view: |
1203 | 1203 | // @@todo |
1204 | 1204 | /*getDetail:function(){ |
1205 | | - //js_log('get detail:' + this.pp.title); |
| 1205 | + //mw.log('get detail:' + this.pp.title); |
1206 | 1206 | var th=Math.round( this.pl_layout.clip_desc * this.pp.height ); |
1207 | 1207 | var tw=Math.round( th * this.pl_layout.clip_aspect ); |
1208 | 1208 | |
— | — | @@ -1216,7 +1216,7 @@ |
1217 | 1217 | |
1218 | 1218 | $j(this.embed).css({ 'position':"absolute",'top':"0px", 'left':"0px"}); |
1219 | 1219 | |
1220 | | - //js_log('append child to:#clipDesc_'+this.id); |
| 1220 | + //mw.log('append child to:#clipDesc_'+this.id); |
1221 | 1221 | if($j('#clipDesc_'+this.id).get(0)){ |
1222 | 1222 | $j('#clipDesc_'+this.id).get(0).appendChild(this.embed); |
1223 | 1223 | |
— | — | @@ -1235,7 +1235,7 @@ |
1236 | 1236 | return 'untitled clip ' + this.order; |
1237 | 1237 | }, |
1238 | 1238 | getClipImg:function( startOffset, size ) { |
1239 | | - js_log( 'f:getClipImg ' + startOffset + ' s:' + size ); |
| 1239 | + mw.log( 'f:getClipImg ' + startOffset + ' s:' + size ); |
1240 | 1240 | if ( !this.img ) { |
1241 | 1241 | return mv_default_thumb_url; |
1242 | 1242 | } else { |
— | — | @@ -1244,9 +1244,9 @@ |
1245 | 1245 | } else { |
1246 | 1246 | // if a metavid image (has request parameters) use size and time args |
1247 | 1247 | if ( this.img.indexOf( '?' ) != -1 ) { |
1248 | | - js_log( 'get with offset: ' + startOffset ); |
| 1248 | + mw.log( 'get with offset: ' + startOffset ); |
1249 | 1249 | var time = mw.seconds2npt( startOffset + ( this.embed.startOffset / 1000 ) ); |
1250 | | - js_log( "time is: " + time ); |
| 1250 | + mw.log( "time is: " + time ); |
1251 | 1251 | this.img = this.img.replace( /t\=[^&]*/gi, "t=" + time ); |
1252 | 1252 | if ( this.img.indexOf( '&size=' ) != -1 ) { |
1253 | 1253 | this.img = this.img.replace( /size=[^&]*/gi, "size=" + size ); |
— | — | @@ -1259,7 +1259,7 @@ |
1260 | 1260 | } |
1261 | 1261 | }, |
1262 | 1262 | 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)] ); |
1264 | 1264 | var num = this.id.substr( this.id.length - 1, 1 ); |
1265 | 1265 | if ( !isNaN( num ) ) { |
1266 | 1266 | num = num.charCodeAt( 0 ); |
— | — | @@ -1270,7 +1270,7 @@ |
1271 | 1271 | } |
1272 | 1272 | /* mwEmbed extensions for playlists */ |
1273 | 1273 | var PlMvEmbed = function( vid_init ) { |
1274 | | - // js_log('PlMvEmbed: '+ vid_init.id); |
| 1274 | + // mw.log('PlMvEmbed: '+ vid_init.id); |
1275 | 1275 | // create the div container |
1276 | 1276 | var ve = document.createElement( 'div' ); |
1277 | 1277 | // extend ve with all this |
— | — | @@ -1280,7 +1280,7 @@ |
1281 | 1281 | ve[method] = this[method]; |
1282 | 1282 | } |
1283 | 1283 | } |
1284 | | - js_log( 've src len:' + ve.media_element.sources.length ); |
| 1284 | + mw.log( 've src len:' + ve.media_element.sources.length ); |
1285 | 1285 | return ve; |
1286 | 1286 | } |
1287 | 1287 | // all the overwritten and new methods for playlist extension of baseEmbed |
— | — | @@ -1313,12 +1313,12 @@ |
1314 | 1314 | } |
1315 | 1315 | }, |
1316 | 1316 | onClipDone:function() { |
1317 | | - js_log( 'pl onClipDone (should go to next)' ); |
| 1317 | + mw.log( 'pl onClipDone (should go to next)' ); |
1318 | 1318 | // go to next in playlist: |
1319 | 1319 | this.pc.pp.playNext(); |
1320 | 1320 | }, |
1321 | 1321 | stop:function() { |
1322 | | - js_log( 'pl:do stop' ); |
| 1322 | + mw.log( 'pl:do stop' ); |
1323 | 1323 | // set up convenience pointer to parent playlist |
1324 | 1324 | var _this = this.pc.pp; |
1325 | 1325 | |
— | — | @@ -1332,7 +1332,7 @@ |
1333 | 1333 | this.showPlayer(); |
1334 | 1334 | }, |
1335 | 1335 | play:function() { |
1336 | | - // js_log('pl eb play'); |
| 1336 | + // mw.log('pl eb play'); |
1337 | 1337 | var _this = this.pc.pp; |
1338 | 1338 | // check if we are already playing |
1339 | 1339 | if ( !this.thumbnail_disp ) { |
— | — | @@ -1363,7 +1363,7 @@ |
1364 | 1364 | // status updates handled by playlist obj |
1365 | 1365 | }, |
1366 | 1366 | updatePlayHead:function( value ) { |
1367 | | - //js_log( 'PlMvEmbed:updatePlayHead:' + value ); |
| 1367 | + //mw.log( 'PlMvEmbed:updatePlayHead:' + value ); |
1368 | 1368 | // updatePlayHead handled by playlist obj |
1369 | 1369 | } |
1370 | 1370 | } |
— | — | @@ -1376,17 +1376,17 @@ |
1377 | 1377 | // for each line not # add as clip |
1378 | 1378 | var inx = 0; |
1379 | 1379 | var this_pl = this; |
1380 | | - // js_log('data:'+ this.data.toString()); |
| 1380 | + // mw.log('data:'+ this.data.toString()); |
1381 | 1381 | $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); |
1383 | 1383 | if ( n.charAt( 0 ) != '#' ) { |
1384 | 1384 | if ( n.length > 3 ) { |
1385 | 1385 | // @@todo make sure its a valid url |
1386 | | - // js_log('add url: '+i + ' '+ n); |
| 1386 | + // mw.log('add url: '+i + ' '+ n); |
1387 | 1387 | var cur_clip = new mvClip( { type:'srcClip', id:'p_' + this_pl.id + '_c_' + inx, pp:this_pl, src:n, order:inx } ); |
1388 | 1388 | // setup the embed object |
1389 | 1389 | 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 ); |
1391 | 1391 | this_pl.addCliptoTrack( cur_clip ); |
1392 | 1392 | inx++; |
1393 | 1393 | } |
— | — | @@ -1406,7 +1406,7 @@ |
1407 | 1407 | tmpElm = this.data.getElementsByTagName( properties[i] )[0]; |
1408 | 1408 | if ( tmpElm ) { |
1409 | 1409 | this[i] = tmpElm.childNodes[0].nodeValue; |
1410 | | - // js_log('set '+i+' to '+this[i]); |
| 1410 | + // mw.log('set '+i+' to '+this[i]); |
1411 | 1411 | } |
1412 | 1412 | } |
1413 | 1413 | // image src is nested in itunes rss: |
— | — | @@ -1426,7 +1426,7 @@ |
1427 | 1427 | tmpElm = clips[i].getElementsByTagName( properties[j] )[0]; |
1428 | 1428 | if ( tmpElm != null ) { |
1429 | 1429 | 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]); |
1431 | 1431 | } |
1432 | 1432 | } |
1433 | 1433 | // image is nested |
— | — | @@ -1453,36 +1453,36 @@ |
1454 | 1454 | */ |
1455 | 1455 | var xspfPlaylist = { |
1456 | 1456 | doParse:function() { |
1457 | | - // js_log('do xsfp parse: '+ this.data.innerHTML); |
| 1457 | + // mw.log('do xsfp parse: '+ this.data.innerHTML); |
1458 | 1458 | var properties = { title:'title', linkback:'info', |
1459 | 1459 | author:'creator', desc:'annotation', |
1460 | 1460 | poster:'image', date:'date' }; |
1461 | 1461 | var tmpElm = null; |
1462 | 1462 | // 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); |
1464 | 1464 | for ( i in properties ) { |
1465 | | - js_log( 'on property: ' + i ); |
| 1465 | + mw.log( 'on property: ' + i ); |
1466 | 1466 | tmpElm = this.data.getElementsByTagName( properties[i] )[0]; |
1467 | 1467 | if ( tmpElm ) { |
1468 | 1468 | if ( tmpElm.childNodes[0] ) { |
1469 | 1469 | 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] ); |
1471 | 1471 | } |
1472 | 1472 | } |
1473 | 1473 | } |
1474 | 1474 | var clips = this.data.getElementsByTagName( "track" ); |
1475 | | - js_log( 'found clips:' + clips.length ); |
| 1475 | + mw.log( 'found clips:' + clips.length ); |
1476 | 1476 | // add any clip specific properties |
1477 | 1477 | properties.src = 'location'; |
1478 | 1478 | for ( var i = 0; i < clips.length; i++ ) { |
1479 | 1479 | 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); |
1481 | 1481 | for ( var j in properties ) { |
1482 | 1482 | tmpElm = clips[i].getElementsByTagName( properties[j] )[0]; |
1483 | 1483 | if ( tmpElm != null ) { |
1484 | 1484 | if ( tmpElm.childNodes.length != 0 ) { |
1485 | 1485 | 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] ); |
1487 | 1487 | } |
1488 | 1488 | } |
1489 | 1489 | } |
— | — | @@ -1500,7 +1500,7 @@ |
1501 | 1501 | // add the current clip to the clip list |
1502 | 1502 | this.addCliptoTrack( cur_clip ); |
1503 | 1503 | } |
1504 | | - // js_log('done with parse'); |
| 1504 | + // mw.log('done with parse'); |
1505 | 1505 | return true; |
1506 | 1506 | } |
1507 | 1507 | } |
— | — | @@ -1509,13 +1509,13 @@ |
1510 | 1510 | *****************************/ |
1511 | 1511 | /*playlist driver extensions to the playlist object*/ |
1512 | 1512 | mvPlayList.prototype.monitor = function() { |
1513 | | - // js_log('pl:monitor'); |
| 1513 | + // mw.log('pl:monitor'); |
1514 | 1514 | // if paused stop updates |
1515 | 1515 | if ( this.paused ) { |
1516 | 1516 | // clearInterval( this.smil_monitorTimerId ); |
1517 | 1517 | return ; |
1518 | 1518 | } |
1519 | | - // js_log("pl check: " + this.currentTime + ' > '+this.getDuration()); |
| 1519 | + // mw.log("pl check: " + this.currentTime + ' > '+this.getDuration()); |
1520 | 1520 | // check if we should be done: |
1521 | 1521 | if ( this.currentTime > this.getDuration() ) |
1522 | 1522 | this.stop(); |
— | — | @@ -1549,7 +1549,7 @@ |
1550 | 1550 | // @@todo could be lazy loaded if necessary |
1551 | 1551 | mvPlayList.prototype.doSmilActions = function( callback ) { |
1552 | 1552 | 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 ); |
1554 | 1554 | var offSetTime = 0; // offset time should let us start a transition later on if we have to. |
1555 | 1555 | var _clip = this.cur_clip; // setup a local pointer to cur_clip |
1556 | 1556 | |
— | — | @@ -1562,7 +1562,7 @@ |
1563 | 1563 | if ( _clip.dur <= _clip.embed.currentTime |
1564 | 1564 | && _clip.order != _clip.pp.getClipCount() - 1 ) { |
1565 | 1565 | // 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 ) + |
1567 | 1567 | ' smil dur: ' + _clip.dur + ' <= curTime: ' + _clip.embed.currentTime + ' go to next clip..' ); |
1568 | 1568 | // do a _play next: |
1569 | 1569 | _clip.pp.playNext(); |
— | — | @@ -1588,7 +1588,7 @@ |
1589 | 1589 | eval( 'var tObj = _clip.' + tid ); |
1590 | 1590 | if ( !tObj ) |
1591 | 1591 | 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); |
1593 | 1593 | // Check if we are in range: |
1594 | 1594 | if ( tid == 'transIn' ) |
1595 | 1595 | in_range = ( _clip.embed.currentTime <= tObj.dur ) ? true : false; |
— | — | @@ -1609,13 +1609,13 @@ |
1610 | 1610 | callback ); |
1611 | 1611 | } |
1612 | 1612 | } else if ( tObj.animation_state == 0 ) { |
1613 | | - js_log( 'init/run_transition ' ); |
| 1613 | + mw.log( 'init/run_transition ' ); |
1614 | 1614 | tObj.run_transition(); |
1615 | 1615 | } |
1616 | 1616 | } else { |
1617 | 1617 | // Close up transition if done & still onDispaly |
1618 | 1618 | 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 ); |
1620 | 1620 | mvTransLib.doCloseTransition( tObj ); |
1621 | 1621 | } |
1622 | 1622 | } |
— | — | @@ -1641,24 +1641,24 @@ |
1642 | 1642 | * @param offSetTime default value 0 if we need to start rendering from a given time |
1643 | 1643 | */ |
1644 | 1644 | doInitTransition:function( tObj ) { |
1645 | | - js_log( 'mvTransLib:f:doInitTransition' ); |
| 1645 | + mw.log( 'mvTransLib:f:doInitTransition' ); |
1646 | 1646 | if ( !tObj.type ) { |
1647 | | - js_log( 'transition is missing type attribute' ); |
| 1647 | + mw.log( 'transition is missing type attribute' ); |
1648 | 1648 | return false; |
1649 | 1649 | } |
1650 | 1650 | |
1651 | 1651 | if ( !tObj.subtype ) { |
1652 | | - js_log( 'transition is missing subtype attribute' ); |
| 1652 | + mw.log( 'transition is missing subtype attribute' ); |
1653 | 1653 | return false; |
1654 | 1654 | } |
1655 | 1655 | |
1656 | 1656 | 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 ); |
1658 | 1658 | return false; |
1659 | 1659 | } |
1660 | 1660 | |
1661 | 1661 | 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 ); |
1663 | 1663 | return false; |
1664 | 1664 | } |
1665 | 1665 | |
— | — | @@ -1670,7 +1670,7 @@ |
1671 | 1671 | var other_pClip = tObj.pClip.pp.getNextClip(); |
1672 | 1672 | |
1673 | 1673 | 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' ); |
1675 | 1675 | // if not sliding start playback: |
1676 | 1676 | if ( !tObj.pClip.pp.userSlide && !tObj.pClip.pp.paused) { |
1677 | 1677 | other_pClip.embed.play(); |
— | — | @@ -1686,13 +1686,13 @@ |
1687 | 1687 | } |
1688 | 1688 | |
1689 | 1689 | // 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 ); |
1691 | 1691 | this['type'][tObj.type][tObj.subtype].init( tObj ); |
1692 | 1692 | }, |
1693 | 1693 | doCloseTransition:function( tObj ) { |
1694 | 1694 | if ( tObj.subtype == 'crossfade' ) { |
1695 | 1695 | // close up crossfade |
1696 | | - js_log( "close up crossfade" ); |
| 1696 | + mw.log( "close up crossfade" ); |
1697 | 1697 | } else { |
1698 | 1698 | $j( '#' + tObj.overlay_selector_id ).remove(); |
1699 | 1699 | } |
— | — | @@ -1701,7 +1701,7 @@ |
1702 | 1702 | }, |
1703 | 1703 | getOverlaySelector:function( tObj ) { |
1704 | 1704 | 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 ); |
1706 | 1706 | // make sure overlay_selector_id not already here: |
1707 | 1707 | if ( $j( '#' + overlay_selector_id ).length == 0 ) { |
1708 | 1708 | $j( '#videoPlayer_' + tObj.pClip.embed.id ).prepend( '' + |
— | — | @@ -1724,7 +1724,7 @@ |
1725 | 1725 | $j( '#' + tObj.overlay_selector_id ).show(); |
1726 | 1726 | |
1727 | 1727 | // do update: |
1728 | | - /* js_log('doing update for: '+ tObj.pClip.id + |
| 1728 | + /* mw.log('doing update for: '+ tObj.pClip.id + |
1729 | 1729 | ' type:' + tObj.transAttrType + |
1730 | 1730 | ' t_type:'+ tObj.type + |
1731 | 1731 | ' subypte:'+ tObj.subtype + |
— | — | @@ -1744,11 +1744,11 @@ |
1745 | 1745 | fadeFromColor: { |
1746 | 1746 | 'attr' : ['fadeColor'], |
1747 | 1747 | '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); |
1749 | 1749 | if ( !tObj.fadeColor ) |
1750 | | - js_log( 'missing fadeColor' ); |
| 1750 | + mw.log( 'missing fadeColor' ); |
1751 | 1751 | 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 ); |
1753 | 1753 | } |
1754 | 1754 | // set the initial state |
1755 | 1755 | $j( '#' + tObj.overlay_selector_id ).css( { |
— | — | @@ -1757,7 +1757,7 @@ |
1758 | 1758 | } ); |
1759 | 1759 | }, |
1760 | 1760 | 'u' : function( tObj, percent ) { |
1761 | | - // js_log(':fadeFromColor:update: '+ percent); |
| 1761 | + // mw.log(':fadeFromColor:update: '+ percent); |
1762 | 1762 | // fade from color (invert the percent) |
1763 | 1763 | var percent = 1 - percent; |
1764 | 1764 | $j( '#' + tObj.overlay_selector_id ).css( { |
— | — | @@ -1769,9 +1769,9 @@ |
1770 | 1770 | crossfade: { |
1771 | 1771 | "attr" : [], |
1772 | 1772 | "init" : function( tObj ) { |
1773 | | - js_log( 'f:crossfade: ' + tObj.overlay_selector_id ); |
| 1773 | + mw.log( 'f:crossfade: ' + tObj.overlay_selector_id ); |
1774 | 1774 | 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 ); |
1776 | 1776 | |
1777 | 1777 | // set the initial state show the zero opacity animation |
1778 | 1778 | $j( '#' + tObj.overlay_selector_id ).css( { 'opacity':0 } ).show(); |
— | — | @@ -1844,7 +1844,7 @@ |
1845 | 1845 | * the main animation loop called every MV_ANIMATION_CB_RATE or 34ms ~around 30frames per second~ |
1846 | 1846 | */ |
1847 | 1847 | run_transition:function() { |
1848 | | - // js_log('f:run_transition:' + this.interValCount); |
| 1848 | + // mw.log('f:run_transition:' + this.interValCount); |
1849 | 1849 | |
1850 | 1850 | // update the time from the video if native: |
1851 | 1851 | if ( typeof this.pClip.embed.vid != 'undefined' ) { |
— | — | @@ -1881,16 +1881,16 @@ |
1882 | 1882 | - ( this.pClip.dur - this.dur ) |
1883 | 1883 | ) / this.dur ; |
1884 | 1884 | |
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 + |
1886 | 1886 | ' / ' + this.dur + ' = ' + percentage ); |
1887 | 1887 | */ |
1888 | 1888 | |
1889 | | - // js_log('cur percentage of transition: '+percentage); |
| 1889 | + // mw.log('cur percentage of transition: '+percentage); |
1890 | 1890 | // update state based on current time + cur_time_offset (for now just use pClip.embed.currentTime) |
1891 | 1891 | mvTransLib.doUpdate( this, percentage ); |
1892 | 1892 | |
1893 | 1893 | if ( percentage >= 1 ) { |
1894 | | - js_log( "transition done update with percentage " + percentage ); |
| 1894 | + mw.log( "transition done update with percentage " + percentage ); |
1895 | 1895 | this.animation_state = 2; |
1896 | 1896 | clearInterval( this.timerId ); |
1897 | 1897 | mvTransLib.doCloseTransition( this ) |
— | — | @@ -1926,7 +1926,7 @@ |
1927 | 1927 | transitions: { }, |
1928 | 1928 | doParse:function() { |
1929 | 1929 | var _this = this; |
1930 | | - js_log( 'f:doParse smilPlaylist' ); |
| 1930 | + mw.log( 'f:doParse smilPlaylist' ); |
1931 | 1931 | // @@todo get/parse meta that we are interested in: |
1932 | 1932 | var meta_tags = this.data.getElementsByTagName( 'meta' ); |
1933 | 1933 | var metaNames = { |
— | — | @@ -1938,7 +1938,7 @@ |
1939 | 1939 | 'mTouchedTime':"" |
1940 | 1940 | }; |
1941 | 1941 | $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') ); |
1943 | 1943 | if ( $j( meta_elm ).attr( 'name' ) in metaNames ) { |
1944 | 1944 | _this[ $j( meta_elm ).attr( 'name' ) ] = $j( meta_elm ).attr( 'content' ); |
1945 | 1945 | } |
— | — | @@ -1954,10 +1954,10 @@ |
1955 | 1955 | if ( $j( trans_elm ).attr( "id" ) ) { |
1956 | 1956 | _this.transitions[ $j( trans_elm ).attr( "id" )] = new transitionObj( trans_elm ); |
1957 | 1957 | } else { |
1958 | | - js_log( 'skipping transition: (missing id) ' + trans_elm ); |
| 1958 | + mw.log( 'skipping transition: (missing id) ' + trans_elm ); |
1959 | 1959 | } |
1960 | 1960 | } ); |
1961 | | - js_log( 'loaded transitions:' + _this.transitions.length ); |
| 1961 | + mw.log( 'loaded transitions:' + _this.transitions.length ); |
1962 | 1962 | |
1963 | 1963 | // Add seq (latter we will have support more than one seq tag) / more than one "track" |
1964 | 1964 | var seq_tags = this.data.getElementsByTagName( 'seq' ); |
— | — | @@ -1966,7 +1966,7 @@ |
1967 | 1967 | // get all the clips for the given seq: |
1968 | 1968 | $j.each( seq_elm.childNodes, function( i, mediaElement ) { |
1969 | 1969 | // ~complex~ @@todo to handle a lot like "switch" "region" etc |
1970 | | - // js_log('process: ' + mediaElemnt.tagName); |
| 1970 | + // mw.log('process: ' + mediaElemnt.tagName); |
1971 | 1971 | if ( typeof mediaElement.tagName != 'undefined' ) { |
1972 | 1972 | if ( _this.tryAddMedia( mediaElement, inx ) ) { |
1973 | 1973 | inx++; |
— | — | @@ -1974,11 +1974,11 @@ |
1975 | 1975 | } |
1976 | 1976 | } ); |
1977 | 1977 | } ); |
1978 | | - js_log( "done proc seq tags" ); |
| 1978 | + mw.log( "done proc seq tags" ); |
1979 | 1979 | return true; |
1980 | 1980 | }, |
1981 | 1981 | tryAddMediaObj:function( mConfig, order, track_id ) { |
1982 | | - js_log( 'tryAddMediaObj::' ); |
| 1982 | + mw.log( 'tryAddMediaObj::' ); |
1983 | 1983 | var mediaElement = document.createElement( 'div' ); |
1984 | 1984 | for ( var i = 0; i < mv_smil_ref_supported_attributes.length; i++ ) { |
1985 | 1985 | var attr = mv_smil_ref_supported_attributes[i]; |
— | — | @@ -1988,7 +1988,7 @@ |
1989 | 1989 | this.tryAddMedia( mediaElement, order, track_id ); |
1990 | 1990 | }, |
1991 | 1991 | tryAddMedia:function( mediaElement, order, track_id ) { |
1992 | | - js_log( 'SMIL:tryAddMedia:' + mediaElement ); |
| 1992 | + mw.log( 'SMIL:tryAddMedia:' + mediaElement ); |
1993 | 1993 | |
1994 | 1994 | var _this = this; |
1995 | 1995 | // Set up basic mvSMILClip send it the mediaElemnt & mvClip init: |
— | — | @@ -2073,7 +2073,7 @@ |
2074 | 2074 | |
2075 | 2075 | if ( sClipElm.firstChild ) { |
2076 | 2076 | 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'] ); |
2078 | 2078 | } |
2079 | 2079 | // debugger; |
2080 | 2080 | // mwEmbed specific property: |
— | — | @@ -2147,7 +2147,7 @@ |
2148 | 2148 | if ( this.transOut ) |
2149 | 2149 | fulldur -= this.transOut.getDuration(); |
2150 | 2150 | |
2151 | | - // js_log("getSoloDuration:: td: " + this.getDuration() + ' sd:' + fulldur); |
| 2151 | + // mw.log("getSoloDuration:: td: " + this.getDuration() + ' sd:' + fulldur); |
2152 | 2152 | return fulldur; |
2153 | 2153 | }, |
2154 | 2154 | // Get the duration of the original media asset (usefull for bounding setting of in-out-points) |
— | — | @@ -2246,14 +2246,14 @@ |
2247 | 2247 | return elmObj; |
2248 | 2248 | }, |
2249 | 2249 | 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 ); |
2251 | 2251 | if ( typeof pos == 'undefined' ) |
2252 | 2252 | pos = this.clips.length; |
2253 | 2253 | // get everything after pos |
2254 | 2254 | this.clips.splice( pos, 0, clipObj ); |
2255 | 2255 | // keep the clip order values accurate: |
2256 | 2256 | this.reOrderClips(); |
2257 | | - js_log( "did add now cLen: " + this.clips.length ); |
| 2257 | + mw.log( "did add now cLen: " + this.clips.length ); |
2258 | 2258 | }, |
2259 | 2259 | getClip:function( inx ) { |
2260 | 2260 | if ( !this.clips[inx] ) |
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/seqRemoteSearchDriver.js |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | sequence_add_target:false, |
12 | 12 | init:function( mySequence ) { |
13 | 13 | var _this = this; |
14 | | - js_log( "init:seqRemoteSearchDriver" ); |
| 14 | + mw.log( "init:seqRemoteSearchDriver" ); |
15 | 15 | |
16 | 16 | // Setup remote search driver with a seq parent: |
17 | 17 | this.pSeq = mySequence; |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | if ( !this.pSeq.parent_do_refresh_timeline ) { |
42 | 42 | this.pSeq.parent_do_refresh_timeline = this.pSeq.do_refresh_timeline; |
43 | 43 | this.pSeq.do_refresh_timeline = function() { |
44 | | - js_log( "seqRemoteSearchDriver::" + _this.pSeq.disp_menu_item ); |
| 44 | + mw.log( "seqRemoteSearchDriver::" + _this.pSeq.disp_menu_item ); |
45 | 45 | // call the parent |
46 | 46 | _this.pSeq.parent_do_refresh_timeline(); |
47 | 47 | //Add our local bindings |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | |
59 | 59 | // Add an additional click binding |
60 | 60 | $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)' ); |
62 | 62 | _this.sequence_add_target = false; |
63 | 63 | } ); |
64 | 64 | |
— | — | @@ -68,13 +68,13 @@ |
69 | 69 | }, |
70 | 70 | revert:'invalid', |
71 | 71 | start:function() { |
72 | | - js_log( 'start drag' ); |
| 72 | + mw.log( 'start drag' ); |
73 | 73 | } |
74 | 74 | } ); |
75 | 75 | $j( ".mv_clip_drag" ).droppable( 'destroy' ).droppable( { |
76 | 76 | accept: '.rsd_res_item', |
77 | 77 | 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') ); |
79 | 79 | $j( this ).css( 'border-right', 'solid thick red' ); |
80 | 80 | }, |
81 | 81 | out:function( event, ui ) { |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | }, |
84 | 84 | drop: function( event, ui ) { |
85 | 85 | $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' ) ); |
87 | 87 | _this.sequence_add_target = $j( this ).attr( 'id' ); |
88 | 88 | // load the original draged item |
89 | 89 | var rObj = _this.getResourceFromId( $j( ui.draggable ).attr( 'id' ) ); |
— | — | @@ -93,7 +93,7 @@ |
94 | 94 | }, |
95 | 95 | insertResource:function( rObj ) { |
96 | 96 | 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 ); |
98 | 98 | if ( _this.sequence_add_target ) { |
99 | 99 | var tClip = _this.pSeq.getClipFromSeqID( _this.sequence_add_target ); |
100 | 100 | var target_order = false; |
— | — | @@ -126,7 +126,7 @@ |
127 | 127 | |
128 | 128 | // Refresh the timeline: |
129 | 129 | _this.pSeq.do_refresh_timeline(); |
130 | | - js_log( "run close all: " ); |
| 130 | + mw.log( "run close all: " ); |
131 | 131 | _this.closeAll(); |
132 | 132 | } ); |
133 | 133 | }, |
— | — | @@ -164,7 +164,7 @@ |
165 | 165 | this.parent_showResourceEditor( rObj, rsdElement ); |
166 | 166 | }, |
167 | 167 | closeAll:function() { |
168 | | - js_log( 'should close: seq_resource_import' ); |
| 168 | + mw.log( 'should close: seq_resource_import' ); |
169 | 169 | $j( '#seq_resource_import' ).dialog( 'close' ).dialog( 'destroy' ).remove(); |
170 | 170 | // Unhide the results container |
171 | 171 | $j( '#rsd_results_container' ).show(); |
— | — | @@ -178,7 +178,7 @@ |
179 | 179 | } |
180 | 180 | }, |
181 | 181 | cancelClipEditCB:function() { |
182 | | - js_log( 'seqRSD:cancelClipEditCB' ); |
| 182 | + mw.log( 'seqRSD:cancelClipEditCB' ); |
183 | 183 | $j( '#seq_resource_import' ).dialog( 'close' ).dialog( 'destroy' ).remove(); |
184 | 184 | } |
185 | 185 | }; |
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvFirefoggRender.js |
— | — | @@ -63,7 +63,7 @@ |
64 | 64 | // Should be externally controlled |
65 | 65 | if ( options.target_startRender ) { |
66 | 66 | $j( options.target_startRender ).click( function() { |
67 | | - js_log( "Start render" ); |
| 67 | + mw.log( "Start render" ); |
68 | 68 | _this.startRender(); |
69 | 69 | } ) |
70 | 70 | this.target_startRender = options.target_startRender; |
— | — | @@ -111,7 +111,7 @@ |
112 | 112 | if ( _this.continue_rendering ) { |
113 | 113 | doNextFrame(); |
114 | 114 | } else { |
115 | | - js_log('done with render'); |
| 115 | + mw.log('done with render'); |
116 | 116 | // else quit: |
117 | 117 | //_this.doFinalRender(); |
118 | 118 | } |
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvTimedEffectsEdit.js |
— | — | @@ -79,7 +79,7 @@ |
80 | 80 | this.doEditMenu(); |
81 | 81 | }, |
82 | 82 | doEditMenu:function() { |
83 | | - js_log( 'mvTimedEffects : doEditMenu::' ); |
| 83 | + mw.log( 'mvTimedEffects : doEditMenu::' ); |
84 | 84 | var _this = this; |
85 | 85 | // add in subMenus if set |
86 | 86 | // check for submenu and add to item container |
— | — | @@ -112,7 +112,7 @@ |
113 | 113 | o += '</div>'; |
114 | 114 | // add sub menu container with menu html: |
115 | 115 | $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 ); |
117 | 117 | // set up bindins: |
118 | 118 | $j( '#mv_submenu_timedeffect' ).tabs( { |
119 | 119 | selected: selected_tab, |
— | — | @@ -126,9 +126,9 @@ |
127 | 127 | }, |
128 | 128 | showEditUI:function( tab_id ) { |
129 | 129 | // @@todo fix the double display of showEditUI |
130 | | - js_log( "showEditUI::" ); |
| 130 | + mw.log( "showEditUI::" ); |
131 | 131 | if ( !this.menu_items[ tab_id ] ) { |
132 | | - js_log( 'error: showEditUI missing item:' + tab_id ); |
| 132 | + mw.log( 'error: showEditUI missing item:' + tab_id ); |
133 | 133 | } else { |
134 | 134 | // use the menu_item config to map to function display |
135 | 135 | this.menu_items[tab_id].doEdit( this ); |
— | — | @@ -137,7 +137,7 @@ |
138 | 138 | doEditEffectDisplayEdit:function() { |
139 | 139 | var _this = this; |
140 | 140 | var appendTarget = '#te_effects'; |
141 | | - js_log( 'type:' + _this.rObj['type'] ); |
| 141 | + mw.log( 'type:' + _this.rObj['type'] ); |
142 | 142 | $j( appendTarget ).html( gM( 'mwe-loading_txt' ) ); |
143 | 143 | // @@todo integrate into core and loading system: |
144 | 144 | loadExternalJs( mw.getMwEmbedPath() + 'libClipEdit/pixastic-editor/editor.js?' + getMwReqParam() ); |
— | — | @@ -162,7 +162,7 @@ |
163 | 163 | }, |
164 | 164 | doTransitionDisplayEdit:function( target_item ) { |
165 | 165 | var _this = this; |
166 | | - js_log( "doTransitionDisplayEdit: " + target_item ); |
| 166 | + mw.log( "doTransitionDisplayEdit: " + target_item ); |
167 | 167 | var apendTarget = '#te_' + target_item; |
168 | 168 | // check if we have a transition of type clip_attr |
169 | 169 | if ( !this.rObj[ this.menu_items[ target_item ].clip_attr ] ) { |
— | — | @@ -232,7 +232,7 @@ |
233 | 233 | case 'fadeColor': |
234 | 234 | var cColor = ( cTran['fadeColor'] ) ? cTran['fadeColor']:''; |
235 | 235 | $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' ); |
237 | 237 | |
238 | 238 | |
239 | 239 | $j( htmlTarget + ' .colorSelector' ).ColorPicker( { |
— | — | @@ -246,7 +246,7 @@ |
247 | 247 | onHide: function ( colpkr ) { |
248 | 248 | $j( colpkr ).fadeOut( 500 ); |
249 | 249 | _this.pSeq.plObj.setCurrentTime( 0, function() { |
250 | | - js_log( "render ready" ); |
| 250 | + mw.log( "render ready" ); |
251 | 251 | } ); |
252 | 252 | return false; |
253 | 253 | }, |
— | — | @@ -263,10 +263,10 @@ |
264 | 264 | |
265 | 265 | }, |
266 | 266 | getTransitionListControl : function( target_out ) { |
267 | | - js_log( "getTransitionListControl" ); |
| 267 | + mw.log( "getTransitionListControl" ); |
268 | 268 | var o = '<h3>' + gM( 'mwe-add-transition' ) + '</h3>'; |
269 | 269 | for ( var type in mvTransLib['type'] ) { |
270 | | - js_log( 'on tran type: ' + type ); |
| 270 | + mw.log( 'on tran type: ' + type ); |
271 | 271 | var tLibSet = mvTransLib['type'][ type ]; |
272 | 272 | for ( var subtype in tLibSet ) { |
273 | 273 | o += '<img style="float:left;padding:10px;" ' + |
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvSequencer.js |
— | — | @@ -204,7 +204,7 @@ |
205 | 205 | this[ i ] = sequencerDefaultValues[i]; |
206 | 206 | } |
207 | 207 | for ( var i in iObj ) { |
208 | | - // js_log('on '+ i + ' :' + iObj[i]); |
| 208 | + // mw.log('on '+ i + ' :' + iObj[i]); |
209 | 209 | if ( typeof sequencerDefaultValues[i] != 'undefined' ) { // make sure its a valid property |
210 | 210 | this[i] = iObj[i]; |
211 | 211 | } |
— | — | @@ -212,7 +212,7 @@ |
213 | 213 | |
214 | 214 | // check for sequence_container |
215 | 215 | if ( $j( this.target_sequence_container ).length === 0 ) { |
216 | | - js_log( "Error: missing target_sequence_container" ); |
| 216 | + mw.log( "Error: missing target_sequence_container" ); |
217 | 217 | return false; |
218 | 218 | } |
219 | 219 | |
— | — | @@ -241,17 +241,17 @@ |
242 | 242 | 'min-width':'850px' |
243 | 243 | } ); |
244 | 244 | |
245 | | - /*js_log('set: '+this.target_sequence_container + ' html to:'+ "\n"+ |
| 245 | + /*mw.log('set: '+this.target_sequence_container + ' html to:'+ "\n"+ |
246 | 246 | $j(this.target_sequence_container).html() |
247 | 247 | );*/ |
248 | 248 | |
249 | 249 | // first check if we got a cloned PL object: |
250 | 250 | // (when the editor is invoked with the plalylist already on the page) |
251 | 251 | /*if( this.plObj != 'null' ){ |
252 | | - js_log('found plObj clone'); |
| 252 | + mw.log('found plObj clone'); |
253 | 253 | //extend with mvSeqPlayList object: |
254 | 254 | 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 ); |
256 | 256 | $j('#'+this.video_container_id).get(0).attachNode( this.plObj ); |
257 | 257 | this.plObj.getHTML(); |
258 | 258 | this.checkReadyPlObj(); |
— | — | @@ -260,10 +260,10 @@ |
261 | 261 | |
262 | 262 | // else check for source based sequence editor (a clean page load of the editor) |
263 | 263 | if ( this.mv_pl_src != 'null' ) { |
264 | | - js_log( ' pl src:: ' + this.mv_pl_src ); |
| 264 | + mw.log( ' pl src:: ' + this.mv_pl_src ); |
265 | 265 | var src_attr = ' src="' + this.mv_pl_src + '" '; |
266 | 266 | } else { |
267 | | - js_log( ' null playlist src .. (start empty) ' ); |
| 267 | + mw.log( ' null playlist src .. (start empty) ' ); |
268 | 268 | var src_attr = ''; |
269 | 269 | } |
270 | 270 | $j( '#' + this.video_container_id ).html( '<playlist ' + src_attr + |
— | — | @@ -327,10 +327,7 @@ |
328 | 328 | value: 100 |
329 | 329 | } ); |
330 | 330 | // 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 ) { |
335 | 332 | $j( '#seq_save_dialog' ).html( gM( 'mwe-save_done' ) ); |
336 | 333 | $j( '#seq_save_dialog' ).dialog( 'option', |
337 | 334 | 'buttons', { |
— | — | @@ -355,7 +352,7 @@ |
356 | 353 | }, |
357 | 354 | // display a menu item (hide the rest) |
358 | 355 | disp:function( item, dispCall ) { |
359 | | - js_log( 'menu_item disp: ' + item ); |
| 356 | + mw.log( 'menu_item disp: ' + item ); |
360 | 357 | this.disp_menu_item = item; |
361 | 358 | // update the display and item state: |
362 | 359 | if ( this.menu_items[item] ) { |
— | — | @@ -371,7 +368,7 @@ |
372 | 369 | }, |
373 | 370 | // setup the menu items: |
374 | 371 | setupMenuItems:function() { |
375 | | - js_log( 'loadInitMenuItems' ); |
| 372 | + mw.log( 'loadInitMenuItems' ); |
376 | 373 | var _this = this; |
377 | 374 | // do all the menu_items setup: @@we could defer this to once the menu item is requested |
378 | 375 | for ( var i in this.menu_items ) { |
— | — | @@ -413,7 +410,7 @@ |
414 | 411 | // add tracks: |
415 | 412 | for ( var i in this.plObj.tracks ) { |
416 | 413 | 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() ); |
418 | 415 | // set up track based on disp type |
419 | 416 | switch( track.disp_mode ) { |
420 | 417 | case 'timeline_thumb': |
— | — | @@ -482,7 +479,7 @@ |
483 | 480 | // else keep checking for the playlist to be ready |
484 | 481 | if ( this.plObj.loading ) { |
485 | 482 | if ( this.plReadyTimeout == 200 ) { |
486 | | - js_error( 'error playlist never ready' ); |
| 483 | + mw.log( 'error playlist never ready' ); |
487 | 484 | } else { |
488 | 485 | this.plReadyTimeout++; |
489 | 486 | setTimeout( this.instance_name + '.checkReadyPlObj()', 25 ); |
— | — | @@ -494,8 +491,8 @@ |
495 | 492 | }, |
496 | 493 | plReadyInit:function() { |
497 | 494 | var _this = this; |
498 | | - js_log( 'plReadyInit' ); |
499 | | - js_log( this.plObj ); |
| 495 | + mw.log( 'plReadyInit' ); |
| 496 | + mw.log( this.plObj ); |
500 | 497 | // give the playlist a pointer to its parent seq: |
501 | 498 | this.plObj['seqObj'] = this; |
502 | 499 | |
— | — | @@ -602,7 +599,7 @@ |
603 | 600 | |
604 | 601 | // Set up key bidnings |
605 | 602 | $j( window ).keydown( function( e ) { |
606 | | - js_log( 'pushed down on:' + e.which ); |
| 603 | + mw.log( 'pushed down on:' + e.which ); |
607 | 604 | if ( e.which == 16 ) |
608 | 605 | _this.key_shift_down = true; |
609 | 606 | |
— | — | @@ -621,7 +618,7 @@ |
622 | 619 | |
623 | 620 | } ); |
624 | 621 | $j( window ).keyup( function( e ) { |
625 | | - js_log( 'key up on ' + e.which ); |
| 622 | + mw.log( 'key up on ' + e.which ); |
626 | 623 | // User let go of "shift" turn off multi-select |
627 | 624 | if ( e.which == 16 ) |
628 | 625 | _this.key_shift_down = false; |
— | — | @@ -646,11 +643,11 @@ |
647 | 644 | var _this = this; |
648 | 645 | // if an input or text area has focus disable delete key binding |
649 | 646 | $j( "input,textarea" ).focus( function () { |
650 | | - js_log( "inputFocus:true" ); |
| 647 | + mw.log( "inputFocus:true" ); |
651 | 648 | _this.inputFocus = true; |
652 | 649 | } ); |
653 | 650 | $j( "input,textarea" ).blur( function () { |
654 | | - js_log( "inputFocus:blur" ); |
| 651 | + mw.log( "inputFocus:blur" ); |
655 | 652 | _this.inputFocus = false; |
656 | 653 | } ) |
657 | 654 | }, |
— | — | @@ -666,13 +663,13 @@ |
667 | 664 | 'left', |
668 | 665 | Math.round( jh_time_sec_float / this.timeline_scale ) + 'px' |
669 | 666 | ); |
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)); |
671 | 668 | }, |
672 | 669 | /* |
673 | 670 | * Returns a xml or json representation of the current sequence |
674 | 671 | */ |
675 | 672 | getSeqOutputJSON:function() { |
676 | | - js_log( 'json output:' ); |
| 673 | + mw.log( 'json output:' ); |
677 | 674 | }, |
678 | 675 | |
679 | 676 | /** |
— | — | @@ -744,7 +741,7 @@ |
745 | 742 | * Handles cases where no clips are selected or multiple clips are selected. |
746 | 743 | */ |
747 | 744 | doEditSelectedClip:function() { |
748 | | - js_log( "f:doEditSelectedClip:" ); |
| 745 | + mw.log( "f:doEditSelectedClip:" ); |
749 | 746 | // And only one clip selected |
750 | 747 | if ( $j( '.mv_selected_clip' ).length == 1 ) { |
751 | 748 | this.doEditClip( this.getClipFromSeqID( $j( '.mv_selected_clip' ).parent().attr( 'id' ) ) ); |
— | — | @@ -761,7 +758,7 @@ |
762 | 759 | */ |
763 | 760 | doEditTransitionSelectedClip:function() { |
764 | 761 | var _this = this; |
765 | | - js_log( "f:doEditTransitionSelectedClip:" + $j( '.mv_selected_clip' ).length ); |
| 762 | + mw.log( "f:doEditTransitionSelectedClip:" + $j( '.mv_selected_clip' ).length ); |
766 | 763 | if ( $j( '.mv_selected_clip' ).length == 1 ) { |
767 | 764 | _this.doEditTransition( _this.getClipFromSeqID( $j( '.mv_selected_clip' ).parent().attr( 'id' ) ) ); |
768 | 765 | } else if ( $j( '.mv_selected_clip' ).length === 0 ) { |
— | — | @@ -777,7 +774,7 @@ |
778 | 775 | * displays the transition edit interface. |
779 | 776 | */ |
780 | 777 | doEditTransition:function( cObj ) { |
781 | | - js_log( "sequence:doEditTransition" ); |
| 778 | + mw.log( "sequence:doEditTransition" ); |
782 | 779 | var _this = this; |
783 | 780 | // Add a loading image |
784 | 781 | mw.loading_spiner( '#transitions_ic' ); |
— | — | @@ -799,7 +796,7 @@ |
800 | 797 | * Updates the clip details div if edit resource is set |
801 | 798 | */ |
802 | 799 | doEditClip:function( resource ) { |
803 | | - js_log( 'seq:doEditClip' ); |
| 800 | + mw.log( 'seq:doEditClip' ); |
804 | 801 | var _this = this; |
805 | 802 | |
806 | 803 | mw.loading_spiner( '#clipedit_ic' ); |
— | — | @@ -858,7 +855,7 @@ |
859 | 856 | |
860 | 857 | // Upload clipboard to the server (if possible) |
861 | 858 | 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' ); |
863 | 860 | } else { |
864 | 861 | // FIXME we need to add an api entry point to store a "clipboard" |
865 | 862 | // right now this is dependent on a custom hook: |
— | — | @@ -872,11 +869,11 @@ |
873 | 870 | "clipboardEditToken": _this.clipboardEditToken |
874 | 871 | } ), |
875 | 872 | success:function( data ) { |
876 | | - js_log( 'did clipboard push ' + $j.toJSON( _this.clipboard ) ); |
| 873 | + mw.log( 'did clipboard push ' + $j.toJSON( _this.clipboard ) ); |
877 | 874 | } |
878 | 875 | } ); |
879 | 876 | } else { |
880 | | - js_log( 'error: no clipboardEditToken to uplaod clipboard to server' ); |
| 877 | + mw.log( 'error: no clipboardEditToken to uplaod clipboard to server' ); |
881 | 878 | } |
882 | 879 | } |
883 | 880 | }, |
— | — | @@ -884,7 +881,7 @@ |
885 | 882 | * Paste the clipboard clips into the sequence |
886 | 883 | */ |
887 | 884 | pasteClipBoardClips:function() { |
888 | | - js_log( 'f:pasteClipBoardClips' ); |
| 885 | + mw.log( 'f:pasteClipBoardClips' ); |
889 | 886 | // @@todo query the server for updated clipboard |
890 | 887 | // paste before the "current clip" |
891 | 888 | this.addClips( this.clipboard, this.plObj.cur_clip.order ); |
— | — | @@ -934,13 +931,13 @@ |
935 | 932 | if ( !before_clip_pos ) |
936 | 933 | before_clip_pos = this.plObj.default_track.getClipCount(); |
937 | 934 | |
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 ); |
939 | 936 | var cur_pos = before_clip_pos; |
940 | 937 | |
941 | 938 | $j.each( clipSet, function( inx, clipInitDom ) { |
942 | 939 | var mediaElement = document.createElement( 'ref' ); |
943 | 940 | for ( var i in clipInitDom ) { |
944 | | - js_log( "set: " + i + ' to ' + clipInitDom[i] ); |
| 941 | + mw.log( "set: " + i + ' to ' + clipInitDom[i] ); |
945 | 942 | if ( i != 'id' ) |
946 | 943 | $j( mediaElement ).attr( i, clipInitDom[i] ); |
947 | 944 | } |
— | — | @@ -957,7 +954,7 @@ |
958 | 955 | removeClips:function( remove_clip_ary ) { |
959 | 956 | var _this = this; |
960 | 957 | 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 ); |
962 | 959 | var afected_tracks = new Array(); |
963 | 960 | // add order to track_clip before we start removing: |
964 | 961 | $j.each( remove_clip_ary, function( inx, track_clip ) { |
— | — | @@ -967,7 +964,7 @@ |
968 | 965 | var track_inx = track_clip[0]; |
969 | 966 | var clip_inx = track_clip[1]; |
970 | 967 | 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 ); |
972 | 969 | // remove the clips from the base tracks |
973 | 970 | for ( var i in _this.plObj.tracks[ track_inx ].clips ) { |
974 | 971 | cur_clip = _this.plObj.tracks[ track_inx ].clips[i] |
— | — | @@ -985,7 +982,7 @@ |
986 | 983 | _this.plObj.tracks[track_inx].reOrderClips(); |
987 | 984 | } ); |
988 | 985 | |
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 ); |
990 | 987 | // animate the removal (@@todo should be able to call the resulting fadeOut only once without a flag) |
991 | 988 | var done_with_refresh = false; |
992 | 989 | $j( jselect ).fadeOut( "slow", function() { |
— | — | @@ -1013,7 +1010,7 @@ |
1014 | 1011 | this.plObj.tracks[e.track_inx].clips[e.clip_inx].doAdjust( 'end', e.delta ); |
1015 | 1012 | break; |
1016 | 1013 | } |
1017 | | - js_log( 're render: ' + e.track_inx ); |
| 1014 | + mw.log( 're render: ' + e.track_inx ); |
1018 | 1015 | // refresh the playlist after adjustment |
1019 | 1016 | this.do_refresh_timeline(); |
1020 | 1017 | }, |
— | — | @@ -1050,7 +1047,7 @@ |
1051 | 1048 | }, |
1052 | 1049 | // toggle cut mode (change icon to cut) |
1053 | 1050 | cut_mode:function() { |
1054 | | - js_log( 'do cut mode' ); |
| 1051 | + mw.log( 'do cut mode' ); |
1055 | 1052 | // add cut layer ontop of clips |
1056 | 1053 | }, |
1057 | 1054 | doAdvancedTl:function() { |
— | — | @@ -1067,7 +1064,7 @@ |
1068 | 1065 | }, |
1069 | 1066 | // renders updates the timeline based on the current scale |
1070 | 1067 | render_tracks:function( track_inx ) { |
1071 | | - js_log( "f::render track: " + track_inx ); |
| 1068 | + mw.log( "f::render track: " + track_inx ); |
1072 | 1069 | var _this = this; |
1073 | 1070 | // inject the tracks into the timeline (if not already there) |
1074 | 1071 | for ( var track_id in this.plObj.tracks ) { |
— | — | @@ -1141,7 +1138,7 @@ |
1142 | 1139 | clip.left_px = Math.round( cur_clip_time / this.timeline_scale ); |
1143 | 1140 | clip.width_px = Math.round( Math.round( clip.getDuration() ) / this.timeline_scale ); |
1144 | 1141 | 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 ); |
1146 | 1143 | |
1147 | 1144 | // for every clip_width pixle output image |
1148 | 1145 | if ( track.disp_mode == 'timeline_thumb' ) { |
— | — | @@ -1172,7 +1169,7 @@ |
1173 | 1170 | |
1174 | 1171 | } |
1175 | 1172 | |
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); |
1177 | 1174 | $j( '#container_track_' + track_id ).html( track_html ); |
1178 | 1175 | |
1179 | 1176 | // apply transition click action |
— | — | @@ -1225,7 +1222,7 @@ |
1226 | 1223 | var cur_clip_click = this; |
1227 | 1224 | // if not in multi select mode remove all existing selections |
1228 | 1225 | // (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 ); |
1230 | 1227 | if ( ! _this.key_shift_down && ! _this.key_ctrl_down ) { |
1231 | 1228 | $j( '.mv_selected_clip' ).each( function( inx, selected_clip ) { |
1232 | 1229 | if ( $j( this ).parent().attr( 'id' ) != $j( cur_clip_click ).parent().attr( 'id' ) |
— | — | @@ -1259,7 +1256,7 @@ |
1260 | 1257 | max_order = cur_clip.order; |
1261 | 1258 | } ); |
1262 | 1259 | // 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 ); |
1264 | 1261 | if ( sClipObj.order <= min_order ) { |
1265 | 1262 | for ( var i = sClipObj.order; i <= max_order; i++ ) { |
1266 | 1263 | $j( '#track_' + track_id + '_clip_' + i + ' > .mv_clip_thumb' ).addClass( 'mv_selected_clip' ); |
— | — | @@ -1277,7 +1274,7 @@ |
1278 | 1275 | // debugger; |
1279 | 1276 | if ( this.timeline_mode == 'time' ) { |
1280 | 1277 | $j( '.ui-resizable-handle' ).mousedown( function() { |
1281 | | - js_log( 'hid: ' + $j( this ).attr( 'class' ) ); |
| 1278 | + mw.log( 'hid: ' + $j( this ).attr( 'class' ) ); |
1282 | 1279 | _this.resize_mode = ( $j( this ).attr( 'class' ).indexOf( 'ui-resizable-e' ) != -1 ) ? |
1283 | 1280 | 'resize_end':'resize_start'; |
1284 | 1281 | } ); |
— | — | @@ -1297,7 +1294,7 @@ |
1298 | 1295 | insert_key = _this.clipDragUpdate( ui, this ); |
1299 | 1296 | }, |
1300 | 1297 | start:function( e, ui ) { |
1301 | | - js_log( 'start drag:' + this.id ); |
| 1298 | + mw.log( 'start drag:' + this.id ); |
1302 | 1299 | // make sure we are ontop |
1303 | 1300 | $j( this ).css( { top:'0px', zindex:10 } ); |
1304 | 1301 | }, |
— | — | @@ -1336,11 +1333,11 @@ |
1337 | 1334 | $j( this ).css( { 'border':'solid thin red' } ); |
1338 | 1335 | // fade In Time stats (end or start based on handle) |
1339 | 1336 | // dragging east (adjusting end time) |
1340 | | - js_log( 'append to: ' + this.id ); |
| 1337 | + mw.log( 'append to: ' + this.id ); |
1341 | 1338 | $j( '#' + this.id + ' > .mv_clip_stats' ).fadeIn( "fast" ); |
1342 | 1339 | }, |
1343 | 1340 | stop: function( e, ui ) { |
1344 | | - js_log( 'stop resize' ); |
| 1341 | + mw.log( 'stop resize' ); |
1345 | 1342 | // restore border |
1346 | 1343 | $j( this ).css( 'border', 'solid thin white' ); |
1347 | 1344 | // remove stats |
— | — | @@ -1374,7 +1371,7 @@ |
1375 | 1372 | |
1376 | 1373 | var insert_key = 'na'; |
1377 | 1374 | // animate re-arrange by left position: |
1378 | | - // js_log('left: '+ui.position.left); |
| 1375 | + // mw.log('left: '+ui.position.left); |
1379 | 1376 | // locate clip (based on clip duration not animate) |
1380 | 1377 | var id_parts = clipElm.id.split( '_' ); |
1381 | 1378 | var track_inx = id_parts[1]; |
— | — | @@ -1423,22 +1420,22 @@ |
1424 | 1421 | } |
1425 | 1422 | }, |
1426 | 1423 | getClipFromSeqID:function( clip_seq_id ) { |
1427 | | - js_log( 'get id from: ' + clip_seq_id ); |
| 1424 | + mw.log( 'get id from: ' + clip_seq_id ); |
1428 | 1425 | var ct = clip_seq_id.replace( 'track_', '' ).replace( 'clip_', '' ).split( '_' ); |
1429 | 1426 | return this.plObj.tracks[ ct[0] ].clips[ ct[1] ]; |
1430 | 1427 | }, |
1431 | 1428 | // renders clip frames |
1432 | 1429 | 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 ); |
1434 | 1431 | var clip_frames_html = ''; |
1435 | 1432 | var frame_width = Math.round( this.track_thumb_height * 1.3333333 ); |
1436 | 1433 | |
1437 | 1434 | var pint = ( frame_offset_count == null ) ? 0:frame_offset_count * frame_width; |
1438 | 1435 | |
1439 | | - // js_log("pinit: "+ pint+ ' < '+clip.width_px+' ++'+frame_width); |
| 1436 | + // mw.log("pinit: "+ pint+ ' < '+clip.width_px+' ++'+frame_width); |
1440 | 1437 | for ( var p = pint; p < clip.width_px; p += frame_width ) { |
1441 | 1438 | 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 ); |
1443 | 1440 | clip_frames_html += clip.embed.renderTimelineThumbnail( { |
1444 | 1441 | 'width': frame_width, |
1445 | 1442 | 'thumb_class':'mv_tl_thumb', |
— | — | @@ -1447,11 +1444,11 @@ |
1448 | 1445 | 'time': clip_time |
1449 | 1446 | } ); |
1450 | 1447 | } |
1451 | | - js_log( 'render_clip_frames:' + clip_frames_html ); |
| 1448 | + mw.log( 'render_clip_frames:' + clip_frames_html ); |
1452 | 1449 | return clip_frames_html; |
1453 | 1450 | }, |
1454 | 1451 | update_clip_resize:function( clip_element ) { |
1455 | | - // js_log('update_clip_resize'); |
| 1452 | + // mw.log('update_clip_resize'); |
1456 | 1453 | var _this = this; |
1457 | 1454 | var id_parts = clip_element.id.split( '_' ); |
1458 | 1455 | track_inx = id_parts[1]; |
— | — | @@ -1478,12 +1475,12 @@ |
1479 | 1476 | var new_end = mw.seconds2npt( mw.npt2seconds( clip.embed.end_ntp ) + clip_dif ); |
1480 | 1477 | clip_desc += '<br>end time: ' + new_end; |
1481 | 1478 | // 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); |
1483 | 1480 | // $j('#container_track_'+track_inx+' > .mv_clip_drag :gt('+clip_inx+')').each(function(){ |
1484 | 1481 | $j( '#container_track_' + track_inx + ' > :gt(' + clip_inx + ')' ).each( function() { |
1485 | 1482 | var move_id_parts = this.id.split( '_' ); |
1486 | 1483 | 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); |
1488 | 1485 | $j( this ).css( 'left', move_clip.left_px + width_dif ); |
1489 | 1486 | } ); |
1490 | 1487 | } else { |
— | — | @@ -1499,13 +1496,13 @@ |
1500 | 1497 | var frame_count = $j( '#' + clip_element.id + ' > img' ).length; |
1501 | 1498 | if ( clip.width_px > ( frame_count * frame_width ) ) { |
1502 | 1499 | // 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 ) ); |
1504 | 1501 | $j( '#' + clip_element.id ).append( this.render_clip_frames( clip, frame_count ) ); |
1505 | 1502 | } |
1506 | 1503 | }, |
1507 | 1504 | // renders cnt_time |
1508 | 1505 | render_playheadhead_seeker:function() { |
1509 | | - js_log( 'render_playheadhead_seeker' ); |
| 1506 | + mw.log( 'render_playheadhead_seeker' ); |
1510 | 1507 | // render out time stamps and time "jump" links |
1511 | 1508 | // first get total width |
1512 | 1509 | |
— | — | @@ -1544,10 +1541,10 @@ |
1545 | 1542 | } |
1546 | 1543 | }, |
1547 | 1544 | jt:function( jh_time ) { |
1548 | | - js_log( 'jt:' + jh_time ); |
| 1545 | + mw.log( 'jt:' + jh_time ); |
1549 | 1546 | var _this = this; |
1550 | 1547 | 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 ) ); |
1552 | 1549 | // render playline at given time |
1553 | 1550 | $j( '#' + this.timeline_id + '_playline' ).css( 'left', Math.round( jh_time / this.timeline_scale ) + 'px' ); |
1554 | 1551 | cur_pl_time = 0; |
— | — | @@ -1558,15 +1555,15 @@ |
1559 | 1556 | zoom_in:function() { |
1560 | 1557 | this.timeline_scale = this.timeline_scale * .75; |
1561 | 1558 | this.do_refresh_timeline(); |
1562 | | - js_log( 'zoomed in:' + this.timeline_scale ); |
| 1559 | + mw.log( 'zoomed in:' + this.timeline_scale ); |
1563 | 1560 | }, |
1564 | 1561 | zoom_out:function() { |
1565 | 1562 | this.timeline_scale = this.timeline_scale * ( 1 + ( 1 / 3 ) ); |
1566 | 1563 | this.do_refresh_timeline(); |
1567 | | - js_log( 'zoom out: ' + this.timeline_scale ); |
| 1564 | + mw.log( 'zoom out: ' + this.timeline_scale ); |
1568 | 1565 | }, |
1569 | 1566 | do_refresh_timeline:function( preserve_selection ) { |
1570 | | - js_log( 'Sequencer:do_refresh_timeline()' ); |
| 1567 | + mw.log( 'Sequencer:do_refresh_timeline()' ); |
1571 | 1568 | // @@todo should "lock" interface while refreshing timeline |
1572 | 1569 | var pSelClips = []; |
1573 | 1570 | if ( preserve_selection ) { |
— | — | @@ -1614,7 +1611,7 @@ |
1615 | 1612 | this.pl_layout.control_height = 0; |
1616 | 1613 | }, |
1617 | 1614 | setSliderValue:function( perc ) { |
1618 | | - js_log( 'setSliderValue::' + perc ); |
| 1615 | + mw.log( 'setSliderValue::' + perc ); |
1619 | 1616 | // get the track_clipThumb_height from parent mvSequencer |
1620 | 1617 | var frame_width = Math.round( this.pSeq.track_clipThumb_height * 1.3333333 ); |
1621 | 1618 | var container_width = frame_width + 60; |
— | — | @@ -1622,7 +1619,7 @@ |
1623 | 1620 | var perc_clip = this.cur_clip.embed.currentTime / this.cur_clip.getDuration(); |
1624 | 1621 | |
1625 | 1622 | 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 ); |
1627 | 1624 | |
1628 | 1625 | |
1629 | 1626 | // update the timeline playhead and |
— | — | @@ -1639,7 +1636,7 @@ |
1640 | 1637 | }, |
1641 | 1638 | // override renderDisplay |
1642 | 1639 | renderDisplay:function() { |
1643 | | - js_log( 'mvSequence:renderDisplay' ); |
| 1640 | + mw.log( 'mvSequence:renderDisplay' ); |
1644 | 1641 | // setup layout for title and dc_ clip container |
1645 | 1642 | $j( this ).html( '<div id="dc_' + this.id + '" style="width:' + this.width + 'px;' + |
1646 | 1643 | 'height:' + ( this.height ) + 'px;position:relative;" />' ); |
Index: branches/js2-work/phase3/js2/mwEmbed/tests/testLang.html |
— | — | @@ -231,15 +231,13 @@ |
232 | 232 | var tkey = mKey + '_' + numKey + '_' + langKey; |
233 | 233 | testCount++; |
234 | 234 | $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 ) { |
244 | 242 | var t = '#'+ tkey ; |
245 | 243 | if(data.parse && data.parse.text && data.parse.text['*']){ |
246 | 244 | $j(t).html( data.parse.text['*'] ); |
Index: branches/js2-work/phase3/js2/mwEmbed/tests/testApiProxy.html |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | ); |
30 | 30 | }); |
31 | 31 | function doHello(){ |
32 | | - js_log('to a hello user'); |
| 32 | + mw.log('to a hello user'); |
33 | 33 | $j('#helloTarget').html( mw.loading_spiner() ); |
34 | 34 | //first get the user name: |
35 | 35 | getUserName(function( user_name ){ |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | function( data ){ |
48 | 48 | //now we get the data back for that domain |
49 | 49 | if( !data.query || !data.query.userinfo ){ |
50 | | - js_log("Error no query.userinfo "); |
| 50 | + mw.log("Error no query.userinfo "); |
51 | 51 | return false; |
52 | 52 | } |
53 | 53 | callback( data.query.userinfo.name ); |
— | — | @@ -62,18 +62,15 @@ |
63 | 63 | var eTitle = 'User_talk:' + userName; |
64 | 64 | //get a edit token |
65 | 65 | 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 = { |
68 | 68 | 'action':'edit', |
69 | 69 | 'title': eTitle, |
70 | 70 | 'summary': "Api proxy test edit", |
71 | 71 | 'appendtext': "\n\n==== Hello from Api proxy At: " + Date() + " ====", |
72 | 72 | 'token': token |
73 | 73 | } |
74 | | - do_api_req({ |
75 | | - 'data': aReq, |
76 | | - 'url': 'proxy' |
77 | | - },function(result){ |
| 74 | + mw.getJSON('proxy', request, function( result ){ |
78 | 75 | if(result.edit && result.edit.newrevid){ |
79 | 76 | $j('#appendTarget').html( "success: " + JSON.stringify ( result) ); |
80 | 77 | url = remote_wiki_host + remote_script_path + '/index.php/'; |
Index: branches/js2-work/phase3/js2/mwEmbed/libClipEdit/mvClipEdit.js |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | this.showEditUI(); |
119 | 119 | } else { |
120 | 120 | // 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); |
122 | 122 | // could separate out into media Types objects for now just call method |
123 | 123 | if ( this.getMediaType() == 'image' ) { |
124 | 124 | this.showImageControls(); |
— | — | @@ -168,7 +168,7 @@ |
169 | 169 | 'media' : ['image', 'template'], |
170 | 170 | 'doEdit':function( _this, target ) { |
171 | 171 | function doUpdateDur( inputElm ) { |
172 | | - js_log( "update duration:" + $j( inputElm ).val() ); |
| 172 | + mw.log( "update duration:" + $j( inputElm ).val() ); |
173 | 173 | // update the parent sequence object: |
174 | 174 | _this.resource.dur = smilParseTime( $j( inputElm ).val() ); |
175 | 175 | // update the playlist: |
— | — | @@ -235,7 +235,7 @@ |
236 | 236 | // if media type is template we have to query to get its URI to get its parameters |
237 | 237 | if ( _this.getMediaType() == 'template' && !_this.resource.tVars ) { |
238 | 238 | $j( '#sub_cliplib_ic' ).loadingSpiner() |
239 | | - var reqObj = { |
| 239 | + var request = { |
240 | 240 | 'action':'query', |
241 | 241 | 'prop':'revisions', |
242 | 242 | 'titles': _this.resource.uri, |
— | — | @@ -244,26 +244,22 @@ |
245 | 245 | // get the interface uri from the plObject |
246 | 246 | var api_url = _this.parentSequence.plObj.interface_url; |
247 | 247 | // 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]['*'] ) { |
253 | 254 | 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]['*']; |
261 | 257 | } |
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 ); |
266 | 258 | } |
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 | + } ); |
268 | 264 | } else { |
269 | 265 | _this.showEditOptions( target ); |
270 | 266 | } |
— | — | @@ -374,7 +370,7 @@ |
375 | 371 | |
376 | 372 | // Add update bindings |
377 | 373 | $j( target + ' .ic_tparam' ).change( function() { |
378 | | - js_log( "updated tparam::" + $j( this ).attr( "name" ) ); |
| 374 | + mw.log( "updated tparam::" + $j( this ).attr( "name" ) ); |
379 | 375 | // Update param value: |
380 | 376 | _this.resource.params[ $j( this ).attr( "name" ) ] = $j( this ).val(); |
381 | 377 | // Re-parse & update template |
— | — | @@ -384,7 +380,7 @@ |
385 | 381 | template_wiki_text += "\n|" + _this.resource.tVars[i] + ' = ' + _this.resource.params[ _this.resource.tVars[i] ] ; |
386 | 382 | } |
387 | 383 | template_wiki_text += "\n}}"; |
388 | | - var reqObj = { |
| 384 | + var request = { |
389 | 385 | 'action':'parse', |
390 | 386 | 'title' : _this.parentSequence.plObj.mTitle, |
391 | 387 | 'text' : template_wiki_text |
— | — | @@ -392,15 +388,12 @@ |
393 | 389 | $j( _this.resource.embed ).html( mw.loading_spiner() ); |
394 | 390 | |
395 | 391 | 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 ) { |
400 | 393 | if ( data.parse.text['*'] ) { |
401 | 394 | // update the target |
402 | 395 | $j( _this.resource.embed ).html( data.parse.text['*'] ); |
403 | 396 | } |
404 | | - } ) |
| 397 | + } ); |
405 | 398 | } ) |
406 | 399 | |
407 | 400 | // Update doFocusBindings |
— | — | @@ -465,7 +458,7 @@ |
466 | 459 | showEditUI:function( edit_type ) { |
467 | 460 | if ( !edit_type ) |
468 | 461 | return false; |
469 | | - js_log( 'showEditUI: ' + edit_type ); |
| 462 | + mw.log( 'showEditUI: ' + edit_type ); |
470 | 463 | if ( this.edit_types[ edit_type ].doEdit ) |
471 | 464 | this.edit_types[ edit_type ].doEdit( this, '#sc_' + edit_type ); |
472 | 465 | }, |
— | — | @@ -474,7 +467,7 @@ |
475 | 468 | * Show Video Controls for the resource edit |
476 | 469 | */ |
477 | 470 | showVideoControls:function() { |
478 | | - js_log( 'showVideoControls:f' ); |
| 471 | + mw.log( 'showVideoControls:f' ); |
479 | 472 | var _this = this; |
480 | 473 | var eb = $j( '#embed_vid' ).get( 0 ); |
481 | 474 | // turn on preview to avoid onDone actions |
— | — | @@ -525,7 +518,7 @@ |
526 | 519 | animate: true, |
527 | 520 | values: [start_sec, end_sec], |
528 | 521 | 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]) ); |
530 | 523 | $target.find( '.startInOut' ).val( mw.seconds2npt( ui.values[0] ) ); |
531 | 524 | $target.find( '.endInOut' ).val( mw.seconds2npt( ui.values[1] ) ); |
532 | 525 | }, |
— | — | @@ -543,13 +536,13 @@ |
544 | 537 | |
545 | 538 | // Update the slider: |
546 | 539 | 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 ); |
548 | 541 | |
549 | 542 | $target.find( '.inOutSlider' ).slider( 'value', 10 ); |
550 | 543 | debugger; |
551 | 544 | $target.find( '.inOutSlider' ).slider( 'option', 'values', [s_sec, e_sec] ); |
552 | 545 | var values = $target.find( '.inOutSlider' ).slider( 'option', 'values' ); |
553 | | - js_log( 'values (after update):' + values ); |
| 546 | + mw.log( 'values (after update):' + values ); |
554 | 547 | } ); |
555 | 548 | |
556 | 549 | $target.find( '.endInOut' ).upDownTimeInputBind( function( inputElm ) { |
— | — | @@ -581,7 +574,7 @@ |
582 | 575 | if ( ebvid ) { |
583 | 576 | ebvid.stop(); |
584 | 577 | ebvid.updateVideoTime( start_time, end_time ); |
585 | | - js_log( 'update thumb: ' + start_time ); |
| 578 | + mw.log( 'update thumb: ' + start_time ); |
586 | 579 | ebvid.updateThumbTimeNPT( start_time ); |
587 | 580 | } |
588 | 581 | }, |
— | — | @@ -624,7 +617,7 @@ |
625 | 618 | o += this.resource.pSobj.getInlineDescWiki( this.resource ); |
626 | 619 | } |
627 | 620 | o += '</textarea><br>'; |
628 | | - // js_log('getInsertHtml: ' + o ); |
| 621 | + // mw.log('getInsertHtml: ' + o ); |
629 | 622 | return o; |
630 | 623 | }, |
631 | 624 | |
— | — | @@ -686,7 +679,7 @@ |
687 | 680 | */ |
688 | 681 | applyEdit:function() { |
689 | 682 | var _this = this; |
690 | | - js_log( 'applyEdit::' + this.getMediaType() ); |
| 683 | + mw.log( 'applyEdit::' + this.getMediaType() ); |
691 | 684 | if ( this.getMediaType() == 'image' ) { |
692 | 685 | this.applyCrop(); |
693 | 686 | } else if ( this.getMediaType() == 'video' ) { |
— | — | @@ -746,11 +739,11 @@ |
747 | 740 | ); |
748 | 741 | // Add binding: |
749 | 742 | $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 ); |
751 | 744 | if ( $j( '#mv_crop_button' ).hasClass( 'mv_crop_button_selected' ) ) { |
752 | 745 | _this.applyCrop(); |
753 | 746 | } else { |
754 | | - js_log( 'click:turn on' ); |
| 747 | + mw.log( 'click:turn on' ); |
755 | 748 | _this.doCropInterface(); |
756 | 749 | } |
757 | 750 | } ); |
— | — | @@ -838,7 +831,7 @@ |
839 | 832 | * Apply the video Start End Adjustments to the resource |
840 | 833 | */ |
841 | 834 | applyVideoStartEnd:function() { |
842 | | - js_log( 'apply Video StartEnd updates::' ); |
| 835 | + mw.log( 'apply Video StartEnd updates::' ); |
843 | 836 | $target = $j( '#' + this.target_control_display ); |
844 | 837 | |
845 | 838 | // Be sure to "stop the video (some plugins can't have DOM elements on top of them) |
— | — | @@ -879,7 +872,7 @@ |
880 | 873 | $j( '#mv_crop_button' ).removeClass( 'mv_crop_button_base' ).addClass( 'mv_crop_button_selected' ).attr( 'title', gM( 'mwe-crop_done' ) ); |
881 | 874 | $j( '#' + _this.target_clip_display + ' img' ).Jcrop( { |
882 | 875 | 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 ); |
884 | 877 | _this.resource.crop = c; |
885 | 878 | }, |
886 | 879 | onChange: function( c ) { |
Index: branches/js2-work/phase3/js2/mwEmbed/libMwApi/mw.proxy.js |
— | — | @@ -71,7 +71,7 @@ |
72 | 72 | } |
73 | 73 | |
74 | 74 | 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? " ); |
76 | 76 | return false; |
77 | 77 | } |
78 | 78 | return true; |
— | — | @@ -93,7 +93,7 @@ |
94 | 94 | 'request' : requestQuery |
95 | 95 | } |
96 | 96 | |
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 ) ); |
98 | 98 | |
99 | 99 | // We can't update src's so we have to remove and add all the time :( |
100 | 100 | // @@todo we should support frame msg system |
— | — | @@ -109,7 +109,7 @@ |
110 | 110 | setTimeout( function() { |
111 | 111 | if ( !frameProxyOk ) { |
112 | 112 | // 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?" ); |
114 | 114 | $.proxy.proxyNotReadyDialog(); |
115 | 115 | } |
116 | 116 | }, 5000 ); |
— | — | @@ -154,7 +154,7 @@ |
155 | 155 | * @param {Function} callback Function called once the request is complete |
156 | 156 | */ |
157 | 157 | $.proxy.doRequest = function( requestQuery, callback ) { |
158 | | - js_log( "doRequest:: " + JSON.stringify( requestQuery ) ); |
| 158 | + mw.log( "doRequest:: " + JSON.stringify( requestQuery ) ); |
159 | 159 | lastApiReq = requestQuery; |
160 | 160 | // setup the callback: |
161 | 161 | $.proxy.callback = callback; |
— | — | @@ -172,14 +172,14 @@ |
173 | 173 | $.proxy.nested = function( hashResult ) { |
174 | 174 | // Close the loader if present: |
175 | 175 | $j.closeLoaderDialog(); |
176 | | - js_log( '$.proxy.nested callback :: ' + unescape( hashResult ) ); |
| 176 | + mw.log( '$.proxy.nested callback :: ' + unescape( hashResult ) ); |
177 | 177 | frameProxyOk = true; |
178 | 178 | |
179 | 179 | // Try to parse the hash result |
180 | 180 | try { |
181 | 181 | var resultObject = JSON.parse( unescape( hashResult ) ); |
182 | 182 | } catch ( e ) { |
183 | | - js_log( "Error could not parse hashResult" ); |
| 183 | + mw.log( "Error could not parse hashResult" ); |
184 | 184 | } |
185 | 185 | |
186 | 186 | // Special callback to frameProxyOk flag |
— | — | @@ -259,11 +259,11 @@ |
260 | 260 | try { |
261 | 261 | var clientRequest = JSON.parse( hashMsg ); |
262 | 262 | } catch ( e ) { |
263 | | - js_log( "ProxyServer:: could not parse anchor" ); |
| 263 | + mw.log( "ProxyServer:: could not parse anchor" ); |
264 | 264 | } |
265 | 265 | |
266 | 266 | if ( !clientRequest || !clientRequest.clientFrame ) { |
267 | | - js_log( "Error: no client domain provided " ); |
| 267 | + mw.log( "Error: no client domain provided " ); |
268 | 268 | $j( 'body' ).append( "no client frame provided" ); |
269 | 269 | return false; |
270 | 270 | } |
— | — | @@ -271,12 +271,12 @@ |
272 | 272 | // Make sure we are logged in |
273 | 273 | // (its a normal mediaWiki page so all site vars should be defined) |
274 | 274 | if ( !wgUserName ) { |
275 | | - js_log( 'Error Not logged in' ); |
| 275 | + mw.log( 'Error Not logged in' ); |
276 | 276 | return false; |
277 | 277 | } |
278 | 278 | |
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 ); |
281 | 281 | |
282 | 282 | var clientDomain = mw.parseUri( clientRequest.clientFrame ).host ; |
283 | 283 | /** |
— | — | @@ -292,7 +292,7 @@ |
293 | 293 | // Check master blacklist |
294 | 294 | for ( var i in proxyConfig.master_blacklist ) { |
295 | 295 | if ( clientDomain == proxyConfig.master_blacklist ) { |
296 | | - js_log( 'domain: ' + clientDomain + ' is blacklisted ( no request )' ); |
| 296 | + mw.log( 'domain: ' + clientDomain + ' is blacklisted ( no request )' ); |
297 | 297 | return false; |
298 | 298 | } |
299 | 299 | } |
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 |
1 | 9 | Merged /branches/REL1_15/phase3/js2/mwEmbed/skins/mvpcf/mvpcf.js:r51646 |
2 | 10 | Merged /branches/sqlite/js2/mwEmbed/skins/mvpcf/mvpcf.js:r58211-58321 |
Added: svn:eol-style |
3 | 11 | + 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 |
1 | 273 | Merged /branches/sqlite/js2/mwEmbed/skins/kskin/kskin.js:r58211-58321 |
2 | 274 | Merged /branches/REL1_15/phase3/js2/mwEmbed/skins/kskin/kskin.js:r51646 |
Added: svn:eol-style |
3 | 275 | + native |
Index: branches/js2-work/phase3/js2/mwEmbed/skins/ctrlBuilder.js |
— | — | @@ -39,8 +39,10 @@ |
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Initialization Object for the control builder |
| 43 | + * |
| 44 | + * @param {Object} embedObj EmbedPlayer interface |
43 | 45 | */ |
44 | | - init:function( embedObj, options ) { |
| 46 | + init: function( embedObj ) { |
45 | 47 | var _this = this; |
46 | 48 | this.embedObj = embedObj; |
47 | 49 | |
— | — | @@ -60,13 +62,13 @@ |
61 | 63 | * Get the controls html |
62 | 64 | * @return {String} html output of controls |
63 | 65 | */ |
64 | | - getControls:function() { |
| 66 | + getControls: function() { |
65 | 67 | // Set up local pointer to the embedObj |
66 | 68 | var embedObj = this.embedObj; |
67 | 69 | // set up local ctrlBuilder |
68 | 70 | var _this = this; |
69 | 71 | |
70 | | - js_log( 'f:controlsBuilder:: opt:' + this.options ); |
| 72 | + mw.log( 'f:controlsBuilder:: opt:' + this.options ); |
71 | 73 | this.id = ( embedObj.pc ) ? embedObj.pc.pp.id:embedObj.id; |
72 | 74 | this.available_width = embedObj.getPlayerWidth(); |
73 | 75 | |
— | — | @@ -87,8 +89,8 @@ |
88 | 90 | |
89 | 91 | |
90 | 92 | // 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 ) ); |
93 | 95 | |
94 | 96 | var o = ''; |
95 | 97 | for ( var i in this.components ) { |
— | — | @@ -100,23 +102,24 @@ |
101 | 103 | o += this.components[i].o( this ); |
102 | 104 | this.available_width -= this.components[i].w; |
103 | 105 | } else { |
104 | | - js_log( 'not enough space for control component:' + i ); |
| 106 | + mw.log( 'not enough space for control component:' + i ); |
105 | 107 | } |
106 | 108 | } |
107 | 109 | } |
108 | 110 | return o; |
109 | 111 | }, |
110 | 112 | |
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 | + */ |
116 | 119 | addControlHooks:function( $target ) { |
117 | 120 | // Set up local pointer to the embedObj |
118 | 121 | var embedObj = this.embedObj; |
119 | 122 | var _this = this; |
120 | | - |
| 123 | + |
121 | 124 | if ( !$target ) |
122 | 125 | $target = $j( '#' + embedObj.id ); |
123 | 126 | |
— | — | @@ -130,7 +133,7 @@ |
131 | 134 | $j( '#dc_' + embedObj.id ).hover( |
132 | 135 | function() { |
133 | 136 | if ( $j( '#gnp_' + embedObj.id ).length == 0 ) { |
134 | | - var toppos = ( embedObj.instanceOf == 'mvPlayList' ) ? 25:10; |
| 137 | + var toppos = ( embedObj.instanceOf == 'mvPlayList' ) ? 25 : 10; |
135 | 138 | $j( this ).append( '<div id="gnp_' + embedObj.id + '" class="ui-state-highlight ui-corner-all" ' + |
136 | 139 | 'style="position:absolute;display:none;background:#FFF;top:' + toppos + 'px;left:10px;right:10px;">' + |
137 | 140 | gM( 'mwe-for_best_experience' ) + |
— | — | @@ -151,7 +154,7 @@ |
152 | 155 | |
153 | 156 | } ); |
154 | 157 | } |
155 | | - // Only show the warrning if cookie and config are true |
| 158 | + // Only show the warning if cookie and config are true |
156 | 159 | if ( mw.getConfig( 'show_player_warning' ) === true ) |
157 | 160 | $j( '#gnp_' + embedObj.id ).fadeIn( 'slow' ); |
158 | 161 | }, |
— | — | @@ -182,7 +185,7 @@ |
183 | 186 | } ); |
184 | 187 | |
185 | 188 | // 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 ); |
187 | 190 | $target.find( '.play_head' ).slider( { |
188 | 191 | range: "min", |
189 | 192 | value: 0, |
— | — | @@ -199,7 +202,7 @@ |
200 | 203 | slide: function( event, ui ) { |
201 | 204 | var perc = ui.value / 1000; |
202 | 205 | 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); |
204 | 207 | if ( _this.long_time_disp ) { |
205 | 208 | embedObj.setStatus( gM( 'mwe-seek_to', embedObj.jump_time ) ); |
206 | 209 | } else { |
— | — | @@ -222,7 +225,7 @@ |
223 | 226 | var perc = ui.value / 1000; |
224 | 227 | // set seek time (in case we have to do a url seek) |
225 | 228 | 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 ); |
227 | 230 | embedObj.setStatus( gM( 'mwe-seeking' ) ); |
228 | 231 | embedObj.doSeek( perc ); |
229 | 232 | } |
— | — | @@ -306,6 +309,7 @@ |
307 | 310 | } |
308 | 311 | return true; |
309 | 312 | }, |
| 313 | + |
310 | 314 | /** |
311 | 315 | * Binds the volume controls |
312 | 316 | */ |
— | — | @@ -314,7 +318,7 @@ |
315 | 319 | var _this = this; |
316 | 320 | var $target = $j( '#' + embedObj.id ); |
317 | 321 | $target.find( '.volume_control' ).unbind().btnBind().click( function() { |
318 | | - js_log( 'clicked volume control' ); |
| 322 | + mw.log( 'clicked volume control' ); |
319 | 323 | $j( '#' + embedObj.id ).get( 0 ).toggleMute(); |
320 | 324 | } ); |
321 | 325 | |
— | — | @@ -352,7 +356,7 @@ |
353 | 357 | max: 100, |
354 | 358 | slide: function( event, ui ) { |
355 | 359 | var perc = ui.value / 100; |
356 | | - // js_log('update volume:' + perc); |
| 360 | + // mw.log('update volume:' + perc); |
357 | 361 | embedObj.updateVolumen( perc ); |
358 | 362 | }, |
359 | 363 | change:function( event, ui ) { |
— | — | @@ -383,9 +387,9 @@ |
384 | 388 | }, |
385 | 389 | |
386 | 390 | /** |
387 | | - * Accessor to get component |
| 391 | + * Get component |
388 | 392 | * |
389 | | - * @param {String} compoent Component key to grab html output |
| 393 | + * @param {String} component Component key to grab html output |
390 | 394 | */ |
391 | 395 | getComponent:function( component ) { |
392 | 396 | if ( this.components[ component ] ) { |
— | — | @@ -432,7 +436,7 @@ |
433 | 437 | * The options for the player, includes player selection, |
434 | 438 | * download, and share options |
435 | 439 | */ |
436 | | - 'mv_embedded_options': { |
| 440 | + 'options_menu': { |
437 | 441 | 'w':0, |
438 | 442 | 'o':function( ctrlObj ) { |
439 | 443 | var o = '<div id="mv_vid_options_' + ctrlObj.id + '" class="videoOptions">' + |
Index: branches/js2-work/phase3/js2/mwEmbed/mwEmbed.js |
— | — | @@ -5,7 +5,8 @@ |
6 | 6 | * All MediaWiki code is released under the GPL2. |
7 | 7 | * For more information visit http://metavid.org/wiki/Code |
8 | 8 | * |
9 | | - * @author Michael Dale |
| 9 | + * @author Michael Dale ( mdale at wikimedia.org ) |
| 10 | + * @author and many others, see svn log for details |
10 | 11 | * |
11 | 12 | * mwEmbed uses the following libraries: |
12 | 13 | * |
— | — | @@ -66,8 +67,8 @@ |
67 | 68 | // If the k-skin video player should attribute kaltura |
68 | 69 | 'k_attribution' : true, |
69 | 70 | |
70 | | - // The path of mvEmbed in mediaWiki folder |
71 | | - 'mediaWikiPath' : 'js2/mwEmbed/', |
| 71 | + // The mediaWiki path of mvEmbed |
| 72 | + 'mediaWiki_mwEmbedPath' : 'js2/mwEmbed/', |
72 | 73 | |
73 | 74 | //If we are in debug mode ( results in fresh debugg javascript includes ) |
74 | 75 | 'debug' : false |
— | — | @@ -83,20 +84,22 @@ |
84 | 85 | * Any global functions/classes that are not jQuery plugins should make |
85 | 86 | * there way into the mw namespace |
86 | 87 | */ |
87 | | -( function( $ ) { |
88 | | - // list valid skins here: |
| 88 | +( function( $ ) { |
| 89 | + |
| 90 | + // List valid skins here: |
89 | 91 | $.valid_skins = [ 'mvpcf', 'kskin' ]; |
90 | | - // the version of mwEmbed |
| 92 | + |
| 93 | + // The version of mwEmbed |
91 | 94 | $.version = '1.1'; |
92 | 95 | |
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 ) |
96 | 99 | $.commons_api_url = 'http://commons.wikimedia.org/w/api.php'; |
97 | 100 | |
98 | 101 | /** |
99 | 102 | * Some global containers flags |
100 | | - */ |
| 103 | + */ |
101 | 104 | $.skin_list = new Array(); |
102 | 105 | $.init_done = false; |
103 | 106 | $.cb_count = 0; |
— | — | @@ -108,7 +111,7 @@ |
109 | 112 | * |
110 | 113 | * Simple system of inherit defauts, with getter setter functions: |
111 | 114 | */ |
112 | | - |
| 115 | + |
113 | 116 | // Local scope configuration var: |
114 | 117 | mwConfig = { }; |
115 | 118 | |
— | — | @@ -141,7 +144,6 @@ |
142 | 145 | } |
143 | 146 | |
144 | 147 | |
145 | | - |
146 | 148 | /** |
147 | 149 | * Language classes mw.lang |
148 | 150 | * |
— | — | @@ -215,6 +217,7 @@ |
216 | 218 | // return the transformed msg |
217 | 219 | return pObj.getHTML(); |
218 | 220 | } |
| 221 | + |
219 | 222 | /** |
220 | 223 | * gMsgSwap |
221 | 224 | * |
— | — | @@ -282,7 +285,7 @@ |
283 | 286 | * Plural matchRuleTest |
284 | 287 | */ |
285 | 288 | function matchRuleTest( cRule, val ) { |
286 | | - js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val ); |
| 289 | + mw.log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val ); |
287 | 290 | function checkValue( compare, val ) { |
288 | 291 | if ( typeof compare == 'string' ) { |
289 | 292 | range = compare.split( '-' ); |
— | — | @@ -339,7 +342,7 @@ |
340 | 343 | * @param |
341 | 344 | */ |
342 | 345 | function getTempParamFromRuleInx( tObj, ruleInx ) { |
343 | | - // js_log('getTempParamFromRuleInx: ruleInx: ' + ruleInx + ' tempParamLength ' + tObj.param.length ); |
| 346 | + // mw.log('getTempParamFromRuleInx: ruleInx: ' + ruleInx + ' tempParamLength ' + tObj.param.length ); |
344 | 347 | if ( ruleInx >= tObj.param.length ) |
345 | 348 | return tObj.param[ tObj.param.length - 1 ]; |
346 | 349 | // else return the requested index: |
— | — | @@ -350,12 +353,12 @@ |
351 | 354 | for ( var ruleInx in rs ) { |
352 | 355 | cRule = rs[ruleInx]; |
353 | 356 | if ( matchRuleTest( cRule, tObj.arg ) ) { |
354 | | - js_log("matched rule: " + ruleInx ); |
| 357 | + mw.log("matched rule: " + ruleInx ); |
355 | 358 | return getTempParamFromRuleInx( tObj, rCount ); |
356 | 359 | } |
357 | 360 | rCount ++; |
358 | 361 | } |
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 ] ); |
360 | 363 | //debugger; |
361 | 364 | // return the last /"other" template param |
362 | 365 | return tObj.param [ tObj.param.length - 1 ]; |
— | — | @@ -377,15 +380,14 @@ |
378 | 381 | ammessages += msgSet; |
379 | 382 | } |
380 | 383 | if ( ammessages == '' ) { |
381 | | - js_log( 'gMsgLoadRemote: no message set requested' ); |
| 384 | + mw.log( 'gMsgLoadRemote: no message set requested' ); |
382 | 385 | return false; |
383 | 386 | } |
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 ) { |
390 | 392 | if ( data.query.allmessages ) { |
391 | 393 | var msgs = data.query.allmessages; |
392 | 394 | for ( var i in msgs ) { |
— | — | @@ -670,7 +672,7 @@ |
671 | 673 | * NOTE: should be integrated with the parser |
672 | 674 | */ |
673 | 675 | getTemplateVars: function(){ |
674 | | - //js_log('matching against: ' + wikiText); |
| 676 | + //mw.log('matching against: ' + wikiText); |
675 | 677 | templateVars = new Array(); |
676 | 678 | var tempVars = wikiText.match(/\{\{\{([^\}]*)\}\}\}/gi); |
677 | 679 | |
— | — | @@ -785,15 +787,20 @@ |
786 | 788 | } |
787 | 789 | |
788 | 790 | // 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 | + } |
792 | 798 | } |
793 | 799 | |
794 | 800 | // Check for the module name loader function |
795 | 801 | if( this.moduleLoaders[ loadRequest ] && |
796 | 802 | typeof ( this.moduleLoaders[ loadRequest ] ) == 'function' |
797 | 803 | ){ |
| 804 | + mw.log("loadModule:" + loadRequest ); |
798 | 805 | //Run the module with the parent callback |
799 | 806 | this.moduleLoaders[ loadRequest ]( callback ); |
800 | 807 | return ; |
— | — | @@ -812,7 +819,7 @@ |
813 | 820 | } |
814 | 821 | |
815 | 822 | //possible error? |
816 | | - js_log( "Error could not handle load request" ); |
| 823 | + mw.log( "Error could not handle load request" ); |
817 | 824 | }, |
818 | 825 | |
819 | 826 | |
— | — | @@ -823,43 +830,102 @@ |
824 | 831 | * @param {Object} loadSet Set of scripts to be loaded |
825 | 832 | * @param {Function} callback Function to call once all scripts are loaded. |
826 | 833 | */ |
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 = { }; |
831 | 839 | |
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 | + } |
838 | 857 | |
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 ) ); |
851 | 864 | //Check if all load request states are set 1 |
852 | 865 | 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 ) |
855 | 868 | loadDone = false; |
856 | 869 | } |
857 | 870 | // Run the parent scope callback for "loadMany" |
858 | | - if( loadDone ) |
859 | | - callback(); |
| 871 | + if( loadDone ){ |
| 872 | + callback( loadName ); |
| 873 | + } |
860 | 874 | } ); |
861 | 875 | } |
862 | 876 | }, |
| 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 | + }, |
863 | 928 | |
| 929 | + |
864 | 930 | /** |
865 | 931 | * Load a sets of scripts satisfy dependency order for browsers that execute out of order |
866 | 932 | * |
— | — | @@ -867,9 +933,9 @@ |
868 | 934 | * Sets are requested in array order. |
869 | 935 | */ |
870 | 936 | loadDependencyChain: function( loadChain, callback ){ |
871 | | - var _this = this; |
| 937 | + var _this = this; |
872 | 938 | // Load with dependency checks |
873 | | - this.load( loadChain.shift(), function() { |
| 939 | + this.load( loadChain.shift(), function() { |
874 | 940 | if ( loadChain.length != 0 ) { |
875 | 941 | _this.loadDependencyChain( loadChain, callback ); |
876 | 942 | } else { |
— | — | @@ -889,28 +955,32 @@ |
890 | 956 | |
891 | 957 | // Make sure the class is not already defined: |
892 | 958 | if ( $.isset( className ) ){ |
893 | | - js_log( 'Class ( ' + className + ' ) already defined ' ); |
| 959 | + mw.log( 'Class ( ' + className + ' ) already defined ' ); |
894 | 960 | callback( className ); |
895 | 961 | return ; |
896 | 962 | } |
897 | 963 | |
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; |
902 | 966 | |
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; |
907 | 970 | }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 | + } |
915 | 985 | |
916 | 986 | // Check for any associated style sheets that should be loaded |
917 | 987 | if( typeof this.stylePaths[ className ] != 'undefined' ){ |
— | — | @@ -918,7 +988,7 @@ |
919 | 989 | } |
920 | 990 | |
921 | 991 | // Issue the request to load the class (include class name in result callback: |
922 | | - $.getScript( url, function( ) { |
| 992 | + $.getScript( scriptRequest, function( ) { |
923 | 993 | callback( className ); |
924 | 994 | } ); |
925 | 995 | |
— | — | @@ -997,7 +1067,73 @@ |
998 | 1068 | return $.loader.addClassStyleSheets( sheetSet ); |
999 | 1069 | } |
1000 | 1070 | |
| 1071 | + |
1001 | 1072 | /** |
| 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 | + /** |
1002 | 1138 | * Utility Functions |
1003 | 1139 | */ |
1004 | 1140 | |
— | — | @@ -1039,6 +1175,40 @@ |
1040 | 1176 | } |
1041 | 1177 | |
1042 | 1178 | /** |
| 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 | + /** |
1043 | 1213 | * Get a loading spiner html |
1044 | 1214 | * @param {String} [Optional] style Style string to apply to the spiner |
1045 | 1215 | */ |
— | — | @@ -1061,32 +1231,32 @@ |
1062 | 1232 | * |
1063 | 1233 | * @param {Function} callback Function to run once DOM and jQuery are ready |
1064 | 1234 | */ |
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 |
1067 | 1239 | mwOnLoadFuncitons.push ( callback ); |
| 1240 | + |
| 1241 | + // Run the setup call ( won't run if already called earlier) |
| 1242 | + $.setupMwEmbed(); |
1068 | 1243 | |
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 | | - } |
1074 | 1244 | return ; |
1075 | 1245 | } |
1076 | 1246 | // If mwReadyFlag is already "ready" call the callback directly: |
1077 | | - callback(); |
| 1247 | + callback(); |
1078 | 1248 | } |
1079 | 1249 | |
1080 | 1250 | /** |
1081 | 1251 | * Runs all the queued functions |
1082 | 1252 | */ |
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 ( ){ |
1088 | 1254 | // Run all the queued functions: |
1089 | 1255 | while( mwOnLoadFuncitons.length ) |
1090 | 1256 | mwOnLoadFuncitons.pop()(); |
| 1257 | + |
| 1258 | + // Sets mwReadyFlag to true so that future addOnLoadHook calls |
| 1259 | + // know to call the callback directly |
| 1260 | + mwReadyFlag = true; |
1091 | 1261 | } |
1092 | 1262 | |
1093 | 1263 | /** |
— | — | @@ -1097,13 +1267,13 @@ |
1098 | 1268 | // Flag to ensure setup is only run once: |
1099 | 1269 | var mwSetupFlag = false; |
1100 | 1270 | |
1101 | | - $.setupMwEmbed = function ( ) { |
| 1271 | + $.setupMwEmbed = function ( ) { |
1102 | 1272 | // Only run the setup once: |
1103 | 1273 | if( mwSetupFlag ) |
1104 | 1274 | return ; |
1105 | 1275 | mwSetupFlag = true; |
1106 | 1276 | |
1107 | | - js_log( 'mw:setupMwEmbed' ); |
| 1277 | + mw.log( 'mw:setupMwEmbed' ); |
1108 | 1278 | |
1109 | 1279 | // Make sure jQuery is loaded: |
1110 | 1280 | $.load( 'window.jQuery', function(){ |
— | — | @@ -1154,7 +1324,7 @@ |
1155 | 1325 | $.domReady = function ( ) { |
1156 | 1326 | if( mwDomReadyFlag ) |
1157 | 1327 | return ; |
1158 | | - js_log( 'run:domReady' ); |
| 1328 | + mw.log( 'run:domReady' ); |
1159 | 1329 | // Set the onDomReady Flag |
1160 | 1330 | mwDomReadyFlag = true; |
1161 | 1331 | |
— | — | @@ -1174,23 +1344,7 @@ |
1175 | 1345 | if ( mwOnLoadFuncitons.length ){ |
1176 | 1346 | $.setupMwEmbed(); |
1177 | 1347 | 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 | + } |
1195 | 1349 | } |
1196 | 1350 | |
1197 | 1351 | /** |
— | — | @@ -1229,26 +1383,37 @@ |
1230 | 1384 | } |
1231 | 1385 | |
1232 | 1386 | /** |
1233 | | - * Wrapper for jQuery getScript |
| 1387 | + * Wrapper for jQuery getScript, |
| 1388 | + * Uses the scriptLoader if enabled |
1234 | 1389 | * |
1235 | 1390 | * If jQuery is not ready load it. |
1236 | 1391 | * |
1237 | | - * @param {String} url Url of script |
| 1392 | + * @param {String} scriptRequest The requested path or classNames for the scriptLoader |
1238 | 1393 | * @param {Function} callback Function to call once script is loaded |
1239 | 1394 | */ |
1240 | | - $.getScript = function( url, callback ){ |
| 1395 | + $.getScript = function( scriptRequest, callback ){ |
1241 | 1396 | |
| 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 | + |
1242 | 1406 | // 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 )? '?' : '&'; |
1246 | 1408 | url += $.getUrlParam(); |
1247 | 1409 | |
1248 | | - js_log( 'mw.getScript: ' + url ); |
| 1410 | + mw.log( 'mw.getScript: ' + url ); |
1249 | 1411 | |
1250 | 1412 | // If jQuery is available and debug is off get the scirpt j |
1251 | 1413 | if( $.isset( 'window.jQuery' ) && $.getConfig( 'debug' ) === false ) { |
1252 | | - $j.getScript( url, callback ); |
| 1414 | + $j.getScript( url, function(){ |
| 1415 | + if( callback ) |
| 1416 | + callback( scriptRequest ); |
| 1417 | + }); |
1253 | 1418 | return ; |
1254 | 1419 | } |
1255 | 1420 | |
— | — | @@ -1269,10 +1434,12 @@ |
1270 | 1435 | if ( !done && (!this.readyState || |
1271 | 1436 | this.readyState == "loaded" || this.readyState == "complete") ) { |
1272 | 1437 | done = true; |
1273 | | - callback(); |
| 1438 | + if( callback ) |
| 1439 | + callback( scriptRequest ); |
1274 | 1440 | } |
1275 | | - }; |
1276 | | - |
| 1441 | + }; |
| 1442 | + // Note: we could check for "className" here |
| 1443 | + |
1277 | 1444 | // Append the script to the DOM: |
1278 | 1445 | head.appendChild( script ); |
1279 | 1446 | } |
— | — | @@ -1307,11 +1474,11 @@ |
1308 | 1475 | foundSheet = true; |
1309 | 1476 | } ); |
1310 | 1477 | if( foundSheet ){ |
1311 | | - js_log( 'sheet: ' + url + ' already included ' ); |
| 1478 | + mw.log( 'sheet: ' + url + ' already included ' ); |
1312 | 1479 | return ; |
1313 | 1480 | } |
1314 | 1481 | |
1315 | | - js_log( ' add css: ' + url ); |
| 1482 | + mw.log( ' add css: ' + url ); |
1316 | 1483 | $j( 'head' ).append( |
1317 | 1484 | $j('<link>').attr( { |
1318 | 1485 | 'rel' : 'stylesheet', |
— | — | @@ -1333,7 +1500,7 @@ |
1334 | 1501 | |
1335 | 1502 | // Local mwEmbedPath variable ( for cache of $.getMwEmbedPath ) |
1336 | 1503 | var mwEmbedPath = null; |
1337 | | - |
| 1504 | + |
1338 | 1505 | /** |
1339 | 1506 | * Gets the path to the mwEmbed folder |
1340 | 1507 | */ |
— | — | @@ -1353,7 +1520,7 @@ |
1354 | 1521 | // Check for scriptLoader include of mwEmbed: |
1355 | 1522 | if ( src.indexOf( 'mwScriptLoader.php' ) !== -1 ) { |
1356 | 1523 | // 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' ); |
1358 | 1525 | } |
1359 | 1526 | |
1360 | 1527 | // Script-loader has jsScriptLoader name when local: |
— | — | @@ -1363,15 +1530,33 @@ |
1364 | 1531 | |
1365 | 1532 | // Error out if we could not get the path: |
1366 | 1533 | if( ! mwpath ){ |
1367 | | - js_log( "Error could not get mwEmbed path " ); |
| 1534 | + mw.log( "Error could not get mwEmbed path " ); |
1368 | 1535 | return ; |
1369 | 1536 | } |
1370 | 1537 | // Update the cached var with the absolute path: |
1371 | 1538 | mwEmbedPath = $.absoluteUrl( mwpath ) ; |
1372 | 1539 | return mwEmbedPath; |
1373 | 1540 | } |
1374 | | - |
| 1541 | + |
1375 | 1542 | /** |
| 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 | + /** |
1376 | 1561 | * Given a float number of seconds, returns npt format response. |
1377 | 1562 | * |
1378 | 1563 | * @param {Float} sec Seconds |
— | — | @@ -1379,7 +1564,7 @@ |
1380 | 1565 | */ |
1381 | 1566 | $.seconds2npt = function( sec, show_ms ) { |
1382 | 1567 | 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); |
1384 | 1569 | return '0:0:0'; |
1385 | 1570 | } |
1386 | 1571 | var hours = Math.floor( sec / 3600 ); |
— | — | @@ -1400,13 +1585,13 @@ |
1401 | 1586 | } |
1402 | 1587 | |
1403 | 1588 | /** |
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 | + */ |
1408 | 1593 | $.npt2seconds = function ( npt_str ) { |
1409 | 1594 | if ( !npt_str ) { |
1410 | | - // js_log('npt2seconds:not valid ntp:'+ntp); |
| 1595 | + // mw.log('npt2seconds:not valid ntp:'+ntp); |
1411 | 1596 | return false; |
1412 | 1597 | } |
1413 | 1598 | // Strip {npt:}01:02:20 or 32{s} from time if present |
— | — | @@ -1460,7 +1645,7 @@ |
1461 | 1646 | } |
1462 | 1647 | } |
1463 | 1648 | } |
1464 | | - js_log( 'Error: getMwEmbedScriptURL failed to get script path' ); |
| 1649 | + mw.log( 'Error: getMwEmbedScriptURL failed to get script path' ); |
1465 | 1650 | return false; |
1466 | 1651 | } |
1467 | 1652 | |
— | — | @@ -1504,6 +1689,39 @@ |
1505 | 1690 | return mwUrlParam; |
1506 | 1691 | } |
1507 | 1692 | |
| 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 | + |
1508 | 1726 | /** |
1509 | 1727 | * parseUri 1.2.2 |
1510 | 1728 | * (c) Steven Levithan <stevenlevithan.com> |
— | — | @@ -1569,40 +1787,9 @@ |
1570 | 1788 | }else{ |
1571 | 1789 | return parsedUrl.protocol + '://' + parsedUrl.authority + parsedUrl.directory + src; |
1572 | 1790 | } |
1573 | | - }; |
| 1791 | + }; |
1574 | 1792 | |
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 | | - } |
1605 | 1793 | |
1606 | | - |
1607 | 1794 | /** |
1608 | 1795 | * Takes in a string returns an xml dom object |
1609 | 1796 | * |
— | — | @@ -1621,7 +1808,7 @@ |
1622 | 1809 | xmldata.loadXML( str ); |
1623 | 1810 | return xmldata; |
1624 | 1811 | } catch (e){ |
1625 | | - js_log( 'XML parse ERROR: ' + e.message ); |
| 1812 | + mw.log( 'XML parse ERROR: ' + e.message ); |
1626 | 1813 | return false; |
1627 | 1814 | } |
1628 | 1815 | } |
— | — | @@ -1631,14 +1818,14 @@ |
1632 | 1819 | try { |
1633 | 1820 | var xmldata = ( new DOMParser() ).parseFromString( str, "text/xml" ); |
1634 | 1821 | } catch ( e ) { |
1635 | | - js_log( 'XML parse ERROR: ' + e.message ); |
| 1822 | + mw.log( 'XML parse ERROR: ' + e.message ); |
1636 | 1823 | return false; |
1637 | 1824 | } |
1638 | 1825 | return xmldata; |
1639 | 1826 | } |
1640 | 1827 | } )( window.mw ); |
1641 | 1828 | |
1642 | | -// load in js2 stopgap into proper location: |
| 1829 | +// Load in js2 stopgap into proper location: |
1643 | 1830 | if ( typeof gMsg != 'undefined' ) { |
1644 | 1831 | mw.addMessages( gMsg ) |
1645 | 1832 | } |
— | — | @@ -1678,8 +1865,8 @@ |
1679 | 1866 | "mw.testLang" : "tests/testLang.js", |
1680 | 1867 | |
1681 | 1868 | "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", |
1684 | 1871 | |
1685 | 1872 | "JSON" : "libMwApi/json2.js", |
1686 | 1873 | "$j.cookie" : "jquery/plugins/jquery.cookie.js", |
— | — | @@ -1775,7 +1962,7 @@ |
1776 | 1963 | // Add the module loader function: |
1777 | 1964 | mw.addModuleLoader( 'player', function( callback ){ |
1778 | 1965 | var _this = this; |
1779 | | - js_log( 'loadModule: player :' ); |
| 1966 | + mw.log( 'loadModule: player :' ); |
1780 | 1967 | |
1781 | 1968 | // Set module specific class videonojs to loading: |
1782 | 1969 | $j( '.videonojs' ).html( gM( 'mwe-loading_txt' ) ); |
— | — | @@ -1810,7 +1997,7 @@ |
1811 | 1998 | dependencyRequest[0].push( '$j.fn.pngFix' ); |
1812 | 1999 | |
1813 | 2000 | // 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 ) |
1815 | 2002 | if( $j.browser.msie ) |
1816 | 2003 | dependencyRequest[0].push( 'javaEmbed' ) |
1817 | 2004 | |
— | — | @@ -1826,10 +2013,11 @@ |
1827 | 2014 | |
1828 | 2015 | // Remove no video html elements: |
1829 | 2016 | $j( '.videonojs' ).remove(); |
1830 | | - //js_log(" run callback: " + callback ); |
| 2017 | + //mw.log(" run callback: " + callback ); |
1831 | 2018 | |
1832 | 2019 | // Run the callback with name of the module |
1833 | | - callback( 'player' ); |
| 2020 | + if( callback ) |
| 2021 | + callback( 'player' ); |
1834 | 2022 | } ); |
1835 | 2023 | |
1836 | 2024 | } ); // done with embedPlayer loader.js |
— | — | @@ -1878,273 +2066,9 @@ |
1879 | 2067 | mw.domReady(); |
1880 | 2068 | } |
1881 | 2069 | |
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 | | - |
2146 | 2070 | /* |
2147 | 2071 | * Store all the mwEmbed jQuery-specific bindings |
2148 | | - * (set up after jQuery is available). |
| 2072 | + * ( to be run after jQuery is available ). |
2149 | 2073 | * |
2150 | 2074 | * These functions are generally are loaders that do the dynamic mapping of |
2151 | 2075 | * dependencies for a given component |
— | — | @@ -2154,7 +2078,7 @@ |
2155 | 2079 | * |
2156 | 2080 | */ |
2157 | 2081 | function mwDojQueryBindings() { |
2158 | | - js_log( 'mv_jqueryBindings' ); |
| 2082 | + mw.log( 'mv_jqueryBindings' ); |
2159 | 2083 | ( function( $ ) { |
2160 | 2084 | |
2161 | 2085 | /** |
— | — | @@ -2186,7 +2110,7 @@ |
2187 | 2111 | * @param {Object} proxyConfig |
2188 | 2112 | */ |
2189 | 2113 | $.apiProxy = function( mode, proxyConfig, callback ) { |
2190 | | - js_log( 'do apiProxy setup' ); |
| 2114 | + mw.log( 'do apiProxy setup' ); |
2191 | 2115 | mw.load( [ |
2192 | 2116 | 'mw.proxy', |
2193 | 2117 | 'JSON' |
— | — | @@ -2206,7 +2130,7 @@ |
2207 | 2131 | |
2208 | 2132 | // non selector based add-media-wizard direct invocation with loader |
2209 | 2133 | $.addMediaWiz = function( options, callback ) { |
2210 | | - js_log( ".addMediaWiz call" ); |
| 2134 | + mw.log( ".addMediaWiz call" ); |
2211 | 2135 | // check if already loaded: |
2212 | 2136 | if ( window['rsdMVRS'] ) { |
2213 | 2137 | window['rsdMVRS'].showDialog(); |
— | — | @@ -2295,13 +2219,13 @@ |
2296 | 2220 | '$j.ui.tabs' |
2297 | 2221 | ] |
2298 | 2222 | ], function() { |
2299 | | - js_log( 'calling new mvSequencer' ); |
| 2223 | + mw.log( 'calling new mvSequencer' ); |
2300 | 2224 | // Initialise the sequence object (it will take over from there) |
2301 | 2225 | // No more than one mvSeq obj for now: |
2302 | 2226 | if ( !mw['mvSeq'] ) { |
2303 | 2227 | mw['mvSeq'] = new mvSequencer( options ); |
2304 | 2228 | } else { |
2305 | | - js_log( 'mvSeq already init' ); |
| 2229 | + mw.log( 'mvSeq already init' ); |
2306 | 2230 | } |
2307 | 2231 | } ); |
2308 | 2232 | } |
— | — | @@ -2323,14 +2247,14 @@ |
2324 | 2248 | var sElm = $j( this.selector ).get( 0 ); |
2325 | 2249 | if ( sElm['firefogg'] ) { |
2326 | 2250 | if ( sElm['firefogg'] == 'loading' ) { |
2327 | | - js_log( "Queued firefogg operations ( firefogg " + |
| 2251 | + mw.log( "Queued firefogg operations ( firefogg " + |
2328 | 2252 | "not done loading ) " ); |
2329 | 2253 | $j.extend( queuedFirefoggConf, options ); |
2330 | 2254 | return false; |
2331 | 2255 | } |
2332 | 2256 | // Update properties |
2333 | 2257 | for ( var i in options ) { |
2334 | | - js_log( "firefogg::updated: " + i + ' to ' + options[i] ); |
| 2258 | + mw.log( "firefogg::updated: " + i + ' to ' + options[i] ); |
2335 | 2259 | sElm['firefogg'][i] = options[i]; |
2336 | 2260 | } |
2337 | 2261 | return sElm['firefogg']; |
— | — | @@ -2364,7 +2288,7 @@ |
2365 | 2289 | } |
2366 | 2290 | // Make sure we have everything loaded that we need: |
2367 | 2291 | mw.load( loadSet, function() { |
2368 | | - js_log( 'firefogg libs loaded. target select:' + options.selector ); |
| 2292 | + mw.log( 'firefogg libs loaded. target select:' + options.selector ); |
2369 | 2293 | // Select interface provider based on whether we want to include the |
2370 | 2294 | // encoder interface or not |
2371 | 2295 | if ( options.encoder_interface ) { |
— | — | @@ -2377,10 +2301,10 @@ |
2378 | 2302 | var selectorElement = $j( options.selector ).get( 0 ); |
2379 | 2303 | selectorElement['firefogg'] = myFogg; |
2380 | 2304 | |
2381 | | - js_log( 'pre:' + selectorElement['firefogg']['firefogg_form_action'] ) |
| 2305 | + mw.log( 'pre:' + selectorElement['firefogg']['firefogg_form_action'] ) |
2382 | 2306 | if ( queuedFirefoggConf ) |
2383 | 2307 | $j.extend( selectorElement['firefogg'], queuedFirefoggConf ); |
2384 | | - js_log( 'post:' + selectorElement['firefogg']['firefogg_form_action'] ) |
| 2308 | + mw.log( 'post:' + selectorElement['firefogg']['firefogg_form_action'] ) |
2385 | 2309 | } |
2386 | 2310 | } ); |
2387 | 2311 | } |
— | — | @@ -2391,7 +2315,7 @@ |
2392 | 2316 | //add a special attribute to the selector: |
2393 | 2317 | if ( sElm['fogg_render'] ) { |
2394 | 2318 | if ( sElm['fogg_render'] == 'loading' ) { |
2395 | | - js_log( "Error: called firefoggRender while loading" ); |
| 2319 | + mw.log( "Error: called firefoggRender while loading" ); |
2396 | 2320 | return false; |
2397 | 2321 | } |
2398 | 2322 | // Call or update the property: |
— | — | @@ -2550,7 +2474,7 @@ |
2551 | 2475 | * @param callback The callback function to pass the token to |
2552 | 2476 | */ |
2553 | 2477 | function get_mw_token( title, api_url, callback ) { |
2554 | | - js_log( ':get_mw_token:' ); |
| 2478 | + mw.log( ':get_mw_token:' ); |
2555 | 2479 | if ( !title && wgUserName ) { |
2556 | 2480 | title = 'User:' + wgUserName; |
2557 | 2481 | } |
— | — | @@ -2575,74 +2499,13 @@ |
2576 | 2500 | } |
2577 | 2501 | ); |
2578 | 2502 | } |
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 = { }; |
2594 | 2503 | |
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 |
2644 | 2507 | // (we should not mix the two request types) |
2645 | 2508 | 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 ); |
2647 | 2510 | // If we are doing a request to the same domain or relative link, do a normal GET |
2648 | 2511 | if ( mw.parseUri( document.URL ).host == mw.parseUri( req_url ).host || |
2649 | 2512 | req_url.indexOf( '://' ) == -1 ){ // if its a relative url go directly as well |
— | — | @@ -2661,19 +2524,19 @@ |
2662 | 2525 | // Prepend json_ to feed_format if not already requesting json format (metavid specific) |
2663 | 2526 | if ( req_url.indexOf( "feed_format=" ) != -1 && req_url.indexOf( "feed_format=json" ) == -1 ) |
2664 | 2527 | 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 ) ); |
2666 | 2529 | } |
2667 | 2530 | } |
2668 | 2531 | |
2669 | 2532 | 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'] ); |
2671 | 2534 | // Run the callback from the global request callback object |
2672 | 2535 | if ( !global_req_cb[response['cb_inx']] ) { |
2673 | | - js_log( 'missing req cb index' ); |
| 2536 | + mw.log( 'missing req cb index' ); |
2674 | 2537 | return false; |
2675 | 2538 | } |
2676 | 2539 | if ( !response['pay_load'] ) { |
2677 | | - js_log( "missing pay load" ); |
| 2540 | + mw.log( "missing pay load" ); |
2678 | 2541 | return false; |
2679 | 2542 | } |
2680 | 2543 | switch( response['content-type'] ) { |
— | — | @@ -2685,33 +2548,12 @@ |
2686 | 2549 | } |
2687 | 2550 | break |
2688 | 2551 | default: |
2689 | | - js_log( 'bad response type' + response['content-type'] ); |
| 2552 | + mw.log( 'bad response type' + response['content-type'] ); |
2690 | 2553 | return false; |
2691 | 2554 | break; |
2692 | 2555 | } |
2693 | 2556 | global_req_cb[response['cb_inx']]( response['pay_load'] ); |
2694 | 2557 | } |
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 | | -} |
2716 | 2558 | |
2717 | 2559 | if ( typeof DOMParser == "undefined" ) { |
2718 | 2560 | DOMParser = function () { } |
— | — | @@ -2735,34 +2577,4 @@ |
2736 | 2578 | /* |
2737 | 2579 | * Utility functions |
2738 | 2580 | */ |
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>'; |
2756 | 2581 | |
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 @@ |
27 | 27 | var $rKey = ''; // the request key |
28 | 28 | var $error_msg = ''; |
29 | 29 | 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; |
31 | 33 | var $doProcReqFlag = true; |
32 | 34 | |
33 | 35 | function outputFromCache(){ |
34 | 36 | // Process the request |
35 | | - $this->rKey = $this->preProcRequestVars(); |
| 37 | + $this->requestKey = $this->preProcRequestVars(); |
36 | 38 | // Setup file cache object |
37 | | - $this->sFileCache = new simpleFileCache( $this->rKey ); |
| 39 | + $this->sFileCache = new simpleFileCache( $this->requestKey ); |
38 | 40 | if ( $this->sFileCache->isFileCached() ) { |
39 | 41 | // Just output headers so we can use PHP's @readfile:: |
40 | 42 | $this->outputJsHeaders(); |
— | — | @@ -47,30 +49,26 @@ |
48 | 50 | global $wgJSAutoloadClasses, $wgJSAutoloadLocalClasses, $IP, |
49 | 51 | $wgEnableScriptMinify, $wgUseFileCache, $wgExtensionMessagesFiles; |
50 | 52 | |
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'; |
53 | 55 | |
54 | | - //reset the rKey: |
55 | | - $this->rKey = ''; |
| 56 | + // Reset the requestKey: |
| 57 | + $this->requestKey = ''; |
56 | 58 | //do the post proc request with configuration vars: |
57 | 59 | $this->postProcRequestVars(); |
58 | 60 | //update the filename (if gzip is on) |
59 | 61 | $this->sFileCache->getCacheFileName(); |
60 | 62 | |
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"; |
68 | 66 | $this->jsout .= 'var mwLang = "' . htmlspecialchars( $this->langCode ) . '";' . "\n"; |
69 | 67 | // Build the output |
70 | 68 | |
71 | 69 | // Swap in the appropriate language per js_file |
72 | 70 | 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 ); |
75 | 73 | if( $jstxt ){ |
76 | 74 | $this->jsout .= $this->doProcessJs( $jstxt ); |
77 | 75 | } |
— | — | @@ -176,10 +174,14 @@ |
177 | 175 | // Output JS MIME type: |
178 | 176 | header( 'Content-Type: text/javascript' ); |
179 | 177 | 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 | + } |
184 | 186 | } |
185 | 187 | |
186 | 188 | function outputJsWithHeaders() { |
— | — | @@ -269,7 +271,7 @@ |
270 | 272 | } |
271 | 273 | if( $doAddWT ){ |
272 | 274 | $this->jsFileList[$reqClass] = true; |
273 | | - $this->rKey .= $reqClass; |
| 275 | + $this->requestKey .= $reqClass; |
274 | 276 | $this->jsvarurl = true; |
275 | 277 | } |
276 | 278 | continue; |
— | — | @@ -282,7 +284,7 @@ |
283 | 285 | $this->error_msg .= 'Requested class: ' . htmlspecialchars( $reqClass ) . ' not found' . "\n"; |
284 | 286 | }else{ |
285 | 287 | $this->jsFileList[ $reqClass ] = $jsFilePath; |
286 | | - $this->rKey .= $reqClass; |
| 288 | + $this->requestKey .= $reqClass; |
287 | 289 | } |
288 | 290 | } |
289 | 291 | } |
— | — | @@ -290,14 +292,14 @@ |
291 | 293 | |
292 | 294 | |
293 | 295 | // Add the language code to the rKey: |
294 | | - $this->rKey .= '_' . $wgContLanguageCode; |
| 296 | + $this->requestKey .= '_' . $wgContLanguageCode; |
295 | 297 | |
296 | 298 | // Add the unique rid |
297 | | - $this->rKey .= $this->urid; |
| 299 | + $this->requestKey .= $this->urid; |
298 | 300 | |
299 | 301 | // Add a minify flag |
300 | 302 | if ( $wgEnableScriptMinify ) { |
301 | | - $this->rKey .= '_min'; |
| 303 | + $this->requestKey .= '_min'; |
302 | 304 | } |
303 | 305 | } |
304 | 306 | /** |
— | — | @@ -404,7 +406,7 @@ |
405 | 407 | global $wgEnableScriptLocalization; |
406 | 408 | // Strip out js_log debug lines (if not in debug mode) |
407 | 409 | 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); |
409 | 411 | |
410 | 412 | // Do language swap by index: |
411 | 413 | if ( $wgEnableScriptLocalization ){ |
— | — | @@ -431,7 +433,8 @@ |
432 | 434 | } |
433 | 435 | $ignorenext = false; |
434 | 436 | $inquote = false; |
435 | | - //look for closing } not inside quotes:: |
| 437 | + |
| 438 | + // Look for closing } not inside quotes:: |
436 | 439 | for ( $i = $returnIndex['s']; $i < strlen( $str ); $i++ ) { |
437 | 440 | $char = $str[$i]; |
438 | 441 | if ( $ignorenext ) { |
— | — | @@ -478,22 +481,23 @@ |
479 | 482 | |
480 | 483 | static public function getMsgKeys(& $jmsg, $langCode = false){ |
481 | 484 | global $wgContLanguageCode; |
482 | | - //check the langCode |
| 485 | + // Check the langCode |
483 | 486 | if(!$langCode) |
484 | 487 | $langCode = $wgContLanguageCode; |
485 | 488 | |
486 | 489 | // Get the msg keys for the a json array |
487 | 490 | foreach ( $jmsg as $msgKey => $default_en_value ) { |
488 | | - $jmsg[$msgKey] = wfMsgGetKey( $msgKey, true, $langCode, false ); |
| 491 | + $jmsg[ $msgKey ] = wfMsgGetKey( $msgKey, true, $langCode, false ); |
489 | 492 | } |
490 | 493 | } |
491 | 494 | function languageMsgReplace( $json_str ) { |
492 | 495 | $jmsg = FormatJson::decode( '{' . $json_str . '}', true ); |
493 | 496 | // Do the language lookup |
494 | 497 | if ( $jmsg ) { |
495 | | - //see if any msgKey has the PLURAL template tag |
| 498 | + |
| 499 | + // See if any msgKey has the PLURAL template tag |
496 | 500 | //package in PLURAL mapping |
497 | | - self::getMsgKeys($jmsg, $this->langCode); |
| 501 | + self::getMsgKeys( $jmsg, $this->langCode ); |
498 | 502 | |
499 | 503 | // Return the updated loadGM JSON with updated msgs: |
500 | 504 | return FormatJson::encode( $jmsg ); |
— | — | @@ -517,20 +521,20 @@ |
518 | 522 | var $rKey = null; |
519 | 523 | |
520 | 524 | public function __construct( &$rKey ) { |
521 | | - $this->rKey = $rKey; |
| 525 | + $this->requestKey = $rKey; |
522 | 526 | $this->getCacheFileName(); |
523 | 527 | } |
524 | 528 | |
525 | 529 | public function getCacheFileName() { |
526 | 530 | global $wgUseGzip, $wgScriptCacheDirectory; |
527 | 531 | |
528 | | - $hash = md5( $this->rKey ); |
| 532 | + $hash = md5( $this->requestKey ); |
529 | 533 | # Avoid extension confusion |
530 | | - $key = str_replace( '.', '%2E', urlencode( $this->rKey ) ); |
| 534 | + $key = str_replace( '.', '%2E', urlencode( $this->requestKey ) ); |
531 | 535 | |
532 | 536 | $hash1 = substr( $hash, 0, 1 ); |
533 | 537 | $hash2 = substr( $hash, 0, 2 ); |
534 | | - $this->filename = "{$wgScriptCacheDirectory}/{$hash1}/{$hash2}/{$this->rKey}.js"; |
| 538 | + $this->filename = "{$wgScriptCacheDirectory}/{$hash1}/{$hash2}/{$this->requestKey}.js"; |
535 | 539 | |
536 | 540 | // Check for defined files:: |
537 | 541 | if( is_file( $this->filename ) ) |
Index: branches/js2-work/phase3/js2/mwEmbed/libTimedText/mvTextInterface.js |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | }, |
35 | 35 | // @@todo separate out data loader & data display |
36 | 36 | getTextTracks:function() { |
37 | | - // js_log("load timed text from roe: "+ this.pe.roe); |
| 37 | + // mw.log("load timed text from roe: "+ this.pe.roe); |
38 | 38 | var _this = this; |
39 | 39 | // if roe not yet loaded do load it: |
40 | 40 | if ( this.pe.roe || _this.pe.wikiTitleKey ) { |
— | — | @@ -50,14 +50,14 @@ |
51 | 51 | _this.getTextTracksWikiTitle() |
52 | 52 | } |
53 | 53 | } else { |
54 | | - js_log( 'row data ready (no roe request)' ); |
| 54 | + mw.log( 'row data ready (no roe request)' ); |
55 | 55 | _this.getParseTimedText_rowReady(); |
56 | 56 | } |
57 | 57 | } else { |
58 | 58 | if ( this.pe.media_element.textSourceExists() ) { |
59 | 59 | _this.getParseTimedText_rowReady(); |
60 | 60 | } else { |
61 | | - js_log( 'no roe data or timed text sources' ); |
| 61 | + mw.log( 'no roe data or timed text sources' ); |
62 | 62 | } |
63 | 63 | } |
64 | 64 | }, |
— | — | @@ -69,23 +69,19 @@ |
70 | 70 | if ( typeof wgNamespaceIds != 'undefined' && wgNamespaceIds['timedtext'] ) { |
71 | 71 | timedtext_ns = wgNamespaceIds['timedtext']; |
72 | 72 | } |
73 | | - do_api_req( { |
74 | | - 'url' : apiUrl, |
75 | | - 'data': { |
76 | | - 'list' : 'allpages', |
77 | | - 'apprefix' : _this.pe.wikiTitleKey, |
78 | | - 'apnamespace' : timedtext_ns, |
79 | | - 'prop':'revisions' |
80 | | - } |
81 | | - }, function( subData ) { |
| 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 ) { |
82 | 80 | 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 ) { |
90 | 86 | _this.doProcSubPages( subData, wgServer + wgScriptPath ); |
91 | 87 | } ); |
92 | 88 | } else { |
— | — | @@ -98,79 +94,74 @@ |
99 | 95 | // look for text tracks: |
100 | 96 | var foundTextTracks = false; |
101 | 97 | |
| 98 | + var request ={ |
| 99 | + 'meta' : 'siteinfo', |
| 100 | + 'siprop' : 'languages' |
| 101 | + } |
| 102 | + var url = hostPath + '/api.php'; |
102 | 103 | // 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]['*']; |
108 | 109 | } |
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; |
114 | 118 | } |
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 | | - } |
124 | 119 | |
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' ); |
148 | 122 | } 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; |
150 | 137 | } |
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 | + } ); |
152 | 147 | }, |
153 | 148 | checkSharedRepo:function() { |
154 | 149 | var _this = this; |
155 | | - js_log( 'checking for shared value of image' ); |
| 150 | + mw.log( 'checking for shared value of image' ); |
156 | 151 | // 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 ) { |
164 | 157 | 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 ) { |
175 | 166 | _this.editlink = 'http://commons.wikimedia.org/wiki/TimedText:' + _this.pe.wikiTitleKey + '.' + wgUserLanguage + '.srt'; |
176 | 167 | _this.doProcSubPages( data, 'http://commons.wikimedia.org/w/' ); |
177 | 168 | } ); |
— | — | @@ -184,7 +175,7 @@ |
185 | 176 | var _this = this; |
186 | 177 | var found_tracks = false; |
187 | 178 | // create timedTextObj |
188 | | - js_log( "mv_txt_load_:SHOW mv_txt_load_" ); |
| 179 | + mw.log( "mv_txt_load_:SHOW mv_txt_load_" ); |
189 | 180 | $j( '#mv_txt_load_' + _this.pe.id ).show(); // show the loading icon |
190 | 181 | |
191 | 182 | // setup edit link: |
— | — | @@ -242,13 +233,13 @@ |
243 | 234 | } ); |
244 | 235 | }, |
245 | 236 | addTrack: function( track_id ) { |
246 | | - js_log( 'f:displayTrack:' + track_id ); |
| 237 | + mw.log( 'f:displayTrack:' + track_id ); |
247 | 238 | var _this = this; |
248 | 239 | // set the display flag to true: |
249 | 240 | _this.availableTracks[ track_id ].display = true; |
250 | 241 | // setup the layout: |
251 | 242 | 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 ); |
253 | 244 | |
254 | 245 | // a flag to avoid checking all clips if we know we are adding to the end: |
255 | 246 | _this.add_to_end_on_this_pass = false; |
— | — | @@ -296,7 +287,7 @@ |
297 | 288 | } |
298 | 289 | } ); |
299 | 290 | } |
300 | | - // js_log('should just add to end: '+insertHTML); |
| 291 | + // mw.log('should just add to end: '+insertHTML); |
301 | 292 | if ( !inserted ) { |
302 | 293 | $j( '#mmbody_' + this.pe.id ).append( insertHTML ); |
303 | 294 | } |
— | — | @@ -309,7 +300,7 @@ |
310 | 301 | interval:200, // polling interval |
311 | 302 | timeout:200, // delay before onMouseOut |
312 | 303 | over:function () { |
313 | | - js_log( 'mvttseek: over' ); |
| 304 | + mw.log( 'mvttseek: over' ); |
314 | 305 | $j( this ).parent().addClass( 'tt_highlight' ); |
315 | 306 | // do section highlight |
316 | 307 | _this.pe.highlightPlaySection( { |
— | — | @@ -318,7 +309,7 @@ |
319 | 310 | } ); |
320 | 311 | }, |
321 | 312 | out:function () { |
322 | | - js_log( 'mvttseek: out' ); |
| 313 | + mw.log( 'mvttseek: out' ); |
323 | 314 | $j( this ).parent().removeClass( 'tt_highlight' ); |
324 | 315 | // de highlight section |
325 | 316 | _this.pe.hideHighlight(); |
— | — | @@ -367,7 +358,7 @@ |
368 | 359 | }, |
369 | 360 | getTsSelect:function() { |
370 | 361 | var _this = this; |
371 | | - js_log( 'getTsSelect' ); |
| 362 | + mw.log( 'getTsSelect' ); |
372 | 363 | var selHTML = '<div id="mvtsel_' + this.pe.id + '" style="position:absolute;background:#FFF;top:30px;left:0px;right:0px;bottom:0px;overflow:auto;">'; |
373 | 364 | selHTML += '<b>' + gM( 'mwe-select_transcript_set' ) + '</b><ul>'; |
374 | 365 | // debugger; |
— | — | @@ -418,7 +409,7 @@ |
419 | 410 | var curhl = $j( '#mmbody_' + this.pe.id + ' .tt_scroll_highlight' ).get( 0 ); |
420 | 411 | if ( mw.npt2seconds( $j( curhl ).attr( 'start' ) ) < cur_time && |
421 | 412 | mw.npt2seconds( $j( curhl ).attr( 'end' ) ) > cur_time ) { |
422 | | - /*js_log('in range of current hl: ' + |
| 413 | + /*mw.log('in range of current hl: ' + |
423 | 414 | mw.npt2seconds($j(curhl).attr('start')) + ' to ' + mw.npt2seconds($j(curhl).attr('end'))); |
424 | 415 | */ |
425 | 416 | search_for_range = false; |
— | — | @@ -428,7 +419,7 @@ |
429 | 420 | $j( '#mmbody_' + this.pe.id + ' .tt_scroll_highlight' ).removeClass( 'tt_scroll_highlight' ); |
430 | 421 | } |
431 | 422 | }; |
432 | | - /*js_log('search_for_range:'+search_for_range + ' for: '+ cur_time);*/ |
| 423 | + /*mw.log('search_for_range:'+search_for_range + ' for: '+ cur_time);*/ |
433 | 424 | if ( search_for_range ) { |
434 | 425 | // search for current time: add tt_scroll_highlight to clip |
435 | 426 | // optimize: |
— | — | @@ -442,7 +433,7 @@ |
443 | 434 | scrollTop: $j( this ).get( 0 ).offsetTop |
444 | 435 | }, 'slow' ); |
445 | 436 | $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')); |
447 | 438 | // done with loop |
448 | 439 | return false; |
449 | 440 | } |
— | — | @@ -462,7 +453,7 @@ |
463 | 454 | } |
464 | 455 | // jump to the current position: |
465 | 456 | var cur_time = parseInt ( this.pe.currentTime ); |
466 | | - js_log( 'cur time: ' + cur_time ); |
| 457 | + mw.log( 'cur time: ' + cur_time ); |
467 | 458 | |
468 | 459 | _this = this; |
469 | 460 | var scroll_to_id = ''; |
— | — | @@ -534,7 +525,7 @@ |
535 | 526 | this.lib = 'SRT'; |
536 | 527 | break; |
537 | 528 | 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' ); |
539 | 530 | return ; |
540 | 531 | break; |
541 | 532 | } |
— | — | @@ -570,7 +561,7 @@ |
571 | 562 | timedTextCMML = { |
572 | 563 | load: function( range, callback ) { |
573 | 564 | var _this = this; |
574 | | - js_log( 'textCMML: loading track: ' + this.src ); |
| 565 | + mw.log( 'textCMML: loading track: ' + this.src ); |
575 | 566 | |
576 | 567 | // :: Load transcript range :: |
577 | 568 | var pcurl = mw.parseUri( _this.getSRC() ); |
— | — | @@ -602,7 +593,7 @@ |
603 | 594 | } |
604 | 595 | } ); |
605 | 596 | 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 ); |
607 | 598 | _this.doParse( data ); |
608 | 599 | _this.loaded = true; |
609 | 600 | callback(); |
— | — | @@ -611,7 +602,7 @@ |
612 | 603 | doParse: function( data ) { |
613 | 604 | var _this = this; |
614 | 605 | $j.each( data.getElementsByTagName( 'clip' ), function( inx, clip ) { |
615 | | - // js_log(' on clip ' + clip.id); |
| 606 | + // mw.log(' on clip ' + clip.id); |
616 | 607 | var text_clip = { |
617 | 608 | start: $j( clip ).attr( 'start' ).replace( 'npt:', '' ), |
618 | 609 | end: $j( clip ).attr( 'end' ).replace( 'npt:', '' ), |
— | — | @@ -632,7 +623,7 @@ |
633 | 624 | timedTextSRT = { |
634 | 625 | load: function( range, callback ) { |
635 | 626 | var _this = this; |
636 | | - js_log( 'textSRT: loading : ' + _this.getSRC() ); |
| 627 | + mw.log( 'textSRT: loading : ' + _this.getSRC() ); |
637 | 628 | if ( _this.getSRC() ) { |
638 | 629 | do_request( _this.getSRC() , function( data ) { |
639 | 630 | _this.doParse( data ); |
— | — | @@ -640,14 +631,12 @@ |
641 | 632 | callback(); |
642 | 633 | } ); |
643 | 634 | } 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 ) { |
652 | 641 | if ( data && data.query && data.query.pages ) { |
653 | 642 | for ( var i in data.query.pages ) { |
654 | 643 | var page = data.query.pages[i]; |
Index: branches/js2-work/phase3/js2/mwEmbed/libTimedText/mvTimeTextEdit.js |
— | — | @@ -33,29 +33,27 @@ |
34 | 34 | return videoTitle; |
35 | 35 | } |
36 | 36 | 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 ) { |
43 | 42 | var apprefix = wgTitle.split( '.' ); |
44 | 43 | apprefix.pop(); |
45 | 44 | apprefix.pop(); |
46 | 45 | 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; |
60 | 58 | } |
61 | 59 | var langData = { }; |
62 | 60 | var languageSelect = '<select id="timed_text_language">'; |
— | — | @@ -100,7 +98,7 @@ |
101 | 99 | 'cmml': 'text/cmml' |
102 | 100 | } |
103 | 101 | if ( !mimeTypes[ extension ] ) { |
104 | | - js_log( 'Error: unknown extension:' + extension ); |
| 102 | + mw.log( 'Error: unknown extension:' + extension ); |
105 | 103 | } |
106 | 104 | |
107 | 105 | |
— | — | @@ -110,20 +108,18 @@ |
111 | 109 | $j( '.ui-dialog-buttonpane' ).remove(); |
112 | 110 | |
113 | 111 | var editToken = $j( 'input[name=wpEditToken]' ).val(); |
114 | | - |
115 | | - do_api_req( { |
116 | | - 'data': { |
| 112 | + var request = { |
117 | 113 | 'action' : 'edit', |
118 | 114 | 'title' : title, |
119 | 115 | 'text' : srt, |
120 | 116 | 'token': editToken |
121 | | - } |
122 | | - }, function( dialog ) { |
| 117 | + }; |
| 118 | + mw.getJSON( request, function( dialog ) { |
123 | 119 | return function( result ) { |
124 | 120 | document.location.href = wgArticlePath.replace( '/$1', '?title=' + title + '&action=edit' ); |
125 | 121 | $j( dialog ).dialog( 'close' ); |
126 | | - } }( this ) |
127 | | - ); |
| 122 | + } |
| 123 | + }( this ) ); |
128 | 124 | } else { |
129 | 125 | $j( this ).html( gM( "mwe-error-only-srt" ) ); |
130 | 126 | } |
Index: branches/js2-work/phase3/js2/mwEmbed/example_usage/Player_Themable.html |
— | — | @@ -3,8 +3,8 @@ |
4 | 4 | <html> |
5 | 5 | <head> |
6 | 6 | <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> --> |
9 | 9 | </head> |
10 | 10 | <script type="text/javascript"> |
11 | 11 | </script> |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -375,7 +375,7 @@ |
376 | 376 | */ |
377 | 377 | init: function( options ) { |
378 | 378 | var _this = this; |
379 | | - js_log( 'remoteSearchDriver:init' ); |
| 379 | + mw.log( 'remoteSearchDriver:init' ); |
380 | 380 | // Add in a local "id" reference to each provider |
381 | 381 | for ( var cp_id in this.content_providers ) { |
382 | 382 | this.content_providers[ cp_id ].id = cp_id; |
— | — | @@ -443,7 +443,7 @@ |
444 | 444 | |
445 | 445 | // Set up the "add media wizard" button, which invokes this object |
446 | 446 | if ( $j( this.target_invoke_button ).length == 0 ) { |
447 | | - js_log( "RemoteSearchDriver:: no target invocation provided " + |
| 447 | + mw.log( "RemoteSearchDriver:: no target invocation provided " + |
448 | 448 | "(will have to run your own createUI() )" ); |
449 | 449 | } else { |
450 | 450 | if ( this.target_invoke_button ) { |
— | — | @@ -462,7 +462,7 @@ |
463 | 463 | * @param license_key the license key (ie "by-sa" or "by-nc-sa" etc) |
464 | 464 | */ |
465 | 465 | getLicenseIconHtml: function( licenseObj ) { |
466 | | - // js_log('output images: '+ imgs); |
| 466 | + // mw.log('output images: '+ imgs); |
467 | 467 | return '<div class="rsd_license" title="' + licenseObj.title + '" >' + |
468 | 468 | '<a target="_new" href="' + licenseObj.lurl + '" ' + |
469 | 469 | 'title="' + licenseObj.title + '">' + |
— | — | @@ -484,7 +484,7 @@ |
485 | 485 | for ( var i = 0; i < license_set.length; i++ ) { |
486 | 486 | var lkey = license_set[i]; |
487 | 487 | if ( !cl.license_images[ lkey ] ) { |
488 | | - js_log( "MISSING::" + lkey ); |
| 488 | + mw.log( "MISSING::" + lkey ); |
489 | 489 | } |
490 | 490 | |
491 | 491 | title += ' ' + gM( 'mwe-cc_' + lkey + '_title' ); |
— | — | @@ -558,7 +558,7 @@ |
559 | 559 | } |
560 | 560 | |
561 | 561 | if ( type == 'unk' ) { |
562 | | - js_log( "unkown ftype: " + mimetype ); |
| 562 | + mw.log( "unkown ftype: " + mimetype ); |
563 | 563 | return ''; |
564 | 564 | } |
565 | 565 | |
— | — | @@ -590,7 +590,7 @@ |
591 | 591 | $j( this.target_invoke_button ) |
592 | 592 | .unbind() |
593 | 593 | .click( function() { |
594 | | - js_log( "createUI:target_invoke_button: click showDialog" ); |
| 594 | + mw.log( "createUI:target_invoke_button: click showDialog" ); |
595 | 595 | _this.showDialog(); |
596 | 596 | } ); |
597 | 597 | } |
— | — | @@ -602,7 +602,7 @@ |
603 | 603 | */ |
604 | 604 | showDialog: function() { |
605 | 605 | var _this = this; |
606 | | - js_log( "showDialog::" ); |
| 606 | + mw.log( "showDialog::" ); |
607 | 607 | _this.clearTextboxCache(); |
608 | 608 | var query = _this.getDefaultQuery(); |
609 | 609 | if ( query != $j( '#rsd_q' ).val() ) { |
— | — | @@ -676,11 +676,11 @@ |
677 | 677 | * Creates the dialog container |
678 | 678 | */ |
679 | 679 | createDialogContainer: function() { |
680 | | - js_log( "createDialogContainer" ); |
| 680 | + mw.log( "createDialogContainer" ); |
681 | 681 | var _this = this; |
682 | 682 | // add the parent target_container if not provided or missing |
683 | 683 | if ( _this.target_container && $j( _this.target_container ).length != 0 ) { |
684 | | - js_log( 'dialog already exists' ); |
| 684 | + mw.log( 'dialog already exists' ); |
685 | 685 | return; |
686 | 686 | } |
687 | 687 | |
— | — | @@ -693,7 +693,7 @@ |
694 | 694 | '</div>' ); |
695 | 695 | |
696 | 696 | // Get layout |
697 | | - js_log( 'width: ' + $j( window ).width() + ' height: ' + $j( window ).height() ); |
| 697 | + mw.log( 'width: ' + $j( window ).width() + ' height: ' + $j( window ).height() ); |
698 | 698 | |
699 | 699 | // Build cancel button |
700 | 700 | var cancelButton = {}; |
— | — | @@ -730,9 +730,9 @@ |
731 | 731 | * Sets up the initial html interface |
732 | 732 | */ |
733 | 733 | initDialog: function() { |
734 | | - js_log( 'initDialog' ); |
| 734 | + mw.log( 'initDialog' ); |
735 | 735 | var _this = this; |
736 | | - js_log( 'f::initDialog' ); |
| 736 | + mw.log( 'f::initDialog' ); |
737 | 737 | |
738 | 738 | var o = '<div class="rsd_control_container" style="width:100%">' + |
739 | 739 | '<form id="rsd_form" action="javascript:return false;" method="GET">' + |
— | — | @@ -801,7 +801,7 @@ |
802 | 802 | * Shows the upload tab loader and issues a call to showUploadForm |
803 | 803 | */ |
804 | 804 | showUploadTab: function() { |
805 | | - js_log( "showUploadTab::" ); |
| 805 | + mw.log( "showUploadTab::" ); |
806 | 806 | var _this = this; |
807 | 807 | // set it to loading: |
808 | 808 | $j( '#tab-upload' ).loadingSpiner(); |
— | — | @@ -921,7 +921,7 @@ |
922 | 922 | * @param {Bollean} resetPaging if the pagging should be reset |
923 | 923 | */ |
924 | 924 | showSearchTab: function( providerName, resetPaging ) { |
925 | | - js_log( "f:showSearchTab::" + providerName ); |
| 925 | + mw.log( "f:showSearchTab::" + providerName ); |
926 | 926 | |
927 | 927 | var draw_direct_flag = true; |
928 | 928 | |
— | — | @@ -933,10 +933,10 @@ |
934 | 934 | if ( provider.sObj.last_query == $j( '#rsd_q' ).val() |
935 | 935 | && provider.sObj.last_offset == provider.offset ) |
936 | 936 | { |
937 | | - js_log( 'last query is: ' + provider.sObj.last_query + |
| 937 | + mw.log( 'last query is: ' + provider.sObj.last_query + |
938 | 938 | ' matches: ' + $j( '#rsd_q' ).val() ); |
939 | 939 | } else { |
940 | | - js_log( 'last query is: ' + provider.sObj.last_query + |
| 940 | + mw.log( 'last query is: ' + provider.sObj.last_query + |
941 | 941 | ' not match: ' + $j( '#rsd_q' ).val() ); |
942 | 942 | draw_direct_flag = false; |
943 | 943 | } |
— | — | @@ -966,31 +966,27 @@ |
967 | 967 | */ |
968 | 968 | checkForCopyURLSupport: function ( callback ) { |
969 | 969 | var _this = this; |
970 | | - js_log( 'checkForCopyURLSupport:: ' ); |
| 970 | + mw.log( 'checkForCopyURLSupport:: ' ); |
971 | 971 | |
972 | 972 | // See if we already have the import mode: |
973 | 973 | if ( this.import_url_mode != 'autodetect' ) { |
974 | | - js_log( 'import mode: ' + _this.import_url_mode ); |
| 974 | + mw.log( 'import mode: ' + _this.import_url_mode ); |
975 | 975 | callback(); |
976 | 976 | } |
977 | 977 | // If we don't have the local wiki api defined we can't auto-detect use "link" |
978 | 978 | 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)' ); |
980 | 980 | _this.import_url_mode = 'remote_link'; |
981 | 981 | callback(); |
982 | 982 | } |
983 | 983 | 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 ) { |
992 | 989 | _this.checkCopyURLApiResult( data, callback ) |
993 | | - } |
994 | | - ); |
| 990 | + } ); |
995 | 991 | } |
996 | 992 | }, |
997 | 993 | |
— | — | @@ -1006,16 +1002,16 @@ |
1007 | 1003 | for ( var i in data.paraminfo.modules[0].parameters ) { |
1008 | 1004 | var pname = data.paraminfo.modules[0].parameters[i].name; |
1009 | 1005 | if ( pname == 'url' ) { |
1010 | | - js_log( 'Autodetect Upload Mode: api: copy by url:: ' ); |
| 1006 | + mw.log( 'Autodetect Upload Mode: api: copy by url:: ' ); |
1011 | 1007 | // Check permission too: |
1012 | 1008 | _this.checkForCopyURLPermission( function( canCopyUrl ) { |
1013 | 1009 | if ( canCopyUrl ) { |
1014 | 1010 | _this.import_url_mode = 'api'; |
1015 | | - js_log( 'import mode: ' + _this.import_url_mode ); |
| 1011 | + mw.log( 'import mode: ' + _this.import_url_mode ); |
1016 | 1012 | callback(); |
1017 | 1013 | } else { |
1018 | 1014 | _this.import_url_mode = 'none'; |
1019 | | - js_log( 'import mode: ' + _this.import_url_mode ); |
| 1015 | + mw.log( 'import mode: ' + _this.import_url_mode ); |
1020 | 1016 | callback(); |
1021 | 1017 | } |
1022 | 1018 | } ); |
— | — | @@ -1031,30 +1027,28 @@ |
1032 | 1028 | * if the user lacks permission. or $wgAllowCopyUploads is set to false |
1033 | 1029 | * (use this function if we want to issue a warning up front) |
1034 | 1030 | * |
1035 | | - * @param {Function} callback Function to call with URL permision |
| 1031 | + * @param {Function} callback Function to call with URL permission |
1036 | 1032 | * @return |
1037 | | - * false callback user does not have permision |
| 1033 | + * false callback user does not have permission |
1038 | 1034 | */ |
1039 | 1035 | checkForCopyURLPermission: function( callback ) { |
1040 | 1036 | var _this = this; |
1041 | 1037 | // 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 |
1055 | 1049 | } |
1056 | | - callback( false ); |
1057 | | - } |
1058 | | - ); |
| 1050 | + } |
| 1051 | + callback( false ); |
| 1052 | + } ); |
1059 | 1053 | }, |
1060 | 1054 | |
1061 | 1055 | /** |
— | — | @@ -1110,7 +1104,7 @@ |
1111 | 1105 | 'baseRemoteSearch', |
1112 | 1106 | provider.lib + 'Search' |
1113 | 1107 | ], function() { |
1114 | | - js_log( "loaded lib:: " + provider.lib ); |
| 1108 | + mw.log( "loaded lib:: " + provider.lib ); |
1115 | 1109 | // else we need to run the search: |
1116 | 1110 | var options = { |
1117 | 1111 | 'provider': provider, |
— | — | @@ -1118,7 +1112,7 @@ |
1119 | 1113 | }; |
1120 | 1114 | eval( 'provider.sObj = new ' + provider.lib + 'Search( options );' ); |
1121 | 1115 | 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 ); |
1123 | 1117 | return false; |
1124 | 1118 | } |
1125 | 1119 | |
— | — | @@ -1135,7 +1129,7 @@ |
1136 | 1130 | * @param {Function} callback called once loading is done |
1137 | 1131 | */ |
1138 | 1132 | waitForResults: function( callback ) { |
1139 | | - // js_log('rsd:waitForResults'); |
| 1133 | + // mw.log('rsd:waitForResults'); |
1140 | 1134 | var _this = this; |
1141 | 1135 | var loading_done = true; |
1142 | 1136 | |
— | — | @@ -1212,7 +1206,7 @@ |
1213 | 1207 | // Output the respective results holders |
1214 | 1208 | $j( '#rsd_results_container' ).html( s ); |
1215 | 1209 | // 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 ); |
1217 | 1211 | $j( "#rsd_tabs_container" ) |
1218 | 1212 | .tabs( { |
1219 | 1213 | selected: selected_tab, |
— | — | @@ -1244,7 +1238,7 @@ |
1245 | 1239 | if ( provider && provider['sObj'] && provider.sObj.resultsObj[resIndex] ) { |
1246 | 1240 | return provider.sObj.resultsObj[resIndex]; |
1247 | 1241 | } |
1248 | | - js_log( "ERROR: could not find " + resIndex ); |
| 1242 | + mw.log( "ERROR: could not find " + resIndex ); |
1249 | 1243 | return false; |
1250 | 1244 | }, |
1251 | 1245 | |
— | — | @@ -1252,7 +1246,7 @@ |
1253 | 1247 | * Show Results for the currentProvider |
1254 | 1248 | */ |
1255 | 1249 | showResults: function() { |
1256 | | - js_log( 'f:showResults::' + this.currentProvider ); |
| 1250 | + mw.log( 'f:showResults::' + this.currentProvider ); |
1257 | 1251 | var _this = this; |
1258 | 1252 | var o = ''; |
1259 | 1253 | var tabSelector = ''; |
— | — | @@ -1285,13 +1279,13 @@ |
1286 | 1280 | $j( tabSelector ).append( o + '<div style="clear:both"/>' ); |
1287 | 1281 | } |
1288 | 1282 | |
1289 | | - js_log( 'did numResults :: ' + numResults + |
| 1283 | + mw.log( 'did numResults :: ' + numResults + |
1290 | 1284 | ' append: ' + $j( '#rsd_q' ).val() ); |
1291 | 1285 | |
1292 | 1286 | // Remove any old search res |
1293 | 1287 | $j( '#rsd_no_search_res' ).remove(); |
1294 | 1288 | if ( numResults == 0 ) { |
1295 | | - $j( '#tab-' + cp_id ).append( |
| 1289 | + $j( '#tab-' + provider.id ).append( |
1296 | 1290 | '<span style="padding:10px">' + |
1297 | 1291 | gM( 'rsd_no_results', $j( '#rsd_q' ).val() ) + |
1298 | 1292 | '</span>' ); |
— | — | @@ -1494,7 +1488,7 @@ |
1495 | 1489 | * Show the resource editor |
1496 | 1490 | */ |
1497 | 1491 | showResourceEditor: function( resource, rsdElement ) { |
1498 | | - js_log( 'f:showResourceEditor:' + resource.title ); |
| 1492 | + mw.log( 'f:showResourceEditor:' + resource.title ); |
1499 | 1493 | var _this = this; |
1500 | 1494 | |
1501 | 1495 | // Remove any existing resource edit interface |
— | — | @@ -1511,7 +1505,7 @@ |
1512 | 1506 | var dialogTitle = gM( 'mwe-add_media_wizard' ) + ': ' + |
1513 | 1507 | gM( 'rsd_resource_edit', resource.title ); |
1514 | 1508 | $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 ); |
1516 | 1510 | |
1517 | 1511 | // Left side holds the image right size the controls / |
1518 | 1512 | $j( rsdElement ) |
— | — | @@ -1531,13 +1525,13 @@ |
1532 | 1526 | try { |
1533 | 1527 | imageRatio = $j( rsdElement ).get(0).height / $j( rsdElement ).get(0).width; |
1534 | 1528 | } 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' ) ; |
1536 | 1530 | } |
1537 | 1531 | if ( !imageRatio ) { |
1538 | 1532 | var imageRatio = 1; // set ratio to 1 if tRatio did not work. |
1539 | 1533 | } |
1540 | 1534 | |
1541 | | - js_log( 'Set from ' + imageRatio + ' to init thumbimage to ' + |
| 1535 | + mw.log( 'Set from ' + imageRatio + ' to init thumbimage to ' + |
1542 | 1536 | maxWidth + ' x ' + parseInt( imageRatio * maxWidth ) ); |
1543 | 1537 | // Scale up image and to swap with high res version |
1544 | 1538 | $j( '#rsd_edit_img' ).animate( |
— | — | @@ -1588,21 +1582,21 @@ |
1589 | 1583 | resource.pSobj.getImageObj( resource, size, function( imObj ) { |
1590 | 1584 | resource['edit_url'] = imObj.url; |
1591 | 1585 | |
1592 | | - js_log( "edit url: " + resource.edit_url ); |
| 1586 | + mw.log( "edit url: " + resource.edit_url ); |
1593 | 1587 | // Update the resource |
1594 | 1588 | resource['width'] = imObj.width; |
1595 | 1589 | resource['height'] = imObj.height; |
1596 | 1590 | |
1597 | 1591 | // See if we need to animate some transition |
1598 | 1592 | 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 ); |
1600 | 1594 | // Set the target id to the new size: |
1601 | 1595 | $j( '#' + target_img_id ).animate( { |
1602 | 1596 | 'width': imObj.width + 'px', |
1603 | 1597 | 'height': imObj.height + 'px' |
1604 | 1598 | }); |
1605 | 1599 | } else { |
1606 | | - js_log( 'use req size: ' + imObj.width + 'x' + imObj.height ); |
| 1600 | + mw.log( 'use req size: ' + imObj.width + 'x' + imObj.height ); |
1607 | 1601 | $j( '#' + target_img_id ).animate( { |
1608 | 1602 | 'width': imObj.width + 'px', |
1609 | 1603 | 'height': imObj.height + 'px' |
— | — | @@ -1616,7 +1610,7 @@ |
1617 | 1611 | // Let the caller know we are done and what size we ended up with: |
1618 | 1612 | callback(); |
1619 | 1613 | } ).error( function () { |
1620 | | - js_log( "Error with: " + resource.edit_url ); |
| 1614 | + mw.log( "Error with: " + resource.edit_url ); |
1621 | 1615 | } ).attr( 'src', resource.edit_url ); |
1622 | 1616 | } ); |
1623 | 1617 | }, |
— | — | @@ -1626,7 +1620,7 @@ |
1627 | 1621 | */ |
1628 | 1622 | onCancelClipEdit: function() { |
1629 | 1623 | var _this = this; |
1630 | | - js_log( 'onCancelClipEdit' ); |
| 1624 | + mw.log( 'onCancelClipEdit' ); |
1631 | 1625 | var b_target = _this.target_container + '~ .ui-dialog-buttonpane'; |
1632 | 1626 | $j( '#rsd_resource_edit' ).remove(); |
1633 | 1627 | |
— | — | @@ -1638,7 +1632,7 @@ |
1639 | 1633 | |
1640 | 1634 | // Restore the title: |
1641 | 1635 | $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' ); |
1643 | 1637 | // Restore the buttons: |
1644 | 1638 | $j( b_target ) |
1645 | 1639 | .html( $j.btnHtml( gM( 'mwe-cancel' ) , 'mv_cancel_rsd', 'close' ) ) |
— | — | @@ -1712,50 +1706,46 @@ |
1713 | 1707 | var options = _this.getClipEditOptions( resource ); |
1714 | 1708 | var mediaType = this.getMediaType( resource ); |
1715 | 1709 | |
1716 | | - js_log( 'media type:: ' + mediaType ); |
| 1710 | + mw.log( 'media type:: ' + mediaType ); |
1717 | 1711 | |
1718 | 1712 | // Get any additional embedding helper meta data prior to doing the actual embed |
1719 | 1713 | // normally this meta should be provided in the search result |
1720 | 1714 | // (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() { |
1723 | 1716 | var runFlag = false; |
1724 | | - mvJsLoader.embedPlayerCheck( function() { |
| 1717 | + // Make sure we have the 'player' module: |
| 1718 | + mw.load( 'player', function() { |
1725 | 1719 | // Strange concurrency issue with callbacks |
1726 | 1720 | // @@todo try and figure out why this callback is fired twice |
1727 | 1721 | if ( !runFlag ) { |
1728 | 1722 | runFlag = true; |
1729 | 1723 | } else { |
1730 | | - js_log( 'Error: embedPlayerCheck run twice' ); |
| 1724 | + mw.log( 'Error: embedPlayerCheck run twice' ); |
1731 | 1725 | return false; |
1732 | 1726 | } |
1733 | 1727 | var embedHtml = resource.pSobj.getEmbedHTML( resource, |
1734 | 1728 | { id : 'embed_vid' } ); |
1735 | | - js_log( 'append html: ' + embedHtml ); |
| 1729 | + mw.log( 'append html: ' + embedHtml ); |
1736 | 1730 | $j( '#clip_edit_disp' ).html( embedHtml ); |
1737 | 1731 | |
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() { |
1739 | 1735 | |
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 ); |
1760 | 1750 | } ); |
1761 | 1751 | } ); |
1762 | 1752 | } ); |
— | — | @@ -1857,7 +1847,7 @@ |
1858 | 1848 | * will be false. |
1859 | 1849 | */ |
1860 | 1850 | isFileAlreadyImported: function( resource, callback ) { |
1861 | | - js_log( '::isFileAlreadyImported:: ' ); |
| 1851 | + mw.log( '::isFileAlreadyImported:: ' ); |
1862 | 1852 | var _this = this; |
1863 | 1853 | |
1864 | 1854 | // Clone the resource |
— | — | @@ -1894,7 +1884,7 @@ |
1895 | 1885 | */ |
1896 | 1886 | showImportUI: function( resource, callback ) { |
1897 | 1887 | var _this = this; |
1898 | | - js_log( "showImportUI:: update:" + _this.canonicalFileNS + ':' + |
| 1888 | + mw.log( "showImportUI:: update:" + _this.canonicalFileNS + ':' + |
1899 | 1889 | resource.target_resource_title ); |
1900 | 1890 | |
1901 | 1891 | // setup the resource description from resource description: |
— | — | @@ -2004,14 +1994,14 @@ |
2005 | 1995 | $j( _this.target_container + ' .rsd_import_apreview' ) |
2006 | 1996 | .btnBind() |
2007 | 1997 | .click( function() { |
2008 | | - js_log( " Do preview asset update" ); |
| 1998 | + mw.log( " Do preview asset update" ); |
2009 | 1999 | $j( '#rsd_import_desc' ).html( mw.loading_spiner() ); |
2010 | 2000 | // load the preview text: |
2011 | 2001 | _this.parse( |
2012 | 2002 | $j( '#rsd_import_ta' ).val(), |
2013 | 2003 | _this.canonicalFileNS + ':' + resource.target_resource_title, |
2014 | 2004 | function( o ) { |
2015 | | - js_log( 'got updated preview: ' ); |
| 2005 | + mw.log( 'got updated preview: ' ); |
2016 | 2006 | $j( '#rsd_import_desc' ).html( o ); |
2017 | 2007 | } |
2018 | 2008 | ); |
— | — | @@ -2020,7 +2010,7 @@ |
2021 | 2011 | $j( buttonPaneSelector + ' .rsd_import_doimport' ) |
2022 | 2012 | .btnBind() |
2023 | 2013 | .click( function() { |
2024 | | - js_log( "do import asset:" + _this.import_url_mode ); |
| 2014 | + mw.log( "do import asset:" + _this.import_url_mode ); |
2025 | 2015 | // check import mode: |
2026 | 2016 | if ( _this.import_url_mode == 'api' ) { |
2027 | 2017 | if ( _this.upload_api_target == 'proxy' ) { |
— | — | @@ -2031,7 +2021,7 @@ |
2032 | 2022 | _this.doApiImport( resource, callback ); |
2033 | 2023 | } |
2034 | 2024 | } 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)" ); |
2036 | 2026 | } |
2037 | 2027 | } ); |
2038 | 2028 | $j( buttonPaneSelector + ' .rsd_import_acancel' ) |
— | — | @@ -2061,7 +2051,7 @@ |
2062 | 2052 | } |
2063 | 2053 | // setup the the proxy via $j.apiProxy loader: |
2064 | 2054 | 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" ); |
2066 | 2056 | return false; |
2067 | 2057 | } else { |
2068 | 2058 | $j.apiProxy( |
— | — | @@ -2086,7 +2076,7 @@ |
2087 | 2077 | * Callback is called with "false" if the file is not found |
2088 | 2078 | */ |
2089 | 2079 | findFileInLocalWiki: function( fileName, callback ) { |
2090 | | - js_log( "findFileInLocalWiki::" + fileName ); |
| 2080 | + mw.log( "findFileInLocalWiki::" + fileName ); |
2091 | 2081 | var _this = this; |
2092 | 2082 | var request = { |
2093 | 2083 | 'action': 'query', |
— | — | @@ -2096,29 +2086,24 @@ |
2097 | 2087 | 'iiurlwidth': '400' |
2098 | 2088 | }; |
2099 | 2089 | // 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; |
2115 | 2100 | } |
2116 | | - // else page is found: |
2117 | | - js_log( fileName + " found" ); |
2118 | | - callback( data.query.pages[i] ); |
2119 | 2101 | } |
| 2102 | + // else page is found: |
| 2103 | + mw.log( fileName + " found" ); |
| 2104 | + callback( data.query.pages[i] ); |
2120 | 2105 | } |
2121 | 2106 | } |
2122 | | - ); |
| 2107 | + } ); |
2123 | 2108 | }, |
2124 | 2109 | |
2125 | 2110 | /** |
— | — | @@ -2129,7 +2114,7 @@ |
2130 | 2115 | */ |
2131 | 2116 | doApiImport: function( resource, callback ) { |
2132 | 2117 | var _this = this; |
2133 | | - js_log( ":doApiImport:" ); |
| 2118 | + mw.log( ":doApiImport:" ); |
2134 | 2119 | $j.addLoaderDialog( gM( 'mwe-importing_asset' ) ); |
2135 | 2120 | |
2136 | 2121 | // Load the BaseUploadInterface: |
— | — | @@ -2139,13 +2124,13 @@ |
2140 | 2125 | '$j.ui.progressbar' |
2141 | 2126 | ], |
2142 | 2127 | function() { |
2143 | | - js_log( 'mvBaseUploadInterface ready' ); |
| 2128 | + mw.log( 'mvBaseUploadInterface ready' ); |
2144 | 2129 | // Initiate a upload object ( similar to url copy ): |
2145 | 2130 | // ( mvBaseUploadInterface handles upload errors ) |
2146 | 2131 | var uploader = new mvBaseUploadInterface( { |
2147 | 2132 | 'api_url' : _this.upload_api_target, |
2148 | 2133 | 'done_upload_cb':function() { |
2149 | | - js_log( 'doApiImport:: run callback::' ); |
| 2134 | + mw.log( 'doApiImport:: run callback::' ); |
2150 | 2135 | // We have finished the upload: |
2151 | 2136 | |
2152 | 2137 | // Close up the rsd_resource_import |
— | — | @@ -2264,7 +2249,7 @@ |
2265 | 2250 | */ |
2266 | 2251 | getEmbedCode: function( resource ) { |
2267 | 2252 | if ( this.import_url_mode == 'remote_link' ) { |
2268 | | - return resource.pSobj.getEmbedHTML( resource ); |
| 2253 | + return resource.pSobj.getEmbedHTML( resource, {'insert_description': true } ); |
2269 | 2254 | } else { |
2270 | 2255 | return resource.pSobj.getEmbedWikiCode( resource ); |
2271 | 2256 | } |
— | — | @@ -2333,7 +2318,7 @@ |
2334 | 2319 | * @param {Object} resource Resource to be inserted |
2335 | 2320 | */ |
2336 | 2321 | insertResource: function( resource ) { |
2337 | | - js_log( 'insertResource: ' + resource.title ); |
| 2322 | + mw.log( 'insertResource: ' + resource.title ); |
2338 | 2323 | var _this = this; |
2339 | 2324 | // Double check that the resource is present: |
2340 | 2325 | this.isFileLocallyAvailable( resource, function( status ) { |
— | — | @@ -2373,7 +2358,8 @@ |
2374 | 2359 | resource.mime.indexOf( 'video' ) != -1 || |
2375 | 2360 | resource.mime.indexOf( '/ogg' ) != -1 ) |
2376 | 2361 | { |
2377 | | - mvJsLoader.embedPlayerCheck(); |
| 2362 | + // Re-load the player module ( will scan page for mw.getConfig( 'rewritePlayerTags' ) ) |
| 2363 | + $j.embedPlayers(); |
2378 | 2364 | } |
2379 | 2365 | } |
2380 | 2366 | |
— | — | @@ -2386,7 +2372,7 @@ |
2387 | 2373 | */ |
2388 | 2374 | closeAll: function() { |
2389 | 2375 | var _this = this; |
2390 | | - js_log( "close all:: " + _this.target_container ); |
| 2376 | + mw.log( "close all:: " + _this.target_container ); |
2391 | 2377 | _this.onCancelClipEdit(); |
2392 | 2378 | // Give a chance for the events to complete |
2393 | 2379 | // (somehow at least in firefox a rare condition occurs where |
— | — | @@ -2489,7 +2475,7 @@ |
2490 | 2476 | var provider = _this.content_providers[ _this.currentProvider ]; |
2491 | 2477 | } |
2492 | 2478 | var search = provider.sObj; |
2493 | | - js_log( 'showPagingHeader:' + _this.currentProvider + ' len: ' + search.num_results ); |
| 2479 | + mw.log( 'showPagingHeader:' + _this.currentProvider + ' len: ' + search.num_results ); |
2494 | 2480 | var to_num = ( provider.limit > search.num_results ) ? |
2495 | 2481 | ( parseInt( provider.offset ) + parseInt( search.num_results ) ) : |
2496 | 2482 | ( parseInt( provider.offset ) + parseInt( provider.limit ) ); |
— | — | @@ -2534,7 +2520,7 @@ |
2535 | 2521 | * @param {String} provider_id Provider id to select and display |
2536 | 2522 | */ |
2537 | 2523 | selectTab: function( provider_id ) { |
2538 | | - js_log( 'select tab: ' + provider_id ); |
| 2524 | + mw.log( 'select tab: ' + provider_id ); |
2539 | 2525 | this.currentProvider = provider_id; |
2540 | 2526 | if ( this.currentProvider == 'upload' ) { |
2541 | 2527 | this.showUploadTab(); |
— | — | @@ -2549,7 +2535,7 @@ |
2550 | 2536 | * @param {String} mode Either "box" or "list" |
2551 | 2537 | */ |
2552 | 2538 | setDisplayMode: function( mode ) { |
2553 | | - js_log( 'setDisplayMode:' + mode ); |
| 2539 | + mw.log( 'setDisplayMode:' + mode ); |
2554 | 2540 | this.displayMode = mode; |
2555 | 2541 | // run /update search display: |
2556 | 2542 | this.showResults(); |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/dragDropFile.js |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | |
11 | 11 | ( function( $ ) { |
12 | 12 | $.fn.dragDropFile = function () { |
13 | | - js_log( "drag drop: " + this.selector ); |
| 13 | + mw.log( "drag drop: " + this.selector ); |
14 | 14 | // setup drag binding and highlight |
15 | 15 | var dC = $j( this.selector ).get( 0 ); |
16 | 16 | dC.addEventListener( "dragenter", |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js |
— | — | @@ -64,7 +64,7 @@ |
65 | 65 | if ( !options ) |
66 | 66 | options = {}; |
67 | 67 | $j.extend( this, default_bui_options, options ); |
68 | | - js_log( "init mvBaseUploadInterface:: " + this.api_url ); |
| 68 | + mw.log( "init mvBaseUploadInterface:: " + this.api_url ); |
69 | 69 | }, |
70 | 70 | |
71 | 71 | /** |
— | — | @@ -72,12 +72,12 @@ |
73 | 73 | * May remap it to use the API field names. |
74 | 74 | */ |
75 | 75 | setupForm: function() { |
76 | | - js_log( "Base::setupForm::" ); |
| 76 | + mw.log( "Base::setupForm::" ); |
77 | 77 | var _this = this; |
78 | 78 | // Set up the local pointer to the edit form: |
79 | 79 | this.form = this.getForm(); |
80 | 80 | if ( !this.form ) { |
81 | | - js_log( "Upload form not found!" ); |
| 81 | + mw.log( "Upload form not found!" ); |
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
— | — | @@ -102,7 +102,7 @@ |
103 | 103 | */ |
104 | 104 | onSubmit: function() { |
105 | 105 | var _this = this; |
106 | | - js_log( 'Base::onSubmit:' ); |
| 106 | + mw.log( 'Base::onSubmit:' ); |
107 | 107 | // Run the original onsubmit (if not run yet set flag to avoid excessive chaining) |
108 | 108 | if ( typeof( this.orig_onsubmit ) == 'function' ) { |
109 | 109 | if ( ! this.orig_onsubmit() ) { |
— | — | @@ -112,12 +112,12 @@ |
113 | 113 | } |
114 | 114 | // Check for post action override |
115 | 115 | 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' ); |
117 | 117 | return true; |
118 | 118 | } |
119 | 119 | |
120 | 120 | // Get the input form data into an array |
121 | | - js_log( 'update formData::' ); |
| 121 | + mw.log( 'update formData::' ); |
122 | 122 | var data = $j( this.form ).serializeArray(); |
123 | 123 | this.formData = {}; |
124 | 124 | for ( var i = 0; i < data.length; i++ ) { |
— | — | @@ -139,7 +139,7 @@ |
140 | 140 | _this.doUpload(); |
141 | 141 | } ); |
142 | 142 | } catch( e ) { |
143 | | - js_log( '::error in displayProgressOverlay or doUpload' ); |
| 143 | + mw.log( '::error in displayProgressOverlay or doUpload' ); |
144 | 144 | } |
145 | 145 | |
146 | 146 | // Don't submit the form we will do the post in ajax |
— | — | @@ -157,16 +157,16 @@ |
158 | 158 | */ |
159 | 159 | detectUploadMode: function( callback ) { |
160 | 160 | var _this = this; |
161 | | - js_log( 'detectUploadMode::' + _this.upload_mode ); |
| 161 | + mw.log( 'detectUploadMode::' + _this.upload_mode ); |
162 | 162 | // Check the upload mode |
163 | 163 | if ( _this.upload_mode == 'detect_in_progress' ) { |
164 | 164 | // Don't send another request, wait for the pending one. |
165 | 165 | } else if ( !_this.isCopyUpload() ) { |
166 | 166 | callback( 'post' ); |
167 | 167 | } 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 ); |
169 | 169 | 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' ); |
171 | 171 | return; |
172 | 172 | } |
173 | 173 | |
— | — | @@ -174,29 +174,24 @@ |
175 | 175 | _this.upload_mode = 'detect_in_progress'; |
176 | 176 | |
177 | 177 | // 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 ) { |
184 | 179 | if ( typeof data.paraminfo == 'undefined' |
185 | 180 | || typeof data.paraminfo.modules == 'undefined' ) |
186 | 181 | { |
187 | | - return js_error( 'Error: bad api results' ); |
| 182 | + return mw.log( 'Error: bad api results' ); |
188 | 183 | } |
189 | 184 | if ( typeof data.paraminfo.modules[0].classname == 'undefined' ) { |
190 | | - js_log( 'Autodetect Upload Mode: \'post\' ' ); |
| 185 | + mw.log( 'Autodetect Upload Mode: \'post\' ' ); |
191 | 186 | _this.upload_mode = 'post'; |
192 | 187 | callback( 'post' ); |
193 | 188 | } else { |
194 | | - js_log( 'Autodetect Upload Mode: api ' ); |
| 189 | + mw.log( 'Autodetect Upload Mode: api ' ); |
195 | 190 | _this.upload_mode = 'api'; |
196 | 191 | // Check to see if chunks are supported |
197 | 192 | for ( var i in data.paraminfo.modules[0].parameters ) { |
198 | 193 | var pname = data.paraminfo.modules[0].parameters[i].name; |
199 | 194 | if( pname == 'enablechunks' ) { |
200 | | - js_log( 'this.chunks_supported = true' ); |
| 195 | + mw.log( 'this.chunks_supported = true' ); |
201 | 196 | _this.chunks_supported = true; |
202 | 197 | break; |
203 | 198 | } |
— | — | @@ -210,7 +205,7 @@ |
211 | 206 | } else if ( _this.upload_mode == 'post' ) { |
212 | 207 | callback( 'post' ); |
213 | 208 | } else { |
214 | | - js_error( 'Error: unrecongized upload mode: ' + _this.upload_mode ); |
| 209 | + mw.log( 'Error: unrecongized upload mode: ' + _this.upload_mode ); |
215 | 210 | } |
216 | 211 | }, |
217 | 212 | |
— | — | @@ -223,7 +218,7 @@ |
224 | 219 | } else if ( this.upload_mode == 'post' ) { |
225 | 220 | this.doPostUpload(); |
226 | 221 | } else { |
227 | | - js_error( 'Error: unrecongized upload mode: ' + this.upload_mode ); |
| 222 | + mw.log( 'Error: unrecongized upload mode: ' + this.upload_mode ); |
228 | 223 | } |
229 | 224 | }, |
230 | 225 | |
— | — | @@ -282,7 +277,7 @@ |
283 | 278 | doPostUpload: function() { |
284 | 279 | var _this = this; |
285 | 280 | var form = $j( _this.form ); |
286 | | - js_log( 'mvBaseUploadInterface.doPostUpload' ); |
| 281 | + mw.log( 'mvBaseUploadInterface.doPostUpload' ); |
287 | 282 | |
288 | 283 | // Issue a normal post request |
289 | 284 | // Get the token from the page |
— | — | @@ -307,8 +302,8 @@ |
308 | 303 | // Set the action to the API URL: |
309 | 304 | form.attr( 'action', _this.api_url ); |
310 | 305 | |
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() ); |
313 | 308 | |
314 | 309 | // Do post override |
315 | 310 | _this.form_post_override = true; |
— | — | @@ -322,8 +317,8 @@ |
323 | 318 | * Do an upload by submitting an API request |
324 | 319 | */ |
325 | 320 | 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) ' ); |
328 | 323 | var httpUpConf = { |
329 | 324 | 'url' : $j( '#wpUploadFileURL' ).val(), |
330 | 325 | 'filename' : $j( '#wpDestFile' ).val(), |
— | — | @@ -358,7 +353,7 @@ |
359 | 354 | } else if ( doc.body ) { |
360 | 355 | // Get the json string |
361 | 356 | 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() ); |
363 | 358 | if ( json ) { |
364 | 359 | response = window["eval"]( "(" + json + ")" ); |
365 | 360 | } else { |
— | — | @@ -400,7 +395,7 @@ |
401 | 396 | |
402 | 397 | // Add the edit token (if available) |
403 | 398 | if( !_this.editToken && _this.api_url ) { |
404 | | - js_log( 'Error:doHttpUpload: missing token' ); |
| 399 | + mw.log( 'Error:doHttpUpload: missing token' ); |
405 | 400 | } else { |
406 | 401 | request['token'] =_this.editToken; |
407 | 402 | } |
— | — | @@ -409,10 +404,7 @@ |
410 | 405 | _this.action_done = false; |
411 | 406 | |
412 | 407 | //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 ) { |
417 | 409 | _this.processApiResult( data ); |
418 | 410 | }); |
419 | 411 | }, |
— | — | @@ -445,15 +437,9 @@ |
446 | 438 | onAjaxUploadStatusTimer: function() { |
447 | 439 | var _this = this; |
448 | 440 | //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 | + } ); |
458 | 444 | }, |
459 | 445 | |
460 | 446 | /** |
— | — | @@ -475,7 +461,7 @@ |
476 | 462 | apiResult = JSON.parse( data.upload['apiUploadResult'] ) ; |
477 | 463 | } catch ( e ) { |
478 | 464 | //could not parse api result |
479 | | - js_log( 'errro: could not parse apiUploadResult' ) |
| 465 | + mw.log( 'errro: could not parse apiUploadResult' ) |
480 | 466 | } |
481 | 467 | _this.processApiResult( apiResult ); |
482 | 468 | }); |
— | — | @@ -499,7 +485,7 @@ |
500 | 486 | ); |
501 | 487 | } else if( data.upload['loaded'] ) { |
502 | 488 | _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'] ); |
504 | 490 | //for lack of content-length requests: |
505 | 491 | $j( '#up-status-container' ).html( |
506 | 492 | gM( 'mwe-upload-stats-fileprogress', |
— | — | @@ -609,7 +595,7 @@ |
610 | 596 | |
611 | 597 | if ( !error_code || error_code == 'unknown-error' ) { |
612 | 598 | if ( typeof JSON != 'undefined' ) { |
613 | | - js_log( 'Error: apiRes: ' + JSON.stringify( apiRes ) ); |
| 599 | + mw.log( 'Error: apiRes: ' + JSON.stringify( apiRes ) ); |
614 | 600 | } |
615 | 601 | if ( apiRes.upload.error == 'internal-error' ) { |
616 | 602 | // Do a remote message load |
— | — | @@ -650,20 +636,20 @@ |
651 | 637 | return false; |
652 | 638 | } |
653 | 639 | |
654 | | - js_log( 'get key: ' + error_msg_key[ error_code ] ) |
| 640 | + mw.log( 'get key: ' + error_msg_key[ error_code ] ) |
655 | 641 | gMsgLoadRemote( error_msg_key[ error_code ], function() { |
656 | 642 | _this.updateProgressWin( |
657 | 643 | gM( 'mwe-uploaderror' ), |
658 | 644 | gM( error_msg_key[ error_code ], errorReplaceArg ), |
659 | 645 | buttons ); |
660 | 646 | }); |
661 | | - js_log( "api.error" ); |
| 647 | + mw.log( "api.error" ); |
662 | 648 | return false; |
663 | 649 | } |
664 | 650 | |
665 | 651 | // Check upload.error |
666 | 652 | if ( apiRes.upload && apiRes.upload.error ) { |
667 | | - js_log( ' apiRes.upload.error: ' + apiRes.upload.error ); |
| 653 | + mw.log( ' apiRes.upload.error: ' + apiRes.upload.error ); |
668 | 654 | _this.updateProgressWin( |
669 | 655 | gM( 'mwe-uploaderror' ), |
670 | 656 | gM( 'mwe-unknown-error' ) + '<br>', |
— | — | @@ -709,7 +695,7 @@ |
710 | 696 | //set to "loading" |
711 | 697 | $j( '#upProgressDialog' ).html( mw.loading_spiner() ); |
712 | 698 | //setup loading: |
713 | | - var req = { |
| 699 | + var request = { |
714 | 700 | 'action': 'upload', |
715 | 701 | 'sessionkey': _this.warnings_sessionkey, |
716 | 702 | 'ignorewarnings': 1, |
— | — | @@ -717,17 +703,11 @@ |
718 | 704 | 'token' : _this.editToken |
719 | 705 | }; |
720 | 706 | //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 ) { |
727 | 708 | _this.processApiResult( data ); |
728 | | - } |
729 | | - ); |
| 709 | + } ); |
730 | 710 | } else { |
731 | | - js_log( 'No session key re-sending upload' ) |
| 711 | + mw.log( 'No session key re-sending upload' ) |
732 | 712 | //do a stashed upload |
733 | 713 | $j( '#wpIgnoreWarning' ).attr( 'checked', true ); |
734 | 714 | $j( _this.editForm ).submit(); |
— | — | @@ -755,7 +735,7 @@ |
756 | 736 | */ |
757 | 737 | processApiResult: function( apiRes ) { |
758 | 738 | var _this = this; |
759 | | - js_log( 'processApiResult::' ); |
| 739 | + mw.log( 'processApiResult::' ); |
760 | 740 | if ( !_this.isApiSuccess( apiRes ) ) { |
761 | 741 | // Error detected, show it to the user |
762 | 742 | _this.showApiError( apiRes ); |
— | — | @@ -765,7 +745,7 @@ |
766 | 746 | // Async upload, do AJAX status polling |
767 | 747 | _this.upload_session_key = apiRes.upload.upload_session_key; |
768 | 748 | _this.doAjaxUploadStatus(); |
769 | | - js_log( "set upload_session_key: " + _this.upload_session_key ); |
| 749 | + mw.log( "set upload_session_key: " + _this.upload_session_key ); |
770 | 750 | return; |
771 | 751 | } |
772 | 752 | |
— | — | @@ -775,7 +755,7 @@ |
776 | 756 | // Upload complete. |
777 | 757 | // Call the completion callback if available. |
778 | 758 | 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" ); |
780 | 760 | // This overrides our normal completion handling so we close the |
781 | 761 | // dialog immediately. |
782 | 762 | $j( '#upProgressDialog' ).dialog( 'destroy' ).remove(); |
— | — | @@ -798,7 +778,7 @@ |
799 | 779 | gM( 'mwe-successfulupload' ), |
800 | 780 | gM( 'mwe-upload_done', url), |
801 | 781 | buttons ); |
802 | | - js_log( 'apiRes.upload.imageinfo::' + url ); |
| 782 | + mw.log( 'apiRes.upload.imageinfo::' + url ); |
803 | 783 | return true; |
804 | 784 | } |
805 | 785 | }, |
— | — | @@ -847,7 +827,7 @@ |
848 | 828 | if ( this.form_selector && $j( this.form_selector ).length != 0 ) { |
849 | 829 | return $j( this.form_selector ).get( 0 ); |
850 | 830 | } else { |
851 | | - js_log( "mvBaseUploadInterface.getForm(): no form_selector" ); |
| 831 | + mw.log( "mvBaseUploadInterface.getForm(): no form_selector" ); |
852 | 832 | return false; |
853 | 833 | } |
854 | 834 | }, |
— | — | @@ -856,7 +836,7 @@ |
857 | 837 | * Update the progress bar to a given completion fraction (between 0 and 1) |
858 | 838 | */ |
859 | 839 | updateProgress: function( fraction ) { |
860 | | - //js_log('update progress: ' + fraction); |
| 840 | + //mw.log('update progress: ' + fraction); |
861 | 841 | $j( '#up-progressbar' ).progressbar( 'value', parseInt( fraction * 100 ) ); |
862 | 842 | $j( '#up-pstatus' ).html( parseInt( fraction * 100 ) + '% - ' ); |
863 | 843 | }, |
— | — | @@ -945,7 +925,7 @@ |
946 | 926 | */ |
947 | 927 | $.fn.doDestCheck = function( opt ) { |
948 | 928 | var _this = this; |
949 | | - js_log( 'doDestCheck::' + _this.selector ); |
| 929 | + mw.log( 'doDestCheck::' + _this.selector ); |
950 | 930 | |
951 | 931 | // Set up option defaults |
952 | 932 | if ( !opt.warn_target ) |
— | — | @@ -964,19 +944,16 @@ |
965 | 945 | $j( _this.selector ) |
966 | 946 | .append( '<img id="mw-spinner-wpDestFile" ' + |
967 | 947 | '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 ) { |
981 | 958 | // Remove spinner |
982 | 959 | $j( '#mw-spinner-wpDestFile' ).remove(); |
983 | 960 | |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js |
— | — | @@ -30,28 +30,24 @@ |
31 | 31 | */ |
32 | 32 | addByTitle:function( title , callback, redirect_count ) { |
33 | 33 | |
34 | | - js_log( "AddByTitle::" + title ); |
| 34 | + mw.log( "AddByTitle::" + title ); |
35 | 35 | |
36 | 36 | var _this = this; |
37 | 37 | if ( !redirect_count ) |
38 | 38 | redirect_count = 0; |
39 | 39 | if ( redirect_count > 5 ) { |
40 | | - js_log( 'Error: addByTitle too many redirects' ); |
| 40 | + mw.log( 'Error: addByTitle too many redirects' ); |
41 | 41 | callback( false ); |
42 | 42 | return false; |
43 | 43 | } |
44 | 44 | var request = { |
45 | | - 'action':'query', |
46 | 45 | 'titles':'File:' + title, |
47 | 46 | 'prop':'imageinfo|revisions|categories', |
48 | 47 | 'iiprop':'url|mime|size', |
49 | 48 | 'iiurlwidth': parseInt( this.rsd.thumb_width ), |
50 | 49 | 'rvprop':'content' |
51 | 50 | } |
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 ) { |
56 | 52 | // check for redirect |
57 | 53 | for ( var i in data.query.pages ) { |
58 | 54 | var page = data.query.pages[i]; |
— | — | @@ -62,7 +58,7 @@ |
63 | 59 | _this.addByTitle( pt[1], callback, redirect_count++ ); |
64 | 60 | return ; |
65 | 61 | } else { |
66 | | - js_log( 'Error: addByTitle could not proccess redirect' ); |
| 62 | + mw.log( 'Error: addByTitle could not proccess redirect' ); |
67 | 63 | callback( false ); |
68 | 64 | return false; |
69 | 65 | } |
— | — | @@ -82,16 +78,13 @@ |
83 | 79 | */ |
84 | 80 | getUserRecentUploads: function( user, callback ) { |
85 | 81 | 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 ) { |
96 | 89 | var titleSet = { }; |
97 | 90 | var titleStr = '' |
98 | 91 | var pound = ''; |
— | — | @@ -108,17 +101,14 @@ |
109 | 102 | } |
110 | 103 | // Run the actual query ( too bad we can't use recentchanges as a generator ) |
111 | 104 | // 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 ) { |
123 | 113 | _this.clearResults(); |
124 | 114 | _this.addResults( data ); |
125 | 115 | if ( callback ) |
— | — | @@ -138,7 +128,7 @@ |
139 | 129 | // Set local ref: |
140 | 130 | var _this = this; |
141 | 131 | |
142 | | - js_log( 'f:getSearchResults for:' + search_query ); |
| 132 | + mw.log( 'f:getSearchResults for:' + search_query ); |
143 | 133 | |
144 | 134 | // Build the image request |
145 | 135 | var request = { |
— | — | @@ -156,10 +146,7 @@ |
157 | 147 | }; |
158 | 148 | |
159 | 149 | // 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 ) { |
164 | 151 | // Add result data: |
165 | 152 | _this.addResults( data ); |
166 | 153 | _this.loading = false; |
— | — | @@ -182,7 +169,7 @@ |
183 | 170 | * @param {Boolean} returnFirst Flag to return the first added resource |
184 | 171 | */ |
185 | 172 | addResults:function( data, returnFirst ) { |
186 | | - js_log( "f:addResults" ); |
| 173 | + mw.log( "f:addResults" ); |
187 | 174 | var _this = this |
188 | 175 | // check if we have |
189 | 176 | if ( typeof data['query-continue'] != 'undefined' ) { |
— | — | @@ -218,8 +205,8 @@ |
219 | 206 | 'poster' : page.imageinfo[0].thumburl, |
220 | 207 | 'thumbwidth' : page.imageinfo[0].thumbwidth, |
221 | 208 | '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, |
224 | 211 | 'mime' : page.imageinfo[0].mime, |
225 | 212 | 'src' : page.imageinfo[0].url, |
226 | 213 | 'desc' : page.revisions[0]['*'], |
— | — | @@ -228,7 +215,7 @@ |
229 | 216 | 'meta': { |
230 | 217 | 'categories':page.categories |
231 | 218 | } |
232 | | - }; |
| 219 | + }; |
233 | 220 | |
234 | 221 | /* |
235 | 222 | //to use once we get the wiki-text parser in shape |
— | — | @@ -277,11 +264,11 @@ |
278 | 265 | |
279 | 266 | this.num_results++; |
280 | 267 | // 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]); |
282 | 269 | // } |
283 | 270 | } |
284 | 271 | } else { |
285 | | - js_log( 'no results:' + data ); |
| 272 | + mw.log( 'no results:' + data ); |
286 | 273 | } |
287 | 274 | }, |
288 | 275 | |
— | — | @@ -319,30 +306,29 @@ |
320 | 307 | // Set the width: |
321 | 308 | if ( size.width ) |
322 | 309 | 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; |
344 | 329 | } |
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 ); |
347 | 333 | } ); |
348 | 334 | }, |
349 | 335 | |
— | — | @@ -374,7 +360,7 @@ |
375 | 361 | desc = desc.replace( /\=\=[^\=]*\=\=/gi, '' ); |
376 | 362 | |
377 | 363 | // 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 ); |
379 | 365 | return desc; |
380 | 366 | }, |
381 | 367 | |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | * @param {Object} options The set of options for the remote search class |
62 | 62 | */ |
63 | 63 | init: function( options ) { |
64 | | - js_log( 'mvBaseRemoteSearch:init' ); |
| 64 | + mw.log( 'mvBaseRemoteSearch:init' ); |
65 | 65 | for ( var i in options ) { |
66 | 66 | this[i] = options[i]; |
67 | 67 | } |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | * @param {String} provider_url the source url (used to generate absolute links) |
101 | 101 | */ |
102 | 102 | addRSSData:function( data , provider_url ) { |
103 | | - js_log( 'f:addRSSData' ); |
| 103 | + mw.log( 'f:addRSSData' ); |
104 | 104 | var _this = this; |
105 | 105 | var http_host = ''; |
106 | 106 | var http_path = ''; |
— | — | @@ -109,13 +109,13 @@ |
110 | 110 | http_path = pUrl.directory; |
111 | 111 | } |
112 | 112 | 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 ) { |
115 | 115 | var resource = { }; |
116 | 116 | for ( var attr in rsd_default_rss_item_mapping ) { |
117 | 117 | _this.mapAttributeToResource( resource, item, attr ); |
118 | 118 | } |
119 | | - // make relative urls absolute: |
| 119 | + // Make relative urls absolute: |
120 | 120 | var url_param = new Array( 'src', 'poster' ); |
121 | 121 | for ( var j = 0; j < url_param.length; j++ ) { |
122 | 122 | var p = url_param[j]; |
— | — | @@ -123,7 +123,7 @@ |
124 | 124 | if ( resource[p].substr( 0, 1 ) == '/' ) { |
125 | 125 | resource[p] = http_host + resource[p]; |
126 | 126 | } |
127 | | - if ( mw.parseUri( resource[i] ).host == resource[p] ) { |
| 127 | + if ( mw.parseUri( resource[ j ] ).host == resource[p] ) { |
128 | 128 | resource[p] = http_host + http_path + resource[p]; |
129 | 129 | } |
130 | 130 | } |
— | — | @@ -210,13 +210,14 @@ |
211 | 211 | if(! options.width ) |
212 | 212 | options.width = resource.width; |
213 | 213 | if(! options.height ) |
214 | | - options.height = resource.height |
| 214 | + options.height = resource.height; |
215 | 215 | |
216 | 216 | var outHtml = ''; |
217 | 217 | if ( options['max_height'] ) { |
218 | 218 | 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 | + |
221 | 222 | options.style = ''; |
222 | 223 | if( options.height ) |
223 | 224 | options.style += 'height:' + options.height + 'px;'; |
— | — | @@ -243,14 +244,14 @@ |
244 | 245 | } |
245 | 246 | } |
246 | 247 | |
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. |
248 | 249 | 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; |
252 | 253 | |
253 | 254 | // 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 ); |
255 | 256 | return 'Error missing embed code for: ' + escape( resource.mime ); |
256 | 257 | }, |
257 | 258 | wrapHtmlDesc: function( resource, options, outHtml ) { |
— | — | @@ -263,8 +264,7 @@ |
264 | 265 | 'title="' + cpTitle + '">' + |
265 | 266 | cpTitle + '</a>'; |
266 | 267 | return '<div class="mw-imported-resource" '+ |
267 | | - 'style="width:' + options.width + 'px;' + |
268 | | - 'height:' + ( options.height + 20 ) + 'px;">' + |
| 268 | + 'style="width:' + options.width + 'px;">' + |
269 | 269 | outHtml + |
270 | 270 | gM( 'mwe-import-description', [titleLink, remoteProviderLink]) + |
271 | 271 | '</div>'; |
— | — | @@ -426,7 +426,9 @@ |
427 | 427 | * @parma {Object} resource Resource to update title on. |
428 | 428 | */ |
429 | 429 | 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 | + } |
432 | 434 | } |
433 | 435 | } |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | this.parent_getSearchResults(); |
41 | 41 | |
42 | 42 | var _this = this; |
43 | | - js_log( 'f:getSearchResults for:' + search_query ); |
| 43 | + mw.log( 'f:getSearchResults for:' + search_query ); |
44 | 44 | |
45 | 45 | |
46 | 46 | // For now force (Ogg video) & url based license |
— | — | @@ -47,22 +47,17 @@ |
48 | 48 | search_query += ' licenseurl:(http\\:\\/\\/*)'; |
49 | 49 | |
50 | 50 | // Build the request Object |
51 | | - var reqObj = { |
| 51 | + var request = { |
52 | 52 | 'q': search_query, // just search for video atm |
53 | 53 | 'fl':"description,title,identifier,licenseurl,format,license,thumbnail", |
54 | 54 | 'wt':'json', |
55 | 55 | 'rows' : this.provider.limit, |
56 | 56 | 'start' : this.provider.offset |
57 | 57 | } |
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 | + } ); |
67 | 62 | }, |
68 | 63 | /** |
69 | 64 | * Adds the search results to the local resultsObj |
— | — | @@ -107,18 +102,18 @@ |
108 | 103 | */ |
109 | 104 | addResourceInfoCallback:function( resource, callback ) { |
110 | 105 | 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(); |
123 | 118 | } ); |
124 | 119 | }, |
125 | 120 | |
— | — | @@ -128,7 +123,7 @@ |
129 | 124 | * @parma {Object} options Options for the embeding. |
130 | 125 | */ |
131 | 126 | getEmbedHTML: function( resource , options ) { |
132 | | - js_log( 'getEmbedHTML:: ' + resource.poster ); |
| 127 | + mw.log( 'getEmbedHTML:: ' + resource.poster ); |
133 | 128 | if ( !options ) |
134 | 129 | options = { }; |
135 | 130 | var id_attr = ( options['id'] ) ? ' id = "' + options['id'] + '" ': ''; |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js |
— | — | @@ -38,24 +38,20 @@ |
39 | 39 | // Set local ref: |
40 | 40 | var _this = this; |
41 | 41 | |
42 | | - js_log( 'metavidSearch::getSearchResults()' ); |
| 42 | + mw.log( 'metavidSearch::getSearchResults()' ); |
43 | 43 | |
44 | 44 | // Process all options |
45 | 45 | 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; |
49 | 49 | |
50 | 50 | // 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::' ); |
60 | 56 | var xmldata = ( data && data['pay_load'] ) ? mw.parseXML( data['pay_load'] ) : false; |
61 | 57 | if( !xmldata ){ |
62 | 58 | // XML Error or No results: |
— | — | @@ -172,7 +168,7 @@ |
173 | 169 | * @param {Object} resource Resource to be updated |
174 | 170 | */ |
175 | 171 | applyVideoAdj: function( resource ) { |
176 | | - js_log( 'mv ApplyVideoAdj::' ); |
| 172 | + mw.log( 'mv ApplyVideoAdj::' ); |
177 | 173 | |
178 | 174 | // Update the titleKey: |
179 | 175 | resource['titleKey'] = this.getTitleKey( resource ); |
— | — | @@ -181,17 +177,17 @@ |
182 | 178 | resource['title'] = this.getTitle( resource ); |
183 | 179 | |
184 | 180 | // update the interface: |
185 | | - js_log( 'update title to: ' + resource['title'] ); |
| 181 | + mw.log( 'update title to: ' + resource['title'] ); |
186 | 182 | $j( '#rsd_resource_title' ).html( gM( 'rsd_resource_edit', resource['title'] ) ); |
187 | 183 | |
188 | 184 | // if the video is "roe" based select the ogg stream |
189 | 185 | if ( resource.roe_url && resource.pSobj.provider.stream_import_key ) { |
190 | 186 | var source = $j( '#embed_vid' ).get( 0 ).media_element.getSourceById( resource.pSobj.provider.stream_import_key ); |
191 | 187 | 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 ); |
193 | 189 | } else { |
194 | 190 | 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'] ) ; |
196 | 192 | return true; |
197 | 193 | } |
198 | 194 | } |
— | — | @@ -222,15 +218,15 @@ |
223 | 219 | */ |
224 | 220 | getImageTransform:function( resource, opt ) { |
225 | 221 | if ( opt.width <= 80 ) { |
226 | | - return getURLParamReplace( resource.poster, { 'size' : "icon" } ) |
| 222 | + return mw.replaceUrlParams( resource.poster, { 'size' : "icon" } ) |
227 | 223 | } else if ( opt.width <= 160 ) { |
228 | | - return getURLParamReplace( resource.poster, { 'size' : "small" } ) |
| 224 | + return mw.replaceUrlParams( resource.poster, { 'size' : "small" } ) |
229 | 225 | } else if ( opt.width <= 320 ) { |
230 | | - return getURLParamReplace( resource.poster, { 'size' : 'medium' } ) |
| 226 | + return mw.replaceUrlParams( resource.poster, { 'size' : 'medium' } ) |
231 | 227 | } else if ( opt.width <= 512 ) { |
232 | | - return getURLParamReplace( resource.poster, { 'size' : 'large' } ) |
| 228 | + return mw.replaceUrlParams( resource.poster, { 'size' : 'large' } ) |
233 | 229 | } else { |
234 | | - return getURLParamReplace( resource.poster, { 'size' : 'full' } ) |
| 230 | + return mw.replaceUrlParams( resource.poster, { 'size' : 'full' } ) |
235 | 231 | } |
236 | 232 | }, |
237 | 233 | |
— | — | @@ -248,7 +244,7 @@ |
249 | 245 | if ( cur_source.id == this.provider.target_source_id ) |
250 | 246 | resource['url'] = cur_source.getSrc(); |
251 | 247 | } |
252 | | - // js_log('set url to: ' + resource['url']); |
| 248 | + // mw.log('set url to: ' + resource['url']); |
253 | 249 | return resource; |
254 | 250 | }, |
255 | 251 | |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/flickrSearch.js |
— | — | @@ -53,13 +53,13 @@ |
54 | 54 | */ |
55 | 55 | getSearchResults:function( search_query ) { |
56 | 56 | var _this = this; |
57 | | - js_log( "flickr::getSearchResults" ); |
| 57 | + mw.log( "flickr::getSearchResults" ); |
58 | 58 | |
59 | 59 | // call parent for common initialisation: |
60 | 60 | this.parent_getSearchResults(); |
61 | 61 | |
62 | 62 | // setup the flickr request: |
63 | | - var reqObj = { |
| 63 | + var request = { |
64 | 64 | 'method':'flickr.photos.search', |
65 | 65 | 'format':'json', |
66 | 66 | 'license':this._license_keys, |
— | — | @@ -69,11 +69,7 @@ |
70 | 70 | 'text': search_query, |
71 | 71 | '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' |
72 | 72 | } |
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 ) { |
78 | 74 | _this.addResults( data ); |
79 | 75 | _this.loading = false; |
80 | 76 | } ); |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvAdvFirefogg.js |
— | — | @@ -303,7 +303,7 @@ |
304 | 304 | }, |
305 | 305 | |
306 | 306 | createControls: function() { |
307 | | - js_log( "adv createControls" ); |
| 307 | + mw.log( "adv createControls" ); |
308 | 308 | var _this = this; |
309 | 309 | // Load presets from the cookie |
310 | 310 | this.loadEncSettings(); |
— | — | @@ -383,7 +383,7 @@ |
384 | 384 | 'class="text ui-widget-content ui-corner-all ' + target + '" ' + |
385 | 385 | 'type="text" value="' + text + '" size="60" /> '; |
386 | 386 | default: |
387 | | - js_log( 'call : basefogg_getTargetHtml for:' + target ); |
| 387 | + mw.log( 'call : basefogg_getTargetHtml for:' + target ); |
388 | 388 | return this.basefogg_getControlHtml( target ); |
389 | 389 | } |
390 | 390 | }, |
— | — | @@ -391,7 +391,7 @@ |
392 | 392 | getPresetControlHtml: function() { |
393 | 393 | var out = ''; |
394 | 394 | var _this = this; |
395 | | - js_log( 'getPresetControlHtml::' ); |
| 395 | + mw.log( 'getPresetControlHtml::' ); |
396 | 396 | if ( typeof this.local_settings.presets != 'undefined' ) { |
397 | 397 | out += '<select class="_preset_select">'; |
398 | 398 | $j.each( this.local_settings.presets, function( presetKey, preset ) { |
— | — | @@ -527,7 +527,7 @@ |
528 | 528 | |
529 | 529 | var helpState = {}; |
530 | 530 | // Do some display tweaks |
531 | | - js_log( 'tw:' + $j( this.selector ).width() + |
| 531 | + mw.log( 'tw:' + $j( this.selector ).width() + |
532 | 532 | ' ssf:' + $j( this.target_btn_select_new_file ).width() + |
533 | 533 | ' sf:' + $j( this.target_btn_save_local_file ).width() ); |
534 | 534 | |
— | — | @@ -578,7 +578,7 @@ |
579 | 579 | $j( this.selector + ' .helpClose_' + configKey ) |
580 | 580 | .click( |
581 | 581 | function() { |
582 | | - js_log( "close help: " + configKey ); |
| 582 | + mw.log( "close help: " + configKey ); |
583 | 583 | // get the config key (assume it's the last class) |
584 | 584 | var configKey = _this.getClassId( this, 'helpClose_' ); |
585 | 585 | $j( _this.selector + ' .helpRow_' + configKey ).hide( 'slow' ); |
— | — | @@ -665,7 +665,7 @@ |
666 | 666 | // Change it to the validated value |
667 | 667 | $j( this ).val( validValue ); |
668 | 668 | // update the slider |
669 | | - js_log( "update: " + _this.selector + ' .slider' + classId ); |
| 669 | + mw.log( "update: " + _this.selector + ' .slider' + classId ); |
670 | 670 | $j( _this.selector + ' .slider' + classId ) |
671 | 671 | .slider( 'option', 'value', validValue ); |
672 | 672 | }); |
— | — | @@ -690,7 +690,7 @@ |
691 | 691 | updatePresetSelection: function( presetKey ) { |
692 | 692 | // Update the local configuration |
693 | 693 | this.local_settings['default'] = presetKey; |
694 | | - // js_log( 'update preset desc: ' + presetKey ); |
| 694 | + // mw.log( 'update preset desc: ' + presetKey ); |
695 | 695 | var presetDesc = ''; |
696 | 696 | if ( this.local_settings.presets[presetKey].desc ) { |
697 | 697 | presetDesc = this.local_settings.presets[presetKey].desc; |
— | — | @@ -714,7 +714,7 @@ |
715 | 715 | } |
716 | 716 | // Look up the type |
717 | 717 | if ( typeof this.default_encoder_config[confKey] == 'undefined' ) { |
718 | | - js_error( 'error: missing default key: ' + confKey ); |
| 718 | + mw.log( 'error: missing default key: ' + confKey ); |
719 | 719 | return false; |
720 | 720 | } |
721 | 721 | |
— | — | @@ -741,7 +741,7 @@ |
742 | 742 | */ |
743 | 743 | updateLocalValue: function( confKey, value ) { |
744 | 744 | 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 ) |
746 | 746 | return value; |
747 | 747 | } |
748 | 748 | var confEntry = this.default_encoder_config[confKey]; |
— | — | @@ -765,7 +765,7 @@ |
766 | 766 | } |
767 | 767 | }*/ |
768 | 768 | |
769 | | - js_log( 'update:local_settings:custom:conf:' + confKey + ' = ' + value ); |
| 769 | + mw.log( 'update:local_settings:custom:conf:' + confKey + ' = ' + value ); |
770 | 770 | this.local_settings.presets['custom']['conf'][confKey] = value; |
771 | 771 | |
772 | 772 | return value; |
— | — | @@ -832,7 +832,7 @@ |
833 | 833 | |
834 | 834 | // In passthrough mode, hide encoder controls |
835 | 835 | if ( settings['passthrough'] ) { |
836 | | - js_log( "in passthrough mode (hide control)" ); |
| 836 | + mw.log( "in passthrough mode (hide control)" ); |
837 | 837 | $j( this.target_control_container ).hide( 'slow' ); |
838 | 838 | $j( this.target_passthrough_mode ).show( 'slow' ); |
839 | 839 | return; |
— | — | @@ -935,7 +935,7 @@ |
936 | 936 | * Set the HTML control values to whatever is currently present in this.local_settings |
937 | 937 | */ |
938 | 938 | updateValuesInHtml: function() { |
939 | | - js_log( 'updateValuesInHtml::' ); |
| 939 | + mw.log( 'updateValuesInHtml::' ); |
940 | 940 | var _this = this; |
941 | 941 | var pKey = this.local_settings[ 'default' ]; |
942 | 942 | this.updatePresetSelection( pKey ); |
— | — | @@ -953,14 +953,14 @@ |
954 | 954 | */ |
955 | 955 | loadEncSettings: function( ) { |
956 | 956 | if ( $j.cookie( 'fogg_encoder_config' ) ) { |
957 | | - js_log( "load:fogg_encoder_config from cookie " ); |
| 957 | + mw.log( "load:fogg_encoder_config from cookie " ); |
958 | 958 | this.local_settings = JSON.parse( $j.cookie( 'fogg_settings' ) ); |
959 | 959 | } |
960 | 960 | // set to default if not loaded yet: |
961 | 961 | if ( this.local_settings && this.local_settings.presets |
962 | 962 | && this.local_settings.presets['custom']['conf'] ) |
963 | 963 | { |
964 | | - js_log( 'local settings already populated' ); |
| 964 | + mw.log( 'local settings already populated' ); |
965 | 965 | } else { |
966 | 966 | this.local_settings = this.default_local_settings; |
967 | 967 | } |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js |
— | — | @@ -146,7 +146,7 @@ |
147 | 147 | } |
148 | 148 | |
149 | 149 | if ( !this.selector ) { |
150 | | - js_log('firefogg: missing selector '); |
| 150 | + mw.log('firefogg: missing selector '); |
151 | 151 | } |
152 | 152 | }, |
153 | 153 | |
— | — | @@ -156,7 +156,7 @@ |
157 | 157 | */ |
158 | 158 | doRewrite: function( callback ) { |
159 | 159 | 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 + |
161 | 161 | ' tag:' + $j( this.selector ).get( 0 ).tagName ); |
162 | 162 | if ( $j( this.selector ).length >= 0 ) { |
163 | 163 | if ( $j( this.selector ).get( 0 ).tagName.toLowerCase() == 'input' ) { |
— | — | @@ -218,7 +218,7 @@ |
219 | 219 | var msg = gM( target.replace( /^target_/, 'fogg-' ) ); |
220 | 220 | return '<div style="" class="' + target + '" >' + msg + '</div> '; |
221 | 221 | } else { |
222 | | - js_error( 'Invalid target: ' + target ); |
| 222 | + mw.log( 'Invalid target: ' + target ); |
223 | 223 | return ''; |
224 | 224 | } |
225 | 225 | }, |
— | — | @@ -270,7 +270,7 @@ |
271 | 271 | |
272 | 272 | // Show the "use latest Firefox" message if necessary |
273 | 273 | 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 ); |
275 | 275 | if ( _this.target_use_latest_firefox ) { |
276 | 276 | if ( _this.form_type == 'upload' ) |
277 | 277 | $j( _this.target_use_latest_firefox ) |
— | — | @@ -340,7 +340,7 @@ |
341 | 341 | * Set up the upload form |
342 | 342 | */ |
343 | 343 | setupForm: function() { |
344 | | - js_log( 'firefogg::setupForm::' ); |
| 344 | + mw.log( 'firefogg::setupForm::' ); |
345 | 345 | |
346 | 346 | // Set up the parent if we are in upload mode |
347 | 347 | if ( this.form_type == 'upload' ) { |
— | — | @@ -377,7 +377,7 @@ |
378 | 378 | var id = $j( this.selector ).attr( 'name' ) + '_firefogg-control'; |
379 | 379 | inputTag += '/><span id="' + id + '"></span>'; |
380 | 380 | |
381 | | - js_log( 'set input: ' + inputTag ); |
| 381 | + mw.log( 'set input: ' + inputTag ); |
382 | 382 | |
383 | 383 | $j( this.selector ).replaceWith( inputTag ); |
384 | 384 | |
— | — | @@ -445,7 +445,7 @@ |
446 | 446 | onPreviewClick: function( sourceNode ) { |
447 | 447 | var button = $j( sourceNode ); |
448 | 448 | var icon = button.children( '.ui-icon' ); |
449 | | - js_log( "click .fogg_preview" + icon.attr( 'class' ) ); |
| 449 | + mw.log( "click .fogg_preview" + icon.attr( 'class' ) ); |
450 | 450 | |
451 | 451 | if ( icon.hasClass( 'ui-icon-triangle-1-e' ) ) { |
452 | 452 | // Show preview |
— | — | @@ -495,7 +495,7 @@ |
496 | 496 | // Initialize the video if it is not set up already |
497 | 497 | var v = $j( '#fogg_preview_vid' ).get( 0 ); |
498 | 498 | 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 ); |
500 | 500 | v.src = _this.fogg.previewUrl; |
501 | 501 | |
502 | 502 | // Once it's loaded, seek to the end |
— | — | @@ -557,11 +557,11 @@ |
558 | 558 | * Update the UI due to the source file changing |
559 | 559 | */ |
560 | 560 | updateSourceFileUI: function() { |
561 | | - js_log( 'videoSelectReady' ); |
| 561 | + mw.log( 'videoSelectReady' ); |
562 | 562 | var _this = this; |
563 | 563 | if ( !_this.fogg.sourceInfo || !_this.fogg.sourceFilename ) { |
564 | 564 | // Something wrong with the source file? |
565 | | - js_log( 'selectSourceFile: sourceInfo/sourceFilename missing' ); |
| 565 | + mw.log( 'selectSourceFile: sourceInfo/sourceFilename missing' ); |
566 | 566 | return; |
567 | 567 | } |
568 | 568 | |
— | — | @@ -589,7 +589,7 @@ |
590 | 590 | } |
591 | 591 | |
592 | 592 | // 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 + |
594 | 594 | ' to: ' + _this.fogg.sourceFilename ); |
595 | 595 | |
596 | 596 | $j( _this.target_input_file_name ) |
— | — | @@ -619,13 +619,13 @@ |
620 | 620 | getSourceFileInfo: function() { |
621 | 621 | if ( this.sourceFileInfo == null ) { |
622 | 622 | if ( !this.fogg.sourceInfo ) { |
623 | | - js_error( 'No firefogg source info is available' ); |
| 623 | + mw.log( 'No firefogg source info is available' ); |
624 | 624 | return false; |
625 | 625 | } |
626 | 626 | try { |
627 | 627 | this.sourceFileInfo = JSON.parse( this.fogg.sourceInfo ); |
628 | 628 | } catch ( e ) { |
629 | | - js_error( 'error could not parse fogg sourceInfo' ); |
| 629 | + mw.log( 'error could not parse fogg sourceInfo' ); |
630 | 630 | return false; |
631 | 631 | } |
632 | 632 | } |
— | — | @@ -647,7 +647,7 @@ |
648 | 648 | doLocalEncodeAndSave: function() { |
649 | 649 | var _this = this; |
650 | 650 | if ( !this.fogg ) { |
651 | | - js_error( 'doLocalEncodeAndSave: no Firefogg object!' ); |
| 651 | + mw.log( 'doLocalEncodeAndSave: no Firefogg object!' ); |
652 | 652 | return false; |
653 | 653 | } |
654 | 654 | |
— | — | @@ -665,7 +665,7 @@ |
666 | 666 | _this.updateProgress( progress ); |
667 | 667 | }, |
668 | 668 | function /* onDone */ () { |
669 | | - js_log( "done with encoding (no upload) " ); |
| 669 | + mw.log( "done with encoding (no upload) " ); |
670 | 670 | // Set status to 100% for one second |
671 | 671 | // FIXME: this is either a hack or a waste of time, not sure which |
672 | 672 | _this.updateProgress( 1 ); |
— | — | @@ -731,7 +731,7 @@ |
732 | 732 | // Grab the extension |
733 | 733 | var sf = this.fogg.sourceFilename; |
734 | 734 | if ( !sf ) { |
735 | | - js_error( 'getEncoderSettings(): No Firefogg source filename is available!' ); |
| 735 | + mw.log( 'getEncoderSettings(): No Firefogg source filename is available!' ); |
736 | 736 | return false; |
737 | 737 | } |
738 | 738 | var ext = ''; |
— | — | @@ -750,7 +750,7 @@ |
751 | 751 | settings['passthrough'] = true; |
752 | 752 | } |
753 | 753 | |
754 | | - js_log( 'base setupAutoEncoder::' + this.getSourceFileInfo().contentType + |
| 754 | + mw.log( 'base setupAutoEncoder::' + this.getSourceFileInfo().contentType + |
755 | 755 | ' passthrough:' + settings['passthrough'] ); |
756 | 756 | this.current_encoder_settings = settings; |
757 | 757 | } |
— | — | @@ -779,7 +779,7 @@ |
780 | 780 | * Get the default title of the progress window |
781 | 781 | */ |
782 | 782 | getProgressTitle: function() { |
783 | | - js_log( "fogg:getProgressTitle f:" + ( this.getFirefogg() ? 'on' : 'off' ) + |
| 783 | + mw.log( "fogg:getProgressTitle f:" + ( this.getFirefogg() ? 'on' : 'off' ) + |
784 | 784 | ' mode:' + this.form_type ); |
785 | 785 | // Return the parent's title if we don't have Firefogg turned on |
786 | 786 | if ( !this.getFirefogg() || !this.firefogg_form_action ) { |
— | — | @@ -796,7 +796,7 @@ |
797 | 797 | */ |
798 | 798 | doUpload: function() { |
799 | 799 | var _this = this; |
800 | | - js_log( "firefogg: doUpload:: " + |
| 800 | + mw.log( "firefogg: doUpload:: " + |
801 | 801 | ( this.getFirefogg() ? 'on' : 'off' ) + |
802 | 802 | ' up mode:' + _this.upload_mode ); |
803 | 803 | |
— | — | @@ -815,7 +815,7 @@ |
816 | 816 | _this.updateProgress( progress ); |
817 | 817 | }, |
818 | 818 | 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 ); |
820 | 820 | // ignore warnings & set source type |
821 | 821 | //_this.formData[ 'wpIgnoreWarning' ]='true'; |
822 | 822 | _this.formData['wpSourceType'] = 'upload'; |
— | — | @@ -830,7 +830,7 @@ |
831 | 831 | } |
832 | 832 | ); |
833 | 833 | } else { |
834 | | - js_error( 'Error: unrecongized upload mode: ' + _this.upload_mode ); |
| 834 | + mw.log( 'Error: unrecongized upload mode: ' + _this.upload_mode ); |
835 | 835 | } |
836 | 836 | }, |
837 | 837 | |
— | — | @@ -839,7 +839,7 @@ |
840 | 840 | * they become ready. |
841 | 841 | */ |
842 | 842 | doChunkUpload : function() { |
843 | | - js_log( 'firefogg::doChunkUpload' ); |
| 843 | + mw.log( 'firefogg::doChunkUpload' ); |
844 | 844 | var _this = this; |
845 | 845 | _this.action_done = false; |
846 | 846 | |
— | — | @@ -864,7 +864,7 @@ |
865 | 865 | } |
866 | 866 | |
867 | 867 | 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 ); |
869 | 869 | _this.doChunkUploadWithFormData(); |
870 | 870 | return; |
871 | 871 | } |
— | — | @@ -889,7 +889,7 @@ |
890 | 890 | */ |
891 | 891 | doChunkUploadWithFormData: function() { |
892 | 892 | var _this = this; |
893 | | - js_log( "firefogg::doChunkUploadWithFormData" + _this.editToken ); |
| 893 | + mw.log( "firefogg::doChunkUploadWithFormData" + _this.editToken ); |
894 | 894 | // Build the API URL |
895 | 895 | var aReq = { |
896 | 896 | 'action': 'upload', |
— | — | @@ -909,8 +909,8 @@ |
910 | 910 | aReq['ignorewarnings'] = _this.formData['ignorewarnings']; |
911 | 911 | |
912 | 912 | 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 ) ); |
915 | 915 | _this.fogg.upload( JSON.stringify( encoderSettings ), _this.api_url, |
916 | 916 | JSON.stringify( aReq ) ); |
917 | 917 | |
— | — | @@ -931,7 +931,7 @@ |
932 | 932 | _this.action_done = false; |
933 | 933 | _this.displayProgressOverlay(); |
934 | 934 | var encoderSettings = this.getEncoderSettings(); |
935 | | - js_log( 'doEncode: with: ' + JSON.stringify( encoderSettings ) ); |
| 935 | + mw.log( 'doEncode: with: ' + JSON.stringify( encoderSettings ) ); |
936 | 936 | _this.fogg.encode( JSON.stringify( encoderSettings ) ); |
937 | 937 | |
938 | 938 | //show transcode status: |
— | — | @@ -957,7 +957,7 @@ |
958 | 958 | doneCallback(); |
959 | 959 | } else if ( _this.fogg.state == 'encoding fail' ) { |
960 | 960 | //@@todo error handling: |
961 | | - js_error( 'encoding failed' ); |
| 961 | + mw.log( 'encoding failed' ); |
962 | 962 | } |
963 | 963 | } |
964 | 964 | encodingStatus(); |
— | — | @@ -982,18 +982,18 @@ |
983 | 983 | var pstatus = JSON.parse( _this.fogg.uploadstatus() ); |
984 | 984 | response_text = pstatus["responseText"]; |
985 | 985 | } catch( e ) { |
986 | | - js_log( "could not parse uploadstatus / could not get responseText" ); |
| 986 | + mw.log( "could not parse uploadstatus / could not get responseText" ); |
987 | 987 | } |
988 | 988 | } |
989 | 989 | |
990 | 990 | 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 ); |
992 | 992 | _this.oldResponseText = response_text; |
993 | 993 | // Parse the response text and check for errors |
994 | 994 | try { |
995 | 995 | var apiResult = JSON.parse( response_text ); |
996 | 996 | } catch( e ) { |
997 | | - js_log( "could not parse response_text::" + response_text + |
| 997 | + mw.log( "could not parse response_text::" + response_text + |
998 | 998 | ' ...for now try with eval...' ); |
999 | 999 | try { |
1000 | 1000 | var apiResult = eval( response_text ); |
— | — | @@ -1026,7 +1026,7 @@ |
1027 | 1027 | |
1028 | 1028 | // Upload done? |
1029 | 1029 | 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 ); |
1031 | 1031 | return; |
1032 | 1032 | } |
1033 | 1033 | if ( apiResult && apiResult.resultUrl ) { |
— | — | @@ -1050,7 +1050,7 @@ |
1051 | 1051 | } |
1052 | 1052 | } else { |
1053 | 1053 | // 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!" ); |
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | } |
— | — | @@ -1064,7 +1064,7 @@ |
1065 | 1065 | if ( !this.have_firefogg ) { |
1066 | 1066 | return this.pe_cancel_action(); |
1067 | 1067 | } |
1068 | | - js_log( 'firefogg:cancel' ) |
| 1068 | + mw.log( 'firefogg:cancel' ) |
1069 | 1069 | if ( confirm( gM( 'mwe-cancel-confim' ) ) ) { |
1070 | 1070 | // FIXME: sillyness ( upstream firefogg cancel fix needed ) |
1071 | 1071 | if ( navigator.oscpu && navigator.oscpu.search( 'Win' ) >= 0 ) { |