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