Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!--
◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
   last.fm sounds of the now
         simple version
◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
i learned about the last.fm stuff
       from the amazing
 Prashant Shrestha (prashant.me)
◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇

-->

<div id="lastfm">
  <div id="sounds">
    <p>
      <span id="current">I've been listening to <a alt="Currently Playing" target="_blank" id="tune">
          <!-- javascript will fill this area with the song title and artist name -->
        </a> lately.</span>
      <!-- the previous section (<span id="current"> etc</span>) vanishes entirely if nothing is playing -->
      <span id="silent">Nothing is currently playing.</span>
      <!--
and is replaced by the previous section (id="silent"), customize as you want -->
      Visit my <a target="_blank" id="profile">Last.fm profile</a>, or visit the <a href="#">playlists page here.</a> <!-- the previous sentence with the link to a playlists page can be altered in any way you want, to remove the link, add others, etc. Alternatively, remove it entirely. -->
    </p>
  </div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
              
            
!

CSS

              
                body {
  /* for demonstrative purposes, i've constrained the page to a sidebar-like width of 30%. ignore this part, because usually, you'll be plopping this in your own sidebar or something */
  width: 30%;
  margin: auto;
}

/*
◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
   last.fm sounds of the now
         simple version
◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
i learned about the last.fm stuff
       from the amazing
 Prashant Shrestha (prashant.me)
◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
*/

#lastfm {
  width: 100%; /* this should remain 100% obviously, if you want it to entirely fill the container in which it is placed, ie, a sidebar, etc... */
}

              
            
!

JS

              
                //◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
//◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
//   last.fm sounds of the now
//         simple version
//◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
//◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
// i learned about last.fm's stuff
//       from the amazing
// Prashant Shrestha (prashant.me)
//◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
//◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
const apikey = "c0fba2a4e49b8d2fa38bfed35df268ab"; //last.fm API key goes here of course...
const username = "ClarityAnne"; //last.fm username goes here...
const s = 60;
const tunes = function () {
  const profile = "https://last.fm/user/" + username;
  $.ajax({
    type: "GET",
    url:
      "https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=" +
      username +
      "&api_key=" +
      apikey +
      "&format=json&limit=1", //building the call, and calling out to last.fm for your most recent track, but will they grace us with a response? do not refuse the call. it is your destiny, last.fm
    dataType: "json",
    success: function (resp) {
      //oh, they responded - good... moving on...
      var tuning = resp.recenttracks.track[0]; //pull most recent track pls?

      var formatted = tuning.name + " by " + tuning.artist["#text"]; //format display of most recent track title and artist name
      $("#silent").hide(); //hides the error message if there's no error. i love weed...
      $("#tune").html(formatted); //adds a line of visible text including the song title and artist
      $("#profile").attr("href", profile);
      $("#tune") //links the text displaying the current song to the song's page
        .attr("href", tuning.url)
        .attr("title", tuning.name + " by " + tuning.artist["#text"])
        .attr("target", "_blank");
    },
    //this part sets up an error function. it hides the text and the album art portion and shows the notice that nothing is playing. to preview what this looks like, remove your API key or replace it with dummy numbers instead.
    error: function (resp) {
      $("#current").hide();
      $("#silent").show();
    }
  });
};

tunes(); //the function executes when the page loads
setInterval(tunes, s * 1000);
// then at intervals of every sixty seconds, reloading to see what new stuff is playing. you can remove the latter line (setIntervals etc) if you only want this to load once per page load, without updating.
//i'm so zooted right now

              
            
!
999px

Console