x x x
x
Only portrait mode is currently supported - please rotate your device.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Hide If
groupconfluence-administrators, operations-admins,smith-administrators


HTML
<div id="edit-style-container"> </div>

<script>
let disableEKey = true; 
const countryAdminGroup = "operations-admins";
var adminCanEdit = false;

async function checkIfCountryAdmin () {
    let groupsRes = await jQuery.ajax({
      url: "/rest/api/user/memberof?username=" + AJS.params.remoteUser,
      type: "get",
      dataType: "json"
    }).then(res => res);
	
	groupsRes = groupsRes.results;
    console.log(groupsRes);

    for (let i = 0; i < groupsRes.length; i++) {
      let groupName = groupsRes[i].name;
      if (groupName === countryAdminGroup) {
         adminCanEdit = true;
      }
    }
	
	return true;
}

checkIfCountryAdmin().then(res => {
	if (!adminCanEdit) {
		document.getElementById("edit-style-container").innerHTML = (`<style> 
	.micropost .micropost-right .micropost-header .micropost-action-menu.show-permanent {
		display: none !important;
	}
 </style>`);
	}
});

    $(document).on("keydown", function (e) {
      // Disabled Keys are c, e, k, n, l
      disableKeys = [67, 69, 75, 76, 78];
	  console.log("keydown", e.target)
      if (disableEKey && disableKeys.includes(e.keyCode)) {
        e.preventDefault();
        return;
      }
    });
</script>


...