public
Description: An embedded media player plugin for Firefox that leverages Moonlight to provide native Windows Media support for Linux.
Homepage: http://go-mono.com/moonlight
Clone URL: git://github.com/abock/moonshine.git
jstedfast (author)
Wed Sep 02 12:33:04 -0700 2009
Aaron Bockover (committer)
Wed Sep 02 12:53:06 -0700 2009
moonshine / player / moonshine-full-screen-button.js
100644 61 lines (50 sloc) 2.09 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// This file is licensed under the MIT X11 open source license.
// http://www.opensource.org/licenses/mit-license.php
//
// Authors: Aaron Bockover <abockover@novell.com>
//
// Copyright 2009 Novell, Inc.
//
 
function MoonshineFullScreenButton () {
    MtkButton.call (this);
    
    this.Override ("OnRealize", function () {
        this.$OnRealize$ ();
        if (!this.IsRealized) {
            return;
        }
        
        this.Icon = new MtkXaml ('\
<Canvas Width="16" Height="16"> \
<Path Width="14" Height="14" Canvas.Left="1" Canvas.Top="1" Opacity="1" Data=" \
M6,0 L0,0 L0,6 Z \
M0,8 L0,14 L6,14 Z \
M8,14 L14,14 L14,8 Z \
M14,6 L14,0 L8,0 Z \
"/> \
<Path Width="14" Height="14" Canvas.Left="1" Canvas.Top="1" Opacity="0" Data=" \
M6,6 L6,0 L0,6 Z \
M6,8 L6,14 L0,8 Z \
M8,8 L8,14 L14,8 Z \
M8,0 L8,6 L14,6 Z \
"/> \
</Canvas> \
');
    
        var fill = MtkStyle.CreateLinearGradient (this, [ 0, 0.5, 0.5, 1], [
            MtkColor.SetOpacity (MtkStyle.Colors.button_fg.normal, 0xaa),
            MtkColor.SetOpacity (MtkStyle.Colors.button_fg.normal, 0xcc),
            MtkColor.SetOpacity (MtkStyle.Colors.button_fg.normal, 0xdd),
            MtkColor.SetOpacity (MtkStyle.Colors.button_fg.normal, 0xf0)
        ]);
        
        for (var i = 0; i < 2; i++) {
            this.Icon.Xaml.Children.GetItem (i).Fill = fill;
        }
        
        this.Screen.AddEventListener ("FullScreenChanged", delegate (this, function () {
            var fs = this.Screen.GetFullScreen ();
            this.Icon.Xaml.Children.GetItem (0).Opacity = fs ? 0 : 1;
            this.Icon.Xaml.Children.GetItem (1).Opacity = fs ? 1 : 0;
        }));
        
        this.Add (this.Icon);
    });
    
    this.Override ("OnActivated", function () this.Screen.ToggleFullScreen ());
    
    this.AfterConstructed ();
}