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