]> git.mxchange.org Git - friendica.git/blob - view/theme/quattro/theme.php
bbcode: rearrange shared links - can only be made standard, when all themes support...
[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 function insertFormatting(comment,BBcode,id) {
48         
49                 var tmpStr = $("#comment-edit-text-" + id).val();
50                 if(tmpStr == comment) {
51                         tmpStr = "";
52                         $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
53                         $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
54                         openMenu("comment-edit-submit-wrapper-" + id);
55                         $("#comment-edit-text-" + id).val(tmpStr);
56                 }
57
58         textarea = document.getElementById("comment-edit-text-" +id);
59         if (document.selection) {
60                 textarea.focus();
61                 selected = document.selection.createRange();
62                 if (BBcode == "url"){
63                         selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
64                         } else                  
65                 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
66         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
67                 var start = textarea.selectionStart;
68                 var end = textarea.selectionEnd;
69                 if (BBcode == "url"){
70                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
71                         } else
72                 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
73         }
74         return true;
75 }
76
77 function showThread(id) {
78         $("#collapsed-comments-" + id).show()
79         $("#collapsed-comments-" + id + " .collapsed-comments").show()
80 }
81 function hideThread(id) {
82         $("#collapsed-comments-" + id).hide()
83         $("#collapsed-comments-" + id + " .collapsed-comments").hide()
84 }
85
86
87 function cmtBbOpen(id) {
88         $("#comment-edit-bb-" + id).show();
89 }
90 function cmtBbClose(id) {
91         $("#comment-edit-bb-" + id).hide();
92 }
93 $(document).ready(function() {
94
95 $('html').click(function() { $("#nav-notifications-menu" ).hide(); });
96
97 $('.group-edit-icon').hover(
98         function() {
99                 $(this).addClass('icon'); $(this).removeClass('iconspacer');},
100         function() {
101                 $(this).removeClass('icon'); $(this).addClass('iconspacer');}
102         );
103
104 $('.sidebar-group-element').hover(
105         function() {
106                 id = $(this).attr('id');
107                 $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
108
109         function() {
110                 id = $(this).attr('id');
111                 $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
112         );
113
114
115 $('.savedsearchdrop').hover(
116         function() {
117                 $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
118         function() {
119                 $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
120         );
121
122 $('.savedsearchterm').hover(
123         function() {
124                 id = $(this).attr('id');
125                 $('#drop-' + id).addClass('icon');      $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
126
127         function() {
128                 id = $(this).attr('id');
129                 $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
130         );
131
132 });
133
134
135 </script>
136 EOT;
137 }