r59846 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59845‎ | r59846 | r59847 >
Date:20:21, 8 December 2009
Author:dale
Status:deferred
Tags:
Comment:
* comment updates
* removed autoLoader paths globals
* update some of the loader variable names
* added mw.getStyleSheet function ( removing global version )

renamed some variable / functions:

parseURLDuration -> getURLDuration
pConf -> proxyConfig
Modified paths:
  • /branches/js2-work/phase3/js2/editPage.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/flickrSearch.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libClipEdit/mvClipEdit.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/embedPlayer.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/htmlEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/javaEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libMwApi/mw.proxy.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvPlayList.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvSequencer.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvTimedEffectsEdit.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/mwEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/skins/ctrlBuilder.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js
@@ -276,7 +276,7 @@
277277 '</div>';
278278 },
279279 /**
280 - * Gets an image object from a requested transformation via callback
 280+ * Get an image object from a requested transformation via callback
281281 * ( letting api search implementations query the remote server for a
282282 * given transformation )
283283 *
@@ -288,7 +288,7 @@
289289 } );
290290 },
291291 /**
292 - * Gets the inline wikiText description of the resource Object
 292+ * Get the inline wikiText description of the resource Object
293293 */
294294 getInlineDescWiki:function( resource ) {
295295 // return striped html & trim white space
@@ -319,12 +319,16 @@
320320 }
321321
322322 },
 323+
323324 /**
324 - * Gets the resource import description text
 325+ * Get the resource import description text
 326+ *
 327+ * @param {Object} resource Resource to get description of
325328 */
326329 getImportResourceDescWiki:function( resource ) {
327330 return gM( 'mwe-imported_from', [resource.title, this.provider.homepage, gM('rsd-' + this.provider.id + '-title'), resource.link] );
328331 },
 332+
329333 /**
330334 * Get any extra wikitext description for the given resource object.
331335 * For content outside of the main template description,
@@ -337,25 +341,36 @@
338342 },
339343
340344 /**
341 - * Gets a image transformation
 345+ * Get an image transformation
342346 * by default it just return the poster
 347+ *
 348+ * @param {Object} resource Resource for image transformation
 349+ * @param {Object} options Transformation options
343350 */
344 - getImageTransform:function( resource, opt ) {
 351+ getImageTransform:function( resource, options ) {
345352 return resource.poster;
346353 },
347354
348355 /**
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
350360 */
351 - addResourceInfoFromEmbedInstance : function( resource, eb_id ) {
 361+ addResourceInfoFromEmbedInstance : function( resource, embed_id ) {
352362 return resource;
353363 },
354364
355365 /**
356 - * Adds resource info with a callback function
 366+ * Adds resource info with a callback
357367 *
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
360375 */
361376 addResourceInfoCallback:function( resource, callback ) {
362377 callback();
@@ -363,6 +378,8 @@
364379
365380 /**
366381 * Get the wiki embed code for a given resource object
 382+ *
 383+ * @param {Object} resource Resoruce to get embed wiki code for.
367384 */
368385 getEmbedWikiCode:function( resource ) {
369386 var layout = ( resource.layout ) ? resource.layout:"right"
@@ -384,6 +401,8 @@
385402
386403 /**
387404 * Updates / normalizes the target_resource_title
 405+ *
 406+ * @parma {Object} resource Resource to update title on.
388407 */
389408 updateTargetResourceTitle:function( resource ) {
390409 resource.target_resource_title = resource.titleKey.replace( /^(File:|Image:)/ , '' );
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js
@@ -28,7 +28,7 @@
2929 }
3030 },
3131 /**
32 - * Gets the search results from the api query
 32+ * Get search results from the api query
3333 */
3434 getSearchResults:function() {
3535 // call parent:
@@ -95,7 +95,7 @@
9696 }
9797 },
9898 /**
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"
100100 */
101101 addResourceInfoCallback:function( resource, callback ) {
102102 var _this = this;
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/searchLibs/flickrSearch.js
@@ -46,7 +46,7 @@
4747 },
4848
4949 /**
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
5151 *
5252 * Runs an api call then calls addResults with the resulting data
5353 */
@@ -154,7 +154,7 @@
155155 }
156156 },
157157 /**
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
159159 *
160160 * @param {Object} resource Resource for image transform
161161 * @param {Object} options Options for image transform call
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js
@@ -494,7 +494,8 @@
495495 },
496496
497497 /**
498 - * Gets License Key From a license Url
 498+ * Get license key from a license Url
 499+ *
499500 * @param license_url the url of the license
500501 */
501502 getLicenseFromUrl: function( license_url ) {
@@ -616,7 +617,7 @@
617618 },
618619
619620 /**
620 - * Gets the current position of the text cursor
 621+ * Get the current position of the text cursor
621622 */
622623 getCaretPos: function() {
623624 if ( this.caretPos == null ) {
@@ -630,7 +631,7 @@
631632 },
632633
633634 /**
634 - * Gets the value of the target textbox.
 635+ * Get the value of the target textbox.
635636 */
636637 getTextboxValue: function() {
637638 if ( this.textboxValue == null ) {
@@ -644,7 +645,7 @@
645646 },
646647
647648 /*
648 - * Gets the default query from the text selection
 649+ * Get the default query from the text selection
649650 */
650651 getDefaultQuery: function() {
651652 if ( this.default_query == null ) {
@@ -1036,7 +1037,7 @@
10371038 },
10381039
10391040 /**
1040 - * Gets the search results for a given content provider
 1041+ * Get the search results for a given content provider
10411042 *
10421043 * Sets up binding to showResults once search providers results are ready
10431044 *
@@ -1305,7 +1306,7 @@
13061307
13071308 // Check for missing poster types for audio
13081309 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';
13101311 }
13111312
13121313 // Get a thumb with proper resolution transform if possible:
@@ -1444,7 +1445,7 @@
14451446 },
14461447
14471448 /**
1448 - * Gets the media Type of a resource
 1449+ * Get the media Type of a resource
14491450 *
14501451 * @param {Object} resource get media type of resource
14511452 */
@@ -2228,8 +2229,9 @@
22292230 );
22302231 } );
22312232 },
 2233+
