Skip to content
This repository has been archived by the owner on May 3, 2019. It is now read-only.

Commit

Permalink
Bandcamp fix on discover page
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinDuquesnoy committed Feb 18, 2018
1 parent 27c1424 commit d2f8a68
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions plugins/bandcamp/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function play() {
m[1].getElementsByClassName("play-button")[0].click();
}
else if (document.location.host === "bandcamp.com" || document.location.host ==="daily.bandcamp.com") {
clickOnHome();
clickButton("playbutton");
}
else {
clickButton("playbutton");
Expand Down Expand Up @@ -177,18 +177,26 @@ function readTimeString(stringTime) {
}

function readElapsedOnFeed() {
var m=document.getElementsByClassName("playing");
var elapsed = m[1].getElementsByClassName("time_elapsed")[0];
if (elapsed != undefined) {
return readTimeString(elapsed.innerHTML);
try {
var m=document.getElementsByClassName("playing");
var elapsed = m[1].getElementsByClassName("time_elapsed")[0];
if (elapsed != undefined) {
return readTimeString(elapsed.innerHTML);
}
} catch (e) {
return 0;
}
}

function readTotalOnFeed() {
var m=document.getElementsByClassName("playing");
var total = m[1].getElementsByClassName("time_total")[0];
if (total != undefined) {
return readTimeString(total.innerHTML);
try {
var m=document.getElementsByClassName("playing");
var total = m[1].getElementsByClassName("time_total")[0];
if (total != undefined) {
return readTimeString(total.innerHTML);
}
} catch (e) {
return 0
}
}

Expand Down Expand Up @@ -258,7 +266,12 @@ function getArtistNameOnHome() {
}
}
catch (e) {
return ""
var miniPlayer=document.getElementsByClassName("playbutton");
if (miniPlayer.length == 1) {
//console.log("mini "+ miniPlayer);
return document.querySelector(".detail-artist > a:nth-child(1)").innerHTML;
}
return "";
}
}

Expand Down Expand Up @@ -311,7 +324,12 @@ function getSongTitleOnHome() {
}
}
catch (e) {
return ""
var miniPlayer=document.getElementsByClassName("playbutton");
if (miniPlayer.length == 1) {
//console.log("mini "+ miniPlayer);
return document.querySelector(".title").innerHTML;
}
return "";
}
}

Expand Down

0 comments on commit d2f8a68

Please sign in to comment.