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

« back to all changes in this revision

Viewing changes to 13.04/js/guidedtoursystem.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
 
 *  Guided Tour System
3
 
 *  author: Anthony Dillon
4
 
 */
5
 
 
6
 
function GuidedTourSystem($parent){
7
 
        var _parent = $parent;
8
 
        var _this = this;
9
 
        
10
 
        var browserfilesGuide;
11
 
        var surfthewebGuide;
12
 
        var checkemailGuide;
13
 
        var viewphotosGuide;
14
 
        var findappsGuide;
15
 
        var createdocumentsGuide;
16
 
        var createpresentation;
17
 
        var createspreadsheets;
18
 
        var watchVideosGuide;
19
 
        var arrowClicked = false;
20
 
        
21
 
        var welcomeGuide;
22
 
        
23
 
        var guides;
24
 
        var currentIndex = -1;
25
 
        var guideCount = 0;
26
 
        
27
 
        this.init = function(){
28
 
                homeGuide = {system:'welcome',icon:null, title:null, desc:'We hope you\'ve enjoyed the Ubuntu online tour. <a href="http://www.ubuntu.com/download/ubuntu/download#tour" target="_blank">Ready to download?</a> or <a href="/ubuntu/take-the-tour" >Back to the site</a>', hash: '#'};
29
 
                
30
 
                browserfilesGuide = {system:'home',icon:'img/tourguide/file-small.png', title:'Browse files', desc:'It’s quick and easy to access your folders and files from Ubuntu’s home folder.', hash: 'browser-files'};
31
 
                surfthewebGuide = {system:'firefox',icon:'img/tourguide/firefox-small.png', title:'Surf the web', desc:'Browsing the web is fast and secure with Ubuntu and Firefox.', hash: 'surf-the-web'};
32
 
                checkemailGuide = {system:'email',icon:'img/tourguide/mail-small.png', title:'Check email', desc:'Read, write and send emails with Thunderbird. It’s easy and fast.', hash: 'check-email'};
33
 
                viewphotosGuide = {system:'shotwell',icon:'img/tourguide/shotwell-small.png', title:'View photos', desc:'You can upload, organise, edit and share your photos with Shotwell.', hash: 'view-photos'};
34
 
                findappsGuide = {system:'software',icon:'img/tourguide/apps-small.png', title:'Find apps', desc:'Search and download apps fast from the Ubuntu Software Centre.', hash: 'find-apps'};
35
 
                createdocumentsGuide = {system:'writer',icon:'img/tourguide/document-small.png', title:'Create documents', desc:'LibreOffice Writer makes it easy to draft professional documents.', hash: 'create-documents'};
36
 
                createspreadsheets  = {system:'calc',icon:'img/tourguide/calc-small.png', title:'Create spreadsheets', desc:'LibreOffice Calc has everything you need to create clear and accurate spreadsheets.', hash: 'create-spreadsheets'};
37
 
                createpresentation = {system:'impress',icon:'img/tourguide/impress-small.png', title:'Create presentations', desc:'Make a good impression with the intuitive LibreOffice Impress presentation tool.', hash: 'create-presentations'};
38
 
                watchVideosGuide = {system:'movieplayer',icon:'img/tourguide/impress-small.png', title:'Watch videos', desc:'You can watch all your favourite films and videos, DVDs, downloads or movies youve created yourself.', hash: 'watch-video'};
39
 
                
40
 
                guides = new Array(browserfilesGuide, surfthewebGuide, checkemailGuide, viewphotosGuide, findappsGuide, createdocumentsGuide, createspreadsheets, createpresentation, watchVideosGuide);
41
 
                guideCount = guides.length;
42
 
                $('#tour-guide .next-button').bind('click',function(){
43
 
                        if(!$(this).hasClass('disabled')){
44
 
                                _this.next();
45
 
                        }
46
 
                });
47
 
                
48
 
                $('#tour-guide .prev-button').bind('click',function(){
49
 
                        if(!$(this).hasClass('disabled')){
50
 
                                _this.prev();
51
 
                        }
52
 
                });
53
 
                
54
 
                $('#tour-guide .back-to-download').bind('click', function(){
55
 
                        _parent.errorMessage.open();
56
 
                });
57
 
                
58
 
                this.update();
59
 
        }
60
 
        
61
 
        this.close = function(){
62
 
                _parent.closeAllWindows(closeAllWindows);
63
 
        }
64
 
        
65
 
        this.setSystem = function($system){
66
 
                if($system == 'email-write'){ $system = 'email'; }
67
 
                if(!arrowClicked){
68
 
                        var found = false;
69
 
                        for(i = 0; i < guides.length; i++){
70
 
                                if(guides[i].system == $system){
71
 
                                        this.setCurrentIndex(i);
72
 
                                        found = true;
73
 
                                        break;
74
 
                                }
75
 
                        }
76
 
                        if(!found){ this.setCurrentIndex(-1); }
77
 
                }
78
 
                
79
 
        }
80
 
        
81
 
        this.setIndex = function($index){
82
 
                currentIndex = $index;
83
 
        }
84
 
        
85
 
        this.setCurrentIndex = function($currentIndex, $update){
86
 
                currentIndex = $currentIndex;
87
 
                this.update();
88
 
        }
89
 
        
90
 
        this.next = function(){
91
 
                arrowClicked = true;
92
 
                _parent.closeAllWindows(currentIndex);
93
 
                if (currentIndex == guideCount -1) {
94
 
                        currentIndex = 0;
95
 
                } else {
96
 
                        currentIndex++;
97
 
                }
98
 
                this.update();
99
 
                this.updateHash();
100
 
                _parent.systemMenu.handleMenuClick(guides[currentIndex].system);
101
 
                arrowClicked = false;
102
 
        }
103
 
        
104
 
        this.prev = function(){
105
 
                arrowClicked = true;
106
 
                _parent.closeAllWindows(currentIndex);
107
 
                if (currentIndex == 0) {
108
 
                        currentIndex = guideCount -1;
109
 
                } else {
110
 
                        currentIndex--;
111
 
                }
112
 
                this.update();
113
 
                this.updateHash();
114
 
                _parent.systemMenu.handleMenuClick(guides[currentIndex].system);
115
 
                arrowClicked = false;
116
 
        }
117
 
        
118
 
        this.update = function(){
119
 
                $('#tour-guide .guide-container').hide();
120
 
                
121
 
                if(currentIndex == -1){
122
 
                        //$('#tour-guide .prev-button').hide();
123
 
                        //$('#tour-guide .next-button').hide();
124
 
                        $('#tour-guide .welcome').show();
125
 
                }else{
126
 
                        $('#tour-guide .'+guides[currentIndex].system).show();
127
 
                        $('#tour-guide .prev-button').show();
128
 
                        $('#tour-guide .next-button').show();
129
 
                }
130
 
        }
131
 
 
132
 
        this.updateHash = function() {
133
 
                window.location.hash = guides[currentIndex].hash;
134
 
        }
135
 
}