Skip to content

Commit

Permalink
fix(bookmaklet): Transpile changes form #408 to JS
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienjoly committed Nov 28, 2020
1 parent 7296b21 commit 59f6f98
Showing 1 changed file with 11 additions and 41 deletions.
52 changes: 11 additions & 41 deletions public/js/bookmarklet.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,52 +524,22 @@ if (typeof exports === 'undefined') {
};
return this;
}
// Additional detectors
function initPlayemPlayers(playemUrl, callback) {
window.SOUNDCLOUD_CLIENT_ID = 'eb257e698774349c22b0b727df0238ad';
window.DEEZER_APP_ID = 190482;
window.DEEZER_CHANNEL_URL = urlPrefix + '/html/deezer.channel.html';
window.JAMENDO_CLIENT_ID = 'c9cb2a0a';
window.YOUTUBE_API_KEY = '';
include(playemUrl, function () {
// playem-all.js must be loaded at that point
callback({
// yt: new YoutubePlayer(...) should be replaced by openwhydYouTubeExtractor, to save API quota (see #262)
sc: new window.SoundCloudPlayer({}),
vi: new window.VimeoPlayer({}),
dm: new window.DailymotionPlayer({}),
dz: new window.DeezerPlayer({}),
bc: new window.BandcampPlayer({}),
ja: new window.JamendoPlayer({}),
});
});
}
// Start up
var urlPrefix = findScriptHost(FILENAME) || 'https://openwhyd.org',
urlSuffix = '?' + new Date().getTime();
console.info('loading bookmarklet stylesheet...');
include(urlPrefix + CSS_FILEPATH + urlSuffix);
console.info('loading PlayemJS...');
var playemFile = /openwhyd\.org/.test(urlPrefix)
? 'playem-min.js'
: 'playem-all.js';
var playemUrl = urlPrefix + '/js/' + playemFile + urlSuffix;
initPlayemPlayers(playemUrl, function (players) {
var bookmarklet = makeBookmarklet({
pageDetectors: openwhydBkPageDetectors,
});
var allPlayers = Object.assign(
{
yt: openwhydYouTubeExtractor,
},
players
);
bookmarklet.detectTracks({
window: window,
ui: BkUi(),
urlDetectors: [makeFileDetector(), makeStreamDetector(allPlayers)],
urlPrefix: urlPrefix,
});
var bookmarklet = makeBookmarklet({
pageDetectors: openwhydBkPageDetectors,
});
var allPlayers = {
yt: openwhydYouTubeExtractor,
};
bookmarklet.detectTracks({
window: window,
ui: BkUi(),
urlDetectors: [makeFileDetector(), makeStreamDetector(allPlayers)],
urlPrefix: urlPrefix,
});
})();
}
Expand Down

0 comments on commit 59f6f98

Please sign in to comment.