Changeset 1352348
- Timestamp:
- 02/17/2016 06:52:55 AM (10 years ago)
- Location:
- netease-music/trunk
- Files:
-
- 13 edited
-
functions/embed.php (modified) (5 diffs)
-
functions/nm-setting.php (modified) (1 diff)
-
functions/nmjson.php (modified) (3 diffs)
-
neteasemusic.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
static/css/page.less (modified) (4 diffs)
-
static/css/page.min.css (modified) (1 diff)
-
static/css/single.less (modified) (1 diff)
-
static/css/single.min.css (modified) (1 diff)
-
static/js/page.js (modified) (3 diffs)
-
static/js/page.min.js (modified) (1 diff)
-
static/js/single.js (modified) (1 diff)
-
static/js/single.min.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
netease-music/trunk/functions/embed.php
r1347195 r1352348 41 41 global $nmjson; 42 42 static $instance = 0; 43 43 44 44 if( $instance === 0) $html ='<script>var playlist = []</script><div id="nm_jplayer" style="display:none"></div>'; 45 45 switch ($type) { … … 47 47 $data = $nmjson->netease_album($id); 48 48 $songs = $data['songs']; 49 $html .= nm_single_playform( $data['album_id'] , $instance , $data['album_cover'] , $data['album_title'] , $data['album_author'] , '' ); 49 $html .= nm_single_playform( $data['album_id'] , $instance , $data['album_cover'] , $data['album_title'] , $data['album_author'] , '' ); 50 50 $html .= '<div class="nms-list" id="nm-list-' . $instance . '" data-index="' . $instance . '">'; 51 51 foreach ($songs as $key => $song) { … … 58 58 case 'song': 59 59 $data = $nmjson->netease_song($id); 60 $html .= nm_single_playform( $data['id'] , $instance , $data['cover'] , $data['title'] , $data['artist'] , $data['duration'] ); 60 $html .= nm_single_playform( $data['id'] , $instance , $data['cover'] , $data['title'] , $data['artist'] , $data['duration'] ); 61 if( nm_get_setting("comment") ) $comments = $nmjson->comments($id); 62 if (!empty($comments)) : 63 $html .= '<div class="nmhotcom"><span class="com-close">X</span><div class="nmhc-title">网易热评</div>'; 64 foreach ($comments as $key => $comment) { 65 $html .= '<div class="nmh-item"><img src="' . $comment['user']['avatarUrl'] . '?param=24x24" class="nmu-avatar"><span class="nmu-name">' . $comment['user']['nickname'] . '</span>:' .$comment['content'] . '</div>'; 66 } 67 $html .= '</div>'; 68 endif; 69 61 70 $html .= '<script>playlist.push(' . json_encode(array($data)). ');</script>'; 62 71 break; … … 66 75 $songs = $data['songs']; 67 76 //var_dump($songs); 68 $html .= nm_single_playform( $data['collect_id'] , $instance , $data['collect_cover'] , $data['collect_title'] , $data['collect_author'] , '' ); 77 $html .= nm_single_playform( $data['collect_id'] , $instance , $data['collect_cover'] , $data['collect_title'] , $data['collect_author'] , '' ); 69 78 $html .= '<div class="nms-list" id="nm-list-' . $instance . '" data-index="' . $instance . '">'; 70 79 foreach ($songs as $key => $song) { … … 76 85 case 'program': 77 86 $data = $nmjson->netease_radio($id); 78 $html .= nm_single_playform( $data['id'] , $instance , $data['cover'] , $data['title'] , $data['artist'] , $data['duration'] ); 87 $html .= nm_single_playform( $data['id'] , $instance , $data['cover'] , $data['title'] , $data['artist'] , $data['duration'] ); 79 88 $html .= '<script>playlist.push(' . json_encode(array($data)) . ');</script>'; 80 break; 89 break; 81 90 default: 82 91 return $url; -
netease-music/trunk/functions/nm-setting.php
r1347195 r1352348 93 93 </tr> 94 94 <tr valign="top"> 95 <th scope="row"><label for="<?php echo nm_setting_key('tworow');?>">歌曲评论</label></th> 96 <td> 97 <label for="<?php echo nm_setting_key('comment');?>"> 98 <input type="checkbox" name="<?php echo nm_setting_key('comment');?>" id="comment" value="1" <?php if(nm_get_setting("comment")) echo 'checked="checked"';?>> 99 </label> 100 <p class="description">显示歌曲热门评论。</p> 101 </td> 102 </tr> 103 <tr valign="top"> 95 104 <th scope="row"><label for="<?php echo nm_setting_key('tworow');?>">歌曲列表三列</label></th> 96 105 <td> -
netease-music/trunk/functions/nmjson.php
r1347195 r1352348 1 1 <?php 2 class nmjson{ 3 public function __construct(){ 4 //$this->get_token(); 5 } 6 public function netease_song($music_id) 7 { 8 $key = "/netease/song/$music_id"; 9 10 $cache = $this->get_cache($key); 11 if( $cache ) return $cache; 12 13 $url = "http://music.163.com/api/song/detail/?id=" . $music_id . "&ids=%5B" . $music_id . "%5D"; 14 $response = $this->netease_http($url); 15 16 if( $response["code"]==200 && $response["songs"] ){ 17 //print_r($response["songs"]); 18 //处理音乐信息 19 $mp3_url = $response["songs"][0]["mp3Url"]; 20 $mp3_url = str_replace("http://m", "http://p", $mp3_url); 21 $music_name = $response["songs"][0]["name"]; 22 $mp3_cover = $response["songs"][0]["album"]["picUrl"]; 23 $song_duration = $response["songs"][0]["duration"]; 2 class nmjson{ 3 public function __construct(){ 4 //$this->get_token(); 5 } 6 public function netease_song($music_id) 7 { 8 $key = "/netease/song/$music_id"; 9 10 $cache = $this->get_cache($key); 11 if( $cache ) return $cache; 12 13 $url = "http://music.163.com/api/song/detail/?id=" . $music_id . "&ids=%5B" . $music_id . "%5D"; 14 $response = $this->netease_http($url); 15 16 if( $response["code"]==200 && $response["songs"] ){ 17 //print_r($response["songs"]); 18 //处理音乐信息 19 $mp3_url = $response["songs"][0]["mp3Url"]; 20 $mp3_url = str_replace("http://m", "http://p", $mp3_url); 21 $music_name = $response["songs"][0]["name"]; 22 $mp3_cover = $response["songs"][0]["album"]["picUrl"]; 23 $song_duration = $response["songs"][0]["duration"]; 24 $artists = array(); 25 26 foreach ($response["songs"][0]["artists"] as $artist) { 27 $artists[] = $artist["name"]; 28 } 29 30 $artists = implode(",", $artists); 31 $lrc = nm_get_setting("lyric") ? $this->get_song_lrc( $music_id ) : ""; 32 $result = array( 33 "id" => $music_id, 34 "title" => $music_name, 35 "artist" => $artists, 36 "mp3" => $mp3_url, 37 "cover" => $mp3_cover, 38 "duration" => $song_duration / 1000, 39 "lrc" => $lrc 40 ); 41 42 $this->set_cache($key, $result); 43 44 return $result; 45 } 46 47 return false; 48 } 49 50 public function netease_songs($song_list) 51 { 52 if( !$song_list ) return false; 53 54 $songs_array = explode(",", $song_list); 55 $songs_array = array_unique($songs_array); 56 57 if( !empty($songs_array) ){ 58 $result = array(); 59 foreach( $songs_array as $song_id ){ 60 $result['songs'][] = $this->netease_song($song_id); 61 } 62 return $result; 63 } 64 65 return false; 66 } 67 68 public function netease_album($album_id) 69 { 70 $key = "/netease/album/$album_id"; 71 72 $cache = $this->get_cache($key); 73 if( $cache ) return $cache; 74 75 $url = "http://music.163.com/api/album/" . $album_id; 76 $response = $this->netease_http($url); 77 78 if( $response["code"]==200 && $response["album"] ){ 79 //处理音乐信息 80 $result = $response["album"]["songs"]; 81 $count = count($result); 82 83 if( $count < 1 ) return false; 84 85 $album_name = $response["album"]["name"]; 86 $album_author = $response["album"]["artist"]["name"]; 87 $album_cover = $response["album"]["blurPicUrl"]; 88 $album = array( 89 "album_id" => $album_id, 90 "album_title" => $album_name, 91 "album_author" => $album_author, 92 "album_type" => "albums", 93 "album_cover" => $album_cover, 94 "album_count" => $count 95 ); 96 97 foreach($result as $k => $value){ 98 $mp3_url = str_replace("http://m", "http://p", $value["mp3Url"]); 99 $lrc = nm_get_setting("lyric") ? $this->get_song_lrc( $value["id"]) : ""; 100 $album["songs"][] = array( 101 "id" => $value["id"], 102 "title" => $value["name"], 103 "duration" => $value["duration"] / 1000, 104 "mp3" => $mp3_url, 105 "artist" => $album_author, 106 "lrc" => $lrc 107 ); 108 } 109 110 $this->set_cache($key, $album); 111 return $album; 112 } 113 114 return false; 115 } 116 117 118 119 public function netease_playlist($playlist_id) 120 { 121 $key = "/netease/playlist/$playlist_id"; 122 netease_music_update_play_count($playlist_id); 123 $cache = $this->get_cache($key); 124 if( $cache ) return $cache; 125 $url = "http://music.163.com/api/playlist/detail?id=" . $playlist_id; 126 $response = $this->netease_http($url); 127 128 if( $response["code"]==200 && $response["result"] ){ 129 //处理音乐信息 130 $result = $response["result"]["tracks"]; 131 $count = count($result); 132 133 if( $count < 1 ) return false; 134 135 $collect_name = $response["result"]["name"]; 136 $collect_author = $response["result"]["creator"]["nickname"]; 137 138 $collect = array( 139 "collect_id" => $playlist_id, 140 "collect_title" => $collect_name, 141 "collect_author" => $collect_author, 142 "collect_type" => "collects", 143 "collect_count" => $count, 144 "collect_cover" => $response["result"]["coverImgUrl"] 145 ); 146 147 foreach($result as $k => $value){ 148 $mp3_url = str_replace("http://m", "http://p", $value["mp3Url"]); 24 149 $artists = array(); 25 26 foreach ($response["songs"][0]["artists"] as $artist) { 150 foreach ($value["artists"] as $artist) { 27 151 $artists[] = $artist["name"]; 28 152 } 29 153 30 154 $artists = implode(",", $artists); 31 $lrc = nm_get_setting("lyric") ? $this->get_song_lrc( $music_id ) : ""; 32 $result = array( 33 "id" => $music_id, 34 "title" => $music_name, 155 $lrc = nm_get_setting("lyric") ? $this->get_song_lrc( $value["id"]) : ""; 156 $collect["songs"][] = array( 157 "id" => $value["id"], 158 "title" => $value["name"], 159 "duration" => $value["duration"] / 1000, 160 "mp3" => $mp3_url, 35 161 "artist" => $artists, 36 "mp3" => $mp3_url,37 "cover" => $mp3_cover,38 "duration" => $song_duration / 1000,39 162 "lrc" => $lrc 40 163 ); 41 42 $this->set_cache($key, $result); 43 44 return $result; 45 } 46 47 return false; 48 } 49 50 public function netease_songs($song_list) 51 { 52 if( !$song_list ) return false; 53 54 $songs_array = explode(",", $song_list); 55 $songs_array = array_unique($songs_array); 56 57 if( !empty($songs_array) ){ 58 $result = array(); 59 foreach( $songs_array as $song_id ){ 60 $result['songs'][] = $this->netease_song($song_id); 61 } 62 return $result; 63 } 64 65 return false; 66 } 67 68 public function netease_album($album_id) 69 { 70 $key = "/netease/album/$album_id"; 71 72 $cache = $this->get_cache($key); 73 if( $cache ) return $cache; 74 75 $url = "http://music.163.com/api/album/" . $album_id; 76 $response = $this->netease_http($url); 77 78 if( $response["code"]==200 && $response["album"] ){ 79 //处理音乐信息 80 $result = $response["album"]["songs"]; 81 $count = count($result); 82 83 if( $count < 1 ) return false; 84 85 $album_name = $response["album"]["name"]; 86 $album_author = $response["album"]["artist"]["name"]; 87 $album_cover = $response["album"]["blurPicUrl"]; 88 $album = array( 89 "album_id" => $album_id, 90 "album_title" => $album_name, 91 "album_author" => $album_author, 92 "album_type" => "albums", 93 "album_cover" => $album_cover, 94 "album_count" => $count 164 } 165 166 $this->set_cache($key, $collect); 167 168 return $collect; 169 } 170 171 return false; 172 } 173 174 public function netease_user($userid) 175 { 176 $key = "/netease/userinfo/$userid"; 177 178 $cache = $this->get_cache($key); 179 if( $cache ) return $cache; 180 $userplaylist = array(); 181 $url = "http://music.163.com/api/user/playlist/?offset=0&limit=1001&uid=" . $userid; 182 $response = $this->netease_http($url); 183 184 if( $response["code"]==200 && $response["playlist"] ){ 185 $playlists = $response["playlist"]; 186 foreach($playlists as $playlist){ 187 $userplaylist[] = array( 188 "playlist_id" => $playlist["id"], 189 "playlist_name" => $playlist["name"], 190 "playlist_coverImgUrl" => $playlist["coverImgUrl"] 95 191 ); 96 192 97 foreach($result as $k => $value){ 98 $mp3_url = str_replace("http://m", "http://p", $value["mp3Url"]); 99 $lrc = nm_get_setting("lyric") ? $this->get_song_lrc( $value["id"]) : ""; 100 $album["songs"][] = array( 101 "id" => $value["id"], 102 "title" => $value["name"], 103 "duration" => $value["duration"] / 1000, 104 "mp3" => $mp3_url, 105 "artist" => $album_author, 106 "lrc" => $lrc 107 ); 108 } 109 110 $this->set_cache($key, $album); 111 return $album; 112 } 113 114 return false; 115 } 116 117 118 119 public function netease_playlist($playlist_id) 120 { 121 $key = "/netease/playlist/$playlist_id"; 122 netease_music_update_play_count($playlist_id); 123 $cache = $this->get_cache($key); 124 if( $cache ) return $cache; 125 $url = "http://music.163.com/api/playlist/detail?id=" . $playlist_id; 126 $response = $this->netease_http($url); 127 128 if( $response["code"]==200 && $response["result"] ){ 129 //处理音乐信息 130 $result = $response["result"]["tracks"]; 131 $count = count($result); 132 133 if( $count < 1 ) return false; 134 135 $collect_name = $response["result"]["name"]; 136 $collect_author = $response["result"]["creator"]["nickname"]; 137 138 $collect = array( 139 "collect_id" => $playlist_id, 140 "collect_title" => $collect_name, 141 "collect_author" => $collect_author, 142 "collect_type" => "collects", 143 "collect_count" => $count, 144 "collect_cover" => $response["result"]["coverImgUrl"] 145 ); 146 147 foreach($result as $k => $value){ 148 $mp3_url = str_replace("http://m", "http://p", $value["mp3Url"]); 149 $artists = array(); 150 foreach ($value["artists"] as $artist) { 151 $artists[] = $artist["name"]; 152 } 153 154 $artists = implode(",", $artists); 155 $lrc = nm_get_setting("lyric") ? $this->get_song_lrc( $value["id"]) : ""; 156 $collect["songs"][] = array( 157 "id" => $value["id"], 158 "title" => $value["name"], 159 "duration" => $value["duration"] / 1000, 160 "mp3" => $mp3_url, 161 "artist" => $artists, 162 "lrc" => $lrc 163 ); 164 } 165 166 $this->set_cache($key, $collect); 167 168 return $collect; 169 } 170 171 return false; 172 } 173 174 public function netease_user($userid) 175 { 176 $key = "/netease/userinfo/$userid"; 177 178 $cache = $this->get_cache($key); 179 if( $cache ) return $cache; 180 $userplaylist = array(); 181 $url = "http://music.163.com/api/user/playlist/?offset=0&limit=1001&uid=" . $userid; 182 $response = $this->netease_http($url); 183 184 if( $response["code"]==200 && $response["playlist"] ){ 185 $playlists = $response["playlist"]; 186 foreach($playlists as $playlist){ 187 $userplaylist[] = array( 188 "playlist_id" => $playlist["id"], 189 "playlist_name" => $playlist["name"], 190 "playlist_coverImgUrl" => $playlist["coverImgUrl"] 191 ); 192 193 194 } 195 $this->set_cache($key, $userplaylist); 196 return $userplaylist; 197 } 198 199 } 200 201 public function netease_radio($id) 202 { 193 194 } 195 $this->set_cache($key, $userplaylist); 196 return $userplaylist; 197 } 198 199 } 200 201 public function netease_radio($id) 202 { 203 203 $key = "/netease/radios/$radio_id"; 204 204 … … 214 214 $mp3_url = str_replace("http://m", "http://p", $result['mainSong']['mp3Url']); 215 215 $results = array( 216 "id" => $result['mainSong']['id'],217 "title" => $result['mainSong']['name'],218 "artist" => '多人',219 "mp3" => $mp3_url,220 "cover" => $result['mainSong']['album']['picUrl'],221 "duration" => $result['mainSong']['duration'] / 1000,222 "lrc" => ""223 );216 "id" => $result['mainSong']['id'], 217 "title" => $result['mainSong']['name'], 218 "artist" => '多人', 219 "mp3" => $mp3_url, 220 "cover" => $result['mainSong']['album']['picUrl'], 221 "duration" => $result['mainSong']['duration'] / 1000, 222 "lrc" => "" 223 ); 224 224 225 225 … … 230 230 return false; 231 231 } 232 233 public function get_song_lrc($songid){ 234 $key = "/netease/lrc/$songid"; 235 236 $cache = $this->get_cache($key); 237 if( $cache ) return $cache; 238 239 $url = "http://music.163.com/api/song/media?id=" . $songid; 240 $response = $this->netease_http($url); 241 242 if( $response["code"]==200 && $response["lyric"] ){ 243 244 $content = $response["lyric"]; 245 $result = $this->parse_lrc($content); 246 $this->set_cache($key, $result); 247 return $result; 248 249 } 250 232 public function comments($id){ 233 $key = 'R_SO_4_' . $id; 234 $cache = $this->get_cache($key); 235 if( $cache ) return $cache; 236 $url = 'http://music.163.com/api/v1/resource/comments/'. $key .'/?rid='. $key .'&offset=0&total=false&limit=0'; 237 $host = parse_url($url); 238 $site = $host['scheme']."://".$host['host']; 239 $ch = curl_init($url); 240 curl_setopt($ch, CURLOPT_TIMEOUT, 30); 241 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 242 curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); 243 curl_setopt($ch, CURLOPT_REFERER, $site); 244 curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)'); 245 curl_setopt($ch, CURLOPT_HTTPHEADER , array('X-FORWARDED-FOR:1.2.4.8', 'X-FORWARDED-HOST:'.$host['host'], 'X-FORWARDED-SERVER:'.$host['host'])); 246 $response = curl_exec($ch); 247 curl_close($ch); 248 $response = json_decode($response,true); 249 if( $response["code"]==200 && $response["hotComments"] ){ 250 251 $content = $response["hotComments"]; 252 $this->set_cache($key, $content); 253 return $content; 254 255 } 256 257 return false; 258 259 } 260 261 public function get_song_lrc($songid){ 262 $key = "/netease/lrc/$songid"; 263 264 $cache = $this->get_cache($key); 265 if( $cache ) return $cache; 266 267 $url = "http://music.163.com/api/song/media?id=" . $songid; 268 $response = $this->netease_http($url); 269 270 if( $response["code"]==200 && $response["lyric"] ){ 271 272 $content = $response["lyric"]; 273 $result = $this->parse_lrc($content); 274 $this->set_cache($key, $result); 275 return $result; 276 277 } 278 279 return false; 280 281 } 282 283 private function parse_lrc($lrc_content){ 284 $now_lrc = array(); 285 $lrc_row = explode("\n", $lrc_content); 286 287 foreach ($lrc_row as $key => $value) { 288 $tmp = explode("]", $value); 289 290 foreach ($tmp as $key => $val) { 291 $tmp2 = substr($val, 1, 8); 292 $tmp2 = explode(":", $tmp2); 293 294 $lrc_sec = intval( $tmp2[0]*60 + $tmp2[1]*1 ); 295 296 if( is_numeric($lrc_sec) && $lrc_sec > 0){ 297 $count = count($tmp); 298 $lrc = trim($tmp[$count-1]); 299 300 if( $lrc != "" ){ 301 $now_lrc[$lrc_sec] = $lrc; 302 } 303 } 304 } 305 } 306 307 return $now_lrc; 308 } 309 310 private function netease_http($url) 311 { 312 $refer = "http://music.163.com/"; 313 $header[] = "Cookie: " . "appver=1.5.0.75771;"; 314 $ch = curl_init(); 315 curl_setopt($ch, CURLOPT_URL, $url); 316 curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 317 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 318 curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); 319 curl_setopt($ch, CURLOPT_REFERER, $refer); 320 $cexecute = curl_exec($ch); 321 curl_close($ch); 322 323 if ($cexecute) { 324 $result = json_decode($cexecute, true); 325 return $result; 326 }else{ 251 327 return false; 252 253 } 254 255 private function parse_lrc($lrc_content){ 256 $now_lrc = array(); 257 $lrc_row = explode("\n", $lrc_content); 258 259 foreach ($lrc_row as $key => $value) { 260 $tmp = explode("]", $value); 261 262 foreach ($tmp as $key => $val) { 263 $tmp2 = substr($val, 1, 8); 264 $tmp2 = explode(":", $tmp2); 265 266 $lrc_sec = intval( $tmp2[0]*60 + $tmp2[1]*1 ); 267 268 if( is_numeric($lrc_sec) && $lrc_sec > 0){ 269 $count = count($tmp); 270 $lrc = trim($tmp[$count-1]); 271 272 if( $lrc != "" ){ 273 $now_lrc[$lrc_sec] = $lrc; 274 } 275 } 276 } 277 } 278 279 return $now_lrc; 280 } 281 282 private function netease_http($url) 283 { 284 $refer = "http://music.163.com/"; 285 $header[] = "Cookie: " . "appver=1.5.0.75771;"; 286 $ch = curl_init(); 287 curl_setopt($ch, CURLOPT_URL, $url); 288 curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 289 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 290 curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); 291 curl_setopt($ch, CURLOPT_REFERER, $refer); 292 $cexecute = curl_exec($ch); 293 curl_close($ch); 294 295 if ($cexecute) { 296 $result = json_decode($cexecute, true); 297 return $result; 298 }else{ 299 return false; 300 } 301 } 302 303 304 public function get_cache($key){ 305 if ( nm_get_setting("objcache") ){ 306 $cache = wp_cache_get($key,'neteasemusic'); 307 } else { 308 $cache = get_transient($key); 309 } 310 311 return $cache === false ? false : json_decode($cache,true); 312 } 313 314 public function set_cache($key, $value){ 315 $value = json_encode($value); 316 $cache_time = nm_get_setting("cachetime") ? nm_get_setting("cachetime") : ( 60 * 60 * 24 * 7); 317 if ( nm_get_setting("objcache") ){ 318 wp_cache_set($key, $value, 'neteasemusic', $cache_time); 319 } else { 320 set_transient($key, $value, $cache_time); 321 } 322 } 323 324 public function clear_cache($key){ 325 if ( nm_get_setting("objcache") ){ 326 wp_cache_delete($key,'neteasemusic'); 327 } else { 328 delete_transient($key); 329 } 330 331 } 332 } 328 } 329 } 330 331 332 public function get_cache($key){ 333 if ( nm_get_setting("objcache") ){ 334 $cache = wp_cache_get($key,'neteasemusic'); 335 } else { 336 $cache = get_transient($key); 337 } 338 339 return $cache === false ? false : json_decode($cache,true); 340 } 341 342 public function set_cache($key, $value){ 343 $value = json_encode($value); 344 $cache_time = nm_get_setting("cachetime") ? nm_get_setting("cachetime") : ( 60 * 60 * 24 * 7); 345 if ( nm_get_setting("objcache") ){ 346 wp_cache_set($key, $value, 'neteasemusic', $cache_time); 347 } else { 348 set_transient($key, $value, $cache_time); 349 } 350 } 351 352 public function clear_cache($key){ 353 if ( nm_get_setting("objcache") ){ 354 wp_cache_delete($key,'neteasemusic'); 355 } else { 356 delete_transient($key); 357 } 358 359 } 360 } -
netease-music/trunk/neteasemusic.php
r1349477 r1352348 4 4 Plugin URI: https://fatesinger.com/74369 5 5 Description: 网易云音乐歌单插件 6 Version: 2.0. 16 Version: 2.0.2 7 7 Author: Bigfa 8 8 Author URI: https://fatesinger.com 9 9 */ 10 10 11 define('NM_VERSION', '2.0. 1');11 define('NM_VERSION', '2.0.2'); 12 12 define('NM_URL', plugins_url('', __FILE__)); 13 13 define('NM_PATH', dirname( __FILE__ )); -
netease-music/trunk/readme.txt
r1349477 r1352348 33 33 34 34 == Changelog == 35 = 2.0.2 = 36 * 错误修复 37 * 增加了歌曲热门评论 35 38 36 39 = 2.0.1 = -
netease-music/trunk/static/css/page.less
r1349724 r1352348 145 145 } 146 146 &-control { 147 float:right; 148 font-size: 20px; 147 149 span { 148 150 display:inline-block; … … 157 159 &-info { 158 160 float:left; 159 }160 &-control {161 float:right;162 161 } 163 162 &-title,&-time { … … 245 244 } 246 245 } 246 &-item.current.pause { 247 &:before{ 248 content:"\e90a"; 249 } 250 } 247 251 &-item.current, &-item:hover { 248 252 color:#ee4d50; … … 257 261 width:33.3%; 258 262 } 263 } 264 265 .fucker { 266 border:20px solid; 267 border-color:rgba(0,0,0,0) rgba(0,0,0,0) #f0f0f0 rgba(0,0,0,0); 268 width:20px; 259 269 } 260 270 -
netease-music/trunk/static/css/page.min.css
r1349724 r1352348 1 @font-face{font-family:fx;src:url(icomoon.eot);src:url(icomoon.eot?#iefix) format('embedded-opentype'),url(icomoon.woff) format('woff'),url(icomoon.ttf) format('truetype'),url(icomoon.svg#fx) format('svg')}.fxfont{font-family:fx!important;font-style:normal;-webkit-font-smoothing:antialiased;-webkit-text-stroke-width:.2px;-moz-osx-font-smoothing:grayscale}.nm-playselected:before{content:"\e604"}.nm-next:before{content:"\e90c"}.nm-play:before,.paused .nm-pause:before{content:"\e909"}.nm-pause:before{content:"\e90a"}.nm-note:before{content:"\e901"}.nm-previous:before{content:"\e902"}.nm-wrapper{line-height:1.8}.nm-container{max-width:1000px;margin:0 auto}.nm-album-list{letter-spacing:-.8em}.nm-album-list .nm-list-item{display:inline-block;box-sizing:border-box;width:25%;padding:10px;letter-spacing:0;cursor:pointer}.nm-album-list .nm-list-item .music-info{color:#333;display:block;font-size:12px;line-height:1.5;overflow:hidden;padding:3px 0;text-align:center;text-overflow:ellipsis;white-space:nowrap}.nm-album-list .nm-list-item.is-active .music-info{background-color:#ee4d50;color:#fff}.nm-album-list .nm-list-item .nm-list-content{border:1px solid rgba(0,0,0,.05);border-radius:3px;overflow:hidden}.nm-album-list .nm-list-item .nm-list-content img{max-width:100%;height:auto;display:block}.nm-songs{background-color:#f0f0f0;padding:20px 0}.nm-songs-title{padding-bottom:5px;border-bottom:1px solid #ddd;max-width:1000px;margin:0 auto 15px}.nm-songs-list{position:relative}.album--nice-list,.nm-songs-list{max-width:1000px;margin:0 auto}.nmplaybar{position:fixed;bottom:0;left:0;right:0;-webkit-transform:translateY(100%);transform:translateY(100%);background-color:hsla(0,0%,100%,.95);color:rgba(0,0,0,.6);z-index:1;-webkit-transition:.5s;transition:.5s;box-shadow:0 0 0 1px rgba(0,0,0,.1)}.nmplaybar.appear{-webkit-transform:translateY(0);transform:translateY(0)}.nmplayer-wrap{overflow:hidden}.nmplayer-prosess{cursor:pointer}.nmplayer-cover{float:left;background-color:#eee;background-size:cover;height:48px;width:48px;margin:5px 5px 0 0;box-shadow:0 0 0 1px rgba(0,0,0,.05)}.nmplayer-control,.nmplayer-info{font-size:13px;height:60px;line-height:60px}.nmplayer-control span{display:inline-block;padding-left:20px;text-decoration:none;cursor:pointer}.nmplayer-control span:hover{color:rgba(0,0,0,.8)}.nmplayer-info{float:left}.nmplayer-control{float:right}.nmplayer-time,.nmplayer-title{margin-right:5px}.jp-play-bar{background:#ee4d50;height:3px}.nm-copyright{max-width:1000px;text-align:right;font-size:12px;margin:0 auto;padding:5px 10px}.nm-copyright i,.nm-loadmore{font-size:14px}.nm-loadmore{display:inline-block;border:2px solid #ee4d50;padding:3px 13px;border-radius:3px;color:#ee4d50}.nm-loadmore:hover{color:#fff;background-color:#ee4d50}.nm-page-header{margin-top:30px;margin-bottom:30px;text-align:center}.nm-page-title{font-size:24px}.nm-songlist{overflow:hidden;counter-reset:a;margin:0;padding:0}.nm-songlist-item{position:relative;font-size:12px;border-radius:3px;padding:2px 20px!important;vertical-align:top;overflow:hidden;list-style:none!important;margin:0!important;box-sizing:border-box;-webkit-box-sizing:border-box;cursor:pointer;float:left;width:50%;-webkit-transition:all .5s;transition:all .5s}.nm-songlist-item:before{content:counter(a,decimal) ". ";counter-increment:a;position:absolute;left:0}.nm-songlist-item .song-time{position:absolute;right:20px;top:2px}.nm-songlist-item .song-info{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;padding-right:30px}.nm-songlist-item.current,.nm-songlist-item:hover{color:#ee4d50}.nm-songlist-item.current:before{content:"\e909";font-family:fx}.nm-songlist.threerow .nm-songlist-item{width:33.3%}@media (max-width:600px){.nm-songlist-item{float:none;width:auto}.nm-songlist.threerow .nm-songlist-item{width:auto}.nm-container{width:90%}.nm-album-list .nm-list-item{padding:3px}.nmplayer-info{display:none}}.music-page-navi{text-align:center;padding:20px 0}1 @font-face{font-family:fx;src:url(icomoon.eot);src:url(icomoon.eot?#iefix) format('embedded-opentype'),url(icomoon.woff) format('woff'),url(icomoon.ttf) format('truetype'),url(icomoon.svg#fx) format('svg')}.fxfont{font-family:fx!important;font-style:normal;-webkit-font-smoothing:antialiased;-webkit-text-stroke-width:.2px;-moz-osx-font-smoothing:grayscale}.nm-playselected:before{content:"\e604"}.nm-next:before{content:"\e90c"}.nm-play:before,.paused .nm-pause:before{content:"\e909"}.nm-pause:before{content:"\e90a"}.nm-note:before{content:"\e901"}.nm-previous:before{content:"\e902"}.nm-wrapper{line-height:1.8}.nm-container{max-width:1000px;margin:0 auto}.nm-album-list{letter-spacing:-.8em}.nm-album-list .nm-list-item{display:inline-block;box-sizing:border-box;width:25%;padding:10px;letter-spacing:0;cursor:pointer}.nm-album-list .nm-list-item .music-info{color:#333;display:block;font-size:12px;line-height:1.5;overflow:hidden;padding:3px 0;text-align:center;text-overflow:ellipsis;white-space:nowrap}.nm-album-list .nm-list-item.is-active .music-info{background-color:#ee4d50;color:#fff}.nm-album-list .nm-list-item .nm-list-content{border:1px solid rgba(0,0,0,.05);border-radius:3px;overflow:hidden}.nm-album-list .nm-list-item .nm-list-content img{max-width:100%;height:auto;display:block}.nm-songs{background-color:#f0f0f0;padding:20px 0}.nm-songs-title{padding-bottom:5px;border-bottom:1px solid #ddd;max-width:1000px;margin:0 auto 15px}.nm-songs-list{position:relative}.album--nice-list,.nm-songs-list{max-width:1000px;margin:0 auto}.nmplaybar{position:fixed;bottom:0;left:0;right:0;-webkit-transform:translateY(100%);transform:translateY(100%);background-color:hsla(0,0%,100%,.95);color:rgba(0,0,0,.6);z-index:1;-webkit-transition:.5s;transition:.5s;box-shadow:0 0 0 1px rgba(0,0,0,.1)}.nmplaybar.appear{-webkit-transform:translateY(0);transform:translateY(0)}.nmplayer-wrap{overflow:hidden}.nmplayer-prosess{cursor:pointer}.nmplayer-cover{float:left;background-color:#eee;background-size:cover;height:48px;width:48px;margin:5px 5px 0 0;box-shadow:0 0 0 1px rgba(0,0,0,.05)}.nmplayer-control,.nmplayer-info{font-size:13px;height:60px;line-height:60px}.nmplayer-control{float:right;font-size:20px}.nmplayer-control span{display:inline-block;padding-left:20px;text-decoration:none;cursor:pointer}.nmplayer-control span:hover{color:rgba(0,0,0,.8)}.nmplayer-info{float:left}.nmplayer-time,.nmplayer-title{margin-right:5px}.jp-play-bar{background:#ee4d50;height:3px}.nm-copyright{max-width:1000px;text-align:right;font-size:12px;margin:0 auto;padding:5px 10px}.nm-copyright i,.nm-loadmore{font-size:14px}.nm-loadmore{display:inline-block;border:2px solid #ee4d50;padding:3px 13px;border-radius:3px;color:#ee4d50}.nm-loadmore:hover{color:#fff;background-color:#ee4d50}.nm-page-header{margin-top:30px;margin-bottom:30px;text-align:center}.nm-page-title{font-size:24px}.nm-songlist{overflow:hidden;counter-reset:a;margin:0;padding:0}.nm-songlist-item{position:relative;font-size:12px;border-radius:3px;padding:2px 20px!important;vertical-align:top;overflow:hidden;list-style:none!important;margin:0!important;box-sizing:border-box;-webkit-box-sizing:border-box;cursor:pointer;float:left;width:50%;-webkit-transition:all .5s;transition:all .5s}.nm-songlist-item:before{content:counter(a,decimal) ". ";counter-increment:a;position:absolute;left:0}.nm-songlist-item .song-time{position:absolute;right:20px;top:2px}.nm-songlist-item .song-info{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;padding-right:30px}.nm-songlist-item.current.pause:before{content:"\e90a"}.nm-songlist-item.current,.nm-songlist-item:hover{color:#ee4d50}.nm-songlist-item.current:before{content:"\e909";font-family:fx}.nm-songlist.threerow .nm-songlist-item{width:33.3%}.fucker{border:20px solid;border-color:transparent transparent #f0f0f0;width:20px}@media (max-width:600px){.nm-songlist-item{float:none;width:auto}.nm-songlist.threerow .nm-songlist-item{width:auto}.nm-container{width:90%}.nm-album-list .nm-list-item{padding:3px}.nmplayer-info{display:none}}.music-page-navi{text-align:center;padding:20px 0} -
netease-music/trunk/static/css/single.less
r1347195 r1352348 154 154 } 155 155 } 156 157 .nmhotcom { 158 padding-bottom: 15px; 159 border: solid 1px rgba(0,0,0,0.05); 160 font-size: 13px; 161 color:rgba(0,0,0,.44); 162 position:relative; 163 .com-close { 164 position:absolute; 165 right:15px; 166 top:5px; 167 cursor:pointer; 168 &:hover { 169 color:@colorPrimary; 170 } 171 } 172 .nmhc-title{ 173 background-color: #fafafa; 174 text-align: center; 175 margin-bottom: 15px; 176 line-height: 40px; 177 } 178 img { 179 vertical-align: middle; 180 border-radius: 100%; 181 margin-right: 5px; 182 } 183 .nmh-item{ 184 padding:3px 15px; 185 &:hover{ 186 background-color: #fafafa; 187 } 188 } 189 .nmu-name { 190 color:@colorPrimary; 191 } 192 } -
netease-music/trunk/static/css/single.min.css
r1347195 r1352348 1 @font-face{font-family:fx;src:url(icomoon.eot);src:url(icomoon.eot?#iefix) format('embedded-opentype'),url(icomoon.woff) format('woff'),url(icomoon.ttf) format('truetype'),url(icomoon.svg#fx) format('svg')}.fxfont{font-family:fx!important;font-style:normal;-webkit-font-smoothing:antialiased;-webkit-text-stroke-width:.2px;-moz-osx-font-smoothing:grayscale}.nm-heart:before{content:"\e904"}.nm-mute:before{content:"\e90d"}.muted.nm-mute:before{content:"\e90e"}.nm-unmute:before{content:"\e90d"}.nm-playselected:before{content:"\e604"}.nm-next:before{content:"\e90c"}.nm-pause:before{content:"\e906"}.nm-play:before,.paused .nm-pause:before{content:"\e905"}.nm-note:before{content:"\e606"}.nm-previous:before{content:"\e902"}.nmsingle-container{border:1px solid rgba(0,0,0,.05);border-radius:3px;overflow:hidden;line-height:26px}.nmsingle-cover{height:74px;width:74px;float:left;background-position:center;background-size:cover;text-align:center;line-height:70px;font-size:36px;color:#fff;cursor:pointer}.nmsingle-cover:hover{color:#c00}.nmsingle-info{padding:5px 15px;margin-left:74px}.nmsingle-process{background-color:#ddd;cursor:pointer;position:relative;overflow:hidden}.nmsingle-process-bar{background-color:#c00;position:relative;height:3px;-webkit-transition:.5s;transition:.5s;-webkit-transform:translateX(-100%);transform:translateX(-100%)}.nmsingle-playtime{color:rgba(0,0,0,.56);float:right}.nmsingle-lrc{font-size:12px;color:rgba(0,0,0,.44);text-overflow:ellipsis;white-space:nowrap}.nmplayer-mid,.nmsingle-lrc{overflow:hidden}.nmplayer-control{float:right;color:rgba(0,0,0,.44)}.nmplayer-control span{margin-left:2px;cursor:pointer}.nmplayer-control span:hover{color:#c00}.nmplayer-control .nm-mute{border-left:1px solid rgba(0,0,0,.3);padding-left:5px}.nms-list{counter-reset:a;font-size:14px;border:1px solid rgba(0,0,0,.05);border-top:0;border-radius:0 0 3px 3px}.nms-list-item{padding:5px 15px;color:rgba(0,0,0,.44);cursor:pointer;line-height:1.4}.nms-list-item:before{content:counter(a,decimal) ". ";counter-increment:a}.nms-list-item.is-active{color:#c00}.nms-list-item:nth-child(odd){background-color:#f0f0f0}.nms-list-item .song-time{float:right} 1 @font-face{font-family:fx;src:url(icomoon.eot);src:url(icomoon.eot?#iefix) format('embedded-opentype'),url(icomoon.woff) format('woff'),url(icomoon.ttf) format('truetype'),url(icomoon.svg#fx) format('svg')}.fxfont{font-family:fx!important;font-style:normal;-webkit-font-smoothing:antialiased;-webkit-text-stroke-width:.2px;-moz-osx-font-smoothing:grayscale}.nm-heart:before{content:"\e904"}.nm-mute:before{content:"\e90d"}.muted.nm-mute:before{content:"\e90e"}.nm-unmute:before{content:"\e90d"}.nm-playselected:before{content:"\e604"}.nm-next:before{content:"\e90c"}.nm-pause:before{content:"\e906"}.nm-play:before,.paused .nm-pause:before{content:"\e905"}.nm-note:before{content:"\e606"}.nm-previous:before{content:"\e902"}.nmsingle-container{border:1px solid rgba(0,0,0,.05);border-radius:3px;overflow:hidden;line-height:26px}.nmsingle-cover{height:74px;width:74px;float:left;background-position:center;background-size:cover;text-align:center;line-height:70px;font-size:36px;color:#fff;cursor:pointer}.nmsingle-cover:hover{color:#c00}.nmsingle-info{padding:5px 15px;margin-left:74px}.nmsingle-process{background-color:#ddd;cursor:pointer;position:relative;overflow:hidden}.nmsingle-process-bar{background-color:#c00;position:relative;height:3px;-webkit-transition:.5s;transition:.5s;-webkit-transform:translateX(-100%);transform:translateX(-100%)}.nmsingle-playtime{color:rgba(0,0,0,.56);float:right}.nmsingle-lrc{font-size:12px;color:rgba(0,0,0,.44);text-overflow:ellipsis;white-space:nowrap}.nmplayer-mid,.nmsingle-lrc{overflow:hidden}.nmplayer-control{float:right;color:rgba(0,0,0,.44)}.nmplayer-control span{margin-left:2px;cursor:pointer}.nmplayer-control span:hover{color:#c00}.nmplayer-control .nm-mute{border-left:1px solid rgba(0,0,0,.3);padding-left:5px}.nms-list{counter-reset:a;font-size:14px;border:1px solid rgba(0,0,0,.05);border-top:0;border-radius:0 0 3px 3px}.nms-list-item{padding:5px 15px;color:rgba(0,0,0,.44);cursor:pointer;line-height:1.4}.nms-list-item:before{content:counter(a,decimal) ". ";counter-increment:a}.nms-list-item.is-active{color:#c00}.nms-list-item:nth-child(odd){background-color:#f0f0f0}.nms-list-item .song-time{float:right}.nmhotcom{padding-bottom:15px;border:1px solid rgba(0,0,0,.05);font-size:13px;color:rgba(0,0,0,.44);position:relative}.nmhotcom .com-close{position:absolute;right:15px;top:5px;cursor:pointer}.nmhotcom .com-close:hover{color:#c00}.nmhotcom .nmhc-title{background-color:#fafafa;text-align:center;margin-bottom:15px;line-height:40px}.nmhotcom img{vertical-align:middle;border-radius:100%;margin-right:5px}.nmhotcom .nmh-item{padding:3px 15px}.nmhotcom .nmh-item:hover{background-color:#fafafa}.nmhotcom .nmu-name{color:#c00} -
netease-music/trunk/static/js/page.js
r1349724 r1352348 58 58 var is3 = nm_ajax_url.tworow ? ' threerow' : ''; 59 59 $('.nmplaybar').addClass('appear'); 60 var nmPlayListSongslist = '<div class="nm-songs"><div class="nm-songs-title nm-container">' + info + '</div><div class="nm-songs-list nm-container"><ul class="nm-songlist' + is3 + '"></ul></div></div>'; 60 var nmPlayListSongslist = '<div class="fucker"></div><div class="nm-songs"><div class="nm-songs-title nm-container">' + info + '</div><div class="nm-songs-list nm-container"><ul class="nm-songlist' + is3 + '"></ul></div></div>'; 61 var left = _self.offset().left + _self.width() / 2 - 10; 62 61 63 nmPlayListContainer.remove(); 64 $('.fucker').remove(); 62 65 _self.parent().after(nmPlayListSongslist); 66 $('.fucker').css('margin-left',left + 'px'); 63 67 __PUSSY.current = blackdick; 64 68 $('.nmplayer-cover').css('background-image','url(' + cover + ')'); … … 91 95 var song = playlist[__PUSSY.current][__PUSSY.bomb]; 92 96 $('.nm-songlist-item').removeClass('current'); 93 $('.nm-songlist-item').data('status','ready') ;97 $('.nm-songlist-item').data('status','ready').removeClass('pause'); 94 98 $('.nm-songlist-item').eq(__PUSSY.bomb).data('status','play'); 95 99 $('.nm-songlist-item').eq(__PUSSY.bomb).addClass('current'); … … 100 104 $(self.player).bind($.jPlayer.event.pause, function() { 101 105 var song = playlist[__PUSSY.current][__PUSSY.bomb]; 102 $('.nm-songlist-item').eq(__PUSSY.bomb).data('status','pause') ;106 $('.nm-songlist-item').eq(__PUSSY.bomb).data('status','pause').addClass('pause'); 103 107 $('.nms-play-btn').removeClass('nm-pause').addClass('nm-play'); 104 108 }); -
netease-music/trunk/static/js/page.min.js
r1349724 r1352348 1 +function(t){"use strict";var e={queue:[],current:null,bomb:0,debug:!1},s=[],i=function(t){e.debug&&console.log(t)},a=function(t){if(!isFinite(t)||0>t)t="--:--";else{var e=Math.floor(t/60);t=Math.floor(t)%60,t=(10>e?"0"+e:e)+":"+(10>t?"0"+t:t)}return t},n=function(e){var s="";t.each(e,function(t,e){s+='<li class="nm-songlist-item"><span class="song-info">'+e.title+" - "+e.artist+'</span><span class="song-time">'+a(e.duration)+"</span></li>"}),t(".nm-songlist").html(s)},o=function(){var a=this;this.options={selector:"#nm_jplayer"},this.player=this.options.selector,a.init(),t(document).on("click",".nm-list-item",function(){var o=t(this);if(!o.hasClass("is-active")){t(".nm-list-item").removeClass("is-active"),o.addClass("is-active");var r=o.children(".nm-list-content").find(".music-info").text(),l=o.children(".nm-list-content").find(".music-cover").attr("src"),h=o.data("id"),u="dick"+h,c=t(".nm-songs"),d=nm_ajax_url.tworow?" threerow":"";t(".nmplaybar").addClass("appear");var m='<div class=" nm-songs"><div class="nm-songs-title nm-container">'+r+'</div><div class="nm-songs-list nm-container"><ul class="nm-songlist'+d+'"></ul></div></div>';c.remove(),o.parent().after(m),e.current=u,t(".nmplayer-cover").css("background-image","url("+l+")"),s[u]?(n(s[u]),a.play(u,0)):t.ajax({type:"post",dataType:"json",url:nm_ajax_url.ajax_url,data:{action:"nmjson",id:h},success:function(t){if(200==t.msg){t=t.song;var e=t.songs;n(e),s["dick"+h]=e,a.play(u,0)}}}),i(e.current)}}),t(a.player).bind(t.jPlayer.event.play,function(){var i=s[e.current][e.bomb];t(".nm-songlist-item").removeClass("current"),t(".nm-songlist-item").data("status","ready"),t(".nm-songlist-item").eq(e.bomb).data("status","play"),t(".nm-songlist-item").eq(e.bomb).addClass("current"),t(".nmplayer-title").html(i.title+" - "+i.artist),t(".nms-play-btn").removeClass("nm-play").addClass("nm-pause")}),t(a.player).bind(t.jPlayer.event.pause,function(){s[e.current][e.bomb];t(".nm-songlist-item").eq(e.bomb).data("status","pause"),t(".nms-play-btn").removeClass("nm-pause").addClass("nm-play")}),t(a.player).bind(t.jPlayer.event.ended,function(){e.bomb<s[e.current].length?(e.bomb=e.bomb+1,a.play(e.current,e.bomb),t(a.player).jPlayer("play")):e.bomb=0}),t(document).on("click",".nm-songlist-item",function(){var s=t(this),n=s.index();"play"==s.data("status")?a.pause():"pause"==s.data("status")?a.play():(a.play(e.current,n),i("play "+n))}),t(".jp-progress").on("click",function(i){i.preventDefault();var n=t(this),o=n.offset().left,r=(i.pageX-o)/n.width(),l=s[e.current][e.bomb].duration;t(a.player).jPlayer("play",l*r)}),t(document).on("click",".nms-play-btn",function(){var e=t(this);e.hasClass("nm-play")?(i("player continue."),a.play()):(i("player pause."),a.pause())}),t(document).on("click",".nm-loadmore",function(){var e=t(this),s=e.data();e.hasClass("is-active")||(e.addClass("is-active"),t.ajax({url:nm_ajax_url.ajax_url,type:"POST",dataType:"json",data:s,success:function(s){return 200!=s.status?i("error"):(t(".nm-wrapper").append(s.data),s.nav?e.data("id",s.nav):e.remove(),void e.removeClass("is-active"))}}))}),t(document).on("click",".nm-previous",function(){t(this);i("previous"),a.previous()}),t(document).on("click",".nm-next",function(){t(this);i("next"),a.next()})};o.prototype={init:function(){t(this.player).jPlayer({timeupdate:function(i){var n,n=i.jPlayer.status.currentTime,n=a(n),o=s[e.current][e.bomb].lrc,r=parseInt(i.jPlayer.status.currentTime);void 0!=o[r]&&t(".nmplayer-lrc").html(o[r]),t(".nmplayer-time").text(n),t(".nmplayer-prosess").css("transform","translateX("+(i.jPlayer.status.currentPercentAbsolute-100)+"%)")},supplied:"mp3",swfPath:nm_ajax_url.swfurl,solution:"html,flash",volume:1})},getJSON:function(e){t.ajax({type:"post",dataType:"json",url:nm_ajax_url.ajax_url,data:{action:"nmjson",id:e},success:function(t){if(200==t.msg){t=t.song;var i=t.songs;return s["dick"+e]=i,i}}})},play:function(e,s){"undefined"!=typeof e&&"undefined"!=typeof s&&this.select(e,s),t(this.player).jPlayer("play")},select:function(i,a){e.current=i,e.bomb=a,t(this.player).jPlayer("setMedia",s[e.current][e.bomb])},pause:function(){t(this.player).jPlayer("pause")},next:function(){var t=s[e.current].length;e.bomb!=t-1&&this.play(e.current,e.bomb+1)},previous:function(){e.bomb<1||(i(e.bomb),this.play(e.current,e.bomb-1))}};new o}(jQuery);1 +function(t){"use strict";var e={queue:[],current:null,bomb:0,debug:!1},s=[],i=function(t){e.debug&&console.log(t)},a=function(t){if(!isFinite(t)||0>t)t="--:--";else{var e=Math.floor(t/60);t=Math.floor(t)%60,t=(10>e?"0"+e:e)+":"+(10>t?"0"+t:t)}return t},n=function(e){var s="";t.each(e,function(t,e){s+='<li class="nm-songlist-item"><span class="song-info">'+e.title+" - "+e.artist+'</span><span class="song-time">'+a(e.duration)+"</span></li>"}),t(".nm-songlist").html(s)},o=function(){var a=this;this.options={selector:"#nm_jplayer"},this.player=this.options.selector,a.init(),t(document).on("click",".nm-list-item",function(){var o=t(this);if(!o.hasClass("is-active")){t(".nm-list-item").removeClass("is-active"),o.addClass("is-active");var r=o.children(".nm-list-content").find(".music-info").text(),l=o.children(".nm-list-content").find(".music-cover").attr("src"),h=o.data("id"),u="dick"+h,c=t(".nm-songs"),d=nm_ajax_url.tworow?" threerow":"";t(".nmplaybar").addClass("appear");var m='<div class="fucker"></div><div class="nm-songs"><div class="nm-songs-title nm-container">'+r+'</div><div class="nm-songs-list nm-container"><ul class="nm-songlist'+d+'"></ul></div></div>',p=o.offset().left+o.width()/2-10;c.remove(),t(".fucker").remove(),o.parent().after(m),t(".fucker").css("margin-left",p+"px"),e.current=u,t(".nmplayer-cover").css("background-image","url("+l+")"),s[u]?(n(s[u]),a.play(u,0)):t.ajax({type:"post",dataType:"json",url:nm_ajax_url.ajax_url,data:{action:"nmjson",id:h},success:function(t){if(200==t.msg){t=t.song;var e=t.songs;n(e),s["dick"+h]=e,a.play(u,0)}}}),i(e.current)}}),t(a.player).bind(t.jPlayer.event.play,function(){var i=s[e.current][e.bomb];t(".nm-songlist-item").removeClass("current"),t(".nm-songlist-item").data("status","ready").removeClass("pause"),t(".nm-songlist-item").eq(e.bomb).data("status","play"),t(".nm-songlist-item").eq(e.bomb).addClass("current"),t(".nmplayer-title").html(i.title+" - "+i.artist),t(".nms-play-btn").removeClass("nm-play").addClass("nm-pause")}),t(a.player).bind(t.jPlayer.event.pause,function(){s[e.current][e.bomb];t(".nm-songlist-item").eq(e.bomb).data("status","pause").addClass("pause"),t(".nms-play-btn").removeClass("nm-pause").addClass("nm-play")}),t(a.player).bind(t.jPlayer.event.ended,function(){e.bomb<s[e.current].length?(e.bomb=e.bomb+1,a.play(e.current,e.bomb),t(a.player).jPlayer("play")):e.bomb=0}),t(document).on("click",".nm-songlist-item",function(){var s=t(this),n=s.index();"play"==s.data("status")?a.pause():"pause"==s.data("status")?a.play():(a.play(e.current,n),i("play "+n))}),t(".jp-progress").on("click",function(i){i.preventDefault();var n=t(this),o=n.offset().left,r=(i.pageX-o)/n.width(),l=s[e.current][e.bomb].duration;t(a.player).jPlayer("play",l*r)}),t(document).on("click",".nms-play-btn",function(){var e=t(this);e.hasClass("nm-play")?(i("player continue."),a.play()):(i("player pause."),a.pause())}),t(document).on("click",".nm-loadmore",function(){var e=t(this),s=e.data();e.hasClass("is-active")||(e.addClass("is-active"),t.ajax({url:nm_ajax_url.ajax_url,type:"POST",dataType:"json",data:s,success:function(s){return 200!=s.status?i("error"):(t(".nm-wrapper").append(s.data),s.nav?e.data("id",s.nav):e.remove(),void e.removeClass("is-active"))}}))}),t(document).on("click",".nm-previous",function(){t(this);i("previous"),a.previous()}),t(document).on("click",".nm-next",function(){t(this);i("next"),a.next()})};o.prototype={init:function(){t(this.player).jPlayer({timeupdate:function(i){var n,n=i.jPlayer.status.currentTime,n=a(n),o=s[e.current][e.bomb].lrc,r=parseInt(i.jPlayer.status.currentTime);void 0!=o[r]&&t(".nmplayer-lrc").html(o[r]),t(".nmplayer-time").text(n),t(".nmplayer-prosess").css("transform","translateX("+(i.jPlayer.status.currentPercentAbsolute-100)+"%)")},supplied:"mp3",swfPath:nm_ajax_url.swfurl,solution:"html,flash",volume:1})},getJSON:function(e){t.ajax({type:"post",dataType:"json",url:nm_ajax_url.ajax_url,data:{action:"nmjson",id:e},success:function(t){if(200==t.msg){t=t.song;var i=t.songs;return s["dick"+e]=i,i}}})},play:function(e,s){"undefined"!=typeof e&&"undefined"!=typeof s&&this.select(e,s),t(this.player).jPlayer("play")},select:function(i,a){e.current=i,e.bomb=a,t(this.player).jPlayer("setMedia",s[e.current][e.bomb])},pause:function(){t(this.player).jPlayer("pause")},next:function(){var t=s[e.current].length;e.bomb!=t-1&&this.play(e.current,e.bomb+1)},previous:function(){e.bomb<1||(i(e.bomb),this.play(e.current,e.bomb-1))}};new o}(jQuery); -
netease-music/trunk/static/js/single.js
r1349477 r1352348 54 54 $('#nm-player-' + __NM.current + ' .nms-play-btn').removeClass('nm-pause').addClass('nm-play'); 55 55 $('#nm-list-' + __NM.current + ' .nms-list-item').eq(__NM.bomb).data('status','pause'); 56 log(__NM.bomb); 57 log('sb'); 56 58 }); 57 59 58 60 $(self.player).bind($.jPlayer.event.ended, function() { 59 if (__NM.bomb < playlist[__NM.current].length ) {61 if (__NM.bomb < playlist[__NM.current].length - 1 ) { 60 62 __NM.bomb = __NM.bomb + 1; 61 63 self.play(__NM.current,__NM.bomb); 62 64 $(self.player).jPlayer('play'); 65 log('continue'); 63 66 } else { 64 67 __NM.bomb = 0; 68 log('end success') 65 69 } 66 70 }); 71 72 $(document).on(_event,'.com-close',function(){ 73 var _self = $(this); 74 _self.parent().remove(); 75 }) 67 76 68 77 $(document).on(_event,'.nm-mute',function(){ -
netease-music/trunk/static/js/single.min.js
r1349477 r1352348 1 +function(t){"use strict";var e="ontouchstart"in document?"touchstart":"click",s={queue:[],current:null,bomb:0,debug:!1},i=function(t){s.debug&&console.log(t)},a=function(t){if(!isFinite(t)||0>t)t="--:--";else{var e=Math.floor(t/60);t=Math.floor(t)%60,t=(10>e?"0"+e:e)+":"+(10>t?"0"+t:t)}return t},n=function(){var n=this;this.options={selector:"#nm_jplayer"},this.player=this.options.selector,n._init(),t(n.player).bind(t.jPlayer.event.play,function(){var e=playlist[s.current][s.bomb];t(".nms-play-btn").removeClass("nm-pause").addClass("nm-play"),t(".nms-list-item").removeClass("is-active"),t("#nm-list-"+s.current+" .nms-list-item").data("status","ready"),t("#nm-player-"+s.current+" .nmplayer-title").html(e.title+" - "+e.artist),t("#nm-player-"+s.current+" .duration").html(a(e.duration)),t("#nm-player-"+s.current+" .nms-play-btn").removeClass("nm-play").addClass("nm-pause"),t("#nm-list-"+s.current).length>0&&(t("#nm-list-"+s.current+" .nms-list-item").eq(s.bomb).addClass("is-active"),t("#nm-list-"+s.current+" .nms-list-item").eq(s.bomb).data("status","play"))}),t(n.player).bind(t.jPlayer.event.pause,function(){playlist[s.current][s.bomb];t("#nm-player-"+s.current+" .nms-play-btn").removeClass("nm-pause").addClass("nm-play"),t("#nm-list-"+s.current+" .nms-list-item").eq(s.bomb).data("status","pause") }),t(n.player).bind(t.jPlayer.event.ended,function(){s.bomb<playlist[s.current].length?(s.bomb=s.bomb+1,n.play(s.current,s.bomb),t(n.player).jPlayer("play")):s.bomb=0}),t(document).on(e,".nm-mute",function(){var e=t(".nm-mute"),s=e.data("status");"mute"==s?(t(n.player).jPlayer("unmute"),e.data("status","unmute"),e.removeClass("muted"),i("unmute mod")):(e.data("status","mute"),t(n.player).jPlayer("mute"),e.addClass("muted"),i("mute mod"))}),t(document).on(e,".nm-previous",function(){var e=t(this),a=e.parent().data("index");i("previous"),a==s.current&&(playlist[s.current]<2||(i("previous"),n.previous()))}),t(document).on(e,".nm-next",function(){var e=t(this),a=e.parent().data("index");i("next"),a==s.current&&(i("next"),n.next())}),t(document).on(e,".nms-play-btn",function(){var e=t(this),a=e.data("index");s.current==a?e.hasClass("nm-play")?(i("player continue."),n.play()):(i("player pause."),n.pause()):(i("player play."),s.current=a,n.play(s.current,0))}),t(".nmsingle-process").on("click",function(e){e.preventDefault();var i=t(this),a=i.data("index");if(a===s.current){var o=i.offset().left,r=(e.pageX-o)/i.width(),l=playlist[s.current][s.bomb].duration;t(n.player).jPlayer("play",l*r)}}),t(document).on("click",".nms-list-item",function(){var e=t(this),a=e.parent().data("index"),n=e.index();return a==s.current&&n==s.bomb?i("current song selected"):(s.current=a,s.bomb=n,t("#nm_jplayer").jPlayer("setMedia",playlist[s.current][s.bomb]),void t("#nm_jplayer").jPlayer("play"))})};n.prototype={_init:function(){t(this.player).jPlayer({timeupdate:function(e){var i,i=e.jPlayer.status.currentTime,i=a(i),n=playlist[s.current][s.bomb].lrc,o=parseInt(e.jPlayer.status.currentTime);void 0!=n[o]&&t("#nm-player-"+s.current+" .nmsingle-lrc").html(n[o]),t("#nm-player-"+s.current+" .current-time").text(i),t("#nm-player-"+s.current+" .nmsingle-process-bar").css("transform","translateX("+(e.jPlayer.status.currentPercentAbsolute-100)+"%)")},supplied:"mp3",swfPath:nm_ajax_url.swfurl,solution:"html,flash",volume:1})},play:function(e,s){"undefined"!=typeof e&&"undefined"!=typeof s&&this.select(e,s),t(this.player).jPlayer("play")},pause:function(){t(this.player).jPlayer("pause")},next:function(){var t=playlist[s.current].length;s.bomb!=t-1&&this.play(s.current,s.bomb+1)},previous:function(){s.bomb<1||(i(s.bomb),this.play(s.current,s.bomb-1))},select:function(e,i){s.current=e,s.bomb=i,t(this.player).jPlayer("setMedia",playlist[s.current][s.bomb])}};new n}(jQuery);1 +function(t){"use strict";var e="ontouchstart"in document?"touchstart":"click",s={queue:[],current:null,bomb:0,debug:!1},i=function(t){s.debug&&console.log(t)},a=function(t){if(!isFinite(t)||0>t)t="--:--";else{var e=Math.floor(t/60);t=Math.floor(t)%60,t=(10>e?"0"+e:e)+":"+(10>t?"0"+t:t)}return t},n=function(){var n=this;this.options={selector:"#nm_jplayer"},this.player=this.options.selector,n._init(),t(n.player).bind(t.jPlayer.event.play,function(){var e=playlist[s.current][s.bomb];t(".nms-play-btn").removeClass("nm-pause").addClass("nm-play"),t(".nms-list-item").removeClass("is-active"),t("#nm-list-"+s.current+" .nms-list-item").data("status","ready"),t("#nm-player-"+s.current+" .nmplayer-title").html(e.title+" - "+e.artist),t("#nm-player-"+s.current+" .duration").html(a(e.duration)),t("#nm-player-"+s.current+" .nms-play-btn").removeClass("nm-play").addClass("nm-pause"),t("#nm-list-"+s.current).length>0&&(t("#nm-list-"+s.current+" .nms-list-item").eq(s.bomb).addClass("is-active"),t("#nm-list-"+s.current+" .nms-list-item").eq(s.bomb).data("status","play"))}),t(n.player).bind(t.jPlayer.event.pause,function(){playlist[s.current][s.bomb];t("#nm-player-"+s.current+" .nms-play-btn").removeClass("nm-pause").addClass("nm-play"),t("#nm-list-"+s.current+" .nms-list-item").eq(s.bomb).data("status","pause"),i(s.bomb),i("sb")}),t(n.player).bind(t.jPlayer.event.ended,function(){s.bomb<playlist[s.current].length-1?(s.bomb=s.bomb+1,n.play(s.current,s.bomb),t(n.player).jPlayer("play"),i("continue")):(s.bomb=0,i("end success"))}),t(document).on(e,".com-close",function(){var e=t(this);e.parent().remove()}),t(document).on(e,".nm-mute",function(){var e=t(".nm-mute"),s=e.data("status");"mute"==s?(t(n.player).jPlayer("unmute"),e.data("status","unmute"),e.removeClass("muted"),i("unmute mod")):(e.data("status","mute"),t(n.player).jPlayer("mute"),e.addClass("muted"),i("mute mod"))}),t(document).on(e,".nm-previous",function(){var e=t(this),a=e.parent().data("index");i("previous"),a==s.current&&(playlist[s.current]<2||(i("previous"),n.previous()))}),t(document).on(e,".nm-next",function(){var e=t(this),a=e.parent().data("index");i("next"),a==s.current&&(i("next"),n.next())}),t(document).on(e,".nms-play-btn",function(){var e=t(this),a=e.data("index");s.current==a?e.hasClass("nm-play")?(i("player continue."),n.play()):(i("player pause."),n.pause()):(i("player play."),s.current=a,n.play(s.current,0))}),t(".nmsingle-process").on("click",function(e){e.preventDefault();var i=t(this),a=i.data("index");if(a===s.current){var o=i.offset().left,r=(e.pageX-o)/i.width(),l=playlist[s.current][s.bomb].duration;t(n.player).jPlayer("play",l*r)}}),t(document).on("click",".nms-list-item",function(){var e=t(this),a=e.parent().data("index"),n=e.index();return a==s.current&&n==s.bomb?i("current song selected"):(s.current=a,s.bomb=n,t("#nm_jplayer").jPlayer("setMedia",playlist[s.current][s.bomb]),void t("#nm_jplayer").jPlayer("play"))})};n.prototype={_init:function(){t(this.player).jPlayer({timeupdate:function(e){var i,i=e.jPlayer.status.currentTime,i=a(i),n=playlist[s.current][s.bomb].lrc,o=parseInt(e.jPlayer.status.currentTime);void 0!=n[o]&&t("#nm-player-"+s.current+" .nmsingle-lrc").html(n[o]),t("#nm-player-"+s.current+" .current-time").text(i),t("#nm-player-"+s.current+" .nmsingle-process-bar").css("transform","translateX("+(e.jPlayer.status.currentPercentAbsolute-100)+"%)")},supplied:"mp3",swfPath:nm_ajax_url.swfurl,solution:"html,flash",volume:1})},play:function(e,s){"undefined"!=typeof e&&"undefined"!=typeof s&&this.select(e,s),t(this.player).jPlayer("play")},pause:function(){t(this.player).jPlayer("pause")},next:function(){var t=playlist[s.current].length;s.bomb!=t-1&&this.play(s.current,s.bomb+1)},previous:function(){s.bomb<1||(i(s.bomb),this.play(s.current,s.bomb-1))},select:function(e,i){s.current=e,s.bomb=i,t(this.player).jPlayer("setMedia",playlist[s.current][s.bomb])}};new n}(jQuery);
Note: See TracChangeset
for help on using the changeset viewer.