]> git.mxchange.org Git - friendica.git/blob - view/theme/quattro/theme.php
quattro: show notification number in favicon
[friendica.git] / view / theme / quattro / theme.php
1 <?php
2 /**
3  * Name: Quattro
4  * Version: 0.5
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         if (notifCount > 0 ) {
22             Tinycon.setBubble(notifCount);
23         } else {
24             Tinycon.setBubble('');
25         }
26     });
27 });        
28
29 function insertFormatting(comment,BBcode,id) {
30         
31                 var tmpStr = $("#comment-edit-text-" + id).val();
32                 if(tmpStr == comment) {
33                         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                         $("#comment-edit-text-" + id).val(tmpStr);
38                 }
39
40         textarea = document.getElementById("comment-edit-text-" +id);
41         if (document.selection) {
42                 textarea.focus();
43                 selected = document.selection.createRange();
44                 if (BBcode == "url"){
45                         selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
46                         } else                  
47                 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
48         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
49                 var start = textarea.selectionStart;
50                 var end = textarea.selectionEnd;
51                 if (BBcode == "url"){
52                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
53                         } else
54                 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
55         }
56         return true;
57 }
58
59 function showThread(id) {
60         $("#collapsed-comments-" + id).show()
61         $("#collapsed-comments-" + id + " .collapsed-comments").show()
62 }
63 function hideThread(id) {
64         $("#collapsed-comments-" + id).hide()
65         $("#collapsed-comments-" + id + " .collapsed-comments").hide()
66 }
67
68
69 function cmtBbOpen(id) {
70         $("#comment-edit-bb-" + id).show();
71 }
72 function cmtBbClose(id) {
73         $("#comment-edit-bb-" + id).hide();
74 }
75 $(document).ready(function() {
76
77 $('html').click(function() { $("#nav-notifications-menu" ).hide(); });
78
79 $('.group-edit-icon').hover(
80         function() {
81                 $(this).addClass('icon'); $(this).removeClass('iconspacer');},
82         function() {
83                 $(this).removeClass('icon'); $(this).addClass('iconspacer');}
84         );
85
86 $('.sidebar-group-element').hover(
87         function() {
88                 id = $(this).attr('id');
89                 $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
90
91         function() {
92                 id = $(this).attr('id');
93                 $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
94         );
95
96
97 $('.savedsearchdrop').hover(
98         function() {
99                 $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
100         function() {
101                 $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
102         );
103
104 $('.savedsearchterm').hover(
105         function() {
106                 id = $(this).attr('id');
107                 $('#drop-' + id).addClass('icon');      $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
108
109         function() {
110                 id = $(this).attr('id');
111                 $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
112         );
113
114 });
115
116
117 </script>
118 EOT;
119 }