Softmen
by Vladimir
JavaScript
var softmen = {
ref: document.referrer,
l: location.href,
ua: navigator.userAgent,
baseProt: 'http://',
basePath: '.softmen.ru/',
wraps: {
//bs: {s: 1, d: 'download', t: 'Скачать официальную версию'},
mr: {s: 0, d: 'mailru', t: 'Скачать с помощью загрузчика Mail.ru', b: 'Скачать с рекламным предложением от mail.ru'},
ic: {s: 1, d: 'installcore',t: 'Скачать с помощью загрузчика InstallCore', b: 'Скачать с рекламным предложением от install core'},
hl: {s: 1, d: 'help', t: 'Скачать полную версию', b: 'скачать полную версию <input type="checkbox" checked="checked" class="download-full" />'}
}
};
$(document).ready(function() {
var t = softmen;
if($('.download-link:first').attr('rel') != 'external') {
t.isPageOpera = /opera/gi.test(t.l);
t.isPageChrome = /chrome/gi.test(t.l);
t.isPageIE = /explorer/gi.test(t.l);
t.isPageFF = /firefox/gi.test(t.l);
t.isPageBowser = t.isPageOpera || t.isPageChrome || t.isPageIE || t.isPageFF;
t.isRefMail = /mail\.ru/gi.test(t.ref);
t.isRefGoogle = /google/gi.test(t.ref);
t.isRefSE = t.isRefMail || t.isRefGoogle;
t.isUaSputnik = /MRSPUTNIK/g.test(t.ua);
t.isUaFF = $.browser.mozilla;
t.isUaIE = $.browser.msie;
t.isSearchBesplat = /бесплатн/gim.test(decodeURI(t.ref));
//* mail rules
if(!t.isUaSputnik && !t.isPageBowser && t.isRefSE && (t.isUaFF || t.isUaIE)) {
t.wraps.mr.s = 1;
}
$('.downloads').each(function() {
var $downloads = $(this),
curLine = 0,
fileName = $downloads.attr('data-url').split('/').pop(),
newLink,
$source;
for(var i in t.wraps) {
if(t.wraps[i].s == 1) {
newLink = t.baseProt + t.wraps[i].d + t.basePath + fileName;
$source = $downloads.find('.source').eq(curLine);
$source.find('.download').html('<a href="' + newLink + '">' + t.wraps[i].t + '</a>');
$source.find('.info').html(newLink);
$source.find('.bubble').html(t.wraps[i].b);
if(i == 'hl') {
newLink = t.baseProt + 'download' + t.basePath +...