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