]> git.mxchange.org Git - friendica.git/blob - view/theme/duepuntozero/theme.php
d3378e49b8ac8dee1a78ce7c881346c9430d765c
[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 }
11 if ($colorset) {
12         if ($colorset == 'greenzero') {
13                 $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />'."\n";
14         }
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         }
18         if ($colorset == 'easterbunny') {
19                 $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/easterbunny.css" type="text/css" media="screen" />'."\n";
20         }
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         }
24         if ($colorset == 'comix') {
25                 $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/comix.css" type="text/css" media="screen" />'."\n";
26         }
27         if ($colorset == 'slackr') {
28                 $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/slackr.css" type="text/css" media="screen" />'."\n";
29         }
30 }
31 $a->page['htmlhead'] .= <<< EOT
32 <script>
33 function insertFormatting(BBcode, id) {
34         var tmpStr = $("#comment-edit-text-" + id).val();
35         if (tmpStr == "") {
36                 $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
37                 $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
38                 openMenu("comment-edit-submit-wrapper-" + id);
39         }
40
41         textarea = document.getElementById("comment-edit-text-" +id);
42         if (document.selection) {
43                 textarea.focus();
44                 selected = document.selection.createRange();
45                 if (BBcode == "url") {
46                         selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
47                 } else {
48                         selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
49                 }
50         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
51                 var start = textarea.selectionStart;
52                 var end = textarea.selectionEnd;
53                 if (BBcode == "url") {
54                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
55                 } else {
56                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
57                 }
58         }
59
60         return true;
61 }
62
63 function cmtBbOpen(comment, id) {
64         if ($(comment).hasClass('comment-edit-text-full')) {
65                 $(".comment-edit-bb-" + id).show();
66                 return true;
67         }
68         return false;
69 }
70 function cmtBbClose(comment, id) {
71         return false;
72 }
73 $(document).ready(function() {
74
75         $('html').click(function() { $("#nav-notifications-menu" ).hide(); });
76
77         $('.group-edit-icon').hover(
78                 function() {
79                         $(this).addClass('icon'); $(this).removeClass('iconspacer');},
80                 function() {
81                         $(this).removeClass('icon'); $(this).addClass('iconspacer');}
82         );
83
84         $('.sidebar-group-element').hover(
85                 function() {
86                         id = $(this).attr('id');
87                         $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
88
89                 function() {
90                         id = $(this).attr('id');
91                         $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
92         );
93
94
95         $('.savedsearchdrop').hover(
96                 function() {
97                         $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
98                 function() {
99                         $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
100         );
101
102         $('.savedsearchterm').hover(
103                 function() {
104                         id = $(this).attr('id');
105                         $('#drop-' + id).addClass('icon');      $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
106
107                 function() {
108                         id = $(this).attr('id');
109                         $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
110         );
111 });
112 </script>
113 EOT;
114 }