<div id="edit-style-container"> </div>
<script>
let disableEKey = true;
const countryAdminGroup = getQueryVariableFromUrl("cc") + "-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;
} else if(groupName === "judging-administrators"){
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> |