~cm-t/ubuntu-fr-tour/ubuntu-fr-tour

« back to all changes in this revision

Viewing changes to 13.04/js/movieplayersystem.js

  • Committer: cm-t arudy
  • Date: 2013-10-22 01:24:09 UTC
  • Revision ID: arudy@ubuntu-fr.org-20131022012409-3dmo4i9u4ufohe5f
First Fr push to 13.10
Fixed many icons (updated to new version or fixed graphic)
Added Cloud indicator
Added Keyboard uindicator
Fixed many layout to fit Fr string

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  Movie Player System
3
 
 *  author: Anthony Dillon
4
 
 */
5
 
 
6
 
function MoviePlayerSystem($parent){
7
 
        
8
 
        var _parent = $parent;
9
 
        var _this = this;
10
 
        var _isOpen = false;
11
 
        var maximised = false;
12
 
        var minified = false;
13
 
        var movieURL = 'videos/iStock.flv';
14
 
        
15
 
        this.init = function(){
16
 
                this.setupControl();
17
 
        }
18
 
        
19
 
        this.setupControl = function(){
20
 
                $('#movieplayer  .control .close').click(function(){
21
 
                        _this.close();
22
 
                });
23
 
                $('#movieplayer  .control .min').click(function(){
24
 
                        _this.min();
25
 
                });
26
 
                
27
 
                $('#movieplayer  .control .max').click(function(){
28
 
                        if(maximised){
29
 
                                maximised = false;
30
 
                                $('#movieplayer').css('width','700px');
31
 
                                $('#movieplayer').css('height','497px');
32
 
                                $('#movieplayer').removeClass('fullsize');
33
 
                                _parent.systemSettings.decreaseFullscreen();
34
 
                        }else{
35
 
                                maximised = true;
36
 
                                $('#movieplayer').css('width',$(document).width() - 70 + 'px');
37
 
                                $('#movieplayer').css('height',$(document).height() - 50 + 'px');
38
 
                                $('#movieplayer').addClass('fullsize');
39
 
                                _parent.systemSettings.increaseFullscreen();
40
 
                        }
41
 
                        _this.resize();
42
 
                });
43
 
                $('#movieplayer .container .tools .controlbuttons .left .play').click(function(){
44
 
                        playClicked();
45
 
                });
46
 
        }
47
 
        
48
 
        this.addVideo = function(){
49
 
                var videoObject = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"  width="'+$('#movieplayer .container .video').width()+'" height="'+$('#movieplayer .container .video').height()+'"  id="videoPlayer"><param name="movie"  value="../videoplayer.swf" />         <param name="wmode" value="transparent" />  <param name="quality" value="high" />               <param name="bgcolor" value="#000000" />                <embed wmode="transparent" src="../videoplayer.swf" quality="high" bgcolor="#000000" width="'+$('#movieplayer .container .video').width()+'" height="'+$('#movieplayer .container .video').height()+'"  name="videoPlayer" align="" type="application/x-shockwave-flash"  pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed></object>'; 
50
 
                $('#movieplayer .container .video').html(videoObject);
51
 
        }
52
 
        
53
 
        this.removeVideo = function(){
54
 
                $('#movieplayer .container .video').html('');
55
 
        }
56
 
        
57
 
        this.open = function($playvideo){
58
 
                if(!_isOpen){
59
 
                        this.resize();
60
 
                        this.center();
61
 
                        $('#movieplayer').show();
62
 
                }
63
 
                $('#movieplayer').mousedown();
64
 
                _parent.systemMenu.openWindow('movieplayer');
65
 
                _isOpen = true;
66
 
                if($('css3-container').length > 0){
67
 
                $('#movieplayer').prev().css('top', $('#movieplayer').css('top'));
68
 
                $('#movieplayer').prev().css('left', $('#movieplayer').css('left'));
69
 
        }
70
 
        }
71
 
        
72
 
        this.close = function(){
73
 
                _parent.openWindows['movieplayer'] = false;
74
 
                if(maximised){ _parent.systemSettings.decreaseFullscreen(); }
75
 
                $('#movieplayer ').hide();
76
 
                _parent.systemMenu.closeWindow('movieplayer');
77
 
                $('#movieplayer ').removeClass('fullsize');
78
 
                _this.resize();
79
 
                minified = _isOpen = false;
80
 
                this.removeVideo();
81
 
                _this.center();
82
 
        }
83
 
        
84
 
        this.min = function(){
85
 
                if(maximised){ _parent.systemSettings.decreaseFullscreen(); }
86
 
                $('#movieplayer ').hide();
87
 
                _parent.systemMenu.wiggle('movieplayer');
88
 
                minified = true;
89
 
                _isOpen = false;
90
 
        }
91
 
        
92
 
        this.isMaximised = function(){
93
 
                return maximised;
94
 
        }
95
 
        
96
 
        this.resize = function(){
97
 
                var videoWidth = $('#movieplayer').width();
98
 
                var videoHeight = $('#movieplayer').height();
99
 
                $('#videoPlayer embed').attr('width',videoWidth);
100
 
                $('#videoPlayer').attr('width',videoWidth);
101
 
                $('#videoPlayer').attr('height',videoHeight);
102
 
                $('#videoPlayer embed').attr('height',videoHeight - 27);
103
 
        }
104
 
        
105
 
        this.center = function(){
106
 
        var left = ($(document).width() / 2) - ($('#movieplayer').width() / 2);
107
 
                var top = Math.max(24,($(document).height() / 2) - ($('#movieplayer').height() / 2));
108
 
                $('#movieplayer').css('left',left);
109
 
                $('#movieplayer').css('top',top);
110
 
    }
111
 
}
112
 
 
113
 
function getFlashMovieObject(movieName){
114
 
        if (window.document[movieName]){
115
 
                return window.document[movieName];
116
 
        }
117
 
        if (navigator.appName.indexOf("Microsoft Internet")==-1){
118
 
                if (document.embeds && document.embeds[movieName])
119
 
                        return document.embeds[movieName];
120
 
        }
121
 
        else{
122
 
                return document.getElementById(movieName);
123
 
        }
124
 
}
125
 
 
126
 
function playClicked(){
127
 
        var flashMovie=getFlashMovieObject("videoPlayer");
128
 
        flashMovie.playClicked('fg');
129
 
}