mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-14 15:37:12 +03:00
Add message when connection failed when trying to vote.
This commit is contained in:
@@ -87,7 +87,7 @@ function addSponsorTime(time) {
|
||||
function submitVote(type, UUID, callback) {
|
||||
getUserID(function(userID) {
|
||||
//publish this vote
|
||||
sendRequestToUser('GET', "/api/voteOnSponsorTime?UUID=" + UUID + "&userID=" + userID + "&type=" + type, function(xmlhttp) {
|
||||
sendRequestToUser('GET', "/api/voteOnSponsorTime?UUID=" + UUID + "&userID=" + userID + "&type=" + type, function(xmlhttp, error) {
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
|
||||
callback({
|
||||
successType: 1
|
||||
@@ -97,6 +97,11 @@ function submitVote(type, UUID, callback) {
|
||||
callback({
|
||||
successType: 0
|
||||
});
|
||||
} else if (error) {
|
||||
//error while connect
|
||||
callback({
|
||||
successType: -1
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -180,7 +185,11 @@ function sendRequestToUser(type, address, callback) {
|
||||
xmlhttp.open(type, serverAddress + address, true);
|
||||
|
||||
xmlhttp.onreadystatechange = function () {
|
||||
callback(xmlhttp);
|
||||
callback(xmlhttp, false);
|
||||
};
|
||||
|
||||
xmlhttp.onerror = function(ev) {
|
||||
callback(xmlhttp, true);
|
||||
};
|
||||
|
||||
//submit this request
|
||||
|
||||
Reference in New Issue
Block a user