Added ability to import/export your userID.

This commit is contained in:
Ajay Ramachandran 2019-12-28 22:13:03 -05:00
parent afb666797d
commit c802212a62
3 changed files with 57 additions and 0 deletions

View file

@ -320,5 +320,17 @@
},
"statusReminder": {
"message": "Check status.sponsor.ajay.app for server status."
},
"changeUserID": {
"message": "Import/Export Your UserID"
},
"whatChangeUserID": {
"message": "This should be kept private. This is like a password and should not be shared with anyone. If someone has this, they can impersonate you."
},
"setUserID": {
"message": "Set UserID"
},
"userIDChangeWarning": {
"message": "Warning: Changing the UserID is permanent. Are you sure you would like to do this? Make sure to backup your old one just in case."
}
}

View file

@ -253,6 +253,28 @@
<br/>
<br/>
<button id="changeUserIDButton" class="warningButton popupElement">__MSG_changeUserID__</button>
<br/>
<sub class="popupElement">
__MSG_whatChangeUserID__
</sub>
<div id="changeUserID" class="popupElement" style="display: none">
<br/>
<br/>
<input id="userIDInput" hint="userID"></input>
<br/>
<br/>
<button id="setUserID" class="warningButton popupElement">__MSG_setUserID__</button>
</div>
<br/>
<br/>
<button id="disableSponsorViewTracking" class="warningButton popupElement">__MSG_disableViewTracking__</button>
<button id="enableSponsorViewTracking" style="display: none" class="warningButton popupElement">__MSG_enableViewTracking__</button>
<br/>

View file

@ -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);
@ -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() {