mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-13 15:07:02 +03:00
Change segment list layout
This commit is contained in:
@@ -23,29 +23,26 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#issueReporterTimeButtons {
|
#issueReporterTimeButtons > .votingButtons > .segmentTimeButton {
|
||||||
display: flex;
|
|
||||||
flex-flow: row wrap;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
#issueReporterTimeButtons > button {
|
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: var(--sb-main-fg-color);
|
color: var(--sb-main-fg-color);
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
|
padding: 10px 8px;
|
||||||
|
outline: none;
|
||||||
|
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sponsorTimesThanksForVotingText {
|
||||||
|
font-size: large;
|
||||||
|
}
|
||||||
|
|
||||||
|
.voteButton {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
padding: 0 8px;
|
padding: 0 5px;
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#issueReporterTimeButtons > div > img:nth-child(2) {
|
cursor: pointer;
|
||||||
margin-left: 6px;
|
|
||||||
transform: scaleY(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#issueReporterTimeButtons > div > h2 {
|
|
||||||
margin: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#videoInfo>p, #videoInfo>div>p {
|
#videoInfo>p, #videoInfo>div>p {
|
||||||
|
|||||||
56
src/popup.ts
56
src/popup.ts
@@ -412,7 +412,7 @@ async function runThePopup(messageListener?: MessageListener) {
|
|||||||
let container = document.getElementById("issueReporterTimeButtons");
|
let container = document.getElementById("issueReporterTimeButtons");
|
||||||
for (let i = 0; i < request.sponsorTimes.length; i++) {
|
for (let i = 0; i < request.sponsorTimes.length; i++) {
|
||||||
let sponsorTimeButton = document.createElement("button");
|
let sponsorTimeButton = document.createElement("button");
|
||||||
sponsorTimeButton.className = "warningButton popupElement";
|
sponsorTimeButton.className = "segmentTimeButton popupElement";
|
||||||
|
|
||||||
let extraInfo = "";
|
let extraInfo = "";
|
||||||
if (request.sponsorTimes[i].hidden === SponsorHideType.Downvoted) {
|
if (request.sponsorTimes[i].hidden === SponsorHideType.Downvoted) {
|
||||||
@@ -426,6 +426,7 @@ async function runThePopup(messageListener?: MessageListener) {
|
|||||||
sponsorTimeButton.innerText = getFormattedTime(request.sponsorTimes[i].segment[0]) + " " + chrome.i18n.getMessage("to") + " " + getFormattedTime(request.sponsorTimes[i].segment[1]) + extraInfo;
|
sponsorTimeButton.innerText = getFormattedTime(request.sponsorTimes[i].segment[0]) + " " + chrome.i18n.getMessage("to") + " " + getFormattedTime(request.sponsorTimes[i].segment[1]) + extraInfo;
|
||||||
|
|
||||||
let votingButtons = document.createElement("div");
|
let votingButtons = document.createElement("div");
|
||||||
|
votingButtons.classList.add("votingButtons");
|
||||||
|
|
||||||
let UUID = request.sponsorTimes[i].UUID;
|
let UUID = request.sponsorTimes[i].UUID;
|
||||||
|
|
||||||
@@ -438,34 +439,40 @@ async function runThePopup(messageListener?: MessageListener) {
|
|||||||
let upvoteButton = document.createElement("img");
|
let upvoteButton = document.createElement("img");
|
||||||
upvoteButton.id = "sponsorTimesUpvoteButtonsContainer" + UUID;
|
upvoteButton.id = "sponsorTimesUpvoteButtonsContainer" + UUID;
|
||||||
upvoteButton.className = "voteButton";
|
upvoteButton.className = "voteButton";
|
||||||
upvoteButton.src = chrome.extension.getURL("icons/thumb.svg");
|
upvoteButton.src = chrome.extension.getURL("icons/thumbs_up.svg");
|
||||||
upvoteButton.addEventListener("click", () => vote(1, UUID));
|
upvoteButton.addEventListener("click", () => vote(1, UUID));
|
||||||
|
|
||||||
let downvoteButton = document.createElement("img");
|
let downvoteButton = document.createElement("img");
|
||||||
downvoteButton.id = "sponsorTimesDownvoteButtonsContainer" + UUID;
|
downvoteButton.id = "sponsorTimesDownvoteButtonsContainer" + UUID;
|
||||||
downvoteButton.className = "voteButton";
|
downvoteButton.className = "voteButton";
|
||||||
downvoteButton.src = chrome.extension.getURL("icons/thumb.svg");
|
downvoteButton.src = chrome.extension.getURL("icons/thumbs_down.svg");
|
||||||
downvoteButton.addEventListener("click", () => vote(0, UUID));
|
downvoteButton.addEventListener("click", () => vote(0, UUID));
|
||||||
|
|
||||||
//add thumbs up and down buttons to the container
|
//add thumbs up and down buttons to the container
|
||||||
//voteButtonsContainer.appendChild(document.createElement("br"));
|
|
||||||
//voteButtonsContainer.appendChild(document.createElement("br"));
|
|
||||||
voteButtonsContainer.appendChild(upvoteButton);
|
voteButtonsContainer.appendChild(upvoteButton);
|
||||||
voteButtonsContainer.appendChild(downvoteButton);
|
voteButtonsContainer.appendChild(downvoteButton);
|
||||||
|
|
||||||
//add click listener to open up vote panel
|
//add click listener to open up vote panel
|
||||||
sponsorTimeButton.addEventListener("click", function() {
|
sponsorTimeButton.addEventListener("click", function() {
|
||||||
voteButtonsContainer.style.display = "unset";
|
voteButtonsContainer.style.removeProperty("display");
|
||||||
});
|
});
|
||||||
|
|
||||||
container.appendChild(sponsorTimeButton);
|
// Will contain request status
|
||||||
container.appendChild(voteButtonsContainer);
|
let voteStatusContainer = document.createElement("div");
|
||||||
|
voteStatusContainer.id = "sponsorTimesVoteStatusContainer" + UUID;
|
||||||
|
voteStatusContainer.classList.add("sponsorTimesVoteStatusContainer");
|
||||||
|
voteStatusContainer.style.display = "none";
|
||||||
|
|
||||||
//if it is not the last iteration
|
let thanksForVotingText = document.createElement("div");
|
||||||
if (i != request.sponsorTimes.length - 1) {
|
thanksForVotingText.id = "sponsorTimesThanksForVotingText" + UUID;
|
||||||
//container.appendChild(document.createElement("br"));
|
thanksForVotingText.classList.add("sponsorTimesThanksForVotingText");
|
||||||
//container.appendChild(document.createElement("br"));
|
voteStatusContainer.appendChild(thanksForVotingText);
|
||||||
}
|
|
||||||
|
votingButtons.append(sponsorTimeButton);
|
||||||
|
votingButtons.append(voteButtonsContainer);
|
||||||
|
votingButtons.append(voteStatusContainer);
|
||||||
|
|
||||||
|
container.appendChild(votingButtons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -883,18 +890,14 @@ async function runThePopup(messageListener?: MessageListener) {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
function addVoteMessage(message, UUID) {
|
function addVoteMessage(message, UUID) {
|
||||||
let container = document.getElementById("sponsorTimesVoteButtonsContainer" + UUID);
|
let voteButtonsContainer = document.getElementById("sponsorTimesVoteButtonsContainer" + UUID);
|
||||||
//remove all children
|
voteButtonsContainer.style.display = "none";
|
||||||
while (container.firstChild) {
|
|
||||||
container.removeChild(container.firstChild);
|
let voteStatusContainer = document.getElementById("sponsorTimesVoteStatusContainer" + UUID);
|
||||||
}
|
voteStatusContainer.style.removeProperty("display");
|
||||||
|
|
||||||
let thanksForVotingText = document.createElement("h2");
|
let thanksForVotingText = document.getElementById("sponsorTimesThanksForVotingText" + UUID);
|
||||||
thanksForVotingText.innerText = message;
|
thanksForVotingText.innerText = message;
|
||||||
//there are already breaks there
|
|
||||||
thanksForVotingText.style.marginBottom = "0px";
|
|
||||||
|
|
||||||
container.appendChild(thanksForVotingText);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function vote(type, UUID) {
|
function vote(type, UUID) {
|
||||||
@@ -919,11 +922,6 @@ async function runThePopup(messageListener?: MessageListener) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideDiscordButton() {
|
|
||||||
Config.config.hideDiscordLink = true;
|
|
||||||
//PageElements.discordButtonContainer.style.display = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
//converts time in seconds to minutes:seconds
|
//converts time in seconds to minutes:seconds
|
||||||
function getFormattedTime(seconds) {
|
function getFormattedTime(seconds) {
|
||||||
let minutes = Math.floor(seconds / 60);
|
let minutes = Math.floor(seconds / 60);
|
||||||
|
|||||||
Reference in New Issue
Block a user