r55328 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55327‎ | r55328 | r55329 >
Date:14:35, 19 August 2009
Author:dale
Status:deferred
Tags:
Comment:
* some sequence fixes
Modified paths:
  • /trunk/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js (modified) (history)
  • /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)
  • /trunk/phase3/js2/mwEmbed/skins/baseSkin.js (deleted) (history)
  • /trunk/phase3/js2/mwEmbed/skins/ctrlBuilder.js (added) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js
@@ -30,7 +30,6 @@
3131 "mwe-ok-button" : "OK"
3232 });
3333
34 -
3534 var default_bui_options = {
3635 'api_url':null,
3736 'parent_uploader':null,
Index: trunk/phase3/js2/mwEmbed/libSequencer/mvPlayList.js
@@ -426,7 +426,8 @@
427427 $j('#dc_'+_this.id).append(
428428 '<div style="font-size:13px;border:solid thin;width:'+this.width+'px;" id="ptitle_'+this.id+'"></div>' +
429429 '<div class="videoPlayer" style="position:absolute;top:'+(_this.height+_this.pl_layout.title_bar_height+4)+'px">' +
430 - '<div id="mv_embedded_controls_'+_this.id+'" class="ui-widget ui-corner-bottom ui-state-default controls" '+
 430+ //'<div id="mv_embedded_controls_'+_this.id+'" class="ui-widget ui-corner-bottom ui-state-default controls" '+
 431+ '<div class="k-control-bar ui-widget-header ui-helper-clearfix" ' +
431432 'style="width:' + _this.width + 'px" >' +
432433 _this.getControlsHTML() +
433434 '</div>'+
@@ -551,7 +552,8 @@
552553 setSliderValue:function(value){
553554 //slider is on 1000 scale:
554555 var val = parseInt( value *1000 );
555 - $j('#mv_play_head_' + this.id).slider('value', val);
 556+ $//j('#mv_play_head_' + this.id).slider('value', val);
 557+ $j('#'+this.id + ' .j-scrubber').slider('value', val);
556558 },
557559 getPlayHeadPos: function(prec_done){
558560 var _this = this;
Index: trunk/phase3/js2/mwEmbed/skins/baseSkin.js
@@ -1 +0,0 @@
2 -//just a stub right now
\ No newline at end of file
Index: trunk/phase3/js2/mwEmbed/skins/ctrlBuilder.js
@@ -0,0 +1,418 @@
 2+//set the dismissNativeWarn flag:
 3+_global['dismissNativeWarn'] = false;
 4+
 5+var ctrlBuilder = {
 6+ height:29,
 7+ supports:{
 8+ 'options':true,
 9+ 'borders':true
 10+ },
 11+ menu_items:[
 12+ 'playerselect',
 13+ 'download',
 14+ 'share',
 15+ 'credits',
 16+ ],
 17+ default_menu_item:'download',
 18+ getControls:function( embedObj ){
 19+ js_log('f:controlsBuilder:: opt:');
 20+ this.id = (embedObj.pc)?embedObj.pc.pp.id:embedObj.id;
 21+ this.available_width = embedObj.playerPixelWidth();
 22+ //make pointer to the embedObj
 23+ this.embedObj = embedObj;
 24+ var _this = this;
 25+ for(var i in embedObj.supports){
 26+ _this.supports[i] = embedObj.supports[i];
 27+ };
 28+
 29+ //check for close_captions tracks:
 30+ if( ( embedObj.roe || embedObj.timedTextSources() )
 31+ && embedObj.show_meta_link )
 32+ this.supports['closed_captions']=true;
 33+
 34+ var o='';
 35+ //get the length of the play_head
 36+ this.player_head_length = embedObj.playerPixelWidth();
 37+ for( var i in this.components ){
 38+ if( this.supports[i] ){
 39+ if( i != 'play_head'){
 40+ this.player_head_length -= this.components[i].w;
 41+ }
 42+ }
 43+ }
 44+ for(var i in this.components){
 45+ if( this.supports[i] ){
 46+ if( this.available_width > this.components[i].w ){
 47+ //special case with playhead don't add unless we have 60px
 48+ if( i == 'play_head' && this.player_head_length < 60 )
 49+ continue;
 50+ o+=this.components[i].o();
 51+ this.available_width -= this.components[i].w;
 52+ }else{
 53+ js_log('not enough space for control component:' + i);
 54+ }
 55+ }
 56+ }
 57+ return o;
 58+ },
 59+ /*
 60+ * addControlHooks
 61+ * to be run once controls are attached to the dom
 62+ */
 63+ addControlHooks:function( embedObj ){
 64+ //add in drag/seek hooks:
 65+ if(!embedObj.base_seeker_slider_offset && $j('#mv_seeker_slider_'+embedObj.id).get(0))
 66+ embedObj.base_seeker_slider_offset = $j('#mv_seeker_slider_'+embedObj.id).get(0).offsetLeft;
 67+
 68+ //js_log('looking for: #mv_seeker_slider_'+embedObj.id + "\n " +
 69+ // 'start sec: '+embedObj.start_time_sec + ' base offset: '+embedObj.base_seeker_slider_offset);
 70+
 71+ var $tp=$j('#' + embedObj.id);
 72+
 73+ //@todo: which object is being play()'d (or whatever) ?
 74+ //We select the element to attach the event to this way:
 75+ //$tp.find('.ui-icon-play').parent().click(function(){alert(0)}); or we can give the button itself a class - probably better.
 76+
 77+ //add play hook for play-btn and large_play_button
 78+ $tp.find('.play-btn,.play-btn-large').unbind().btnBind().click(function(){
 79+ $j('#' + embedObj.id).get(0).play();
 80+ })
 81+ //add recomend firefox if non-native playback:
 82+ if( embedObj.doNativeWarningCheck() ){
 83+ $j('#dc_'+ embedObj.id).hover(
 84+ function(){
 85+ if($j('#gnp_' + embedObj.id).length==0){
 86+ $j(this).append('<div id="gnp_' + embedObj.id + '" class="ui-state-highlight ui-corner-all" ' +
 87+ 'style="position:absolute;display:none;background:#FFF;top:10px;left:10px;right:10px;height:60px;">' +
 88+ gM('mv_for_best_experience') +
 89+ '<br><input id="ffwarn_'+embedObj.id+'" type=\"checkbox\">' +
 90+ gM('mv_do_not_warn_again') +
 91+ '</div>');
 92+ $j('#ffwarn_'+embedObj.id).click(function(){
 93+ if( $j(this).is(':checked') ){
 94+ //set up a cookie for 5 days:
 95+ $j.cookie('dismissNativeWarn', true, { expires: 5 });
 96+ //set the current instance
 97+ _global['dismissNativeWarn'] = true;
 98+ $j('#gnp_' + embedObj.id).fadeOut('slow');
 99+ }else{
 100+ _global['adismissNativeWarn'] = false;
 101+ $j.cookie('dismissNativeWarn', false);
 102+ }
 103+
 104+ });
 105+ }
 106+ if( ($j.cookie('dismissNativeWarn') !== true) &&
 107+ _global['dismissNativeWarn'] === false ){
 108+ $j('#gnp_' + embedObj.id).fadeIn('slow');
 109+ }
 110+ },
 111+ function(){
 112+ $j('#gnp_' + embedObj.id).fadeOut('slow');
 113+ }
 114+ );
 115+ }
 116+
 117+ if( $j.browser.msie && $j.browser.version <= 6){
 118+ $j('#big_play_link_' + embedObj.id).pngFix();
 119+ }
 120+
 121+ //captions binding:
 122+ $j('#timed_text_' + embedObj.id).unbind().btnBind().click(function(){
 123+ $j('#' + embedObj.id).get(0).showTextInterface();
 124+ });
 125+
 126+ //options binding:
 127+ $j('#options_button_' + embedObj.id).unbind().btnBind().click(function(){
 128+ $j('#' +embedObj.id).get(0).doOptionsHTML();
 129+ });
 130+
 131+ //fullscreen binding:
 132+ $j('#fullscreen_' + embedObj.id).unbind().btnBind().click(function(){
 133+ $j('#' +embedObj.id).get(0).fullscreen();
 134+ });
 135+
 136+ js_log(" should add slider binding: " + $j('#mv_play_head_'+embedObj.id).length) ;
 137+// $j('#mv_play_head_'+embedObj.id).slider({
 138+ $tp.find( '.j-scrubber' ).slider({
 139+ range: "min",
 140+ value: 0,
 141+ min: 0,
 142+ max: 1000,
 143+ start: function(event, ui){
 144+ var id = (embedObj.pc!=null)?embedObj.pc.pp.id:embedObj.id;
 145+ embedObj.userSlide=true;
 146+ $j('#big_play_link_'+id).fadeOut('fast');
 147+ //if playlist always start at 0
 148+ embedObj.start_time_sec = (embedObj.instanceOf == 'mvPlayList')?0:
 149+ npt2seconds(embedObj.getTimeReq().split('/')[0]);
 150+ },
 151+ slide: function(event, ui) {
 152+ var perc = ui.value/1000;
 153+ embedObj.jump_time = seconds2npt( parseFloat( parseFloat(embedObj.getDuration()) * perc ) + embedObj.start_time_sec);
 154+ //js_log('perc:' + perc + ' * ' + embedObj.getDuration() + ' jt:'+ this.jump_time);
 155+ embedObj.setStatus( gM('seek_to')+' '+embedObj.jump_time );
 156+ //update the thumbnail / frame
 157+ if(embedObj.isPlaying==false){
 158+ embedObj.updateThumbPerc( perc );
 159+ }
 160+ },
 161+ change:function(event, ui){
 162+ //only run the onChange event if done by a user slide:
 163+ if(embedObj.userSlide){
 164+ embedObj.userSlide=false;
 165+ embedObj.seeking=true;
 166+ //stop the monitor timer (if we can)
 167+ if(embedObj.stopMonitor)
 168+ embedObj.stopMonitor();
 169+
 170+ var perc = ui.value/1000;
 171+ //set seek time (in case we have to do a url seek)
 172+ embedObj.seek_time_sec = npt2seconds( embedObj.jump_time, true );
 173+ js_log('do jump to: '+embedObj.jump_time + ' perc:' +perc + ' sts:' + embedObj.seek_time_sec);
 174+ embedObj.doSeek(perc);
 175+ }
 176+ }
 177+ });
 178+ //@todo: identify problem with volume button jumping...
 179+ $tp.find('.k-volume-slider').slider({
 180+ range: "min",
 181+ value: 80,
 182+ min: 0,
 183+ max: 100,
 184+ slide: function(event, ui) {
 185+ embedObj.updateVolumen(ui.value/100);
 186+ },
 187+ change: function(event, ui){
 188+ var level = ui.value/100;
 189+ if (level==0) {
 190+ $tp.find('.k-volume span').addClass('ui-icon-volume-off');
 191+ }else{
 192+ $tp.find('.k-volume span').removeClass('ui-icon-volume-off');
 193+ }
 194+ //only run the onChange event if done by a user slide:
 195+ if(embedObj.userSlide){
 196+ embedObj.userSlide=false;
 197+ embedObj.seeking=true;
 198+// var perc = ui.value/100;
 199+ embedObj.updateVolumen(level);
 200+ }
 201+ }
 202+ });
 203+ //up the z-index of the default status indicator:
 204+// $j('#mv_play_head_'+embedObj.id + ' .ui-slider-handle').css('z-index', 4);
 205+// $j('#mv_play_head_'+embedObj.id + ' .ui-slider-range').addClass('ui-corner-all').css('z-index', 2);
 206+ //extended class list for jQuery ui themeing (we can probably refactor this with custom buffering highliter)
 207+ $j('#' + embedObj.id + ' .j-scrubber').prepend( ctrlBuilder.getMvBufferHtml() );
 208+
 209+
 210+ //adds options and bindings: (we do this onClick for faster vidoe tag startup times)
 211+ var addMvOptions = function(){
 212+ if($j('#' + embedObj.id + ' .k-menu').length != 0 )
 213+ return false;
 214+
 215+ $j('#' + embedObj.id).prepend( ctrlBuilder.components['mv_embedded_options'].o( embedObj ) );
 216+
 217+ //by default its hidden:
 218+ $tp.find('.k-menu').hide();
 219+
 220+ //output menu-items:
 221+ for(i=0; i < ctrlBuilder.menu_items.length ; i++){
 222+ $tp.find('.k-' + ctrlBuilder.menu_items[i] + '-btn').click(function(){
 223+ var mk = $j(this).attr('rel');
 224+ $target = $j('#' + embedObj.id + ' .menu-'+mk).hide();
 225+ //gennerate the menu html not already done:
 226+ if( $target.children().length == 0 ){
 227+ //call the function show{Menuitem} with target:
 228+ embedObj['show' + mk.charAt(0).toUpperCase() + mk.substring(1)](
 229+ $j('#' + embedObj.id + ' .menu-'+mk)
 230+ );
 231+ }
 232+ //slide out the others
 233+ $j('#' + embedObj.id + ' .menu-screen').hide();
 234+ $target.fadeIn("fast");
 235+ //don't follow the # link
 236+ return false;
 237+ });
 238+ }
 239+ }
 240+
 241+ //options menu display:
 242+ $tp.find('.k-options').click(function(){
 243+ if($j('#' + embedObj.id + ' .k-menu').length == 0 )
 244+ addMvOptions();
 245+ //set up the text and menu:
 246+ var $ktxt = $j(this).find('.ui-icon-k-menu');
 247+ var $kmenu = $tp.find('.k-menu');
 248+ if( $kmenu.is(':visible') ){
 249+ $kmenu.fadeOut("fast",function(){
 250+ $ktxt.html ( gM('menu_btn') );
 251+ });
 252+ $tp.find('.play-btn-large').fadeIn('fast');
 253+ }else{
 254+ $kmenu.fadeIn("fast", function(){
 255+ $ktxt.html ( gM('close_btn') );
 256+ });
 257+ $tp.find('.play-btn-large').fadeOut('fast');
 258+ }
 259+ });
 260+
 261+ //volume binding:
 262+ $tp.find('.k-volume').unbind().btnBind().click(function(){
 263+ $tp.toggleMute();
 264+ });
 265+
 266+ var hoverOverDelay=false;
 267+ /*$j('#volume_control_'+embedObj.id).unbind().btnBind().click(function(){
 268+ $j('#' +embedObj.id).get(0).toggleMute();
 269+ });
 270+ .hover(
 271+ function(){
 272+ $j('#vol_container_' + embedObj.id).addClass('vol_container_top');
 273+ //set to "below" if playing and embedType != native
 274+ if(embedObj && embedObj.isPlaying() && !embedObj.supports['overlays']){
 275+ $j('#vol_container_' + embedObj.id).removeClass('vol_container_top').addClass('vol_container_below');
 276+ }
 277+
 278+ $j('#vol_container_' + embedObj.id).fadeIn('fast');
 279+ hoverOverDelay = true;
 280+ },
 281+ function(){
 282+ hoverOverDelay= false;
 283+ setTimeout(function doHideVolume(){
 284+ if(!hoverOverDelay){
 285+ $j('#vol_container_' + embedObj.id).fadeOut('fast');
 286+ }
 287+ }, 500);
 288+ }
 289+ );
 290+ //Volumen Slider
 291+ $j('#volume_bar_'+embedObj.id).slider({
 292+ orientation: "vertical",
 293+ range: "min",
 294+ value: 80,
 295+ min: 0,
 296+ max: 100,
 297+ slide: function(event, ui) {
 298+ var perc = ui.value/100;
 299+ //js_log('update volume:' + perc);
 300+ embedObj.updateVolumen(perc);
 301+ },
 302+ change:function(event, ui){
 303+ var perc = ui.value/100;
 304+ if (perc==0) {
 305+ $j('#volume_control_'+embedObj.id + ' span').removeClass('ui-icon-volume-on').addClass('ui-icon-volume-off');
 306+ }else{
 307+ $j('#volume_control_'+embedObj.id + ' span').removeClass('ui-icon-volume-off').addClass('ui-icon-volume-on');
 308+ }
 309+ //only run the onChange event if done by a user slide:
 310+ if(embedObj.userSlide){
 311+ embedObj.userSlide=false;
 312+ embedObj.seeking=true;
 313+ var perc = ui.value/100;
 314+ embedObj.updateVolumen(perc);
 315+ }
 316+ }
 317+ });*/
 318+
 319+ },
 320+ getMvBufferHtml:function(){
 321+ return '<div class="ui-slider-horizontal ui-corner-all ui-slider-buffer" />';
 322+ },
 323+ components:{
 324+ 'borders':{
 325+ 'w':8,
 326+ 'o':function(){
 327+ return '';
 328+ }
 329+ },
 330+ 'mv_embedded_options':{
 331+ 'w':0,
 332+ 'o':function( embedObj ){
 333+ var o= '' +
 334+ '<div class="k-menu ui-widget-content" ' +
 335+ 'style="width:' + embedObj.playerPixelWidth() + 'px; height:' + embedObj.playerPixelHeight() + 'px;">' +
 336+ '<ul class="k-menu-bar">';
 337+ //output menu item containers:
 338+ for(i=0; i < ctrlBuilder.menu_items.length; i++){
 339+ var mk = ctrlBuilder.menu_items[i];
 340+ o+= '<li class="k-' + mk + '-btn" rel="' + mk + '">' +
 341+ '<a href="#" title="' + gM( mk ) +'">' + gM( mk ) +'</a></li>';
 342+ }
 343+ o+='</ul>' +
 344+ //we have to substract the width of the k-menu-bar
 345+ '<div class="k-menu-screens" style="width:' + ( embedObj.playerPixelWidth() -75) +
 346+ 'px; height:' + (embedObj.playerPixelHeight() - ctrlBuilder.height) + 'px;">';
 347+
 348+ //output menu item containers:
 349+ for(i=0; i < ctrlBuilder.menu_items.length; i++){
 350+ o+= '<div class="menu-screen menu-' + ctrlBuilder.menu_items[i] + '"></div>';
 351+ }
 352+ '</div>' +
 353+ '</div>';
 354+ return o;
 355+ }
 356+ },
 357+ 'pause':{
 358+ 'w':28, //28 147
 359+ 'o':function(){
 360+ return '<button class="play-btn ui-state-default ui-corner-all" title="' +
 361+ gM('play_clip') + '" ><span class="ui-icon ui-icon-play"></span></button>'
 362+ }
 363+ },
 364+ 'play_head':{ // scrubber
 365+ 'w':0, //special case (takes up remaining space)
 366+ 'o':function(){
 367+ return '<div class="ui-slider ui-slider-horizontal ui-corner-all j-scrubber"' +
 368+ ' style="width:' + ( ctrlBuilder.player_head_length - 30 ) + 'px;"></div>'
 369+ }
 370+ },
 371+ 'time_display':{
 372+ 'w':36,
 373+ 'o':function(){
 374+ return '<div class="k-timer">' + seconds2npt ( ctrlBuilder.embedObj.getDuration() ) + '</div>';
 375+ }
 376+ },
 377+ 'volume_control':{
 378+ 'w':40,
 379+ 'o':function(){
 380+ return '<button class="ui-state-default ui-corner-all k-volume">' +
 381+ '<span class="ui-icon ui-icon-volume-on"></span>' +
 382+ '</button>' +
 383+ '<div class="ui-slider ui-slider-horizontal k-volume-slider"></div>';
 384+
 385+ //vertical volume control:
 386+ /* return '<div title="' + gM('volume_control') + '" id="volume_control_'+ctrlBuilder.id+'" class="ui-state-default ui-corner-all ui-icon_link rButton">' +
 387+ '<span class="ui-icon ui-icon-volume-on"></span>' +
 388+ '<div style="position:absolute;display:none;" id="vol_container_'+ctrlBuilder.id+'" class="vol_container ui-corner-all">' +
 389+ '<div class="volume_bar" id="volume_bar_' + ctrlBuilder.id + '"></div>' +
 390+ '</div>'+
 391+ '</div>';
 392+ */
 393+ }
 394+ },
 395+ 'closed_captions':{
 396+ 'w':24,
 397+ 'o':function(){
 398+ return '<div title="' + gM('closed_captions') + '" id="timed_text_' + ctrlBuilder.id +'" ' +
 399+ 'class="ui-state-default ui-corner-all ui-icon_link rButton">' +
 400+ '<span class="ui-icon ui-icon-comment"></span></div>';
 401+ }
 402+ },
 403+ 'fullscreen':{
 404+ 'w':24,
 405+ 'o':function(){
 406+ return '<button class="ui-state-default ui-corner-all k-fullscreen" title="' + gM('player_fullscreen') + '">' +
 407+ '<span class="ui-icon ui-icon-arrow-4-diag"></span></button>'
 408+ }
 409+ },
 410+ 'options':{
 411+ 'w':50,
 412+ 'o':function(){
 413+ return '<button class="ui-state-default ui-corner-bl k-options" title="'+ gM('player_options') + '" >' +
 414+ '<span class="ui-icon ui-icon-k-menu">'+ gM('menu_btn') + '</span>'
 415+ '</button>'
 416+ }
 417+ }
 418+ }
 419+}
Property changes on: trunk/phase3/js2/mwEmbed/skins/ctrlBuilder.js
___________________________________________________________________
Name: svn:mergeinfo
1420 + /branches/REL1_15/phase3/js2/mwEmbed/skins/baseSkin.js:51646
Index: trunk/phase3/js2/mwEmbed/mv_embed.js
@@ -149,9 +149,9 @@
150150 "$j.Jcrop" : "libClipEdit/Jcrop/js/jquery.Jcrop.js",
151151 "$j.fn.simpleUploadForm": "libAddMedia/simpleUploadForm.js",
152152
153 - "baseSkin" : "skins/baseSkin.js",
154 - "kskin" : "skins/kskin/kskin.js",
155 - "mvpcf" : "skins/mvpcf/mvpcf.js",
 153+ "ctrlBuilder" : "skins/ctrlBuilder.js",
 154+ "kskin" : "skins/kskin/kskin.js",
 155+ "mvpcf" : "skins/mvpcf/mvpcf.js",
156156
157157 "$j.secureEvalJSON" : "jquery/plugins/jquery.secureEvalJSON.js",
158158 "$j.cookie" : "jquery/plugins/jquery.cookie.js",
@@ -540,6 +540,7 @@
541541 [
542542 '$j.ui',
543543 'embedVideo',
 544+ 'ctrlBuilder',
544545 '$j.cookie'
545546 ],
546547 [
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js
@@ -105,427 +105,7 @@
106106 'default',
107107 'lang'
108108 );
109 -//set the dismissNativeWarn flag:
110 -_global['dismissNativeWarn'] = false;
111109
112 -
113 -var ctrlBuilder = {
114 - height:29,
115 - supports:{
116 - 'options':true,
117 - 'borders':true
118 - },
119 - menu_items:[
120 - 'playerselect',
121 - 'download',
122 - 'share',
123 - 'credits',
124 - ],
125 - default_menu_item:'download',
126 - getControls:function( embedObj ){
127 - js_log('f:controlsBuilder:: opt:');
128 - this.id = (embedObj.pc)?embedObj.pc.pp.id:embedObj.id;
129 - this.available_width = embedObj.playerPixelWidth();
130 - //make pointer to the embedObj
131 - this.embedObj = embedObj;
132 - var _this = this;
133 - for(var i in embedObj.supports){
134 - _this.supports[i] = embedObj.supports[i];
135 - };
136 -
137 - //check for close_captions tracks:
138 - if( ( embedObj.roe || embedObj.timedTextSources() )
139 - && embedObj.show_meta_link )
140 - this.supports['closed_captions']=true;
141 -
142 - var o='';
143 - //get the length of the play_head
144 - this.player_head_length = embedObj.playerPixelWidth();
145 - for( var i in this.components ){
146 - if( this.supports[i] ){
147 - if( i != 'play_head'){
148 - this.player_head_length -= this.components[i].w;
149 - }
150 - }
151 - }
152 - for(var i in this.components){
153 - if( this.supports[i] ){
154 - if( this.available_width > this.components[i].w ){
155 - //special case with playhead don't add unless we have 60px
156 - if( i == 'play_head' && this.player_head_length < 60 )
157 - continue;
158 - o+=this.components[i].o();
159 - this.available_width -= this.components[i].w;
160 - }else{
161 - js_log('not enough space for control component:' + i);
162 - }
163 - }
164 - }
165 - return o;
166 - },
167 - /*
168 - * addControlHooks
169 - * to be run once controls are attached to the dom
170 - */
171 - addControlHooks:function( embedObj ){
172 - //add in drag/seek hooks:
173 - if(!embedObj.base_seeker_slider_offset && $j('#mv_seeker_slider_'+embedObj.id).get(0))
174 - embedObj.base_seeker_slider_offset = $j('#mv_seeker_slider_'+embedObj.id).get(0).offsetLeft;
175 -
176 - //js_log('looking for: #mv_seeker_slider_'+embedObj.id + "\n " +
177 - // 'start sec: '+embedObj.start_time_sec + ' base offset: '+embedObj.base_seeker_slider_offset);
178 -
179 - var $tp=$j('#' + embedObj.id);
180 -
181 - //@todo: which object is being play()'d (or whatever) ?
182 - //We select the element to attach the event to this way:
183 - //$tp.find('.ui-icon-play').parent().click(function(){alert(0)}); or we can give the button itself a class - probably better.
184 -
185 - //add play hook for play-btn and large_play_button
186 - $tp.find('.play-btn,.play-btn-large').unbind().btnBind().click(function(){
187 - $j('#' + embedObj.id).get(0).play();
188 - })
189 - //add recomend firefox if non-native playback:
190 - if( embedObj.doNativeWarningCheck() ){
191 - $j('#dc_'+ embedObj.id).hover(
192 - function(){
193 - if($j('#gnp_' + embedObj.id).length==0){
194 - $j(this).append('<div id="gnp_' + embedObj.id + '" class="ui-state-highlight ui-corner-all" ' +
195 - 'style="position:absolute;display:none;background:#FFF;top:10px;left:10px;right:10px;height:60px;">' +
196 - gM('mv_for_best_experience') +
197 - '<br><input id="ffwarn_'+embedObj.id+'" type=\"checkbox\">' +
198 - gM('mv_do_not_warn_again') +
199 - '</div>');
200 - $j('#ffwarn_'+embedObj.id).click(function(){
201 - if( $j(this).is(':checked') ){
202 - //set up a cookie for 5 days:
203 - $j.cookie('dismissNativeWarn', true, { expires: 5 });
204 - //set the current instance
205 - _global['dismissNativeWarn'] = true;
206 - $j('#gnp_' + embedObj.id).fadeOut('slow');
207 - }else{
208 - _global['adismissNativeWarn'] = false;
209 - $j.cookie('dismissNativeWarn', false);
210 - }
211 -
212 - });
213 - }
214 - if( ($j.cookie('dismissNativeWarn') !== true) &&
215 - _global['dismissNativeWarn'] === false ){
216 - $j('#gnp_' + embedObj.id).fadeIn('slow');
217 - }
218 - },
219 - function(){
220 - $j('#gnp_' + embedObj.id).fadeOut('slow');
221 - }
222 - );
223 - }
224 -
225 - if( $j.browser.msie && $j.browser.version <= 6){
226 - $j('#big_play_link_' + embedObj.id).pngFix();
227 - }
228 -
229 - //captions binding:
230 - $j('#timed_text_' + embedObj.id).unbind().btnBind().click(function(){
231 - $j('#' + embedObj.id).get(0).showTextInterface();
232 - });
233 -
234 - //options binding:
235 - $j('#options_button_' + embedObj.id).unbind().btnBind().click(function(){
236 - $j('#' +embedObj.id).get(0).doOptionsHTML();
237 - });
238 -
239 - //fullscreen binding:
240 - $j('#fullscreen_' + embedObj.id).unbind().btnBind().click(function(){
241 - $j('#' +embedObj.id).get(0).fullscreen();
242 - });
243 -
244 - js_log(" should add slider binding: " + $j('#mv_play_head_'+embedObj.id).length) ;
245 -// $j('#mv_play_head_'+embedObj.id).slider({
246 - $tp.find( '.j-scrubber' ).slider({
247 - range: "min",
248 - value: 0,
249 - min: 0,
250 - max: 1000,
251 - start: function(event, ui){
252 - var id = (embedObj.pc!=null)?embedObj.pc.pp.id:embedObj.id;
253 - embedObj.userSlide=true;
254 - $j('#big_play_link_'+id).fadeOut('fast');
255 - //if playlist always start at 0
256 - embedObj.start_time_sec = (embedObj.instanceOf == 'mvPlayList')?0:
257 - npt2seconds(embedObj.getTimeReq().split('/')[0]);
258 - },
259 - slide: function(event, ui) {
260 - var perc = ui.value/1000;
261 - embedObj.jump_time = seconds2npt( parseFloat( parseFloat(embedObj.getDuration()) * perc ) + embedObj.start_time_sec);
262 - //js_log('perc:' + perc + ' * ' + embedObj.getDuration() + ' jt:'+ this.jump_time);
263 - embedObj.setStatus( gM('seek_to')+' '+embedObj.jump_time );
264 - //update the thumbnail / frame
265 - if(embedObj.isPlaying==false){
266 - embedObj.updateThumbPerc( perc );
267 - }
268 - },
269 - change:function(event, ui){
270 - //only run the onChange event if done by a user slide:
271 - if(embedObj.userSlide){
272 - embedObj.userSlide=false;
273 - embedObj.seeking=true;
274 - //stop the monitor timer (if we can)
275 - if(embedObj.stopMonitor)
276 - embedObj.stopMonitor();
277 -
278 - var perc = ui.value/1000;
279 - //set seek time (in case we have to do a url seek)
280 - embedObj.seek_time_sec = npt2seconds( embedObj.jump_time, true );
281 - js_log('do jump to: '+embedObj.jump_time + ' perc:' +perc + ' sts:' + embedObj.seek_time_sec);
282 - embedObj.doSeek(perc);
283 - }
284 - }
285 - });
286 - //@todo: identify problem with volume button jumping...
287 - $tp.find('.k-volume-slider').slider({
288 - range: "min",
289 - value: 80,
290 - min: 0,
291 - max: 100,
292 - slide: function(event, ui) {
293 - embedObj.updateVolumen(ui.value/100);
294 - },
295 - change: function(event, ui){
296 - var level = ui.value/100;
297 - if (level==0) {
298 - $tp.find('.k-volume span').addClass('ui-icon-volume-off');
299 - }else{
300 - $tp.find('.k-volume span').removeClass('ui-icon-volume-off');
301 - }
302 - //only run the onChange event if done by a user slide:
303 - if(embedObj.userSlide){
304 - embedObj.userSlide=false;
305 - embedObj.seeking=true;
306 -// var perc = ui.value/100;
307 - embedObj.updateVolumen(level);
308 - }
309 - }
310 - });
311 - //up the z-index of the default status indicator:
312 -// $j('#mv_play_head_'+embedObj.id + ' .ui-slider-handle').css('z-index', 4);
313 -// $j('#mv_play_head_'+embedObj.id + ' .ui-slider-range').addClass('ui-corner-all').css('z-index', 2);
314 - //extended class list for jQuery ui themeing (we can probably refactor this with custom buffering highliter)
315 - $j('#' + embedObj.id + ' .j-scrubber').prepend( ctrlBuilder.getMvBufferHtml() );
316 -
317 -
318 - //adds options and bindings: (we do this onClick for faster vidoe tag startup times)
319 - var addMvOptions = function(){
320 - if($j('#' + embedObj.id + ' .k-menu').length != 0 )
321 - return false;
322 -
323 - $j('#' + embedObj.id).prepend( ctrlBuilder.components['mv_embedded_options'].o( embedObj ) );
324 -
325 - //by default its hidden:
326 - $tp.find('.k-menu').hide();
327 -
328 - //output menu-items:
329 - for(i=0; i < ctrlBuilder.menu_items.length ; i++){
330 - $tp.find('.k-' + ctrlBuilder.menu_items[i] + '-btn').click(function(){
331 - var mk = $j(this).attr('rel');
332 - $target = $j('#' + embedObj.id + ' .menu-'+mk).hide();
333 - //gennerate the menu html not already done:
334 - if( $target.children().length == 0 ){
335 - //call the function show{Menuitem} with target:
336 - embedObj['show' + mk.charAt(0).toUpperCase() + mk.substring(1)](
337 - $j('#' + embedObj.id + ' .menu-'+mk)
338 - );
339 - }
340 - //slide out the others
341 - $j('#' + embedObj.id + ' .menu-screen').hide();
342 - $target.fadeIn("fast");
343 - //don't follow the # link
344 - return false;
345 - });
346 - }
347 - }
348 -
349 - //options menu display:
350 - $tp.find('.k-options').click(function(){
351 - if($j('#' + embedObj.id + ' .k-menu').length == 0 )
352 - addMvOptions();
353 - //set up the text and menu:
354 - var $ktxt = $j(this).find('.ui-icon-k-menu');
355 - var $kmenu = $tp.find('.k-menu');
356 - if( $kmenu.is(':visible') ){
357 - $kmenu.fadeOut("fast",function(){
358 - $ktxt.html ( gM('menu_btn') );
359 - });
360 - $tp.find('.play-btn-large').fadeIn('fast');
361 - }else{
362 - $kmenu.fadeIn("fast", function(){
363 - $ktxt.html ( gM('close_btn') );
364 - });
365 - $tp.find('.play-btn-large').fadeOut('fast');
366 - }
367 - });
368 -
369 - //volume binding:
370 - $tp.find('.k-volume').unbind().btnBind().click(function(){
371 - $tp.toggleMute();
372 - });
373 -
374 - var hoverOverDelay=false;
375 - /*$j('#volume_control_'+embedObj.id).unbind().btnBind().click(function(){
376 - $j('#' +embedObj.id).get(0).toggleMute();
377 - });
378 - .hover(
379 - function(){
380 - $j('#vol_container_' + embedObj.id).addClass('vol_container_top');
381 - //set to "below" if playing and embedType != native
382 - if(embedObj && embedObj.isPlaying() && !embedObj.supports['overlays']){
383 - $j('#vol_container_' + embedObj.id).removeClass('vol_container_top').addClass('vol_container_below');
384 - }
385 -
386 - $j('#vol_container_' + embedObj.id).fadeIn('fast');
387 - hoverOverDelay = true;
388 - },
389 - function(){
390 - hoverOverDelay= false;
391 - setTimeout(function doHideVolume(){
392 - if(!hoverOverDelay){
393 - $j('#vol_container_' + embedObj.id).fadeOut('fast');
394 - }
395 - }, 500);
396 - }
397 - );
398 - //Volumen Slider
399 - $j('#volume_bar_'+embedObj.id).slider({
400 - orientation: "vertical",
401 - range: "min",
402 - value: 80,
403 - min: 0,
404 - max: 100,
405 - slide: function(event, ui) {
406 - var perc = ui.value/100;
407 - //js_log('update volume:' + perc);
408 - embedObj.updateVolumen(perc);
409 - },
410 - change:function(event, ui){
411 - var perc = ui.value/100;
412 - if (perc==0) {
413 - $j('#volume_control_'+embedObj.id + ' span').removeClass('ui-icon-volume-on').addClass('ui-icon-volume-off');
414 - }else{
415 - $j('#volume_control_'+embedObj.id + ' span').removeClass('ui-icon-volume-off').addClass('ui-icon-volume-on');
416 - }
417 - //only run the onChange event if done by a user slide:
418 - if(embedObj.userSlide){
419 - embedObj.userSlide=false;
420 - embedObj.seeking=true;
421 - var perc = ui.value/100;
422 - embedObj.updateVolumen(perc);
423 - }
424 - }
425 - });*/
426 -
427 - },
428 - getMvBufferHtml:function(){
429 - return '<div class="ui-slider-horizontal ui-corner-all ui-slider-buffer" />';
430 - },
431 - components:{
432 - 'borders':{
433 - 'w':8,
434 - 'o':function(){
435 - return '';
436 - }
437 - },
438 - 'mv_embedded_options':{
439 - 'w':0,
440 - 'o':function( embedObj ){
441 - var o= '' +
442 - '<div class="k-menu ui-widget-content" ' +
443 - 'style="width:' + embedObj.playerPixelWidth() + 'px; height:' + embedObj.playerPixelHeight() + 'px;">' +
444 - '<ul class="k-menu-bar">';
445 - //output menu item containers:
446 - for(i=0; i < ctrlBuilder.menu_items.length; i++){
447 - var mk = ctrlBuilder.menu_items[i];
448 - o+= '<li class="k-' + mk + '-btn" rel="'+mk+'">' +
449 - '<a href="#" title="' + gM( mk ) +'">' + gM( mk ) +'</a></li>';
450 - }
451 - o+='</ul>' +
452 - //we have to substract the width of the k-menu-bar
453 - '<div class="k-menu-screens" style="width:' + ( embedObj.playerPixelWidth() -75) +
454 - 'px; height:' + (embedObj.playerPixelHeight() - ctrlBuilder.height) + 'px;">';
455 -
456 - //output menu item containers:
457 - for(i=0; i < ctrlBuilder.menu_items.length; i++){
458 - o+= '<div class="menu-screen menu-' + ctrlBuilder.menu_items[i] + '"></div>';
459 - }
460 -
461 - '</div>' +
462 - '</div>';
463 - return o;
464 - }
465 - },
466 - 'pause':{
467 - 'w':28, //28 147
468 - 'o':function(){
469 - return '<button class="play-btn ui-state-default ui-corner-all" title="' +
470 - gM('play_clip') + '" ><span class="ui-icon ui-icon-play"></span></button>'
471 - }
472 - },
473 - 'play_head':{ // scrubber
474 - 'w':0, //special case (takes up remaining space)
475 - 'o':function(){
476 - return '<div class="ui-slider ui-slider-horizontal ui-corner-all j-scrubber"' +
477 - ' style="width:' + ( ctrlBuilder.player_head_length - 30 ) + 'px;"></div>'
478 - }
479 - },
480 - 'time_display':{
481 - 'w':36,
482 - 'o':function(){
483 - return '<div class="k-timer">' + seconds2npt ( ctrlBuilder.embedObj.getDuration() ) + '</div>';
484 - }
485 - },
486 - 'volume_control':{
487 - 'w':40,
488 - 'o':function(){
489 - return '<button class="ui-state-default ui-corner-all k-volume">' +
490 - '<span class="ui-icon ui-icon-volume-on"></span>' +
491 - '</button>' +
492 - '<div class="ui-slider ui-slider-horizontal k-volume-slider"></div>';
493 -
494 - //vertical volume control:
495 - /* return '<div title="' + gM('volume_control') + '" id="volume_control_'+ctrlBuilder.id+'" class="ui-state-default ui-corner-all ui-icon_link rButton">' +
496 - '<span class="ui-icon ui-icon-volume-on"></span>' +
497 - '<div style="position:absolute;display:none;" id="vol_container_'+ctrlBuilder.id+'" class="vol_container ui-corner-all">' +
498 - '<div class="volume_bar" id="volume_bar_' + ctrlBuilder.id + '"></div>' +
499 - '</div>'+
500 - '</div>';
501 - */
502 - }
503 - },
504 - 'closed_captions':{
505 - 'w':24,
506 - 'o':function(){
507 - return '<div title="' + gM('closed_captions') + '" id="timed_text_' + ctrlBuilder.id +'" ' +
508 - 'class="ui-state-default ui-corner-all ui-icon_link rButton">' +
509 - '<span class="ui-icon ui-icon-comment"></span></div>';
510 - }
511 - },
512 - 'fullscreen':{
513 - 'w':24,
514 - 'o':function(){
515 - return '<button class="ui-state-default ui-corner-all k-fullscreen" title="' + gM('player_fullscreen') + '">' +
516 - '<span class="ui-icon ui-icon-arrow-4-diag"></span></button>'
517 - }
518 - },
519 - 'options':{
520 - 'w':50,
521 - 'o':function(){
522 - return '<button class="ui-state-default ui-corner-bl k-options" title="'+ gM('player_options') + '" >' +
523 - '<span class="ui-icon ui-icon-k-menu">'+ gM('menu_btn') + '</span>'
524 - '</button>'
525 - }
526 - }
527 - }
528 -}
529 -
530110 /*
531111 * Converts all occurrences of <video> tag into video object
532112 */
@@ -601,7 +181,11 @@
602182 mvEmbed.swapEmbedVideoElement(this, plObj);
603183 var added_height = plObj.pl_layout.title_bar_height + plObj.pl_layout.control_height;
604184 //move into a blocking display container with height + controls + title height:
605 - $j('#'+plObj.id).wrap('<div style="display:block;height:' + (plObj.height + added_height) + 'px;"></div>');
 185+ $j('#'+plObj.id).wrap('<div style="display:block;' +
 186+ 'height:' + (plObj.height + added_height) + 'px;' +
 187+ 'width:' + parseInt(this.width) + 'px;" ' +
 188+ 'id="k-player_' + this.id + '" class="k-player ui-widget">' +
 189+ '</div>');
606190 });
607191 });
608192 }
@@ -1758,7 +1342,9 @@
17591343 //block out some space by encapulating the top level div
17601344 if($j(this).parents('.k-player').length==0){
17611345 $j(this).wrap('<div style="width:'+parseInt(this.width)+'px;height:'
1762 - + (parseInt(this.height) + ctrlBuilder.height )+'px" id="k-player_' + this.id + '" class="k-player ui-widget"></div>');
 1346+ + (parseInt(this.height) + ctrlBuilder.height )+'px" ' +
 1347+ 'id="k-player_' + this.id + '" class="k-player ui-widget"></div>'
 1348+ );
17631349 }
17641350 }
17651351

Status & tagging log