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