aboutsummaryrefslogtreecommitdiffhomepage
path: root/popup.js
diff options
context:
space:
mode:
Diffstat (limited to 'popup.js')
-rw-r--r--popup.js31
1 files changed, 27 insertions, 4 deletions
diff --git a/popup.js b/popup.js
index 713863e5..af4d3f26 100644
--- a/popup.js
+++ b/popup.js
@@ -82,6 +82,11 @@ function runThePopup() {
"setUsername",
"usernameInput",
"submitUsername",
+ // UserID
+ "changeUserID",
+ "changeUserIDButton",
+ "userIDInput",
+ "setUserID",
// More
"submissionSection",
"mainControls",
@@ -118,6 +123,8 @@ function runThePopup() {
SB.enableSponsorViewTracking.addEventListener("click", enableSponsorViewTracking);
SB.setUsernameButton.addEventListener("click", setUsernameButton);
SB.submitUsername.addEventListener("click", submitUsername);
+ SB.changeUserIDButton.addEventListener("click", changeUserIDButton);
+ SB.setUserID.addEventListener("click", setUserID);
SB.optionsButton.addEventListener("click", openOptions);
SB.reportAnIssue.addEventListener("click", reportAnIssue);
SB.hideDiscordButton.addEventListener("click", hideDiscordButton);
@@ -740,8 +747,8 @@ function runThePopup() {
tabs[0].id,
{message: "getCurrentTime"},
function (response) {
- let minutes = document.getElementById(idStartName + chrome.i18n.getMessage("Mins") + index);
- let seconds = document.getElementById(idStartName + chrome.i18n.getMessage("Secs") + index);
+ let minutes = document.getElementById(idStartName + "Minutes" + index);
+ let seconds = document.getElementById(idStartName + "Seconds" + index);
minutes.value = getTimeInMinutes(response.currentTime);
seconds.value = getTimeInFormattedSeconds(response.currentTime);
@@ -752,8 +759,8 @@ function runThePopup() {
//id start name is whether it is the startTime or endTime
//gives back the time in seconds
function getSponsorTimeEditTimes(idStartName, index) {
- let minutes = document.getElementById(idStartName + chrome.i18n.getMessage("Mins") + index);
- let seconds = document.getElementById(idStartName + chrome.i18n.getMessage("Secs") + index);
+ let minutes = document.getElementById(idStartName + "Minutes" + index);
+ let seconds = document.getElementById(idStartName + "Seconds" + index);
return parseInt(minutes.value) * 60 + parseFloat(seconds.value);
}
@@ -1158,6 +1165,22 @@ function runThePopup() {
SB.setUsernameContainer.style.display = "none";
SB.setUsername.style.display = "unset";
}
+
+ function changeUserIDButton() {
+ //get the user ID
+ chrome.storage.sync.get(["userID"], function(result) {
+ SB.userIDInput.value = result.userID;
+ SB.setUserID.style.display = "unset";
+ SB.userIDInput.style.display = "unset";
+ SB.changeUserID.style.display = "unset";
+ });
+ }
+
+ function setUserID() {
+ if (!confirm(chrome.i18n.getMessage("userIDChangeWarning"))) return;
+
+ chrome.storage.sync.set({"userID": SB.userIDInput.value});
+ }
//this is not a YouTube video page
function displayNoVideo() {