]> git.mxchange.org Git - friendica.git/blob - view/theme/duepuntozero/theme.php
588a6fa463468281fd4e51777c5f0be722e64335
[friendica.git] / view / theme / duepuntozero / theme.php
1 <?php
2
3 use Friendica\App;
4 use Friendica\Core\Config;
5 use Friendica\Core\PConfig;
6
7 function duepuntozero_init(App $a) {
8
9 $a->setActiveTemplateEngine('smarty3');
10
11     $colorset = PConfig::get( local_user(), 'duepuntozero','colorset');
12     if (!$colorset)
13        $colorset = Config::get('duepuntozero', 'colorset');          // user setting have priority, then node settings
14     if ($colorset) {
15         if ($colorset == 'greenzero')
16             $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />'."\n";
17         if ($colorset == 'purplezero')
18             $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/purplezero.css" type="text/css" media="screen" />'."\n";
19         if ($colorset == 'easterbunny')
20             $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/easterbunny.css" type="text/css" media="screen" />'."\n";
21         if ($colorset == 'darkzero')
22             $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/darkzero.css" type="text/css" media="screen" />'."\n";
23         if ($colorset == 'comix')
24             $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/comix.css" type="text/css" media="screen" />'."\n";
25         if ($colorset == 'slackr')
26             $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/slackr.css" type="text/css" media="screen" />'."\n";
27     }
28 $a->page['htmlhead'] .= <<< EOT
29 <script>
30 function insertFormatting(BBcode, id) {
31         var tmpStr = $("#comment-edit-text-" + id).val();
32         if (tmpStr == "") {
33                 $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
34                 $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
35                 openMenu("comment-edit-submit-wrapper-" + id);
36         }
37
38         textarea = document.getElementById("comment-edit-text-" +id);
39         if (document.selection) {
40                 textarea.focus();
41                 selected = document.selection.createRange();
42                 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
43         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
44                 var start = textarea.selectionStart;
45                 var end = textarea.selectionEnd;
46                 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
47         }
48
49         return true;
50 }
51
52 function cmtBbOpen(comment, id) {
53         if ($(comment).hasClass('comment-edit-text-full')) {
54                 $(".comment-edit-bb-" + id).show();
55                 return true;
56         }
57         return false;
58 }
59 function cmtBbClose(comment, id) {
60         return false;
61 }
62 $(document).ready(function() {
63
64         $('html').click(function() { $("#nav-notifications-menu" ).hide(); });
65
66         $('.group-edit-icon').hover(
67                 function() {
68                         $(this).addClass('icon'); $(this).removeClass('iconspacer');},
69                 function() {
70                         $(this).removeClass('icon'); $(this).addClass('iconspacer');}
71         );
72
73         $('.sidebar-group-element').hover(
74                 function() {
75                         id = $(this).attr('id');
76                         $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
77
78                 function() {
79                         id = $(this).attr('id');
80                         $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
81         );
82
83
84         $('.savedsearchdrop').hover(
85                 function() {
86                         $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
87                 function() {
88                         $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
89         );
90
91         $('.savedsearchterm').hover(
92                 function() {
93                         id = $(this).attr('id');
94                         $('#drop-' + id).addClass('icon');      $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
95
96                 function() {
97                         id = $(this).attr('id');
98                         $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
99         );
100 });
101 </script>
102 EOT;
103 }