<commit_before><!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>Lark</title>
    <link rel="stylesheet" href="http://labs.music.baidu.com/muplayer/doc/bower_components/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="http://labs.music.baidu.com/muplayer/doc/css/player-demo.css">
    <style>
      #player-demo .avatar img{
        /* width: 0; */
      }
      .mod {
        width: 320px;
        margin: 10% auto;
      }
    </style>
  </head>
  <body>

    <div class="mod">
      <div class="hd">带UI的简易播放器</div>
      <div class="bd">
        <div id="player-demo">
          <div class="player-widget">
            <div class="opts">
              <span class="prev" title="prev">
                <i class="glyphicon glyphicon-step-backward"></i>
              </span>
              <span class="ctrl" title="play">
                <i class="glyphicon glyphicon-play"></i>
              </span>
              <span class="next" title="next">
                <i class="glyphicon glyphicon-step-forward"></i>
              </span>
              <span class="mode" title="mode"><i class="glyphicon glyphicon-repeat"></i></span>
            </div>
            <div class="volume" title="volume">
              <i class="glyphicon glyphicon-volume-down"></i><span class="bar"></span>
            </div>
            <a class="avatar" href="javascript:;">
              <img alt="" src="http://labs.music.baidu.com/muplayer/doc/img/default.jpg">
            </a>
            <div class="progress-bar"></div>
          </div>
        </div>
      </div>
    </div>

    <footer>
      <script src="http://labs.music.baidu.com/muplayer/bower_components/jquery/jquery.min.js"></script>
      <script src="http://labs.music.baidu.com/muplayer/bower_components/jquery-ui/ui/jquery-ui.js"></script>
      <script src="http://labs.music.baidu.com/muplayer/bower_components/jquery-ui/ui/jquery.ui.slider.js"></script>
      <script src="http://labs.music.baidu.com/muplayer/bower_components/requirejs/require.js"></script>
      <script src="http://labs.music.baidu.com/muplayer/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
      <script>
        require.config({
          paths: {
            muplayer: 'http://tmp-images.qiniudn.com/js/muplayer/0.9.2' // 须指向muplayer.js存放的目录
          }
        });

        // 通过AMD方式加载muplayer
        require(['muplayer/player'], function(Player) {

        // 重写 _fetch 方法，支持通过 sid 获取音频资源信息
        Player.prototype._fetch = function() {
          var def;
          def = $.Deferred();
          if (this.getUrl() === this.getCur()) {
            def.resolve();
          } else {
            setTimeout((function(_this) {
              return function() {
                var sid = _this.getCur();
                $.ajax({
                  url: '/music/api/music/' + sid + '/',
                  async: false,
                  success: function(data) {
                    _this.setUrl(data.data.mp3);
                    return def.resolve();
                  },
                  error: function() {
                    def.resolve();
                  }
                });
              };
            })(this), 0);
          }
          return def.promise();
        };


          hasAddedNewMusic = false;
          var player = window.player = new Player({
            baseDir: 'http://tmp-images.qiniudn.com/js/muplayer/0.9.2',
            absoluteUrl: false,
            engines: [{
              constructor: 'AudioCore'
            }]

          }),
          $player = $('.player-widget'),
          $opts = $player.find('.opts'),
          $ctrlBtn = $opts.find('.ctrl'),
          $ctrlIcon = $ctrlBtn.find('i'),
          $prevBtn = $opts.find('.prev'),
          $nextBtn = $opts.find('.next'),
          $modeBtn = $opts.find('.mode'),
          $modeIcon = $modeBtn.find('i'),
          $volume = $player.find('.volume'),
          $progress = $player.find('.progress-bar'),
          $avatar = $player.find('.avatar'),

          // 监听播放时派发的timeupdate事件以更新播放进度条等相关UI
          handleTimeupdate = function() {
            var pos = player.curPos(),
                duration = player.duration(),
                progressValue = duration ? pos / duration * 1000 : 0;
            $progress.slider('option', 'value', progressValue);
            if (!hasAddedNewMusic && progressValue >= 800) {
              // 添加新的音乐
              newMusic();
              hasAddedNewMusic = true;
            } else if (hasAddedNewMusic && progressValue <= 500) {
              hasAddedNewMusic = false;
            }
          };

          // 添加新的音乐
          function newMusic() {
            $.ajax({<commit_msg>Revert "update index.html"<commit_after><!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>Lark</title>
    <link rel="stylesheet" href="http://labs.music.baidu.com/muplayer/doc/bower_components/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="http://labs.music.baidu.com/muplayer/doc/css/player-demo.css">
    <style>
      #player-demo .avatar img{
        /* width: 0; */
      }
      .mod {
        width: 320px;
        margin: 10% auto;
      }
    </style>
  </head>
  <body>

    <div class="mod">
      <div class="hd">带UI的简易播放器</div>
      <div class="bd">
        <div id="player-demo">
          <div class="player-widget">
            <div class="opts">
              <span class="prev" title="prev">
                <i class="glyphicon glyphicon-step-backward"></i>
              </span>
              <span class="ctrl" title="play">
                <i class="glyphicon glyphicon-play"></i>
              </span>
              <span class="next" title="next">
                <i class="glyphicon glyphicon-step-forward"></i>
              </span>
              <span class="mode" title="mode"><i class="glyphicon glyphicon-repeat"></i></span>
            </div>
            <div class="volume" title="volume">
              <i class="glyphicon glyphicon-volume-down"></i><span class="bar"></span>
            </div>
            <a class="avatar" href="javascript:;">
              <img alt="" src="http://labs.music.baidu.com/muplayer/doc/img/default.jpg">
            </a>
            <div class="progress-bar"></div>
          </div>
        </div>
      </div>
    </div>

    <footer>
      <script src="http://labs.music.baidu.com/muplayer/bower_components/jquery/jquery.min.js"></script>
      <script src="http://labs.music.baidu.com/muplayer/bower_components/jquery-ui/ui/jquery-ui.js"></script>
      <script src="http://labs.music.baidu.com/muplayer/bower_components/jquery-ui/ui/jquery.ui.slider.js"></script>
      <script src="http://labs.music.baidu.com/muplayer/bower_components/requirejs/require.js"></script>
      <script src="http://labs.music.baidu.com/muplayer/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
      <script>
        require.config({
          paths: {
            muplayer: 'http://tmp-images.qiniudn.com/js/muplayer/0.9.2' // 须指向muplayer.js存放的目录
          }
        });

        // 通过AMD方式加载muplayer
        require(['muplayer/player'], function(Player) {

        // 重写 _fetch 方法，支持通过 sid 获取音频资源信息
        Player.prototype._fetch = function() {
          var def;
          def = $.Deferred();
          if (this.getUrl() === this.getCur()) {
            def.resolve();
          } else {
            setTimeout((function(_this) {
              return function() {
                var sid = _this.getCur();
                $.ajax({
                  url: '/music/api/music/' + sid + '/',
                  async: false,
                  success: function(data) {
                    _this.setUrl(data.data.mp3);
                    return def.resolve();
                  },
                  error: function() {
                    def.resolve();
                  }
                });
              };
            })(this), 0);
          }
          return def.promise();
        };


          hasAddedNewMusic = false;
          var player = window.player = new Player({
            baseDir: 'http://tmp-images.qiniudn.com/js/muplayer/0.9.2',
            absoluteUrl: false,
            engines: [{
              constructor: 'AudioCore'
            }]

          }),
          $player = $('.player-widget'),
          $opts = $player.find('.opts'),
          $ctrlBtn = $opts.find('.ctrl'),
          $ctrlIcon = $ctrlBtn.find('i'),
          $prevBtn = $opts.find('.prev'),
          $nextBtn = $opts.find('.next'),
          $modeBtn = $opts.find('.mode'),
          $modeIcon = $modeBtn.find('i'),
          $volume = $player.find('.volume'),
          $progress = $player.find('.progress-bar'),
          $avatar = $player.find('.avatar'),

          // 监听播放时派发的timeupdate事件以更新播放进度条等相关UI
          handleTimeupdate = function() {
            var pos = player.curPos(),
                duration = player.duration(),
                progressValue = duration ? pos / duration * 1000 : 0;
            $progress.slider('option', 'value', progressValue);
            if (!hasAddedNewMusic && progressValue >= 800) {
              // 添加新的音乐
              newMusic();
              hasAddedNewMusic = true;
            } else if (progressValue <= 500) {
              hasAddedNewMusic = false;
            }
          };

          // 添加新的音乐
          function newMusic() {
            $.ajax({
{'fraction_non_alphanumeric': 0.16304917689000734, 'fraction_numerical': 0.005452448359022754, 'mean_word_length': 1.634806629834254, 'pattern_counts': {'":': 0, '<': 133, '<?xml version=': 0, '>': 133, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3679173', 'n_tokens_mistral': 2992, 'n_tokens_neox': 2899, 'n_words': 446}