2020-09-27 16:36:33 +00:00
|
|
|
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
|
2017-04-21 14:04:29 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-13 23:54:35 +00:00
|
|
|
* @file view/theme/frio/js/mod_circle.js
|
|
|
|
* The javascript for the circle module
|
2017-04-21 14:04:29 +00:00
|
|
|
*/
|
|
|
|
|
2021-01-22 13:38:44 +00:00
|
|
|
$(document).ready(function () {
|
2017-04-21 14:04:29 +00:00
|
|
|
// Add an event listeners on buttons for switching the contact list view
|
2023-05-13 23:54:35 +00:00
|
|
|
$("body").on("click", ".circle-list-switcher", function () {
|
|
|
|
switchCircleViewMode(this);
|
2017-04-21 14:04:29 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
2023-05-13 23:54:35 +00:00
|
|
|
* Change the circle membership of the contacts and fetch the new grup list
|
2017-04-21 14:04:29 +00:00
|
|
|
* as html
|
2017-05-11 12:54:26 +00:00
|
|
|
*
|
2023-05-13 23:54:35 +00:00
|
|
|
* @param {int} gid The circle ID
|
2017-04-21 14:04:29 +00:00
|
|
|
* @param {int} cid The contact ID
|
|
|
|
* @param {string} sec_token The security token
|
2017-05-11 12:54:26 +00:00
|
|
|
*
|
2017-04-21 14:04:29 +00:00
|
|
|
* @returns {undefined}
|
|
|
|
*/
|
2023-05-13 23:54:35 +00:00
|
|
|
function circleChangeMember(gid, cid, sec_token) {
|
2017-04-23 13:26:26 +00:00
|
|
|
$("#contact-entry-wrapper-" + cid).fadeTo("fast", 0.33);
|
2017-04-21 14:04:29 +00:00
|
|
|
$(".tooltip").tooltip("hide");
|
|
|
|
$("body").css("cursor", "wait");
|
2017-04-23 13:26:26 +00:00
|
|
|
|
2023-05-13 23:54:35 +00:00
|
|
|
$.get("circle/" + gid + "/" + cid + "?t=" + sec_token, function (data) {
|
|
|
|
// Insert the new circle member list
|
|
|
|
$("#circle-update-wrapper").html(data);
|
2017-04-21 14:04:29 +00:00
|
|
|
|
2023-05-13 23:54:35 +00:00
|
|
|
// Apply the actual circle list view mode to the new
|
|
|
|
// circle list html
|
|
|
|
var activeMode = $(".circle-list-switcher.active");
|
|
|
|
switchCircleViewMode(activeMode[0]);
|
2017-04-21 14:04:29 +00:00
|
|
|
|
2021-01-22 13:38:44 +00:00
|
|
|
$("body").css("cursor", "auto");
|
2017-04-21 14:04:29 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-05-13 23:54:35 +00:00
|
|
|
* Change the circle list view mode
|
2017-05-11 12:54:26 +00:00
|
|
|
*
|
2017-04-21 14:04:29 +00:00
|
|
|
* @param {object} elm The button element of the view mode switcher
|
|
|
|
* @returns {undefined}
|
|
|
|
*/
|
2023-05-13 23:54:35 +00:00
|
|
|
function switchCircleViewMode(elm) {
|
|
|
|
// Remove the active class from circle list switcher buttons
|
|
|
|
$(".circle-list-switcher").removeClass("active");
|
2021-01-22 13:38:44 +00:00
|
|
|
// And add it to the active button element
|
|
|
|
$(elm).addClass("active");
|
2017-04-21 14:04:29 +00:00
|
|
|
|
2023-05-13 23:54:35 +00:00
|
|
|
// 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");
|
2021-01-22 13:38:44 +00:00
|
|
|
} else {
|
2023-05-13 23:54:35 +00:00
|
|
|
$("#contact-circle-list > li").removeClass("shortmode col-lg-6 col-md-6 col-sm-6 col-xs-12");
|
2021-01-22 13:38:44 +00:00
|
|
|
}
|
2017-04-21 14:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-05-13 23:54:35 +00:00
|
|
|
* Filter the circle member list for contacts
|
2017-05-11 12:54:26 +00:00
|
|
|
*
|
2017-04-21 14:04:29 +00:00
|
|
|
* @returns {undefined}
|
|
|
|
*/
|
|
|
|
function filterList() {
|
|
|
|
// Declare variables
|
|
|
|
var input, filter, ul, li, a, i;
|
|
|
|
input = document.getElementById("contacts-search");
|
|
|
|
filter = input.value.toUpperCase();
|
2023-05-13 23:54:35 +00:00
|
|
|
li = document.querySelectorAll("#contact-circle-list>li");
|
2017-04-21 14:04:29 +00:00
|
|
|
|
|
|
|
// 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";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-09-27 16:36:33 +00:00
|
|
|
// @license-end
|