mirror of
https://github.com/friendica/friendica
synced 2024-11-10 17:02:53 +00:00
4f7740264e
- Remaining mentions already mean "forum"
89 lines
2.6 KiB
JavaScript
89 lines
2.6 KiB
JavaScript
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
|
|
|
|
/**
|
|
* @file view/theme/frio/js/mod_circle.js
|
|
* The javascript for the circle module
|
|
*/
|
|
|
|
$(document).ready(function () {
|
|
// Add an event listeners on buttons for switching the contact list view
|
|
$("body").on("click", ".circle-list-switcher", function () {
|
|
switchCircleViewMode(this);
|
|
});
|
|
});
|
|
|
|
/**
|
|
* Change the circle membership of the contacts and fetch the new grup list
|
|
* as html
|
|
*
|
|
* @param {int} gid The circle ID
|
|
* @param {int} cid The contact ID
|
|
* @param {string} sec_token The security token
|
|
*
|
|
* @returns {undefined}
|
|
*/
|
|
function circleChangeMember(gid, cid, sec_token) {
|
|
$("#contact-entry-wrapper-" + cid).fadeTo("fast", 0.33);
|
|
$(".tooltip").tooltip("hide");
|
|
$("body").css("cursor", "wait");
|
|
|
|
$.get("circle/" + gid + "/" + cid + "?t=" + sec_token, function (data) {
|
|
// Insert the new circle member list
|
|
$("#circle-update-wrapper").html(data);
|
|
|
|
// Apply the actual circle list view mode to the new
|
|
// circle list html
|
|
var activeMode = $(".circle-list-switcher.active");
|
|
switchCircleViewMode(activeMode[0]);
|
|
|
|
$("body").css("cursor", "auto");
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Change the circle list view mode
|
|
*
|
|
* @param {object} elm The button element of the view mode switcher
|
|
* @returns {undefined}
|
|
*/
|
|
function switchCircleViewMode(elm) {
|
|
// Remove the active class from circle list switcher buttons
|
|
$(".circle-list-switcher").removeClass("active");
|
|
// And add it to the active button element
|
|
$(elm).addClass("active");
|
|
|
|
// Add or remove the css classes for the circle list with regard to the active view mode
|
|
if (elm.id === "circle-list-small") {
|
|
$("#contact-circle-list > li").addClass("shortmode col-lg-6 col-md-6 col-sm-6 col-xs-12");
|
|
} else {
|
|
$("#contact-circle-list > li").removeClass("shortmode col-lg-6 col-md-6 col-sm-6 col-xs-12");
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Filter the circle member list for contacts
|
|
*
|
|
* @returns {undefined}
|
|
*/
|
|
function filterList() {
|
|
// Declare variables
|
|
var input, filter, ul, li, a, i;
|
|
input = document.getElementById("contacts-search");
|
|
filter = input.value.toUpperCase();
|
|
li = document.querySelectorAll("#contact-circle-list>li");
|
|
|
|
// Loop through all list items, and hide those who don't match the search query
|
|
for (i = 0; i < li.length; i++) {
|
|
// Get the heading element
|
|
var mh = li[i].getElementsByClassName("media-heading")[0];
|
|
// The first child of the heading element should contain
|
|
// the text which we want to filter
|
|
a = mh.firstChild;
|
|
if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {
|
|
li[i].style.display = "";
|
|
} else {
|
|
li[i].style.display = "none";
|
|
}
|
|
}
|
|
}
|
|
// @license-end
|