Index: branches/js2-work/phase3/js2/mwEmbed/mwEmbed.js |
— | — | @@ -1460,24 +1460,58 @@ |
1461 | 1461 | * @return {String} absolute url |
1462 | 1462 | */ |
1463 | 1463 | $.absoluteUrl = function( src, contextUrl ){ |
1464 | | - var pSrc = mw.parseUri( src ); |
1465 | | - if( pSrc.protocol != '') |
| 1464 | + var parsedSrc = mw.parseUri( src ); |
| 1465 | + // Source is already absolute return: |
| 1466 | + if( parsedSrc.protocol != '') |
1466 | 1467 | return src; |
1467 | 1468 | |
1468 | 1469 | // Get parent Url location the context URL |
1469 | 1470 | if( contextUrl){ |
1470 | | - var pUrl = mw.parseUri( contextUrl ); |
| 1471 | + var parsedUrl = mw.parseUri( contextUrl ); |
1471 | 1472 | } else { |
1472 | | - var pUrl = mw.parseUri( document.URL ); |
| 1473 | + var parsedUrl = mw.parseUri( document.URL ); |
1473 | 1474 | } |
1474 | | - // If a leading slash: |
| 1475 | + |
| 1476 | + // Check for leading slash: |
1475 | 1477 | if( src.indexOf( '/' ) == 1 ){ |
1476 | | - return pUrl.protocol + '://' + pUrl.authority + src; |
| 1478 | + return parsedUrl.protocol + '://' + parsedUrl.authority + src; |
1477 | 1479 | }else{ |
1478 | | - return pUrl.protocol + '://' + pUrl.authority + pUrl.directory + src; |
| 1480 | + return parsedUrl.protocol + '://' + parsedUrl.authority + parsedUrl.directory + src; |
1479 | 1481 | } |
1480 | 1482 | }; |
1481 | 1483 | |
| 1484 | + /** |
| 1485 | + * Replace url parammaters via newParams key value pairs |
| 1486 | + * |
| 1487 | + * @param {String} url Source url to be updated |
| 1488 | + * @param {Object} newParams key, value paris to swap in |
| 1489 | + * @return {String} |
| 1490 | + * the updated url |
| 1491 | + */ |
| 1492 | + $.replaceUrlParams = function( url, newParams ) { |
| 1493 | + var parsedUrl = mw.parseUri( url ); |
| 1494 | + |
| 1495 | + |
| 1496 | + if ( parsedUrl.protocol != '' ) { |
| 1497 | + var new_url = parsedUrl.protocol + '://' + parsedUrl.authority + parsedUrl.path + '?'; |
| 1498 | + } else { |
| 1499 | + var new_url = parsedUrl.path + '?'; |
| 1500 | + } |
| 1501 | + |
| 1502 | + // Merge new params: |
| 1503 | + $j.merge( parsedUrl.queryKey, newParams ); |
| 1504 | + |
| 1505 | + // Output to new_url |
| 1506 | + var amp = ''; |
| 1507 | + for ( var key in parsedUrl.queryKey ) { |
| 1508 | + var val = parsedUrl.queryKey[ val ]; |
| 1509 | + new_url += amp + key + '=' + val; |
| 1510 | + amp = '&'; |
| 1511 | + } |
| 1512 | + return new_url; |
| 1513 | + } |
| 1514 | + |
| 1515 | + |
1482 | 1516 | /** |
1483 | 1517 | * Takes in a string returns an xml dom object |
1484 | 1518 | * |
— | — | @@ -2418,32 +2452,6 @@ |
2419 | 2453 | /* |
2420 | 2454 | * Utility functions: |
2421 | 2455 | */ |
2422 | | -// Simple URL rewriter (could probably be refactored into an inline regular exp) |
2423 | | -function getURLParamReplace( url, opt ) { |
2424 | | - var pSrc = mw.parseUri( url ); |
2425 | | - if ( pSrc.protocol != '' ) { |
2426 | | - var new_url = pSrc.protocol + '://' + pSrc.authority + pSrc.path + '?'; |
2427 | | - } else { |
2428 | | - var new_url = pSrc.path + '?'; |
2429 | | - } |
2430 | | - var amp = ''; |
2431 | | - for ( var key in pSrc.queryKey ) { |
2432 | | - var val = pSrc.queryKey[ key ]; |
2433 | | - // Do override if requested |
2434 | | - if ( opt[ key ] ) |
2435 | | - val = opt[ key ]; |
2436 | | - new_url += amp + key + '=' + val; |
2437 | | - amp = '&'; |
2438 | | - }; |
2439 | | - // Add any vars that were not already there: |
2440 | | - for ( var i in opt ) { |
2441 | | - if ( !pSrc.queryKey[i] ) { |
2442 | | - new_url += amp + i + '=' + opt[i]; |
2443 | | - amp = '&'; |
2444 | | - } |
2445 | | - } |
2446 | | - return new_url; |
2447 | | -} |
2448 | 2456 | |
2449 | 2457 | /** |
2450 | 2458 | * Given a float number of seconds, returns npt format response. |
Index: branches/js2-work/phase3/js2/mwEmbed/example_usage/Add_Media_Wizard.html |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | //we only enabled commons |
30 | 30 | //(since javascript includes from other servers would be problamatic ) in a default install |
31 | 31 | //** but you can set this to 'all' to pull from multiple repositories |
32 | | - 'enabled_providers' : ['wiki_commons'], |
| 32 | + 'enabled_providers' : ['all'], |
33 | 33 | |
34 | 34 | //the local wiki api url: |
35 | 35 | 'local_wiki_api_url': 'none' |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js |
— | — | @@ -1,22 +1,37 @@ |
2 | | -var mediaWikiSearch = function( iObj ) { |
3 | | - return this.init( iObj ); |
| 2 | +/** |
| 3 | +* mediaWiki search implementation |
| 4 | +*/ |
| 5 | +var mediaWikiSearch = function( options ) { |
| 6 | + return this.init( options ); |
4 | 7 | }; |
5 | 8 | mediaWikiSearch.prototype = { |
6 | | - init:function( iObj ) { |
| 9 | + |
| 10 | + /** |
| 11 | + * Inherits the base search object and passes along options |
| 12 | + * @constructor |
| 13 | + */ |
| 14 | + init:function( options ) { |
7 | 15 | // init base class and inherit: |
8 | | - var baseSearch = new baseRemoteSearch( iObj ); |
| 16 | + var baseSearch = new baseRemoteSearch( options ); |
9 | 17 | for ( var i in baseSearch ) { |
10 | 18 | if ( typeof this[i] == 'undefined' ) { |
11 | 19 | this[i] = baseSearch[i]; |
12 | 20 | } else { |
13 | 21 | this['parent_' + i] = baseSearch[i]; |
14 | 22 | } |
15 | | - } |
16 | | - // inherit the cp settings for |
| 23 | + } |
17 | 24 | }, |
18 | | - // returns a rObj by title |
| 25 | + |
| 26 | + /** |
| 27 | + * Adds a resource by its Title |
| 28 | + * |
| 29 | + * @param {String} title Title of the resource to be added |
| 30 | + * @param {Function} callback Function called once title resource aquired |
| 31 | + */ |
19 | 32 | addByTitle:function( title , callback, redirect_count ) { |
| 33 | + |
20 | 34 | js_log( "AddByTitle::" + title ); |
| 35 | + |
21 | 36 | var _this = this; |
22 | 37 | if ( !redirect_count ) |
23 | 38 | redirect_count = 0; |
— | — | @@ -25,7 +40,7 @@ |
26 | 41 | callback( false ); |
27 | 42 | return false; |
28 | 43 | } |
29 | | - var reqObj = { |
| 44 | + var request = { |
30 | 45 | 'action':'query', |
31 | 46 | 'titles':'File:' + title, |
32 | 47 | 'prop':'imageinfo|revisions|categories', |
— | — | @@ -34,7 +49,7 @@ |
35 | 50 | 'rvprop':'content' |
36 | 51 | } |
37 | 52 | do_api_req( { |
38 | | - 'data':reqObj, |
| 53 | + 'data':request, |
39 | 54 | 'url':this.provider.api_url |
40 | 55 | }, function( data ) { |
41 | 56 | // check for redirect |
— | — | @@ -58,12 +73,14 @@ |
59 | 74 | } |
60 | 75 | ); |
61 | 76 | }, |
62 | | - clearResults:function() { |
63 | | - this.resultsObj = { }; |
64 | | - this.last_query = ''; |
65 | | - }, |
66 | | - // update the resultObj with recently uploaded items by current User: |
67 | | - getUserRecentUploads:function( wgUser, callback ) { |
| 77 | + |
| 78 | + /** |
| 79 | + * Get recent upload by user and add them as results |
| 80 | + * |
| 81 | + * @param {String} user Name of the user |
| 82 | + * @param {Function} callback Function to call once user upload list has been populated |
| 83 | + */ |
| 84 | + getUserRecentUploads: function( user, callback ) { |
68 | 85 | var _this = this; |
69 | 86 | do_api_req( { |
70 | 87 | 'url':this.provider.api_url, |
— | — | @@ -71,7 +88,7 @@ |
72 | 89 | 'action':'query', |
73 | 90 | 'list':'recentchanges', |
74 | 91 | 'rcnamespace':6, // only files |
75 | | - 'rcuser': wgUser, |
| 92 | + 'rcuser': user, |
76 | 93 | 'rclimit':15 // get last 15 uploaded files |
77 | 94 | } |
78 | 95 | }, function( data ) { |
— | — | @@ -89,7 +106,7 @@ |
90 | 107 | } |
91 | 108 | } |
92 | 109 | } |
93 | | - // now run the actual query ( too bad we can't use recentchanges as a generator ) |
| 110 | + // Run the actual query ( too bad we can't use recentchanges as a generator ) |
94 | 111 | // bug 20563 |
95 | 112 | do_api_req( { |
96 | 113 | 'data' : { |
— | — | @@ -100,7 +117,7 @@ |
101 | 118 | 'iiurlwidth': parseInt( _this.rsd.thumb_width ), |
102 | 119 | 'rvprop':'content' |
103 | 120 | }, |
104 | | - 'url':_this.provider.api_url |
| 121 | + 'url': _this.provider.api_url |
105 | 122 | }, function( data ) { |
106 | 123 | _this.clearResults(); |
107 | 124 | _this.addResults( data ); |
— | — | @@ -109,22 +126,27 @@ |
110 | 127 | } ); |
111 | 128 | } ); |
112 | 129 | }, |
113 | | - getSearchResults:function() { |
114 | | - // Call parent: |
| 130 | + |
| 131 | + /** |
| 132 | + * Get search results |
| 133 | + * |
| 134 | + * @param {String} search_query Text search string |
| 135 | + */ |
| 136 | + getSearchResults: function( search_query ) { |
| 137 | + // call parent for common initialisation: |
115 | 138 | this.parent_getSearchResults(); |
116 | 139 | // Set local ref: |
117 | 140 | var _this = this; |
118 | 141 | |
119 | | - js_log( 'f:getSearchResults for:' + $j( '#rsd_q' ).val() ); |
120 | | - // Do two queries against the Image / File / MVD namespace: |
| 142 | + js_log( 'f:getSearchResults for:' + search_query ); |
121 | 143 | |
122 | | - // Build the image request object: |
123 | | - var reqObj = { |
| 144 | + // Build the image request |
| 145 | + var request = { |
124 | 146 | 'action':'query', |
125 | 147 | 'generator':'search', |
126 | | - 'gsrsearch': $j( '#rsd_q' ).val(), |
| 148 | + 'gsrsearch': search_query , |
127 | 149 | 'gsrnamespace':6, // (only search the "file" namespace (audio, video, images) |
128 | | - 'gsrwhat':'title', |
| 150 | + 'gsrwhat': 'text', |
129 | 151 | 'gsrlimit': this.provider.limit, |
130 | 152 | 'gsroffset': this.provider.offset, |
131 | 153 | 'prop':'imageinfo|revisions|categories', |
— | — | @@ -132,27 +154,33 @@ |
133 | 155 | 'iiurlwidth': parseInt( this.rsd.thumb_width ), |
134 | 156 | 'rvprop':'content' |
135 | 157 | }; |
136 | | - // Set up the number of request: |
137 | | - this.completed_req = 0; |
138 | | - this.num_req = 1; |
139 | | - // Setup the number of requests result flag: |
140 | | - // Also do a request for page titles (would be nice if api could query both at the same time) |
141 | | - reqObj['gsrwhat'] = 'text'; |
| 158 | + |
| 159 | + // Do the api request: |
142 | 160 | do_api_req( { |
143 | | - 'data':reqObj, |
144 | | - 'url':this.provider.api_url |
145 | | - }, function( data ) { |
146 | | - js_log( 'mediaWikiSearch: got data response' ); |
147 | | - // parse the return data |
148 | | - _this.addResults( data ); |
149 | | - // _this.checkRequestDone(); //only need if we do two queries one for title one for text |
| 161 | + 'data':request, |
| 162 | + 'url': this.provider.api_url |
| 163 | + }, function( data ) { |
| 164 | + // Add result data: |
| 165 | + _this.addResults( data ); |
150 | 166 | _this.loading = false; |
151 | 167 | } ); |
152 | 168 | }, |
153 | | - // same as below but returns your rObj for convenience |
154 | | - addSingleResult:function( data ) { |
| 169 | + |
| 170 | + /** |
| 171 | + * Adds a single result to resultsObj and returns the resource |
| 172 | + * |
| 173 | + * @param {Object} data Api resource result data to be transformed into a "resource" |
| 174 | + */ |
| 175 | + addSingleResult: function( data ) { |
155 | 176 | return this.addResults( data, true ); |
156 | 177 | }, |
| 178 | + |
| 179 | + /** |
| 180 | + * Covert api data results into common search resources and insert into the resultsObj |
| 181 | + * |
| 182 | + * @param {Object} data Api resource result data to be transformed into a resources |
| 183 | + * @param {Boolean} returnFirst Flag to return the first added resource |
| 184 | + */ |
157 | 185 | addResults:function( data, returnFirst ) { |
158 | 186 | js_log( "f:addResults" ); |
159 | 187 | var _this = this |
— | — | @@ -178,10 +206,11 @@ |
179 | 207 | // skip page is redirect |
180 | 208 | continue; |
181 | 209 | } |
| 210 | + |
182 | 211 | // Skip if its an empty or missing imageinfo: |
183 | 212 | if ( !page.imageinfo ) |
184 | 213 | continue; |
185 | | - var rObj = { |
| 214 | + var resource = { |
186 | 215 | 'id' : page_id, |
187 | 216 | 'titleKey' : page.title, |
188 | 217 | 'link' : page.imageinfo[0].descriptionurl, |
— | — | @@ -200,33 +229,34 @@ |
201 | 230 | 'categories':page.categories |
202 | 231 | } |
203 | 232 | }; |
| 233 | + |
204 | 234 | /* |
205 | 235 | //to use once we get the wiki-text parser in shape |
206 | | - var pObj = mw.parser.pNew( rObj.desc ); |
| 236 | + var pObj = mw.parser.pNew( resource.desc ); |
207 | 237 | //structured data on commons is based on the "information" template: |
208 | 238 | var tmplInfo = pObj.templates( 'information' ); |
209 | | - rObj.desc = tmplInfo.description |
| 239 | + resource.desc = tmplInfo.description |
210 | 240 | */ |
211 | 241 | |
212 | 242 | // Attempt to parse out the description current user desc from the commons template: |
213 | 243 | // @@todo these could be combined to a single regEx |
214 | 244 | // or better improve the wiki-text parsing and use above |
215 | | - var desc = rObj.desc.match( /\|\s*description\s*=\s*(([^\n]*\n)*)\|\s*source=/i ); |
| 245 | + var desc = resource.desc.match( /\|\s*description\s*=\s*(([^\n]*\n)*)\|\s*source=/i ); |
216 | 246 | if ( desc && desc[1] ) { |
217 | | - rObj.desc = $j.trim( desc[1] ); |
| 247 | + resource.desc = $j.trim( desc[1] ); |
218 | 248 | // attempt to get the user language if set: |
219 | 249 | if ( typeof wgUserLanguage != 'undefined' && wgUserLanguage ) { |
220 | 250 | // for some reason the RegExp object is not happy: |
221 | 251 | var reg = new RegExp( '\{\{\s*' + wgUserLanguage + '([^=]*)=([^\}]*)\}\}', 'gim' ); |
222 | | - var langMatch = reg.exec( rObj.desc ); |
| 252 | + var langMatch = reg.exec( resource.desc ); |
223 | 253 | if ( langMatch && langMatch[2] ) { |
224 | | - rObj.desc = langMatch[2]; |
| 254 | + resource.desc = langMatch[2]; |
225 | 255 | } else { |
226 | | - // try simple lang template form: |
| 256 | + // Try simple lang template form: |
227 | 257 | var reg = new RegExp( '\{\{\s*' + wgUserLanguage + '\\|([^\}]*)\}\}', 'gim' ); |
228 | | - var langMatch = reg.exec( rObj.desc ); |
| 258 | + var langMatch = reg.exec( resource.desc ); |
229 | 259 | if ( langMatch && langMatch[1] ) { |
230 | | - rObj.desc = langMatch[1]; |
| 260 | + resource.desc = langMatch[1]; |
231 | 261 | } |
232 | 262 | } |
233 | 263 | } |
— | — | @@ -234,11 +264,11 @@ |
235 | 265 | |
236 | 266 | // Likely a audio clip if no poster and type application/ogg |
237 | 267 | // @@todo we should return audio/ogg for the mime type or some other way to specify its "audio" |
238 | | - if ( ! rObj.poster && rObj.mime == 'application/ogg' ) { |
239 | | - rObj.mime = 'audio/ogg'; |
| 268 | + if ( ! resource.poster && resource.mime == 'application/ogg' ) { |
| 269 | + resource.mime = 'audio/ogg'; |
240 | 270 | } |
241 | 271 | // Add to the resultObj |
242 | | - this.resultsObj[page_id] = rObj; |
| 272 | + this.resultsObj[page_id] = resource; |
243 | 273 | |
244 | 274 | // If returnFirst flag: |
245 | 275 | if ( returnFirst ) |
— | — | @@ -254,7 +284,11 @@ |
255 | 285 | js_log( 'no results:' + data ); |
256 | 286 | } |
257 | 287 | }, |
258 | | - // Check request done used for when we have multiple requests to check before formating results. |
| 288 | + |
| 289 | + /* |
| 290 | + * Check request done |
| 291 | + * Used when we have multiple requests to check before formating results. |
| 292 | + */ |
259 | 293 | checkRequestDone:function() { |
260 | 294 | // Display output if done: |
261 | 295 | this.completed_req++; |
— | — | @@ -262,24 +296,32 @@ |
263 | 297 | this.loading = 0; |
264 | 298 | } |
265 | 299 | }, |
266 | | - getImageObj:function( rObj, size, callback ) { |
267 | | - if ( rObj.mime == 'application/ogg' ) |
268 | | - return callback( { 'url':rObj.src, 'poster' : rObj.url } ); |
| 300 | + |
| 301 | + /** |
| 302 | + * Get an Image object of requested size from a resource |
| 303 | + * |
| 304 | + * @param {Object} resource Source resource |
| 305 | + * @param {Object} size Requested size: .width and .height |
| 306 | + * @param {Function} callbcak Function to be called once image has been reqeusted |
| 307 | + */ |
| 308 | + getImageObj:function( resource, size, callback ) { |
| 309 | + if ( resource.mime == 'application/ogg' ) |
| 310 | + return callback( { 'url':resource.src, 'poster' : resource.url } ); |
269 | 311 | |
270 | 312 | // This could be depreciated if thumb.php support is standard |
271 | | - var reqObj = { |
| 313 | + var request = { |
272 | 314 | 'action':'query', |
273 | 315 | 'format':'json', |
274 | | - 'titles':rObj.titleKey, |
| 316 | + 'titles':resource.titleKey, |
275 | 317 | 'prop':'imageinfo', |
276 | 318 | 'iiprop':'url|size|mime' |
277 | 319 | } |
278 | 320 | // Set the width: |
279 | 321 | if ( size.width ) |
280 | | - reqObj['iiurlwidth'] = size.width; |
281 | | - js_log( 'going to do req: ' + this.provider.api_url + ' ' + reqObj ); |
| 322 | + request['iiurlwidth'] = size.width; |
| 323 | + js_log( 'going to do req: ' + this.provider.api_url + ' ' + request ); |
282 | 324 | do_api_req( { |
283 | | - 'data':reqObj, |
| 325 | + 'data':request, |
284 | 326 | 'url' : this.provider.api_url |
285 | 327 | }, function( data ) { |
286 | 328 | var imObj = { }; |
— | — | @@ -303,13 +345,14 @@ |
304 | 346 | callback( imObj ); |
305 | 347 | } ); |
306 | 348 | }, |
307 | | - // the insert image function |
308 | | - insertImage:function( cEdit ) { |
309 | | - if ( !cEdit ) |
310 | | - var cEdit = _this.cEdit; |
311 | | - }, |
312 | | - getInlineDescWiki:function( rObj ) { |
313 | | - var desc = this.parent_getInlineDescWiki( rObj ); |
| 349 | + |
| 350 | + /* |
| 351 | + * Gets an inline description of the resource |
| 352 | + * |
| 353 | + * @param {Object} resource Resource to get description of. |
| 354 | + */ |
| 355 | + getInlineDescWiki:function( resource ) { |
| 356 | + var desc = this.parent_getInlineDescWiki( resource ); |
314 | 357 | |
315 | 358 | // Strip categories for inline Desc: (should strip license tags too but not as easy) |
316 | 359 | desc = desc.replace( /\[\[Category\:[^\]]*\]\]/gi, '' ); |
— | — | @@ -334,24 +377,29 @@ |
335 | 378 | js_log( 'Error: No Description Tag, Using::' + desc ); |
336 | 379 | return desc; |
337 | 380 | }, |
338 | | - // Returns the inline wikitext for insertion (template based crops for now) |
339 | | - getEmbedWikiCode: function( rObj ) { |
| 381 | + |
| 382 | + /** |
| 383 | + * Returns the wikitext for embeding the resource in a wiki article |
| 384 | + * |
| 385 | + * @param {Object} resource Resource to get wiki text embed code |
| 386 | + */ |
| 387 | + getEmbedWikiCode: function( resource ) { |
340 | 388 | // Set default layout to right justified |
341 | | - var layout = ( rObj.layout ) ? rObj.layout:"right" |
| 389 | + var layout = ( resource.layout ) ? resource.layout:"right" |
342 | 390 | // if crop is null do base output: |
343 | | - if ( rObj.crop == null ) |
344 | | - return this.parent_getEmbedWikiCode( rObj ); |
| 391 | + if ( resource.crop == null ) |
| 392 | + return this.parent_getEmbedWikiCode( resource ); |
345 | 393 | // Using the preview crop template: http://en.wikipedia.org/wiki/Template:Preview_Crop |
346 | 394 | // @@todo should be replaced with server side cropping |
347 | 395 | return '{{Preview Crop ' + "\n" + |
348 | | - '|Image = ' + rObj.target_resource_title + "\n" + |
349 | | - '|bSize = ' + rObj.width + "\n" + |
350 | | - '|cWidth = ' + rObj.crop.w + "\n" + |
351 | | - '|cHeight = ' + rObj.crop.h + "\n" + |
352 | | - '|oTop = ' + rObj.crop.y + "\n" + |
353 | | - '|oLeft = ' + rObj.crop.x + "\n" + |
| 396 | + '|Image = ' + resource.target_resource_title + "\n" + |
| 397 | + '|bSize = ' + resource.width + "\n" + |
| 398 | + '|cWidth = ' + resource.crop.w + "\n" + |
| 399 | + '|cHeight = ' + resource.crop.h + "\n" + |
| 400 | + '|oTop = ' + resource.crop.y + "\n" + |
| 401 | + '|oLeft = ' + resource.crop.x + "\n" + |
354 | 402 | '|Location =' + layout + "\n" + |
355 | | - '|Description =' + rObj.inlineDesc + "\n" + |
| 403 | + '|Description =' + resource.inlineDesc + "\n" + |
356 | 404 | '}}'; |
357 | 405 | } |
358 | 406 | } |
\ No newline at end of file |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js |
— | — | @@ -1,4 +1,4 @@ |
2 | | -/* |
| 2 | +/** |
3 | 3 | * Base remote search Object. |
4 | 4 | * provides the base class for the other search system to extend. |
5 | 5 | */ |
— | — | @@ -66,23 +66,35 @@ |
67 | 67 | } |
68 | 68 | return this; |
69 | 69 | }, |
| 70 | + |
70 | 71 | /** |
71 | 72 | * Base search results |
72 | | - * Does some common initialisation for search results |
| 73 | + * Does some common initialisation for search results |
| 74 | + * @param {String} search_query Text search string |
73 | 75 | */ |
74 | | - getSearchResults:function() { |
| 76 | + getSearchResults: function( search_query ) { |
75 | 77 | // Empty out the current results before issuing a request |
76 | 78 | this.resultsObj = { }; |
77 | 79 | |
78 | 80 | // Do global getSearchResults bindings |
79 | | - this.last_query = $j( '#rsd_q' ).val(); |
| 81 | + this.last_query = search_query; |
80 | 82 | this.last_offset = this.provider.offset; |
81 | 83 | |
82 | 84 | // Set the loading flag: |
83 | 85 | this.loading = true; |
84 | 86 | }, |
| 87 | + |
| 88 | + /** |
| 89 | + * Clears Results |
| 90 | + */ |
| 91 | + clearResults:function() { |
| 92 | + this.resultsObj = { }; |
| 93 | + this.last_query = ''; |
| 94 | + }, |
| 95 | + |
85 | 96 | /* |
86 | 97 | * Parses and adds video rss based input format |
| 98 | + * |
87 | 99 | * @param {XML Nodes} data the data to be parsed |
88 | 100 | * @param {String} provider_url the source url (used to generate absolute links) |
89 | 101 | */ |
— | — | @@ -258,7 +270,10 @@ |
259 | 271 | '</div>'; |
260 | 272 | }, |
261 | 273 | /** |
262 | | - * Get the embed html specifically for an image type resource Object. |
| 274 | + * Get the embed html specifically for an image type resource Object. |
| 275 | + * |
| 276 | + * @param {Object} resource Resource to get embed html from |
| 277 | + * @param {Object} options Embeding options |
263 | 278 | */ |
264 | 279 | getImageEmbedHTML:function( resource, options ) { |
265 | 280 | // if crop is null do base output: |
— | — | @@ -275,18 +290,24 @@ |
276 | 291 | '</div>' + |
277 | 292 | '</div>'; |
278 | 293 | }, |
| 294 | + |
279 | 295 | /** |
280 | 296 | * Get an image object from a requested transformation via callback |
281 | 297 | * ( letting api search implementations query the remote server for a |
282 | 298 | * given transformation ) |
283 | 299 | * |
284 | 300 | * By default just return the existing image. |
| 301 | + * |
| 302 | + * @param {Object} resource Not used in base method |
| 303 | + * @param {Object} size Not used in base method |
| 304 | + * @param {Function} callbcak Function called with returned image Object |
285 | 305 | */ |
286 | 306 | getImageObj:function( resource, size, callback ) { |
287 | 307 | callback( { |
288 | 308 | 'url' : resource.poster |
289 | 309 | } ); |
290 | 310 | }, |
| 311 | + |
291 | 312 | /** |
292 | 313 | * Get the inline wikiText description of the resource Object |
293 | 314 | */ |
— | — | @@ -357,7 +378,7 @@ |
358 | 379 | * @param {Object} resource Resource to add embeded info to |
359 | 380 | * @param {String} embed_id Id of embed object |
360 | 381 | */ |
361 | | - addResourceInfoFromEmbedInstance : function( resource, embed_id ) { |
| 382 | + addEmbedInfo : function( resource, embed_id ) { |
362 | 383 | return resource; |
363 | 384 | }, |
364 | 385 | |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js |
— | — | @@ -27,25 +27,28 @@ |
28 | 28 | } |
29 | 29 | } |
30 | 30 | }, |
| 31 | + |
31 | 32 | /** |
32 | | - * Get search results from the api query |
| 33 | + * Get search results from the api query. |
| 34 | + * |
| 35 | + * @param {String} search_query Text search string |
33 | 36 | */ |
34 | | - getSearchResults:function() { |
35 | | - // call parent: |
| 37 | + getSearchResults: function( search_query ) { |
| 38 | + |
| 39 | + // call parent for common initialisation: |
36 | 40 | this.parent_getSearchResults(); |
| 41 | + |
37 | 42 | var _this = this; |
38 | | - js_log( 'f:getSearchResults for:' + $j( '#rsd_q' ).val() ); |
| 43 | + js_log( 'f:getSearchResults for:' + search_query ); |
39 | 44 | |
40 | | - // Build the query var |
41 | | - var q = $j( '#rsd_q' ).val(); |
42 | 45 | |
43 | 46 | // For now force (Ogg video) & url based license |
44 | | - q += ' format:(Ogg video)'; |
45 | | - q += ' licenseurl:(http\\:\\/\\/*)'; |
| 47 | + search_query += ' format:(Ogg video)'; |
| 48 | + search_query += ' licenseurl:(http\\:\\/\\/*)'; |
46 | 49 | |
47 | 50 | // Build the request Object |
48 | 51 | var reqObj = { |
49 | | - 'q': q, // just search for video atm |
| 52 | + 'q': search_query, // just search for video atm |
50 | 53 | 'fl':"description,title,identifier,licenseurl,format,license,thumbnail", |
51 | 54 | 'wt':'json', |
52 | 55 | 'rows' : this.provider.limit, |
— | — | @@ -63,6 +66,8 @@ |
64 | 67 | }, |
65 | 68 | /** |
66 | 69 | * Adds the search results to the local resultsObj |
| 70 | + * |
| 71 | + * @param {Object} data Api result data |
67 | 72 | */ |
68 | 73 | addResults:function( data ) { |
69 | 74 | var _this = this; |
— | — | @@ -96,6 +101,9 @@ |
97 | 102 | }, |
98 | 103 | /** |
99 | 104 | * Get media metadata via a archive.org special entry point "avinfo" |
| 105 | + * |
| 106 | + * @param {Object} resource Resrouce to add metadata to. |
| 107 | + * @param {Function} callbcak Function called once extra metadata is added. |
100 | 108 | */ |
101 | 109 | addResourceInfoCallback:function( resource, callback ) { |
102 | 110 | var _this = this; |
— | — | @@ -116,6 +124,8 @@ |
117 | 125 | |
118 | 126 | /** |
119 | 127 | * Returns html to embed a given result Object ( resource ) |
| 128 | + * @param {Object} resrouce Resource to get embed HTML from. |
| 129 | + * @parma {Object} options Options for the embeding. |
120 | 130 | */ |
121 | 131 | getEmbedHTML: function( resource , options ) { |
122 | 132 | js_log( 'getEmbedHTML:: ' + resource.poster ); |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js |
— | — | @@ -8,12 +8,12 @@ |
9 | 9 | return this.init( iObj ); |
10 | 10 | }; |
11 | 11 | metavidSearch.prototype = { |
12 | | - defaultReq: { // set up the default request paramaters |
13 | | - 'order':'recent', |
14 | | - 'feed_format':'json_rss', |
15 | | - 'cb_inx': 1 // Not really used (we should update the metavid json retrun system) |
| 12 | + // Default request parameters |
| 13 | + defaultReq: { |
| 14 | + 'order': 'recent', |
| 15 | + 'feed_format': 'json_rss' |
16 | 16 | }, |
17 | | - init:function( iObj ) { |
| 17 | + init: function( iObj ) { |
18 | 18 | // init base class and inherit: |
19 | 19 | var baseSearch = new baseRemoteSearch( iObj ); |
20 | 20 | for ( var i in baseSearch ) { |
— | — | @@ -24,17 +24,27 @@ |
25 | 25 | } |
26 | 26 | } |
27 | 27 | }, |
28 | | - getSearchResults:function() { |
29 | | - // call parent: |
| 28 | + |
| 29 | + /** |
| 30 | + * getSearchResults |
| 31 | + * |
| 32 | + * @param {String} search_query Text search string |
| 33 | + */ |
| 34 | + getSearchResults: function( search_query ) { |
| 35 | + |
| 36 | + // Call parent for common initialisation: |
30 | 37 | this.parent_getSearchResults(); |
31 | | - // set local ref: |
| 38 | + |
| 39 | + // Set local ref: |
32 | 40 | var _this = this; |
| 41 | + |
33 | 42 | js_log( 'metavidSearch::getSearchResults()' ); |
34 | | - // Proccess all options |
| 43 | + |
| 44 | + // Process all options |
35 | 45 | var url = this.provider.api_url; |
36 | 46 | var reqObj = $j.extend({}, this.defaultReq); |
37 | 47 | reqObj[ 'f[0][t]' ] = 'match'; |
38 | | - reqObj[ 'f[0][v]' ] = $j( '#rsd_q' ).val(); |
| 48 | + reqObj[ 'f[0][v]' ] = search_query; |
39 | 49 | |
40 | 50 | // add offset limit: |
41 | 51 | reqObj[ 'limit' ] = this.provider.limit; |
— | — | @@ -87,17 +97,32 @@ |
88 | 98 | _this.loading = 0; |
89 | 99 | } ); |
90 | 100 | }, |
| 101 | + |
91 | 102 | /** |
92 | | - * Get a Title key for the assset name inside the mediaWiki system |
| 103 | + * Get a Title key for the asset name inside the mediaWiki system |
| 104 | + * |
| 105 | + * @param {Object} resource Resource to get title key from |
93 | 106 | */ |
94 | 107 | getTitleKey:function( resource ) { |
95 | 108 | return resource['stream_name'] + '_part_' + resource['start_time'].replace(/:/g, '.' ) + '_to_' + resource['end_time'].replace(/:/g, '.' ) + '.ogv'; |
96 | 109 | }, |
| 110 | + |
| 111 | + /** |
| 112 | + * Get a Title from a resource |
| 113 | + * |
| 114 | + * @parma {Object} resoruce Resource to get title from |
| 115 | + */ |
97 | 116 | getTitle:function( resource ) { |
98 | 117 | var sn = resource['stream_name'].replace( /_/g, ' ' ); |
99 | 118 | sn = sn.charAt( 0 ).toUpperCase() + sn.substr( 1 ); |
100 | 119 | return gM( 'mwe-stream_title', [ sn, resource.start_time, resource.end_time ] ); |
101 | 120 | }, |
| 121 | + |
| 122 | + /** |
| 123 | + * Get additional wiki text description |
| 124 | + * |
| 125 | + * @param {Object} resource Resource to get addtional wikitext for. |
| 126 | + */ |
102 | 127 | getExtraResourceDescWiki:function( resource ) { |
103 | 128 | var o = "\n"; |
104 | 129 | // check for person |
— | — | @@ -115,7 +140,12 @@ |
116 | 141 | o += '* related to bill: [[' + resource.bill['label'] + ']] more bill [' + resource.bill['url'] + ' video clips]' + "\n"; |
117 | 142 | return o; |
118 | 143 | }, |
119 | | - // format is "quote" followed by [[name of person]] |
| 144 | + |
| 145 | + /** |
| 146 | + * Get inline description |
| 147 | + * format is "quote" followed by [[name of person]] |
| 148 | + * @param {Object} resource Resource to get inline description of. |
| 149 | + */ |
120 | 150 | getInlineDescWiki:function( resource ) { |
121 | 151 | var o = this.parent_getInlineDescWiki( resource ); |
122 | 152 | // add in person if found |
— | — | @@ -135,13 +165,19 @@ |
136 | 166 | // '<ref>[' + resource.link + ' Metavid Source Page] for ' + resource.title +'</ref>'; |
137 | 167 | return o; |
138 | 168 | }, |
139 | | - // give an updated start and end time updates the title and url |
| 169 | + |
| 170 | + /** |
| 171 | + * Apply an updated start and end time to the resource ( for use with the #embed_vid clip ) |
| 172 | + * |
| 173 | + * @param {Object} resource Resource to be updated |
| 174 | + */ |
140 | 175 | applyVideoAdj: function( resource ) { |
141 | 176 | js_log( 'mv ApplyVideoAdj::' ); |
142 | | - // update the titleKey: |
| 177 | + |
| 178 | + // Update the titleKey: |
143 | 179 | resource['titleKey'] = this.getTitleKey( resource ); |
144 | 180 | |
145 | | - // update the title: |
| 181 | + // Update the title: |
146 | 182 | resource['title'] = this.getTitle( resource ); |
147 | 183 | |
148 | 184 | // update the interface: |
— | — | @@ -160,18 +196,30 @@ |
161 | 197 | } |
162 | 198 | } |
163 | 199 | }, |
| 200 | + |
| 201 | + /** |
| 202 | + * Get html to embed the resource into a page: |
| 203 | + * |
| 204 | + * @param {Object} resource Resource to be embed |
| 205 | + * @param {Object} options Resource Optiosn for embeind ( like max_width ) |
| 206 | + */ |
164 | 207 | getEmbedHTML:function( resource , options ) { |
165 | 208 | if ( !options ) |
166 | 209 | options = { }; |
167 | 210 | var id_attr = ( options['id'] ) ? ' id = "' + options['id'] + '" ': ''; |
168 | | - var style_attr = ( options['max_width'] ) ? ' style="width:' + options['max_width'] + 'px;"':''; |
169 | | - // @@maybe check type here ? |
| 211 | + var style_attr = ( options['max_width'] ) ? ' style="width:' + options['max_width'] + 'px;"':''; |
170 | 212 | if ( options['only_poster'] ) { |
171 | 213 | return '<img ' + id_attr + ' src="' + resource['poster'] + '" ' + style_attr + '>'; |
172 | 214 | } else { |
173 | 215 | return '<video ' + id_attr + ' roe="' + resource['roe_url'] + '"></video>'; |
174 | 216 | } |
175 | 217 | }, |
| 218 | + |
| 219 | + /** |
| 220 | + * Get Image Transform |
| 221 | + * |
| 222 | + * @param {Object} resource Resource to transform |
| 223 | + */ |
176 | 224 | getImageTransform:function( resource, opt ) { |
177 | 225 | if ( opt.width <= 80 ) { |
178 | 226 | return getURLParamReplace( resource.poster, { 'size' : "icon" } ) |
— | — | @@ -185,7 +233,13 @@ |
186 | 234 | return getURLParamReplace( resource.poster, { 'size' : 'full' } ) |
187 | 235 | } |
188 | 236 | }, |
189 | | - addResourceInfoFromEmbedInstance : function( resource, embed_id ) { |
| 237 | + |
| 238 | + /** |
| 239 | + * Add information from the embed instance to the resource |
| 240 | + * |
| 241 | + * @param {Object} resource Resource to transform |
| 242 | + */ |
| 243 | + addEmbedInfo : function( resource, embed_id ) { |
190 | 244 | var sources = $j( '#' + embed_id ).get( 0 ).media_element.getSources(); |
191 | 245 | resource.other_versions = '*[' + resource['roe_url'] + ' XML of all Video Formats and Timed Text]' + "\n"; |
192 | 246 | for ( var i in sources ) { |
— | — | @@ -197,6 +251,13 @@ |
198 | 252 | // js_log('set url to: ' + resource['url']); |
199 | 253 | return resource; |
200 | 254 | }, |
| 255 | + |
| 256 | + /** |
| 257 | + * Get a date from a media link |
| 258 | + * |
| 259 | + * @param {String} link Link url to be parsed |
| 260 | + * @return {Date Object} |
| 261 | + */ |
201 | 262 | getDateFromLink:function( link ) { |
202 | 263 | var dateExp = new RegExp( /_([0-9]+)\-([0-9]+)\-([0-9]+)/ ); |
203 | 264 | var dParts = link.match ( dateExp ); |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/flickrSearch.js |
— | — | @@ -49,12 +49,15 @@ |
50 | 50 | * Get the Search results setting _loading flag to false once results have been added |
51 | 51 | * |
52 | 52 | * Runs an api call then calls addResults with the resulting data |
| 53 | + * @param {String} search_query Text search string |
53 | 54 | */ |
54 | | - getSearchResults:function() { |
| 55 | + getSearchResults:function( search_query ) { |
55 | 56 | var _this = this; |
56 | 57 | js_log( "flickr::getSearchResults" ); |
57 | | - // call parent (sets loading sate and other setup stuff) |
| 58 | + |
| 59 | + // call parent for common initialisation: |
58 | 60 | this.parent_getSearchResults(); |
| 61 | + |
59 | 62 | // setup the flickr request: |
60 | 63 | var reqObj = { |
61 | 64 | 'method':'flickr.photos.search', |
— | — | @@ -63,12 +66,12 @@ |
64 | 67 | 'api_key':this.apikey, |
65 | 68 | 'per_page': this.provider.limit, |
66 | 69 | 'page' : this.provider.offset, |
67 | | - 'text': $j( '#rsd_q' ).val(), |
| 70 | + 'text': search_query, |
68 | 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' |
69 | 72 | } |
70 | 73 | do_api_req( { |
71 | 74 | 'data': reqObj, |
72 | | - 'url':this.provider.api_url, |
| 75 | + 'url': this.provider.api_url, |
73 | 76 | 'jsonCB':'jsoncallback', |
74 | 77 | }, function( data ) { |
75 | 78 | _this.addResults( data ); |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvAdvFirefogg.js |
— | — | @@ -951,7 +951,7 @@ |
952 | 952 | /** |
953 | 953 | * Restore settings from a cookie (if available) |
954 | 954 | */ |
955 | | - loadEncSettings: function( force ) { |
| 955 | + loadEncSettings: function( ) { |
956 | 956 | if ( $j.cookie( 'fogg_encoder_config' ) ) { |
957 | 957 | js_log( "load:fogg_encoder_config from cookie " ); |
958 | 958 | this.local_settings = JSON.parse( $j.cookie( 'fogg_settings' ) ); |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -384,7 +384,7 @@ |
385 | 385 | // Merge in the options |
386 | 386 | $j.extend( _this, default_remote_search_options, options ); |
387 | 387 | |
388 | | - // Quick fix for cases where people put ['all'] instead of 'all' for enabled_providers |
| 388 | + // Quick fix for cases where {object} ['all'] is used instead of {string} 'all' for enabled_providers: |
389 | 389 | if ( _this.enabled_providers.length == 1 && _this.enabled_providers[0] == 'all' ) |
390 | 390 | _this.enabled_providers = 'all'; |
391 | 391 | |
— | — | @@ -836,7 +836,8 @@ |
837 | 837 | }, |
838 | 838 | |
839 | 839 | /** |
840 | | - * Once the uploadForm is ready display it for the upload provider |
| 840 | + * Once the uploadForm is ready display it for the upload provider |
| 841 | + * |
841 | 842 | * @param {Object} provider Provider object for Upload From |
842 | 843 | */ |
843 | 844 | showUploadForm_internal: function( provider ) { |
— | — | @@ -867,7 +868,7 @@ |
868 | 869 | // Fill in the user uploads: |
869 | 870 | if ( typeof wgUserName != 'undefined' && wgUserName ) { |
870 | 871 | // Load the upload bin with anything the current user has uploaded |
871 | | - provider.sObj.getUserRecentUploads( wgUserName, function() { |
| 872 | + provider.sObj.getUserRecentUploads( wgUserName, function( ) { |
872 | 873 | _this.showResults(); |
873 | 874 | } ); |
874 | 875 | } else { |
— | — | @@ -908,6 +909,7 @@ |
909 | 910 | |
910 | 911 | /** |
911 | 912 | * Show the search tab for a given providerName |
| 913 | + * |
912 | 914 | * @param {String} providerName name of the content provider |
913 | 915 | * @param {Bollean} resetPaging if the pagging should be reset |
914 | 916 | */ |
— | — | @@ -917,7 +919,7 @@ |
918 | 920 | var draw_direct_flag = true; |
919 | 921 | |
920 | 922 | // Else do showSearchTab |
921 | | - var provider = this.content_providers[providerName]; |
| 923 | + var provider = this.content_providers[ providerName ]; |
922 | 924 | |
923 | 925 | // Check if we need to update: |
924 | 926 | if ( typeof provider.sObj != 'undefined' ) { |
— | — | @@ -934,6 +936,7 @@ |
935 | 937 | } else { |
936 | 938 | draw_direct_flag = false; |
937 | 939 | } |
| 940 | + |
938 | 941 | if ( !draw_direct_flag ) { |
939 | 942 | // See if we should reset the paging |
940 | 943 | if ( resetPaging ) { |
— | — | @@ -983,6 +986,13 @@ |
984 | 987 | ); |
985 | 988 | } |
986 | 989 | }, |
| 990 | + |
| 991 | + /** |
| 992 | + * Evaluate the result of an api copyURL permision request |
| 993 | + * |
| 994 | + * @param {Object} data Result data to be checked |
| 995 | + * @param {Function} callback Function to call once api returns value |
| 996 | + */ |
987 | 997 | checkCopyURLApiResult: function( data, callback ) { |
988 | 998 | var _this = this; |
989 | 999 | // Api checks: |
— | — | @@ -1013,6 +1023,10 @@ |
1014 | 1024 | * not really necessary the api request to upload will return appropriate error |
1015 | 1025 | * if the user lacks permission. or $wgAllowCopyUploads is set to false |
1016 | 1026 | * (use this function if we want to issue a warning up front) |
| 1027 | + * |
| 1028 | + * @param {Function} callback Function to call with URL permision |
| 1029 | + * @return |
| 1030 | + * false callback user does not have permision |
1017 | 1031 | */ |
1018 | 1032 | checkForCopyURLPermission: function( callback ) { |
1019 | 1033 | var _this = this; |
— | — | @@ -1065,10 +1079,10 @@ |
1066 | 1080 | '</div>' ); |
1067 | 1081 | } |
1068 | 1082 | return false; |
1069 | | - } |
1070 | | - _this.loadSearchLib( provider, function() { |
1071 | | - // Do the search |
1072 | | - provider.sObj.getSearchResults(); |
| 1083 | + } |
| 1084 | + _this.loadSearchLib( provider, function( provider ) { |
| 1085 | + // Do the search: |
| 1086 | + provider.sObj.getSearchResults( $j( '#rsd_q' ).val() ); |
1073 | 1087 | _this.waitForResults( function() { |
1074 | 1088 | _this.showResults(); |
1075 | 1089 | } ); |
— | — | @@ -1079,7 +1093,8 @@ |
1080 | 1094 | * Loads a providers search library |
1081 | 1095 | * |
1082 | 1096 | * @param {Object} provider content provider to be loaded |
1083 | | - * @param {Function} callback function to be called once provider is loaded |
| 1097 | + * @param {Function} callback Function to call once provider is loaded |
| 1098 | + * ( provider is passed back in callback to avoid possible concurancy issues in multiple load calls) |
1084 | 1099 | */ |
1085 | 1100 | loadSearchLib: function( provider, callback ) { |
1086 | 1101 | var _this = this; |
— | — | @@ -1103,7 +1118,7 @@ |
1104 | 1119 | // inherit defaults if not set: |
1105 | 1120 | provider.limit = provider.limit ? provider.limit : provider.sObj.limit; |
1106 | 1121 | provider.offset = provider.offset ? provider.offset : provider.sObj.offset; |
1107 | | - callback(); |
| 1122 | + callback( provider ); |
1108 | 1123 | } ); |
1109 | 1124 | }, |
1110 | 1125 | |
— | — | @@ -1720,7 +1735,7 @@ |
1721 | 1736 | $j( '#embed_vid').embedPlayer ( function() { |
1722 | 1737 | |
1723 | 1738 | // Grab information available from the embed instance |
1724 | | - resource.pSobj.addResourceInfoFromEmbedInstance( resource, 'embed_vid' ); |
| 1739 | + resource.pSobj.addEmbedInfo( resource, 'embed_vid' ); |
1725 | 1740 | |
1726 | 1741 | // Add libraries resizable and hoverIntent to support video edit tools |
1727 | 1742 | var librarySet = [ |
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/embedPlayer.js |
— | — | @@ -566,7 +566,7 @@ |
567 | 567 | if ( !npt2seconds( end_npt ) ) |
568 | 568 | end_npt = this.end_npt; |
569 | 569 | |
570 | | - this.src = getURLParamReplace( this.src, { |
| 570 | + this.src = mw.replaceUrlParams( this.src, { |
571 | 571 | 't': start_npt + '/' + end_npt |
572 | 572 | }); |
573 | 573 | |
— | — | @@ -607,7 +607,7 @@ |
608 | 608 | } else { |
609 | 609 | var endvar = '/' + this.end_npt; |
610 | 610 | } |
611 | | - return getURLParamReplace( this.src, |
| 611 | + return mw.replaceUrlParams( this.src, |
612 | 612 | { |
613 | 613 | 't': seconds2npt( seek_time_sec ) + endvar |
614 | 614 | } |
— | — | @@ -1967,7 +1967,7 @@ |
1968 | 1968 | // check if our thumbnail has a time attribute: |
1969 | 1969 | if ( my_thumb_src.indexOf( 't=' ) !== -1 ) { |
1970 | 1970 | var time_ntp = seconds2npt ( options.time + parseInt( this.start_offset ) ); |
1971 | | - my_thumb_src = getURLParamReplace( my_thumb_src, { |
| 1971 | + my_thumb_src = mw.replaceUrlParams( my_thumb_src, { |
1972 | 1972 | 't' : time_ntp, |
1973 | 1973 | 'size' : options.size |
1974 | 1974 | }); |
— | — | @@ -1991,7 +1991,7 @@ |
1992 | 1992 | this.org_thum_src = this.media_element.getThumbnailURL(); |
1993 | 1993 | } |
1994 | 1994 | if ( this.org_thum_src.indexOf( 't=' ) !== -1 ) { |
1995 | | - this.last_thumb_url = getURLParamReplace( this.org_thum_src, |
| 1995 | + this.last_thumb_url = mw.replaceUrlParams( this.org_thum_src, |
1996 | 1996 | { |
1997 | 1997 | 't' : seconds2npt( float_sec + parseInt( this.start_offset ) ) |
1998 | 1998 | } |