22322234 /**
2233 - * Gets the embed code
 2235+ * Get the embed code
22342236 *
22352237 * based on import_url_mode:
22362238 * calls the resource providers getEmbedHTML method
@@ -2378,10 +2380,10 @@
23792381 */
23802382 showResultsHeader: function() {
23812383 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';
23862388
23872389 if ( !this.content_providers[ this.currentProvider ] ) {
23882390 return;
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/embedPlayer.js
@@ -536,7 +536,7 @@
537537 else
538538 this.mime_type = this.detectType( this.src );
539539
540 - this.parseURLDuration();
 540+ this.getURLDuration();
541541 },
542542
543543 /**
@@ -571,7 +571,7 @@
572572 });
573573
574574 // update the duration
575 - this.parseURLDuration();
 575+ this.getURLDuration();
576576 }
577577 },
578578
@@ -652,11 +652,11 @@
653653
654654 /**
655655 *
656 - * Gets Duration of the media in milliseconds from the source url.
 656+ * Get Duration of the media in milliseconds from the source url.
657657 *
658658 * Supports media_url?t=ntp_start/ntp_end url request format
659659 */
660 - parseURLDuration : function() {
 660+ getURLDuration : function() {
661661 // check if we have a URLTimeEncoding:
662662 if ( this.URLTimeEncoding ) {
663663 var annoURL = mw.parseUri( this.src );
@@ -745,13 +745,15 @@
746746 /**
747747 * Media Element constructor
748748 *
 749+ * Sets up a mediaElement from a provided top level "video" element
 750+ * adds any child sources that are found
 751+ *
749752 * @param {Element} video_element Element that has src attribute or has children source elements
750753 */
751754 init: function( video_element ) {
752755 var _this = this;
753756 js_log( 'Initializing mediaElement...' );
754 - this.sources = new Array();
755 - this.thumbnail = mv_default_thumb_url;
 757+ this.sources = new Array();
756758
757759 if ( $j( video_element ).attr( 'thumbnail' ) )
758760 this.thumbnail = $j( video_element ).attr( 'thumbnail' );
@@ -759,6 +761,10 @@
760762 if ( $j( video_element ).attr( 'poster' ) )
761763 this.thumbnail = $j( video_element ).attr( 'poster' );
762764
 765+ // Set by default thumb value if not found
 766+ if( ! this.thumbnail )
 767+ this.thumbnail = mw.getConfig( 'default_video_thumb' );
 768+
763769 if ( $j( video_element ).attr( 'wikiTitleKey' ) )
764770 this.wikiTitleKey = $j( video_element ).attr( 'wikiTitleKey' );
765771
@@ -766,7 +772,7 @@
767773 this.durationHint = $j( video_element ).attr( 'durationHint' );
768774 // Convert duration hint if needed:
769775 this.duration = npt2seconds( this.durationHint );
770 - }
 776+ }
771777
772778 // Process the video_element as a source element:
773779 if ( $j( video_element ).attr( "src" ) )
@@ -989,7 +995,7 @@
990996 },
991997
992998 /**
993 - * Gets playable sources
 999+ * Get playable sources
9941000 *
9951001 * @returns {Array} of playbale sources
9961002 */
@@ -1172,7 +1178,7 @@
11731179 this.ctrlBuilder = new ctrlBuilder( this );
11741180 }
11751181 // 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' );
11771183 },
11781184
11791185 /**
@@ -1361,6 +1367,8 @@
13621368 /**
13631369 * Issue a warning to non-native playback systems
13641370 * that they could improve the playback experience with a different browser
 1371+ *
 1372+ * dependent on media_element being setup
13651373 */
13661374 doNativeWarningCheck: function( ) {
13671375 if ( $j.cookie( 'dismissNativeWarn' ) && $j.cookie( 'dismissNativeWarn' ) === true ) {
@@ -1393,7 +1401,7 @@
13941402 },
13951403
13961404 /**
1397 - * Gets a Time range from the media start and end time
 1405+ * Get a time range from the media start and end time
13981406 *
13991407 * @return start_npt and end_npt time if present
14001408 */
@@ -1408,8 +1416,9 @@
14091417 return default_time_range;
14101418 return this.media_element.selected_source.start_npt + this.media_element.selected_source.end_npt;
14111419 },
 1420+
