Skip to content

Instantly share code, notes, and snippets.

@gilchris
Last active October 24, 2017 16:12
Show Gist options
  • Save gilchris/0ad8e27b9fd86b2a9e6a6be2022998d5 to your computer and use it in GitHub Desktop.
Save gilchris/0ad8e27b9fd86b2a9e6a6be2022998d5 to your computer and use it in GitHub Desktop.
온누리교회 nCare 이용에 도움을 주는 TemperMonkey용 스크립트
// ==UserScript==
// @name Onnuri nCare Attendance
// @namespace http://icare.ionnuri.org/
// @version 0.3
// @description try to take over the world!
// @author gilchris
// @match http://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// 출석 목록
if (location.href.indexOf('choolsuk.do') > -1) {
$("#AXTreeTarget2").bind("DOMSubtreeModified", function() {
$(".rows").click(function() {
var dlb = $(".dlb_td").map(function() { return ($(this).css("color") == "rgb(255, 255, 255)") ? $(this).children(".sehak").text() : undefined; }).get()[0];
var soon = $(".soon_td").map(function() { return ($(this).css("color") == "rgb(255, 255, 255)") ? $(this).children(".soon").text() : undefined; }).get()[0];
var thisClass = $(this).attr('lang');
var thisId = $(this).attr('id');
location.href = 'choolsuk.do?act=choolsukUpdate&dlb='+encodeURIComponent(dlb)+'&soon='+encodeURIComponent(soon)+'&bogoday='+encodeURIComponent(thisClass);
});
});
}
// 반별 출석
if (location.href.indexOf('act=choolsukUpdate') > -1) {
// 전체 출석 체크 버튼 추가
var btnAttendAll = $("#choolsuk_update")
.clone()
.attr('id', 'attend_all')
.val('전체 출석')
.on('click', function() {
$("input[type=checkbox].gridCheckBox_body_colSeq6").map(function(i, el) {
if (false === el.checked) {
el.click();
}
});
$("option[value=' ']").prop('selected', true);
});
$("#choolsuk_update").parent().append(btnAttendAll);
// 출석 체크 시 자동으로 사유를 없앰
$("#AXGridTarget").bind("DOMSubtreeModified", function() {
$("input[type='checkbox'].gridCheckBox_body_colSeq6").click(function() {
if ($(this).prop("checked")) {
$("#" + $(this).attr("id").replace("checkboxItem_AX_6", "bodyText_AX_0_AX_7") + " > select > option[value=' ']").prop("selected", true);
} else {
$("#" + $(this).attr("id").replace("checkboxItem_AX_6", "bodyText_AX_0_AX_7") + " > select > option[value='사유를 알지 못하는 결석']").prop("selected", true);
}
});
});
// 직적입력을 골랐다가 다시 드롭다운 메뉴로 돌아가는 버튼 추가
}
// 교사 목록 칸 넓힘
if (location.href.indexOf('teacher.do') > -1) {
$("#AXGridTarget").height('980px');
myGrid.resetHeight();
}
// 새친구 목록에서 기본값을 미배정으로..
if (location.href.indexOf('newMember.do') > -1) {
$("#AXSearchTarget_AX_0_AX_0_AX_radiobox_AX_2").click();
fnObj.grid.search();
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment