Sha256: 4e1a8b0db7700f35563518ec361a6eb476c9da613cba96dea1dbff44bcd5e1bd

Contents?: true

Size: 938 Bytes

Versions: 3

Compression:

Stored size: 938 Bytes

Contents

$(function() {

  var client = new Faye.Client('/faye');

  client.subscribe('/info', function(message) {
    console.log(message);
    $pause_button = $('button.pause');
    $love_button = $('button.love');
    if (message.radio.is_paused) {
      $pause_button.text('播放');
    } else {
      $pause_button.text('暂停');
    }
    if (message.radio.selected_like) {
      $love_button.text('取消喜欢');
    } else {
      $love_button.text('喜欢');
    }
    $('#cover').html('<img src="' + message.song.coverUrl + '" />');
    $('#channel').html('频道: ' + message.song.channelName);
    $('#artist').html('歌手: ' + message.song.artistName);
    $('#song-name').html('歌名: ' + message.song.songName);
  });

  client.publish('/get_info', { get: 1 });

  $buttons = $('button');
  $buttons.click(function() {
    $this = $(this);
    var cmd = $this.data('cmd')
    client.publish('/hotkey', { cmd: cmd });
  });
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
douban_fm_hotkey-1.2.2 lib/douban_fm_hotkey/server/public/server.js
douban_fm_hotkey-1.2.1 lib/douban_fm_hotkey/server/public/server.js
douban_fm_hotkey-1.2.0 lib/douban_fm_hotkey/server/public/server.js