Skip to content

Commit

Permalink
Merge branch 'main' into v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
esllo committed May 22, 2021
2 parents f5e0302 + 73b0ece commit fac86b3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
7 changes: 4 additions & 3 deletions README.md
@@ -1,6 +1,7 @@
# ClassPlus
코스모스 기능 확장 플러그인

크롬 스토어 : [ClassPlus](https://chrome.google.com/webstore/detail/classplus/kmbnhpalnepccnjgaobhndnkimepecbl/related?hl=ko)

## Todo List

Expand All @@ -18,11 +19,11 @@

### 프로그램의 느린 로딩
해당 프로그램은 코스모스가 공식 API를 제공하지 않음에 따라 HTTP 요청 후 파싱으로 동작합니다.
따라서 코스모스에 응답 속도에 따라 로딩 속도가 변합니다.
따라서 코스모스의 응답 속도에 따라 로딩 속도가 변합니다.
~~코스모스 자체의 응답이 느리고, Promise.all을 통해 모든 로딩이 끝난 경우만 처리하기 때문에 로딩이 느릴 수 있습니다.~~
너무 긴 로딩으로 인하여 Promise.all은 임시 비활성화 하였습니다.

### 동영상 배속
동영상 수강의 시작 시간과 종료 시간이 저장되므로, 첫 강의를 배속으로 들을 경우 수강 시간이 인정되지 않을 수 있습니다.
동영상 시작 시간과 종료 시간이 저장되어, 첫 강의를 배속으로 들을 경우 수강 시간이 인정되지 않을 수 있습니다.
해당 기능은 기본적으로 비활성화 상태로 되어있으며 설정에서 활성화할 수 있습니다.
해당 기능을 통해 수강 후 수강인정이 되지 않더라도 본 프로그램에서는 아무 책임도 지지 않습니다.
해당 기능을 통해 수강 후 수강인정이 되지 않더라도 본 프로그램은 아무런 책임이 없습니다.
8 changes: 6 additions & 2 deletions js/report_us.js
Expand Up @@ -3,6 +3,10 @@
const HOST = location.host
const BASE_URL = `${PROTOCOL}//${HOST}/mod/assign/`

function checkLangKor(){
return document.querySelector('.user-info-shortcut > li > a').textContent === '파일 관리'
}

function insertReportLabel(parent, id) {
const numId = id.split('=')[1]
const elementId = `cp-report-${numId}`
Expand All @@ -12,11 +16,11 @@
}
return fetch(`${BASE_URL}${id}`).then(e => e.text()).then(text => {
const tbody = text.split('tbody')
let textValue = '미제출 과제 : '
let textValue = checkLangKor() ? '미제출 과제 : ' : 'Assignments : '
let isAccent = false
if (tbody.length === 3) {
const [, html] = tbody
const inProgress = (html.match(/\>미제출\</g) || []).length
const inProgress = (html.match(/\>(미제출|No\ssubmission)\</g) || []).length
textValue += inProgress
isAccent = inProgress > 0
} else {
Expand Down
18 changes: 14 additions & 4 deletions js/signup_us.js
Expand Up @@ -11,6 +11,10 @@
}, 0)
}

function checkLangKor(){
return document.querySelector('.user-info-shortcut > li > a').textContent === '파일 관리'
}

function insertSignupLabel(parent, id) {
const numId = id.split('=')[1]
const elementId = `cp-signup-${numId}`
Expand All @@ -19,10 +23,15 @@
parent.removeChild(before)
}
return fetch(`${BASE_URL}${id}`).then(e => e.text()).then(text => {
let textValue = '미수강 영상 : '
let textValue = checkLangKor() ? '미수강 영상 : ' : 'Not Watched : '
let isAccent = false
if (text.indexOf('요구시간') !== -1) {
const splitted = text.split('요구시간')[1].split('<tbody>')[1]
if (text.indexOf('요구시간') !== -1 || text.indexOf('Required</th>') !== -1) {
let divider = '요구시간'
if(text.indexOf('Required</th>')!==-1){
divider = 'Required</th>'
}
const splitted = text.split(divider)[1].split('<tbody>')[1]

let body = splitted.split('</tbody>')[0]
const trs = body.split('<tr>')
let notSignedUp = 0
Expand All @@ -35,6 +44,7 @@
const requestTime = timeToDecimal(requestText)
const watchedTime = timeToDecimal(watchedText)
if (requestTime > watchedTime) notSignedUp++
console.log(requestText, watchedText)
}
})
textValue += notSignedUp
Expand All @@ -49,7 +59,7 @@
}
p.textContent = textValue
const prof = parent.querySelector('.prof')
const left = prof.offsetLeft + 108
const left = prof.offsetLeft + 116
p.style.left = `${left}px`
return [parent, p]
})
Expand Down

0 comments on commit fac86b3

Please sign in to comment.