/* Cached on Thu, 31 Oct 2024 23:03:14 */
if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/gm, '');
}
}
String.prototype.trimCustom = function(symb) {
return this.replace(new RegExp('^[\\s'+symb+']+|[\\s'+symb+']+$', 'gm'), '');
}
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj, start) {
for (var i = (start || 0), j = this.length; i < j; i++) {
if (this[i] === obj) { return i; }
}
return -1;
}
}
if (!Array.prototype.lastIndexOf) {
Array.prototype.lastIndexOf = function(obj, start) {
var lastIndex = null;
for (var i = (start || 0), j = this.length; i < j; i++) {
if (this[i] === obj) { lastIndex = i; }
}
return lastIndex || -1;
}
}
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(f) {
var c = this.length;
for (k in this) if (c != 0) {
f(this[k],k);
c--;
}
}
}
function getMonth(input,type) {
type = type || 1;
var date = input.split('.');
switch (date[(date.length==2)? 0 : 1]) {
case '1':
if (type == 1) {month = 'январь';} else {month = 'января';}
break;
case '2':
if (type == 1) {month = 'февраль';} else {month = 'февраля';}
break;
case '3':
if (type == 1) {month = 'март';} else {month = 'марта';}
break;
case '4':
if (type == 1) {month = 'апрель';} else {month = 'апреля';}
break;
case '5':
if (type == 1) {month = 'май';} else {month = 'мая';}
break;
case '6':
if (type == 1) {month = 'июнь';} else {month = 'июня';}
break;
case '7':
if (type == 1) {month = 'июль';} else {month = 'июля';}
break;
case '8':
if (type == 1) {month = 'август';} else {month = 'авгуса';}
break;
case '9':
if (type == 1) {month = 'сентябрь';} else {month = 'сентября';}
break;
case '10':
if (type == 1) {month = 'октябрь';} else {month = 'октября';}
break;
case '11':
if (type == 1) {month = 'ноябрь';} else {month = 'ноября';}
break;
case '12':
if (type == 1) {month = 'декабрь';} else {month = 'декабря';}
break;
default:
break;
}
if (date.length==2) {
return month+' '+date[1];
} else {
return date[0]+' '+month+' '+date[2];
}
}
$(function() {
$('.lightBox').click(function(e) {
if (e.target == this) {
$(this).fadeOut(250);
}
})
$('.lightBox .close').click(function() {
$(this).parents('.lightBox').click();
})
})
exchange = {
convert: function(vIn,vOut,count,int) {
count = count || 1;
int = int || false;
if (vIn == '' || vOut == '') {
return false;
}
var newCount;
$.ajax({
async: false,
url: 'funct/ajax.php',
type: 'POST',
data: {
op:'exchange',
inVal:vIn,
outVal:vOut,
count:count,
int:int
},
success: function(data) {
var out = $.parseJSON(data);
newCount = out.newCount;
}
})
return (int == 'true')? parseInt(newCount) : parseFloat(newCount);
},
list: function() {
var list;
$.ajax({
async: false,
url: 'funct/ajax.php',
type: 'POST',
data: {
op:'exchange_list'
},
success: function(data) {
list = JSON.parse();
}
})
return list;
}
}
cookies = {
getCookie: {},
init: function() {
var list = document.cookie.split(';');
for (i=0; i < list.length; i++) {
var cookie = list[i].split('=');
this.getCookie[cookie[0].trim()] = decodeURIComponent(cookie[1].trim());
}
},
set: function(name, value, expires, path, domain) {
path = path || '/'
expires instanceof Date ? expires = expires.toGMTString() : typeof(expires) == 'number' && (expires = (new Date(+(new Date) + expires * 1e3)).toGMTString());
var r = [name + "=" + escape(value)], s, i;
for(i in s = {expires: expires, path: path, domain: domain}){
s[i] && r.push(i + "=" + s[i]);
}
document.cookie = r.join(";");
this.init();
}
}
notepad = {
add: function(id,type) {
$.post('funct/ajax.php',{op:'notepadAdd',id:id,t:type})
},
remove: function(id,type) {
$.post('funct/ajax.php',{op:'notepadRemove',id:id,t:type})
},
setTip: function(id,type,value) {
$.post('funct/ajax.php',{op:'setTip',id:id,t:type,value:value})
},
getTip: function(id,type) {
var result = '';
$.ajax({
async: false,
url: 'funct/ajax.php',
type: 'POST',
data: {
op:'getTip',
id:id,
t:type
},
success: function(data) {
result = data;
}
});
return result;
},
removeTip: function(id,type) {
$.post('funct/ajax.php',{op:'removeTip',id:id,t:type})
},
makeNote: function(id,type) {
type = 'notepad_'+type;
var notes = $.parseJSON(cookies.getCookie[type]);
if (notes.indexOf(id.toString()) == -1) notes.push(id.toString());
cookies.set(type,JSON.stringify(notes),60*60*24*100);
},
removeNote: function(id,type) {
type = 'notepad_'+type;
var notes = $.parseJSON(cookies.getCookie[type]);
notes.splice(notes.indexOf(id.toString()),1);
cookies.set(type,JSON.stringify(notes),60*60*24*100);
},
getCount: function(type) {
if (type == 'vacTot') {
type = 'notepad_vac';
var count = $.parseJSON(cookies.getCookie[type]).length;
count += $.parseJSON(cookies.getCookie['notepad_vip']).length;
return count;
}
type = 'notepad_'+type;
var count = $.parseJSON(cookies.getCookie[type]).length;
return count;
},
getCountSaved: function(type) {
var count = 0;
$.ajax({
async: false,
url: 'funct/ajax.php',
type: 'POST',
data: {
op: 'getCountSaved',
t:type
},
success: function(data) {
count = data;
}
});
return count;
},
getNotes: function(type) {
cookies.init();
var notes = $.parseJSON(cookies.getCookie['notepad_'+type]);
return notes;
}
}
function translate(to, text) {
var translated;
$.ajax({
async: false,
url: 'funct/ajax.php',
data: {
op: 'translate',
to: to,
text: text
},
success: function(response) {
translated = response;
}
})
return translated;
}
function message(mesID,elem,timeout,type) {
var timeout = timeout || 10;
timeout = timeout * 1000;
var mes = document.createElement('div');
var mesId = Math.floor(Math.random() * (9999 - 1000 + 1)) + 1000;
if (type) {
mes.className = 'message msg_'+mesId+' message_' + type;
} else {
mes.className = 'message msg_'+mesId+'';
}
mes.style.display = 'none';
mes.id = 'message';
$(elem).after(mes);
$(mes).load('funct/ajax.php', {'com':'message','id':mesID}, function() {$(mes).slideDown(400);});
setTimeout('$("#message.msg_'+mesId+'").slideToggle(400,function() {$("#message").remove()})',timeout);
}
function msg(p) {
if (!p || p.msgId == undefined) throw 'msgId parameter is required!';
this.p = p;
this.p.showAfter = this.p.showAfter || document.getElementById('headPanel');
if (this.p.timeout != undefined) this.p.timeout = this.p.timeout * 1000;
else this.p.timeout = 10 * 1000;
function getMessageText() {
var msgText;
$.ajax({
async: false,
url: 'funct/ajax.php',
type: 'POST',
data: {
com:'message',
id: this.p.msgId
},
success: function(data) {
msgText = data;
}
});
this.msgText = msgText.replace("\n",'
');
}
function createMsgBox() {
getMessageText.apply(this);
if (this.p.parts != undefined) {
this.msgText = this.msgText.format(this.p.parts);
}
var msgBox = document.createElement('div');
$(msgBox)
.addClass('message')
.html(this.msgText)
.hide();
if (this.p.classes) {
if (typeof(this.p.classes) == 'object') {
for (p in this.p.classes) {
$(msgBox).addClass(this.p.classes[p])
}
} else $(msgBox).addClass(this.p.classes)
}
return msgBox;
}
function showMsg() {
var ths = this;
var msgBox = createMsgBox.apply(this);
$(msgBox)
.insertAfter(this.p.showAfter)
.slideDown(400, function() {
var elem = this;
window.setTimeout(function() {
$(elem).slideUp(400,function() {
$(this).remove();
})
},ths.p.timeout)
});
}
this.show = function() {
showMsg.apply(this);
}
}
String.prototype.format = function() {
var args = (typeof(arguments[0]) == 'object')? arguments[0] : arguments;
return this.replace(/%(\d+)/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};
function notepadLoginMessage(isVip) {
var sA = (isVip)? document.getElementsByClassName('notepadDiv')[0] : document.getElementById('viewTable');
var message = new msg({
msgId: 30,
timeout: 6,
parts: encodeURIComponent(window.location),
showAfter: sA
})
message.show();
}
function modalDialog(p) {
this.p = p;
function createModal() {
var modal = document.createElement('div');
$(modal)
.addClass('lightBox');
var modalInner = document.createElement('div');
$(modalInner)
.addClass('inner')
.html('
')).text(title) .append(buttonsWrapper) .appendTo('body'); showSubPointer(wrapper); $('body').one('mouseup', function(e) { checkOutOfDialogClick(e, wrapper, onFalse); }); } })(jQuery); $(function() { window.cursorX = window.cursorY = 0; $('body') .on('mousemove', function(e) { window.cursorX = e.pageX; window.cursorY = e.pageY; }) .delegate('.share-block a', 'click', function(e) { e.preventDefault(); window.open(e.target.href, '_blank', 'width=675, height=400'); }); $('.share-block a').each(function(k, elem) { var _elem = $(elem), service = _elem.data('service'); _elem .attr({ target: '_blank', href: 'https://share.yandex.net/go.xml?service=' + service + '&url=' + encodeURIComponent(window.location.toString()) + '&title=' + document.title }) }); });