Use runtime.getURL

This commit is contained in:
Ajay 2024-01-21 13:51:32 -05:00
parent 8dfd06919b
commit 783326afca
7 changed files with 16 additions and 16 deletions

View file

@ -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);

View file

@ -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 });

View file

@ -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()}>

View file

@ -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>

View file

@ -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}

View file

@ -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);
}

View file

@ -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 ? ". " : "")}