-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtuwel-group-member-list.user.js
35 lines (30 loc) · 1.29 KB
/
tuwel-group-member-list.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// ==UserScript==
// @name TUWEL: Show group members
// @namespace https://fsinf.at/
// @downloadURL https://fsinf.at/userscripts/tuwel-group-member-list.user.js
// @updateURL https://fsinf.at/userscripts/tuwel-group-member-list.user.js
// @version 1
// @grant none
// @include https://tuwel.tuwien.ac.at/mod/grouptool/view.php*
// ==/UserScript==
var textBreadcrumb = document.getElementsByClassName('breadcrumb')[0].innerHTML;
var courseId = textBreadcrumb.match('id\=([0-9]+)')[1]
var groupContainers = document.body.getElementsByClassName('showmembers');
for (var i = 0; i < groupContainers.length; i++) {
var groupContainer = groupContainers[i];
var showMemberLink = groupContainer.firstElementChild
var groupData = showMemberLink.getAttribute('data-absregs');
var groupObj = JSON.parse(groupData);
var listNode = document.createElement('ul');
for (var y = 0; y < groupObj.length; y++) {
var listItemNode = document.createElement('li');
var memberObj = groupObj[y];
const a = document.createElement('a');
a.href = 'https://tuwel.tuwien.ac.at/user/view.php?course=' + courseId + '&id=' + memberObj.id;
a.target = '_blank';
a.textContent = memberObj.fullname;
listItemNode.appendChild(a);
listNode.appendChild(listItemNode);
}
groupContainer.appendChild(listNode);
}