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
204effbb
Commit
204effbb
authored
Apr 23, 2024
by
TheJoeCoder
Browse files
Options
Downloads
Patches
Plain Diff
Split functions out to reduce duplicate code
parent
32a36872
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
+16
-11
16 additions, 11 deletions
bvletools.user.js
with
16 additions
and
11 deletions
bvletools.user.js
+
16
−
11
View file @
204effbb
...
@@ -57,15 +57,26 @@
...
@@ -57,15 +57,26 @@
return
elem
;
return
elem
;
}
}
function
appendUtilButton
(
id
,
text
)
{
$
(
"
#content_RB9Buttons
"
).
append
(
generateUtilButtonText
(
id
,
text
));
}
function
timetableToClipboardProcess
(
data
)
{
var
data_str
=
JSON
.
stringify
(
data
);
console
.
log
(
data_str
);
navigator
.
clipboard
.
writeText
(
data_str
);
alert
(
"
Copied to Clipboard.
\n
Number of lessons
"
+
data
[
"
table
"
].
length
);
}
$
(
"
#widgetsDahsboard .grid-stack
"
)
$
(
"
#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>
"
);
.
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("<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("<br /><a onclick=\"alert(userGuidingUserId.split('$')[0]);\">Get User ID</a>");
$
(
"
#content_RB9Buttons
"
).
append
(
generate
UtilButton
Text
(
"
rb9ButtonGetTTWeek
"
,
"
Get Timetable (This Week)
"
)
)
;
append
UtilButton
(
"
rb9ButtonGetTTWeek
"
,
"
Get Timetable (This Week)
"
);
$
(
"
#content_RB9Buttons
"
).
append
(
generate
UtilButton
Text
(
"
rb9ButtonGetTTWeekNext
"
,
"
Get Timetable (Next Week)
"
)
)
;
append
UtilButton
(
"
rb9ButtonGetTTWeekNext
"
,
"
Get Timetable (Next Week)
"
);
$
(
"
#content_RB9Buttons
"
).
append
(
generate
UtilButton
Text
(
"
rb9ButtonGetUserId
"
,
"
Get User ID
"
)
)
;
append
UtilButton
(
"
rb9ButtonGetUserId
"
,
"
Get User ID
"
);
$
(
"
#rb9ButtonGetUserId
"
).
on
(
"
click
"
,
()
=>
{
$
(
"
#rb9ButtonGetUserId
"
).
on
(
"
click
"
,
()
=>
{
var
userIdParts
=
userGuidingUserId
.
split
(
"
$
"
);
var
userIdParts
=
userGuidingUserId
.
split
(
"
$
"
);
...
@@ -82,10 +93,7 @@
...
@@ -82,10 +93,7 @@
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
"
})
$
.
ajax
({
url
:
url
,
method
:
"
POST
"
,
dataType
:
"
json
"
})
.
done
((
data
)
=>
{
.
done
((
data
)
=>
{
var
data_str
=
JSON
.
stringify
(
data
);
timetableToClipboardProcess
(
data
);
console
.
log
(
data_str
);
navigator
.
clipboard
.
writeText
(
data_str
);
alert
(
"
Copied to Clipboard. Len(table) =
"
+
data
[
"
table
"
].
length
);
});
});
});
});
...
@@ -97,10 +105,7 @@
...
@@ -97,10 +105,7 @@
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
"
})
$
.
ajax
({
url
:
url
,
method
:
"
POST
"
,
dataType
:
"
json
"
})
.
done
((
data
)
=>
{
.
done
((
data
)
=>
{
var
data_str
=
JSON
.
stringify
(
data
);
timetableToClipboardProcess
(
data
);
console
.
log
(
data_str
);
navigator
.
clipboard
.
writeText
(
data_str
);
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