Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bromcom VLE to ICS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TheJoeCoder
Bromcom VLE to ICS
Commits
32a36872
Commit
32a36872
authored
Apr 23, 2024
by
TheJoeCoder
Browse files
Options
Downloads
Patches
Plain Diff
Major Refactor
parent
c2c5e417
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bvletools.user.js
+42
-7
42 additions, 7 deletions
bvletools.user.js
with
42 additions
and
7 deletions
bvletools.user.js
+
42
−
7
View file @
32a36872
// ==UserScript==
// ==UserScript==
// @name Bromcom VLE Tools
// @name Bromcom VLE Tools
// @namespace http://radialbog9.uk/
// @namespace http://radialbog9.uk/
// @version 2024-0
2-04
// @version 2024-0
4-23
// @description Bromcom VLE dashboard widget
// @description Bromcom VLE dashboard widget
// @author Radialbog9
// @author Radialbog9
// @match https://vle.bromcomcloud.com/Home/Dashboard
// @match https://vle.bromcomcloud.com/Home/Dashboard
...
@@ -48,10 +48,31 @@
...
@@ -48,10 +48,31 @@
return
[
year
,
month
,
day
].
join
(
'
-
'
);
return
[
year
,
month
,
day
].
join
(
'
-
'
);
}
}
//addEventListener("load", (e) => {
$
(
"
#widgetsDahsboard .grid-stack
"
).
append
(
"
\r\n
<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
\"
>
\r\n
<div class=
\"
panel panel-danger shadow grid-stack-item-content ui-draggable-handle
\"
>
\r\n
<div class=
\"
panel-heading
\"
>
\r\n
<table>
\r\n
<tbody>
\r\n
<tr class=
\"
tableheader
\"
>
\r\n
<td><i style=
\"
font-size:35px; padding-right:5px; padding-left:5px
\"
class=
\"
fa fa fa-wrench
\"
><
\
/i><
\
/td>
\r\n
<td>
\r\n
<h3 class=
\"
panel-title
\"
>Toolkit<
\
/h3><h5 class=
\"
panelSubTitle
\"
>Utilities Toolkit<
\
/h5>
\r\n
<
\
/td>
\r\n
<
\
/tr>
\r\n
<tr><
\
/tr>
\r\n
<
\
/tbody>
\r\n
<
\
/table>
\r\n
<
\
/div>
\r\n
<div id=
\"
content_RB9Buttons
\"
style=
\"
display:block; width: 100%;padding:0px;
\"
class=
\"
ifNoDataInWidget
\"
>
\r\n
<span class=
\"
txtalignCenter
\"
><a id=
\"
rb9ButtonGetTTWeek
\"
>Get Timetable (This Week)<
\
/a><
\
/span>
\r\n
<
\
/div>
\r\n
<
\
/div><div class=
\"
ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se
\"
style=
\"
z-index: 90; display: none;
\"
><
\
/div>
\r\n
<
\
/div>
"
);
$
(
"
#content_RB9Buttons
"
).
append
(
"
<br /><a onclick=
\"
alert(userGuidingUserId.split('$')[0]);
\"
>Get User ID</a>
"
);
function
generateUtilButtonText
(
id
,
text
)
{
var
elem
=
"
<span class=
\"
txtalignCenter
\"
>
"
;
elem
+=
`<a id="
${
id
}
">
${
text
}
</a>`
;
elem
+=
"
</span>
"
;
elem
+=
"
<br />
"
;
return
elem
;
}
$
(
"
#widgetsDahsboard .grid-stack
"
)
.
append
(
"
\n
<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
\"
>
\n
<div class=
\"
panel panel-danger shadow grid-stack-item-content ui-draggable-handle
\"
>
\n
<div class=
\"
panel-heading
\"
>
\n
<table>
\n
<tbody>
\n
<tr class=
\"
tableheader
\"
>
\n
<td><i style=
\"
font-size:35px; padding-right:5px; padding-left:5px
\"
class=
\"
fa fa fa-wrench
\"
><
\
/i><
\
/td>
\n
<td>
\n
<h3 class=
\"
panel-title
\"
>Toolkit<
\
/h3><h5 class=
\"
panelSubTitle
\"
>Utilities Toolkit<
\
/h5>
\n
<
\
/td>
\n
<
\
/tr>
\n
<tr><
\
/tr>
\n
<
\
/tbody>
\n
<
\
/table>
\n
<
\
/div>
\n
<div id=
\"
content_RB9Buttons
\"
style=
\"
display:block; width: 100%;padding:0px;
\"
class=
\"
ifNoDataInWidget
\"
>
\n
<
\
/div>
\n
<
\
/div><div class=
\"
ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se
\"
style=
\"
z-index: 90; display: none;
\"
><
\
/div>
\n
<
\
/div>
"
);
//$("#content_RB9Buttons").append("<span class=\"txtalignCenter\"><a id=\"rb9ButtonGetTTWeek\">Get Timetable (This Week)<\/a><\/span>");
//$("#content_RB9Buttons").append("<br /><a onclick=\"alert(userGuidingUserId.split('$')[0]);\">Get User ID</a>");
$
(
"
#content_RB9Buttons
"
).
append
(
generateUtilButtonText
(
"
rb9ButtonGetTTWeek
"
,
"
Get Timetable (This Week)
"
));
$
(
"
#content_RB9Buttons
"
).
append
(
generateUtilButtonText
(
"
rb9ButtonGetTTWeekNext
"
,
"
Get Timetable (Next Week)
"
));
$
(
"
#content_RB9Buttons
"
).
append
(
generateUtilButtonText
(
"
rb9ButtonGetUserId
"
,
"
Get User ID
"
));
$
(
"
#rb9ButtonGetUserId
"
).
on
(
"
click
"
,
()
=>
{
var
userIdParts
=
userGuidingUserId
.
split
(
"
$
"
);
var
id_user
=
userIdParts
[
0
];
var
id_institution
=
userIdParts
[
1
];
alert
(
`User ID:
${
id_user
}
\nInstitution ID:
${
id_institution
}
`
);
});
$
(
"
#rb9ButtonGetTTWeek
"
).
on
(
"
click
"
,
()
=>
{
$
(
"
#rb9ButtonGetTTWeek
"
).
on
(
"
click
"
,
()
=>
{
var
now
=
new
Date
();
var
now
=
new
Date
();
...
@@ -59,6 +80,21 @@
...
@@ -59,6 +80,21 @@
var
lastSunday
=
new
Date
(
today
.
setDate
(
today
.
getDate
()
-
today
.
getDay
()));
var
lastSunday
=
new
Date
(
today
.
setDate
(
today
.
getDate
()
-
today
.
getDay
()));
var
nextSaturday
=
new
Date
(
lastSunday
).
setDate
(
lastSunday
.
getDate
()
+
6
);
var
nextSaturday
=
new
Date
(
lastSunday
).
setDate
(
lastSunday
.
getDate
()
+
6
);
var
url
=
"
https://vle.bromcomcloud.com/Timetable/GetTimeTable?WeekStartDate=
"
+
formatDate
(
lastSunday
)
+
"
&weekEndDate=
"
+
formatDate
(
nextSaturday
)
+
"
&type=1&id=0
"
;
var
url
=
"
https://vle.bromcomcloud.com/Timetable/GetTimeTable?WeekStartDate=
"
+
formatDate
(
lastSunday
)
+
"
&weekEndDate=
"
+
formatDate
(
nextSaturday
)
+
"
&type=1&id=0
"
;
$
.
ajax
({
url
:
url
,
method
:
"
POST
"
,
dataType
:
"
json
"
})
.
done
((
data
)
=>
{
var
data_str
=
JSON
.
stringify
(
data
);
console
.
log
(
data_str
);
navigator
.
clipboard
.
writeText
(
data_str
);
alert
(
"
Copied to Clipboard. Len(table) =
"
+
data
[
"
table
"
].
length
);
});
});
$
(
"
#rb9ButtonGetTTWeekNext
"
).
on
(
"
click
"
,
()
=>
{
var
now
=
new
Date
();
var
today
=
new
Date
(
now
.
getFullYear
(),
now
.
getMonth
(),
now
.
getDate
()
+
7
);
// Forward 1 week
var
lastSunday
=
new
Date
(
today
.
setDate
(
today
.
getDate
()
-
today
.
getDay
()));
var
nextSaturday
=
new
Date
(
lastSunday
).
setDate
(
lastSunday
.
getDate
()
+
6
);
var
url
=
"
https://vle.bromcomcloud.com/Timetable/GetTimeTable?WeekStartDate=
"
+
formatDate
(
lastSunday
)
+
"
&weekEndDate=
"
+
formatDate
(
nextSaturday
)
+
"
&type=1&id=0
"
;
$
.
ajax
({
url
:
url
,
method
:
"
POST
"
,
dataType
:
"
json
"
})
$
.
ajax
({
url
:
url
,
method
:
"
POST
"
,
dataType
:
"
json
"
})
.
done
((
data
)
=>
{
.
done
((
data
)
=>
{
var
data_str
=
JSON
.
stringify
(
data
);
var
data_str
=
JSON
.
stringify
(
data
);
...
@@ -67,5 +103,4 @@
...
@@ -67,5 +103,4 @@
alert
(
"
Copied to Clipboard.
"
);
alert
(
"
Copied to Clipboard.
"
);
});
});
});
});
//});
})();
})();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment