r55208 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55207‎ | r55208 | r55209 >
Date:21:44, 17 August 2009
Author:dale
Status:deferred
Tags:
Comment:
* switched to mwConfig based object configuration (patch by GerardoDoog)
Modified paths:
  • /trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libSequencer/mvPlayList.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/mv_embed.js (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/libSequencer/mvPlayList.js
@@ -1689,7 +1689,7 @@
16901690 this['type'][tObj.type][tObj.subtype].u(tObj,percent);
16911691 },
16921692 getTransitionIcon:function( type, subtype){
1693 - return mv_embed_path +'/skins/'+mv_skin_name+'/transition_images/'+ type+'_'+ subtype+ '.png';
 1693+ return mv_embed_path +'/skins/'+mwConfig['skin_name']+'/transition_images/'+ type+'_'+ subtype+ '.png';
16941694 },
16951695 /*
16961696 * mvTransLib: functional library mapping:
Index: trunk/phase3/js2/mwEmbed/mv_embed.js
@@ -24,22 +24,24 @@
2525
2626 /*
2727 * Configuration variables (can be set from some precceding script)
 28+ * set up mwConfig global overide any of the defaultMwConfig values:
 29+ * @@ more config valuse on the way ;)
2830 */
29 -//the name of the player skin (default is mvpcf)
30 -if(!mv_skin_name)
31 - var mv_skin_name = 'mvpcf';
32 -
33 -if(!mwjQueryUiSkin)
34 - var mwjQueryUiSkin = 'redmond';
 31+var defaultMwConfig = {
 32+ 'skin_name': 'mvpcf',
 33+ 'video_size':'400x300'
 34+}
3535
 36+if(!mwConfig)
 37+ var mwConfig = {};
 38+
 39+//install the default config values for anything not set in mwConfig
 40+checkDefaultMwConfig();
 41+
3642 //whether or not to load java from an iframe.
3743 //note: this is necessary for remote embedding because of java security model)
3844 if(!mv_java_iframe)
3945 var mv_java_iframe = true;
40 -
41 -//the default height/width of the video (if no style or width attribute provided)
42 -if(!mv_default_video_size)
43 - var mv_default_video_size = '400x300';
4446
4547 //for when useing mv_embed with script-loader in root mediawiki path
4648 var mediaWiki_mvEmbed_path = 'js2/mwEmbed/';
@@ -62,8 +64,8 @@
6365
6466
6567 //setup the skin path:
66 -var mv_jquery_skin_path = mv_embed_path + 'jquery/' + jQueryUiVN + '/themes/' + mwjQueryUiSkin + '/';
67 -var mv_skin_img_path = mv_embed_path + 'skins/' + mv_skin_name + '/images/';
 68+var mv_jquery_skin_path = mv_embed_path + 'jquery/' + jQueryUiVN + '/themes/redmond/';
 69+var mv_skin_img_path = mv_embed_path + 'skins/' + mwConfig['skin_name'] + '/images/';
6870 var mv_default_thumb_url = mv_skin_img_path + 'vid_default_thumb.jpg';
6971
7072
@@ -547,7 +549,7 @@
548550 //set videonojs to loading
549551 //issue a style sheet request get both mv_embed and jquery styles:
550552 loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
551 - loadExternalCss( mv_embed_path + 'skins/'+mv_skin_name+'/styles.css');
 553+ loadExternalCss( mv_embed_path + 'skins/'+mwConfig['skin_name']+'/styles.css');
552554
553555 //make sure we have jQuery
554556 _this.jQueryCheck(function(){
@@ -642,7 +644,7 @@
643645 function js2AddOnloadHook( func ) {
644646 //make sure the skin/style sheets are avaliable always:
645647 loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
646 - loadExternalCss( mv_embed_path + 'skins/'+mv_skin_name+'/styles.css');
 648+ loadExternalCss( mv_embed_path + 'skins/'+mwConfig['skin_name']+'/styles.css');
647649
648650 //if we have already run the dom ready just run the function directly:
649651 if( mvJsLoader.doneReadyEvents ){
@@ -770,7 +772,7 @@
771773
772774 //load the mv_embed_base skin:
773775 loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
774 - loadExternalCss( mv_embed_path + 'skins/'+mv_skin_name+'/styles.css' );
 776+ loadExternalCss( mv_embed_path + 'skins/'+mwConfig['skin_name']+'/styles.css' );
775777 //load all the req libs:
776778 mvJsLoader.jQueryCheck(function(){
777779 //load with staged dependeinces (for ie and safari that don't execute in order)
@@ -799,7 +801,7 @@
800802 iObj['target_sequence_container'] = this.selector;
801803 //issue a request to get the css file (if not already included):
802804 loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css');
803 - loadExternalCss( mv_embed_path+'skins/'+mv_skin_name+'/mv_sequence.css');
 805+ loadExternalCss( mv_embed_path+'skins/'+mwConfig['skin_name']+'/mv_sequence.css');
804806 //make sure we have the required mv_embed libs (they are not loaded when no video element is on the page)
805807 mvJsLoader.embedVideoCheck(function(){
806808 //load playlist object and then jquery ui stuff:
@@ -842,7 +844,7 @@
843845 iObj={};
844846 //add base theme css:
845847 loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css');
846 - loadExternalCss( mv_embed_path + 'skins/'+mv_skin_name+'/styles.css' );
 848+ loadExternalCss( mv_embed_path + 'skins/'+mwConfig['skin_name']+'/styles.css' );
847849
848850 //check if we already have firefogg loaded (the call just updates properties for that element)
849851 var sElm = $j(this.selector).get(0);
@@ -1406,6 +1408,14 @@
14071409 return false;
14081410 }
14091411
 1412+function checkDefaultMwConfig(){
 1413+ for(var i in defaultMwConfig){
 1414+ if(typeof(mwConfig[i])=='undefined'){
 1415+ mwConfig[i] =defaultMwConfig[i];
 1416+ }
 1417+ }
 1418+ }
 1419+
14101420 function js_error(string){
14111421 alert(string);
14121422 return false;
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js
@@ -1156,7 +1156,7 @@
11571157 this.duration = parseFloat(this.duration);
11581158 js_log("duration is: " + this.duration);
11591159 //if style is set override width and height
1160 - var dwh = mv_default_video_size.split('x');
 1160+ var dwh = mwConfig['video_size'].split('x');
11611161 this.width = element.style.width ? element.style.width : dwh[0];
11621162 this.height = element.style.height ? element.style.height : dwh[1];
11631163 //set the plugin id

Status & tagging log