]> git.mxchange.org Git - friendica.git/blob - view/theme/quattro/theme.php
Merge branch 'release/3.4'
[friendica.git] / view / theme / quattro / theme.php
1 <?php
2 /**
3  * Name: Quattro
4  * Version: 0.6
5  * Author: Fabio <http://kirgroup.com/profile/fabrixxm>
6  * Maintainer: Fabio <http://kirgroup.com/profile/fabrixxm>
7  * Maintainer: Tobias <https://diekershoff.homeunix.net/friendica/profile/tobias>
8  */
9  
10 function quattro_init(&$a) {
11 $a->theme_info = array();
12 set_template_engine($a, 'smarty3');
13
14
15 $a->page['htmlhead'] .= '<script src="'.$a->get_baseurl().'/view/theme/quattro/tinycon.min.js"></script>';
16 $a->page['htmlhead'] .= <<< EOT
17 <script>
18 $(document).ready(function(){
19     $('nav').bind('nav-update', function(e,data){
20         var notifCount = $(data).find('notif').attr('count');
21         var intro = $(data).find('intro').text();
22         var mail = $(data).find('mail').text();
23         
24         console.log(intro,mail);
25         
26         if (notifCount > 0 ) {
27             Tinycon.setBubble(notifCount);
28         } else {
29             Tinycon.setBubble('');
30         }
31         
32         if (intro>0){
33                         $("#nav-introductions-link").addClass("on");
34                 } else {
35                         $("#nav-introductions-link").removeClass("on");
36                 }
37                 
38         if (mail>0){
39                         $("#nav-messages-link").addClass("on");
40                 } else {
41                         $("#nav-messages-link").removeClass("on");
42                 }
43                 
44     });
45         
46         /* 
47          * show and hide contact action buttons in 
48          * contacts page on contacts' checkbox selection
49          */
50         $('.contact-select').bind('click', function(e) {
51                 var y = e.clientY;
52                 var elm = $("#contacts-actions");
53                 y=y-40;
54                 if (y<0) y=0;
55                 if (y+elm.height() > $("html").height()) y=$("html").height()-elm.height();
56                 elm.css('top', y+"px");
57                 if ($(".contact-select:checked").length > 0) {
58                         elm.show();
59                 } else {
60                         elm.hide();
61                 }
62         });
63 });        
64
65 function insertFormatting(comment,BBcode,id) {
66         
67                 var tmpStr = $("#comment-edit-text-" + id).val();
68                 if(tmpStr == comment) {
69                         tmpStr = "";
70                         $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
71                         $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
72                         openMenu("comment-edit-submit-wrapper-" + id);
73                         $("#comment-edit-text-" + id).val(tmpStr);
74                 }
75
76         textarea = document.getElementById("comment-edit-text-" +id);
77         if (document.selection) {
78                 textarea.focus();
79                 selected = document.selection.createRange();
80                 if (BBcode == "url"){
81                         selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
82                         } else                  
83                 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
84         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
85                 var start = textarea.selectionStart;
86                 var end = textarea.selectionEnd;
87                 if (BBcode == "url"){
88                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
89                         } else
90                 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
91         }
92         return true;
93 }
94
95 function showThread(id) {
96         $("#collapsed-comments-" + id).show()
97         $("#collapsed-comments-" + id + " .collapsed-comments").show()
98 }
99 function hideThread(id) {
100         $("#collapsed-comments-" + id).hide()
101         $("#collapsed-comments-" + id + " .collapsed-comments").hide()
102 }
103
104
105 function cmtBbOpen(id) {
106         $("#comment-edit-bb-" + id).show();
107 }
108 function cmtBbClose(id) {
109         $("#comment-edit-bb-" + id).hide();
110 }
111
112 $(document).ready(function() {
113
114         $('html').click(function() { $("#nav-notifications-menu" ).hide(); });
115
116         $('.group-edit-icon').hover(
117                 function() {
118                         $(this).addClass('icon'); $(this).removeClass('iconspacer');},
119                 function() {
120                         $(this).removeClass('icon'); $(this).addClass('iconspacer');}
121                 );
122
123         $('.sidebar-group-element').hover(
124                 function() {
125                         id = $(this).attr('id');
126                         $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
127
128                 function() {
129                         id = $(this).attr('id');
130                         $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
131                 );
132
133
134         $('.savedsearchdrop').hover(
135                 function() {
136                         $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
137                 function() {
138                         $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
139                 );
140
141         $('.savedsearchterm').hover(
142                 function() {
143                         id = $(this).attr('id');
144                         $('#drop-' + id).addClass('icon');      $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
145
146                 function() {
147                         id = $(this).attr('id');
148                         $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
149         );
150
151 });
152
153
154 </script>
155 EOT;
156 }