mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 21:17:20 +03:00
Made upvote button close menu and downvote show message
This commit is contained in:
14
content.css
14
content.css
@@ -37,6 +37,20 @@
|
|||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#sponsorTimesThanksForVotingText {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000000;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sponsorTimesThanksForVotingInfoText {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000000;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
.voteButton {
|
.voteButton {
|
||||||
height: 32px;
|
height: 32px;
|
||||||
margin-right: 15px;
|
margin-right: 15px;
|
||||||
|
|||||||
24
content.js
24
content.js
@@ -259,14 +259,17 @@ function openSkipNotice(){
|
|||||||
|
|
||||||
//thumbs up and down buttons
|
//thumbs up and down buttons
|
||||||
let voteButtonsContainer = document.createElement("div");
|
let voteButtonsContainer = document.createElement("div");
|
||||||
|
voteButtonsContainer.id = "sponsorTimesVoteButtonsContainer";
|
||||||
voteButtonsContainer.setAttribute("align", "center");
|
voteButtonsContainer.setAttribute("align", "center");
|
||||||
|
|
||||||
let upvoteButton = document.createElement("img");
|
let upvoteButton = document.createElement("img");
|
||||||
|
upvoteButton.id = "sponsorTimesUpvoteButtonsContainer"
|
||||||
upvoteButton.className = "sponsorSkipObject voteButton";
|
upvoteButton.className = "sponsorSkipObject voteButton";
|
||||||
upvoteButton.src = chrome.extension.getURL("icons/upvote.png");
|
upvoteButton.src = chrome.extension.getURL("icons/upvote.png");
|
||||||
upvoteButton.addEventListener("click", upvote);
|
upvoteButton.addEventListener("click", upvote);
|
||||||
|
|
||||||
let downvoteButton = document.createElement("img");
|
let downvoteButton = document.createElement("img");
|
||||||
|
downvoteButton.id = "sponsorTimesDownvoteButtonsContainer"
|
||||||
downvoteButton.className = "sponsorSkipObject voteButton";
|
downvoteButton.className = "sponsorSkipObject voteButton";
|
||||||
downvoteButton.src = chrome.extension.getURL("icons/downvote.png");
|
downvoteButton.src = chrome.extension.getURL("icons/downvote.png");
|
||||||
downvoteButton.addEventListener("click", downvote);
|
downvoteButton.addEventListener("click", downvote);
|
||||||
@@ -315,10 +318,31 @@ function openSkipNotice(){
|
|||||||
|
|
||||||
function upvote() {
|
function upvote() {
|
||||||
vote(1);
|
vote(1);
|
||||||
|
|
||||||
|
closeSkipNotice();
|
||||||
}
|
}
|
||||||
|
|
||||||
function downvote() {
|
function downvote() {
|
||||||
vote(0);
|
vote(0);
|
||||||
|
|
||||||
|
//change text to say thanks for voting
|
||||||
|
//remove buttons
|
||||||
|
document.getElementById("sponsorTimesVoteButtonsContainer").removeChild(document.getElementById("sponsorTimesUpvoteButtonsContainer"));
|
||||||
|
document.getElementById("sponsorTimesVoteButtonsContainer").removeChild(document.getElementById("sponsorTimesDownvoteButtonsContainer"));
|
||||||
|
|
||||||
|
//add thanks for voting text
|
||||||
|
let thanksForVotingText = document.createElement("p");
|
||||||
|
thanksForVotingText.id = "sponsorTimesThanksForVotingText";
|
||||||
|
thanksForVotingText.innerText = "Thanks for voting!"
|
||||||
|
|
||||||
|
//add extra info for voting
|
||||||
|
let thanksForVotingInfoText = document.createElement("p");
|
||||||
|
thanksForVotingInfoText.id = "sponsorTimesThanksForVotingInfoText";
|
||||||
|
thanksForVotingInfoText.innerText = "Hit go back to get to where you came from."
|
||||||
|
|
||||||
|
//add element to div
|
||||||
|
document.getElementById("sponsorTimesVoteButtonsContainer").appendChild(thanksForVotingText);
|
||||||
|
document.getElementById("sponsorTimesVoteButtonsContainer").appendChild(thanksForVotingInfoText);
|
||||||
}
|
}
|
||||||
|
|
||||||
function vote(type) {
|
function vote(type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user