]> git.mxchange.org Git - friendica.git/blob - view/theme/duepuntozero/theme.php
Merge branch 'develop' into improvement/move-app-to-src-2
[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                 if (BBcode == "url") {
41                         selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
42                 } else {
43                         selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
44                 }
45         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
46                 var start = textarea.selectionStart;
47                 var end = textarea.selectionEnd;
48                 if (BBcode == "url") {
49                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
50                 } else {
51                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
52                 }
53         }
54
55         return true;
56 }
57
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 }