/* Cached on Sun, 10 Nov 2024 19:40:47 */ 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('
') .appendTo(modal); var title = document.createElement('h5'); $(title) .addClass('title') .text(this.p.title) .appendTo(modalInner); var modalContent = document.createElement('div'); $(modalContent) .addClass('modalContent') .appendTo(modalInner) return modal; } this.modal = createModal.apply(this); if (this.p.buttons) { var content = $(this.modal).find('.modalContent'); for (i in this.p.buttons) { var button = document.createElement('input'); button.type = 'button'; button.value = this.p.buttons[i]['value']; button.onclick = this.p.buttons[i]['onClick']; $(button).appendTo(content); } } return this.modal; } function flashMessage() { $.ajax({ async: false, url: 'funct/ajax.php', type: 'POST', dataType: 'JSON', data: { op: 'getFlash' }, success: function(response) { if (response.notEmpty) { var messages = []; for (var p in response.list) { messages.push(getMsg(response.list[p])); } if ($('.flashMessagesBox').length) { var msgWrapper = $('.flashMessagesBox')[0]; } else { var msgWrapper = document.createElement('div'); $(msgWrapper) .addClass('flashMessagesBox') .appendTo('body'); } var c = 1; for (id in messages) { showMsg(messages[id], msgWrapper, c++); } } } }) function getMsg(text) { var msgBox = document.createElement('div'); $(msgBox) .addClass('flashMessage'); var closeCross = document.createElement('img'); $(closeCross) .attr('src','images/close.png') .addClass('click_me') .click(function() { $(this).parent().hide( 'slide', { direction: 'left' }, 150, function() { $(this).remove(); } ) }) .appendTo(msgBox); var p = document.createElement('p'); $(p) .html(text) .appendTo(msgBox); return msgBox; } function showMsg(msg, msgBox, t) { setTimeout( function() { $(msg) .appendTo(msgBox) .show( 'slide', { direction: 'left' }, 200 ) }, 500 * t ) } } function getEdu() { var rows = $('p')[2].innerText.match(/\n.+/gi); rows.forEach(function(v,k) {if (v.match(/обра/)) console.log(v)}) } function parseEdu(text) { var out = 0; var getEduSingleLine = function() { var ret = false; var startEnd = ['.',';','!','?']; var regExp = new RegExp( '(?:^|[' + startEnd.join('') + '])[^' + startEnd.join('') + ']+', 'gi' ); var rows = text.match(regExp); $(rows).each( function(k,v) { if (v.match(/обра/i)) { ret = getEduFromRow(v); return; } } ) return ret; } var getEduMultiLine = function() { var ret = false; var rows = text.match(/(?:\n|^).+/gi); $(rows).each( function(k,v) { if (v.match(/обра/i)) { ret = getEduFromRow(v); return; } } ) return ret; } var getEduFromRow = function(row) { var ret = 0; var eduArr = { 1: [ 'высш', 'high', 'year degree', 'super' ], 7: [ 'спец', 'spec' ], 8: [ 'средн', 'secun' ] }; for (var p in eduArr) { if (row.match(new RegExp('(' + eduArr[p].join(')|(') + ')','i'))) { ret = parseInt(p); break; } } return ret; } if (!text.match(/\n/)) out = getEduSingleLine() || 0; else out = getEduMultiLine() || 0; return out; } function findRowByExpr(text,expr,multi) { multi = multi || false; var getRowSingleLine = function() { var ret = false; var list = []; var startEnd = [',','.',';','!','?']; var regExp = new RegExp( '(?:^|[' + startEnd.join('') + '])[^' + startEnd.join('') + ']+', 'gi' ); var rows = text.match(regExp); $(rows).each( function(k,v) { if (v.match(expr)) { if (!multi) { ret = v; return false; } else list.push(v); } } ) return (multi)? list : ret; } var getRowMultiLine = function() { var ret = false; var list = []; var rows = text.match(/(?:\n|^).+/gi); $(rows).each( function(k,v) { if (v.match(expr)) { if (!multi) { ret = v; return false; } else list.push(v); } } ) return (multi)? list : ret; } if (!text.match(/\n/)) return getRowSingleLine(); else return getRowMultiLine(); } function chTab(tab) { if ($(tab).parent().hasClass('active')) return false; var tabId = $(tab).parent().prevAll('td').length; var tabContentBlock = $(tab).parents('table').next().children()[tabId]; $(tab).parent() .addClass('active') .siblings('.active') .removeClass('active'); $(tabContentBlock) .addClass('active') .siblings('.active') .removeClass('active'); } function declension(digit,expr,onlyword) { onlyword = onlyword || false; if (expr.length == 2) expr[2] = expr[1]; var i = parseInt(digit) % 100; if (onlyword) digit=''; var result = ''; if (i >= 5 && i <= 20) result = digit + ' ' + expr[2]; else { i = i % 10; if(i == 1) result = digit + ' ' + expr[0]; else if (i>=2 && i<=4) result = digit + ' ' + expr[1]; else result = digit + ' ' + expr[2]; } return result.trim(); } function getHREF(route, params) { params = params || null; var href = ''; $.ajax({ async: false, type: 'GET', url: 'funct/ajax.php', data: { op: 'getRoute', 'for': route, params: params }, dataType: 'json', success: function(r){ href = r.href; } }); return href; } function fromDSToSrc(ds) { var ret = []; for(var i in ds) ret.push({ label: ds[i][2], value: ds[i][1] }) return ret; } $(function() { $( "body" ).delegate('.ui-combobox-input', 'focus', function() { $(this).parent().css('border-color','#56A4C9'); }) $( "body" ).delegate('.ui-combobox-input', 'blur', function() { $(this).parent().removeAttr('style'); }) }) function findObjectBy(arr, by, byVal) { return ($.grep(arr, function(e){ return e[by] == byVal; })).pop(); } /*$(function() { setInterval(flashMessage, 3000); })*/ function getRandomColor() { var letters = '0123456789ABCDEF'.split(''); var color = '#'; for (var i = 0; i < 6; i++ ) { color += letters[Math.round(Math.random() * 15)]; } return color; } function trimSelection() { var s = window.getSelection(); if (s.rangeCount > 0) { var clone = s.getRangeAt(0).cloneRange(); var string = s.toString(); var i = 1; while (string[string.length - i++] == ' ') { var newEndOffset = clone.endOffset - 1; clone.setEnd(s.anchorNode, newEndOffset); } var i = 0; while (string[i++] == ' ') { var newStartOffset = clone.startOffset + 1; clone.setStart(s.anchorNode, newStartOffset); } s.removeAllRanges(); s.addRange(clone); } return s; } function needBreak(total, current, cols) { current = current || 1; cols = cols || 3; return current % Math.ceil(total / cols) == 0; } $(function() { var _crossDomain = { ajax: function(settings) { var data = settings.data; delete(settings.data); settings.data = {}; settings.data.data = data; settings.data.url = settings.url; delete(settings.url); settings.data.type = settings.type; settings.type = 'get'; $.ajax('/js/crossDomainGate.php',settings); } } window.crossDomain = { ajax: function(settings) { _crossDomain.ajax(settings); } } function scrollToTop() { var top = $('body').offset().top; $('html, body').animate({ scrollTop: top },300); return true; } var currentScroll = document.body.scrollTop; if (currentScroll > 300) $('.toTopWrap').fadeIn(200); $(window).scroll(function() { var currentScroll = document.body.scrollTop; if (currentScroll > 300) $('.toTopWrap').fadeIn(200); else $('.toTopWrap').fadeOut(200); }) $('.toTop').click(function() { scrollToTop(); }) }); function showSubPointer(elem, event) { if (!event) { event = new Event('click'); event.pageX = cursorX; event.pageY = cursorY; } event.pageX -= event.pageX > 15 ? 15 : event.pageX; $(elem).show().position({ my: 'left center', of: event, collision: 'fit' }) } (function($) { function closeDialog(dialog) { dialog.remove() } function checkOutOfDialogClick(event, dialog, onFalse) { if (!$(event.target).closest(dialog).length) { event.stopPropagation(); closeDialog(dialog); onFalse(); } else if (!$(event.target).is('input')) $('body').one('click', function(e) { checkOutOfDialogClick(e, dialog, onFalse); }); } window.tlConfirm = function(title, onTrue, onFalse) { onTrue = onTrue || function() {}; onFalse = onFalse || function() {}; var wrapper = $('
'), buttonsWrapper = $('
'); buttonsWrapper .delegate('input', 'click', function() { closeDialog(wrapper); }) .append($('').val('Да').on('click', onTrue)) .append($('').val('Нет').on('click', onFalse)); wrapper .append($('

')).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 }) }); });