kw-service / klas-helper-userscript

[DEPRECATED] 광운대학교 KLAS 사이트에 편리한 기능을 추가할 수 있는 유저 스크립트
MIT License
65 stars 27 forks source link

인터넷이 느린 상황에서 스크립트 작동 안됨 #76

Closed mirusu400 closed 2 years ago

mirusu400 commented 2 years ago

image

클라스 사이트 구조가, 페이지를 우선 로드해서 다 띄워놓고 필요한 값들을 추가로 요청한다음에 동적으로 이를 그리고 있습니다.

문제는, 이 프로그램 진입점이

window.addEventListener('load', () => {
  const dependencies = [
    'https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.js',
    'https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.css',
    'https://cdn.jsdelivr.net/npm/chart.js@2.9.3/dist/Chart.min.js'
  ];
...

이런식으로 load 할때 스크립트를 실행하기때문에, 아직 제대로 값을 안받아오고 그러져 있지 않을때 로드될 가능성이 있습니다..

실제로 크롬에는 인터넷이 강제로 느리게 로드되도록 설정할수있는데 (Network -> 최상단의 No throttling 을 Fast/Slow 3G로 설정) 이런 경우 백이면 백 클라스 헬퍼 스크립트가 위처럼 로딩되지 않습니다.

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'appendChild')
    at eval (userscript.html?name=KLAS%20Helper.user.js&id=aeeb0f67-bcd5-4560-b594-a3023fc96386:34)
    at Window.tms_aeeb0f67_bcd5_4560_b594_a3023fc96386 (userscript.html?name=KLAS%20Helper.user.js&id=aeeb0f67-bcd5-4560-b594-a3023fc96386:45)
    at <anonymous>:4:80
    at eval (userscript.html?name=KLAS%20Helper.user.js&id=aeeb0f67-bcd5-4560-b594-a3023fc96386:1)
    at eval (userscript.html?name=KLAS%20Helper.user.js&id=aeeb0f67-bcd5-4560-b594-a3023fc96386:1)
    at eval (userscript.html?name=KLAS%20Helper.user.js&id=aeeb0f67-bcd5-4560-b594-a3023fc96386:115)
    at eval (userscript.html?name=KLAS%20Helper.user.js&id=aeeb0f67-bcd5-4560-b594-a3023fc96386:117)
    at eval (<anonymous>)
    at <anonymous>:4:80
    at Object.t [as F_c] (<anonymous>:3:191)

진짜 정말로 모든 페이지가 로드됐을때 해당 스크립트를 실행하는게 베스트일거 같긴 한데.. 페이지마다 받아오는 정보도 다르고 구조도 애매해서 수정할 방법이 딱히 떠오르지가 않네요..

mirusu400 commented 2 years ago

아마 이 이슈가 해결되면, https://github.com/nbsp1221/klas-helper/issues/26 이 이슈도 자연스레 해결될 것 같네요.

mirusu400 commented 2 years ago

klas-helper-extension 에서 해결된것으로 판단해 이슈 닫겠습니다.