]> git.mxchange.org Git - friendica.git/blob - view/theme/quattro/js/quattro.js
mv URL path uexport -> userexport
[friendica.git] / view / theme / quattro / js / quattro.js
1 // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
2 $(document).ready(function(){
3         $('nav').bind('nav-update', function(e,data){
4                 var notifCount = $(data).find('notif').attr('count');
5                 var intro = $(data).find('intro').text();
6                 var mail = $(data).find('mail').text();
7
8                 $(".tool .notify").removeClass("on");
9                 $(data).find("group").each(function() {
10                         var gid = this.id;
11                         var gcount = this.innerHTML;
12                         $(".group-"+gid+" .notify").addClass("on").text(gcount);
13                 });
14
15                 $(".forum-widget-entry .notify").removeClass("on");
16                 $(data).find("forum").each(function() {
17                         var fid = this.id;
18                         var fcount = this.innerHTML;
19                         $(".forum-"+fid+" .notify").addClass("on").text(fcount);
20                 });
21
22                 console.log(intro,mail);
23
24                 if (notifCount > 0 ) {
25                         Tinycon.setBubble(notifCount);
26                 } else {
27                         Tinycon.setBubble('');
28                 }
29
30                 if (intro>0){
31                         $("#nav-introductions-link").addClass("on");
32                 } else {
33                         $("#nav-introductions-link").removeClass("on");
34                 }
35
36                 if (mail>0){
37                         $("#nav-messages-link").addClass("on");
38                 } else {
39                         $("#nav-messages-link").removeClass("on");
40                 }
41
42         });
43
44         /*
45          * show and hide contact action buttons in
46          * contacts page on contacts' checkbox selection
47          */
48         $('.contact-select').bind('click', function(e) {
49                 var y = e.clientY;
50                 var elm = $("#contacts-actions");
51                 y=y-40;
52                 if (y<0) y=0;
53                 if (y+elm.height() > $("html").height()) y=$("html").height()-elm.height();
54                 elm.css('top', y+"px");
55                 if ($(".contact-select:checked").length > 0) {
56                         elm.show();
57                 } else {
58                         elm.hide();
59                 }
60         });
61 });
62
63 function insertFormatting(BBcode, id) {
64         var tmpStr = $("#comment-edit-text-" + id).val();
65         if (tmpStr == "") {
66                 $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
67                 $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
68                 openMenu("comment-edit-submit-wrapper-" + id);
69         }
70
71         textarea = document.getElementById("comment-edit-text-" +id);
72         if (document.selection) {
73                 textarea.focus();
74                 selected = document.selection.createRange();
75                 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
76         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
77                 var start = textarea.selectionStart;
78                 var end = textarea.selectionEnd;
79                 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
80         }
81
82         return true;
83 }
84
85 function showThread(id) {
86         $("#collapsed-comments-" + id).show()
87         $("#collapsed-comments-" + id + " .collapsed-comments").show()
88 }
89 function hideThread(id) {
90         $("#collapsed-comments-" + id).hide()
91         $("#collapsed-comments-" + id + " .collapsed-comments").hide()
92 }
93
94
95 function cmtBbOpen(id) {
96         $("#comment-edit-bb-" + id).show();
97 }
98 function cmtBbClose(id) {
99         $("#comment-edit-bb-" + id).hide();
100 }
101
102 $(document).ready(function() {
103
104         $('html').click(function() { $("#nav-notifications-menu" ).hide(); });
105
106         $('.group-edit-icon').hover(
107                 function() {
108                         $(this).addClass('icon'); $(this).removeClass('iconspacer');},
109                 function() {
110                         $(this).removeClass('icon'); $(this).addClass('iconspacer');}
111                 );
112
113         $('.sidebar-group-element').hover(
114                 function() {
115                         id = $(this).attr('id');
116                         $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
117
118                 function() {
119                         id = $(this).attr('id');
120                         $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
121                 );
122
123
124         $('.savedsearchdrop').hover(
125                 function() {
126                         $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
127                 function() {
128                         $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
129                 );
130
131         $('.savedsearchterm').hover(
132                 function() {
133                         id = $(this).attr('id');
134                         $('#drop-' + id).addClass('icon');      $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
135
136                 function() {
137                         id = $(this).attr('id');
138                         $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
139         );
140
141 });
142
143 // @license-end