// Dynamically set the css background images for all the sprites
SkinManager = function() {
    var self = this;

    this._skinImages = {
        "#winamp": "MAIN.BMP",
        "#title-bar": "TITLEBAR.BMP",
        "#title-bar #option": "TITLEBAR.BMP",
        "#title-bar #minimize": "TITLEBAR.BMP",
        "#title-bar #shade": "TITLEBAR.BMP",
        "#title-bar #close": "TITLEBAR.BMP",
        ".status #clutter-bar": "TITLEBAR.BMP",
        ".status #play-pause": "PLAYPAUS.BMP",
        ".play .status #play-pause #work-indicator": "PLAYPAUS.BMP",
        ".status #time #minus-sign": "NUMBERS.BMP",
        ".media-info .mono-stereo div": "MONOSTER.BMP",
        "#volume": "VOLUME.BMP",
        "#volume::-webkit-slider-thumb": "VOLUME.BMP",
        "#volume::-moz-range-thumb": "VOLUME.BMP",
        "#balance": "BALANCE.BMP",
        "#balance::-webkit-slider-thumb": "VOLUME.BMP",
        "#balance::-moz-range-thumb": "VOLUME.BMP",
        ".windows div": "SHUFREP.BMP",
        "#position": "POSBAR.BMP",
        "#position::-webkit-slider-thumb": "POSBAR.BMP",
        "#position::-moz-range-thumb": "POSBAR.BMP",
        ".actions div": "CBUTTONS.BMP",
        "#eject": "CBUTTONS.BMP",
        ".shuffle-repeat div": "SHUFREP.BMP",
        ".character": "TEXT.BMP",
        ".digit": "NUMBERS.BMP",
        ".shade #position": "TITLEBAR.BMP",
        ".shade #position::-webkit-slider-thumb": "TITLEBAR.BMP",
        ".shade #position::-moz-range-thumb": "TITLEBAR.BMP",
    }

    // I have a collection of skins on GitHub to make loading remote skins
    // easier. rawgit.com changes this into a free CDN
    this.setSkinByName = function(name) {
        url = "https://cdn.rawgit.com/elliots/winamp2-js/master/skins/" + name + ".wsz";
        self.setSkinByUrl(url);
    }

    // Given the url of an original Winamp WSZ file, set the current skin
    this.setSkinByUrl = function(url) {

      JSZipUtils.getBinaryContent(url, function(err, data) {

        if (err) {
          alert('Failed to load skin ' + url + ' : ' + err);
        }

        try {

          var zip = new JSZip(data);

          var style = document.getElementById('skin');
          var cssRules = '';
          for(var selector in self._skinImages) {

            var file = zip.filter(function (relativePath, file){
              return new RegExp(self._skinImages[selector], 'i').test(relativePath)
            })[0];

            if (!file) {
              console.log("Warning: Couldn't find file:" + self._skinImages[selector])
            } else {
              var value = "background-image: url(data:image/bmp;base64," + btoa(file.asBinary()) + ")"
              cssRules += selector + "{" + value + "}\n";
            }
          }
          style.appendChild(document.createTextNode(cssRules));

        } catch(e) {
          alert('Failed to load skin ' + url + ' : ' + e.message);
        }
      })

    }
}

;(function () {

  var object = typeof exports != 'undefined' ? exports : this; // #8: web workers
  var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

  function InvalidCharacterError(message) {
    this.message = message;
  }
  InvalidCharacterError.prototype = new Error;
  InvalidCharacterError.prototype.name = 'InvalidCharacterError';

  // encoder
  // [https://gist.github.com/999166] by [https://github.com/nignag]
  object.btoa || (
  object.btoa = function (input) {
    for (
      // initialize result and counter
      var block, charCode, idx = 0, map = chars, output = '';
      // if the next input index does not exist:
      //   change the mapping table to "="
      //   check if d has no fractional digits
      input.charAt(idx | 0) || (map = '=', idx % 1);
      // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
      output += map.charAt(63 & block >> 8 - idx % 1 * 8)
    ) {
      charCode = input.charCodeAt(idx += 3/4);
      if (charCode > 0xFF) {
        throw new InvalidCharacterError("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
      }
      block = block << 8 | charCode;
    }
    return output;
  });

  // decoder
  // [https://gist.github.com/1020396] by [https://github.com/atk]
  object.atob || (
  object.atob = function (input) {
    input = input.replace(/=+$/, '');
    if (input.length % 4 == 1) {
      throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
    }
    for (
      // initialize result and counters
      var bc = 0, bs, buffer, idx = 0, output = '';
      // get next character
      buffer = input.charAt(idx++);
      // character found in table? initialize bit storage and add its ascii value;
      ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
        // and if not first of each 4 characters,
        // convert the first 8 bits to one ascii character
        bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
    ) {
      // try to find character in table (0-63, not found => -1)
      buffer = chars.indexOf(buffer);
    }
    return output;
  });

}());

@@ -2919,2195 +2919,4 @@
 %7D%0A%7D%0A
-%0A;(function () %7B%0A%0A  var object = typeof exports != 'undefined' ? exports : this; // #8: web workers%0A  var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';%0A%0A  function InvalidCharacterError(message) %7B%0A    this.message = message;%0A  %7D%0A  InvalidCharacterError.prototype = new Error;%0A  InvalidCharacterError.prototype.name = 'InvalidCharacterError';%0A%0A  // encoder%0A  // %5Bhttps://gist.github.com/999166%5D by %5Bhttps://github.com/nignag%5D%0A  object.btoa %7C%7C (%0A  object.btoa = function (input) %7B%0A    for (%0A      // initialize result and counter%0A      var block, charCode, idx = 0, map = chars, output = '';%0A      // if the next input index does not exist:%0A      //   change the mapping table to %22=%22%0A      //   check if d has no fractional digits%0A      input.charAt(idx %7C 0) %7C%7C (map = '=', idx %25 1);%0A      // %228 - idx %25 1 * 8%22 generates the sequence 2, 4, 6, 8%0A      output += map.charAt(63 & block %3E%3E 8 - idx %25 1 * 8)%0A    ) %7B%0A      charCode = input.charCodeAt(idx += 3/4);%0A      if (charCode %3E 0xFF) %7B%0A        throw new InvalidCharacterError(%22'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.%22);%0A      %7D%0A      block = block %3C%3C 8 %7C charCode;%0A    %7D%0A    return output;%0A  %7D);%0A%0A  // decoder%0A  // %5Bhttps://gist.github.com/1020396%5D by %5Bhttps://github.com/atk%5D%0A  object.atob %7C%7C (%0A  object.atob = function (input) %7B%0A    input = input.replace(/=+$/, '');%0A    if (input.length %25 4 == 1) %7B%0A      throw new InvalidCharacterError(%22'atob' failed: The string to be decoded is not correctly encoded.%22);%0A    %7D%0A    for (%0A      // initialize result and counters%0A      var bc = 0, bs, buffer, idx = 0, output = '';%0A      // get next character%0A      buffer = input.charAt(idx++);%0A      // character found in table? initialize bit storage and add its ascii value;%0A      ~buffer && (bs = bc %25 4 ? bs * 64 + buffer : buffer,%0A        // and if not first of each 4 characters,%0A        // convert the first 8 bits to one ascii character%0A        bc++ %25 4) ? output += String.fromCharCode(255 & bs %3E%3E (-2 * bc & 6)) : 0%0A    ) %7B%0A      // try to find character in table (0-63, not found =%3E -1)%0A      buffer = chars.indexOf(buffer);%0A    %7D%0A    return output;%0A  %7D);%0A%0A%7D());%0A

Remove base64 shim