<script type="text/javascript">
var usA = navigator.userAgent;
var sysbr = [
{re: /(Windows 2000)()/ig, r:/(Windows NT 5.0|Windows 2000)/, sub: 'http://forumstatic.ru/files/0012/72/15/47637.png'},
{re: /(Windows XP)()/ig, r:/(Windows NT 5.1|Windows XP)/, sub: 'http://forumstatic.ru/files/0012/72/15/52481.png'},
{re: /(Windows Server 2003)()/ig, r:/Windows NT 5.2/, sub: 'http://forumstatic.ru/files/0012/72/15/52481.png'},
{re: /(Windows Vista)()/ig, r:/Windows NT 6.0/, sub: 'http://forumstatic.ru/files/0012/72/15/17322.png'},
{re: /(Windows 7)()/ig, r:/(Windows 7|Windows NT 6.1)/, sub: 'http://forumstatic.ru/files/0012/72/15/78704.png'},
{re: /(Windows 8)()/ig, r:/(Windows 8|Windows NT 6.2)/, sub: 'http://forumstatic.ru/files/0012/72/15/15694.png'},
{re: /(Windows 8.1)()/ig, r:/(Windows 8.1|Windows NT 6.3)/, sub: 'http://forumstatic.ru/files/0012/72/15/27734.png'},
{re: /(Windows 10)()/ig, r:/(Windows NT 6.4)/, sub: 'http://forumstatic.ru/files/0012/72/15/15694.png'},
{re: /(Android)()/ig, r:/Android/, sub: 'http://forumstatic.ru/files/0012/72/15/62456.png'},
{re: /(Open BSD)()/ig, r:/OpenBSD/, sub: 'http://forumstatic.ru/files/0012/72/15/13979.png'},
{re: /(Ubuntu)()/ig, r:/Ubuntu/, sub: 'http://forumstatic.ru/files/0012/72/15/93172.png'},
{re: /(Xubuntu)()/ig, r:/Xubuntu/, sub: 'http://forumstatic.ru/files/0012/72/15/90513.png'},
{re: /(Sun OS)()/ig, r:/SunOS/, sub: 'http://forumstatic.ru/files/0012/72/15/90135.png'},
{re: /(Linux)()/ig, r:/(Linux|X11)/, sub: 'http://forumstatic.ru/files/0012/72/15/94875.png'},
{re: /(iOS)()/ig, r:/(iPhone|iPad|iPod)/, sub: 'http://forumstatic.ru/files/0012/72/15/79763.png'},
{re: /(Mac OS X)()/ig, r:/Mac OS X/, sub: 'http://forumstatic.ru/files/0012/72/15/16372.png'},
{re: /(Mac OS)()/ig, r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/, sub: 'http://forumstatic.ru/files/0012/72/15/72782.png'},
{re: /(BeOS)()/ig, r:/BeOS/, sub: 'http://forumstatic.ru/files/0012/72/15/90377.png'},
{re: /(OS\/2)()/ig, r:/OS\/2/, sub: 'http://forumstatic.ru/files/0012/72/15/45919.png'},
{re:/(Amigo)\s*(\.|\,?\d+(\.\d+)*)/gi, sub: 'http://forumstatic.ru/files/0012/72/15/70700.png'},
{re: /(opera|OPR)\s*(\.|\,?\d+(\.\d+)*)/ig, sub: 'http://forumstatic.ru/files/0012/72/15/14487.png'},
{re: /(chrome)\s*(\.|\,?\d+(\.\d+)*)/gi, sub: 'http://forumstatic.ru/files/0012/72/15/44189.png'},
{re: /(chromium)\s*(\.|\,?\d+(\.\d+)*)/gi, sub: 'http://forumstatic.ru/files/0012/72/15/29722.png'},
{re: /(safari)\s*(\.|\,?\d+(\.\d+)*)/gi, sub: 'http://forumstatic.ru/files/0012/72/15/73467.png'},
{re: /(firefox)\s*(\.|\,?\d+(\.\d+)*)/gi, sub: 'http://forumstatic.ru/files/0012/72/15/93737.png'},
{re: /(msie)\s*(\.|\,?\d+(\.\d+)*)/gi, sub: 'http://forumstatic.ru/files/0012/72/15/48061.png'},
{re: /(yabrowser)\s*(\.|\,?\d+(\.\d+)*)/gi, sub: 'http://forumstatic.ru/files/0012/72/15/32345.png'}
];
// определяем ОС
(function (window) {
{
var unknown = '-';
var os = unknown;
for (var i=0; i< sysbr.length; i++) {
var y = sysbr[i].re;
var rr = sysbr[i].r;
var ge = y.toString().replace(/\/|\(|\)|gi/gi, '');
if (usA.match(rr) != null) {
os = ge;
break;
}
}
var osVersion = unknown;
if (/Windows/.test(os)) {
osVersion = /Windows (.*)/.exec(os)[1];
os = 'Windows';
}
switch (os) {
case 'Mac OS X':
osVersion = /Mac OS X (10[\.\_\d]+)/.exec(usA)[1];
break;
case 'Android':
osVersion = /Android ([\.\_\d]+)/.exec(usA)[1];
break;
case 'iOS':
osVersion = /OS (\d+)_(\d+)_?(\d+)?/.exec(navigator.appVersion);
osVersion = osVersion[1] + '.' + osVersion[2] + '.' + (osVersion[3] | 0);
break;
}
}
// Определяем браузер
var N = navigator.appName, tem;
var brow = usA.match(/(amigo|opr|opera|safari|firefox|msie|yabrowser|chrome|chromium)\/?\s*(\.?\d+(\.\d+)*)/i);
if(brow && (tem = usA.match(/version\/([\.\d]+)/i))!= null) brow[2] = tem[1];
brow = brow? [brow[1], brow[2]]: [N, navigator.appVersion,'-?'];
if (usA.match('Amigo')!= null){ brow='Amigo ' +[brow[1]]};
if (usA.match('OPR')!= null){ brow='Opera ' +[brow[1]]};
window.ua = {
os: os,
osVersion: osVersion,
browser: brow
};
}(this));
// добавляем маркер в пост ос/браузер
$('#main-reply').bind('mouseout touchstart mousedown', function (e) {
var self = $(this);
setTimeout(function(e) {
var newpost = $(self).val();
$('input[name=submit]').bind('click', function (e) {
$(self).val(newpost +' [color=transparent][size=2]'+ua.os+' '+ua.osVersion+', '+ua.browser+'[/size][/color]');
});
}, 0);
});
// заменяем маркер на иконки
$('img.live-tipsy').tipsy({live: true,gravity: 's'});
$('.post').has('span[style=color: transparent]').map(function () {
var self = $(this);
var marker = $(this).find('span[style=color: transparent]').text();
var bro = '<li class="pa-agent">';
for (var i=0; i< sysbr.length; i++) {
var k = sysbr[i].re;
var t = marker.replace(k, '$1 $2');
var val = sysbr[i].sub;
if (marker.match(k) != null) {
var qq = marker.replace(marker, ' <img class="live-tipsy" src="' +val+ '" original-title="' +t+ '"/> ');
bro += qq;
}
}
bro += '</li>';
$(self).find('.post-author ul li:not(.pa-online):last').after(bro);
});
// удаляем маркер при цитировании (пока грубое решение)
function quote(username, post_id, no_repeat)
{
var theSelection = '';
$('#p'+post_id+'-content > p').each(function(index){
p = $(this).html().replace(/<span style=\"color: transparent\"><span style=\"font-size: (\d+)px\">(.*?)<\/span><\/span>/gi, '');
el = $('<div style="display:none"></div>');
$(el).append(p);
theSelection += $(el).text()+'\n\n';
});
insert('[quote="' + username + '"]' + $.trim(theSelection) + '[/quote]' + '\n');
return;
}
</script>