~ya-bo-ng/ubuntu-online-tour/13.10

« back to all changes in this revision

Viewing changes to 13.04/js/ubuntuonesystem.js

  • Committer: Anthony Dillon
  • Date: 2013-10-02 09:35:39 UTC
  • Revision ID: anthony.dillon@canonical.com-20131002093539-ewxr0tx9oi85ppoi
Inishal setup of the 13.10 version of the tour

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* UbuntuOne system
 
3
*  author: Anthony Dillon
 
4
*/
 
5
 
 
6
function UbuntuOneSystem($parent){
 
7
        var _isOpen = false;
 
8
        var _parent = $parent;
 
9
        var _this = this;
 
10
        
 
11
        this.init = function(){
 
12
                $('#ubuntuone-window').hide();
 
13
                $('#ubuntuone-window .control .close').bind('click', function(){
 
14
                        _this.close();
 
15
                });
 
16
                $('#ubuntuone-window .content .body .ubuntuone-buttons .join-now').bind('click', function(){
 
17
                        //_this.close();
 
18
                        //_parent.errorMessage.open();
 
19
                        _this.openUbuntu1Page();
 
20
                });
 
21
                
 
22
                $('#ubuntuone-window .content .body .ubuntuone-buttons .learn-more').bind('click', function(){
 
23
                        _this.openUbuntu1Page();
 
24
                });
 
25
                
 
26
                $('#ubuntuone-window .content .body .ubuntuone-buttons .have-account').bind('click', function(){
 
27
                        _this.openUbuntu1Page();
 
28
                });
 
29
        }
 
30
        
 
31
        this.open = function(){
 
32
                
 
33
                this.center();
 
34
                $('#ubuntuone-window ').show();
 
35
                _isOpen = true;
 
36
                
 
37
                if($('css3-container').length > 0){
 
38
                $('#ubuntuone-window').prev().css('top', $('#ubuntuone-window').css('top'));
 
39
                $('#ubuntuone-window').prev().css('left', $('#ubuntuone-window').css('left'));
 
40
        }
 
41
                
 
42
        }
 
43
        
 
44
        this.openUbuntu1Page = function(){
 
45
                window.open('http://one.ubuntu.com');
 
46
        }
 
47
                
 
48
        this.close = function(){
 
49
                if(_isOpen){
 
50
                        _parent.openWindows['ubuntuone-window'] = false;
 
51
                        $('#ubuntuone-window .control .close').unbind('click');
 
52
                        $('#ubuntuone-window').hide();
 
53
                        _parent.systemMenu.closeWindow('uone');
 
54
                        _isOpen = false;
 
55
                }
 
56
        }
 
57
        
 
58
        this.isOpen = function(){
 
59
                return _isOpen;
 
60
        }
 
61
        
 
62
        this.resize = function(){
 
63
                this.center();
 
64
        }
 
65
        
 
66
        this.center = function(){
 
67
        var left = ($(document).width() / 2) - ($('#ubuntuone-window ').width() / 2);
 
68
                var top = Math.max(24,($(document).height() / 2) - ($('#ubuntuone-window ').height() / 2));
 
69
                $('#ubuntuone-window ').css('left',left);
 
70
                $('#ubuntuone-window ').css('top',top);
 
71
    }
 
72
}
 
 
b'\\ No newline at end of file'