Skip to content

Commit 6030722

Browse files
committed
Release 0.5.0
1 parent 49bd6db commit 6030722

File tree

3 files changed

+126
-1
lines changed

3 files changed

+126
-1
lines changed

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ BassoonTracker is a web application that runs in your browser.
7474
Just serve "index.html" from a webserver and you're good to go.
7575
If you want to run it locally and you don't want to fiddle with things as `node`and `npm`, I can recommend [Spark](https://github.com/rif/spark/releases)
7676
Download the binary for your platform, drop the Spark executable in the folder where you downloaded the BassoonTracker source files and run it.
77-
If you then point your browser to http://localhost:8080/ it should work.
77+
If you then point your browser to http://localhost:8080/dev.html it should work.
7878

7979
**How to Build**
8080
- BassoonTracker doesn't need building, the build step is **optional**, there are no runtime dependencies (*bliss!*)

script/src/provider/hippo.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
2+
import FetchService from "../fetchService.js";
3+
4+
var Hippo = function(){
5+
var me = {};
6+
7+
var apiUrl = "http://localhost:3000/hippo/";
8+
apiUrl = "https://www.stef.be/bassoontracker/api/hippo/";
9+
//var apiUrlV1 = "https://www.stef.be/bassoontracker/api/";
10+
var playlists = [];
11+
12+
me.get = function(url,next){
13+
var params = url.split("/");
14+
15+
url = params[0];
16+
var param = params[1] || "";
17+
var page = params[2] || "";
18+
19+
switch (url){
20+
case "playlists":
21+
loadPlaylists(next);
22+
break;
23+
case "playlist":
24+
loadFromApi(param,next);
25+
break;
26+
default:
27+
next([]);
28+
}
29+
};
30+
31+
function loadPlaylists(next){
32+
if (playlists.length) {
33+
if (next) next(playlists);
34+
}else{
35+
loadFromApi("",function(result){
36+
playlists = [];
37+
result.forEach(function(item){
38+
playlists.push({
39+
title: item.replace(".prg","").replace(/_/g," "),
40+
url: item,
41+
icon:"playlist"
42+
});
43+
});
44+
if (next) next(playlists);
45+
})
46+
}
47+
}
48+
49+
50+
function loadFromApi(url,next){
51+
console.log("load from api " + apiUrl + url);
52+
FetchService.json(apiUrl + url,function(data){
53+
next(data);
54+
})
55+
}
56+
57+
58+
return me;
59+
}();
60+
61+
export default Hippo;

script/src/service/shareService.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import Tracker from "../tracker.js";
2+
import Host from "../host.js";
3+
import UI from "../ui/ui.js";
4+
5+
let ShareService = (()=>{
6+
let me = {};
7+
let defaultText = "Check out this awesome music mod!";
8+
9+
me.canShareNative = function(){
10+
return navigator.share
11+
&& navigator.canShare
12+
&& navigator.canShare(
13+
{
14+
title: "BassoonTracker",
15+
text: defaultText,
16+
url: window.location.href
17+
});
18+
}
19+
20+
21+
me.share = function(target,type){
22+
let url = getUrl();
23+
switch (target){
24+
case "native":
25+
if (navigator.share){
26+
navigator.share({
27+
title: "BassoonTracker",
28+
text: defaultText,
29+
url: url
30+
});
31+
}
32+
break;
33+
case "x":
34+
window.open("http://x.com/share?text=" + encodeURIComponent(defaultText) +"&url="+encodeURIComponent(url)+"&hashtags=TrackerMusic");
35+
break;
36+
case "facebook":
37+
window.open("https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(url));
38+
break;
39+
case "copy":
40+
// Copy to clipboard
41+
navigator.clipboard.writeText(url).then(function() {
42+
UI.setStatus("Share Link copied to clipboard");
43+
});
44+
45+
break;
46+
}
47+
}
48+
49+
function getUrl(){
50+
let url = Tracker.getCurrentUrl();
51+
let base = Host.getBaseUrl();
52+
if (!base){
53+
base = window.location.href.split("?")[0];
54+
base = base.substring(0,base.lastIndexOf("/")) + "/";
55+
base = "https://www.stef.be/bassoontracker/";
56+
}
57+
url = base + "?file=" + url;
58+
return url;
59+
}
60+
61+
return me;
62+
})();
63+
64+
export default ShareService;

0 commit comments

Comments
 (0)