/* 1 - картинки не отображаются, 0 - отображаются */ var img_no = 0;
/* Функция изменения загружаемой картинки */ var id_img = 0; function imgminimum(obj) { var imgmax = 800; // максимальный размер картинки в пикселях var h = obj.height; var w = obj.width; if (h > imgmax || w > imgmax) { if (h > w) { obj.height = imgmax } else { obj.width = imgmax } }; if (!obj.id) { var scr = document.getElementById("leftdiv"); if (parent.left.document.compatMode != 'BackCompat') scr = parent.left.document.documentElement; scr.scrollTop = scr.scrollHeight; obj.id = id_img++; } }
// начало обработки тега media if (img_no == 0) { text = text.replace(/\[media\]((?:http|https):\/\/(.*?)\.(gif|jpg|jpeg|bmp|png|tif|tiff))\[\/media\]/mig, '<br><a href="$1" target="_blank" ><img onload=parent.imgminimum(this) src=$1 title="открыть в новом окне" alt="" border=0></a> ') } else { text = text.replace(/\[media\]((?:http|https):\/\/(.*?)\.(gif|jpg|jpeg|bmp|png|tif|tiff))\[\/media\]/mig, '<a href=./index.php?inc=go&url=$1 target=_blank><img src=http://mpchat.com/blank/img/ftp/img.gif border=0 alt=""> $2.$3</a>') }; if (img_no == 1) { text = text.replace(/\[media\](http:\/\/(.*?))\[\/media\]/mig, '<a href=./index.php?inc=go&url=$1 target=_blank>$1</a>') }; text = text.replace(/\[media\](http:\/\/zoom\.it\/(.*?))\[\/media\]/mig, '<script src="$1.js?width=auto&height=400px"></script><a href="$1" target="_blank" title="ссылка откроется в новом окне">link</a>'); text = text.replace(/\[media\](http:\/\/www\.divshare\.com\/download\/(.*?))\[\/media\]/mig, '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="335" height="28" id="divplaylist">' + '<param name="movie" value="http://www.divshare.com/flash/playlist?myId=$2" />' + '<param name="allowScriptAccess" value="always" />' + '<embed src="http://www.divshare.com/flash/playlist?myId=$2" width="335" height="28" allowScriptAccess="always" name="divplaylist" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>' + '</object>'); text = text.replace(/\[media\](http:\/\/prostopleer\.com\/tracks\/(.*?))\[\/media\]/mig, '<object width="411" height="28"><param name="movie" value="http://embed.prostopleer.com/track?id=$2"></param><embed src="http://embed.prostopleer.com/track?id=$2" type="application/x-shockwave-flash" width="411" height="28"></embed></object>'); text = text.replace(/\[media\]http:\/\/music\.yandex\.ru\/#!\/track\/(.*?)\/album\/(.*?)\[\/media\]/mig, '<object width="350" height="28"><param name="muz" value="http://music.yandex.ru/embed/$1/track.swf"/><param value="noscale" name="scale"/><param value="bg-color=%23D8D8D8&text-color=%23555555&hover-text-color=%23000000" name="flashvars"/><embed type="application/x-shockwave-flash" width="350" height="28" scale="noscale" flashvars="bg-color=%23D8D8D8&text-color=%23555555&hover-text-color=%23000000" src="http://music.yandex.ru/embed/$1/track.swf"/></object>'); text = text.replace(/\[media\](http:\/\/.*mp3)\[\/media\]/mig, '<embed type="application/x-shockwave-flash" src="http://mpchat.com/blank/player.swf" allowfullscreen="false" flashvars="file=$1&autostart=false" width="250" height="20">'); var vidregxp = []; //через запятую - название, регэксп, реплэйс, метод внедрения (1 - embed, 2 - iframe, 3 - embed через x-mplayer2) vidregxp[0] = ["videofile", "(http:\/\/(.*\\.)(rmi|wmv|midi|mid|mpg|wav|snd|wma|mpeg|avi|mpe|m1v|mpa|aifc|aiff|au|aif|swf))", "$1", 3]; vidregxp[1] = ["flv", "(http:\/\/.*\\.flv)", '"http://mpchat.com/blank/player.swf" flashvars="file=$1&autostart=false"', 1]; vidregxp[2] = ["rutube.ru", "(http:\/\/)(rutube\.ru\/)\\S+\\?v=(\\S+)", "$1video.$2$3", 1]; vidregxp[3] = ["youtube.com", "(http:\/\/www\.youtube\.com\/)\\S+(\\?v|&v)=(\\S+)", "$1v/$3&hl=ru_RU&fs=1", 1]; vidregxp[4] = ["youtu.be", "(http:\/\/youtu\.be\/)(\\S+)", "http://www.youtube.com/embed/$2", 2]; vidregxp[5] = ["lovi.tv", "(http:\/\/lovi\.tv\/video\/)\\S+?Code=(\\S+)", "$1sharer.php?Code=$2&Width=280&Height=224", 2]; vidregxp[6] = ["lovi.tv2", "(http:\/\/loovi\.tv\/)video\/(\\S+)\/", "$1flash/player5.swf?config=/video/config.php?Code=$2", 1]; vidregxp[7] = ["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] = ["metacafe.com", "(http:\/\/www\.metacafe\.com\/)watch(\\S+)\/?", "$1fplayer$2.swf", 1]; vidregxp[9] = ["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] = ["video.google.com", "(http:\/\/video\.google\.com\/)\\S+docid=(\\S+)&\\S+", "$1googleplayer.swf?docid=$2&hl=ru&fs=true", 1]; vidregxp[11] = ["dailymotion.com", "(http:\/\/www\.dailymotion\.com\/)video\/([^_+]+)\\S+", "$1swf/$2", 1]; vidregxp[12] = ["5min.com", "http:\/\/www\.(5min\.com\/)\\S+-(\\d+)", "http://embed.$1$2/", 1]; vidregxp[13] = ["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] = ["gametrailers.com", "(http:\/\/www\.gametrailers\.com)\/\\S+\/(\\d+)", "$1/remote_wrap.php?umid=$2", 1]; vidregxp[15] = ["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] = ["video.libero.it", "(http:\/\/video\.libero\.it)\/app\/\\S+id=(\\S+)", '"$1/static/swf/eltvplayer.swf?id=$2.flv&ap=0"', 1]; vidregxp[17] = ["play.ukr.net", "(http:\/\/play\.ukr\.net)\/videos\/show\/(\\S+)\/", '"$1/player.swf?key=$2&StopAsking=0&self=0"', 1]; vidregxp[18] = ["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] = ["vision.rambler.ru", "(http:\/\/vision\.rambler\.ru)\/users\/(\\S+)\/", '"$1/i/e.swf?id=$2&logo=1&where=home"', 1]; vidregxp[20] = ["video.bigmir.net", "(http:\/\/video\.bigmir\.net)\/show\/(\\S+)\/", '"$1/extplayer/$2/"', 1]; vidregxp[21] = ["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] = ["irc.lv", "(http:\/\/irc\.lv)\/video\\?(id=.*)", "$1/player.swf?$2", 1]; vidregxp[23] = ["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] = ["gamestar.de", "(http:\/\/www\.gamestar\.de\/)\\S+=(\\d+)", "$1emb/player.swf?config=$1emb/getVideoData.cfm?vid=$2", 1]; vidregxp[25] = ["spike.com", "(http:\/\/www\.spike\.com\/)video\/\\S+\/(\\S+)", '"$1efp" flashvars="flvbaseclip=$2"', 1]; vidregxp[26] = ["sostav.ru", "(http:\/\/(?:www\.)?videosostav\.ru\/)video\/(\\S+)\/", "$1swf/hplayer.swf?fname=$2", 1]; vidregxp[27] = ["vkontakte.ru", "(http:\/\/vkontakte\.ru\/video\\S+hash=\\w+)", "$1", 2]; vidregxp[28] = ["vk.com", "(http:\/\/vk\.com\/video\\S+hash=\\w+)", "$1", 2]; vidregxp[29] = ["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, //ширина видеоокна viheight = 224, //высота видеоокна viwindow = document.getElementById('mediains'); 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]); viwindow.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 = ''; viwindow.style.display = 'none'; } } // конец обработки тега media t = text.split('<iframe src="'); if (t[1]) { t2 = t[1].split('" width="607" height="360" frameborder="0"></iframe>'); if (t2[0].substr(0, 19) == 'http://vk.com/video') { text = text.replace('<iframe src="' + t2[0] + '" width="607" height="360" frameborder="0"></iframe>', '<a href="' + t2[0] + '" target="_blank" title="ссылка откроется в новом окне">Видеоролик загружен!</a> '); document.getElementById('mediains').innerHTML = '<iframe src="' + t2[0] + '" width="280" height="224" frameborder="0"></iframe>'; } }
} else { text = 'Просмотр выключен'; viwindow.innerHTML = ''; viwindow.style.display = 'none'; }
/* Ники закрывающих видео: videoremover['nick']=1; */ var videoremover = []; videoremover['nick1'] = 1; videoremover['nick2'] = 1; videoremover['nick3'] = 1;
} else if(videoremover[nick]) { text = 'Просмотр выключен'; viwindow.innerHTML = ''; viwindow.style.display = 'none'; }
} else if(videoremover[nick]) { text = 'Просмотр выключен'; viwindow.innerHTML = ''; viwindow.style.display = 'none'; } else text = text.replace('[media][/media]','')
<iframe src="http://vk.com/video_ext.php?oid=13564673&id=162748388&hash=e94f88c62f6cd152&hd=3" width="607" height="360" frameborder="0"></iframe>
[media]http://vk.com/video_ext.php?oid=13564673&id=162748388&hash=e94f88c62f6cd152&hd=3[/media]
[media]http://vk.com/video_ext.php?oid=72450163&id=163273935&hash=bcfdb04e032dbc9d[/media]
<iframe src="http://vk.com/video_ext.php?oid=72450163&id=163273935&hash=bcfdb04e032dbc9d" width="607" height="360" frameborder="0"></iframe>
text = text.replace(/\[media\](http:\/\/pleer\.com\/tracks\/(.*?))\[\/media\]/mig, '<object width="550" height="42"><param name="movie" value="http://embed.pleer.com/track?id=$2"></param><embed src="http://embed.pleer.com/track?id=$2" type="application/x-shockwave-flash" width="550" height="42"></embed></object>');
/* Музебра */ text = text.replace(/\[media\](http:\/\/muzebra\.com\/(.*?))\[\/media\]/mig, '<object width="550" height="42"><param name="movie" value="http://embed.muzebra.com/player?id=$2"></param><embed src="http://embed.muzebra.com/player?id=$2" type="application/x-shockwave-flash" width="550" height="42"></embed></object>');
text = text.replace(/\[media\](http:\/\/muzebra\.com\/l\/(.*?)\/)\[\/media\]/mig, '<object width="395" height="42"><param name="movie" value="http://embed.muzebra.com/player?id=$2"></param><embed src="http://embed.muzebra.com/player?id=$2" type="application/x-shockwave-flash" width="395" height="42"></embed><param name="wmode" value="transparent"/><param name="scale" value="noscale" /></object>');