]> git.mxchange.org Git - friendica.git/blob - view/theme/dispy/theme.php
eb70732684770145654ad614fe595fb7185222cb
[friendica.git] / view / theme / dispy / theme.php
1 <?php
2
3 /*
4  * Name: Dispy
5  * Description: <p style="white-space:pre;">            Dispy: Light, Spartan, Sleek, and Functional<br />            Dispy Dark: Dark, Spartan, Sleek, and Functional</p>
6  * Version: 1.2
7  * Author: Simon <http://simon.kisikew.org/>
8  * Maintainer: Simon <http://simon.kisikew.org/>
9  * Screenshot: <a href="screenshot.jpg">Screenshot</a>
10  */
11
12 $a = get_app();
13 $a->theme_info = array(
14     'family' => 'dispy',
15         'version' => '1.2'
16 );
17
18 function dispy_init(&$a) {
19
20     /** @purpose set some theme defaults
21     */
22     $cssFile = null;
23     $colour = false;
24     $colour = get_pconfig(local_user(), "dispy", "colour");
25         $baseurl = $a->get_baseurl($ssl_state);
26
27     if ($colour === false) { $colour = "light"; }
28     if ($colour == "light") {
29                 $colour_path = "/light/";
30                 require_once ('light/theme.php');
31         }
32     if ($colour == "dark") {
33                 $colour_path = "/dark/";
34                 require_once ('dark/theme.php');
35         }
36
37     /** @purpose aside on profile page
38     */
39         if (($a->argv[0] . $a->argv[1]) === ("profile" . $a->user['nickname'])) {
40                 dispy_community_info();
41         }
42
43         $a->page['htmlhead'] .= <<<EOT
44         <script type="text/javascript" src="$baseurl/view/theme/dispy/js/modernizr.custom.2.5.3.min.js"></script>
45         <script type="text/javascript">
46         $(document).ready(function() {
47                 $('.group-edit-icon').hover(
48                         function() {
49                                 $(this).addClass('icon');
50                                 $(this).removeClass('iconspacer'); },
51
52                         function() {
53                                 $(this).removeClass('icon');
54                                 $(this).addClass('iconspacer'); }
55                 );
56
57                 $('.sidebar-group-element').hover(
58                         function() {
59                                 id = $(this).attr('id');
60                                 $('#edit-' + id).addClass('icon');
61                                 $('#edit-' + id).removeClass('iconspacer'); },
62
63                         function() {
64                                 id = $(this).attr('id');
65                                 $('#edit-' + id).removeClass('icon');
66                                 $('#edit-' + id).addClass('iconspacer'); }
67                 );
68
69                 $('.savedsearchdrop').hover(
70                         function() {
71                                 $(this).addClass('drop');
72                                 $(this).addClass('icon');
73                                 $(this).removeClass('iconspacer'); },
74
75                         function() {
76                                 $(this).removeClass('drop');
77                                 $(this).removeClass('icon');
78                                 $(this).addClass('iconspacer'); }
79                 );
80
81                 $('.savedsearchterm').hover(
82                         function() {
83                                 id = $(this).attr('id');
84                                 $('#drop-' + id).addClass('icon');
85                                 $('#drop-' + id).addClass('drophide');
86                                 $('#drop-' + id).removeClass('iconspacer'); },
87
88                         function() {
89                                 id = $(this).attr('id');
90                                 $('#drop-' + id).removeClass('icon');
91                                 $('#drop-' + id).removeClass('drophide');
92                                 $('#drop-' + id).addClass('iconspacer'); }
93                         );
94
95                 // click outside notifications menu closes it
96                 $('html').click(function() {
97                         $('#nav-notifications-linkmenu').removeClass('selected');
98                         $('#nav-notifications-menu').css({display: 'none'});
99                 });
100
101                 $('#nav-notifications-linkmenu').click(function(event) {
102                         event.stopPropagation();
103                 });
104                 // click outside profiles menu closes it
105                 $('html').click(function() {
106                         $('#profiles-menu-trigger').removeClass('selected');
107                         $('#profiles-menu').css({display: 'none'});
108                 });
109
110                 $('#profiles-menu').click(function(event) {
111                         event.stopPropagation();
112                 });
113
114                 // main function in toolbar functioning
115                 function toggleToolbar() {
116                         if ( $('#nav-floater').is(':visible') ) {
117                                 $('#nav-floater').slideUp('fast');
118                                 $('.floaterflip').css({
119                                         backgroundPosition: '-210px -60px' 
120                                 });
121                                 $('.search-box').slideUp('fast');
122                         } else {
123                                 $('#nav-floater').slideDown('fast');
124                                 $('.floaterflip').css({
125                                         backgroundPosition: '-190px -60px'
126                                 });
127                                 $('.search-box').slideDown('fast');
128                         }
129                 };
130                 // our trigger for the toolbar button
131                 $('.floaterflip').click(function() {
132                         toggleToolbar();
133                         return false;
134                 });
135
136                 // (attempt to) change the text colour in a top post
137                 $('#profile-jot-text').focusin(function() {
138                         $(this).css({color: '#eec'});
139                 });
140
141                 $('a[href=#top]').click(function() {
142                         $('html, body').animate({scrollTop:0}, 'slow');
143                         return false;
144                 });
145
146         });
147         // shadowing effect for floating toolbars
148         $(document).scroll(function(e) {
149                 var pageTop = $('html').scrollTop();
150                 if (pageTop) {
151                         $('#nav-floater').css({boxShadow: '3px 3px 10px rgba(0, 0, 0, 0.7)'});
152                         $('.search-box').css({boxShadow: '3px 3px 10px rgba(0, 0, 0, 0.7)'});
153                 } else {
154                         $('#nav-floater').css({boxShadow: '0 0 0 0'});
155                         $('.search-box').css({boxShadow: '0 0 0 0'});
156                 }
157         });
158         </script>
159 EOT;
160
161     // custom css
162     if (!is_null($cssFile)) {
163         $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
164     }
165
166         js_in_foot();
167 }
168
169 function dispy_community_info() {
170     /** @purpose some sidebar stuff for new users
171     */
172         $a = get_app();
173         $url = $a->get_baseurl($ssl_state);
174         $aside['$url'] = $url;
175
176         $tpl = file_get_contents(dirname(__file__) . '/communityhome.tpl');
177         return $a->page['aside_bottom'] = replace_macros($tpl, $aside);
178 }
179
180 function js_in_foot() {
181         /** @purpose insert stuff in bottom of page
182          */
183         $a = get_app();
184         $baseurl = $a->get_baseurl($ssl_state);
185         $bottom['$baseurl'] = $baseurl;
186         $tpl = file_get_contents(dirname(__file__) . '/bottom.tpl');
187
188         return $a->page['bottom'] = replace_macros($tpl, $bottom);
189 }