Projet

Général

Profil

Paste
Télécharger (3,49 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / bluemasters / template.php @ 503b3f7b

1
<?php 
2

    
3
/** 
4
* Override or insert variables into the html template. 
5
*/ 
6
function bluemasters_preprocess_html(&$variables) {
7
        if (!theme_get_setting('responsive_respond','bluemasters')):
8
        drupal_add_css(path_to_theme() . '/css/basic-layout.css', array('group' => CSS_THEME, 'browsers' => array('IE' => '(lte IE 8)&(!IEMobile)', '!IE' => FALSE), 'preprocess' => FALSE));
9
        endif;
10
}
11

    
12

    
13
/**
14
 * Add javascript files for jquery slideshow.
15
 */
16
if (theme_get_setting('slideshow_js','bluemasters')):
17

    
18
        drupal_add_js(drupal_get_path('theme', 'bluemasters') . '/js/jquery.flexslider-min.js');
19

    
20
        //Initialize slideshow using theme settings
21
    $effect=theme_get_setting('slideshow_effect','bluemasters');
22
    $effect_time= (int) theme_get_setting('slideshow_effect_time','bluemasters')*1000;
23
    $slideshow_controls=theme_get_setting('slideshow_controls','bluemasters');
24
    $slideshow_random=theme_get_setting('slideshow_random','bluemasters');
25
    $slideshow_pause=theme_get_setting('slideshow_pause','bluemasters');
26
    $slideshow_touch=theme_get_setting('slideshow_touch','bluemasters');
27
    $animation_time= (int) theme_get_setting('slideshow_animation_time','bluemasters')*1000;
28

    
29
        drupal_add_js('
30
                jQuery.noConflict();
31
                jQuery(document).ready(function($){
32

33
                        $(window).load(function() {
34

35
                                $(".flexslider").fadeIn("slow");
36

37
                                $(".flexslider").flexslider({ 
38
                                animationLoop: true,                                          
39
                                animation: "'.$effect.'",
40
                                animationSpeed: "'.$animation_time.'",
41
                                controlNav: '.$slideshow_controls.',
42
                                directionNav: false,
43
                                touch: '.$slideshow_touch.',
44
                                pauseOnHover: '.$slideshow_pause.',  
45
                                slideshowSpeed: '.$effect_time.',
46
                                randomize: '.$slideshow_random.',
47
                                controlsContainer: "#slideshow",
48
                                });
49
                        });
50
                });  /* JQUERY ENDS */',
51
                array('type' => 'inline', 'scope' => 'footer', 'weight' => 5));
52

    
53
endif;
54

    
55

    
56
/**
57
 * Page alter.
58
 */
59
function bluemasters_page_alter($page) {
60

    
61
        if (theme_get_setting('responsive_meta','bluemasters')):
62
                $mobileoptimized = array(
63
                        '#type' => 'html_tag',
64
                        '#tag' => 'meta',
65
                        '#attributes' => array(
66
                        'name' =>  'MobileOptimized',
67
                        'content' =>  'width'
68
                        )
69
                );
70

    
71
                $handheldfriendly = array(
72
                        '#type' => 'html_tag',
73
                        '#tag' => 'meta',
74
                        '#attributes' => array(
75
                        'name' =>  'HandheldFriendly',
76
                        'content' =>  'true'
77
                        )
78
                );
79

    
80
                $viewport = array(
81
                        '#type' => 'html_tag',
82
                        '#tag' => 'meta',
83
                        '#attributes' => array(
84
                        'name' =>  'viewport',
85
                        'content' =>  'width=device-width, initial-scale=1'
86
                        )
87
                );
88

    
89
                drupal_add_html_head($mobileoptimized, 'MobileOptimized');
90
                drupal_add_html_head($handheldfriendly, 'HandheldFriendly');
91
                drupal_add_html_head($viewport, 'viewport');
92
        endif;
93
}
94

    
95

    
96
/**
97
 * Add Javascript for responsive mobile menu
98
 */
99
if (theme_get_setting('responsive_menu_state','bluemasters')) {
100

    
101
$responsive_menu_switchwidth= (int) theme_get_setting('responsive_menu_switchwidth','bluemasters');
102
$responsive_menu_topoptiontext=theme_get_setting('responsive_menu_topoptiontext','bluemasters');
103
drupal_add_js(array('bluemasters' => array('topoptiontext' => $responsive_menu_topoptiontext)), 'setting');
104

    
105
drupal_add_js(drupal_get_path('theme', 'bluemasters') .'/js/jquery.mobilemenu.min.js');
106
drupal_add_js('
107
jQuery(document).ready(function($) {
108

109
        $("#navigation > ul.menu, #navigation ul.sf-menu, #navigation .content > ul.menu").mobileMenu({
110
        prependTo: "#navigation",
111
        combine: false,
112
    switchWidth: '.$responsive_menu_switchwidth.',
113
    topOptionText: Drupal.settings.bluemasters[\'topoptiontext\']
114
        });
115

116
});', array('type' => 'inline', 'scope' => 'footer', 'weight' => 10)
117
);
118
}
119

    
120
?>