я решил продолжить работу с этим скриптом и сделать некое подобие универсального тега [video], чтоб работал с прямыми ссылками на популярные видеоресурсы,
в данный момент скрипт обрабатывает ссылки для : youtube.com rutube.ru vimeo.com dailymotion.com и smotri.com запнулся на vids.myspace.com вот собственно скрипт <script type="text/javascript"> var vide, html; var div = document.getElementsByTagName("div") for( i=0; i < div.length; i++ ) { if(div[i].className == 'postcolor') { if(div[i].innerHTML.indexOf("[video]")!=-1 && div[i].innerHTML.indexOf("[/video]")!=-1) { html = div[i].innerHTML; if (html.indexOf('smotri.com')) { vide = /\\[video\\]http:\\/\\/(.*?)\\/video\\/view\\/\\?id=(.*?)\\[\\/video\\]/g html = html.replace(vide, "<br><embed src='http://pics.$1/scrubber_custom8.swf?file=$2&bufferTime=3&autoStart=false&str_lang=rus&xmlsource=http://pics.$1/cskins/blue/skin_color_lightaqua.xml&xmldatasource=http://pics.$1/skin_ng.xml' quality='high' allowscriptaccess='always' allowfullscreen='true' wmode='opaque' width='400' height='300' type='application/x-shockwave-flash'></embed><br>") } if (html.indexOf('youtube.com')) { vide = /\\[video\\]http:\\/\\/(.*?)\\/watch\\?v=([^\\[]{11,110})\\[\\/video\\]/g html = html.replace(vide, "<br><embed src='http://$1/v/$2' type='application/x-shockwave-flash' wmode='transparent' allowfullscreen='true' allowscriptaccess='always' flashvars='fs=1&rel=0' width='425' height='350'></embed><br>") } if (html.indexOf('rutube.ru')) { vide = /\\[video\\]http:\\/\\/(.*?)\\/tracks\\/([^\\[]{1,20})\\.html\\?v=([^\\[]{11,50})\\[\\/video\\]/g html = html.replace(vide, "<br><embed src='http://video.$1/$3' type='application/x-shockwave-flash' wmode='transparent' width='425' height='350'></embed><br>") } if (html.indexOf('vimeo.com')) { vide = /\\[video\\]http:\\/\\/(.*?)\\/([^\\[]{1,10})\\[\\/video\\]/g html = html.replace(vide, "<br><embed src='http://$1/moogaloop.swf?clip_id=$2&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&fullscreen=1' type='application/x-shockwave-flash' wmode='transparent' allowfullscreen='true' allowscriptaccess='always' width='400' height='300'></embed><br>") } if (html.indexOf('dailymotion.com')) { vide = /\\[video\\]http:\\/\\/(.*?)\\/video\\/([^\\[]{6,110})\\[\\/video\\]/g html = html.replace(vide, "<br><embed src='http://$1/swf/video/$2' type='application/x-shockwave-flash' wmode='transparent' width='480' height='360' allowfullscreen='true'></embed><br>") } div[i].innerHTML = html}}} </script> для myspace.com сделать работу с цифровыми окончаниями от ссылки не проблема получается по той же схеме как с youtube в первом посте выглядит так: <script type="text/javascript"> var mys, html, result; var div = document.getElementsByTagName("div") for( i=0; i < div.length; i++ ) { if(div[i].className == 'postcolor') { if(div[i].innerHTML.indexOf("[myspace]")!=-1 && div[i].innerHTML.indexOf("[/myspace]")!=-1) { html = div[i].innerHTML; mys = /\\[myspace\\](.*?)\\[\\/myspace\\]/g result = html.replace(mys, "<br><embed src='http://mediaservices.myspace.com/services/media/embed.aspx/m=$1,t=1,mt=video,searchID=,primarycolor=,secondarycolor=' width='425' height='360' allowFullScreen='true' type='application/x-shockwave-flash' wmode='transparent'/></embed><br>") div[i].innerHTML = result}}} </script> но как только пытаюсь сделать работу с прямой ссылкой, (которые выглядят так http://vids.myspace.com/index.cfm?fu...id=10554 7198 http://vids.myspace.com/index.cfm?fu...id=10552 4453) начинается фигня вот регулярка Цитата:
где что упустил? (индексацию я потом прикручу, мне бы с прямыми ссылками разобраться) |
Часовой пояс GMT +3, время: 04:20. |