35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
/**
|
|
* ---------------------------------------------------------------------------------
|
|
* | 백그라운드 |
|
|
* ---------------------------------------------------------------------------------
|
|
* - 디폴트 컬러를 지정하여 스토리지 API 를 호출하여 지정한 색을 저장시킵니다.
|
|
**/
|
|
let color = '#3aa757';
|
|
|
|
|
|
chrome.runtime.onInstalled.addListener(() => {
|
|
chrome.storage.sync.set({ color });
|
|
console.log('기본 배경색은 %cgreen', `color: ${color}`);
|
|
});
|
|
|
|
chrome.webNavigation.onCompleted.addListener((details) => {
|
|
// console.log("details.url", details.url)
|
|
console.log(`B`);
|
|
if (details.frameId === 0 && details.url.includes("booktoki")) {
|
|
console.log(`A`);
|
|
chrome.scripting.executeScript({
|
|
target: { tabId: details.tabId },
|
|
function: () => {
|
|
const title = document.title;
|
|
alert(`Page Title: ${title}\nPage Load Complete!`);
|
|
}
|
|
});
|
|
} else {
|
|
console.log(`Page Title: ${title}\nis not target Page!`);
|
|
}
|
|
});
|
|
|
|
chrome.runtime.onInstalled.addListener(() => {
|
|
console.log('Page Load Notifier installed.');
|
|
});
|