From 4f8e1bc8273aa96a7152fb76b37a6e0a1cbf8597 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Fri, 10 Jan 2020 20:49:21 -0500 Subject: [PATCH] Fixed formatting. --- background.js | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/background.js b/background.js index 904e46d9..7dcbd61d 100644 --- a/background.js +++ b/background.js @@ -130,34 +130,35 @@ function addSponsorTime(time, videoID, callback) { } function submitVote(type, UUID, callback) { - let userID = SB.config.userID; + let userID = SB.config.userID; - if (userID == undefined || userID === "undefined") { - //generate one - userID = generateUserID(); - SB.config.userID = userID; + if (userID == undefined || userID === "undefined") { + //generate one + userID = generateUserID(); + SB.config.userID = userID; + } + + //publish this vote + sendRequestToServer("POST", "/api/voteOnSponsorTime?UUID=" + UUID + "&userID=" + userID + "&type=" + type, function(xmlhttp, error) { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { + callback({ + successType: 1 + }); + } else if (xmlhttp.readyState == 4 && xmlhttp.status == 405) { + //duplicate vote + callback({ + successType: 0, + statusCode: xmlhttp.status + }); + } else if (error) { + //error while connect + callback({ + successType: -1, + statusCode: xmlhttp.status + }); } - //publish this vote - sendRequestToServer("POST", "/api/voteOnSponsorTime?UUID=" + UUID + "&userID=" + userID + "&type=" + type, function(xmlhttp, error) { - if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { - callback({ - successType: 1 - }); - } else if (xmlhttp.readyState == 4 && xmlhttp.status == 405) { - //duplicate vote - callback({ - successType: 0, - statusCode: xmlhttp.status - }); - } else if (error) { - //error while connect - callback({ - successType: -1, - statusCode: xmlhttp.status - }); - } - }) + }); } async function submitTimes(videoID, callback) {