~ubuntu-it-www/ubuntu-it-www/www-test-repo

« back to all changes in this revision

Viewing changes to www/tour/13.04/js/systemmenu.js

  • Committer: Emanuele Boncimino
  • Date: 2013-05-21 15:24:36 UTC
  • Revision ID: almaidinajad@hotmail.it-20130521152436-lkfhdhg2dw1mlowx
Aggiornato tour 13.04

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
        var locked = false;
13
13
        var menuScrollAmount = 0;
14
14
        var scrolling = false;
 
15
        var selectedMenu;
15
16
        
16
17
        this.init = function(){
17
 
                 $("#menu").mouseover(function(e){
18
 
                        if(menuTimeout != null){
19
 
                                        clearInterval(menuTimeout);
20
 
                                        menuTimeout = null;
21
 
                        }
22
 
             });
23
18
             
24
19
             $('#menu ul li').mouseover(function() {
25
20
                                $('#tooltip-text').text($(this).text());
29
24
             
30
25
             $('#menu ul li').click(function() {
31
26
                var theClass = $(this).attr("class").replace(' bottom','');
32
 
                theClass = theClass.replace(' temp', '');
 
27
                theClass = theClass.replace(' temp', '').replace(' glow', '');
33
28
                _this.handleMenuClick(theClass);
34
29
             });
35
30
             
40
35
        }
41
36
        
42
37
        this.resize = function(){
43
 
                var menuHeight = $(window).height() - 74;
 
38
                var menuHeight = $(window).height() - 24;
44
39
                $("#menu").css('height',menuHeight);
45
40
                this.scrollCheck();             
46
41
        }
97
92
        }
98
93
        
99
94
        this.handleMenuClick = function($menu){
 
95
                if($menu != 'dash'){
 
96
                        selectedMenu = $menu;
 
97
                }
100
98
                switch($menu){
101
99
                        case 'dash':
 
100
                                $('#menu .selected-window-arrow').hide();
 
101
                                $('#menu .dash .selected-window-arrow').show();
102
102
                                _parent.systemOverlay.open();
103
103
                        break;
104
104
                        case 'home':
218
218
                        break;
219
219
                }
220
220
                $("#menu ul li."+$menu+" img.open-arrow").show();
 
221
                var $currentBackground = $("#menu ul li."+$menu).css('background-image');
 
222
                if($menu != 'dash' && $menu != 'rubbish' && $currentBackground.indexOf('-active') == -1){
 
223
                        $indexLastSlash = $currentBackground.lastIndexOf('.');
 
224
                        $newBackgroundLink = $currentBackground.substr(0,$indexLastSlash) + '-active.png';
 
225
                        $("#menu ul li."+$menu).css('background-image',$newBackgroundLink);
 
226
                }
 
227
        }
 
228
        
 
229
        this.getSelectedMenu = function() {
 
230
                return selectedMenu;
221
231
        }
222
232
        
223
233
        this.increaseFullscreen = function(){
224
 
                _parent.systemSettings.increaseFullscreen();
 
234
                //_parent.systemSettings.increaseFullscreen();
225
235
        }
226
236
        
227
237
        this.decreaseFullscreen = function(){
228
 
                _parent.systemSettings.decreaseFullscreen();
 
238
                //_parent.systemSettings.decreaseFullscreen();
229
239
        }
230
240
        
231
241
        this.wiggle = function($icon){
232
242
                $('#menu').css('overflow','visible');
233
243
                _parent.noWIndowSelected();
234
 
                $("#menu ul li."+$icon).stop(true,false).animate({"marginLeft": "30px"}, "1000") .animate({"marginLeft": "0px"}, "1000", function(){ $('#menu').css('overflow','hidden'); });
 
244
                //$("#menu ul li."+$icon).stop(true,false).animate({"marginLeft": "30px"}, "1000") .animate({"marginLeft": "0px"}, "1000", function(){ $('#menu').css('overflow','hidden'); });
 
245
                $("#menu ul li."+$icon).addClass('glow').delay(600).queue(function(next){
 
246
                    $(this).removeClass("glow");
 
247
                    next();
 
248
                });
 
249
 
235
250
        }
236
251
        
237
252
        this.closeWindow = function($icon){
238
253
                $("#menu ul li."+$icon+" img").hide();
 
254
                var $currentBackground = $("#menu ul li."+$icon).css('background-image');
 
255
                $("#menu ul li."+$icon).css('background-image',$currentBackground.replace('-active',''));
239
256
                if($("#menu ul li."+$icon).hasClass('temp')){
240
257
                        $("#menu ul li."+$icon).hide();
241
258
                }
253
270
                this.scrollCheck();
254
271
        }
255
272
        
256
 
        this.triggerMenuOut = function() {
257
 
                        if(!locked){
258
 
                                goingIn = false;
259
 
                                menuOut = true;
260
 
                                $('#menu').animate({
261
 
                                                left: '0px'
262
 
                                 }, 300, function() {
263
 
                                                
264
 
                                 });
265
 
                        }
266
 
        }
267
 
        
268
 
        this.triggerMenuIn = function() {
269
 
                if(!locked){
270
 
                        goingIn = true;
271
 
                        menuTimeout = setTimeout(function() {
272
 
                        $('#menu').animate({
273
 
                                                left: '-70px'
274
 
                                 }, 300, function() {
275
 
                                                menuOut = false;
276
 
                                                menuTimeout = null;
277
 
                                 });
278
 
                        }, 1000);
279
 
                }
280
 
        }
281
 
        
282
 
        this.triggerJumpIn = function() {
283
 
                if(!locked){
284
 
                        goingIn = true;
285
 
                        menuTimeout = setTimeout(function() {
286
 
                        $('#menu').animate({
287
 
                                                left: '-70px'
288
 
                                 }, 300, function() {
289
 
                                                menuOut = false;
290
 
                                                menuTimeout = null;
291
 
                                 });
292
 
                        });
293
 
                }
294
 
        }
295
 
        
296
 
        this.setLocked = function($locked){
297
 
                locked = $locked;
298
 
        }
299
 
        
300
 
        this.menuGoingIn = function(){
301
 
                return goingIn;
302
 
        }
303
 
        
304
 
        this.isRunning = function(){
305
 
                return (menuTimeout != null);
306
 
        }
307
 
        
308
 
        this.getTimer = function(){
309
 
                return menuTimeout;
310
 
        }
311
 
        
312
 
        this.isMenuOut = function(){
313
 
                return menuOut;
314
 
        }
315
 
        
316
273
}
317
274
 
318
275
function scrollUp(){
322
279
}
323
280
        
324
281
function scrollDown(){
325
 
        var maxscroll =  ($(window).height() - 74) - ($('#menu ul .rubbish').position().top + $('#menu ul .rubbish').height() + 30);
 
282
        var maxscroll =  ($(window).height() - 24) - ($('#menu ul .rubbish').position().top + $('#menu ul .rubbish').height() + 30);
326
283
        var pos = Math.max(maxscroll ,Math.min(0,$('#menu ul').position().top - 5));
327
284
        $('#menu ul').css('top',pos+'px');
328
285
        scrollingTimer = setTimeout("scrollDown()",50);