2 * skin js allows you to override contrlBuilder html/class output
6 "mwe-credit-title" : "Title: $1",
7 "mwe-kaltura-platform-title" : "Kaltura open source video platform"
12 // display time progress
13 long_time_disp
: false,
15 volume_layout
: 'horizontal',
29 return '<div class="ui-state-default ui-corner-bl rButton k-options" title="' + gM( 'mwe-player_options' ) + '" >' +
30 '<span>' + gM( 'mwe-menu_btn' ) + '</span>' +
37 'mv_embedded_options': {
39 'o':function( ctrlObj
) {
40 var embedObj
= ctrlObj
.embedObj
;
42 '<div class="k-menu ui-widget-content" ' +
43 'style="width:' + embedObj
.playerPixelWidth() + 'px; height:' + embedObj
.playerPixelHeight() + 'px;">' +
44 '<ul class="k-menu-bar">';
45 // output menu item containers:
46 for ( i
= 0; i
< ctrlObj
.menu_items
.length
; i
++ ) {
47 var mk
= ctrlObj
.menu_items
[i
];
48 o
+= '<li class="k-' + mk
+ '-btn" rel="' + mk
+ '">' +
49 '<a href="#" title="' + gM( 'mwe-' + mk
) + '">' + gM( 'mwe-' + mk
) + '</a></li>';
52 // We have to subtract the width of the k-menu-bar
53 '<div class="k-menu-screens" style="width:' + ( embedObj
.playerPixelWidth() - 75 ) +
54 'px; height:' + ( embedObj
.playerPixelHeight() - ctrlBuilder
.height
) + 'px;">';
56 // Output menu item containers:
57 for ( i
= 0; i
< ctrlObj
.menu_items
.length
; i
++ ) {
58 o
+= '<div class="menu-screen menu-' + ctrlObj
.menu_items
[i
] + '"></div>';
67 * Adds the skin Control Bindings
69 addSkinControlBindings: function() {
70 var embedObj
= this.embedObj
;
72 var $tp
= $j( '#' + embedObj
.id
);
74 // Adds options and bindings: (we do this onClick )
75 var addMvOptions = function() {
76 if ( $j( '#' + embedObj
.id
+ ' .k-menu' ).length
!= 0 )
79 $j( '#' + embedObj
.id
+ ' .' + _this
.pClass
).prepend(
80 _this
.components
['mv_embedded_options'].o( $tp
.get( 0 ).ctrlBuilder
)
83 // By default its hidden:
84 $tp
.find( '.k-menu' ).hide();
87 for ( i
= 0; i
< _this
.menu_items
.length
; i
++ ) {
88 $tp
.find( '.k-' + _this
.menu_items
[i
] + '-btn' ).click( function() {
89 var mk
= $j( this ).attr( 'rel' );
90 $target
= $j( '#' + embedObj
.id
+ ' .menu-' + mk
).hide();
91 // Generate the menu html not already done:
92 if ( $target
.children().length
== 0 ) {
93 // call the function show{Menuitem} with target:
94 _this
.showMenuItem( mk
);
96 // Slide out the others
97 $j( '#' + embedObj
.id
+ ' .menu-screen' ).hide();
98 $target
.fadeIn( "fast" );
99 // don't follow the # link
105 // Options menu display:
106 $tp
.find( '.k-options' ).click( function() {
107 if ( $j( '#' + embedObj
.id
+ ' .k-menu' ).length
== 0 ) {
108 // Stop the player if it does not support overlays:
109 if ( !embedObj
.supports
['overlay'] )
114 // Set up the text and menu:
115 var $ktxt
= $j( this );
116 var $kmenu
= $tp
.find( '.k-menu' );
117 if ( $kmenu
.is( ':visible' ) ) {
118 $kmenu
.fadeOut( "fast", function() {
119 $ktxt
.find( 'span' ).html ( gM( 'mwe-menu_btn' ) );
121 $tp
.find( '.play-btn-large' ).fadeIn( 'fast' );
123 $kmenu
.fadeIn( "fast", function() {
124 $ktxt
.find( 'span' ).html ( gM( 'mwe-close_btn' ) );
126 $tp
.find( '.play-btn-large' ).fadeOut( 'fast' );
131 showMenuItem:function( menu_item
) {
132 //handle special k-skin specific display;
133 if( menu_item
== 'credits'){
136 //call the base embedObj "show{Item}"
137 this.embedObj
['show' + menu_item
.charAt( 0 ).toUpperCase() + menu_item
.substring( 1 )](
138 $j( '#' + this.embedObj
.id
+ ' .menu-' + menu_item
)
142 // Do the credit screen (presently specific to kaltura skin:)
143 showCredits:function() {
144 //set up the shortcuts:
145 embedObj
= this.embedObj
;
147 $target
= $j( '#' + embedObj
.id
+ ' .menu-credits' );
149 $target
.html( '<h2>' + gM( 'mwe-credits' ) + '</h2>' +
150 '<div class="credits_box ui-corner-all">' +
151 mv_get_loading_img() +
155 if( mw
.conf
.k_attribution
== true ){
157 $j('<div/>').addClass( 'k-attribution' )
159 'title': gM('mwe-kaltura-platform-title')
162 window
.location
= 'http://kaltura.com';
167 if( !embedObj
.wikiTitleKey
){
168 $target
.find('.credits_box').text(
169 'Error: no title key to grab credits with'
173 // Do the api request to populate the credits via the wikiTitleKey ( tied to "commons" )
176 // Normalize the File NS (ie sometimes its present in wikiTitleKey other times not
177 'titles' : 'File:' + embedObj
.wikiTitleKey
.replace(/File:|Image:/, '' ),
178 'prop' : 'revisions',
181 var req_categories
= new Array();
183 'url' : mw
.commons_api_url
,
185 }, function( data
) {
186 if( !data
|| !data
.query
|| !data
.query
.pages
){
187 $target
.find('.credits_box').text(
188 'Error: title key: ' + embedObj
.wikiTitleKey
+ ' not found'
192 var pages
= data
.query
.pages
;
195 if( page
[ 'revisions' ] && page
[ 'revisions' ][0]['*'] ){
196 $target
.find('.credits_box').html(
197 _this
.doCreditLineFromWikiText( page
[ 'revisions' ][0]['*'] )
203 doCreditLineFromWikiText:function ( wikiText
){
204 var embedObj
= this.embedObj
;
207 var titleStr
= embedObj
.wikiTitleKey
.replace(/_
/g
, ' ');
208 var titleLink
= 'http://commons.wikimedia.org/wiki/File:' + embedObj
.wikiTitleKey
;
210 // @@FIXME Do a quick check for source line:
211 return $j( '<div/>' ).addClass( 'creditline' )
219 'src' : embedObj
.thumbnail
,
225 gM( 'mwe-credit-title' ,
226 // We use a div container to easialy get at the built out link