-
Notifications
You must be signed in to change notification settings - Fork 2
/
cs.js
64 lines (52 loc) · 2.6 KB
/
cs.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
chrome.storage.sync.get( null, function( items ) {
if( location.hostname.indexOf( items.cpex_domain ) != -1 ) {
console.log("Init \"Cpex\" ");
$( "body" ).append( "<div id='cp-mojisuu'></div>" );
$( "#cp-mojisuu" ).hide();
if( location.pathname == "/lms/error/notLogin" || location.pathname == "/lms/error/" ) {
location.pathname = "/lms/lginLgir/";
}
if( items.cpex_dark == "true" ){
$("body").addClass("cpex-dark");
}
if( items.cpex_name && !document.forms.logoutActionForm.getElementsByTagName("li")[0].id ) {
document.forms.logoutActionForm.getElementsByTagName("li")[0].innerHTML = items.cpex_name;
}
document.title = items.cpex_title || document.title;
if( items.cpex_disp_x ){
if( items.cpex_disp_x == "left" ){
document.getElementById("cp-mojisuu").style["left"] = 0;
document.getElementById("cp-mojisuu").style.right = "auto";
}
else if( items.cpex_disp_x == "right" ){
document.getElementById("cp-mojisuu").style["right"] = 0;
document.getElementById("cp-mojisuu").style.left = "auto";
}
}
if( items.cpex_disp_y ){
if( items.cpex_disp_y == "top" ){
document.getElementById("cp-mojisuu").style["top"] = 0;
document.getElementById("cp-mojisuu").style.bottom = "auto";
}
else if( items.cpex_disp_y == "bottom" ){
document.getElementById("cp-mojisuu").style["bottom"] = 0;
document.getElementById("cp-mojisuu").style.top = "auto";
}
}
if( items.cpex_disp_size ) $("#cp-mojisuu").css("font-size", String(items.cpex_disp_size) );
$( "textarea" ).on( "click keyup change keydown", function() {
$( "#cp-mojisuu" ).show();
$( "#cp-mojisuu" ).text( this.value.length );
} ).on( "blur", function() {
$( "#cp-mojisuu" ).hide();
} );
if( items.cpex_favicon ){
$('head').append(`<link rel="shortcut icon" type="image/x-icon" href="${items.cpex_favicon}" />`)
}
if( items.cpex_open == "true" ){
if( $(".cs_Bt")[1] ) if( $(".cs_Bt")[1].value == "すべて開く" || $(".cs_Bt")[1].value == "Open all" ) $(".cs_Bt")[1].click();
}
if( items.cpex_attend == "true" && $("#attend").last()[0] && $("#attend").last()[0].value == "出席する" ) $("#attend").last()[0].click();
$( "#loginForm input[type=text]" ).first().focus();
}
} );