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>
10 function quattro_init(&$a) {
11 $a->theme_info = array();
12 set_template_engine($a, 'smarty3');
15 $a->page['htmlhead'] .= '<script src="'.$a->get_baseurl().'/view/theme/quattro/tinycon.min.js"></script>';
16 $a->page['htmlhead'] .= <<< EOT
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();
24 console.log(intro,mail);
26 if (notifCount > 0 ) {
27 Tinycon.setBubble(notifCount);
29 Tinycon.setBubble('');
33 $("#nav-introductions-link").addClass("on");
35 $("#nav-introductions-link").removeClass("on");
39 $("#nav-messages-link").addClass("on");
41 $("#nav-messages-link").removeClass("on");
47 * show and hide contact action buttons in
48 * contacts page on contacts' checkbox selection
50 $('.contact-select').bind('click', function(e) {
52 var elm = $("#contacts-actions");
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) {
65 function insertFormatting(comment,BBcode,id) {
67 var tmpStr = $("#comment-edit-text-" + id).val();
68 if(tmpStr == comment) {
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);
76 textarea = document.getElementById("comment-edit-text-" +id);
77 if (document.selection) {
79 selected = document.selection.createRange();
81 selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
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;
88 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
90 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
95 function showThread(id) {
96 $("#collapsed-comments-" + id).show()
97 $("#collapsed-comments-" + id + " .collapsed-comments").show()
99 function hideThread(id) {
100 $("#collapsed-comments-" + id).hide()
101 $("#collapsed-comments-" + id + " .collapsed-comments").hide()
105 function cmtBbOpen(id) {
106 $("#comment-edit-bb-" + id).show();
108 function cmtBbClose(id) {
109 $("#comment-edit-bb-" + id).hide();
112 $(document).ready(function() {
114 $('html').click(function() { $("#nav-notifications-menu" ).hide(); });
116 $('.group-edit-icon').hover(
118 $(this).addClass('icon'); $(this).removeClass('iconspacer');},
120 $(this).removeClass('icon'); $(this).addClass('iconspacer');}
123 $('.sidebar-group-element').hover(
125 id = $(this).attr('id');
126 $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
129 id = $(this).attr('id');
130 $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
134 $('.savedsearchdrop').hover(
136 $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
138 $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
141 $('.savedsearchterm').hover(
143 id = $(this).attr('id');
144 $('#drop-' + id).addClass('icon'); $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
147 id = $(this).attr('id');
148 $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}