* switched skin over to class attribute (ie class="kskin")
authorMichael Dale <dale@users.mediawiki.org>
Fri, 6 Nov 2009 09:50:57 +0000 (09:50 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Fri, 6 Nov 2009 09:50:57 +0000 (09:50 +0000)
js2/mwEmbed/example_usage/Player_Themable.html
js2/mwEmbed/libEmbedVideo/embedVideo.js
js2/mwEmbed/mv_embed.js

index b9d14d7..a32e539 100644 (file)
@@ -22,12 +22,12 @@ src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight
 </div>
 
 <div style="width:450px;float:left">
-<video skin_name="kskin" src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg" 
+<video class="kskin" src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg" 
                poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" durationHint="15"></video>
-<video  skin_name="kskin" style="width:208px;height:160px;float:left;" src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg" 
+<video class="kskin" style="width:208px;height:160px;float:left;" src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg" 
                poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" durationHint="15"></video>
 <b>(ksin) Source Code used:</b><br>
-<textarea cols="50" rows="7"><video style="width:400px;height:288px" poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" 
+<textarea cols="50" rows="7"><video class="kskin" style="width:400px;height:288px" poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" 
 src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg"></video></textarea>
 </div>
 
index c9316f6..5a1b7b1 100644 (file)
@@ -98,8 +98,6 @@ var default_video_attributes = {
        "embed_link":true,
        "download_link":true,
        "type":null,     //the content type of the media 
-       
-       "skin_name":null //if you want to select a custom skin per video tag. 
 };
 /*
  * the base source attribute checks
@@ -823,9 +821,18 @@ embedVideo.prototype = {
                        }
                }
                
-               //set the skin name from the config (if not set locally) 
-               if( !this.skin_name )
-                       this.skin_name = $mw.conf['skin_name'];
+               //set the skin name from the class  
+               var     sn = element.getAttribute('class');
+               if( sn && sn != ''){
+                       for(var n=0;n< $mw.valid_skins.length;n++){ 
+                               if( sn.indexOf($mw.valid_skins[n]) !== -1){
+                                       this.skin_name = $mw.valid_skins[n];
+                               }
+                       }
+               }
+               //set the default if unset: 
+               if(!this.skin_name)
+                       this.skin_name = $mw.conf.skin_name;
                
                //make sure startOffset is cast as an int                  
                if( this.startOffset && this.startOffset.split(':').length >= 2)
index e23409d..181f0ca 100644 (file)
@@ -222,6 +222,8 @@ if( !mv_embed_path ) {
                'jui_skin' : 'redmond',
                'video_size' : '400x300'        
        }
+       //list valid skins here:
+       $.valid_skins = ['mvpcf', 'kskin'];
        // the version of mwEmbed
        $.version = '1.0r21';
        
@@ -1142,9 +1144,13 @@ function mwdomReady( force ) {
                for(var j in e){
                        for(var k in e[j]){
                                if(e[j][k] && typeof( e[j][k]) == 'object'){
-                                       var     sn = e[j][k].getAttribute('skin_name')
+                                       var     sn = e[j][k].getAttribute('class');                             
                                        if( sn && sn != ''){
-                                               $mw.skin_list.push( sn );
+                                               for(var n=0;n< $mw.valid_skins.length;n++){ 
+                                                       if( sn.indexOf($mw.valid_skins[n]) !== -1){
+                                                               $mw.skin_list.push( $mw.valid_skins[n] );
+                                                       }
+                                               }
                                        }
                                }
                        }