diff options
author | Ajay <[email protected]> | 2024-01-21 13:51:32 -0500 |
---|---|---|
committer | Ajay <[email protected]> | 2024-01-21 13:51:32 -0500 |
commit | 783326afcaf24be91d1aa02e2f1c015342f32754 (patch) | |
tree | e4a76047ab99f1e91481617be774e566c042f24c | |
parent | 8dfd06919b09a353def609cdca5c48a74a34d8ca (diff) | |
download | SponsorBlock-783326afcaf24be91d1aa02e2f1c015342f32754.tar.gz SponsorBlock-783326afcaf24be91d1aa02e2f1c015342f32754.zip |
Use runtime.getURL
-rw-r--r-- | src/background.ts | 4 | ||||
-rw-r--r-- | src/components/CategoryPillComponent.tsx | 4 | ||||
-rw-r--r-- | src/components/NoticeComponent.tsx | 2 | ||||
-rw-r--r-- | src/components/SponsorTimeEditComponent.tsx | 2 | ||||
-rw-r--r-- | src/components/SubmissionNoticeComponent.tsx | 4 | ||||
-rw-r--r-- | src/content.ts | 14 | ||||
-rw-r--r-- | src/render/RectangleTooltip.tsx | 2 |
7 files changed, 16 insertions, 16 deletions
diff --git a/src/background.ts b/src/background.ts index 99df62db..161ee45a 100644 --- a/src/background.ts +++ b/src/background.ts @@ -123,7 +123,7 @@ chrome.runtime.onInstalled.addListener(function () { // If there is no userID, then it is the first install. if (!userID && !Config.local.alreadyInstalled){ //open up the install page - chrome.tabs.create({url: chrome.extension.getURL("/help/index.html")}); + chrome.tabs.create({url: chrome.runtime.getURL("/help/index.html")}); //generate a userID const newUserID = generateUserID(); @@ -137,7 +137,7 @@ chrome.runtime.onInstalled.addListener(function () { if (Config.config.supportInvidious) { if (!(await utils.containsInvidiousPermission())) { - chrome.tabs.create({url: chrome.extension.getURL("/permissions/index.html")}); + chrome.tabs.create({url: chrome.runtime.getURL("/permissions/index.html")}); } } }, 1500); diff --git a/src/components/CategoryPillComponent.tsx b/src/components/CategoryPillComponent.tsx index 1d39a400..c72dc18e 100644 --- a/src/components/CategoryPillComponent.tsx +++ b/src/components/CategoryPillComponent.tsx @@ -53,7 +53,7 @@ class CategoryPillComponent extends React.Component<CategoryPillProps, CategoryP <span className="sponsorBlockCategoryPillTitleSection"> <img className="sponsorSkipLogo sponsorSkipObject" - src={chrome.extension.getURL("icons/IconSponsorBlocker256px.png")}> + src={chrome.runtime.getURL("icons/IconSponsorBlocker256px.png")}> </img> { @@ -86,7 +86,7 @@ class CategoryPillComponent extends React.Component<CategoryPillProps, CategoryP )} {/* Close Button */} - <img src={chrome.extension.getURL("icons/close.png")} + <img src={chrome.runtime.getURL("icons/close.png")} className="categoryPillClose" onClick={() => { this.setState({ show: false }); diff --git a/src/components/NoticeComponent.tsx b/src/components/NoticeComponent.tsx index e41c3fa7..56a96378 100644 --- a/src/components/NoticeComponent.tsx +++ b/src/components/NoticeComponent.tsx @@ -207,7 +207,7 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> { {/* Close button */} - <img src={chrome.extension.getURL("icons/close.png")} + <img src={chrome.runtime.getURL("icons/close.png")} className={"sponsorSkipObject sponsorSkipNoticeButton sponsorSkipNoticeCloseButton sponsorSkipNoticeRightButton" + (this.props.biggerCloseButton ? " biggerCloseButton" : "")} onClick={() => this.close()}> diff --git a/src/components/SponsorTimeEditComponent.tsx b/src/components/SponsorTimeEditComponent.tsx index 4c8b1641..0564293a 100644 --- a/src/components/SponsorTimeEditComponent.tsx +++ b/src/components/SponsorTimeEditComponent.tsx @@ -223,7 +223,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo target="_blank" rel="noreferrer"> <img id={"sponsorTimeCategoriesHelpButton" + this.idSuffix} className="helpButton" - src={chrome.extension.getURL("icons/help.svg")} + src={chrome.runtime.getURL("icons/help.svg")} title={chrome.i18n.getMessage("categoryGuidelines")} /> </a> </div> diff --git a/src/components/SubmissionNoticeComponent.tsx b/src/components/SubmissionNoticeComponent.tsx index cd51be01..7ddc3e0e 100644 --- a/src/components/SubmissionNoticeComponent.tsx +++ b/src/components/SubmissionNoticeComponent.tsx @@ -107,7 +107,7 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S onClick={() => this.sortSegments()} title={chrome.i18n.getMessage("sortSegments")} key="sortButton" - src={chrome.extension.getURL("icons/sort.svg")}> + src={chrome.runtime.getURL("icons/sort.svg")}> </img>; const exportButton = <img id={"sponsorSkipExportButton" + this.state.idSuffix} @@ -115,7 +115,7 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S onClick={() => this.exportSegments()} title={chrome.i18n.getMessage("exportSegments")} key="exportButton" - src={chrome.extension.getURL("icons/export.svg")}> + src={chrome.runtime.getURL("icons/export.svg")}> </img>; return ( <NoticeComponent noticeTitle={this.state.noticeTitle} diff --git a/src/content.ts b/src/content.ts index 9e744ebb..6d656e27 100644 --- a/src/content.ts +++ b/src/content.ts @@ -1768,7 +1768,7 @@ function createButton(baseID: string, title: string, callback: () => void, image newButton.draggable = isDraggable; newButtonImage.id = baseID + "Image"; newButtonImage.className = "playerButtonImage"; - newButtonImage.src = chrome.extension.getURL("icons/" + imageName); + newButtonImage.src = chrome.runtime.getURL("icons/" + imageName); // Append image to button newButton.appendChild(newButtonImage); @@ -1867,10 +1867,10 @@ function updateEditButtonsOnPlayer(): void { if (buttonsEnabled) { if (creatingSegment) { - playerButtons.startSegment.image.src = chrome.extension.getURL("icons/PlayerStopIconSponsorBlocker.svg"); + playerButtons.startSegment.image.src = chrome.runtime.getURL("icons/PlayerStopIconSponsorBlocker.svg"); playerButtons.startSegment.button.setAttribute("title", chrome.i18n.getMessage("sponsorEnd")); } else { - playerButtons.startSegment.image.src = chrome.extension.getURL("icons/PlayerStartIconSponsorBlocker.svg"); + playerButtons.startSegment.image.src = chrome.runtime.getURL("icons/PlayerStartIconSponsorBlocker.svg"); playerButtons.startSegment.button.setAttribute("title", chrome.i18n.getMessage("sponsorStart")); } } @@ -2048,7 +2048,7 @@ function openInfoMenu() { } } }); - frame.src = chrome.extension.getURL("popup.html"); + frame.src = chrome.runtime.getURL("popup.html"); popup.appendChild(frame); const elemHasChild = (elements: NodeListOf<HTMLElement>): Element => { @@ -2274,7 +2274,7 @@ async function sendSubmitMessage() { } // Add loading animation - playerButtons.submit.image.src = chrome.extension.getURL("icons/PlayerUploadIconSponsorBlocker.svg"); + playerButtons.submit.image.src = chrome.runtime.getURL("icons/PlayerUploadIconSponsorBlocker.svg"); const stopAnimation = AnimationUtils.applyLoadingAnimation(playerButtons.submit.button, 1, () => updateEditButtonsOnPlayer()); //check if a sponsor exceeds the duration of the video @@ -2349,7 +2349,7 @@ async function sendSubmitMessage() { } else { // Show that the upload failed playerButtons.submit.button.style.animation = "unset"; - playerButtons.submit.image.src = chrome.extension.getURL("icons/PlayerUploadFailedIconSponsorBlocker.svg"); + playerButtons.submit.image.src = chrome.runtime.getURL("icons/PlayerUploadFailedIconSponsorBlocker.svg"); if (response.status === 403 && response.responseText.startsWith("Submission rejected due to a tip from a moderator.")) { openWarningDialog(skipNoticeContentContainer); @@ -2533,7 +2533,7 @@ function addCSS() { fileref.rel = "stylesheet"; fileref.type = "text/css"; - fileref.href = chrome.extension.getURL(file); + fileref.href = chrome.runtime.getURL(file); head.appendChild(fileref); } diff --git a/src/render/RectangleTooltip.tsx b/src/render/RectangleTooltip.tsx index 1b357fa8..d325688a 100644 --- a/src/render/RectangleTooltip.tsx +++ b/src/render/RectangleTooltip.tsx @@ -59,7 +59,7 @@ export class RectangleTooltip { className="sponsorBlockRectangleTooltip" > <div> <img className="sponsorSkipLogo sponsorSkipObject" - src={chrome.extension.getURL("icons/IconSponsorBlocker256px.png")}> + src={chrome.runtime.getURL("icons/IconSponsorBlocker256px.png")}> </img> <span className="sponsorSkipObject"> {this.text + (props.link ? ". " : "")} |