酷觉网络电台ExtJs版源代码 EXTAjaxPHP音乐CSS
程序员文章站
2022-07-15 08:48:23
...
直接贴代码(核心):
/labs/cojueradio/getRadioTree:
获取树节点信息的php文件,返回的数据格式:
根节点:
类别节点:二维(对象)数组:
/labs/cojueradio/getRadioMms:
根据当前点击的电台(叶子)节点获取电台播放地址的php文件,返回的数据格式(简单加密):
其他代码省略(包括数据库连接、查询、css等)。欢迎拍砖!
<script type="text/javascript"> Ext.namespace('cojue'); cojue.Module = function(app, main){ this.app = app; this.main = main; this.init(); } cojue.App = function(){ this.init(); }; Ext.extend(cojue.App, Ext.util.Observable, { init:function(){ Ext.Ajax.request({ method:'GET', url:'/labs/cojueradio/getRadioTree', scope: this, success: this.loadTreeRootFinish, failure:function(r,o){} }); }, loadTreeRootFinish:function(response){ var rootInfo = eval(response.responseText); this.radioRoot = new Ext.tree.AsyncTreeNode({ id:rootInfo[0].id, text:rootInfo[0].text, iconCls:'folderStar' }); var radioLoader = new Ext.tree.TreeLoader({url:"/labs/cojueradio/getRadioTree"}); radioLoader.on("beforeload",function(loader,node){ radioLoader.baseParams.parentId = node.id.split("_")[1]; radioLoader.baseParams.label= node.id.split("_")[0] radioLoader.baseParams.keyword = node.text; }); this.radioTree = new Ext.tree.TreePanel({ id:'radioTree', region:'center', layout:"fit", width:214, height:379, split:true, collapsible:true, frame:true, animate:true, autoScroll:true, loader:radioLoader, root:this.radioRoot }); this.playerPanel = new Ext.Panel({ layout:'fit', region:'north', height:33, frame:true, items:[document.getElementById('musicbox')] }); this.radioWin = new Ext.Window({ title:'酷觉网络电台', iconCls:'music', width:238, height:400, layout:'border', collapsible:true, resizable:false, renderTo:'radioPlayer', items:[this.playerPanel, this.radioTree] }); this.radioWin.show(); this.radioRoot.expand(false, true); this.radioTree.on("click", function(node, event){ Ext.Ajax.request({ url:'/labs/cojueradio/getRadioMms', method:'post', params:{rid:node.id,url:location.href}, scope:this, success:function(response){ eval(response.responseText); if(rurl == '') return; else playSelectURL(rurl, node.text); }, failure:function(response){ errorProcess(response.info); } }); }, this); } }); Ext.onReady(function(){ Ext.QuickTips.init(); Ext.BLANK_IMAGE_URL = '/ext/resources/images/default/s.gif'; Ext.lib.Ajax.defaultPostHeader += '; charset=utf-8'; cojueApp = new cojue.App(); }); </script>
/labs/cojueradio/getRadioTree:
获取树节点信息的php文件,返回的数据格式:
根节点:
[{id:"0_1",text:"酷觉网络电台",label:"",iconCls:"folderStar"}]
类别节点:二维(对象)数组:
[{id:"1_4028eee423c384370123c39bafe40001",text:"推荐电台",label:"0",iconCls:"folderStar"},{id:"2_4028eee423c384370123c39bb0550002",text:"网络电台",label:"0",iconCls:"folderStar"},...]电台(叶子)节点:二维(对象)数组:
[{id:"r_2d90d099273b53c801273b8d51340a76",text:"<span style='color:red;' title='CRI 怀旧金曲频道 - 1453'>CRI 怀旧金曲频道</span>",iconCls:"cd",leaf:true},{id:"r_2d90d099273b53c801273b8d51ec0b8d",text:"<span style='color:red;' title='青檬音乐台 - 1391'>青檬音乐台</span>",iconCls:"cd",leaf:true},...]
/labs/cojueradio/getRadioMms:
根据当前点击的电台(叶子)节点获取电台播放地址的php文件,返回的数据格式(简单加密):
var rurl = 'mF.2*m%cF*s2ro*%Fil*3l.d*Aici*%vne*2e%s*';
其他代码省略(包括数据库连接、查询、css等)。欢迎拍砖!