Skip to content

Commit

Permalink
Merge pull request #79 from pvrs12/77_76_fixes
Browse files Browse the repository at this point in the history
77 76 fixes
  • Loading branch information
pvrs12 authored May 27, 2021
2 parents a24ce8c + 58016fd commit 47f61a8
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 46 deletions.
2 changes: 1 addition & 1 deletion chrome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"global": true
}
},
"version": "2.1.2",
"version": "2.1.3",
"options_ui": {
"page": "options.htm",
"chrome_style": true
Expand Down
2 changes: 2 additions & 0 deletions common/js/anesidora.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ async function userLogin(response) {
return "uncool credentials";
}

dontRetryPartnerLogin = false;

userAuthToken = res.result.userAuthToken;
userId = res.result.userId;
if (stationList.length == 0) {
Expand Down
32 changes: 24 additions & 8 deletions common/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ get_browser().webRequest.onBeforeSendHeaders.addListener(
},
{
urls: [
"http://*.pandora.com/*",
"https://*.pandora.com/*",
"http://*.p-cdn.com/*",
"http://*.p-cdn.us/*"
"http://*.pandora.com/services/json/*",
"https://*.pandora.com/services/json/*",
]
},
['blocking', 'requestHeaders']
Expand Down Expand Up @@ -152,7 +150,13 @@ async function nextSong(depth=1, prev_station=undefined) {
xhr2.send(null);
}

callbacks.updatePlayer.forEach(e => { try{e && e()}catch(b){}});
background.callbacks.updatePlayer.forEach((e) => {
try {
e();
} catch(b) {
background.callbacks.updatePlayer.splice(background.callbacks.updatePlayer.indexOf(e), 1);
}
});
};
xhr.send();
}
Expand Down Expand Up @@ -191,8 +195,14 @@ document.addEventListener('DOMContentLoaded', function () {
mp3Player.addEventListener("play", function () {
try {
//check if the window exists
document.getElementById('mp3Player').yep = 'thisexists'
callbacks.updatePlayer.forEach(e => { try{e && e()}catch(b){}});
document.getElementById('mp3Player').yep = 'thisexists'
background.callbacks.updatePlayer.forEach((e) => {
try {
e();
} catch(b) {
background.callbacks.updatePlayer.splice(background.callbacks.updatePlayer.indexOf(e), 1);
}
});
currentSong.startTime = Math.round(new Date().getTime() / 1000);
} catch (e) {
//if it doesn"t exist, don"t draw here
Expand All @@ -206,7 +216,13 @@ document.addEventListener('DOMContentLoaded', function () {
try {
//check if the window exists
document.getElementById('mp3Player').yep = 'thisexists'
callbacks.drawPlayer.forEach(e => { e && e()});
background.callbacks.drawPlayer.forEach((e) => {
try {
e();
} catch(b) {
background.callbacks.drawPlayer.splice(background.callbacks.drawPlayer.indexOf(e), 1);
}
});
} catch(e){
//if it doesn"t, don"t draw here
return;
Expand Down
30 changes: 16 additions & 14 deletions common/js/newpopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,20 +447,22 @@ document.addEventListener('DOMContentLoaded', async function () {
unWarning.style.display = 'none';
pwWarning.style.display = 'none';

login.addEventListener("submit", async function () {
localStorage.username = unInput.value;
localStorage.password = pwInput.value;
await background.partnerLogin();
if (background.userAuthToken === "") {
document.getElementById("li1").classList.add("warning");
document.getElementById("li2").classList.add("warning");
return false;
} else {
await addStations();
//move to mid panel
goToStations();
return false;
}
login.addEventListener("submit", function (e) {
(async() => {
localStorage.username = unInput.value;
localStorage.password = pwInput.value;
await background.partnerLogin();
if (background.userAuthToken === "") {
document.getElementById("li1").classList.add("warning");
document.getElementById("li2").classList.add("warning");
} else {
await addStations();
//move to mid panel
goToStations();
}
})();
e.preventDefault();
return false;
});

['keypress', 'change', 'input', 'paste'].forEach(e => {
Expand Down
46 changes: 24 additions & 22 deletions common/js/oldpopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,28 +358,30 @@ $(document).ready(async function () {
});
$("#unWarning").hide();
$("#pwWarning").hide();
$("#login").bind("submit", async function () {
localStorage.username = $("#username").val();
localStorage.password = $("#password").val();
await background.partnerLogin();
if (background.userAuthToken === "") {
$("#unWarning").show();
$("#pwWarning").show();
$("#username").css({
"padding-left": "16px",
"width": "216px"
});
$("#password").css({
"padding-left": "16px",
"width": "216px"
});
return false;
} else {
addStations();
//move to mid panel
goToStations();
return false;
}
$("#login").bind("submit", function (e) {
(async() => {
localStorage.username = $("#username").val();
localStorage.password = $("#password").val();
await background.partnerLogin();
if (background.userAuthToken === "") {
$("#unWarning").show();
$("#pwWarning").show();
$("#username").css({
"padding-left": "16px",
"width": "216px"
});
$("#password").css({
"padding-left": "16px",
"width": "216px"
});
} else {
addStations();
//move to mid panel
goToStations();
}
})();
e.preventDefault();
return false;
});

$("#stationFilterInput").bind("keypress change input paste", () => {
Expand Down
2 changes: 1 addition & 1 deletion firefox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"description": "Skip to the next song"
}
},
"version": "2.1.2",
"version": "2.1.3",
"options_ui": {
"page": "options.htm",
"browser_style": true
Expand Down

0 comments on commit 47f61a8

Please sign in to comment.