r58629 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58628‎ | r58629 | r58630 >
Date:09:50, 6 November 2009
Author:dale
Status:deferred
Tags:
Comment:
* switched skin over to class attribute (ie class="kskin")
Modified paths:
  • /trunk/phase3/js2/mwEmbed/example_usage/Player_Themable.html (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/mv_embed.js (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/example_usage/Player_Themable.html
@@ -22,12 +22,12 @@
2323 </div>
2424
2525 <div style="width:450px;float:left">
26 -<video skin_name="kskin" src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg"
 26+<video class="kskin" src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg"
2727 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>
28 -<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"
 28+<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"
2929 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>
3030 <b>(ksin) Source Code used:</b><br>
31 -<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"
 31+<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"
3232 src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg"></video></textarea>
3333 </div>
3434
Index: trunk/phase3/js2/mwEmbed/mv_embed.js
@@ -222,6 +222,8 @@
223223 'jui_skin' : 'redmond',
224224 'video_size' : '400x300'
225225 }
 226+ //list valid skins here:
 227+ $.valid_skins = ['mvpcf', 'kskin'];
226228 // the version of mwEmbed
227229 $.version = '1.0r21';
228230
@@ -1142,9 +1144,13 @@
11431145 for(var j in e){
11441146 for(var k in e[j]){
11451147 if(e[j][k] && typeof( e[j][k]) == 'object'){
1146 - var sn = e[j][k].getAttribute('skin_name')
 1148+ var sn = e[j][k].getAttribute('class');
11471149 if( sn && sn != ''){
1148 - $mw.skin_list.push( sn );
 1150+ for(var n=0;n< $mw.valid_skins.length;n++){
 1151+ if( sn.indexOf($mw.valid_skins[n]) !== -1){
 1152+ $mw.skin_list.push( $mw.valid_skins[n] );
 1153+ }
 1154+ }
11491155 }
11501156 }
11511157 }
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js
@@ -98,8 +98,6 @@
9999 "embed_link":true,
100100 "download_link":true,
101101 "type":null, //the content type of the media
102 -
103 - "skin_name":null //if you want to select a custom skin per video tag.
104102 };
105103 /*
106104 * the base source attribute checks
@@ -823,9 +821,18 @@
824822 }
825823 }
826824
827 - //set the skin name from the config (if not set locally)
828 - if( !this.skin_name )
829 - this.skin_name = $mw.conf['skin_name'];
 825+ //set the skin name from the class
 826+ var sn = element.getAttribute('class');
 827+ if( sn && sn != ''){
 828+ for(var n=0;n< $mw.valid_skins.length;n++){
 829+ if( sn.indexOf($mw.valid_skins[n]) !== -1){
 830+ this.skin_name = $mw.valid_skins[n];
 831+ }
 832+ }
 833+ }
 834+ //set the default if unset:
 835+ if(!this.skin_name)
 836+ this.skin_name = $mw.conf.skin_name;
830837
831838 //make sure startOffset is cast as an int
832839 if( this.startOffset && this.startOffset.split(':').length >= 2)

Status & tagging log