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 there is no userID, then it is the first install.
if (!userID && !Config.local.alreadyInstalled){ if (!userID && !Config.local.alreadyInstalled){
//open up the install page //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 //generate a userID
const newUserID = generateUserID(); const newUserID = generateUserID();
@ -137,7 +137,7 @@ chrome.runtime.onInstalled.addListener(function () {
if (Config.config.supportInvidious) { if (Config.config.supportInvidious) {
if (!(await utils.containsInvidiousPermission())) { 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); }, 1500);

View file

@ -53,7 +53,7 @@ class CategoryPillComponent extends React.Component<CategoryPillProps, CategoryP
<span className="sponsorBlockCategoryPillTitleSection"> <span className="sponsorBlockCategoryPillTitleSection">
<img className="sponsorSkipLogo sponsorSkipObject" <img className="sponsorSkipLogo sponsorSkipObject"
src={chrome.extension.getURL("icons/IconSponsorBlocker256px.png")}> src={chrome.runtime.getURL("icons/IconSponsorBlocker256px.png")}>
</img> </img>
{ {
@ -86,7 +86,7 @@ class CategoryPillComponent extends React.Component<CategoryPillProps, CategoryP
)} )}
{/* Close Button */} {/* Close Button */}
<img src={chrome.extension.getURL("icons/close.png")} <img src={chrome.runtime.getURL("icons/close.png")}
className="categoryPillClose" className="categoryPillClose"
onClick={() => { onClick={() => {
this.setState({ show: false }); this.setState({ show: false });

View file

@ -207,7 +207,7 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
{/* Close button */} {/* Close button */}
<img src={chrome.extension.getURL("icons/close.png")} <img src={chrome.runtime.getURL("icons/close.png")}
className={"sponsorSkipObject sponsorSkipNoticeButton sponsorSkipNoticeCloseButton sponsorSkipNoticeRightButton" className={"sponsorSkipObject sponsorSkipNoticeButton sponsorSkipNoticeCloseButton sponsorSkipNoticeRightButton"
+ (this.props.biggerCloseButton ? " biggerCloseButton" : "")} + (this.props.biggerCloseButton ? " biggerCloseButton" : "")}
onClick={() => this.close()}> onClick={() => this.close()}>

View file

@ -223,7 +223,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
target="_blank" rel="noreferrer"> target="_blank" rel="noreferrer">
<img id={"sponsorTimeCategoriesHelpButton" + this.idSuffix} <img id={"sponsorTimeCategoriesHelpButton" + this.idSuffix}
className="helpButton" className="helpButton"
src={chrome.extension.getURL("icons/help.svg")} src={chrome.runtime.getURL("icons/help.svg")}
title={chrome.i18n.getMessage("categoryGuidelines")} /> title={chrome.i18n.getMessage("categoryGuidelines")} />
</a> </a>
</div> </div>

View file

@ -107,7 +107,7 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
onClick={() => this.sortSegments()} onClick={() => this.sortSegments()}
title={chrome.i18n.getMessage("sortSegments")} title={chrome.i18n.getMessage("sortSegments")}
key="sortButton" key="sortButton"
src={chrome.extension.getURL("icons/sort.svg")}> src={chrome.runtime.getURL("icons/sort.svg")}>
</img>; </img>;
const exportButton = const exportButton =
<img id={"sponsorSkipExportButton" + this.state.idSuffix} <img id={"sponsorSkipExportButton" + this.state.idSuffix}
@ -115,7 +115,7 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
onClick={() => this.exportSegments()} onClick={() => this.exportSegments()}
title={chrome.i18n.getMessage("exportSegments")} title={chrome.i18n.getMessage("exportSegments")}
key="exportButton" key="exportButton"
src={chrome.extension.getURL("icons/export.svg")}> src={chrome.runtime.getURL("icons/export.svg")}>
</img>; </img>;
return ( return (
<NoticeComponent noticeTitle={this.state.noticeTitle} <NoticeComponent noticeTitle={this.state.noticeTitle}

View file

@ -1768,7 +1768,7 @@ function createButton(baseID: string, title: string, callback: () => void, image
newButton.draggable = isDraggable; newButton.draggable = isDraggable;
newButtonImage.id = baseID + "Image"; newButtonImage.id = baseID + "Image";
newButtonImage.className = "playerButtonImage"; newButtonImage.className = "playerButtonImage";
newButtonImage.src = chrome.extension.getURL("icons/" + imageName); newButtonImage.src = chrome.runtime.getURL("icons/" + imageName);
// Append image to button // Append image to button
newButton.appendChild(newButtonImage); newButton.appendChild(newButtonImage);
@ -1867,10 +1867,10 @@ function updateEditButtonsOnPlayer(): void {
if (buttonsEnabled) { if (buttonsEnabled) {
if (creatingSegment) { 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")); playerButtons.startSegment.button.setAttribute("title", chrome.i18n.getMessage("sponsorEnd"));
} else { } 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")); 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); popup.appendChild(frame);
const elemHasChild = (elements: NodeListOf<HTMLElement>): Element => { const elemHasChild = (elements: NodeListOf<HTMLElement>): Element => {
@ -2274,7 +2274,7 @@ async function sendSubmitMessage() {
} }
// Add loading animation // 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()); const stopAnimation = AnimationUtils.applyLoadingAnimation(playerButtons.submit.button, 1, () => updateEditButtonsOnPlayer());
//check if a sponsor exceeds the duration of the video //check if a sponsor exceeds the duration of the video
@ -2349,7 +2349,7 @@ async function sendSubmitMessage() {
} else { } else {
// Show that the upload failed // Show that the upload failed
playerButtons.submit.button.style.animation = "unset"; 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.")) { if (response.status === 403 && response.responseText.startsWith("Submission rejected due to a tip from a moderator.")) {
openWarningDialog(skipNoticeContentContainer); openWarningDialog(skipNoticeContentContainer);
@ -2533,7 +2533,7 @@ function addCSS() {
fileref.rel = "stylesheet"; fileref.rel = "stylesheet";
fileref.type = "text/css"; fileref.type = "text/css";
fileref.href = chrome.extension.getURL(file); fileref.href = chrome.runtime.getURL(file);
head.appendChild(fileref); head.appendChild(fileref);
} }

View file

@ -59,7 +59,7 @@ export class RectangleTooltip {
className="sponsorBlockRectangleTooltip" > className="sponsorBlockRectangleTooltip" >
<div> <div>
<img className="sponsorSkipLogo sponsorSkipObject" <img className="sponsorSkipLogo sponsorSkipObject"
src={chrome.extension.getURL("icons/IconSponsorBlocker256px.png")}> src={chrome.runtime.getURL("icons/IconSponsorBlocker256px.png")}>
</img> </img>
<span className="sponsorSkipObject"> <span className="sponsorSkipObject">
{this.text + (props.link ? ". " : "")} {this.text + (props.link ? ". " : "")}