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