Skip to content

Commit

Permalink
ウィジェット表示設定を追加/自動出席の挙動を変更 [2.6]
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsgi committed Jun 25, 2019
1 parent 2d7eca1 commit 45a0db2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 17 deletions.
37 changes: 25 additions & 12 deletions cs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,40 @@ chrome.storage.sync.get( null, function( items ) {

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_disp_size ) $("#cp-mojisuu").css("font-size", String(items.cpex_disp_size) );

if( items.cpex_name ) document.forms.logoutActionForm.getElementsByTagName("li")[0].innerHTML = items.cpex_name;
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" ) $("#cp-mojisuu").css("left", "0").css("right", "auto");
else if( items.cpex_disp_x == "right" ) $("#cp-mojisuu").css("right", "0").css("left", "auto");
console.log(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" ) $("#cp-mojisuu").css("top", "0").css("bottom", "auto");
else if( items.cpex_disp_y == "bottom" ) $("#cp-mojisuu").css("bottom", "0").css("top", "auto");
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";
}
}

$( "body" ).append( "<div id='cp-mojisuu'></div>" );
$( "#cp-mojisuu" ).hide();
if( items.cpex_disp_size ) $("#cp-mojisuu").css("font-size", String(items.cpex_disp_size) );

$( "textarea" ).on( "click keyup", function() {
$( "#cp-mojisuu" ).show();
Expand All @@ -33,9 +46,9 @@ chrome.storage.sync.get( null, function( items ) {
} );

if( items.cpex_open == "true" ){
if( $(".cs_Bt")[1].value == "すべて開く" || $(".cs_Bt")[1].value == "Open all" ) $(".cs_Bt")[1].click();
if( $(".cs_Bt")[1] && $(".cs_Bt")[1].value == "すべて開く" || $(".cs_Bt")[1].value == "Open all" ) $(".cs_Bt")[1].click();
}
if( items.cpex_attend == "true" && $("#attend")[0].value == "出席する" ) $("#attend")[0].click();

if( items.cpex_attend == "true" && $("#attend").last()[0] && $("#attend").last()[0].value == "出席する" ) $("#attend").last()[0].click();
}
} );
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Cpextend",
"short_name": "Cpex",
"version": "2.5",
"version": "2.6",
"description": "CoursePowerを使いやすくするChrome拡張です",
"icons": {
"16": "16.png",
Expand Down
8 changes: 4 additions & 4 deletions opt.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
</div>
</div>

<div class="form" style="display: none">
<div class="form">
<div class="form-title">ウィジェット設定</div>
<div class="form-content">
<!--
<div class="desc">表示位置を指定します。</div>

<div class="desc">文字数カウンターの表示位置を指定します</div>
<select id="disp-x">
<option value="left"></option>
<option value="right" selected></option>
Expand All @@ -36,7 +36,7 @@
<option value="top"></option>
<option value="bottom" selected></option>
</select>
-->

<div class="desc">フォントサイズを指定します。</div>
<input type="text" value="30px" id="disp-size">
</div>
Expand Down

0 comments on commit 45a0db2

Please sign in to comment.