0% found this document useful (0 votes)
16 views7 pages

User Script

The script adds a button to view student lists to each row on the student group page. When clicked, it loads the student list into a modal overlay on the page. It fetches the student data from an API and builds a table to display the names, IDs, dates and classes.

Uploaded by

no name
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views7 pages

User Script

The script adds a button to view student lists to each row on the student group page. When clicked, it loads the student list into a modal overlay on the page. It fetches the student data from an API and builds a table to display the names, IDs, dates and classes.

Uploaded by

no name
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

// ==UserScript==

// @name Xem Dssv Qldt Ptit


// @namespace [Link]
// @version 1.0.0
// @description Try to take over the world!
// @author NhatHoang
// @match [Link]
// ==/UserScript==

function nhatHoang(data) {
const rowHeader = [Link]('#printArea table thead tr')
const arrHeader = [Link]('#printArea table thead tr th')
if ([Link] <= 13) {
const th = [Link]('th')
[Link](th)
}

const arrElement = [Link]('#printArea table tbody tr')

[Link](function (element, index) {


const td = [Link]('td')
[Link] = 'align-middle'
const button = [Link]('button')
[Link] = 'btn btn-outline-primary btnprintxem'
[Link] = 'DSSV'
[Link]('click', () => {
handleClick([Link].ds_nhom_to[index].id_to_hoc)
})
[Link](button)
[Link](td);
});
}

const handleClick = async (id) => {


const body = [Link]('body')
[Link] = 'hidden'

const page = [Link]('.[Link]-star-inserted')


const container = [Link]('div')
[Link] = 'dssv'
[Link] = 'd-flex justify-content-center position-fixed w-100 h-100 top-0 start-0 overflow-auto'
[Link] = 'rgba(0, 0, 0, .9)'
[Link] = '10000'

[Link]('click', () => handleClose())

createTable(id, container)

[Link](container)
}

const createTable = async (id, container) => {


const loading = [Link]('div')
[Link] = 'ng-tns-c41-11 la-2x la-ball-clip-rotate-multiple ng-star-inserted'
[Link] = 'rgb(255, 255, 255)'
const first = [Link]('div')
[Link] = 'ng-tns-c41-11 ng-star-inserted'
const last = [Link]('div')
[Link] = 'ng-tns-c41-11 ng-star-inserted'

[Link](first)
[Link](last)
[Link](loading)
[Link]('align-items-center')

const data = await getDssv(id)

if (data === null || [Link] !== 200) {


const notify = [Link]('div')
[Link] = 'bg-primary p-3 text-white fs-5'
[Link] = "Có lỗi xảy ra!"
[Link]('click', (e) => [Link]())
[Link](notify)
[Link]()
return
}

const listSv = [Link].ds_sinh_vien

if ([Link] === 0) {
const notify = [Link]('div')
[Link] = 'bg-primary p-3 text-white fs-5'
[Link] = "Danh sách sinh viên trống!"
[Link]('click', (e) => [Link]())
[Link](notify)
[Link]()
return
}

[Link]('align-items-center')
[Link]()

const table = [Link]('table');


[Link] = 'bg-light'

const thead = [Link]('thead');


[Link] = 'position-sticky top-0'

const headerRow = [Link]('tr');


[Link] = 'bg-primary text-center align-middle'

const headerTitle = [
'STT',
'Mã sinh viên',
'Họ và tên',
'Ngày sinh',
'Lớp'
]
for (let i = 0; i < [Link]; i++) {
const th = [Link]('th');
[Link] = headerTitle[i]
[Link] = 'px-3 py-2 border border-top-0 text-center align-middle'
[Link](th);
}

[Link](headerRow);
[Link](thead);

const tbody = [Link]('tbody');

for (let i = 0; i < [Link]; i++) {

const row = [Link]('tr');


[Link] = 'text-center align-middle ng-star-inserted'
const tdStt = [Link]('td');
[Link] = 'px-3 py-1 border text-center align-middle ng-star-inserted'
[Link] = i + 1
[Link](tdStt);

const tdMsv = [Link]('td');


[Link] = 'px-3 py-1 border text-center align-middle ng-star-inserted'
[Link] = listSv[i].ma_sinh_vien
[Link](tdMsv);

const tdName = [Link]('td')


[Link] = 'px-3 py-1 border text-left align-middle custenmon ng-star-inserted'
[Link] = listSv[i].ho_lot + ' ' + listSv[i].ten
[Link](tdName);

const tdDate = [Link]('td');


[Link] = 'px-3 py-1 border text-center align-middle ng-star-inserted'
[Link] = listSv[i].ngay_sinh
[Link](tdDate);

const tdClass = [Link]('td');


[Link] = 'px-3 py-1 border text-left align-middle ng-star-inserted'
[Link] = listSv[i].ten_lop
[Link](tdClass);

[Link](row);
}

[Link](tbody);
[Link]('click', (e) => [Link]())
[Link](table)
}

const handleClose = () => {


const body = [Link]('body')
[Link]('overflow-y')

const dssv = [Link]('#dssv')


[Link]()
}

const getDssv = async (id) => {


try {
const res = await fetch('[Link] {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${[Link]([Link]("CURRENT_USER")).access_token}`
},
body: [Link]({
filter: {
id_to_hoc: id,
id_sinh_hoat: "NhatHoang"
},
additional: {
paging: {
limit: 500,
page: 1
},
ordering: [{
name: null,
order_type: 0
}]
}
})
})
const data = await [Link]()
return data
} catch (error) {
return null
}
}

(function () {
'use strict';
const url = "/api/sch/w-locdstkbhockytheodoituong";
const originalXhrSend = [Link];
[Link] = function () {
const xhr = this;
[Link] = function () {
if ([Link] === 4 && xhr.__zone_symbol__xhrURL === url) {
const data = [Link]([Link])
setTimeout(() => nhatHoang(data), 0)
}
};
[Link](this, arguments);
};
})();

You might also like