14121421 /**
1413 - * Gets the duration of the embed media
 1422+ * Get the duration of the selected source media
14141423 */
14151424 getDuration:function() {
14161425 // Update some local pointers for the selected source:
@@ -1670,8 +1679,8 @@
16711680 },
16721681
16731682 /**
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 )
16761685 */
16771686 getNearbyClipLinks:function() {
16781687 js_log( 'f:getNextPrevLinks' );
@@ -2282,7 +2291,7 @@
22832292 var playable = embedTypes.players.defaultPlayer( source.getMIMEType() );
22842293
22852294 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' ) ;
22872296
22882297 o += '<h2>' + source.getTitle() + '</h2>';
22892298
@@ -2761,7 +2770,7 @@
27622771 */
27632772
27642773 /**
2765 - * Gets the current selected media source
 2774+ * Get the current selected media source
27662775 *
27672776 * @return src url
27682777 */
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/javaEmbed.js
@@ -34,7 +34,7 @@
3535 },
3636
3737 /**
38 - * Gets the embed html code:
 38+ * Get the embed html code:
3939 */
4040 getEmbedObj: function() {
4141 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 @@
187187 return $j( '#' + thumb_render_id ).html();
188188 },
189189 /*
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
192194 */
193195 updateThumbTime:function( float_time ) {
194196 return ;
195197 },
196198
197199 /**
198 - * gets the "embed" html for the html player
 200+ * Get the "embed" html for the html player
199201 */
200202 getEmbedHTML:function() {
201203 js_log( 'f:html:getEmbedHTML: ' + this.id );
@@ -211,7 +213,7 @@
212214 },
213215
214216 /**
215 - * gets the ThumbnailHTML
 217+ * Get the ThumbnailHTML
216218 * ThumbnailHTML is used for both the "paused and playing states of the htmlEmbed player
217219 */
218220 getThumbnailHTML:function( opt ) {
@@ -248,7 +250,7 @@
249251 },
250252
251253 /**
252 - * Gets the media duration
 254+ * Get the media duration
253255 */
254256 getDuration:function() {
255257 if( !this.duration ){
@@ -263,6 +265,7 @@
264266
265267 /**
266268 * Updates the Video time
 269+ *
267270 * @param {String} start_npt Start time for update
268271 * @param {String} end_npt End time for update
269272 */
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvPlayList.js
@@ -918,8 +918,11 @@
919919 }
920920 return 0;
921921 },
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+ */
924927 getControlsHTML:function() {
925928 // get controls from current clip (add some playlist specific controls:
926929 return this.ctrlBuilder.getControls( this );
@@ -1061,11 +1064,11 @@
10621065 js_log( 'getPL cont' );
10631066 return '<a id="mv_prev_link_' + this.id + '" title="Previus Clip" onclick="document.getElementById(\'' + this.id + '\').playPrev();return false;" href="#">' +
10641067 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' } ) +
10661069 '</a>' +
10671070 '<a id="mv_next_link_' + this.id + '" title="Next Clip" onclick="document.getElementById(\'' + this.id + '\').playNext();return false;" href="#">' +
10681071 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' } ) +
10701073 '</a>';
10711074 },
10721075 run_transition: function( clip_inx, trans_type ) {
@@ -2142,7 +2145,7 @@
21432146 return this.dur;
21442147 return this.embed.getDuration();
21452148 },
2146 - // gets the duration of the clip subracting transitions
 2149+ // Get the duration of the clip subracting transitions
