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