Permalink
Browse files

fix play-in-douRex on music collection page

  • Loading branch information...
1 parent 55a9899 commit 29f3716c0a477e506d6932f5792f446ccb2906d9 @rnons committed Dec 20, 2011
Showing with 53 additions and 20 deletions.
  1. +7 −1 README
  2. +45 −0 includes/musicpage.js
  3. +0 −18 includes/musicpage.user.js
  4. +1 −1 scripts/radio.js
View
8 README
@@ -1,7 +1,13 @@
豆瓣电台Opera Extension
based upon https://github.com/ylm201/douRadio
-changelog - 2011-12-13
+Changelog - 2011-12-20
+1. 采用网页分享(支持豆瓣、饭否、新浪)
+2. 从歌曲名链接到豆瓣专辑页面
+3. 在专辑页面可选择从插件播放
+4. 在音乐收藏(想听、听过)页面可选择从插件播放
+
+Changelog - 2011-12-13
1. Opera的<audio>标签不支持mp3格式,改用jPlayer库
2. 增加index.js,用于后台播放
3. off状态不显示暂停按钮
View
@@ -0,0 +1,45 @@
+// ==UserScript==
+// @include http://music.douban.com/*
+// ==/UserScript==
+var subject = /subject/g;
+var people = /people/g;
+if ( subject.test(document.URL) ){
+ document.addEventListener('DOMContentLoaded', function() {
+ var start_radio = document.getElementsByClassName("start_radio")[0];
+ var douRex = document.createElement("a");
+ douRex.title = "在douRex中播放";
+ douRex.text = "\u00a0"+"douRex";
+ douRex.href = "javascript:;"
+ douRex.addEventListener('click', function() {
+ opera.postError('clicked');
+ opera.extension.postMessage(document.URL.substr(32,7));
+ },false);
+ var p = document.createElement("p");
+ p.appendChild(douRex);
+ var text = document.createTextNode("\u00a0"+"\u00a0"+"\u00a0"+"也在播放^_^");
+ p.appendChild(text);
+ start_radio.appendChild(p);
+ }, false);
+}
+
+if ( people.test(document.URL) ){
+ document.addEventListener('DOMContentLoaded', function() {
+ var start_radio_all = document.getElementsByClassName("start_radio");
+ for (i=0; i<start_radio_all.length; i++){
+ var douRex = document.createElement("a");
+ douRex.title = "在douRex中播放";
+ douRex.text = "\\[douRex]/";
+ douRex.href = "javascript:;"
+ douRex.addEventListener('click', function() {
+ opera.postError('clicked');
+ opera.extension.postMessage(this.parentNode.getElementsByTagName("a")[0].href.substr(32,7));
+ },false);
+ //douRex.style="background-origin: padding-box; background-clip: border-box; background-color: transparent;"
+
+
+ var start_radio = start_radio_all[i];
+ start_radio.parentNode.appendChild(douRex);
+ }
+ }, false);
+
+}
View
@@ -1,18 +0,0 @@
-// ==UserScript==
-// @include http://music.douban.com/*
-// ==/UserScript==
-document.addEventListener('DOMContentLoaded', function() {
- target = document.getElementsByClassName("start_radio")[0];
- opera.postError(target.className);
- douRex = document.createElement("a");
- douRex.title = "在douRex中播放";
- douRex.text = "在douRex中播放";
- douRex.href = "javascript:;"
- douRex.addEventListener('click', function() {
- opera.postError('clicked');
- opera.extension.postMessage(document.URL.substr(32,7));
- },false);
- p = document.createElement("p");
- p.appendChild(douRex);
- target.appendChild(p);
-}, false);
View
@@ -63,7 +63,7 @@ Radio.prototype.getPlayList=function(t,skip){
var songs=data.song
for(s in songs){
self.song_list[s]=songs[s]
- opera.postError(songs[s].title)
+ //opera.postError(songs[s].title)
}
if(skip){
self.changeSong(t)

0 comments on commit 29f3716

Please sign in to comment.