]> git.mxchange.org Git - friendica.git/blob - view/theme/dispy-dark/theme.php
string fix: typo. slow down scroll to top in dispys
[friendica.git] / view / theme / dispy-dark / theme.php
1 <?php
2
3 /*
4  * Name: Dispy Dark
5  * Description: Dispy Dark, Friendica theme
6  * Version: 1.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 $a = get_app();
13 $a->theme_info = array(
14         'name' => 'dispy-dark',
15         'version' => '1.1'
16 );
17
18 function dispy_dark_init(&$a) {
19
20         // aside on profile page
21         if (($a->argv[0] . $a->argv[1]) === ("profile" . $a->user['nickname'])) {
22                 dispy_dark_community_info();
23         }
24
25         $a->page['htmlhead'] .= <<<EOT
26         <script type="text/javascript">
27         $(document).ready(function() {
28                 $('.group-edit-icon').hover(
29                         function() {
30                                 $(this).addClass('icon');
31                                 $(this).removeClass('iconspacer'); },
32
33                         function() {
34                                 $(this).removeClass('icon');
35                                 $(this).addClass('iconspacer'); }
36                 );
37
38                 $('.sidebar-group-element').hover(
39                         function() {
40                                 id = $(this).attr('id');
41                                 $('#edit-' + id).addClass('icon');
42                                 $('#edit-' + id).removeClass('iconspacer'); },
43
44                         function() {
45                                 id = $(this).attr('id');
46                                 $('#edit-' + id).removeClass('icon');
47                                 $('#edit-' + id).addClass('iconspacer'); }
48                 );
49
50                 $('.savedsearchdrop').hover(
51                         function() {
52                                 $(this).addClass('drop');
53                                 $(this).addClass('icon');
54                                 $(this).removeClass('iconspacer'); },
55
56                         function() {
57                                 $(this).removeClass('drop');
58                                 $(this).removeClass('icon');
59                                 $(this).addClass('iconspacer'); }
60                 );
61
62                 $('.savedsearchterm').hover(
63                         function() {
64                                 id = $(this).attr('id');
65                                 $('#drop-' + id).addClass('icon');
66                                 $('#drop-' + id).addClass('drophide');
67                                 $('#drop-' + id).removeClass('iconspacer'); },
68
69                         function() {
70                                 id = $(this).attr('id');
71                                 $('#drop-' + id).removeClass('icon');
72                                 $('#drop-' + id).removeClass('drophide');
73                                 $('#drop-' + id).addClass('iconspacer'); }
74                         );
75
76                 // click outside notifications menu closes it
77                 $('html').click(function() {
78                         $('#nav-notifications-linkmenu').removeClass('selected');
79                         document.getElementById("nav-notifications-menu").style.display = "none";
80                 });
81
82                 $('#nav-notifications-linkmenu').click(function(event) {
83                         event.stopPropagation();
84                 });
85                 // click outside profiles menu closes it
86                 $('html').click(function() {
87                         $('#profiles-menu-trigger').removeClass('selected');
88                         document.getElementById("profiles-menu").style.display = "none";
89                 });
90
91                 $('#profiles-menu').click(function(event) {
92                         event.stopPropagation();
93                 });
94
95                 // main function in toolbar functioning
96                 function toggleToolbar() {
97                         if ( $('#nav-floater').is(':visible') ) {
98                                 $('#nav-floater').slideUp('fast');
99                                 $('.floaterflip').css({
100                                         backgroundPosition: '-210px -60px' 
101                                 });
102                                 $('.search-box').slideUp('fast');
103                         } else {
104                                 $('#nav-floater').slideDown('fast');
105                                 $('.floaterflip').css({
106                                         backgroundPosition: '-190px -60px'
107                                 });
108                                 $('.search-box').slideDown('fast');
109                         }
110                 };
111                 // our trigger for the toolbar button
112                 $('.floaterflip').click(function() {
113                         toggleToolbar();
114                         return false;
115                 });
116
117                 // (attempt to) change the text colour in a top post
118                 $('#profile-jot-text').focusin(function() {
119                         $(this).css({color: '#eec'});
120                 });
121
122                 $('a[href=#top]').click(function() {
123                         $('html, body').animate({scrollTop:0}, 'slow');
124                         return false;
125                 });
126
127         });
128         // shadowing effect for floating toolbars
129         $(document).scroll(function(e) {
130                 var pageTop = $('html').scrollTop();
131                 if (pageTop) {
132                         $('#nav-floater').css({boxShadow: '3px 3px 10px rgba(0, 0, 0, 0.7)'});
133                         $('.search-box').css({boxShadow: '3px 3px 10px rgba(0, 0, 0, 0.7)'});
134                 } else {
135                         $('#nav-floater').css({boxShadow: '0 0 0 0'});
136                         $('.search-box').css({boxShadow: '0 0 0 0'});
137                 }
138         });
139         </script>
140 EOT;
141 }
142
143 function dispy_dark_community_info() {
144         $a = get_app();
145         $url = $a->get_baseurl($ssl_state);
146         $aside['$url'] = $url;
147
148         $fpostitJS = <<<FPI
149                 javascript: (function() {
150                 the_url = ' . $url . '/view/theme/' . $a->theme_info['name'] . '/fpostit/fpostit.php?url=' +
151                 encodeURIComponent(window.location.href) + '&title=' + encodeURIComponent(document.title) + '&text=' +
152                 encodeURIComponent(''+(window.getSelection ? window.getSelection() : document.getSelection ?
153                 document.getSelection() : document.selection.createRange().text));
154                 a_funct = function() {
155                         if (!window.open(the_url, 'fpostit', 'location=yes,links=no,scrollbars=no,toolbar=no,width=600,height=300')) {
156                                 location.href = the_url;
157                         }
158                         if (/Firefox/.test(navigator.userAgent)) {
159                                 setTimeout(a_funct, 0)
160                         } else {
161                                 a_funct();
162                         }
163                 })();
164 FPI;
165
166         $aside['$fpostitJS'] = $fpostitJS;
167         $tpl = file_get_contents(dirname(__file__) . '/communityhome.tpl');
168         return $a->page['aside_bottom'] = replace_macros($tpl, $aside);
169 }
170