21472150 getSoloDuration:function() {
21482151 var fulldur = this.getDuration();
21492152 // see if we need to subtract from time eating transitions (transOut)
@@ -2152,7 +2155,7 @@
21532156 // js_log("getSoloDuration:: td: " + this.getDuration() + ' sd:' + fulldur);
21542157 return fulldur;
21552158 },
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)
21572160 getSourceDuration:function() {
21582161 if ( this.durationHint )
21592162 return this.durationHint;
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvTimedEffectsEdit.js
@@ -132,7 +132,7 @@
133133 loadExternalJs( mw.getMwEmbedPath() + 'libClipEdit/pixastic-editor/pixastic.all.js?' + getMwReqParam() );
134134 loadExternalJs( mw.getMwEmbedPath() + 'libClipEdit/pixastic-editor/ui.js?' + getMwReqParam() );
135135 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() );
137137
138138 var isPixasticReady = function() {
139139 if ( typeof PixasticEditor != 'undefined' ) {
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvSequencer.js
@@ -670,11 +670,12 @@
671671 getSeqOutputJSON:function() {
672672 js_log( 'json output:' );
673673 },
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
676677 * @returns {xml}
677678 */
678 - getSeqOutputHLRDXML:function() {
 679+ getSeqOutputHLRDXML: function() {
679680 var o = '<sequence_hlrd>' + "\n";
680681 o += "\t<head>\n";
681682 // Get transitions
Index: branches/js2-work/phase3/js2/mwEmbed/libClipEdit/mvClipEdit.js
@@ -126,9 +126,9 @@
127127 }
128128 }
129129 },
 130+
130131 /**
131 - * Gets the mediatype for the current resource
132 - *
 132+ * Get the mediatype for the current resource
133133 */
134134 getMediaType: function (){
135135 if( this.media_type )
@@ -593,7 +593,7 @@
594594 *
595595 * @param {Object} defaultTime Provides start and end time default values
596596 */
597 - getStartEndHtml:function( defaultTime ) {
 597+ getStartEndHtml: function( defaultTime ) {
598598 return '<strong>' + gM( 'mwe-set_in_out_points' ) + '</strong>' +
599599 '<table border="0" style="background: transparent; width:94%;height:50px;">' +
600600 '<tr>' +
@@ -614,9 +614,9 @@
615615 },
616616
617617 /**
618 - * Gets the Insert Html
 618+ * Get the Insert Html form text area
619619 */
620 - getInsertHtml:function() {
 620+ getInsertHtml: function() {
621621 var o = '<h3>' + gM( 'mwe-inline-description' ) + '</h3>' +
622622 '<textarea style="width:95%" id="mv_inline_img_desc" rows="5" cols="30">';
623623 if ( this.parentRemoteSearchDriver ) {
@@ -633,7 +633,7 @@
634634 *
635635 * Loops over the local controlActionsCallback
636636 */
637 - updateInsertControlActions:function() {
 637+ updateInsertControlActions: function() {
638638 var _this = this;
639639 var b_target = _this.parentRemoteSearchDriver.target_container + '~ .ui-dialog-buttonpane';
640640 // Empty the ui-dialog-buttonpane bar:
Index: branches/js2-work/phase3/js2/mwEmbed/libMwApi/mw.proxy.js
@@ -44,6 +44,7 @@
4545 } );
4646
4747 ( function( $ ) {
 48+
4849 /**
4950 * Base API Proxy object
5051 *
@@ -53,14 +54,14 @@
5455 /**
5556 * The client setup function:
5657 */
57 - $.proxy.client = function( pConf, conf ) {
 58+ $.proxy.client = function( proxyConfig, conf ) {
5859 var _this = this;
5960 // 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;
6263
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;
6566 } else {
6667 // Set to default mwEmbed iframe path:
6768 $.proxy.client_frame_path = wgScriptPath + '/js2/mwEmbed/libMwApi/NestedCallbackIframe.html';
@@ -176,7 +177,7 @@
177178 *
178179 * This is (Domain B) in the above described setup
179180 */
180 - $.proxy.server = function( pConf, callback ) {
 181+ $.proxy.server = function( proxyConfig, callback ) {
181182 /* clear the body of any html */
182183 $j( 'body' ).html( 'proxy setup' );
183184
@@ -206,15 +207,15 @@
207208 var domain = aObj.cd;
208209 var nested_frame_src = 'http://' + aObj.cd + aObj.cfp;
209210 // 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 ] ) {
212213 // Do the request:
213214 return doNestedProxy( aObj.req );
214215 }
215216 }
216217 // 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 ) {
219220 js_log( 'domain: ' + domain + ' is blacklisted' );
220221 return false;
221222 }
Index: branches/js2-work/phase3/js2/mwEmbed/skins/ctrlBuilder.js
@@ -59,7 +59,7 @@
6060 },
6161
6262 /**
63 - * Gets the controls html
 63+ * Get the controls html
6464 * @return {String} html output of controls
6565 */
6666 getControls:function() {
@@ -338,7 +338,7 @@
339339 },
340340
341341 /**
342 - * Gets the Buffer Html that overlays the playhead
 342+ * Get the Buffer Html that overlays the playhead
343343 */
344344 getBufferHtml:function() {
345345 return '<div class="ui-slider-range ui-slider-range-min ui-widget-header ' +
@@ -347,7 +347,7 @@
348348 },
349349
350350 /**
351 - * Accessor to get a given local component
 351+ * Accessor to get component
352352 *
353353 * @param {String} compoent Component key to grab html output
354354 */
Index: branches/js2-work/phase3/js2/mwEmbed/mwEmbed.js
@@ -17,48 +17,6 @@
1818 *
1919 */
2020
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 -
6321 // The global scope: will be depreciated once we get everything into mw
6422 var _global = this;
6523
@@ -685,7 +643,7 @@
686644 /**
687645 * templates
688646 *
689 - * gets a requested template from the wikitext (if available)
 647+ * Get a requested template from the wikitext (if available)
690648 *
691649 */
692650 templates: function( tname ) {
@@ -773,20 +731,28 @@
774732 */
775733 $.loader = {
776734 /*
777 - * Javascript Module Set
 735+ * Javascript Module Loader functions
778736 * @key Name of Module
779737 * @value function code to load module
780738 */
781 - moduleNames : { },
 739+ moduleLoaders : { },
782740
783741 /**
784 - * Javascript Class Names
 742+ * Javascript Class Paths
785743 * @key Name of class
786744 * @value Class file path
787745 */
788 - classNames : { },
 746+ classPaths : { },
789747
790748 /**
 749+ * Style sheet paths for aossicated classes
 750+ * @key Name of the class
 751+ * @value Style sheet path
 752+ */
 753+ stylePaths : { },
 754+
 755+
 756+ /**
791757 * Load a set of scripts.
792758 * Will issue many load requests or package the request for the script-loader
793759 *
@@ -883,16 +849,16 @@
884850 }
885851
886852 // 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'
889855 ){
890856 //Run the module with the parent callback
891 - this.moduleNames[ loadRequest ]( callback );
 857+ this.moduleLoaders[ loadRequest ]( callback );
892858 return ;
893859 }
894860
895861 // Check for javascript class
896 - if( this.classNames[ loadRequest ] ){
 862+ if( this.classPaths[ loadRequest ] ){
897863 this.loadClass( loadRequest, callback );
898864 return ;
899865 }
@@ -923,11 +889,13 @@
924890 }
925891
926892 // Get the class url:
927 - var baseClassPath = this.classNames[ className ];
 893+ var baseClassPath = this.classPaths[ className ];
928894
929895 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 ){
932900 url = $.getMwEmbedPath() + baseClassPath;
933901 }else{
934902 url = baseClassPath;
@@ -936,8 +904,13 @@
937905 if( ! url ){
938906 js_log( "Could not get url for class " + className );
939907 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+
942915 // Issue the request to load the class (include class name in result callback:
943916 $.getScript( url, function( ) {
944917 callback( className );
@@ -953,7 +926,7 @@
954927 * loads dependencies for a module
955928 */
956929 addModuleLoader: function( name, moduleLoader ){
957 - this.moduleNames [ name ] = moduleLoader;
 930+ this.moduleLoaders [ name ] = moduleLoader;
958931 },
959932
960933 /**
@@ -967,8 +940,20 @@
968941 */
969942 addClassFilePaths: function( classSet ){
970943 for( var i in classSet ){
971 - this.classNames[ i ] = classSet[ i ];
 944+ this.classPaths[ i ] = classSet[ i ];
972945 }
 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+ }
973958 }
974959 }
975960
@@ -999,6 +984,12 @@
1000985 return $.loader.addClassFilePaths( classSet );
1001986 }
1002987
 988+ /**
 989+ * Add Class Style Sheet entry point:
 990+ */
 991+ $.addClassStyleSheets = function( sheetSet ){
 992+ return $.loader.addClassStyleSheets( sheetSet );
 993+ }
1003994
1004995 /**
1005996 * Utility Functions
@@ -1092,14 +1083,14 @@
10931084 _global['$j'] = jQuery.noConflict();
10941085 }
10951086
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' );
11001091
11011092 // 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' );
11041095
11051096 // Set up AJAX to not send dynamic URLs for loading scripts
11061097 $j.ajaxSetup( {
@@ -1184,7 +1175,7 @@
11851176 return false;
11861177 }
11871178 /**
1188 - * Gets page elements that match the rewritePlayerTags config
 1179+ * Get page elements that match the rewritePlayerTags config
11891180 *
11901181 * @param {Boolean} getOne Flag to retive only one tag ( faster for simple has tag checks )
11911182 */
@@ -1231,7 +1222,12 @@
12321223 return ;
12331224 }
12341225
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+
12361232 // Load and bind manually: ( copied from jQuery ajax function )
12371233 var head = document.getElementsByTagName("head")[0];
12381234 var script = document.createElement("script");
@@ -1246,10 +1242,54 @@
12471243 callback();
12481244 }
12491245 };
 1246+
12501247 // Append the script to the DOM:
12511248 head.appendChild( script );
12521249 }
12531250
 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+
12541294 /**
12551295 * Get Api URL from mediaWiki output page defined variables
12561296 */
@@ -1264,8 +1304,8 @@
12651305 var mwEmbedPath = null;
12661306
12671307 /**
1268 - * Gets the path to the mwEmbed folder
1269 - */
 1308+ * Gets the path to the mwEmbed folder
 1309+ */
12701310 $.getMwEmbedPath = function() {
12711311 if ( mwEmbedPath )
12721312 return mwEmbedPath;
@@ -1568,6 +1608,14 @@
15691609
15701610 } );
15711611
 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+
15721620 /**
15731621 * libEmbedPlayer Dependency Module Loader:
15741622 *
@@ -1760,7 +1808,7 @@
17611809 // Do a check for any CSS we may need and get it
17621810 for ( var i = 0; i < loadLibs.length; i++ ) {
17631811 if ( typeof mvCssPaths[ loadLibs[i] ] != 'undefined' ) {
1764 - loadExternalCss( mw.getMwEmbedPath() + mvCssPaths[ loadLibs[i] ] );
 1812+ mw.getStyleSheet( mw.getMwEmbedPath() + mvCssPaths[ loadLibs[i] ] );
17651813 }
17661814 }
17671815
@@ -2063,8 +2111,8 @@
20642112 }
20652113
20662114 // 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' );
20692117 // Load all the required libs:
20702118 mw.load( [
20712119 [ 'remoteSearchDriver',
@@ -2094,8 +2142,8 @@
20952143 // Debugger
20962144 options['target_sequence_container'] = this.selector;
20972145 // 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' );
21002148 // Make sure we have the required mwEmbed libs (they are not loaded when no video
21012149 // element is on the page)
21022150 mvJsLoader.eembedPlayerheck( function() {
@@ -2136,27 +2184,28 @@
21372185 * @@note This Firefogg invocation could be made to work more like real jQuery plugins
21382186 */
21392187 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+
21432192 // 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' );
21462195
21472196 // Check if we already have Firefogg loaded (the call just updates the element's
2148 - // properties)
 2197+ // properties)
21492198 var sElm = $j( this.selector ).get( 0 );
21502199 if ( sElm['firefogg'] ) {
21512200 if ( sElm['firefogg'] == 'loading' ) {
21522201 js_log( "Queued firefogg operations ( firefogg " +
21532202 "not done loading ) " );
2154 - $j.extend( queuedFirefoggConf, iObj );
 2203+ $j.extend( queuedFirefoggConf, options );
21552204 return false;
21562205 }
21572206 // 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];
21612210 }
21622211 return sElm['firefogg'];
21632212 } else {
@@ -2164,7 +2213,7 @@
21652214 sElm['firefogg'] = 'loading';
21662215 }
21672216 // Add the selector
2168 - iObj['selector'] = this.selector;
 2217+ options['selector'] = this.selector;
21692218
21702219 var loadSet = [
21712220 [
@@ -2178,7 +2227,7 @@
21792228 '$j.ui.draggable'
21802229 ]
21812230 ];
2182 - if ( iObj.encoder_interface ) {
 2231+ if ( options.encoder_interface ) {
21832232 loadSet.push( [
21842233 'mvAdvFirefogg',
21852234 '$j.cookie',
@@ -2189,17 +2238,17 @@
21902239 }
21912240 // Make sure we have everything loaded that we need:
21922241 mw.load( loadSet, function() {
2193 - js_log( 'firefogg libs loaded. target select:' + iObj.selector );
 2242+ js_log( 'firefogg libs loaded. target select:' + options.selector );
21942243 // Select interface provider based on whether we want to include the
21952244 // 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 );
21982247 } else {
2199 - var myFogg = new mvFirefogg( iObj );
 2248+ var myFogg = new mvFirefogg( options );
22002249 }
22012250 if ( myFogg ) {
22022251 myFogg.doRewrite( callback );
2203 - var selectorElement = $j( iObj.selector ).get( 0 );
 2252+ var selectorElement = $j( options.selector ).get( 0 );
22042253 selectorElement['firefogg'] = myFogg;
22052254
22062255 js_log( 'pre:' + selectorElement['firefogg']['firefogg_form_action'] )
@@ -2210,7 +2259,7 @@
22112260 } );
22122261 }
22132262 // Take an input player as the selector and expose basic rendering controls
2214 - $.fn.firefoggRender = function( iObj, callback ) {
 2263+ $.fn.firefoggRender = function( options, callback ) {
22152264 // Check if we already have render loaded then just pass on updates/actions
22162265 var sElm = $j( this.selector ).get( 0 );
22172266 //add a special attribute to the selector:
@@ -2223,20 +2272,20 @@
22242273 }
22252274 sElm['fogg_render'] = 'loading';
22262275 // Add the selector
2227 - iObj['player_target'] = this.selector;
 2276+ options['player_target'] = this.selector;
22282277 mw.load( [
22292278 'mvBaseUploadInterface',
22302279 'mvFirefogg',
22312280 'mvFirefoggRender'
22322281 ], function() {
22332282 // Attach the firefoggRender obj to the selected elm:
2234 - sElm['fogg_render'] = new mvFirefoggRender( iObj );
 2283+ sElm['fogg_render'] = new mvFirefoggRender( options );
22352284 if ( callback && typeof callback == 'function' )
22362285 callback( sElm['fogg_render'] );
22372286 } );
22382287 }
22392288
2240 - $.fn.baseUploadInterface = function( iObj ) {
 2289+ $.fn.baseUploadInterface = function( options ) {
22412290 mw.load( [
22422291 [
22432292 'mvBaseUploadInterface',
@@ -2247,7 +2296,7 @@
22482297 '$j.ui.dialog'
22492298 ]
22502299 ], function() {
2251 - myUp = new mvBaseUploadInterface( iObj );
 2300+ myUp = new mvBaseUploadInterface( options );
22522301 myUp.setupForm();
22532302 } );
22542303 }
@@ -2619,40 +2668,7 @@
26202669 document.getElementsByTagName( "head" )[0].appendChild( e );
26212670 // }
26222671 }
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 - }
26422672
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 -
26572673 if ( typeof DOMParser == "undefined" ) {
26582674 DOMParser = function () { }
26592675 DOMParser.prototype.parseFromString = function ( str, contentType ) {
Index: branches/js2-work/phase3/js2/editPage.js
@@ -53,7 +53,7 @@
5454 js_log( 'Do old toolbar bind:' );
5555 didWikiEditorBind = true;
5656 $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">' );
5858 $j( '#btn-add-media-wiz' ).addMediaWiz(
5959 amwConf
6060 );

Status & tagging log