From 95e645cafddf2b286f88cd6e3d558b00e4c88ca9 Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Fri, 6 Nov 2009 09:50:57 +0000 Subject: [PATCH] * switched skin over to class attribute (ie class="kskin") --- js2/mwEmbed/example_usage/Player_Themable.html | 6 +++--- js2/mwEmbed/libEmbedVideo/embedVideo.js | 17 ++++++++++++----- js2/mwEmbed/mv_embed.js | 10 ++++++++-- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/js2/mwEmbed/example_usage/Player_Themable.html b/js2/mwEmbed/example_usage/Player_Themable.html index b9d14d7c25..a32e539ef6 100644 --- a/js2/mwEmbed/example_usage/Player_Themable.html +++ b/js2/mwEmbed/example_usage/Player_Themable.html @@ -22,12 +22,12 @@ src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight
- - (ksin) Source Code used:
-
diff --git a/js2/mwEmbed/libEmbedVideo/embedVideo.js b/js2/mwEmbed/libEmbedVideo/embedVideo.js index c9316f6964..5a1b7b1f78 100644 --- a/js2/mwEmbed/libEmbedVideo/embedVideo.js +++ b/js2/mwEmbed/libEmbedVideo/embedVideo.js @@ -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) diff --git a/js2/mwEmbed/mv_embed.js b/js2/mwEmbed/mv_embed.js index e23409d3ac..181f0ca299 100644 --- a/js2/mwEmbed/mv_embed.js +++ b/js2/mwEmbed/mv_embed.js @@ -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] ); + } + } } } } -- 2.20.1