]> git.mxchange.org Git - friendica.git/blob - view/theme/duepuntozero/theme.php
Merge pull request #12591 from MrPetovan/task/2023-licence
[friendica.git] / view / theme / duepuntozero / theme.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2023, the Friendica project
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Affero General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  *
20  */
21
22 use Friendica\App;
23 use Friendica\Core\Renderer;
24 use Friendica\DI;
25
26 /*
27  * This script can be included even when the app is in maintenance mode which requires us to avoid any config call
28  */
29
30 function duepuntozero_init(App $a) {
31
32         Renderer::setActiveTemplateEngine('smarty3');
33
34         $colorset = null;
35
36         if (DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {
37                 $colorset = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset');
38                 if (!$colorset)
39                         $colorset = DI::config()->get('duepuntozero', 'colorset');          // user setting have priority, then node settings
40         }
41
42         if ($colorset) {
43                 if ($colorset == 'greenzero')
44                         DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />' . "\n";
45                 if ($colorset == 'purplezero')
46                         DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/purplezero.css" type="text/css" media="screen" />' . "\n";
47                 if ($colorset == 'easterbunny')
48                         DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/easterbunny.css" type="text/css" media="screen" />' . "\n";
49                 if ($colorset == 'darkzero')
50                         DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/darkzero.css" type="text/css" media="screen" />' . "\n";
51                 if ($colorset == 'comix')
52                         DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/comix.css" type="text/css" media="screen" />' . "\n";
53                 if ($colorset == 'slackr')
54                         DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/slackr.css" type="text/css" media="screen" />' . "\n";
55         }
56 DI::page()['htmlhead'] .= <<< EOT
57 <script>
58 function cmtBbOpen(comment, id) {
59         if ($(comment).hasClass('comment-edit-text-full')) {
60                 $(".comment-edit-bb-" + id).show();
61                 return true;
62         }
63         return false;
64 }
65 function cmtBbClose(comment, id) {
66         return false;
67 }
68 $(document).ready(function() {
69
70         $('html').click(function() { $("#nav-notifications-menu" ).hide(); });
71
72         $('.group-edit-icon').hover(
73                 function() {
74                         $(this).addClass('icon'); $(this).removeClass('iconspacer');},
75                 function() {
76                         $(this).removeClass('icon'); $(this).addClass('iconspacer');}
77         );
78
79         $('.sidebar-group-element').hover(
80                 function() {
81                         id = $(this).attr('id');
82                         $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
83
84                 function() {
85                         id = $(this).attr('id');
86                         $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
87         );
88
89
90         $('.savedsearchdrop').hover(
91                 function() {
92                         $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
93                 function() {
94                         $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
95         );
96
97         $('.savedsearchterm').hover(
98                 function() {
99                         id = $(this).attr('id');
100                         $('#drop-' + id).addClass('icon');      $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
101
102                 function() {
103                         id = $(this).attr('id');
104                         $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
105         );
106 });
107 </script>
108 EOT;
109 }
110
111 /**
112  * @param int|null $uid
113  * @return null
114  * @see \Friendica\Core\Theme::getBackgroundColor()
115  * @TODO Implement this function
116  */
117 function duepuntozero_get_background_color(int $uid = null)
118 {
119         return null;
120 }
121
122 /**
123  * @param int|null $uid
124  * @return null
125  * @see \Friendica\Core\Theme::getThemeColor()
126  * @TODO Implement this function
127  */
128 function duepuntozero_get_theme_color(int $uid = null)
129 {
130         return null;
131 }