Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js |
— | — | @@ -276,7 +276,7 @@ |
277 | 277 | '</div>'; |
278 | 278 | }, |
279 | 279 | /** |
280 | | - * Gets an image object from a requested transformation via callback |
| 280 | + * Get an image object from a requested transformation via callback |
281 | 281 | * ( letting api search implementations query the remote server for a |
282 | 282 | * given transformation ) |
283 | 283 | * |
— | — | @@ -288,7 +288,7 @@ |
289 | 289 | } ); |
290 | 290 | }, |
291 | 291 | /** |
292 | | - * Gets the inline wikiText description of the resource Object |
| 292 | + * Get the inline wikiText description of the resource Object |
293 | 293 | */ |
294 | 294 | getInlineDescWiki:function( resource ) { |
295 | 295 | // return striped html & trim white space |
— | — | @@ -319,12 +319,16 @@ |
320 | 320 | } |
321 | 321 | |
322 | 322 | }, |
| 323 | + |
323 | 324 | /** |
324 | | - * Gets the resource import description text |
| 325 | + * Get the resource import description text |
| 326 | + * |
| 327 | + * @param {Object} resource Resource to get description of |
325 | 328 | */ |
326 | 329 | getImportResourceDescWiki:function( resource ) { |
327 | 330 | return gM( 'mwe-imported_from', [resource.title, this.provider.homepage, gM('rsd-' + this.provider.id + '-title'), resource.link] ); |
328 | 331 | }, |
| 332 | + |
329 | 333 | /** |
330 | 334 | * Get any extra wikitext description for the given resource object. |
331 | 335 | * For content outside of the main template description, |
— | — | @@ -337,25 +341,36 @@ |
338 | 342 | }, |
339 | 343 | |
340 | 344 | /** |
341 | | - * Gets a image transformation |
| 345 | + * Get an image transformation |
342 | 346 | * by default it just return the poster |
| 347 | + * |
| 348 | + * @param {Object} resource Resource for image transformation |
| 349 | + * @param {Object} options Transformation options |
343 | 350 | */ |
344 | | - getImageTransform:function( resource, opt ) { |
| 351 | + getImageTransform:function( resource, options ) { |
345 | 352 | return resource.poster; |
346 | 353 | }, |
347 | 354 | |
348 | 355 | /** |
349 | | - * Adds additional resource information post clip embedding. |
| 356 | + * Adds additional resource information from an embedding instance. |
| 357 | + * |
| 358 | + * @param {Object} resource Resource to add embeded info to |
| 359 | + * @param {String} embed_id Id of embed object |
350 | 360 | */ |
351 | | - addResourceInfoFromEmbedInstance : function( resource, eb_id ) { |
| 361 | + addResourceInfoFromEmbedInstance : function( resource, embed_id ) { |
352 | 362 | return resource; |
353 | 363 | }, |
354 | 364 | |
355 | 365 | /** |
356 | | - * Adds resource info with a callback function |
| 366 | + * Adds resource info with a callback |
357 | 367 | * |
358 | | - * Use full for grabbing extra info that is not available in the initial |
359 | | - * search results api request. |
| 368 | + * Usefull for async grabbing extra info that is not available in the initial |
| 369 | + * search results api request. |
| 370 | + * |
| 371 | + * For example see archive.org extra resource query |
| 372 | + * |
| 373 | + * @param {Object} resource Resource to add information to |
| 374 | + * @param {Function} callback Callback function once extra resource info has been added |
360 | 375 | */ |
361 | 376 | addResourceInfoCallback:function( resource, callback ) { |
362 | 377 | callback(); |
— | — | @@ -363,6 +378,8 @@ |
364 | 379 | |
365 | 380 | /** |
366 | 381 | * Get the wiki embed code for a given resource object |
| 382 | + * |
| 383 | + * @param {Object} resource Resoruce to get embed wiki code for. |
367 | 384 | */ |
368 | 385 | getEmbedWikiCode:function( resource ) { |
369 | 386 | var layout = ( resource.layout ) ? resource.layout:"right" |
— | — | @@ -384,6 +401,8 @@ |
385 | 402 | |
386 | 403 | /** |
387 | 404 | * Updates / normalizes the target_resource_title |
| 405 | + * |
| 406 | + * @parma {Object} resource Resource to update title on. |
388 | 407 | */ |
389 | 408 | updateTargetResourceTitle:function( resource ) { |
390 | 409 | resource.target_resource_title = resource.titleKey.replace( /^(File:|Image:)/ , '' ); |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | } |
30 | 30 | }, |
31 | 31 | /** |
32 | | - * Gets the search results from the api query |
| 32 | + * Get search results from the api query |
33 | 33 | */ |
34 | 34 | getSearchResults:function() { |
35 | 35 | // call parent: |
— | — | @@ -95,7 +95,7 @@ |
96 | 96 | } |
97 | 97 | }, |
98 | 98 | /** |
99 | | - * Gets some media metadata via a archive.org special entry point "avinfo" |
| 99 | + * Get media metadata via a archive.org special entry point "avinfo" |
100 | 100 | */ |
101 | 101 | addResourceInfoCallback:function( resource, callback ) { |
102 | 102 | var _this = this; |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/flickrSearch.js |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | }, |
48 | 48 | |
49 | 49 | /** |
50 | | - * Gets the Search results setting _loading flag to false once results have been added |
| 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 | 53 | */ |
— | — | @@ -154,7 +154,7 @@ |
155 | 155 | } |
156 | 156 | }, |
157 | 157 | /** |
158 | | - * Gets an image transformation based a SrcTypeKey generated by the requested options |
| 158 | + * Get an image transformation based a SrcTypeKey generated by the requested options |
159 | 159 | * |
160 | 160 | * @param {Object} resource Resource for image transform |
161 | 161 | * @param {Object} options Options for image transform call |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -494,7 +494,8 @@ |
495 | 495 | }, |
496 | 496 | |
497 | 497 | /** |
498 | | - * Gets License Key From a license Url |
| 498 | + * Get license key from a license Url |
| 499 | + * |
499 | 500 | * @param license_url the url of the license |
500 | 501 | */ |
501 | 502 | getLicenseFromUrl: function( license_url ) { |
— | — | @@ -616,7 +617,7 @@ |
617 | 618 | }, |
618 | 619 | |
619 | 620 | /** |
620 | | - * Gets the current position of the text cursor |
| 621 | + * Get the current position of the text cursor |
621 | 622 | */ |
622 | 623 | getCaretPos: function() { |
623 | 624 | if ( this.caretPos == null ) { |
— | — | @@ -630,7 +631,7 @@ |
631 | 632 | }, |
632 | 633 | |
633 | 634 | /** |
634 | | - * Gets the value of the target textbox. |
| 635 | + * Get the value of the target textbox. |
635 | 636 | */ |
636 | 637 | getTextboxValue: function() { |
637 | 638 | if ( this.textboxValue == null ) { |
— | — | @@ -644,7 +645,7 @@ |
645 | 646 | }, |
646 | 647 | |
647 | 648 | /* |
648 | | - * Gets the default query from the text selection |
| 649 | + * Get the default query from the text selection |
649 | 650 | */ |
650 | 651 | getDefaultQuery: function() { |
651 | 652 | if ( this.default_query == null ) { |
— | — | @@ -1036,7 +1037,7 @@ |
1037 | 1038 | }, |
1038 | 1039 | |
1039 | 1040 | /** |
1040 | | - * Gets the search results for a given content provider |
| 1041 | + * Get the search results for a given content provider |
1041 | 1042 | * |
1042 | 1043 | * Sets up binding to showResults once search providers results are ready |
1043 | 1044 | * |
— | — | @@ -1305,7 +1306,7 @@ |
1306 | 1307 | |
1307 | 1308 | // Check for missing poster types for audio |
1308 | 1309 | if ( resource.mime == 'audio/ogg' && !resource.poster ) { |
1309 | | - resource.poster = mv_skin_img_path + 'sound_music_icon-80.png'; |
| 1310 | + resource.poster = mw.getConfig( 'skin_img_path' ) + 'sound_music_icon-80.png'; |
1310 | 1311 | } |
1311 | 1312 | |
1312 | 1313 | // Get a thumb with proper resolution transform if possible: |
— | — | @@ -1444,7 +1445,7 @@ |
1445 | 1446 | }, |
1446 | 1447 | |
1447 | 1448 | /** |
1448 | | - * Gets the media Type of a resource |
| 1449 | + * Get the media Type of a resource |
1449 | 1450 | * |
1450 | 1451 | * @param {Object} resource get media type of resource |
1451 | 1452 | */ |
— | — | @@ -2228,8 +2229,9 @@ |
2229 | 2230 | ); |
2230 | 2231 | } ); |
2231 | 2232 | }, |
| 2233 | + |
2232 | 2234 | /** |
2233 | | - * Gets the embed code |
| 2235 | + * Get the embed code |
2234 | 2236 | * |
2235 | 2237 | * based on import_url_mode: |
2236 | 2238 | * calls the resource providers getEmbedHTML method |
— | — | @@ -2378,10 +2380,10 @@ |
2379 | 2381 | */ |
2380 | 2382 | showResultsHeader: function() { |
2381 | 2383 | var _this = this; |
2382 | | - var darkBoxUrl = mv_skin_img_path + 'box_layout_icon_dark.png'; |
2383 | | - var lightBoxUrl = mv_skin_img_path + 'box_layout_icon.png'; |
2384 | | - var darkListUrl = mv_skin_img_path + 'list_layout_icon_dark.png'; |
2385 | | - var lightListUrl = mv_skin_img_path + 'list_layout_icon.png'; |
| 2384 | + var darkBoxUrl = mw.getConfig( 'skin_img_path' ) + 'box_layout_icon_dark.png'; |
| 2385 | + var lightBoxUrl = mw.getConfig( 'skin_img_path' ) + 'box_layout_icon.png'; |
| 2386 | + var darkListUrl = mw.getConfig( 'skin_img_path' ) + 'list_layout_icon_dark.png'; |
| 2387 | + var lightListUrl = mw.getConfig( 'skin_img_path' ) + 'list_layout_icon.png'; |
2386 | 2388 | |
2387 | 2389 | if ( !this.content_providers[ this.currentProvider ] ) { |
2388 | 2390 | return; |
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/embedPlayer.js |
— | — | @@ -536,7 +536,7 @@ |
537 | 537 | else |
538 | 538 | this.mime_type = this.detectType( this.src ); |
539 | 539 | |
540 | | - this.parseURLDuration(); |
| 540 | + this.getURLDuration(); |
541 | 541 | }, |
542 | 542 | |
543 | 543 | /** |
— | — | @@ -571,7 +571,7 @@ |
572 | 572 | }); |
573 | 573 | |
574 | 574 | // update the duration |
575 | | - this.parseURLDuration(); |
| 575 | + this.getURLDuration(); |
576 | 576 | } |
577 | 577 | }, |
578 | 578 | |
— | — | @@ -652,11 +652,11 @@ |
653 | 653 | |
654 | 654 | /** |
655 | 655 | * |
656 | | - * Gets Duration of the media in milliseconds from the source url. |
| 656 | + * Get Duration of the media in milliseconds from the source url. |
657 | 657 | * |
658 | 658 | * Supports media_url?t=ntp_start/ntp_end url request format |
659 | 659 | */ |
660 | | - parseURLDuration : function() { |
| 660 | + getURLDuration : function() { |
661 | 661 | // check if we have a URLTimeEncoding: |
662 | 662 | if ( this.URLTimeEncoding ) { |
663 | 663 | var annoURL = mw.parseUri( this.src ); |
— | — | @@ -745,13 +745,15 @@ |
746 | 746 | /** |
747 | 747 | * Media Element constructor |
748 | 748 | * |
| 749 | + * Sets up a mediaElement from a provided top level "video" element |
| 750 | + * adds any child sources that are found |
| 751 | + * |
749 | 752 | * @param {Element} video_element Element that has src attribute or has children source elements |
750 | 753 | */ |
751 | 754 | init: function( video_element ) { |
752 | 755 | var _this = this; |
753 | 756 | js_log( 'Initializing mediaElement...' ); |
754 | | - this.sources = new Array(); |
755 | | - this.thumbnail = mv_default_thumb_url; |
| 757 | + this.sources = new Array(); |
756 | 758 | |
757 | 759 | if ( $j( video_element ).attr( 'thumbnail' ) ) |
758 | 760 | this.thumbnail = $j( video_element ).attr( 'thumbnail' ); |
— | — | @@ -759,6 +761,10 @@ |
760 | 762 | if ( $j( video_element ).attr( 'poster' ) ) |
761 | 763 | this.thumbnail = $j( video_element ).attr( 'poster' ); |
762 | 764 | |
| 765 | + // Set by default thumb value if not found |
| 766 | + if( ! this.thumbnail ) |
| 767 | + this.thumbnail = mw.getConfig( 'default_video_thumb' ); |
| 768 | + |
763 | 769 | if ( $j( video_element ).attr( 'wikiTitleKey' ) ) |
764 | 770 | this.wikiTitleKey = $j( video_element ).attr( 'wikiTitleKey' ); |
765 | 771 | |
— | — | @@ -766,7 +772,7 @@ |
767 | 773 | this.durationHint = $j( video_element ).attr( 'durationHint' ); |
768 | 774 | // Convert duration hint if needed: |
769 | 775 | this.duration = npt2seconds( this.durationHint ); |
770 | | - } |
| 776 | + } |
771 | 777 | |
772 | 778 | // Process the video_element as a source element: |
773 | 779 | if ( $j( video_element ).attr( "src" ) ) |
— | — | @@ -989,7 +995,7 @@ |
990 | 996 | }, |
991 | 997 | |
992 | 998 | /** |
993 | | - * Gets playable sources |
| 999 | + * Get playable sources |
994 | 1000 | * |
995 | 1001 | * @returns {Array} of playbale sources |
996 | 1002 | */ |
— | — | @@ -1172,7 +1178,7 @@ |
1173 | 1179 | this.ctrlBuilder = new ctrlBuilder( this ); |
1174 | 1180 | } |
1175 | 1181 | // Load player skin css: |
1176 | | - loadExternalCss( mw.getMwEmbedPath() + 'skins/' + this.skin_name + '/playerSkin.css' ); |
| 1182 | + mw.getStyleSheet( mw.getMwEmbedPath() + 'skins/' + this.skin_name + '/playerSkin.css' ); |
1177 | 1183 | }, |
1178 | 1184 | |
1179 | 1185 | /** |
— | — | @@ -1361,6 +1367,8 @@ |
1362 | 1368 | /** |
1363 | 1369 | * Issue a warning to non-native playback systems |
1364 | 1370 | * that they could improve the playback experience with a different browser |
| 1371 | + * |
| 1372 | + * dependent on media_element being setup |
1365 | 1373 | */ |
1366 | 1374 | doNativeWarningCheck: function( ) { |
1367 | 1375 | if ( $j.cookie( 'dismissNativeWarn' ) && $j.cookie( 'dismissNativeWarn' ) === true ) { |
— | — | @@ -1393,7 +1401,7 @@ |
1394 | 1402 | }, |
1395 | 1403 | |
1396 | 1404 | /** |
1397 | | - * Gets a Time range from the media start and end time |
| 1405 | + * Get a time range from the media start and end time |
1398 | 1406 | * |
1399 | 1407 | * @return start_npt and end_npt time if present |
1400 | 1408 | */ |
— | — | @@ -1408,8 +1416,9 @@ |
1409 | 1417 | return default_time_range; |
1410 | 1418 | return this.media_element.selected_source.start_npt + this.media_element.selected_source.end_npt; |
1411 | 1419 | }, |
| 1420 | + |
1412 | 1421 | /** |
1413 | | - * Gets the duration of the embed media |
| 1422 | + * Get the duration of the selected source media |
1414 | 1423 | */ |
1415 | 1424 | getDuration:function() { |
1416 | 1425 | // Update some local pointers for the selected source: |
— | — | @@ -1670,8 +1679,8 @@ |
1671 | 1680 | }, |
1672 | 1681 | |
1673 | 1682 | /** |
1674 | | - * Gets nearby Clip links |
1675 | | - * Mostly metavid specific ( should be factored into a seperate module ) |
| 1683 | + * Get nearby Clip links |
| 1684 | + * Mostly metavid specific ( should be factored into a separate module ) |
1676 | 1685 | */ |
1677 | 1686 | getNearbyClipLinks:function() { |
1678 | 1687 | js_log( 'f:getNextPrevLinks' ); |
— | — | @@ -2282,7 +2291,7 @@ |
2283 | 2292 | var playable = embedTypes.players.defaultPlayer( source.getMIMEType() ); |
2284 | 2293 | |
2285 | 2294 | var is_selected = ( source == _this.media_element.selected_source ); |
2286 | | - var image_src = mv_skin_img_path ; |
| 2295 | + var image_src = mw.getConfig( 'skin_img_path' ) ; |
2287 | 2296 | |
2288 | 2297 | o += '<h2>' + source.getTitle() + '</h2>'; |
2289 | 2298 | |
— | — | @@ -2761,7 +2770,7 @@ |
2762 | 2771 | */ |
2763 | 2772 | |
2764 | 2773 | /** |
2765 | | - * Gets the current selected media source |
| 2774 | + * Get the current selected media source |
2766 | 2775 | * |
2767 | 2776 | * @return src url |
2768 | 2777 | */ |
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/javaEmbed.js |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | }, |
36 | 36 | |
37 | 37 | /** |
38 | | - * Gets the embed html code: |
| 38 | + * Get the embed html code: |
39 | 39 | */ |
40 | 40 | getEmbedObj: function() { |
41 | 41 | js_log( "java play url:" + this.getSrc( this.seek_time_sec ) ); |
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/htmlEmbed.js |
— | — | @@ -186,15 +186,17 @@ |
187 | 187 | return $j( '#' + thumb_render_id ).html(); |
188 | 188 | }, |
189 | 189 | /* |
190 | | - * updates the ThumbTime |
191 | | - * (does nothings since we display a single renderd html page) |
| 190 | + * Updates the thumb time |
| 191 | + * (does nothings since we display a single frame renderd html page) |
| 192 | + * |
| 193 | + * @param {Float} float_time Ignored |
192 | 194 | */ |
193 | 195 | updateThumbTime:function( float_time ) { |
194 | 196 | return ; |
195 | 197 | }, |
196 | 198 | |
197 | 199 | /** |
198 | | - * gets the "embed" html for the html player |
| 200 | + * Get the "embed" html for the html player |
199 | 201 | */ |
200 | 202 | getEmbedHTML:function() { |
201 | 203 | js_log( 'f:html:getEmbedHTML: ' + this.id ); |
— | — | @@ -211,7 +213,7 @@ |
212 | 214 | }, |
213 | 215 | |
214 | 216 | /** |
215 | | - * gets the ThumbnailHTML |
| 217 | + * Get the ThumbnailHTML |
216 | 218 | * ThumbnailHTML is used for both the "paused and playing states of the htmlEmbed player |
217 | 219 | */ |
218 | 220 | getThumbnailHTML:function( opt ) { |
— | — | @@ -248,7 +250,7 @@ |
249 | 251 | }, |
250 | 252 | |
251 | 253 | /** |
252 | | - * Gets the media duration |
| 254 | + * Get the media duration |
253 | 255 | */ |
254 | 256 | getDuration:function() { |
255 | 257 | if( !this.duration ){ |
— | — | @@ -263,6 +265,7 @@ |
264 | 266 | |
265 | 267 | /** |
266 | 268 | * Updates the Video time |
| 269 | + * |
267 | 270 | * @param {String} start_npt Start time for update |
268 | 271 | * @param {String} end_npt End time for update |
269 | 272 | */ |
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvPlayList.js |
— | — | @@ -918,8 +918,11 @@ |
919 | 919 | } |
920 | 920 | return 0; |
921 | 921 | }, |
922 | | - // gets playlist controls large control height for sporting |
923 | | - // next prev button and more status display |
| 922 | + |
| 923 | + /** |
| 924 | + * Gets playlist controls large control height for sporting |
| 925 | + * next prev button and more status display |
| 926 | + */ |
924 | 927 | getControlsHTML:function() { |
925 | 928 | // get controls from current clip (add some playlist specific controls: |
926 | 929 | return this.ctrlBuilder.getControls( this ); |
— | — | @@ -1061,11 +1064,11 @@ |
1062 | 1065 | js_log( 'getPL cont' ); |
1063 | 1066 | return '<a id="mv_prev_link_' + this.id + '" title="Previus Clip" onclick="document.getElementById(\'' + this.id + '\').playPrev();return false;" href="#">' + |
1064 | 1067 | getTransparentPng( { id:'mv_prev_btn_' + this.id, style:'float:left', width:'27', height:'27', border:"0", |
1065 | | - src:mv_skin_img_path + 'vid_prev_sm.png' } ) + |
| 1068 | + src: mw.getConfig( 'skin_img_path' ) + 'vid_prev_sm.png' } ) + |
1066 | 1069 | '</a>' + |
1067 | 1070 | '<a id="mv_next_link_' + this.id + '" title="Next Clip" onclick="document.getElementById(\'' + this.id + '\').playNext();return false;" href="#">' + |
1068 | 1071 | getTransparentPng( { id:'mv_next_btn_' + this.id, style:'float:left', width:'27', height:'27', border:"0", |
1069 | | - src:mv_skin_img_path + 'vid_next_sm.png' } ) + |
| 1072 | + src: mw.getConfig( 'skin_img_path' ) + 'vid_next_sm.png' } ) + |
1070 | 1073 | '</a>'; |
1071 | 1074 | }, |
1072 | 1075 | run_transition: function( clip_inx, trans_type ) { |
— | — | @@ -2142,7 +2145,7 @@ |
2143 | 2146 | return this.dur; |
2144 | 2147 | return this.embed.getDuration(); |
2145 | 2148 | }, |
2146 | | - // gets the duration of the clip subracting transitions |
| 2149 | + // Get the duration of the clip subracting transitions |
2147 | 2150 | getSoloDuration:function() { |
2148 | 2151 | var fulldur = this.getDuration(); |
2149 | 2152 | // see if we need to subtract from time eating transitions (transOut) |
— | — | @@ -2152,7 +2155,7 @@ |
2153 | 2156 | // js_log("getSoloDuration:: td: " + this.getDuration() + ' sd:' + fulldur); |
2154 | 2157 | return fulldur; |
2155 | 2158 | }, |
2156 | | - // gets the duration of the original media asset (usefull for bounding setting of in-out-points) |
| 2159 | + // Get the duration of the original media asset (usefull for bounding setting of in-out-points) |
2157 | 2160 | getSourceDuration:function() { |
2158 | 2161 | if ( this.durationHint ) |
2159 | 2162 | return this.durationHint; |
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvTimedEffectsEdit.js |
— | — | @@ -132,7 +132,7 @@ |
133 | 133 | loadExternalJs( mw.getMwEmbedPath() + 'libClipEdit/pixastic-editor/pixastic.all.js?' + getMwReqParam() ); |
134 | 134 | loadExternalJs( mw.getMwEmbedPath() + 'libClipEdit/pixastic-editor/ui.js?' + getMwReqParam() ); |
135 | 135 | loadExternalJs( mw.getMwEmbedPath() + 'libClipEdit/pixastic-editor/uidata.js?' + getMwReqParam() ); |
136 | | - loadExternalCss( mw.getMwEmbedPath() + 'libClipEdit/pixastic-editor/pixastic.all.js?' + getMwReqParam() ); |
| 136 | + mw.getStyleSheet( mw.getMwEmbedPath() + 'libClipEdit/pixastic-editor/pixastic.all.js?' + getMwReqParam() ); |
137 | 137 | |
138 | 138 | var isPixasticReady = function() { |
139 | 139 | if ( typeof PixasticEditor != 'undefined' ) { |
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvSequencer.js |
— | — | @@ -670,11 +670,12 @@ |
671 | 671 | getSeqOutputJSON:function() { |
672 | 672 | js_log( 'json output:' ); |
673 | 673 | }, |
674 | | - /* |
675 | | - * Gets the Sequence as a formated high level resource description xml string |
| 674 | + |
| 675 | + /** |
| 676 | + * Get the Sequence as a formated high level resource description xml string |
676 | 677 | * @returns {xml} |
677 | 678 | */ |
678 | | - getSeqOutputHLRDXML:function() { |
| 679 | + getSeqOutputHLRDXML: function() { |
679 | 680 | var o = '<sequence_hlrd>' + "\n"; |
680 | 681 | o += "\t<head>\n"; |
681 | 682 | // Get transitions |
Index: branches/js2-work/phase3/js2/mwEmbed/libClipEdit/mvClipEdit.js |
— | — | @@ -126,9 +126,9 @@ |
127 | 127 | } |
128 | 128 | } |
129 | 129 | }, |
| 130 | + |
130 | 131 | /** |
131 | | - * Gets the mediatype for the current resource |
132 | | - * |
| 132 | + * Get the mediatype for the current resource |
133 | 133 | */ |
134 | 134 | getMediaType: function (){ |
135 | 135 | if( this.media_type ) |
— | — | @@ -593,7 +593,7 @@ |
594 | 594 | * |
595 | 595 | * @param {Object} defaultTime Provides start and end time default values |
596 | 596 | */ |
597 | | - getStartEndHtml:function( defaultTime ) { |
| 597 | + getStartEndHtml: function( defaultTime ) { |
598 | 598 | return '<strong>' + gM( 'mwe-set_in_out_points' ) + '</strong>' + |
599 | 599 | '<table border="0" style="background: transparent; width:94%;height:50px;">' + |
600 | 600 | '<tr>' + |
— | — | @@ -614,9 +614,9 @@ |
615 | 615 | }, |
616 | 616 | |
617 | 617 | /** |
618 | | - * Gets the Insert Html |
| 618 | + * Get the Insert Html form text area |
619 | 619 | */ |
620 | | - getInsertHtml:function() { |
| 620 | + getInsertHtml: function() { |
621 | 621 | var o = '<h3>' + gM( 'mwe-inline-description' ) + '</h3>' + |
622 | 622 | '<textarea style="width:95%" id="mv_inline_img_desc" rows="5" cols="30">'; |
623 | 623 | if ( this.parentRemoteSearchDriver ) { |
— | — | @@ -633,7 +633,7 @@ |
634 | 634 | * |
635 | 635 | * Loops over the local controlActionsCallback |
636 | 636 | */ |
637 | | - updateInsertControlActions:function() { |
| 637 | + updateInsertControlActions: function() { |
638 | 638 | var _this = this; |
639 | 639 | var b_target = _this.parentRemoteSearchDriver.target_container + '~ .ui-dialog-buttonpane'; |
640 | 640 | // Empty the ui-dialog-buttonpane bar: |
Index: branches/js2-work/phase3/js2/mwEmbed/libMwApi/mw.proxy.js |
— | — | @@ -44,6 +44,7 @@ |
45 | 45 | } ); |
46 | 46 | |
47 | 47 | ( function( $ ) { |
| 48 | + |
48 | 49 | /** |
49 | 50 | * Base API Proxy object |
50 | 51 | * |
— | — | @@ -53,14 +54,14 @@ |
54 | 55 | /** |
55 | 56 | * The client setup function: |
56 | 57 | */ |
57 | | - $.proxy.client = function( pConf, conf ) { |
| 58 | + $.proxy.client = function( proxyConfig, conf ) { |
58 | 59 | var _this = this; |
59 | 60 | // Do client setup: |
60 | | - if ( pConf.server_frame ) |
61 | | - $.proxy.server_frame = pConf.server_frame; |
| 61 | + if ( proxyConfig.server_frame ) |
| 62 | + $.proxy.server_frame = proxyConfig.server_frame; |
62 | 63 | |
63 | | - if ( pConf.client_frame_path ) { |
64 | | - $.proxy.client_frame_path = pConf.client_frame_path; |
| 64 | + if ( proxyConfig.client_frame_path ) { |
| 65 | + $.proxy.client_frame_path = proxyConfig.client_frame_path; |
65 | 66 | } else { |
66 | 67 | // Set to default mwEmbed iframe path: |
67 | 68 | $.proxy.client_frame_path = wgScriptPath + '/js2/mwEmbed/libMwApi/NestedCallbackIframe.html'; |
— | — | @@ -176,7 +177,7 @@ |
177 | 178 | * |
178 | 179 | * This is (Domain B) in the above described setup |
179 | 180 | */ |
180 | | - $.proxy.server = function( pConf, callback ) { |
| 181 | + $.proxy.server = function( proxyConfig, callback ) { |
181 | 182 | /* clear the body of any html */ |
182 | 183 | $j( 'body' ).html( 'proxy setup' ); |
183 | 184 | |
— | — | @@ -206,15 +207,15 @@ |
207 | 208 | var domain = aObj.cd; |
208 | 209 | var nested_frame_src = 'http://' + aObj.cd + aObj.cfp; |
209 | 210 | // Check the master whitelist |
210 | | - for ( var i in pConf.master_whitelist ) { |
211 | | - if ( domain == pConf.master_whitelist[ i ] ) { |
| 211 | + for ( var i in proxyConfig.master_whitelist ) { |
| 212 | + if ( domain == proxyConfig.master_whitelist[ i ] ) { |
212 | 213 | // Do the request: |
213 | 214 | return doNestedProxy( aObj.req ); |
214 | 215 | } |
215 | 216 | } |
216 | 217 | // Check master blacklist |
217 | | - for ( var i in pConf.master_blacklist ) { |
218 | | - if ( domain == pConf.master_blacklist ) { |
| 218 | + for ( var i in proxyConfig.master_blacklist ) { |
| 219 | + if ( domain == proxyConfig.master_blacklist ) { |
219 | 220 | js_log( 'domain: ' + domain + ' is blacklisted' ); |
220 | 221 | return false; |
221 | 222 | } |
Index: branches/js2-work/phase3/js2/mwEmbed/skins/ctrlBuilder.js |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | }, |
61 | 61 | |
62 | 62 | /** |
63 | | - * Gets the controls html |
| 63 | + * Get the controls html |
64 | 64 | * @return {String} html output of controls |
65 | 65 | */ |
66 | 66 | getControls:function() { |
— | — | @@ -338,7 +338,7 @@ |
339 | 339 | }, |
340 | 340 | |
341 | 341 | /** |
342 | | - * Gets the Buffer Html that overlays the playhead |
| 342 | + * Get the Buffer Html that overlays the playhead |
343 | 343 | */ |
344 | 344 | getBufferHtml:function() { |
345 | 345 | return '<div class="ui-slider-range ui-slider-range-min ui-widget-header ' + |
— | — | @@ -347,7 +347,7 @@ |
348 | 348 | }, |
349 | 349 | |
350 | 350 | /** |
351 | | - * Accessor to get a given local component |
| 351 | + * Accessor to get component |
352 | 352 | * |
353 | 353 | * @param {String} compoent Component key to grab html output |
354 | 354 | */ |
Index: branches/js2-work/phase3/js2/mwEmbed/mwEmbed.js |
— | — | @@ -17,48 +17,6 @@ |
18 | 18 | * |
19 | 19 | */ |
20 | 20 | |
21 | | -/** |
22 | | - * AutoLoader paths |
23 | | - * @path The path to the file (or set of files) with ending slash |
24 | | - * @gClasses The set of classes |
25 | | - * if it's an array, $j.className becomes jquery.className.js |
26 | | - * if it's an associative object then key => value pairs are used |
27 | | - */ |
28 | | -if ( typeof mvAutoLoadClasses == 'undefined' ) |
29 | | - mvAutoLoadClasses = { }; |
30 | | - |
31 | | -// The script that loads the class set |
32 | | -function lcPaths( classSet ) { |
33 | | - for ( var i in classSet ) { |
34 | | - mvAutoLoadClasses[i] = classSet[i]; |
35 | | - } |
36 | | -} |
37 | | - |
38 | | -function mvGetClassPath( k ) { |
39 | | - if ( mvAutoLoadClasses[k] ) { |
40 | | - // js_log('got class path:' + k + ' : '+ mvClassPaths[k]); |
41 | | - return mvAutoLoadClasses[k]; |
42 | | - } else { |
43 | | - js_log( 'Error:: Could not find path for requested class ' + k ); |
44 | | - return false; |
45 | | - } |
46 | | -} |
47 | | - |
48 | | -if ( typeof mvCssPaths == 'undefined' ) |
49 | | - mvCssPaths = { }; |
50 | | - |
51 | | -function lcCssPath( cssSet ) { |
52 | | - for ( var i in cssSet ) { |
53 | | - mvCssPaths[i] = cssSet[i]; |
54 | | - } |
55 | | -} |
56 | | - |
57 | | -// Dependency mapping for CSS files for self-contained included plugins: |
58 | | -lcCssPath( { |
59 | | - '$j.Jcrop' : 'libClipEdit/Jcrop/css/jquery.Jcrop.css', |
60 | | - '$j.fn.ColorPicker' : 'libClipEdit/colorpicker/css/colorpicker.css' |
61 | | -}) |
62 | | - |
63 | 21 | // The global scope: will be depreciated once we get everything into mw |
64 | 22 | var _global = this; |
65 | 23 | |
— | — | @@ -685,7 +643,7 @@ |
686 | 644 | /** |
687 | 645 | * templates |
688 | 646 | * |
689 | | - * gets a requested template from the wikitext (if available) |
| 647 | + * Get a requested template from the wikitext (if available) |
690 | 648 | * |
691 | 649 | */ |
692 | 650 | templates: function( tname ) { |
— | — | @@ -773,20 +731,28 @@ |
774 | 732 | */ |
775 | 733 | $.loader = { |
776 | 734 | /* |
777 | | - * Javascript Module Set |
| 735 | + * Javascript Module Loader functions |
778 | 736 | * @key Name of Module |
779 | 737 | * @value function code to load module |
780 | 738 | */ |
781 | | - moduleNames : { }, |
| 739 | + moduleLoaders : { }, |
782 | 740 | |
783 | 741 | /** |
784 | | - * Javascript Class Names |
| 742 | + * Javascript Class Paths |
785 | 743 | * @key Name of class |
786 | 744 | * @value Class file path |
787 | 745 | */ |
788 | | - classNames : { }, |
| 746 | + classPaths : { }, |
789 | 747 | |
790 | 748 | /** |
| 749 | + * Style sheet paths for aossicated classes |
| 750 | + * @key Name of the class |
| 751 | + * @value Style sheet path |
| 752 | + */ |
| 753 | + stylePaths : { }, |
| 754 | + |
| 755 | + |
| 756 | + /** |
791 | 757 | * Load a set of scripts. |
792 | 758 | * Will issue many load requests or package the request for the script-loader |
793 | 759 | * |
— | — | @@ -883,16 +849,16 @@ |
884 | 850 | } |
885 | 851 | |
886 | 852 | // Check for the module name loader function |
887 | | - if( this.moduleNames[ loadRequest ] && |
888 | | - typeof ( this.moduleNames[ loadRequest ] ) == 'function' |
| 853 | + if( this.moduleLoaders[ loadRequest ] && |
| 854 | + typeof ( this.moduleLoaders[ loadRequest ] ) == 'function' |
889 | 855 | ){ |
890 | 856 | //Run the module with the parent callback |
891 | | - this.moduleNames[ loadRequest ]( callback ); |
| 857 | + this.moduleLoaders[ loadRequest ]( callback ); |
892 | 858 | return ; |
893 | 859 | } |
894 | 860 | |
895 | 861 | // Check for javascript class |
896 | | - if( this.classNames[ loadRequest ] ){ |
| 862 | + if( this.classPaths[ loadRequest ] ){ |
897 | 863 | this.loadClass( loadRequest, callback ); |
898 | 864 | return ; |
899 | 865 | } |
— | — | @@ -923,11 +889,13 @@ |
924 | 890 | } |
925 | 891 | |
926 | 892 | // Get the class url: |
927 | | - var baseClassPath = this.classNames[ className ]; |
| 893 | + var baseClassPath = this.classPaths[ className ]; |
928 | 894 | |
929 | 895 | var url = null; |
930 | | - // Load the mwEmbed path ( if not a root dir url ) |
931 | | - if( baseClassPath.indexOf( '/' ) !== 0 ){ |
| 896 | + |
| 897 | + // Add the mwEmbed path if not a root path or a full url |
| 898 | + if( baseClassPath.indexOf( '/' ) !== 0 && |
| 899 | + baseClassPath.indexOf('://') === -1 ){ |
932 | 900 | url = $.getMwEmbedPath() + baseClassPath; |
933 | 901 | }else{ |
934 | 902 | url = baseClassPath; |
— | — | @@ -936,8 +904,13 @@ |
937 | 905 | if( ! url ){ |
938 | 906 | js_log( "Could not get url for class " + className ); |
939 | 907 | return ; |
940 | | - } |
941 | | - |
| 908 | + } |
| 909 | + |
| 910 | + // Check for any associated style sheets that should be loaded |
| 911 | + if( typeof this.stylePaths[ className ] != 'undefined' ){ |
| 912 | + $.getStyleSheet( this.stylePaths[ className ] ); |
| 913 | + } |
| 914 | + |
942 | 915 | // Issue the request to load the class (include class name in result callback: |
943 | 916 | $.getScript( url, function( ) { |
944 | 917 | callback( className ); |
— | — | @@ -953,7 +926,7 @@ |
954 | 927 | * loads dependencies for a module |
955 | 928 | */ |
956 | 929 | addModuleLoader: function( name, moduleLoader ){ |
957 | | - this.moduleNames [ name ] = moduleLoader; |
| 930 | + this.moduleLoaders [ name ] = moduleLoader; |
958 | 931 | }, |
959 | 932 | |
960 | 933 | /** |
— | — | @@ -967,8 +940,20 @@ |
968 | 941 | */ |
969 | 942 | addClassFilePaths: function( classSet ){ |
970 | 943 | for( var i in classSet ){ |
971 | | - this.classNames[ i ] = classSet[ i ]; |
| 944 | + this.classPaths[ i ] = classSet[ i ]; |
972 | 945 | } |
| 946 | + }, |
| 947 | + |
| 948 | + /** |
| 949 | + * Add a style sheet to be loaded the same time as the requested class |
| 950 | + * |
| 951 | + * NOTE: In general style sheets should be loaded via a module loader function. |
| 952 | + * In some cases a single class has a single sheet that can use this function |
| 953 | + */ |
| 954 | + addClassStyleSheets: function( sheetSet ){ |
| 955 | + for(var i in sheetSet ){ |
| 956 | + this.stylePaths[ i ] = sheetSet[ i ]; |
| 957 | + } |
973 | 958 | } |
974 | 959 | } |
975 | 960 | |
— | — | @@ -999,6 +984,12 @@ |
1000 | 985 | return $.loader.addClassFilePaths( classSet ); |
1001 | 986 | } |
1002 | 987 | |
| 988 | + /** |
| 989 | + * Add Class Style Sheet entry point: |
| 990 | + */ |
| 991 | + $.addClassStyleSheets = function( sheetSet ){ |
| 992 | + return $.loader.addClassStyleSheets( sheetSet ); |
| 993 | + } |
1003 | 994 | |
1004 | 995 | /** |
1005 | 996 | * Utility Functions |
— | — | @@ -1092,14 +1083,14 @@ |
1093 | 1084 | _global['$j'] = jQuery.noConflict(); |
1094 | 1085 | } |
1095 | 1086 | |
1096 | | - // Set up the skin paths |
1097 | | - _global['mv_jquery_skin_path'] = mw.getMwEmbedPath() + 'jquery/jquery.ui/themes/' + mw.getConfig( 'jui_skin' ) + '/'; |
1098 | | - _global['mv_skin_img_path'] = mw.getMwEmbedPath() + 'skins/' + mw.getConfig( 'skin_name' ) + '/images/'; |
1099 | | - _global['mv_default_thumb_url'] = mv_skin_img_path + 'vid_default_thumb.jpg'; |
| 1087 | + // Set up the skin paths configuration |
| 1088 | + $.setConfig( 'jquery_skin_path', mw.getMwEmbedPath() + 'jquery/jquery.ui/themes/' + mw.getConfig( 'jui_skin' ) + '/' ); |
| 1089 | + $.setConfig( 'skin_img_path', mw.getMwEmbedPath() + 'skins/' + mw.getConfig( 'skin_name' ) + '/images/' ); |
| 1090 | + $.setConfig( 'default_video_thumb', mw.getConfig( 'skin_img_path' ) + 'vid_default_thumb.jpg' ); |
1100 | 1091 | |
1101 | 1092 | // Make Core skin/style sheets are always available: |
1102 | | - loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' ); |
1103 | | - loadExternalCss( mw.getMwEmbedPath() + 'skins/' + mw.getConfig( 'skin_name' ) + '/styles.css' ); |
| 1093 | + mw.getStyleSheet( mw.getConfig( 'jquery_skin_path' ) + 'jquery-ui-1.7.1.custom.css' ); |
| 1094 | + mw.getStyleSheet( mw.getMwEmbedPath() + 'skins/' + mw.getConfig( 'skin_name' ) + '/styles.css' ); |
1104 | 1095 | |
1105 | 1096 | // Set up AJAX to not send dynamic URLs for loading scripts |
1106 | 1097 | $j.ajaxSetup( { |
— | — | @@ -1184,7 +1175,7 @@ |
1185 | 1176 | return false; |
1186 | 1177 | } |
1187 | 1178 | /** |
1188 | | - * Gets page elements that match the rewritePlayerTags config |
| 1179 | + * Get page elements that match the rewritePlayerTags config |
1189 | 1180 | * |
1190 | 1181 | * @param {Boolean} getOne Flag to retive only one tag ( faster for simple has tag checks ) |
1191 | 1182 | */ |
— | — | @@ -1231,7 +1222,12 @@ |
1232 | 1223 | return ; |
1233 | 1224 | } |
1234 | 1225 | |
1235 | | - // No jQuery or we want a script instead of XHR eval for debugging |
| 1226 | + /** |
| 1227 | + * No jQuery |
| 1228 | + * OR |
| 1229 | + * In debug mode inject the script instead of doing an ajax request and eval |
| 1230 | + */ |
| 1231 | + |
1236 | 1232 | // Load and bind manually: ( copied from jQuery ajax function ) |
1237 | 1233 | var head = document.getElementsByTagName("head")[0]; |
1238 | 1234 | var script = document.createElement("script"); |
— | — | @@ -1246,10 +1242,54 @@ |
1247 | 1243 | callback(); |
1248 | 1244 | } |
1249 | 1245 | }; |
| 1246 | + |
1250 | 1247 | // Append the script to the DOM: |
1251 | 1248 | head.appendChild( script ); |
1252 | 1249 | } |
1253 | 1250 | |
| 1251 | + /** |
| 1252 | + * "Get" a style sheet. |
| 1253 | + * |
| 1254 | + * Appends a style sheet to the DOM is called "getStyleSheet" to mirror wraping of jqueries getScript |
| 1255 | + * |
| 1256 | + * @param {Mixed} |
| 1257 | + * {Array} url List of urls to be loaded |
| 1258 | + * {String} url Url of the style sheet to be loaded |
| 1259 | + */ |
| 1260 | + $.getStyleSheet = function( url ) { |
| 1261 | + if ( typeof url == 'object' ) { |
| 1262 | + for ( var i in url ) { |
| 1263 | + $.getStyleSheet( url[i] ); |
| 1264 | + } |
| 1265 | + return ; |
| 1266 | + } |
| 1267 | + |
| 1268 | + // Add URL params ( if not already included ) |
| 1269 | + if ( url.indexOf( '?' ) == -1 ) { |
| 1270 | + url += '?' + mw.getUrlParam(); |
| 1271 | + } |
| 1272 | + |
| 1273 | + // Return if style sheet is already included: |
| 1274 | + var foundSheet = false; |
| 1275 | + $j( 'link' ).each( function(){ |
| 1276 | + if( $j( this) .attr( 'href' ) == url ) |
| 1277 | + foundSheet = true; |
| 1278 | + } ); |
| 1279 | + if( foundSheet ){ |
| 1280 | + js_log( 'sheet: ' + url + ' already included ' ); |
| 1281 | + return ; |
| 1282 | + } |
| 1283 | + |
| 1284 | + js_log( ' add css: ' + url ); |
| 1285 | + $j( 'head' ).append( |
| 1286 | + $j('<link>').attr( { |
| 1287 | + 'rel' : 'stylesheet', |
| 1288 | + 'type' : 'text/css', |
| 1289 | + 'href' : url |
| 1290 | + } ) |
| 1291 | + ); |
| 1292 | + } |
| 1293 | + |
1254 | 1294 | /** |
1255 | 1295 | * Get Api URL from mediaWiki output page defined variables |
1256 | 1296 | */ |
— | — | @@ -1264,8 +1304,8 @@ |
1265 | 1305 | var mwEmbedPath = null; |
1266 | 1306 | |
1267 | 1307 | /** |
1268 | | - * Gets the path to the mwEmbed folder |
1269 | | - */ |
| 1308 | + * Gets the path to the mwEmbed folder |
| 1309 | + */ |
1270 | 1310 | $.getMwEmbedPath = function() { |
1271 | 1311 | if ( mwEmbedPath ) |
1272 | 1312 | return mwEmbedPath; |
— | — | @@ -1568,6 +1608,14 @@ |
1569 | 1609 | |
1570 | 1610 | } ); |
1571 | 1611 | |
| 1612 | +/* |
| 1613 | +* Adds style sheets to be loaded with particular classes |
| 1614 | +*/ |
| 1615 | +mw.addClassStyleSheets( { |
| 1616 | + '$j.Jcrop' : 'libClipEdit/Jcrop/css/jquery.Jcrop.css', |
| 1617 | + '$j.fn.ColorPicker' : 'libClipEdit/colorpicker/css/colorpicker.css' |
| 1618 | +}) |
| 1619 | + |
1572 | 1620 | /** |
1573 | 1621 | * libEmbedPlayer Dependency Module Loader: |
1574 | 1622 | * |
— | — | @@ -1760,7 +1808,7 @@ |
1761 | 1809 | // Do a check for any CSS we may need and get it |
1762 | 1810 | for ( var i = 0; i < loadLibs.length; i++ ) { |
1763 | 1811 | if ( typeof mvCssPaths[ loadLibs[i] ] != 'undefined' ) { |
1764 | | - loadExternalCss( mw.getMwEmbedPath() + mvCssPaths[ loadLibs[i] ] ); |
| 1812 | + mw.getStyleSheet( mw.getMwEmbedPath() + mvCssPaths[ loadLibs[i] ] ); |
1765 | 1813 | } |
1766 | 1814 | } |
1767 | 1815 | |
— | — | @@ -2063,8 +2111,8 @@ |
2064 | 2112 | } |
2065 | 2113 | |
2066 | 2114 | // Load the mwEmbed_base skin: |
2067 | | - loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' ); |
2068 | | - loadExternalCss( mw.getMwEmbedPath() + 'skins/' + mw.getConfig( 'skin_name' ) + '/styles.css' ); |
| 2115 | + mw.getStyleSheet( mw.getConfig( 'jquery_skin_path' ) + 'jquery-ui-1.7.1.custom.css' ); |
| 2116 | + mw.getStyleSheet( mw.getMwEmbedPath() + 'skins/' + mw.getConfig( 'skin_name' ) + '/styles.css' ); |
2069 | 2117 | // Load all the required libs: |
2070 | 2118 | mw.load( [ |
2071 | 2119 | [ 'remoteSearchDriver', |
— | — | @@ -2094,8 +2142,8 @@ |
2095 | 2143 | // Debugger |
2096 | 2144 | options['target_sequence_container'] = this.selector; |
2097 | 2145 | // Issue a request to get the CSS file (if not already included): |
2098 | | - loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' ); |
2099 | | - loadExternalCss( mw.getMwEmbedPath() + 'skins/' + mw.getConfig( 'skin_name' ) + '/mv_sequence.css' ); |
| 2146 | + mw.getStyleSheet( mw.getConfig( 'jquery_skin_path' ) + 'jquery-ui-1.7.1.custom.css' ); |
| 2147 | + mw.getStyleSheet( mw.getMwEmbedPath() + 'skins/' + mw.getConfig( 'skin_name' ) + '/mv_sequence.css' ); |
2100 | 2148 | // Make sure we have the required mwEmbed libs (they are not loaded when no video |
2101 | 2149 | // element is on the page) |
2102 | 2150 | mvJsLoader.eembedPlayerheck( function() { |
— | — | @@ -2136,27 +2184,28 @@ |
2137 | 2185 | * @@note This Firefogg invocation could be made to work more like real jQuery plugins |
2138 | 2186 | */ |
2139 | 2187 | var queuedFirefoggConf = { }; |
2140 | | - $.fn.firefogg = function( iObj, callback ) { |
2141 | | - if ( !iObj ) |
2142 | | - iObj = { }; |
| 2188 | + $.fn.firefogg = function( options, callback ) { |
| 2189 | + if ( !options ) |
| 2190 | + options = { }; |
| 2191 | + |
2143 | 2192 | // Add the base theme CSS: |
2144 | | - loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' ); |
2145 | | - loadExternalCss( mw.getMwEmbedPath() + 'skins/' + mw.getConfig( 'skin_name' ) + '/styles.css' ); |
| 2193 | + mw.getStyleSheet( mw.getConfig( 'jquery_skin_path' ) + 'jquery-ui-1.7.1.custom.css' ); |
| 2194 | + mw.getStyleSheet( mw.getMwEmbedPath() + 'skins/' + mw.getConfig( 'skin_name' ) + '/styles.css' ); |
2146 | 2195 | |
2147 | 2196 | // Check if we already have Firefogg loaded (the call just updates the element's |
2148 | | - // properties) |
| 2197 | + // properties) |
2149 | 2198 | var sElm = $j( this.selector ).get( 0 ); |
2150 | 2199 | if ( sElm['firefogg'] ) { |
2151 | 2200 | if ( sElm['firefogg'] == 'loading' ) { |
2152 | 2201 | js_log( "Queued firefogg operations ( firefogg " + |
2153 | 2202 | "not done loading ) " ); |
2154 | | - $j.extend( queuedFirefoggConf, iObj ); |
| 2203 | + $j.extend( queuedFirefoggConf, options ); |
2155 | 2204 | return false; |
2156 | 2205 | } |
2157 | 2206 | // Update properties |
2158 | | - for ( var i in iObj ) { |
2159 | | - js_log( "firefogg::updated: " + i + ' to ' + iObj[i] ); |
2160 | | - sElm['firefogg'][i] = iObj[i]; |
| 2207 | + for ( var i in options ) { |
| 2208 | + js_log( "firefogg::updated: " + i + ' to ' + options[i] ); |
| 2209 | + sElm['firefogg'][i] = options[i]; |
2161 | 2210 | } |
2162 | 2211 | return sElm['firefogg']; |
2163 | 2212 | } else { |
— | — | @@ -2164,7 +2213,7 @@ |
2165 | 2214 | sElm['firefogg'] = 'loading'; |
2166 | 2215 | } |
2167 | 2216 | // Add the selector |
2168 | | - iObj['selector'] = this.selector; |
| 2217 | + options['selector'] = this.selector; |
2169 | 2218 | |
2170 | 2219 | var loadSet = [ |
2171 | 2220 | [ |
— | — | @@ -2178,7 +2227,7 @@ |
2179 | 2228 | '$j.ui.draggable' |
2180 | 2229 | ] |
2181 | 2230 | ]; |
2182 | | - if ( iObj.encoder_interface ) { |
| 2231 | + if ( options.encoder_interface ) { |
2183 | 2232 | loadSet.push( [ |
2184 | 2233 | 'mvAdvFirefogg', |
2185 | 2234 | '$j.cookie', |
— | — | @@ -2189,17 +2238,17 @@ |
2190 | 2239 | } |
2191 | 2240 | // Make sure we have everything loaded that we need: |
2192 | 2241 | mw.load( loadSet, function() { |
2193 | | - js_log( 'firefogg libs loaded. target select:' + iObj.selector ); |
| 2242 | + js_log( 'firefogg libs loaded. target select:' + options.selector ); |
2194 | 2243 | // Select interface provider based on whether we want to include the |
2195 | 2244 | // encoder interface or not |
2196 | | - if ( iObj.encoder_interface ) { |
2197 | | - var myFogg = new mvAdvFirefogg( iObj ); |
| 2245 | + if ( options.encoder_interface ) { |
| 2246 | + var myFogg = new mvAdvFirefogg( options ); |
2198 | 2247 | } else { |
2199 | | - var myFogg = new mvFirefogg( iObj ); |
| 2248 | + var myFogg = new mvFirefogg( options ); |
2200 | 2249 | } |
2201 | 2250 | if ( myFogg ) { |
2202 | 2251 | myFogg.doRewrite( callback ); |
2203 | | - var selectorElement = $j( iObj.selector ).get( 0 ); |
| 2252 | + var selectorElement = $j( options.selector ).get( 0 ); |
2204 | 2253 | selectorElement['firefogg'] = myFogg; |
2205 | 2254 | |
2206 | 2255 | js_log( 'pre:' + selectorElement['firefogg']['firefogg_form_action'] ) |
— | — | @@ -2210,7 +2259,7 @@ |
2211 | 2260 | } ); |
2212 | 2261 | } |
2213 | 2262 | // Take an input player as the selector and expose basic rendering controls |
2214 | | - $.fn.firefoggRender = function( iObj, callback ) { |
| 2263 | + $.fn.firefoggRender = function( options, callback ) { |
2215 | 2264 | // Check if we already have render loaded then just pass on updates/actions |
2216 | 2265 | var sElm = $j( this.selector ).get( 0 ); |
2217 | 2266 | //add a special attribute to the selector: |
— | — | @@ -2223,20 +2272,20 @@ |
2224 | 2273 | } |
2225 | 2274 | sElm['fogg_render'] = 'loading'; |
2226 | 2275 | // Add the selector |
2227 | | - iObj['player_target'] = this.selector; |
| 2276 | + options['player_target'] = this.selector; |
2228 | 2277 | mw.load( [ |
2229 | 2278 | 'mvBaseUploadInterface', |
2230 | 2279 | 'mvFirefogg', |
2231 | 2280 | 'mvFirefoggRender' |
2232 | 2281 | ], function() { |
2233 | 2282 | // Attach the firefoggRender obj to the selected elm: |
2234 | | - sElm['fogg_render'] = new mvFirefoggRender( iObj ); |
| 2283 | + sElm['fogg_render'] = new mvFirefoggRender( options ); |
2235 | 2284 | if ( callback && typeof callback == 'function' ) |
2236 | 2285 | callback( sElm['fogg_render'] ); |
2237 | 2286 | } ); |
2238 | 2287 | } |
2239 | 2288 | |
2240 | | - $.fn.baseUploadInterface = function( iObj ) { |
| 2289 | + $.fn.baseUploadInterface = function( options ) { |
2241 | 2290 | mw.load( [ |
2242 | 2291 | [ |
2243 | 2292 | 'mvBaseUploadInterface', |
— | — | @@ -2247,7 +2296,7 @@ |
2248 | 2297 | '$j.ui.dialog' |
2249 | 2298 | ] |
2250 | 2299 | ], function() { |
2251 | | - myUp = new mvBaseUploadInterface( iObj ); |
| 2300 | + myUp = new mvBaseUploadInterface( options ); |
2252 | 2301 | myUp.setupForm(); |
2253 | 2302 | } ); |
2254 | 2303 | } |
— | — | @@ -2619,40 +2668,7 @@ |
2620 | 2669 | document.getElementsByTagName( "head" )[0].appendChild( e ); |
2621 | 2670 | // } |
2622 | 2671 | } |
2623 | | -function styleSheetPresent( url ) { |
2624 | | - style_elements = document.getElementsByTagName( 'link' ); |
2625 | | - if ( style_elements.length > 0 ) { |
2626 | | - for ( i = 0; i < style_elements.length; i++ ) { |
2627 | | - if ( style_elements[i].href == url ) |
2628 | | - return true; |
2629 | | - } |
2630 | | - } |
2631 | | - return false; |
2632 | | -} |
2633 | | -function loadExternalCss( url ) { |
2634 | | - // We could have the script loader group these CSS requests. |
2635 | | - // But it's debatable: it may hurt more than it helps with caching and all |
2636 | | - if ( typeof url == 'object' ) { |
2637 | | - for ( var i in url ) { |
2638 | | - loadExternalCss( url[i] ); |
2639 | | - } |
2640 | | - return ; |
2641 | | - } |
2642 | 2672 | |
2643 | | - if ( url.indexOf( '?' ) == -1 ) { |
2644 | | - url += '?' + mw.getUrlParam(); |
2645 | | - } |
2646 | | - if ( !styleSheetPresent( url ) ) { |
2647 | | - js_log( 'load css: ' + url ); |
2648 | | - var e = document.createElement( "link" ); |
2649 | | - e.href = url; |
2650 | | - e.type = "text/css"; |
2651 | | - e.rel = 'stylesheet'; |
2652 | | - document.getElementsByTagName( "head" )[0].appendChild( e ); |
2653 | | - } |
2654 | | -} |
2655 | | - |
2656 | | - |
2657 | 2673 | if ( typeof DOMParser == "undefined" ) { |
2658 | 2674 | DOMParser = function () { } |
2659 | 2675 | DOMParser.prototype.parseFromString = function ( str, contentType ) { |
Index: branches/js2-work/phase3/js2/editPage.js |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | js_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 | | - mv_skin_img_path + 'Button_add_media.png">' ); |
| 57 | + mw.getConfig( 'skin_img_path' ) + 'Button_add_media.png">' ); |
58 | 58 | $j( '#btn-add-media-wiz' ).addMediaWiz( |
59 | 59 | amwConf |
60 | 60 | ); |