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