Permalink
Browse files

href of song_title when playing DJ channel

  • Loading branch information...
1 parent c401ed0 commit 099e7a8f543bfa0cde5231c9a13dc77c4576676c @rnons committed Jul 11, 2012
Showing with 41 additions and 7 deletions.
  1. +37 −4 includes/musicpage.js
  2. +4 −3 scripts/player.js
View
@@ -19,7 +19,6 @@ var url = document.URL;
if ( subject.test(url) ){
document.addEventListener('DOMContentLoaded', function() {
var start_radio = document.getElementsByClassName("bs")[0];
- opera.postError("hello")
if ( !start_radio )
return;
var douRex = document.createElement("a");
@@ -151,7 +150,10 @@ if ( explore.test(url) ){
document.addEventListener('DOMContentLoaded', function() {
opera.postError("hello")
var start_radio_musician = null;
- start_radio_musician = document.getElementsByClassName("item-link");
+ var cid = null;
+
+ // side channel list
+ start_radio_musician = document.getElementsByClassName("ch-name");
if ( !start_radio_musician )
return;
@@ -160,6 +162,37 @@ if ( explore.test(url) ){
douRex.title = "用douRex收听";
douRex.text = "\\[douRex]/";
douRex.href = "javascript:;"
+ douRex.style = "font-size:12px;"
+ douRex.addEventListener('click', function() {
+ //cid = this.parentNode.getElementsByTagName("a")[0].href.substr(22,7)
+ cid = this.parentNode.parentNode.href.substr(22,7)
+ opera.postError(cid)
+ opera.postError("hello")
+
+ opera.extension.postMessage({
+ action: 'play_channel',
+ channel_id: cid
+ });
+
+ },false);
+
+ var start_radio = start_radio_musician[i];
+ start_radio.parentNode.style.height = '60px';
+ //start_radio.parentNode.appendChild(douRex);
+ start_radio.appendChild(douRex);
+ }
+ // recommend channels
+
+ var start_radio_ch = null;
+ start_radio_ch = document.getElementsByClassName("item-link");
+
+ if ( !start_radio_ch )
+ return;
+ for (i=0; i<start_radio_ch.length; i++){
+ var douRex = document.createElement("a");
+ douRex.title = "用douRex收听";
+ douRex.text = "\\[douRex]/";
+ douRex.href = "javascript:;"
douRex.style = "font-size:14px;"
douRex.addEventListener('click', function() {
opera.extension.postMessage({
@@ -168,9 +201,9 @@ if ( explore.test(url) ){
});
},false);
- var start_radio = start_radio_musician[i];
+ var start_radio = start_radio_ch[i];
start_radio.parentNode.appendChild(douRex);
- }
+ }
},false);
}
View
@@ -3,6 +3,7 @@ console.log(radio.channel);
function showSong(){
var data=radio.c_song;
+ var site = /site/;
var page="http://music.douban.com"+data.album
if(data&&data.like==1){
$("#like").attr("src","img/rated.png")
@@ -19,14 +20,14 @@ function showSong(){
$("search_lrc").hide()
}
if(data.title){
- if(radio.channel==26)
+ if(site.test(data.album)){
$("#song_title").html("<a href='"+data.album+"'>"+data.title+"</a>")
- else
+ }else{
$("#song_title").html("<a href='"+page+"'>"+data.title+"</a>")
+ }
$("#song_title").attr("title",data.title)
$("#song_artist").html(data.artist)
$("#song_artist").attr("title",data.artist)
- $("#song_artist").attr("href",page)
}
};

0 comments on commit 099e7a8

Please sign in to comment.