gamer | Дата: Вторник, 24.03.2009, 20:41 | Сообщение # 1 |
Admin
Группа: Администраторы
Сообщений: 404
Статус: Offline
| И еще один скрипт.. Подстраивается под любую ширину. Если нужно могу изменить цвет... Code <html> <head> <link rel="stylesheet" type="text/css" media="all" href="http://danison.ucoz.ru/radio/radio.css.txt"> <meta http-equiv=Content-Type content="text/html; charset=win-1251"> <script type="text/javascript">if(escape('а')!='%u0430') { var cs_i2=new Image; cs_i2.src='http://err.rambler.ru/cs/'; }function globalCsChErr(a,b,c) {var i=new Image; i.src='http://err.rambler.ru/js/?'+escape(a)+','+escape(b)+','+escape(c)+'/'; return true;}window.onerror=globalCsChErr;</script>
<script type="text/javascript" src="http://audio.rambler.ru/i/js/evnt_wth.js"></script> <script type="text/javascript" src="http://audio.rambler.ru/i/js/radioplayer.js?v=1"></script> <script type="text/javascript"> function resizeOnLoad() { var t = document.body.getElementsByTagName('DIV')[0], h = typeof innerHeight != 'undefined'? innerHeight: document.documentElement.clientHeight; //изменяем высоту попап окна, //если оно ожидаемой высоты (для защиты от изменения размера не попап окна браузера) // t.offsetHeight >= h && ( h < 300 && window.resizeBy(0, t.offsetHeight - h + 6) } </script> <style id="not4Simple" disabled="true"> .not4Simple {display:none;} </style> </head> <body scroll="no" onload="resizeOnLoad()"> <div> <div id="logo" class="horizontalBg"> <div class="help"> </div> <a class="imgs home" href="http://danison.ucoz.ru" target="_blank" onclick="window[window.opener? 'opener': 'top'].open(this.href, this.target); return false" ></a> </div> <div class="imgs prevButton"><div class="imgs" title="Назад"></div></div> <div class="imgs nextButton"><div class="imgs" title="Вперед"></div></div> <div id="radioList" class="horizontalBg"> <div class="box"> <ul> <li></li> </ul> </div> </div> <div id="panel" class="horizontalBg"> <div class="imgs leftBg"></div> <div class="imgs rightBg"></div> <div class="horizontalBg label">В эфире</div> <div id="radioName"></div> <div id="playButton" class="imgs control disable"></div> <div class="horizontalBg delimiter not4Simple"></div> <div class="imgs volume not4Simple"><div class="imgs" style="margin-left:50%"></div></div> <div class="horizontalBg delimiter"></div> <div class="statusBar"><span id="playerState"></span></div> </div> </div> <script> var radioPlayer, radioPlayerClass = ( function (listItem) { var timeCounter, timerId, k, prots; function closure(obj, bitrate, listItem) { return function(){ obj.myBitrate = bitrate; obj.playFromItem(listItem) } } function timeToStr(n) { var s = '', t = { 'h': Math.floor(n / 3600), 'm': Math.floor(n % 3600 / 60), 's': Math.floor(n % 60) }; if (t.h) { s += t.h + ':' } t.m < 10 && (s += '0'); s += t.m + ':'; t.s < 10 && (s += '0'); s += t.s; return s } function myPlayerClass(myBitrate) { this.myBitrate = myBitrate || 64; } myPlayerClass.prototype = new GA.WMPlayerClass; prots = { 'drawListItem': function(listItem) { var t = 0, k, c, o, n =document.createElement('DIV'), classNode, valueNode; n.className = 'quality'; n.innerHTML = ' <div class="another"> <div class="imgs topRightAngle"></div> <div class="imgs topLeftAngle"></div> <div class="qualityValue">64KB</div> </div>'; classNode = n.getElementsByTagName('DIV')[0]; valueNode = classNode.getElementsByTagName('DIV')[2]; o = document.getElementById('panel'); c = o.lastChild; do { k = c.previousSibling; if (c.nodeType == 1 && c.className == 'quality') { o.removeChild(c) } c = k } while (c) for (k in listItem.bitrates) { if (k-0 >= this.myBitrate-0) { t = k; break } } t == 0 && (t = k); c = null; for (k in listItem.bitrates) { valueNode.innerHTML = k+'KB'; if (k == t) { classNode.className = 'current'; c = o.insertBefore(n.cloneNode(true), c); classNode.className = 'another' } else { c = o.insertBefore(n.cloneNode(true), c); c.onclick = closure(this, k ,listItem) } } o = document.getElementById('radioName'); o.innerHTML = listItem.name; return t }, 'showTime': function() { var n = document.getElementById('playerState'); if (!n) return; n.innerHTML = timeToStr(this.playerObject.controls.currentPosition) }, 'showTimeSimple': function() { var n = document.getElementById('playerState'); timeCounter++; if (!n) return; n.innerHTML = timeToStr(timeCounter) }, 'setSimpleMode': function(url) { GA.WMPlayerClass.prototype.setSimpleMode.call(this, url); myPlayerClass.prototype.showTime = myPlayerClass.prototype.showTimeSimple; document.getElementById('not4Simple').disabled = false; }, 'playStateChange': function(NewState) { var n = document.getElementById('playerState'); if(n) { n.innerHTML = [ 'Неопределенно', 'Стоп', 'Пауза', 'Воспроизведение', 'Вперед', 'Назад', 'Загрузка', 'Ожидание', 'Закончено', 'Соединение', 'Готово', 'Перезагрузка' ][NewState];//'d>]; this.state = NewState; } if (typeof timerId != 'undefined') { window.clearInterval(timerId) } n = document.getElementById('playButton'); if (NewState == 3) { timeCounter = 0; timerId = window.setInterval((function(obj){return function(){obj.showTime()}})(this), 1000); n && (n.className = n.className.replace(/(^|\s)(?:play|disable)(\s|$)/, '$1pause$2')) } else { n && (n.className = n.className.replace(/(^|\s)(?:pause|disable)(\s|$)/, '$1play$2')) } }, 'playFromItem': function(listItem) { var t, v='http://audio.rambler.ru/?from=', url = listItem.bitrates[ this.drawListItem(listItem) ]; this.playFromURL(url); v+=( window.location.host.indexOf('assist')!=-1? 'assist': window.location.search.indexOf('bld=')!=-1? 'icq': 'audio' )+'&station='+listItem.id; (new Image).src=v; this.saveCookie(this.myBitrate, 3, /(\d+)$/.exec(url)[1]); }, 'saveCookie': function (bitrate, state, urlId) { var t = new Date(); t.setDate(365); urlId && (this.lastUrlId = urlId); t ='current_radio='+this.lastUrlId+'|'+bitrate+ '|'+state+ '; expires='+ t.toGMTString()+ '; domain='+window.location.hostname; document.cookie = t; } }; for (k in prots) { myPlayerClass.prototype[k] = prots[k] } return myPlayerClass; } )(); (function(){ function closure(obj, methodName, removeMethod,pm) { return function(){ if (removeMethod) { this[removeMethod] = null } obj[methodName](this,pm||0) } } /** * вычислитель растояний промотки * @param {GA.Dynamic} t * @param {HTMLElement} o елемент хранящий прокручиваемые блоки * @param {Boolean|Number} p * <b>true</b>:промотать на один елемент вперет,<br> * <b>false</b>:назат,<br> * иначе промотать в центр болк с заданным <b>порядковым номером</b> */ function c(t,o,p){ var a=o.getElementsByTagName('LI'),k,w=a.length-1,i=p?0:w,d='offsetWidth',s='offsetLeft'; if(typeof p == 'undefined'){p=0} if(p===!0||p===!1){ if(p==!0) while(i<w && a[i][s]-t.to<=0){i++} else while(i && a[i][s]-t.to>=0){i--}; p=a[i][s]; }else{ p=a[p][s]-((o[d]-a[p][d])>>1); p<0&&(p=0) } t.from=o.scrollLeft; k=a[w][d]+a[w][s]-o[d]; t.to=(k>0&&p>k)?k:p; if (t.to<k) { !/(?:^|\s)active(?:\s|$)/.test(t.oNextButton.className) && (t.oNextButton.className += ' active') } else { t.oNextButton.className = t.oNextButton.className.replace(/(^|\s)active(?:\s|$)/, '$1') } if (t.to>0) { !/(?:^|\s)active(?:\s|$)/.test(t.oPrevButton.className) && (t.oPrevButton.className += ' active') } else { t.oPrevButton.className = t.oPrevButton.className.replace(/(^|\s)active(?:\s|$)/, '$1') } t.playBack=!1; delete t.current; t.play() } GA.Dynamic=function(){}; GA.Dynamic.closure=(function(c){ return function(o,a,b){ c!==!1&&clearTimeout(c); t=0; function f(){ var d=20,l=b-a; o[o.methodName](o.current=(a+o.type(t/o.duration)*l)); if(t<o.duration){ t+=(d=((l=(o.duration-t))<d?l:d)); c=setTimeout(f,d) }else{ o.playBack=!o.playBack; delete o.current; c=!1 } }; return f } })(!1); GA.Dynamic.prototype.play=function(){ var t=this,f=GA.Dynamic.closure,a=['from','to']; if(t.playBack){a=a.reverse()} a[0]=t[a[0]];a[1]=t[a[1]]; if(typeof t.current=='undefined'){ (f(t,a[0],a[1]))() }else{ t.playBack=!t.playBack;(f(t,t.current,a[0]))() } }; var volume = new GA.eventWatcherClass(['mouseover', 'mousedown', 'mouseup'], '.volume', 'onOver', 'onOut') volume.onOver = function(node, pos, e) { var x = 0, t = node; if(!radioPlayer.playerObject) return if (e.type == 'mousedown') { this._mousePressed = node; } if (this._mousePressed == node) { if (document.selection) { document.selection.empty() } while (t && t != document.body) { x += t.offsetLeft; t = t.offsetParent } x = pos.x-x-7; x < 0 && (x = 0); x > 50 && (x = 50); radioPlayer.setVolume(Math.floor(x * 100 / 50)); node.getElementsByTagName('DIV')[0].style.marginLeft = (x-5)+'px' } if (e.type == 'mouseup') { delete this._mousePressed; } }; volume.onOut = function(pos, e) { if (e.type == 'mouseup') { delete this._mousePressed; } }; /** * класс_работы_с_горизонтально_прокручиваемым_списком_блоков. * @param {Object} containerId */ GA.listClass = function(containerId, aList) { if (typeof aList[0] == 'undefined') return; this.aList = aList; GA.runMethodWhenNodeExist(this, 'init', 'document.getElementById("'+containerId+'")', []); } GA.listClass.prototype = { 'init': function(oNode) { var evs = {'DOMMouseScroll':{}, 'mousewheel':{}}, o = document.cookie.split(';'), k, t, c={}, i; //this.currentItem = 0; while (o.length) { t = o[o.length-1]; t = t.substr(t.charAt(0)==' '? 1: 0).split('='); o.length--; c[t[0]] = t.slice(1).join('') } k=document.location.search.slice(1).split('&'); for(i=k.length;i--;){ k[i]=k[i].split('='); if(k[i][0]=='id'){ i=k[i][1]; break } } o=[typeof c.current_radio != 'undefined',0]; if (o[0] || i!=-1) { o[0] && (o = c.current_radio.split('|')); if (i !=-1){ for(k=this.aList.length;k--;){ if(this.aList[k].id==i){ this.currentItem=k; o[2]=3; break } } }else{ currentItemFinded: for (i = this.aList.length; i--; ) { c = this.aList[i].bitrates; for (k in c) { if ((t = /(\d+)$/.exec(c[k])) && t[1] == o[0]) { this.currentItem = i; break currentItemFinded } } } } } radioPlayer = new radioPlayerClass( o[1] ); if (typeof this.currentItem != 'undefined') { if (typeof o[2] != 'undefined' && o[2] == 3) { radioPlayer.playFromItem(this.aList[this.currentItem]); } else { radioPlayer.drawListItem(this.aList[this.currentItem]); radioPlayer.playStateChange(1) } } else { // this.currentItem=0 } radioPlayer.lastUrlId = t[1]; this.oContainer = oNode.getElementsByTagName('UL')[0]; while ( (oNode=oNode.previousSibling) && !( oNode.nodeType == 1 && /(?:^|\s)nextButton(?:\s|$)/.test(oNode.className) ) ); this.oNextButton = oNode.getElementsByTagName('DIV')[0]; while ( (oNode=oNode.previousSibling) && !( oNode.nodeType == 1 && /(?:^|\s)prevButton(?:\s|$)/.test(oNode.className) ) ); this.oPrevButton = oNode.getElementsByTagName('DIV')[0]; t=this.oPrevButton; t.ondblclick=t.onclick = closure(this, 'scrollPrev'); t=this.oNextButton; t.ondblclick=t.onclick = closure(this, 'scrollNext'); try{ document.links[0].focus(); document.links[0].blur(); }catch(e){} this.showBlocks(); this.methodIntoEventProcessing('watchMouseScroll', 'mouseover', this.oContainer, evs); this.methodIntoEventProcessing('unwatchMouseScroll', 'mouseout', this.oContainer, evs); this.methodIntoEventProcessing('showBlocks', 'resize', window); GA.eventWatcherClass.call(this, ['click'], '[@id=playButton]', 'clickPlayPause'); /**/ }, 'play':GA.Dynamic.prototype.play, 'type':function(p){return 1-Math.sin(Math.acos(p))}, 'draw':function(pos){ this.oContainer.parentNode.scrollLeft=Math.round(pos) }, 'duration':110, 'to':0, 'methodName':'draw', 'showBlocks': function() { var lineTopOffset, endPosition, t, n, im, i = 0; if (!this.oListItemTemplate) { t = this.oContainer.getElementsByTagName('LI')[0]; this.oListItemTemplate = this.oContainer.removeChild(t); this.aListItems = []; for (i = 0, n = this.aList.length; i < n; i++) { t = this.oListItemTemplate.cloneNode(true); t.className += ' listItem'+i; t.title = this.aList[i].name; im=new Image(); im.alt=this.aList[i].name; t.appendChild(im); this.aListItems[i] = this.oContainer.appendChild(t); this.aListItems[i].onclick = closure(this, 'clickOnListItem'); im.onload = closure(this, 'correctWidth'); im.onerror = closure(this, 'correctWidth'); im.src=this.aList[i].icon; } this.correctWidth(); if(typeof this.currentItem != 'undefined'){ this.aListItems[this.currentItem].className += ' current horizontalBg'; c(this,this.oContainer.parentNode,this.currentItem) } } }, 'correctWidth':function(){ var a=this.oContainer.getElementsByTagName('LI'),i,s=0; for(i=a.length;i--;){ s+=a[i].offsetWidth } this.oContainer.style.width=s+'px'; c(this,this.oContainer.parentNode,this.currentItem) }, 'scrollPrev': function() { c(this,this.oContainer.parentNode,!1) }, 'scrollNext': function() { c(this,this.oContainer.parentNode,!0) }, 'clickOnListItem': function(oNode) { var n, i=''; if (oNode) { i = /(?:^|\s)listItem(\d+)(?:\s|$)/.exec(oNode.className)[1]; if ( typeof this.currentItem != 'undefined' && i == this.currentItem ) return; if (typeof this.currentItem != 'undefined' && oNode) { n = this.aListItems[this.currentItem]; n.className = n.className.replace(/(^|\s)current horizontalBg(?:\s|$)/, '$1') } this.currentItem = i; !/(?:^|\s)current horizontalBg(?:\s|$)/.test(oNode.className) && (oNode.className += ' current horizontalBg') } radioPlayer.playFromItem(this.aList[this.currentItem]); c(this,this.oContainer.parentNode,this.currentItem) }, 'clickPlayPause': function(oNode, pos, e, evs) { if(/(?:^|\s)disable(?:\s|$)/.test(oNode.className))return; if(!radioPlayer.playerObject) { typeof this.currentItem != 'undefined' && this.clickOnListItem() } else { radioPlayer.playPause(); radioPlayer.saveCookie( radioPlayer.myBitrate, (radioPlayer.state==1 || radioPlayer.state==2)? 1: 3 ) } }, 'onMouseScroll': function(oNode, pos, e, evs) { var delta = e.wheelDelta || -e.detail; for (var k in evs) { if (e.type != k) { GA.eventWatcherClass.removeEventProcessing(k, evs[k], document); delete evs[k] } } this[delta > 0 ? 'scrollPrev': 'scrollNext'](); }, 'watchMouseScroll': function(oNode, pos, e, evs) { for (var k in evs) { evs[k] = this.methodIntoEventProcessing( 'onMouseScroll', k, document, evs ); } }, 'unwatchMouseScroll': function(oNode, pos, e, evs) { for (var k in evs) { GA.eventWatcherClass.removeEventProcessing(k, evs[k], document) } } }; for (var k in GA.eventWatcherClass.prototype) { if (!GA.listClass.prototype[k]) { GA.listClass.prototype[k] = GA.eventWatcherClass.prototype[k] } } // new GA.listClass('radioList', []) })(); </script> <script type="text/javascript" charset="utf-8" src="http://audio.rambler.ru/ajax/stations.js"></script> <div align="right"><a href="http://danison.ucoz.ru/index/0-82"><img src="http://danison.ucoz.ru/radio/1.png" /></a></div> </span> </body> </html>
|
|
| |