Merge branch 'master' of https://github.com/ajayyy/SponsorBlock into chapters

This commit is contained in:
Ajay 2022-09-01 15:21:23 -04:00
commit 3e40745621
3 changed files with 14 additions and 8 deletions

View file

@ -100,6 +100,10 @@
margin-bottom: 16px; margin-bottom: 16px;
} }
#sponsorBlockPopupContainer iframe {
width: 100%;
}
/* /*
* Disable popup max height when displayed in-page (content.ts) * Disable popup max height when displayed in-page (content.ts)
*/ */
@ -110,7 +114,7 @@
/* /*
* Disable fixed popup width when displayed in-page (content.ts) * Disable fixed popup width when displayed in-page (content.ts)
*/ */
#sponsorBlockPopupContainer #sponsorBlockPopupBody { #sponsorBlockPopupBody.is-embedded {
width: auto; width: auto;
} }
@ -240,7 +244,7 @@
border-radius: 50%; border-radius: 50%;
display: inline-block; display: inline-block;
} }
/* /*
* Category name in segment * Category name in segment
*/ */
.summaryLabel { .summaryLabel {
@ -544,7 +548,7 @@
background: var(--sb-grey-bg-color); background: var(--sb-grey-bg-color);
} }
/* /*
* Submissions * Submissions
*/ */
#sponsorTimesContributionsContainer { #sponsorTimesContributionsContainer {

View file

@ -86,6 +86,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
const PageElements: PageElements = {}; const PageElements: PageElements = {};
[ [
"sponsorBlockPopupBody",
"sponsorblockPopup", "sponsorblockPopup",
"sponsorStart", "sponsorStart",
// Top toggles // Top toggles
@ -153,7 +154,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
getSegmentsFromContentScript(false); getSegmentsFromContentScript(false);
await utils.wait(() => Config.config !== null && allowPopup, 5000, 5); await utils.wait(() => Config.config !== null && allowPopup, 5000, 5);
document.querySelector("body").style.removeProperty("visibility"); PageElements.sponsorBlockPopupBody.style.removeProperty("visibility");
if (!Config.configSyncListeners.includes(contentConfigUpdateListener)) { if (!Config.configSyncListeners.includes(contentConfigUpdateListener)) {
Config.configSyncListeners.push(contentConfigUpdateListener); Config.configSyncListeners.push(contentConfigUpdateListener);
} }
@ -166,6 +167,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
if (window !== window.top) { if (window !== window.top) {
PageElements.sbCloseButton.classList.remove("hidden"); PageElements.sbCloseButton.classList.remove("hidden");
PageElements.sponsorBlockPopupBody.classList.add("is-embedded");
} }
// Hide donate button if wanted (Safari, or user choice) // Hide donate button if wanted (Safari, or user choice)
@ -212,7 +214,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
if (window !== window.top) { if (window !== window.top) {
document.addEventListener("keydown", (e) => { document.addEventListener("keydown", (e) => {
const target = e.target as HTMLElement; const target = e.target as HTMLElement;
if (target.tagName === "INPUT" if (target.tagName === "INPUT"
|| target.tagName === "TEXTAREA" || target.tagName === "TEXTAREA"
|| e.key === "ArrowUp" || e.key === "ArrowUp"
|| e.key === "ArrowDown") { || e.key === "ArrowDown") {
@ -283,7 +285,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
} }
PageElements.sponsorTimesOthersTimeSavedDisplay.innerText = getFormattedHours(minutesSaved); PageElements.sponsorTimesOthersTimeSavedDisplay.innerText = getFormattedHours(minutesSaved);
} }
Config.config.isVip = userInfo.vip; Config.config.isVip = userInfo.vip;
Config.config.permissions = userInfo.permissions; Config.config.permissions = userInfo.permissions;
@ -580,7 +582,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
} }
segmentTimeFromToNode.style.margin = "5px"; segmentTimeFromToNode.style.margin = "5px";
// for inline-styling purposes // for inline-styling purposes
const labelContainer = document.createElement("div"); const labelContainer = document.createElement("div");
if (actionType !== ActionType.Chapter) labelContainer.appendChild(categoryColorCircle); if (actionType !== ActionType.Chapter) labelContainer.appendChild(categoryColorCircle);

View file

@ -72,7 +72,7 @@ function getFormattedTime(seconds: number, precise?: boolean): string {
* @returns {string} errorMessage * @returns {string} errorMessage
*/ */
function getErrorMessage(statusCode: number, responseText: string): string { function getErrorMessage(statusCode: number, responseText: string): string {
const postFix = ((responseText && !responseText.includes(`cf-wrapper`)) ? "\n\n" + responseText : ""); const postFix = ((responseText && !(responseText.includes(`cf-wrapper`) || responseText.includes("<!DOCTYPE html>"))) ? "\n\n" + responseText : "");
// display response body for 4xx // display response body for 4xx
if([400, 429, 409, 0].includes(statusCode)) { if([400, 429, 409, 0].includes(statusCode)) {
return chrome.i18n.getMessage(statusCode + "") + " " + chrome.i18n.getMessage("errorCode") + statusCode + postFix; return chrome.i18n.getMessage(statusCode + "") + " " + chrome.i18n.getMessage("errorCode") + statusCode + postFix;