原帖由 传奇人物 于 2007-1-18 08:23 发表
楼主, 能改一下这个播放器吗?
看了吓,这个应该是早期版本,1.0的,代码不是很整齐,不过一样是可以兼容的,这个已经是经过了人家修改的,照我的修改了就不能使用搜索了。修改方法:
打开js/exobudpl.js,删除以下代码:
- //selectlist、、歌曲或歌手全名
- var requeststr=document.location.search;
- if(requeststr==""){
- document.write ("<script language="javascript" src="js\/29403940.js"><\/script>");
- }
- else if(requeststr=="?artist="){
- document.write ("<script language="javascript" src="js\/29403940.js"><\/script>");
- }
- else //搜索清单
- {document.write ("<script language="javascript" src="http:\/\/hzau.131.tofor.com\/ll\/list1.asp" + requeststr +""><\/script>");}
复制代码
加入以下代码:
-
- // ▽播放列表XML文件的地址,可以是url也可以是相对路径
- //用URL表示需要读取的百度音乐魔方的播放列表文件的地址
- //注意!!!!这里的xml只能放在bbs所在的同一个域名下,否则由于js的安全机制,是无法读取远程文件的
- var playListUrl = "../PlayList-Top500.xml";
- var maxTryTimes=20;//尝试20秒后即更换下一曲,以防止过慢的地址等待太长时间
- // check for XPath implementation
- if( document.implementation.hasFeature("XPath", "3.0") )
- {
- // prototying the XMLDocument
- XMLDocument.prototype.selectNodes = function(cXPathString, xNode)
- {
- if( !xNode ) { xNode = this; }
- var oNSResolver = this.createNSResolver(this.documentElement)
- var aItems = this.evaluate(cXPathString, xNode, oNSResolver,
- XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
- var aResult = [];
- for( var i = 0; i < aItems.snapshotLength; i++)
- {
- aResult[i] = aItems.snapshotItem(i);
- }
- return aResult;
- }
- // prototying the Element
- Element.prototype.selectNodes = function(cXPathString)
- {
- if(this.ownerDocument.selectNodes)
- {
- return this.ownerDocument.selectNodes(cXPathString, this);
- }
- else{throw "For XML Elements Only";}
- }
- }
- // check for XPath implementation
- if( document.implementation.hasFeature("XPath", "3.0") )
- {
- // prototying the XMLDocument
- XMLDocument.prototype.selectSingleNode = function(cXPathString, xNode)
- {
- if( !xNode ) { xNode = this; }
- var xItems = this.selectNodes(cXPathString, xNode);
- if( xItems.length > 0 )
- {
- return xItems[0];
- }
- else
- {
- return null;
- }
- }
-
- // prototying the Element
- Element.prototype.selectSingleNode = function(cXPathString)
- {
- if(this.ownerDocument.selectSingleNode)
- {
- return this.ownerDocument.selectSingleNode(cXPathString, this);
- }
- else{throw "For XML Elements Only";}
- }
- }
- var myDocument;
- if (document.implementation.createDocument){
- // Mozilla, create a new DOMParser
- myDocument = new DOMParser();
- myDocument = document.implementation.createDocument("","",null);
- myDocument.async = false;
- myDocument.load(playListUrl);
- nodes = myDocument.documentElement.getElementsByTagName("Song");
- for(var i=0; i<nodes.length; i++)
- {
- var url = nodes[i].selectSingleNode("URL").textContent.split('|')[0];
- var name=nodes[i].selectSingleNode("Name").textContent;
- var artist=nodes[i].selectSingleNode("Artist").textContent;
- mkList(url,name+" - "+artist);
- }
- }
- else if (window.ActiveXObject){
- // Internet Explorer, create a new XML document using ActiveX
- // and use loadXML as a DOM parser.
- myDocument = new ActiveXObject("Microsoft.XMLDOM")
- myDocument.async = false;
- myDocument.load(playListUrl);
- nodes = myDocument.documentElement.childNodes;
- for(var i=0; i<nodes.length; i++)
- {
- var url = nodes[i].selectSingleNode("URL").text.split('|')[0];
- var name=nodes[i].selectSingleNode("Name").text;
- var artist=nodes[i].selectSingleNode("Artist").text;
- mkList(url,name+" - "+artist);
- }
- }
复制代码
打开js/exobud.js加入以下代码在最后:
- //播放智能控制,当缓冲时间过长,自动换曲
- var iTimeCount=0;
- function checkTryTimes()
- {
- var ps = document.getElementById("Exobud").playState;
- if(ps==6||ps==9)
- {
- iTimeCount+=1;
- document.getElementById("disp2").innerHTML="已等待"+iTimeCount+"秒";
- }
- if(iTimeCount>maxTryTimes)
- {
- playNext();
- iTimeCount=0;//重设状态检查计数
- document.getElementById("disp2").innerHTML="跳过无效地址";
- }
- }
复制代码
打开index.htm,在</body>前加入:
- <script language="JavaScript">setInterval("checkTryTimes()",1000);</script>
复制代码
然后把列表PlayList-Top500.xml放在论坛根目录,就可以了吧。
[ 本帖最后由 lonestone 于 2007-1-18 11:34 编辑 ] |