Change return to break.

This commit is contained in:
Ajay Ramachandran
2019-08-27 21:17:21 -04:00
parent 871ba63f67
commit f91c6d5f9d

View File

@@ -91,85 +91,103 @@ chrome.runtime.onMessage.addListener(messageListener);
function messageListener(request, sender, sendResponse) { function messageListener(request, sender, sendResponse) {
//messages from popup script //messages from popup script
switch(request.message){ switch(request.message){
case "update": case "update":
videoIDChange(getYouTubeVideoID(document.URL)); videoIDChange(getYouTubeVideoID(document.URL));
return
case "sponsorStart": break;
sponsorMessageStarted(sendResponse); case "sponsorStart":
return sponsorMessageStarted(sendResponse);
case "sponsorDataChanged":
updateSponsorTimesSubmitting(); break;
return case "sponsorDataChanged":
//send the sponsor times along with if it's found updateSponsorTimesSubmitting();
case "isInfoFound":
sendResponse({ break;
found: sponsorDataFound, case "isInfoFound":
sponsorTimes: sponsorTimes, //send the sponsor times along with if it's found
hiddenSponsorTimes: hiddenSponsorTimes, sendResponse({
UUIDs: UUIDs found: sponsorDataFound,
}); sponsorTimes: sponsorTimes,
if (popupInitialised && document.getElementById("sponsorBlockPopupContainer") != null) { hiddenSponsorTimes: hiddenSponsorTimes,
//the popup should be closed now that another is opening UUIDs: UUIDs
closeInfoMenu(); });
}
popupInitialised = true; if (popupInitialised && document.getElementById("sponsorBlockPopupContainer") != null) {
return //the popup should be closed now that another is opening
case "getVideoID": closeInfoMenu();
sendResponse({ }
videoID: sponsorVideoID
}) popupInitialised = true;
return break;
case "getVideoDuration": case "getVideoID":
sendResponse({ sendResponse({
duration: v.duration videoID: sponsorVideoID
}); });
return
case "skipToTime": break;
v.currentTime = request.time; case "getVideoDuration":
return sendResponse({
case "getCurrentTime": duration: v.duration
sendResponse({ });
currentTime: v.currentTime
}); break;
return case "skipToTime":
case "getChannelURL": v.currentTime = request.time;
sendResponse({ return
channelURL: channelURL case "getCurrentTime":
}) sendResponse({
return currentTime: v.currentTime
case "isChannelWhitelisted": });
sendResponse({
value: channelWhitelisted break;
}) case "getChannelURL":
return sendResponse({
case "whitelistChange": channelURL: channelURL
channelWhitelisted = request.value; });
sponsorsLookup(sponsorVideoID);
return break;
case "dontShowNotice": case "isChannelWhitelisted":
dontShowNotice = false; sendResponse({
return value: channelWhitelisted
case "changeStartSponsorButton": });
changeStartSponsorButton(request.showStartSponsor, request.uploadButtonVisible);
return break;
case "showNoticeAgain": case "whitelistChange":
dontShowNotice = false; channelWhitelisted = request.value;
return sponsorsLookup(sponsorVideoID);
case "changeVideoPlayerControlsVisibility":
hideVideoPlayerControls = request.value; break;
updateVisibilityOfPlayerControlsButton(); case "dontShowNotice":
return dontShowNotice = false;
case "changeInfoButtonPlayerControlsVisibility":
hideInfoButtonPlayerControls = request.value; break;
updateVisibilityOfPlayerControlsButton(); case "changeStartSponsorButton":
return changeStartSponsorButton(request.showStartSponsor, request.uploadButtonVisible);
case "changeDeleteButtonPlayerControlsVisibility":
hideDeleteButtonPlayerControls = request.value; break;
updateVisibilityOfPlayerControlsButton(); case "showNoticeAgain":
return dontShowNotice = false;
case "trackViewCount":
trackViewCount = request.value; break;
return case "changeVideoPlayerControlsVisibility":
hideVideoPlayerControls = request.value;
updateVisibilityOfPlayerControlsButton();
break;
case "changeInfoButtonPlayerControlsVisibility":
hideInfoButtonPlayerControls = request.value;
updateVisibilityOfPlayerControlsButton();
break;
case "changeDeleteButtonPlayerControlsVisibility":
hideDeleteButtonPlayerControls = request.value;
updateVisibilityOfPlayerControlsButton();
break;
case "trackViewCount":
trackViewCount = request.value;
break;
} }
} }