+ var rclickmenu = document.getElementById('rclickmenu');
+ var scopes = document.querySelectorAll('.userselector');
+ document.addEventListener("click", (e) =>
+ {
+ if (e.target.offsetParent != rclickmenu)
+ {
+ rclickmenu.classList.remove("visible");
+ }
+ });
+ scopes.forEach((scope) => {
+ scope.addEventListener("contextmenu", (event) =>
+ {
+ event.preventDefault();
+ var { clientX: mouseX, clientY: mouseY } = event;
+ var name = $('#' + scope.id).attr('value')
+ document.getElementById("rclick_opt1").innerHTML = 'View details for ' + name;
+ rclickmenu.style.top = `${mouseY}px`;
+ rclickmenu.style.left = `${mouseX}px`;
+ rclickmenu.classList.remove("visible");
+ setTimeout(() => { rclickmenu.classList.add("visible"); });
+ });
+ });
+ document.addEventListener('keydown', (event) => {
+ if (event.key === 'Escape')
+ {
+ rclickmenu.classList.remove("visible");
+ }
+});
+
+$(document).ready( function () {
+ args = {
+ 'responsive': true,
+ 'fixedHeader': {
+ header: true,
+ headerOffset: 53
+ },
+ 'ajax': {
+ 'url': '<?php echo get_config("base_url"); ?>api/users.php',
+ dataSrc: ''
+ },
+ 'pageLength':100,
+ 'order':[[1,'asc']],
+ 'columns': [
+ { 'data': 'Select', 'responsivePriority': 1 },
+ { 'data': 'Nick', 'responsivePriority': 1 },
+ { 'data': 'Country', 'className':'countrycol', 'responsivePriority': 2 },
+ { 'data': 'Host/IP', 'className':'hostname', 'responsivePriority': 5 },
+ { 'data': 'Account', 'className':'accountcol', 'responsivePriority': 3 },
+ { 'data': 'Oper', 'className':'opercol', 'responsivePriority': 8 },
+ { 'data': 'Connected to', 'className':'uplinkcol', 'responsivePriority': 6 },
+ { 'data': 'Reputation', 'className':'reputationcol', 'responsivePriority': 4 },
+ ],
+ };
+ /* Hide on mobile */
+ if (window.innerWidth > 800)
+ {
+ args['dom'] = 'Pfrtip';
+ args['searchPanes'] = {
+ 'initCollapsed': 'true',
+ 'columns': [2,6],
+ 'dtOpts': {
+ select: { style: 'multi'},
+ order: [[ 1, "desc" ]]
+ },
+ }
+ }
+
+ $('#data_list').DataTable(args);
+} );
+