fix(rhwp-chrome): 썸네일 로딩 스피너 정리 + options CSP 호환#167
Closed
postmelee wants to merge 2 commits intoedwardkim:develfrom
Closed
fix(rhwp-chrome): 썸네일 로딩 스피너 정리 + options CSP 호환#167postmelee wants to merge 2 commits intoedwardkim:develfrom
postmelee wants to merge 2 commits intoedwardkim:develfrom
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Chrome 확장 프로그램의 사용자 체감 문제(호버 썸네일 로딩 표시, 옵션 페이지 CSP) 2가지를 해결해 확장 UI/옵션 동작을 정상화합니다.
Changes:
- 호버 썸네일 이미지 삽입 시 로딩 플레이스홀더(⏳)를 제거하도록 처리
- 옵션 페이지 인라인 스크립트를 외부 파일(
options.js)로 분리해 CSP 호환 - 빌드 스크립트에서
options.js를dist/로 복사하도록 반영
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| rhwp-chrome/content-script.js | 썸네일 이미지 삽입 시 로딩 플레이스홀더 제거로 UI 잔상 해결 |
| rhwp-chrome/options.html | 인라인 스크립트 제거 및 외부 스크립트 로드로 CSP 대응 |
| rhwp-chrome/options.js | 옵션 i18n/설정 로드·저장 로직을 외부 스크립트로 분리 |
| rhwp-chrome/build.mjs | 배포 산출물에 options.js 포함되도록 복사 단계 추가 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+34
| // i18n 적용 | ||
| document.getElementById('title').textContent = chrome.i18n.getMessage('optionsTitle'); | ||
| document.getElementById('labelAutoOpen').textContent = chrome.i18n.getMessage('optionsAutoOpen'); | ||
| document.getElementById('labelShowBadges').textContent = chrome.i18n.getMessage('optionsShowBadges'); | ||
| document.getElementById('labelHoverPreview').textContent = chrome.i18n.getMessage('optionsHoverPreview'); | ||
| document.getElementById('saved').textContent = chrome.i18n.getMessage('optionsSaved'); | ||
| document.getElementById('privacy').textContent = chrome.i18n.getMessage('optionsPrivacy'); | ||
|
|
||
| const inputs = ['autoOpen', 'showBadges', 'hoverPreview']; | ||
|
|
||
| // 설정 로드 | ||
| chrome.storage.sync.get( | ||
| { autoOpen: true, showBadges: true, hoverPreview: true }, | ||
| (settings) => { | ||
| for (const id of inputs) { | ||
| document.getElementById(id).checked = settings[id]; | ||
| } | ||
| } | ||
| ); | ||
|
|
||
| // 설정 저장 | ||
| for (const id of inputs) { | ||
| document.getElementById(id).addEventListener('change', () => { | ||
| const settings = {}; | ||
| for (const id2 of inputs) { | ||
| settings[id2] = document.getElementById(id2).checked; | ||
| } | ||
| chrome.storage.sync.set(settings, () => { | ||
| const saved = document.getElementById('saved'); | ||
| saved.classList.add('show'); | ||
| setTimeout(() => saved.classList.remove('show'), 1500); | ||
| }); | ||
| }); | ||
| } |
There was a problem hiding this comment.
options.js가 전역 스코프에서 실행되어 inputs 등이 options 페이지 전역에 노출됩니다. 이 레포의 다른 non-module 스크립트(content-script.js, dev-tools-inject.js)는 IIFE + 'use strict'로 감싸 전역 오염을 방지하고 있어 동일 패턴을 적용하는 게 안전합니다.
Suggested change
| // i18n 적용 | |
| document.getElementById('title').textContent = chrome.i18n.getMessage('optionsTitle'); | |
| document.getElementById('labelAutoOpen').textContent = chrome.i18n.getMessage('optionsAutoOpen'); | |
| document.getElementById('labelShowBadges').textContent = chrome.i18n.getMessage('optionsShowBadges'); | |
| document.getElementById('labelHoverPreview').textContent = chrome.i18n.getMessage('optionsHoverPreview'); | |
| document.getElementById('saved').textContent = chrome.i18n.getMessage('optionsSaved'); | |
| document.getElementById('privacy').textContent = chrome.i18n.getMessage('optionsPrivacy'); | |
| const inputs = ['autoOpen', 'showBadges', 'hoverPreview']; | |
| // 설정 로드 | |
| chrome.storage.sync.get( | |
| { autoOpen: true, showBadges: true, hoverPreview: true }, | |
| (settings) => { | |
| for (const id of inputs) { | |
| document.getElementById(id).checked = settings[id]; | |
| } | |
| } | |
| ); | |
| // 설정 저장 | |
| for (const id of inputs) { | |
| document.getElementById(id).addEventListener('change', () => { | |
| const settings = {}; | |
| for (const id2 of inputs) { | |
| settings[id2] = document.getElementById(id2).checked; | |
| } | |
| chrome.storage.sync.set(settings, () => { | |
| const saved = document.getElementById('saved'); | |
| saved.classList.add('show'); | |
| setTimeout(() => saved.classList.remove('show'), 1500); | |
| }); | |
| }); | |
| } | |
| (function () { | |
| 'use strict'; | |
| // i18n 적용 | |
| document.getElementById('title').textContent = chrome.i18n.getMessage('optionsTitle'); | |
| document.getElementById('labelAutoOpen').textContent = chrome.i18n.getMessage('optionsAutoOpen'); | |
| document.getElementById('labelShowBadges').textContent = chrome.i18n.getMessage('optionsShowBadges'); | |
| document.getElementById('labelHoverPreview').textContent = chrome.i18n.getMessage('optionsHoverPreview'); | |
| document.getElementById('saved').textContent = chrome.i18n.getMessage('optionsSaved'); | |
| document.getElementById('privacy').textContent = chrome.i18n.getMessage('optionsPrivacy'); | |
| const inputs = ['autoOpen', 'showBadges', 'hoverPreview']; | |
| // 설정 로드 | |
| chrome.storage.sync.get( | |
| { autoOpen: true, showBadges: true, hoverPreview: true }, | |
| (settings) => { | |
| for (const id of inputs) { | |
| document.getElementById(id).checked = settings[id]; | |
| } | |
| } | |
| ); | |
| // 설정 저장 | |
| for (const id of inputs) { | |
| document.getElementById(id).addEventListener('change', () => { | |
| const settings = {}; | |
| for (const id2 of inputs) { | |
| settings[id2] = document.getElementById(id2).checked; | |
| } | |
| chrome.storage.sync.set(settings, () => { | |
| const saved = document.getElementById('saved'); | |
| saved.classList.add('show'); | |
| setTimeout(() => saved.classList.remove('show'), 1500); | |
| }); | |
| }); | |
| } | |
| })(); |
postmelee
added a commit
to postmelee/rhwp
that referenced
this pull request
Apr 16, 2026
Copilot 리뷰 (PR edwardkim#167) 반영 — 다른 non-module 스크립트 (content-script.js, dev-tools-inject.js)와 동일하게 IIFE + 'use strict' 패턴으로 감싸 전역 스코프 오염 방지.
Contributor
Author
|
본 PR은 #168로 대체되어 close합니다. (PR 타임라인 정리 + Copilot 리뷰 반영 커밋 포함) |
5 tasks
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 characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경 요약
Chrome 확장에서 두 가지 사용자 체감 이슈를 수정했습니다.
rhwp-chrome/content-script.jsinsertThumbnailImg()에서 이미지 삽입 전에thumbDiv.textContent = ''로 로딩 플레이스홀더를 제거rhwp-chrome/options.html인라인 스크립트를 제거하고options.js로 분리rhwp-chrome/build.mjs에서options.js를dist/로 복사하도록 반영변경 파일:
rhwp-chrome/content-script.jsrhwp-chrome/options.htmlrhwp-chrome/options.js(신규)rhwp-chrome/build.mjs관련 이슈
closes #86
closes #166
테스트
cargo test통과cargo clippy -- -D warnings통과cd rhwp-chrome && npm run build실행rhwp-chrome/dist로드 후 옵션 페이지/썸네일 동작 수동 확인스크린샷