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

« back to all changes in this revision

Viewing changes to 13.04/12.04/js/libresystem.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
 *  Error Message 
 
3
 *  author: Anthony Dillon
 
4
 */
 
5
 
 
6
function LibreSystem($parent){
 
7
        var _this = this;
 
8
        var _parent = $parent;
 
9
        
 
10
        this.init = function(){
 
11
                $('#libreoffice-calc-window   .control .close').bind('click', function(){
 
12
                        _this.close('calc');
 
13
                });
 
14
                $('#libreoffice-writer-window   .control .close').bind('click', function(){
 
15
                        _this.close('writer');
 
16
                });
 
17
                $('#libreoffice-impress-window   .control .close').bind('click', function(){
 
18
                        _this.close('impress');
 
19
                });
 
20
                $('#libreoffice-calc-window .content').bind('click', function(){
 
21
                        _parent.errorMessage.open();
 
22
                });
 
23
                $('#libreoffice-writer-window .content').bind('click', function(){
 
24
                        _parent.errorMessage.open();
 
25
                });
 
26
                $('#libreoffice-impress-window .content').bind('click', function(){
 
27
                        _parent.errorMessage.open();
 
28
                });
 
29
                
 
30
                this.center('calc');
 
31
                this.center('writer');
 
32
        }
 
33
        
 
34
        this.open = function($type){
 
35
                $('#libreoffice-'+$type+'-window').show();
 
36
                $('#libreoffice-'+$type+'-window ').trigger('mousedown');
 
37
                this.center($type);
 
38
                if($('css3-container').length > 0){
 
39
                $('#libreoffice-'+$type+'-window').prev().css('top', $('#libreoffice-'+$type+'-window').css('top'));
 
40
                $('#libreoffice-'+$type+'-window').prev().css('left', $('#libreoffice-'+$type+'-window').css('left'));
 
41
        }
 
42
        }
 
43
        
 
44
        this.close = function($type){
 
45
                if($('#libreoffice-'+$type+'-window').is(':visible')){
 
46
                        _parent.openWindows['libreoffice-'+$type+'-window'] = false;
 
47
                        $('#libreoffice-'+$type+'-window').hide();
 
48
                        this.center($type);
 
49
                        _parent.systemMenu.closeWindow($type);
 
50
                }
 
51
        }
 
52
        
 
53
        this.center = function($type){
 
54
                var left = ($(document).width() / 2) - ($('#libreoffice-'+$type+'-window').width() / 2);
 
55
                        var top =  Math.max(24,($(document).height() / 2) - ($('#libreoffice-'+$type+'-window').height() / 2));
 
56
                        $('#libreoffice-'+$type+'-window').css('left',left);
 
57
                        $('#libreoffice-'+$type+'-window').css('top',top);
 
58
            }
 
59
}