t=text.split('[video]'); if(t[1]) {t2=t[1].split('[/video]'); if(t2[0]) { if(t2[0].substr(0,25) == 'http://vkontakte.ru/video') {text=text.replace('[video]'+t2[0]+'[/video]','<a href="'+t2[0]+'" target="_blank" title="ссылка откроется в новом окне">Видеоролик загружен!</a> '); parent.users.document.getElementById('video').innerHTML='<iframe src="'+t2[0]+'" width="250" height="200" frameborder="0"></iframe>'} else { var reg_rutube = new RegExp("(http:\/\/)(rutube\.ru\/)\\S+\\?v=(\\S+)"); var reg_youtube = new RegExp("(http:\/\/www\.youtube\.com\/)\\S+\\?v=(\\S+)"); var reg_veoh = new RegExp("(http:\/\/www\.veoh\.com\/)\\S+watch\/?%?3?D?(v\\S+)"); var reg_vimeo = new RegExp("(http:\/\/vimeo\.com\/)(\\S+)"); var reg_metacafe = new RegExp("(http:\/\/www\.metacafe\.com\/)watch(\\S+)\/?"); var reg_spike = new RegExp("(http:\/\/www\.spike\.com\/)video\/\\S+\/(\\S+)"); var reg_myspace = new RegExp("http:\/\/vids\.(myspace\.com\/)\\S+videoid=(\\S+)"); var reg_google = new RegExp("(http:\/\/video\.google\.com\/)\\S+docid=(\\S+)&\\S+"); var reg_dailymotion = new RegExp("(http:\/\/www\.dailymotion\.com\/)video\/([^_+]+)\\S+"); var reg_5min = new RegExp("http:\/\/www\.(5min\.com\/)\\S+-(\\d+)"); var reg_gamestar = new RegExp("(http:\/\/www\.gamestar\.de\/)\\S+=(\\d+)"); var reg_mail = new RegExp("http:\/\/(video\.mail\.ru)\/(\\S+)\/(\\S+)\/(\\S+)\/(\\S+)\.html"); var reg_gametrailers = new RegExp("(http:\/\/www\.gametrailers\.com)\/\\S+\/(\\d+)"); var reg_yahoo = new RegExp("(http:\/\/video\.yahoo\.com)\/watch\/(\\d+)\/(\\d+)"); var reg_libero = new RegExp("(http:\/\/video\.libero\.it)\/app\/\\S+id=(\\S+)"); var reg_ukr = new RegExp("(http:\/\/play\.ukr\.net)\/videos\/show\/(\\S+)\/"); var reg_online = new RegExp("(http:\/\/video\.online\.ua)\/(\\S+)\/"); var reg_rambler = new RegExp("(http:\/\/vision\.rambler\.ru)\/users\/(\\S+)\/"); var reg_bigmir = new RegExp("(http:\/\/video\.bigmir\.net)\/show\/(\\S+)\/"); var reg_sibnet = new RegExp("http:\/\/(video\.sibnet\.ru)\/\\S*?video(\\d+)\/"); var reg_irc = new RegExp("(http:\/\/irc\.lv)\/video\\?(id=.*)"); var reg_swf = new RegExp("(http:\/\/(.*\\.)(mp3|flv))"); var src = t2[0].replace(reg_rutube,"$1video.$2$3"); src = src.replace(reg_youtube,"$1v/$2&hl=ru_RU&fs=1"); src = src.replace(reg_veoh, "$1static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.4.9.1006&permalinkId=$2&player=videodetailsembedded&videoAutoPlay=0&id=anonymous"); src = src.replace(reg_vimeo, "$1moogaloop.swf?clip_id=$2&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1"); src = src.replace(reg_metacafe, "$1fplayer$2.swf"); src = src.replace(reg_spike, '"$1efp" flashvars="flvbaseclip=$2"'); src = src.replace(reg_myspace, 'http://mediaservices.$1services/media/embed.aspx/m=$2,t=1,mt=video'); src = src.replace(reg_google, '$1googleplayer.swf?docid=$2&hl=ru&fs=true'); src = src.replace(reg_dailymotion, '$1swf/$2'); src = src.replace(reg_5min, 'http://embed.$1$2/'); src = src.replace(reg_gamestar, '$1emb/player.swf?config=$1emb/getVideoData.cfm?vid=$2'); src = src.replace(reg_mail, 'http://img.mail.ru/r/video2/player_v2.swf?par=http://content.$1/$2/$3/$4/$$$5$$0$39&imaginehost=$1&perlhost=$1&alias=$2&username=$3&albumid=$4&id=$5&catalogurl=http://video.mail.ru/themes/clips'); src = src.replace(reg_gametrailers, '$1/remote_wrap.php?umid=$2'); src = src.replace(reg_yahoo, '"http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.46" flashVars="id=$3&vid=$2&lang=en-us&intl=us"'); src = src.replace(reg_libero, '"$1/static/swf/eltvplayer.swf?id=$2.flv&ap=0"'); src = src.replace(reg_ukr, '"$1/player.swf?key=$2&StopAsking=0&self=0"'); src = src.replace(reg_online, '"http://i.online.ua/mplayer/player_logo.swf?file=$1/playlist/$2.xml&autostart=false&javascriptid=media_player&enablejs=true"'); src = src.replace(reg_rambler, '"$1/i/e.swf?id=$2&logo=1&where=home"'); src = src.replace(reg_bigmir, '"$1/extplayer/$2/"'); src = src.replace(reg_sibnet, '"http://$1/mediaplayer.swf" flashvars="file=http%3A%2F%2F$1%2Fupload%2Fvideo%2F$2.flv&image=http%3A%2F%2F$1%2Fupload%2Fcover%2Fvideo_$2_0.jpg"'); src = src.replace(reg_irc, '$1/player.swf?$2'); var autostart='true'; if(loaded==0) autostart='false'; if (src==t2[0]&&src.match(reg_swf))src = src.replace(reg_swf, '"http://mpchat.com/blank/player.swf" flashvars="file='+t2[0]+'&autostart='+autostart+'"'); var type = "application/x-shockwave-flash"; var file_tipe = new RegExp("(http:\/\/(.*\\.)(rmi|wmv|midi|mid|mpg|wav|snd|wma|mpeg|avi|mpe|m1v|mpa|aifc|aiff|au|aif|swf))"); if (src==t2[0]&&src.match(file_tipe)) type = "application/x-mplayer2"; if (src==t2[0]&&!src.match(file_tipe)){parent.users.document.getElementById('video').innerHTML='Данный тип файлов не поддерживается или неверная ссылка'} else {parent.users.document.getElementById('video').innerHTML='<embed src='+src+' type='+type+' allowscriptaccess=always allowfullscreen=true width=250 height=200></embed>'}; text=text.replace('[video]'+t2[0]+'[/video]','<a href="'+t2[0]+'" target="_blank" title="ссылка откроется в новом окне">Видеоролик загружен!</a> ')}} else {text='Просмотр выключен';parent.users.document.getElementById('video').innerHTML=''}}
[video]http://vkontakte.ru/video_ext.php?oid=9673837&id=160821682&hash=1d9d798019255db6&hd=1[/video]
var reg_youtube = new RegExp("(http:\/\/www\.youtube\.com\/)\\S+\\?v=(\\S+)"); и src = src.replace(reg_youtube,"$1v/$2&hl=ru_RU&fs=1");
var vidregxp = [];//через запятую - название, регэксп, реплэйс, метод внедрения (1 - embed, 2 - iframe, 3 - embed через x-mplayer2) vidregxp[0] = new Array("videofile","(http:\/\/(.*\\.)(rmi|wmv|midi|mid|mpg|wav|snd|wma|mpeg|avi|mpe|m1v|mpa|aifc|aiff|au|aif|swf))","$1",3); vidregxp[1] = new Array("flv","(http:\/\/.*\\.flv)",'"http://mpchat.com/blank/player.swf" flashvars="file=$1&autostart=false"',1); vidregxp[2] = new Array("rutube.ru","(http:\/\/)(rutube\.ru\/)\\S+\\?v=(\\S+)","$1video.$2$3",1); vidregxp[3] = new Array("youtube.com","(http:\/\/www\.youtube\.com\/)\\S+\\?v=(\\S+)","$1v/$2&hl=ru_RU&fs=1",1); vidregxp[4] = new Array("youtu.be","(http:\/\/youtu\.be\/)(\\S+)","http://www.youtube.com/embed/$2",2); vidregxp[5] = new Array("lovi.tv","(http:\/\/lovi\.tv\/video\/)\\S+?Code=(\\S+)","$1sharer.php?Code=$2&Width=280&Height=224",2); vidregxp[6] = new Array("lovi.tv2","(http:\/\/loovi\.tv\/)video\/(\\S+)\/","$1flash/player5.swf?config=/video/config.php?Code=$2",1); vidregxp[7] = new Array("vimeo.com","(http:\/\/vimeo\.com\/)(\\S+)","$1moogaloop.swf?clip_id=$2&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1",1); vidregxp[8] = new Array("metacafe.com","(http:\/\/www\.metacafe\.com\/)watch(\\S+)\/?","$1fplayer$2.swf",1); vidregxp[9] = new Array("vids.myspace.com","http:\/\/vids\.(myspace\.com\/)\\S+videoid=(\\S+)","http://mediaservices.$1services/media/embed.aspx/m=$2,t=1,mt=video",1); vidregxp[10] = new Array("video.google.com","(http:\/\/video\.google\.com\/)\\S+docid=(\\S+)&\\S+","$1googleplayer.swf?docid=$2&hl=ru&fs=true",1); vidregxp[11] = new Array("dailymotion.com","(http:\/\/www\.dailymotion\.com\/)video\/([^_+]+)\\S+","$1swf/$2",1); vidregxp[12] = new Array("5min.com","http:\/\/www\.(5min\.com\/)\\S+-(\\d+)","http://embed.$1$2/",1); vidregxp[13] = new Array("video.mail.ru","http:\/\/(video\.mail\.ru)\/(\\S+)\/(\\S+)\/(\\S+)\/(\\S+)\.html","http://img.mail.ru/r/video2/player_v2.swf?par=http://content.$1/$2/$3/$4/$$$5$$0$39&imaginehost=$1&perlhost=$1&alias=$2&username=$3&albumid=$4&id=$5&catalogurl=http://video.mail.ru/themes/clips",1); vidregxp[14] = new Array("gametrailers.com","(http:\/\/www\.gametrailers\.com)\/\\S+\/(\\d+)","$1/remote_wrap.php?umid=$2",1); vidregxp[15] = new Array("video.yahoo.com","(http:\/\/video\.yahoo\.com)\/watch\/(\\d+)\/(\\d+)",'"http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.46" flashVars="id=$3&vid=$2&lang=en-us&intl=us"',1); vidregxp[16] = new Array("video.libero.it","(http:\/\/video\.libero\.it)\/app\/\\S+id=(\\S+)",'"$1/static/swf/eltvplayer.swf?id=$2.flv&ap=0"',1); vidregxp[17] = new Array("play.ukr.net","(http:\/\/play\.ukr\.net)\/videos\/show\/(\\S+)\/",'"$1/player.swf?key=$2&StopAsking=0&self=0"',1); vidregxp[18] = new Array("video.online.ua","(http:\/\/video\.online\.ua)\/(\\S+)\/",'"http://i.online.ua/mplayer/player_logo.swf?file=$1/playlist/$2.xml&autostart=false&javascriptid=media_player&enablejs=true"',1); vidregxp[19] = new Array("vision.rambler.ru","(http:\/\/vision\.rambler\.ru)\/users\/(\\S+)\/",'"$1/i/e.swf?id=$2&logo=1&where=home"',1); vidregxp[20] = new Array("video.bigmir.net","(http:\/\/video\.bigmir\.net)\/show\/(\\S+)\/",'"$1/extplayer/$2/"',1); vidregxp[21] = new Array("sibnet.ru","http:\/\/(video\.sibnet\.ru)\/\\S*?video(\\d+)\/",'"http://$1/mediaplayer.swf" flashvars="file=http%3A%2F%2F$1%2Fupload%2Fvideo%2F$2.flv&image=http%3A%2F%2F$1%2Fupload%2Fcover%2Fvideo_$2_0.jpg"',1); vidregxp[22] = new Array("irc.lv","(http:\/\/irc\.lv)\/video\\?(id=.*)","$1/player.swf?$2",1); vidregxp[23] = new Array("veoh.com","(http:\/\/www\.veoh\.com\/)\\S+watch\/?%?3?D?(v\\S+)","$1static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.4.9.1006&permalinkId=$2&player=videodetailsembedded&videoAutoPlay=0&id=anonymous",1); vidregxp[24] = new Array("gamestar.de","(http:\/\/www\.gamestar\.de\/)\\S+=(\\d+)","$1emb/player.swf?config=$1emb/getVideoData.cfm?vid=$2",1); vidregxp[25] = new Array("spike.com","(http:\/\/www\.spike\.com\/)video\/\\S+\/(\\S+)",'"$1efp" flashvars="flvbaseclip=$2"',1); vidregxp[26] = new Array("sostav.ru","(http:\/\/videosostav\.ru\/)video\/(\\S+)\/","$1swf/player480297.swf?fname=$2",1); vidregxp[27] = new Array("vkontakte.ru","(http:\/\/vkontakte\.ru\/video\\S+hash=\\w+)","$1",2); vidregxp[28] = new Array("smotri.com","http:\/\/smotri\.com\/video\/\\S+id=(\\S+)","http://pics.smotri.com/player.swf?file=$1&bufferTime=3&autoStart=false&str_lang=rus&xmlsource=http%3A%2F%2Fpics.smotri.com%2Fcskins%2Fblue%2Fskin_color.xml&xmldatasource=http%3A%2F%2Fpics.smotri.com%2Fskin_ng.xml",1); t = text.split('[media]'); if (t[1]) { var viwidth = 280; //ширина видеоокна var viheight = 224; //высота видеоокна var viborder = parent.users.document.getElementById('mediaborder'); var viwindow = parent.users.document.getElementById('mediains'); var viautor = parent.users.document.getElementById('mediaautor'); t2=t[1].split('[/media]'); if (t2[0]) { var src = t2[0]; var expr; for (var i = 0; i < vidregxp.length; i++) { expr = new RegExp(vidregxp[i][1]); if (src.match(expr)) { src = src.replace(expr,vidregxp[i][2]); viautor.innerHTML = nick + ': см. ' + time; viborder.style.display = 'block'; if (vidregxp[i][3] == 1) { //грузим в embed через x-shockwave-flash text = text.replace('[media]' + t2[0] + '[/media]','<a href="' + t2[0] + '" target="_blank" title="ссылка откроется в новом окне">Видеоролик загружен!</a>'); viwindow.innerHTML = '<embed width=' + viwidth + ' height=' + viheight + ' src=' + src + ' type="application/x-shockwave-flash" allowscriptaccess=always allowfullscreen=true></embed>'; } if (vidregxp[i][3] == 2) { //грузим в iframe text = text.replace('[media]' + t2[0] + '[/media]','<a href="' + t2[0] + '" target="_blank" title="ссылка откроется в новом окне">Видеоролик загружен!</a>'); viwindow.innerHTML = '<iframe width=' + viwidth + ' height=' + viheight + ' src=' + src + ' frameborder=0 allowfullscreen></iframe>'; } if (vidregxp[i][3] == 3) { //грузим в embed через x-mplayer2 text = text.replace('[media]' + t2[0] + '[/media]','<a href="' + t2[0] + '" target="_blank" title="ссылка откроется в новом окне">Видеоролик загружен!</a>'); viwindow.innerHTML = '<embed width=' + viwidth + ' height=' + viheight + ' src=' + src + ' type="application/x-mplayer2" allowscriptaccess=always allowfullscreen=true></embed>'; } } } text=text.replace('[media]'+t2[0]+'[/media]','<a href="'+t2[0]+'" target="_blank" title="ссылка откроется в новом окне">'+t2[0]+'</a>'); } else {text='Просмотр выключен'; viwindow.innerHTML=''; viautor.innerHTML=''; viborder.style.display='none';} }
t=text.split('[video]'); if(t[1]) {t2=t[1].split('[/video]'); if(t2[0]) { if(t2[0].substr(0,25) == 'http://vkontakte.ru/video') {text=text.replace('[video]'+t2[0]+'[/video]','<a href="'+t2[0]+'" target="_blank" title="ссылка откроется в новом окне">Видеоролик загружен!</a> '); document.getElementById('video').innerHTML='<iframe src="'+t2[0]+'" width="250" height="200" frameborder="0"></iframe>'} else { var reg_rutube = new RegExp("(http:\/\/)(rutube\.ru\/)\\S+\\?v=(\\S+)"); var reg_youtube = new RegExp("(http:\/\/www\.youtube\.com\/)\\S+\\?v=(\\S+)"); var reg_veoh = new RegExp("(http:\/\/www\.veoh\.com\/)\\S+watch\/?%?3?D?(v\\S+)"); var reg_vimeo = new RegExp("(http:\/\/vimeo\.com\/)(\\S+)"); var reg_metacafe = new RegExp("(http:\/\/www\.metacafe\.com\/)watch(\\S+)\/?"); var reg_spike = new RegExp("(http:\/\/www\.spike\.com\/)video\/\\S+\/(\\S+)"); var reg_myspace = new RegExp("http:\/\/vids\.(myspace\.com\/)\\S+videoid=(\\S+)"); var reg_google = new RegExp("(http:\/\/video\.google\.com\/)\\S+docid=(\\S+)&\\S+"); var reg_dailymotion = new RegExp("(http:\/\/www\.dailymotion\.com\/)video\/([^_+]+)\\S+"); var reg_5min = new RegExp("http:\/\/www\.(5min\.com\/)\\S+-(\\d+)"); var reg_gamestar = new RegExp("(http:\/\/www\.gamestar\.de\/)\\S+=(\\d+)"); var reg_mail = new RegExp("http:\/\/(video\.mail\.ru)\/(\\S+)\/(\\S+)\/(\\S+)\/(\\S+)\.html"); var reg_gametrailers = new RegExp("(http:\/\/www\.gametrailers\.com)\/\\S+\/(\\d+)"); var reg_yahoo = new RegExp("(http:\/\/video\.yahoo\.com)\/watch\/(\\d+)\/(\\d+)"); var reg_libero = new RegExp("(http:\/\/video\.libero\.it)\/app\/\\S+id=(\\S+)"); var reg_ukr = new RegExp("(http:\/\/play\.ukr\.net)\/videos\/show\/(\\S+)\/"); var reg_online = new RegExp("(http:\/\/video\.online\.ua)\/(\\S+)\/"); var reg_rambler = new RegExp("(http:\/\/vision\.rambler\.ru)\/users\/(\\S+)\/"); var reg_bigmir = new RegExp("(http:\/\/video\.bigmir\.net)\/show\/(\\S+)\/"); var reg_sibnet = new RegExp("http:\/\/(video\.sibnet\.ru)\/\\S*?video(\\d+)\/"); var reg_irc = new RegExp("(http:\/\/irc\.lv)\/video\\?(id=.*)"); var reg_swf = new RegExp("(http:\/\/(.*\\.)(mp3|flv))"); var src = t2[0].replace(reg_rutube,"$1video.$2$3"); src = src.replace(reg_youtube,"$1v/$2&hl=ru_RU&fs=1"); src = src.replace(reg_veoh, "$1static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.4.9.1006&permalinkId=$2&player=videodetailsembedded&videoAutoPlay=0&id=anonymous"); src = src.replace(reg_vimeo, "$1moogaloop.swf?clip_id=$2&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1"); src = src.replace(reg_metacafe, "$1fplayer$2.swf"); src = src.replace(reg_spike, '"$1efp" flashvars="flvbaseclip=$2"'); src = src.replace(reg_myspace, 'http://mediaservices.$1services/media/embed.aspx/m=$2,t=1,mt=video'); src = src.replace(reg_google, '$1googleplayer.swf?docid=$2&hl=ru&fs=true'); src = src.replace(reg_dailymotion, '$1swf/$2'); src = src.replace(reg_5min, 'http://embed.$1$2/'); src = src.replace(reg_gamestar, '$1emb/player.swf?config=$1emb/getVideoData.cfm?vid=$2'); src = src.replace(reg_mail, 'http://img.mail.ru/r/video2/player_v2.swf?par=http://content.$1/$2/$3/$4/$$$5$$0$39&imaginehost=$1&perlhost=$1&alias=$2&username=$3&albumid=$4&id=$5&catalogurl=http://video.mail.ru/themes/clips'); src = src.replace(reg_gametrailers, '$1/remote_wrap.php?umid=$2'); src = src.replace(reg_yahoo, '"http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.46" flashVars="id=$3&vid=$2&lang=en-us&intl=us"'); src = src.replace(reg_libero, '"$1/static/swf/eltvplayer.swf?id=$2.flv&ap=0"'); src = src.replace(reg_ukr, '"$1/player.swf?key=$2&StopAsking=0&self=0"'); src = src.replace(reg_online, '"http://i.online.ua/mplayer/player_logo.swf?file=$1/playlist/$2.xml&autostart=false&javascriptid=media_player&enablejs=true"'); src = src.replace(reg_rambler, '"$1/i/e.swf?id=$2&logo=1&where=home"'); src = src.replace(reg_bigmir, '"$1/extplayer/$2/"'); src = src.replace(reg_sibnet, '"http://$1/mediaplayer.swf" flashvars="file=http%3A%2F%2F$1%2Fupload%2Fvideo%2F$2.flv&image=http%3A%2F%2F$1%2Fupload%2Fcover%2Fvideo_$2_0.jpg"'); src = src.replace(reg_irc, '$1/player.swf?$2'); var autostart='true'; if(loaded==0) autostart='false'; if (src==t2[0]&&src.match(reg_swf))src = src.replace(reg_swf, '"http://mpchat.com/blank/player.swf" flashvars="file='+t2[0]+'&autostart='+autostart+'"'); var type = "application/x-shockwave-flash"; var file_tipe = new RegExp("(http:\/\/(.*\\.)(rmi|wmv|midi|mid|mpg|wav|snd|wma|mpeg|avi|mpe|m1v|mpa|aifc|aiff|au|aif|swf))"); if (src==t2[0]&&src.match(file_tipe)) type = "application/x-mplayer2"; if (src==t2[0]&&!src.match(file_tipe)){document.getElementById('video').innerHTML='Данный тип файлов не поддерживается или неверная ссылка'} else {document.getElementById('video').innerHTML='<embed src='+src+' type='+type+' allowscriptaccess=always allowfullscreen=true width=250 height=200></embed>'}; text=text.replace('[video]'+t2[0]+'[/video]','<a href="'+t2[0]+'" target="_blank" title="ссылка откроется в новом окне">Видеоролик загружен!</a> ')}} else {text='Просмотр выключен';document.getElementById('video').innerHTML=''}}