]> git.mxchange.org Git - friendica.git/blob - view/theme/dispy-dark/theme.php
Merge pull request #186 from simonlnu/master
[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.0
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->page['htmlhead'] .= <<< EOT
13 <script>
14 $(document).ready(function() {
15     $('.group-edit-icon').hover(
16         function() {
17             $(this).addClass('icon');
18             $(this).removeClass('iconspacer'); },
19
20         function() {
21             $(this).removeClass('icon');
22             $(this).addClass('iconspacer'); }
23     );
24
25     $('.sidebar-group-element').hover(
26         function() {
27             id = $(this).attr('id');
28             $('#edit-' + id).addClass('icon');
29             $('#edit-' + id).removeClass('iconspacer'); },
30
31         function() {
32             id = $(this).attr('id');
33             $('#edit-' + id).removeClass('icon');
34             $('#edit-' + id).addClass('iconspacer'); }
35     );
36
37     $('.savedsearchdrop').hover(
38         function() {
39             $(this).addClass('drop');
40             $(this).addClass('icon');
41             $(this).removeClass('iconspacer'); },
42
43         function() {
44             $(this).removeClass('drop');
45             $(this).removeClass('icon');
46             $(this).addClass('iconspacer'); }
47     );
48
49     $('.savedsearchterm').hover(
50         function() {
51             id = $(this).attr('id');
52             $('#drop-' + id).addClass('icon');
53             $('#drop-' + id).addClass('drophide');
54             $('#drop-' + id).removeClass('iconspacer'); },
55
56         function() {
57             id = $(this).attr('id');
58             $('#drop-' + id).removeClass('icon');
59             $('#drop-' + id).removeClass('drophide');
60             $('#drop-' + id).addClass('iconspacer'); }
61         );
62
63         // click outside notifications menu closes it
64         $('html').click(function() {
65                 $('#nav-notifications-linkmenu').removeClass('selected');
66                 document.getElementById("nav-notifications-menu").style.display = "none";
67         });
68
69         $('#nav-notifications-linkmenu').click(function(event) {
70                 event.stopPropagation();
71         });
72         // click outside profiles menu closes it
73         $('html').click(function() {
74                 $('#profiles-menu-trigger').removeClass('selected');
75                 document.getElementById("profiles-menu").style.display = "none";
76         });
77
78         $('#profiles-menu').click(function(event) {
79                 event.stopPropagation();
80         });
81
82         // main function in toolbar functioning
83     function toggleToolbar() {
84         if ( $('#nav-floater').is(':visible') ) {
85             $('#nav-floater').slideUp('fast');
86             $('.floaterflip').css({
87                 backgroundPosition: '-210px -60px' 
88             });
89                         $('.search-box').slideUp('fast');
90         } else {
91             $('#nav-floater').slideDown('fast');
92             $('.floaterflip').css({
93                 backgroundPosition: '-190px -60px'
94             });
95                         $('.search-box').slideDown('fast');
96         }
97     };
98         // our trigger for the toolbar button
99     $('.floaterflip').click(function() {
100         toggleToolbar();
101         return false;
102     });
103
104         // (attempt) to change the text colour in a top post
105         $('#profile-jot-text').focusin(function() {
106                 $(this).css({color: '#eec'});
107         });
108
109 });
110 </script>
111 EOT;
112
113 function dispydark_community_info() {
114         $a = get_app();
115
116         $fostitJS = "javascript: (function() {
117                 the_url = '".$a->get_baseurl($ssl_state)."/view/theme/dispy-dark/fpostit/fpostit.php?url=' +
118                 encodeURIComponent(window.location.href) + '&title=' + encodeURIComponent(document.title) + '&text=' +
119                 encodeURIComponent(''+(window.getSelection ? window.getSelection() : document.getSelection ?
120                 document.getSelection() : document.selection.createRange().text));
121                 a_funct = function() {
122                         if (!window.open(the_url, 'fpostit', 'location=yes,links=no,scrollbars=no,toolbar=no,width=600,height=300')) {
123                                 location.href = the_url;
124                         }
125                         if (/Firefox/.test(navigator.userAgent)) {
126                                 setTimeout(a_funct, 0)
127                         } else {
128                                 a_funct();
129                         }
130                 })();";
131
132         $aside['$fostitJS'] = $fostitJS;
133         $url = $a->get_baseurl($ssl_state);
134         $aside['$url'] = $url;
135
136     $tpl = file_get_contents(dirname(__file__).'/communityhome.tpl');
137         $a->page['aside_bottom'] = replace_macros($tpl, $aside);
138 }
139
140 // aside on profile page
141 if (($a->argv[0] . $a->argv[1]) === ("profile" . $a->user['nickname'])) {
142         dispydark_community_info();
143 }