Created
April 29, 2020 13:37
-
-
Save sohsatoh/07be936e7ce7387f5f328f4989745e43 to your computer and use it in GitHub Desktop.
Revisions
-
sohsatoh created this gist
Apr 29, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ document.body.appendChild((function(){ var jq = document.createElement("script"); jq.src = '//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js'; return jq; })()); if(confirm('OKで評定検索、キャンセルで再履修科目の検索')){ searchGrade(); }else{ searchRepeat(); } function searchGrade() { var gradeDict = {}; $.each($('.tdHyokaList'), function(i, val) { var grade = $(val).text(); if(grade != ""){ if(grade in gradeDict) { gradeDict[grade]['授業数']++; gradeDict[grade]['単位数'] += Number($(this).parent().find('.tdTaniList').text()); } else { gradeDict[grade] = {}; gradeDict[grade]['授業数'] = 1; gradeDict[grade]['単位数'] = Number($(this).parent().find('.tdTaniList').text()); } } }); alert(JSON.stringify(gradeDict,null,'\t')); } function searchRepeat() { var classDict = {}; $.each($('.tdKamokuList'), function(i, val) { if($(this).parents('.kamokuList').parent().find('.tdKyoshokuinNameList').text() != ''){ var className = $(val).text(); var gradeNum = $(this).parents('.kamokuList').parent().find('.tdTaniList').text(); if(gradeNum) { console.log(className + ' is deleted'); if(className in classDict) delete classDict[className]; } else classDict[className] = gradeNum; } }); console.log(Object.keys(classDict)); alert('※必修かどうかは判定されません!\n' + Object.keys(classDict)); }