This very simple script can be used to show the iTunes Buy now or Pre-order Badge.
Created by me Lapotor.
You need jQuery to run this. You can choose a version from https://code.jquery.com/ or use the following:
<script src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
Of course you need to import the functions.js
.
And you need to add the following below the jQuery and functions import:
Edit the variable STATION_NAME
at the beginning where it says <<LAUT.FM STATION NAME>>
with your Laut.fm station name.
/* === EDIT BELOW === */
let STATION_NAME = "<<LAUT.FM STATION NAME>>";
/* === DON'T EDIT === */
let song_url = "https://api.laut.fm/station/" + STATION_NAME + "/current_song";
let song_str;
iTunesBadge(song_url);
badgeLoop(song_url);
The test.html
file shows the Structure how it needed to get implemented into your page.
It's very simple, this is needed more or less:
<div id="iTunes">
<a href="" target="_top _blank">
<img src="images/buy_now.svg" width="140" height="41" alt="Erhältlich im iTunes Store">
</a>
</div>
If needed change the src
attribute of the <img>
to your path for the buy now badge.
To get the badges in your language few this page:
https://www.apple.com/itunes/marketing-on-itunes/identity-guidelines.html#itunes-store-badges
To be sure for legal reasons this work is licensed under the MIT License:
https://opensource.org/licenses/MIT