-
Notifications
You must be signed in to change notification settings - Fork 3
/
single_student_presence_siscad_tweak.user.js
45 lines (43 loc) · 1.6 KB
/
single_student_presence_siscad_tweak.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
36
37
38
39
40
41
42
43
44
45
// ==UserScript==
// @name SiscadFrequencySingleStudent
// @author andvicoso
// @namespace andvicoso_siscad_tweak
// @description Single Student frequency edit
// @version 1.8
// @grant none
// @icon https://siscad-admin.ufms.br/favicon.ico
// @downloadURL https://github.com/andvicoso/siscad_tweak/raw/master/single_student_presence_siscad_tweak.user.js
// @include https://siscad-admin.ufms.br/titan.php?toSection=12&toAction=edit*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js
// @require https://raw.githubusercontent.com/jmosbech/StickyTableHeaders/master/js/jquery.stickytableheaders.min.js
// @require https://raw.githubusercontent.com/andvicoso/siscad_tweak/master/siscad_tweak_utils.js
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);
var all = $('#notas > tbody > tr:not(.cabecalho)');
var total = all.length;
all.each(function (index) {
var line = $(this);
var obj = line.find('input.input_hide');
var value = getValue(obj.val());
var presence = 'P';
if (isFailed(value)) {
presence = 'F';
}
//set the defined presence to each input text field of the line
//single click, multiple edition
var inputs = line.find('.input_hide');
inputs.each(function (index) {
if (!$(this).val()) {
$(this).val(presence);
$(this).css('font-weight','Bold');
}
$(this).click(function () {
var currpresence = $(this).val();
inputs.each(function (index) {
$(this).val(currpresence);
$(this).css('font-weight','normal');
});
});
});
highlightLinks(line);
});