Select Git revision
bvletools.user.js
bvletools.user.js 9.65 KiB
// ==UserScript==
// @name Bromcom VLE Tools
// @namespace http://radialbog9.uk/
// @version 2024-04-23_03
// @description Bromcom VLE dashboard widget
// @author Radialbog9
// @match https://vle.bromcomcloud.com/*
// @downloadURL https://git.rb9.xyz/TheJoeCoder/bromcom-vle-to-ics/-/raw/main/bvletools.user.js
// @updateURL https://git.rb9.xyz/TheJoeCoder/bromcom-vle-to-ics/-/raw/main/bvletools.user.js
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
/*
<div class="grid-stack-item ui-draggable ui-resizable ui-resizable-autohide ui-resizable-disabled" id="gs_RB9Buttons" data-color="danger" data-gs-id="gs_RB9Buttons" data-gs-x="8" data-gs-y="2" data-gs-width="4" data-gs-height="2" data-gs-no-resize="yes">
<div class="panel panel-danger shadow grid-stack-item-content ui-draggable-handle">
<div class="panel-heading">
<table>
<tbody>
<tr class="tableheader">
<td><i style="font-size:35px; padding-right:5px; padding-left:5px" class="fa fa fa-wrench "></i></td>
<td>
<h3 class="panel-title">Toolkit</h3><h5 class="panelSubTitle">Utilities Toolkit</h5>
</td>
</tr>
<tr></tr>
</tbody>
</table>
</div>
<div id="content_RB9Buttons" style="display:block; width: 100%;padding:0px;" class="ifNoDataInWidget">
<span class="txtalignCenter"><a id="rb9ButtonGetTTWeek">Get Timetable (This Week)</a></span>
</div>
</div><div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se" style="z-index: 90; display: none;"></div>
</div>
*/
// Behaviour page script modifications
if (window.location.href.endsWith("/Behaviour")) {
console.log("[RB9] Override function handlers");
// copied from https://vle.bromcomcloud.com/lib/pages/js/behaviour.js
var toCamelCase = (str) => {
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
return index == 0 ? word.toLowerCase() : word.toUpperCase();
}).replace(/\s+/g, '');
}
// copied from https://vle.bromcomcloud.com/lib/pages/js/behaviour.js
var loadBehaviourTable = () => {
$(".wait").show();
$.ajax({
url: "/Behaviour/StudentBehaviour",
type: "Post",
data: null,
contentType: false,
processData: false,
cache: false,
success: function (data) {
console.log(data);
$(".wait").hide();
var content = "";
var headerContent = "";
if (data.behaviourStudentEventHeader.length > 0) {
headerContent += "<tr>"
for (var i = 0; i < data.behaviourStudentEventHeader.length; i++) {
headerContent += "<th>" + data.behaviourStudentEventHeader[i].displayName.replace(/([A-Z])/g, ' $1').trim() + "</th>"
}
headerContent += "</tr>"
}
if (data.studentEvents.length > 0) {