// Examples
// FORUM.set('editor.quote.username_append', ", ");
// console.log(FORUM.get('editor.quote.username_append'));
// FORUM.set("editor.link.short_url", function() { return false; });
// console.log(FORUM.get("editor.link.short_url()"));
FORUM.set('editor', new Object({
settings : {
autofocus: 'enabled'
},
font : {
name : 'Шрифт',
onclick : function() { changeVisibility('font-area'); },
container : 'font-area',
fonts : ['Arial', 'Arial Black', 'Arial Narrow', 'Book Antiqua', 'Century Gothic', 'Comic Sans Ms', 'Courier New', 'Fixedsys', 'Franklin Gothic Medium', 'Garamond', 'Georgia', 'Impact', 'Lucida Console', 'Microsoft Sans Serif', 'Palatino Linotype', 'System', 'Tahoma', 'Times New Roman', 'Trebuchet Ms', 'Verdana']
},
size : {
name : 'Размер',
onclick : function() { changeVisibility('size-area'); },
container : 'size-area',
sizes : [8,10,12,14,16,18,20],
unit : 'px'
},
bold : {
name : 'Жирный',
onclick : function() { bbcode('[b]','[/b]'); }
},
italic : {
name : 'Наклонный',
onclick : function() { bbcode('[i]','[/i]'); }
},
underline : {
name : 'Подчеркнутый',
onclick : function() { bbcode('[u]','[/u]'); }
},
strike : {
name : 'Зачеркнутый',
onclick : function() { bbcode('[s]','[/s]'); }
},
left : {
name : 'Выравнивание по левому краю',
onclick : function() { bbcode('[align=left]','[/align]'); }
},
center : {
name : 'Выравнивание по центру',
onclick : function() { bbcode('[align=center]','[/align]'); }
},
right : {
name : 'Выравнивание по правому краю',
onclick : function() { bbcode('[align=right]','[/align]'); }
},
link : {
name : 'Ссылка',
onclick : function() { tag_url(); },
link_url : function() { return prompt('Поместите ссылку веб-страницы', 'http://'); },
link_title : function() { return prompt('Введите название ссылки', 'Ссылка'); },
short_url : function(link) { return (link.indexOf('http://'+window.location.hostname+'/') != -1) ? false : confirm('Сократить ссылку?'); },
invalid_link : function() { return alert('Неверный формат ссылки'); }
},
email : {
name : 'E-mail',
onclick : function() { bbcode('[email]','[/email]'); },
email_address : function() { return prompt('Поместите e-mail адрес', ''); }
},
image : {
name : 'Изображение',
onclick : function() { changeVisibility('image-area'); },
container : 'image-area',
img_append : '\\n',
img_bbcodes : {
viewer : {
name : 'Превью',
format : function(host, name, link, thumb_link, append) { return '[url=http://'+host+'/?v='+name+'][img]'+thumb_link+'[/img][/url]'+append; },
selected : true
},
to_source : {
name : 'Прямая ссылка',
format : function(host, name, link, thumb_link, append) { return '[url='+link+'][img]'+thumb_link+'[/img][/url]'+append; },
selected : false
},
source : {
name : 'Оригинал',
format : function(host, name, link, thumb_link, append) { return '[img]'+link+'[/img]'+append; },
selected : false
}
},
image_resize : {
name : 'Уменьшить до:',
sizes : [640,800,1024,1280],
selected: false
},
thumb_resize : {
name : 'Ширина превью:',
sizes : [120,160,240,360,480,640],
selected: 240
},
pixels : 'пикселей',
image_url : function() { return prompt('Поместите ссылку изображения', 'http://'); },
confirm_delete : function() { return confirm('Вы действительно хотите удалить загруженные файлы с сервера?'); }
},
video : {
name : 'Видео',
onclick : function() { changeVisibility('video-area'); },
container : 'video-area',
hosts : ['youtube.com', 'video.mail.ru', 'rutube.ru', 'video.yandex.ru', 'vkontakte.ru', 'smotri.com', 'video.bigmir.net', 'video.i.ua', 'video.google.com', 'vimeo.com', 'metacafe.com', 'vids.myspace.com', 'dailymotion.com', 'facebook.com', '24video.net', 'kiwi.kz', '1tv.ru', 'ntv.ru', 'rutv.ru', '5-tv.ru']
},
hide : {
name : 'Скрытый текст',
onclick : function() { tag_hide(); },
hide_num_posts : function() { return prompt('Введите минимум сообщений для просмотра текста', ''); }
},
quote : {
name : 'Цитата',
onclick : function() { bbcode('[quote]','[/quote]'); },
username_append : '\n',
quote_fail : function() { return alert('Не выделен текст для цитирования'); }
},
code : {
name : 'Код',
onclick : function() { bbcode('[code]','[/code]'); }
},
color : {
name : 'Цвет',
onclick : function() { changeVisibility('color-area'); },
container : 'color-area',
colors : ['black', 'silver', 'gray', 'white', 'maroon', 'red', 'purple', 'fuchsia', 'green', 'lime', 'olive', 'yellow', 'navy', 'blue', 'teal', 'aqua']
},
smile : {
name : 'Смайлик',
onclick : function() { smilies(); },
container : 'smilies-area'
},
keyboard : {
name : 'Виртуальная клавиатура',
onclick : function() { changeVisibility('keyboard-area'); },
container : 'keyboard-area',
keys : ['Tab', 'Й', 'Ц', 'У', 'К', 'Е', 'Н', 'Г', 'Ш', 'Щ', 'З', 'Х', 'Ъ', 'Back', '_NL_', 'Caps', 'Ф', 'Ы', 'В', 'А', 'П', 'Р', 'О', 'Л', 'Д', 'Ж', 'Э', 'Enter', '_NL_', '!', '?', 'Я', 'Ч', 'С', 'М', 'И', 'Т', 'Ь', 'Б', 'Ю', 'Ё', ',', '.', '_NL_', '@', '©', '®', '™', ' Space ', '«', '»', '/', '—', '•']
}
}));
var deleteImages = new Object(); var Capspos = false; var theSelection = false; var lastSelection;
function insert(text)
{
$('#main-reply').focus();
if ($.browser.msie){
if (lastSelection){
$('#main-reply').setSelection(lastSelection.start, lastSelection.end);
}
}
$("#main-reply").collapseSelection();
theSelection = $('#main-reply').getSelection();
$("#main-reply").insertText(text, theSelection.start, true);
if ($.browser.opera){
var lineBreaks = text.match(/\n/g);
if (lineBreaks != null && lineBreaks.length > 0){
var endPosition = $('#main-reply').getSelection().end;
$('#main-reply').setSelection(endPosition + lineBreaks.length + 1, endPosition + lineBreaks.length + 1);
$("#main-reply").collapseSelection();
}
}
$('#main-reply').focus();
theSelection = $('#main-reply').getSelection();
if ($.browser.msie)
lastSelection = theSelection;
return false;
}
function bbcode(bbopen, bbclose)
{
$('#main-reply').focus();
if ($.browser.msie){
if (lastSelection){
$('#main-reply').setSelection(lastSelection.start, lastSelection.end);
}
}
theSelection = $('#main-reply').getSelection();
$('#main-reply').surroundSelectedText(bbopen, bbclose);
$('#main-reply').focus();
theSelection = $('#main-reply').getSelection();
if ($.browser.msie)
lastSelection = theSelection;
return false;
}
function quote(username, post_id, no_repeat)
{
var theSelection = '';
if (window.getSelection && !$.browser.opera)
{
theSelection = window.getSelection().toString();
}
else if (document.getSelection)
{
theSelection = document.getSelection();
}
else if (document.selection)
{
theSelection = document.selection.createRange().text;
}
if (theSelection == '' || typeof theSelection == 'undefined' || theSelection == null)
{
var postContent = document.getElementById('p'+post_id+'-content');
if ($.browser.msie) {
var range = document.body.createTextRange();
range.moveToElementText(postContent);
range.select();
theSelection = document.selection.createRange().text;
} else if ($.browser.mozilla) {
var selection = window.getSelection();
var range = document.createRange();
range.selectNodeContents(postContent);
selection.removeAllRanges();
selection.addRange(range);
theSelection = window.getSelection().toString();
} else {
var theSelection = '';
$('#p'+post_id+'-content > p').each(function(index){
p = $(this).html().replace(/
/gi, '\n');
el = $('
');
$(el).append(p);
theSelection += $(el).text()+'\n\n';
});
theSelection = theSelection.replace(/\r\n/g, '\n').replace(/\n\n\n/g, '\n\n');
}
if (theSelection == '' || typeof theSelection == 'undefined' || theSelection == null){
FORUM.get('editor.quote.quote_fail()');
return;
}
}
if ($.browser.mozilla && theSelection.indexOf('http://') != -1){
var cachedResults = new Array();
var currentSrc = '';
$('#p'+post_id+'-content img').each(function(index) {
currentSrc = $(this).attr('src');
if (cachedResults.length > 0 && cachedResults.join(',').indexOf(currentSrc) != -1) return;
theSelection = theSelection.replace(new RegExp(currentSrc,'g'), '[img]'+currentSrc+'[/img]');
cachedResults.push(currentSrc);
});
}
insert('[quote="' + username + '"]' + $.trim(theSelection) + '[/quote]' + '\n');
return;
}
function to(username)
{
insert('[b]' + username + '[/b]' + FORUM.get('editor.quote.username_append'));
}
function smile(code)
{
return insert(' ' + code + ' ');
}
function changeVisibility(id)
{
var obj = document.getElementById(id);
if (obj == null || typeof(obj) == "undefined")
return;
var current = obj.style.display;
var change = {
"none": { "display": "block" },
"block": { "display": "none" }
}
obj.style.display = change[current]["display"];
return;
}
function tag_url()
{
var link_url = FORUM.get('editor.link.link_url()');
if (!link_url || link_url == 'http://' || $.trim(link_url) == '') return false;
var link_title = FORUM.get('editor.link.link_title()');
if (!link_title || link_title == 'http://' || $.trim(link_title) == '') link_title = link_url;
if (FORUM.get("editor.link.short_url('"+link_url+"')")){
if ($.browser.msie || $.browser.opera){
ShortURLService = 'http://'+window.location.hostname+'/bridge.php?ws=qps&url='+encodeURIComponent(link_url)+'&format=text';
}
else{
ShortURLService = 'http://qps.ru/api?url='+encodeURIComponent(link_url)+'&format=text';
}
$.get(ShortURLService, function(data){
if (data.indexOf('http://') == -1){
FORUM.get('editor.link.invalid_link()');
return false;
}
insert('[url=' + data + ']' + (link_title != link_url ? link_title : data) + '[/url]');
});
}
else{
insert('[url=' + link_url + ']' + link_title + '[/url]');
}
}
function tag_email()
{
var email_address = FORUM.get('editor.email.email_address()');
if (!email_address){
return;
}
insert('[email]' + email_address + '[/email]');
}
function tag_image()
{
var image_url = FORUM.get('editor.image.image_url()');
if (!image_url){
return;
}
insert('[img]' + image_url + '[/img]');
}
function tag_hide()
{
var hide_num_posts = FORUM.get('editor.hide.hide_num_posts()');
if (!hide_num_posts){
bbcode('[hide]','[/hide]');
}
else{
bbcode('[hide=' + hide_num_posts + ']','[/hide]');
}
}
function smilies()
{
changeVisibility('smilies-area');
if ($('#smilies-block').length > 0 && $('#smilies-block img').length == 0){
html = '';
$.each(FORUM.get('editor.smile.smilies'), function(key,value){
html += ''+'\n';
});
$('#smilies-block').append(html);
}
}
function keyboard(value)
{
$('#main-reply').focus();
if (value == 'Caps')
Capspos = !(Capspos);
else
{
if (value == 'Back'){
if ($.browser.msie){
if (lastSelection){
$('#main-reply').setSelection(lastSelection.start, lastSelection.end);
}
}
theSelection = $('#main-reply').getSelection();
$('#main-reply').setSelection(theSelection.start-1, theSelection.start);
$("#main-reply").deleteSelectedText();
theSelection = $('#main-reply').getSelection();
if ($.browser.msie)
lastSelection = theSelection;
}
else if (value == 'Tab'){
insert('\t');
}
else if (value == 'Enter'){
insert('\n');
}
else if (value == ' Space '){
insert(' ');
}
else{
var code = value.charCodeAt(0);
if (Capspos == false){
if (code == 168)
code = 184;
else if (code == 1025)
code = 1105;
else if (code >= 1025 && code <= 1071)
code = code + 32;
}
value = String.fromCharCode(code);
insert(value);
}
}
}
function create_answer()
{
var id = 1;
if ($('#variants p').length > 0){
id = parseInt($('#variants p:last').attr('id').replace('poll-option-',''))+1;
}
$('#variants').append('
Удалить
');
$('#variants #po'+id).focus();
return;
}
function remove_answer(id)
{
$('#poll-option-'+id).remove();
return;
}
function insertUploadedImage(obj){
insert(imageGenBBCode(obj));
}
function insertUploadedImages(){
$('#uploaded-images img').each(function(index, value) {
insertUploadedImage(this);
});
}
function imageGenBBCode(obj){
var format = $('#selected-insert-format').val();
var name = $(obj).attr("id");
var thumb_link = $(obj).attr("src");
var link = thumb_link.replace('uploads\.ru/t/','uploads\.ru/i/');
var server = link.match(/^http:\/\/(.*)uploads\.ru/);
var host = server ? server.slice(1)+'uploads.ru' : 'uploads.ru';
var append = FORUM.get('editor.image.img_append');
return FORUM.get("editor.image.img_bbcodes['"+format+"'].format('"+host+"', '"+name+"', '"+link+"', '"+thumb_link+"', '"+append+"')");
}
$(document).ready(function(){
if ($("#image_upload").length > 0){
$('#image_upload').uploadify({
'uploader' : '/js/uploadify/uploadify.swf',
'script' : 'http://uploads.ru/api?format=json',
'scriptAccess' : 'always',
'fileDataName' : 'upload',
'cancelImg' : '/js/uploadify/cancel.png',
'buttonImg' : '/js/uploadify/button.png',
'multi' : true,
'queueID' : 'imageQueue',
'sizeLimit' : 5242880,
'queueSizeLimit' : 100,
'onQueueFull' : function (event,queueSizeLimit) {
alert('Вы можете загрузить не более '+queueSizeLimit+' файлов за один раз!');
return false;
},
'onSelect' : function(event,queueID,fileObj) {
if (fileObj.size > 5242880) {
alert("Файл " + fileObj.name + " слишком большой!" + '\n' + "Размер файла не должен превышать 5 MB.");
$('#image_upload').uploadifyCancel(queueID);
return false;
}
},
'onSelectOnce' : function(event,data) {
if ($('#uploaded-images img').length == 0){
$('#imageQueue').css("max-height",150);
}
$('#load-image-container').show();
$('#imageQueue').show();
$('#upload-button-container').show();
if ($('#image-width').is(':empty')){
var image_resize_html = '';
$.each(FORUM.get('editor.image.image_resize.sizes'), function(key, value) {
image_resize_html += '';
});
$('#image-width').append(''+FORUM.get('editor.image.image_resize.name')+'
'+FORUM.get('editor.image.pixels'));
}
$('#image-width').show();
if ($('#image-thumb-width').is(':empty')){
var thumb_resize_html = '';
$.each(FORUM.get('editor.image.thumb_resize.sizes'), function(key, value) {
thumb_resize_html += '';
});
$('#image-thumb-width').append(''+FORUM.get('editor.image.thumb_resize.name')+'
'+FORUM.get('editor.image.pixels'));
}
$('#image-thumb-width').show();
$('#action-clean-uploaded').show();
},
'onCancel' : function(event,ID,fileObj,data) {
if ($('#imageQueue div.uploadifyQueueItem').length-1 == 0){
$('#imageQueue').hide();
$('#upload-button-container').hide();
$('#image-width').hide();
$('#image-thumb-width').hide();
if ($('#uploaded-images img').length == 0){
$('#action-clean-uploaded').hide();
$('#load-image-container').hide();
}
}
},
'onComplete': function(event,queueID,fileObj,response,data) {
var file = jQuery.parseJSON(response);
deleteImages[file.data.img_name] = file.data.delete_key;
var image_html = '';
if ($('#uploaded-images img').length == 0){
$('#imageQueue').css("max-height",66);
}
$("#uploaded-images").prepend(image_html);
$('#'+file.data.img_name.replace('.','\\.')).tipsy({gravity: 's'});
},
'onAllComplete' : function(event,data) {
$('#upload-button-container').hide();
$('#image-width').hide();
$('#image-thumb-width').hide();
$('#imageQueue').hide();
$('#uploaded-images').show();
if ($('#image-insert-format').is(':empty')){
var bbcodes_html = '';
$.each(FORUM.get('editor.image.img_bbcodes'), function(key, value) {
bbcodes_html += '';
});
$('#image-insert-format').append('Вставить как:
');
}
$('#image-insert-format').show();
$('#insert-all-images-container').show();
$('#insert-image-tip').show();
$('#action-insert-uploaded').show();
$('#action-clean-uploaded').show();
$('#action-drop-files').show();
},
'fileExt' : '*.jpg;*.jpeg;*.png;*.gif;*.bmp',
'fileDesc' : 'Image Files (.JPG, .PNG, .GIF, .BMP)'
});
}
});
$(document).ready(function(){
if ($("#main-reply").length > 0){
$('#action-computer').click(function(){
$('#image-area-sels').hide();
$('#image-area-tcon-computer').show();
$('#image-area-actions').show();
if ($('#uploaded-images img').length > 0){
$('#action-insert-uploaded').show();
$('#action-clean-uploaded').show();
$('#action-drop-files').show();
}
if ($('#imageQueue div.uploadifyQueueItem').length > 0)
$('#action-clean-uploaded').show();
return false;
});
$('#action-internet').click(function(){
$('#image-area-sels').hide();
$('#image-area-tcon-internet').show();
$('#image-area-actions').show();
if ($('#image-area-tinp').val() != '' || $.browser.msie){
$('#action-insert-textarea').show();
$('#action-clean-textarea').show();
}
return false;
});
$('#action-drop-files').click(function(){
if (!FORUM.get('editor.image.confirm_delete()'))
return false;
cleanImages();
var delete_url = 'http://uploads.ru/api?action=delete';
if ($.browser.msie && window.XDomainRequest){
var params = '';
for (var key in deleteImages) {
params += (params?'&':'')+'img%5B'+key+'%5D='+deleteImages[key];
}
var xdr = new XDomainRequest();
xdr.open("POST", delete_url);
xdr.send(params);
}
else if ($.browser.msie && parseInt($.browser.version, 10) < 7){
$.post('http://'+window.location.hostname+'/bridge.php?ws=uploads&action=delete', { 'img': deleteImages });
}
else {
$.post(delete_url, { 'img': deleteImages });
}
deleteImages = {};
return false;
});
$('#action-clean-textarea').click(function(){
$('#image-area-tinp').val('');
if (!$.browser.msie){
$('#action-insert-textarea').hide();
$('#action-clean-textarea').hide();
}
return false;
});
$('#action-clean-uploaded').click(function(){
cleanImages();
deleteImages = {};
return false;
});
$('#action-insert-textarea').click(function(){
var imagelinks = $('#image-area-tinp').val().replace(/\r\n/g, "\n").split(/\n/);
for (key in imagelinks) {
if ($.trim(imagelinks[key]).length > 0){
insert(FORUM.get("editor.image.img_bbcodes.source.format(false,false,'"+imagelinks[key]+"',false,'"+FORUM.get('editor.image.img_append')+"')"));
}
}
changeVisibility('image-area');
return false;
});
$('#action-insert-uploaded').click(function(){
insertUploadedImages();
changeVisibility('image-area');
return false;
});
$('#action-close').click(function(){
changeVisibility('image-area');
return false;
});
$('#action-return').click(function(){
$('#image-area-tcon-internet').hide();
$('#image-area-tcon-computer').hide();
$('#image-area-actions').hide();
$('#action-insert-textarea').hide();
$('#action-clean-textarea').hide();
$('#insert-image-tip').hide();
$('#action-insert-uploaded').hide();
$('#action-clean-uploaded').hide();
$('#action-drop-files').hide();
$('#image-area-sels').show();
return false;
});
$('#upload-button-container img').click(function(){
$('#upload-button-container').hide();
$('#image-width').hide();
$('#image-thumb-width').hide();
$('#image_upload').uploadifySettings('scriptData',{'thumb_width':$('#selected-thumb-width').val(), 'image_width':$('#selected-image-width').val()});
$('#image_upload').uploadifyUpload();
});
function cleanImages(){
$('#image_upload').uploadifyClearQueue();
$('#uploaded-images').empty();
$('#uploaded-images').hide();
$('#image-insert-format').hide();
$('#insert-all-images-container').hide();
$('#insert-image-tip').hide();
$('#action-insert-uploaded').hide();
$('#action-clean-uploaded').hide();
$('#action-drop-files').hide();
$('#load-image-container').hide();
$('#imageQueue').hide();
$('#upload-button-container').hide();
$('#image-width').hide();
$('#image-thumb-width').hide();
}
$('#image-area-tinp').bind('keyup select click mouseout', function(){
if ($(this).val() == '' && !$.browser.msie){
$('#action-insert-textarea').hide();
$('#action-clean-textarea').hide();
}
else {
$('#action-insert-textarea').show();
$('#action-clean-textarea').show();
}
});
if ($.browser.msie){
$('#main-reply').bind('keyup select click mouseout', function() {
lastSelection = $(this).getSelection();
});
}
$('#main-reply').mouseover(function() {
if (FORUM.get('editor.settings.autofocus') == 'enabled' && document.activeElement.tagName.toLowerCase() != 'input' && document.activeElement.tagName.toLowerCase() != 'textarea'){
$(this).focus();
if ($.browser.msie){
if (lastSelection){
$(this).setSelection(lastSelection.start, lastSelection.end);
}
lastSelection = $(this).getSelection();
}
}
});
$('#post input').mouseover(function() {
if (FORUM.get('editor.settings.autofocus') == 'enabled' && document.activeElement.tagName.toLowerCase() != 'input' && document.activeElement.tagName.toLowerCase() != 'textarea'){
$(this).focus();
}
});
}
});
function MYBB_bindVideoScript() {
if (window.MYBB_VideoScript && window.MYBB_bindVideoScriptITV) {
try { clearInterval(window.MYBB_bindVideoScriptITV); window.MYBB_bindVideoScriptITV=false; } catch(e) {}
return false;
}
var R = document.getElementById("video-area");
var Ac = R.getElementsByTagName("a");
if(Ac) {
var p=Ac.length;
for(var i=0; i=0)) {
e.onclick=function(el) { return function(){ MYBB_vsc.reInit(); MYBB_vsc.clickHost(el); return false; }; }(e);
}
}
}
// alert("vsc run");
window.MYBB_VideoScript = true;
return true;
}
function MYBB_fvs(t) {
MYBB_vsc.reInit();
MYBB_vsc.clickHost(t);
return false;
}
function MYBB_vsi(o,e) {
if(o.getElementsByTagName('a').item(0).onclick==undefined) {
MYBB_bindVideoScript();
var e=(e&&e[0])?e[0]:window.event;
var t=e.srcElement||e.target;
if(t&&t.tagName&&t.tagName.toLowerCase()=="a") {
MYBB_fvs(t);
}
}
}
var MYBB_vsc={
cH: null,
RG: {
"youtube.com":{
l:"1",t:"youtube.com",x:/v[=\/]([A-Za-z0-9_-]+)(?:[^A-Za-z0-9_-]|$)/,
nf:"http://www.youtube.com/watch?v=%TOKEN%"
},
"smotri.com":{
l:"1",t:"smotri.com",x:/(?:id|file)=(\w+)/,
nf:"http://smotri.com/video/view/?id=%TOKEN%"
},
"video.mail.ru": {
// corp/afisha/trailers/2114
// corp/videomusic/89/1156
l:"1",t:".mail.ru",x:/(?:video\.mail\.ru\/|"movieSrc=)((?:mail|inbox|bk|list|corp|lvi)(?:\/[a-z0-9\/_-]+))(?:"|\.html)/,
nf: "http://video.mail.ru/%TOKEN%.html"
},
"rutube.ru": {
l:"1",t:"rutube.ru",x:/(?:rutube\.ru\/|v=)([0-9a-f]+)(?:[^0-9a-f]|$)/m,
nf: "http://video.rutube.ru/%TOKEN%"
},
"video.yandex.ru": {
l:"0",t:"video.yandex.ru",x:/http:\/\/((?:[a-z0-9-]+\.)+video\.yandex\.ru\/(?:[a-z0-9.-]+\/)+)(?:[\]"]|$)/,
nf: "http://%TOKEN%"
},
"video.bigmir.net": {
l:"1",t:"video.bigmir.net",x:/video\.bigmir\.net\/(?:show|extplayer)\/(\d+)\/?/,
nf: "http://video.bigmir.net/show/%TOKEN%/"
},
"video.i.ua": {
l:"0",t:".i.ua",x:/V=((?:[a-f0-9]+\.)+[a-f0-9]+)[^a-f0-9]/,
nf: "http://i.i.ua/video/evp.swf?V=%TOKEN%"
},
"video.google.com": {
l:"1",t:"video.google.com",x:/docid=(-?\d+)/,
nf: "http://video.google.com/videoplay?docid=%TOKEN%"
},
"vimeo.com": {
l:"1",t:"vimeo.com",x:/(?:vimeo\.com\/|clip_id=)(\d+)/,
nf: "http://vimeo.com/%TOKEN%"
},
"dailymotion.com": {
l:"1",t:"dailymotion.com",x:/video\/([a-z0-9_-]+)(?:$|["?&])/,
nf:"http://www.dailymotion.com/video/%TOKEN%"
},
"metacafe.com": {
l:"1",t:"metacafe.com",x:/(?:watch|fplayer)\/(\d+)\//,
nf: "http://www.metacafe.com/watch/%TOKEN%/"
},
"vids.myspace.com": {
l:"1",t:".myspace.com",x:/(?:videoid|\/m)=(\d+)(?:\D|$)/,
nf: "http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=%TOKEN%"
},
"1tv.ru": {
l:"1",t:"1tv.ru",x:/ru\/news(?:video|\/[a-z]+)\/(\d+)/,
nf: "http://www.1tv.ru/newsvideo/%TOKEN%"
},
"ntv.ru": {
l:"1",t:"ntv.ru",x:/ntv\.ru\/(?:novosti\/|vi)(\d+)\/?/,
nf: "http://www.ntv.ru/novosti/%TOKEN%/"
},
"rutv.ru": {
l:"1",t:"rutv.ru",x:/vid=(\d+)/,
nf: "http://www.rutv.ru/video.html?vid=%TOKEN%"
},
"5-tv.ru": {
l:"1",t:"5-tv.ru",x:/5-tv\.ru\/(?:news|video)\/(\d+)\/?/,
nf: "http://5-tv.ru/video/%TOKEN%/"
},
"vkontakte.ru": {
l:"0",t:"vkontakte.ru/",m:"1",
x:/video_ext.php\?oid=(-?\d+)&id=(-?\d+)&hash=([0-9a-f]+)(?:&hd=(\d+))?/i,
nf: "http://vkontakte.ru/video%TK1%_%TK2%?h=%TK3%&hd=%TK4%"
},
"vk.com": {
l:"0",t:"vk.com/",m:"1",
x:/video_ext.php\?oid=(-?\d+)&id=(-?\d+)&hash=([0-9a-f]+)(?:&hd=(\d+))?/i,
nf: "http://vk.com/video%TK1%_%TK2%?h=%TK3%&hd=%TK4%"
},
"facebook.com":{
l:"1",t:"facebook.com",x:/v=(\d+)/,
nf:"http://facebook.com/video/video.php?v=%TOKEN%"
},
"24video.net": {
l:"1",t:"24video.net",x:/24video\.net\/video\/view\/(\d+)/,
nf: "http://www.24video.net/video/view/%TOKEN%"
},
"kiwi.kz": {
l:"1",t:"kiwi.kz",x:/kiwi\.kz\/watch\/(\w+)\/?/,
nf: "http://kiwi.kz/watch/%TOKEN%/"
}
},
checkHost: function(R,t) {
//-----------------------------------------------------------
var l=false,m=R.x.exec(t);
if(m&&m.length>=2) {
if(R.m) {
var nf = R.nf;
for(var i=1; i=0) {
hF = i;
break;
}
}
if(!hF) {
MYBB_vsc.message("Код не распознан.");
}
else
{
var R = MYBB_vsc.RG[hF];
var cF = (R.cF&&typeof(R.cF)=="function") ? R.cF : MYBB_vsc.checkHost;
var l = cF(R,tx);
if(!l) {
if(MYBB_vsc.isLink(tx)) {
MYBB_vsc.message("Ссылка не распознана. Попробуйте вставить код видео-ролика.");
}
else {
MYBB_vsc.message("Код не распознан.");
}
}
else {
insert("[video]"+l+"[/video]");
document.getElementById("video-area").style.display="none";
MYBB_vsc.reInit();
}
}
},
isLink: function(t) {
return (/^\s*http:\/\//.test(t));
},
message: function(t) {
document.getElementById("video-area-msg").innerHTML=t;
},
reInit: function() {
document.getElementById("video-area-hsel").style.display="block";
document.getElementById("video-area-actions").style.display="none";
document.getElementById("video-area-tcon").style.display="none";
document.getElementById("video-area-tinp").value="";
document.getElementById("video-area-thd").innerHTML="";
document.getElementById("video-area-msg").innerHTML="";
}
};
$(document).ready(function(){
if ($("#video-area").length > 0){
window.MYBB_bindVideoScriptITV=setInterval(function() {
if(window.MYBB_bindVideoScript && typeof(window.MYBB_bindVideoScript)=="function") {MYBB_bindVideoScript();}
}, 20);
}
});