Projet

Général

Profil

Paste
Télécharger (2,25 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / adminimal_theme / js / adminimal_theme.js @ 87dbc3bf

1
(function($) {
2

    
3
// Define jRespond Media queries.
4
var jRes = jRespond([
5
        {
6
                label: 'mobile',
7
                enter: 0,
8
                exit: 480
9
        },{
10
                label: 'tablet',
11
                enter: 481,
12
                exit: 979
13
        },{
14
                label: 'desktop',
15
                enter: 980,
16
                exit: 9999
17
        }
18
]);
19

    
20
// Modify the Search field for module filter.
21
Drupal.behaviors.adminimal_module_filter_box = {
22
  attach: function (context, settings) {
23
    //Add default hint value using the HTML5 placeholder attribute.
24
    $('input#edit-module-filter-name').attr( "placeholder", Drupal.t('Search') );
25
  }
26
};
27

    
28
// Fix some krumo styling.
29
Drupal.behaviors.krumo_remove_class = {
30
  attach: function (context, settings) {
31
          // Find status messages that has krumo div inside them, and change the classes.
32
    $('#console .messages.status').has("div.krumo-root").removeClass().addClass( "krumo-wrapper" );
33
  }
34
};
35

    
36
// Add media query classes to the body tag.
37
Drupal.behaviors.adminimal_media_queries = {
38
        attach: function (context, settings) {
39
                jRes.addFunc([
40
                        {
41
                                breakpoint: 'mobile',
42
                                        enter: function() {
43
                                                $( "body" ).addClass( "mq-mobile" );
44
                                        },
45
                                        exit: function() {
46
                                                $( "body" ).removeClass( "mq-mobile" );
47
                                        }
48
                        },{
49
                                breakpoint: 'tablet',
50
                                        enter: function() {
51
                                                $( "body" ).addClass( "mq-tablet" );
52
                                        },
53
                                        exit: function() {
54
                                                $( "body" ).removeClass( "mq-tablet" );
55
                                        }
56
                        },{
57
                                breakpoint: 'desktop',
58
                                        enter: function() {
59
                                                $( "body" ).addClass( "mq-desktop" );
60
                                        },
61
                                        exit: function() {
62
                                                $( "body" ).removeClass( "mq-desktop" );
63
                                        }
64
                        }
65
                ]);
66
        }
67
};
68

    
69
// Move the active primary tab on mobile to be displayed last. 
70
Drupal.behaviors.adminimal_move_active_primary_tab = {
71
        attach: function (context, settings) {
72
          // Add primary tabs class to the branding div for the bottom border.
73
    $('#branding').has("ul.tabs.primary").addClass( "has-primary-tabs" );
74

    
75
                // register enter and exit functions for a single breakpoint
76
                jRes.addFunc({
77
                        breakpoint: 'mobile',
78
                                enter: function() {
79
                                        $( "ul.tabs.primary li.active" ).clone().appendTo( "ul.tabs.primary" ).removeClass( "active" ).addClass( "current" );
80
                                        $( "ul.tabs.primary li.active" ).hide();
81
                                },
82
                                exit: function() {
83
                                        $( "ul.tabs.primary li.active" ).show();
84
                                        $( "ul.tabs.primary li.current" ).hide();
85
                                }
86
                });
87
        }
88
};
89

    
90
})(jQuery);