Форум "Я-Печорец!" - главный форум города Печора http://www.ya-pechorec.ru/forum/ |
|
"Инклюдим" радио на сайт http://www.ya-pechorec.ru/forum/viewtopic.php?f=159&t=1925 |
Страница 1 из 1 |
Автор: | admin [ 03 июл 2011, 15:23 ] |
Заголовок сообщения: | "Инклюдим" радио на сайт |
Всем, кому надо. Долго искал фишку с плеером радио на сайт. "В контакте" полно таких приложений, но вот "всунуть" их к себе - есть проблемы. Нашел решение и грамотно "стырил" у Харьковчан. Между <head> и </head> пастим портянку скриптов: Код: <script> //Hint Start // CLASS : MW_System_Load // Init function MW_System_Load(){ this.wib = screen.width; this.heb = screen.height; this.documes = (document.getElementById || document.createElement || document.getElementsByTagName) ? true : false; this.objects = window.addEventListener || window.attachEvent ? window : document.addEventListener ? document : null; this.types = 'load'; } MW_System_Load.prototype.addsevent = function(func){ if(this.objects.addEventListener){ this.objects.addEventListener(this.types,func,false); return true; } else if (this.objects.attachEvent){ this.objects.attachEvent("on" + this.types,func); } else { return false; } } MW_System_Load.prototype.browser = function(){ this.ver = navigator.appVersion; this.agent = navigator.userAgent.toLowerCase(); this.dom = document.getElementById ? 1:0; this.all = document.all ? 1:0; this.ie5 = (this.ver.indexOf("MSIE 5")>-1 && this.dom) ? 1:0; this.ie6 = (this.ver.indexOf("MSIE 6")>-1 && this.dom) ? 1:0; this.ie4 = (document.all && !this.dom) ? 1:0; this.ie = this.ie4 || this.ie5 || this.ie6; this.opera = this.agent.indexOf("opera")>-1; this.gecko = (this.agent.indexOf("gecko")!=-1) ? 1:0; this.bw = (this.ie || this.opera || this.gecko); return this; } MW_System_Load.prototype.findobj = function(obj){ this.parent = window.document; if(this.parent[obj]){ return this.parent[obj]; } if(this.parent.all && this.parent.all[obj]){ return this.parent.all[obj]; } if(this.parent.layers && this.parent.layers[obj]){ return this.parent.layers[obj]; } if(this.parent.getElementById && this.parent.getElementById(obj)){ return this.parent.getElementById(obj); } return null; } var MW = new MW_System_Load(); function MW_System_Hint(){} MW_System_Hint.prototype.show = function(obj,str){ var hint = MW.findobj('hint'); if(!obj){ return; } if(!MW.documes){ return; } if(!hint){ return; } hint.className = 'hint'; hint.style.left = 15; hint.style.top = 50; obj.onmouseout = function(advance){ hint.style.width = ''; hint.style.visibility = 'hidden'; if(hint.firstChild) hint.removeChild(hint.firstChild); hint.appendChild(document.createTextNode(str)); }; obj.onmousemove = function(advance){ //str = str.replace(/</g,"<"); //str = str.replace(/>/g,">"); hint.style.width = ''; hint.innerHTML = str; vc = document.getElementsByTagName((document.compatMode && document.compatMode=="CSS1Compat") ? "HTML":"BODY")[0]; x = window.event ? event.clientX + vc.scrollLeft : advance.pageX; y = window.event ? event.clientY + vc.scrollTop : advance.pageY; vcwidth = vc.clientWidth ? vc.clientWidth + vc.scrollLeft : window.innerWidth + window.pageXOffset; vcheight = vc.innerHeight ? window.innerHeight + window.pageYOffset : vc.clientHeight + vc.scrollTop; if(hint.offsetWidth>500){ hint.style.width = '200'; } if((x + hint.offsetWidth + 15) > vcwidth){ hint.style.left = x - hint.offsetWidth - 4; } else { hint.style.left = x + 15; } if((y + hint.offsetHeight + 19) > vcheight){ hint.style.top = y - hint.offsetHeight; } else { hint.style.top = y + 25; } //if(typeof(hint.style.MozOpacity)!="undefined"){ hint.style.opacity = '.91'; hint.style.filter = "alpha(opacity:91)"; //} hint.style.visibility = 'visible'; }; } MW_System_Hint.prototype.initialize = function(){ var hint = document.createElement("DIV"); hint.setAttribute('id','hint'); document.getElementsByTagName('body')[0].appendChild(hint); hint.style.visibility = 'hidden'; var hintmarker = ['a','img','img','input','span','div','textarea']; var textmarker = ['title','alt','title','title','title','title','title']; var lenmarker = hintmarker.length; for(var i=0; i<lenmarker; i++) { atr = document.getElementsByTagName(hintmarker[i]); for(var j=0; j<atr.length; j++) if(viewhint=atr[j].getAttribute(textmarker[i])){ atr[j].removeAttribute(textmarker[i]); HINT.show(atr[j],viewhint); } } } var HINT = new MW_System_Hint(); if(MW.objects){ MW.addsevent(HINT.initialize); } </script> <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script> Затем в любом удобном месте пастим само радио. Замуровано в таблицу, но несложно переделать кому как надо, в принципе нам нужен только swf-объект: Код: <TABLE style="BACKGROUND-IMAGE: url(http://mykh.com.ua/panel/editor/saf/undefined); WIDTH: 100%; BORDER-COLLAPSE: collapse"> <TBODY> <TR> <TD style="TEXT-ALIGN: center; LETTER-SPACING: 0px; VERTICAL-ALIGN: middle; WORD-SPACING: 0px"> <DIV> <OBJECT codeBase="http://active.macromedia.com/flash6/cabs/swflash.cab#version=6.0.0.0" classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=570 height=430><PARAM NAME="_cx" VALUE="15081"><PARAM NAME="_cy" VALUE="11906"><PARAM NAME="FlashVars" VALUE=""><PARAM NAME="Movie" VALUE="http://77.120.106.119/333.swf"><PARAM NAME="Src" VALUE="http://77.120.106.119/333.swf"><PARAM NAME="WMode" VALUE="Opaque"><PARAM NAME="Play" VALUE="-1"><PARAM NAME="Loop" VALUE="-1"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE=""><PARAM NAME="Menu" VALUE="-1"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE=""><PARAM NAME="Scale" VALUE="ShowAll"><PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE=""><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1"><PARAM NAME="Profile" VALUE="0"><PARAM NAME="ProfileAddress" VALUE=""><PARAM NAME="ProfilePort" VALUE="0"><PARAM NAME="AllowNetworking" VALUE="all"><PARAM NAME="AllowFullScreen" VALUE="false"> <embed src="http://77.120.106.119/333.swf" play="true" loop="true" wmode="Opaque" quality="high" bgcolor="" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="570" align="T" height="430"></OBJECT></DIV> </TD> </TR> </TBODY> </TABLE> Надеюсь кому-то пригодится. И очень надеюсь, что не сильно напугал этим бредом непосвященных. |
Автор: | admin [ 12 сен 2011, 17:38 ] |
Заголовок сообщения: | Re: "Инклюдим" радио на сайт |
К предыдущим постам. В общем, радио у Харьковчан заглючило , соответственно и у нас на сайте. По-сути они тоже "слили" swf файл радио с "Контакта". Проблему решил по другому. Сам глюк радио заключался в том, что автор swf-оболочки с "зашитыми" ссылками на потоки радио периодически меняет оболочку, добавляет новые фишки и ссылки. Что в таком случае надо сделать? Естественно, нужно "скачать" swf-приложение из "Контакта" к себе на сайт, нужен-то всего один файл. Вот его очень хитро надо взять взаймы. В явном виде его не найти. Скачивание приложения из "В Контакте", или как все просто оказалось... Открываем "В Контакте" страницу с приложением. Я делал в "Опере". Открываем исходный код страницы и находим ссылку на единственный файл zip. Это и есть "закамуфлированное" флэш-приложение. Оно выглядит примерно так: Код: src":"http:\/\/cs10155.vkontakte.ru\/u4801600\/33432870cc93e0.zip" Убираем все лишнее (лишние слэшы и кавычки) и получаем ссылку для скачивания swf-приложения: Код: http://cs10155.vkontakte.ru/u4801600/33432870cc93e0.zip После закачки переименовываем расширение zip на swf (обязательно) и само имя файла (как вам удобно). Закачиваем полученный файл к себе на сервер, делаем embed как в посте выше и вуаля! Обновляй приложение хоть каждый месяц (если автор любит его модифицировать). По такому принципу можно скачать любую игру из "Контакта", любое приложение и фишку. Единственное, если у приложения есть взаимодействие с сервисами "Контакта", то эти примочки работать не будут. |
Автор: | yarickPa [ 13 июл 2015, 19:42 ] |
Заголовок сообщения: | "Инклюдим" радио на сайт |
как сделать так чтобы при заходе на сайт начинало играть радио ссылку еа радио если это важно могу дать... |
Страница 1 из 1 | Часовой пояс: UTC + 3 часа |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |