~joaopinto/apt-portal/pre-modules

« back to all changes in this revision

Viewing changes to applications/playdeb/static/js/page.updates.js

  • Committer: Joao Pinto
  • Date: 2009-06-13 22:45:41 UTC
  • Revision ID: joao.pinto@getdeb.net-20090613224541-g1fpmbb9e9jg5u10
Initial commit for the cherrypy version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Javascript written by Tyler Mulligan
2
 
// http://www.detrition.net
3
 
 
4
 
// Load shadowbox skin
5
 
Shadowbox.loadSkin('classic', '/js/skin'); // use the "classic" skin
6
 
 
7
 
$(document).ready(function() {
8
 
        // Info Box
9
 
        
10
 
        // How to Install
11
 
        if (window.location.hash!="#how_to_install") {  
12
 
                $('#how_to_install .info_content').hide();
13
 
                $('#how_to_install .info_content p').hide();
14
 
                $('#how_to_install .info_content code').hide();
15
 
                $('#how_to_install .info_header h2 a').text("Click here to learn how to install games from PlayDeb");
16
 
 
17
 
                // Cookie to determine showing of info
18
 
                
19
 
                // If the cookie is set, hide the welcome messages
20
 
                if($.cookie('pd_how_to_install')=='true') {
21
 
                        $('#how_to_install').hide();
22
 
                        $('#hide_install').hide();
23
 
                // Null or the user wants to see it again
24
 
                } else if ($.cookie('pd_to_install')=='false') {
25
 
                        //show_info();
26
 
                }
27
 
 
28
 
        }
29
 
 
30
 
        // Genre Dropdown
31
 
        $('#genre li').hover(
32
 
                function(){ $('ul', this).fadeIn('fast'); }, 
33
 
                function() { } 
34
 
        );
35
 
        if (document.all) {
36
 
                $('#genre li').hoverClass ('sfHover');
37
 
        }
38
 
        
39
 
        // Shadowbox
40
 
        var options = {
41
 
        resizeLgImages:     true,
42
 
        displayNav:         true,
43
 
        handleUnsupported:  'remove',
44
 
        enableKeys:                     true
45
 
    };
46
 
 
47
 
    Shadowbox.init(options);
48
 
        
49
 
        // Ratings
50
 
        $('.the_stars :radio.star').rating(); 
51
 
        
52
 
        // Tags
53
 
        $('.add_tag').hide();
54
 
        $('.add_new_tag').click(function () { 
55
 
                $(this).parent().children('.add_tag').fadeIn();
56
 
                return false;
57
 
    });
58
 
        $('.add_tag_submit').click(function () {
59
 
                //$(this).parent('.tags_container').children('.tags').fadeOut();
60
 
                $(this).parent().parent('.tags_container').children('.tags').fadeOut();
61
 
                $(this).parent().fadeOut();
62
 
                // Database requery - then:
63
 
                var newtag = $(this).parent().children('.add_tag_box').val()
64
 
                if (newtag=="") { newtag="new tag!" }
65
 
                $(this).parent().parent('.tags_container').children('.tags').append(", " + newtag );
66
 
                $(this).parent().parent('.tags_container').children('.tags').fadeIn();
67
 
        });
68
 
 
69
 
        // User Action Click Cookie
70
 
        $("#hide_install").click(function(e){
71
 
                // Kept incase of future changes
72
 
                /* if($.cookie('pd_to_install')=='true') {
73
 
                        //show_weclome();
74
 
                } else if ($.cookie('pd_to_install')==null || $.cookie('pd_to_install')=='false') {
75
 
                        //hide_info();
76
 
                } */            
77
 
                hide_info("#how_to_install");
78
 
        });
79
 
 
80
 
});
81
 
 
82
 
// Dropdown Function
83
 
$.fn.hoverClass = function(c) {
84
 
        return this.each(function(){
85
 
                $(this).hover( 
86
 
                        function() { $(this).addClass(c);  },
87
 
                        function() { $(this).removeClass(c); }
88
 
                );
89
 
        });
90
 
};
91
 
 
92
 
// Vertically-center thumbnails
93
 
$(window).load(function(){
94
 
        $('.game .thumb').each(function(){
95
 
                var imageheight = $(this).height();
96
 
                var margin = (209-imageheight)/2;
97
 
                $(this).css('margin-top',margin-5); // -5 because there's 5px to the top
98
 
        });
99
 
});