' + about_mobile_text + '';
}
box.addButton({label: getLang('captcha_cancel'), style: 'button_no', onClick: function(){
removeEvent(key, 'keypress');
box.hide();
}});
box.addButton({label: getLang('captcha_send'), onClick: onClickHandler});
box.setOptions({onHide: onHide, bodyStyle: 'padding: 16px 14px' + (about_mobile_text.length ? ' 10px' : '')});
box.content('
' + about_mobile_text);
box.show();
if (isFunction(onShow)) onShow();
key = ge('captchaKey');
addEvent(key, 'keypress', function(e) { if(e.keyCode==13){ onClickHandler(); }});
addEvent(ge('refreshCaptcha'), 'click', onClickHandler);
key.focus();
}
(function(){
var ajaxObjs = {};
window.Ajax.Get = function(p){
var a = (p.key)?ajaxObjs[p.key]:null;
if(!a){
a = new Ajax(p.onDone, p.onFail, p.eval);
if(p.key)ajaxObjs[p.key] = a;
}
a.get(p.url, p.query, p.sync);
}
window.Ajax.Post = function(p){
var a = (p.key)?ajaxObjs[p.key]:null;
if(!a){
a = new Ajax(p.onDone, p.onFail, p.eval);
if(p.key)ajaxObjs[p.key] = a;
}
a.post(p.url, p.query, p.sync);
}
window.Ajax.postWithCaptcha = function(url, data, options) {
var onSuccess, onFail, onCaptchaShow, onCaptchaHide, difficulty, p;
if (!options) options = {};
if (isFunction(options)) {
onSuccess = options;
} else {
onSuccess = options.onSuccess;
onFail = options.onFail;
onCaptchaShow = options.onCaptchaShow;
onCaptchaHide = options.onCaptchaHide;
}
var done = function(o, t) {
var r;
try {
r = eval('(' + t + ')');
if (r.ok == -5) {
if (ge('please_confirm_mail')) {
r.ok = -4;
}
}
switch(r.ok) {
case -6:
var box = new MessageBox({title:r.title || getLang('global_charged_zone_title'), returnHidden:true});
box.addButton({label: getLang('global_cancel'), style: 'button_no', onClick: function() {
box.setOptions({returnHidden:false});
box.hide();
}}).addButton({label:getLang('global_charged_zone_continue'), onClick: function() {
box.hide();
p.query.charged_confirm = r.hash;
Ajax.Post(p);
}}).content(r.message).show();
break;
case -5:
if (isFunction(onCaptchaShow)) onCaptchaShow();
if (r.title || r.message) {
var box = new MessageBox({title: r.title || 'Ïîäòâåðæäåíèå äåéñòâèÿ'});
box.addButton({label: getLang('global_close'), onClick: box.hide});
box.content(r.message || 'Ïðåâûøåíî îãðàíè÷åíèå íà êîëè÷åñòâî äåéñòâèé, ïîïðîáóéòå ïîçæå.').show();
} else {
window.validated = false;
activate_mobile(false, function() {
if (window.validated) {
Ajax.Post(p);
}
if (onCaptchaHide) onCaptchaHide(!window.need_mobile_act);
}, r.hash);
}
break;
case -4:
if (isFunction(onCaptchaShow)) onCaptchaShow()
if (ge('please_confirm_mail')) {
show_change_mail_box(onCaptchaHide);
} else {
if (onCaptchaHide) onCaptchaHide();
}
break;
case -3:
var to;
var iframe = ce('iframe', {src: vk.loginscheme + '://login.vk.com/?ip_h=' + vk.ip_h + '&from_host=' + location.host + '&from_protocol=' + location.protocol}, {visibility: 'hidden', position: 'absolute'});
document.body.appendChild(iframe);
var onload = function() {
try {
var href = iframe.contentWindow.location.href;
if (href.match(/&hash=/)) {
if (href.match(/&hash=[a-z0-9]+/)) {
Ajax.Post(p);
} else {
location.href= base_domain + 'login.php?op=logout'; return false;
}
clearInterval(t);
}
} catch(e) {}
}
if (browser.msie) {
to = setInterval(function(){
if (iframe.document.readyState == 'complete') {
onload();
}
}, 200);
} else {
iframe.onload = onload;
}
break;
case -2:
// Show captcha here TODO
var difficulty = '';
if (r.difficult === undefined) r.difficult = options.difficultCaptcha ? 1 : 0;
if (r.difficult !== undefined) {
difficulty = intval(r.difficult) ? '' : 's=1&';
}
var onClick = function(sid, value) {
if (typeof(p.query) == 'object') {
extend(p.query, {'captcha_sid': sid, 'captcha_key': value});
} else {
p.query += '&captcha_sid=' + sid + '&captcha_key=' + value;
}
Ajax.Post(p);
return false;
};
var captcha_img = base_domain+'captcha.php?'+difficulty+'sid='+r.captcha_sid;
showCaptcha(r.captcha_sid, captcha_img, onClick, onCaptchaShow, onCaptchaHide);
break;
default:
throw "Exit";
break;
}
} catch (e) { // if captcha test passed
if (options.json && r)
t = r;
else if (r && typeof(r.text) == 'string')
t = r.text;
if (window.Ajax._captchaBox) {
window.Ajax._captchaBox.setOptions({onHide: function(){}}).hide();
if (isFunction(onCaptchaHide)) onCaptchaHide(true);
}
if (isFunction(onSuccess)) onSuccess(o, t);
}
};
var fail = function(o, t) {
if (isFunction(onFail)) onFail(o, t);
if (window.Ajax._captchaBox) {
window.Ajax._captchaBox.setOptions({onHide: function(){}}).hide();
if (isFunction(onCaptchaHide)) onCaptchaHide(true);
}
};
p = {
url: url,
query: data,
onFail: fail,
onDone: done
};
Ajax.Post(p);
}
window.Ajax.History = function(url, query, update, failed) {
ajaxHistory.useCache = false;
ajaxHistory.prepare({url: url, done: function(o,t){
try {
var r = eval('('+t+')');
if(r.data)Ajax.current = r.data;
update(r);
} catch (e) {
debugLog(e);
}
}, fail:failed, def: query});
Ajax.current = query;
};
window.Ajax.Go = function(query) {
var q = extend(clone(Ajax.current), query);
ajaxHistory.go(q);
return false;
}
window.Ajax.Send = Ajax.postWithCaptcha;
})();
var ajaxHistory = $ah = new (function(){
var _t = this;
var curHash = "";
var curHashes = {};
var frame = null;
var with_frame = browser.msie6 || browser.msie7;
var frame_doc = function() {
return frame.contentDocument ? frame.contentDocument : (frame.contentWindow ? frame.contentWindow.document : frame.document);
}
var setFrameContent = function(hash) {
var d = frame_doc();
d.open();
d.write('
' +
hash.replace('&', '&').replace('"', '"').replace('>', '>').replace('<', '<') +
'
'
);
d.close();
}
var forceLoad = false;
var order = null;
//_t.frameLoading = false;
_t.enabled = false;
_t.useCache = true;
_t.onLoad = {};
_t.cache = {};
_t.preloads = {};
var setHash = function(hash){
hash = hash.replace("#","");
if (location.hash != "#" + hash){
location.hash = "#" + hash;
if (with_frame) {
setFrameContent(hash);
handler();
}
}
return true;
};
var getHash = function(){
if (!with_frame) return location.hash.replace("#","");
try {
return frame_doc().getElementById('hash').innerHTML.replace(/</ig, '<').replace(/>/ig, '>').replace(/"/ig, '"').replace(/&/ig, '&');
} catch(e) { return curHash; }
};
var splitHash = function(hash){
if(!hash)return {};
hash = hash.split("/");
if(hash.length == 1){
if(!_t.onLoad['default'])return {};
if(_t.onLoad['default'].show)hash[0] = _t.onLoad['default'].show.from(hash[0]);
return {'default':sortParams(hash[0])};
}
var parsed = {};
for(var i=0;i
';
var a = new Ajax(
(function(i,p){return function(res,text){
var c = true;
if (_t.preloads[i][p] != '') {
c = _t.preloads[i][p](res, text);
} else if (on_preloaded) {
c = on_preloaded(res, text);
}
if(c !== false)_t.cache[i][p] = text;
};})(id, state[id]),
function() {}, true);
a.post(_t.onLoad[id].url, state[id] + '&preload=1');
}
})();
onDomReady(function(){
ajaxHistory.init();
});
/**
* Cookies
**/
var _cookies;
function _initCookies() {
_cookies = {};
var ca = document.cookie.split(';');
var re = /^[\s]*([^\s]+?)$/i;
for(var i = 0; i < ca.length; i++) {
var c = ca[i].split("=");
if(c.length == 2) {
_cookies[c[0].match(re)[1]] = unescape(c[1].match(re) ? c[1].match(re)[1] : '');
}
}
}
function getCookie(name) {
if (!_cookies) _initCookies();
return _cookies[name];
}
function setCookie(name, value, days) {
if (!_cookies) _initCookies();
_cookies[name] = value;
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
var domain = location.host.match(/[^.]+\.[^.]+$/);
document.cookie = name+"="+escape(value)+expires+"; path=/"+(domain ? '; domain=.'+domain : '');
}
/**
* Other stuff
**/
function callHub(func, count) {
this.count = count || 1;
this.done = function(c) {
this.count -= c || 1;
if (this.count <= 0) {
func();
}
};
}
var gSearch = new (function() {
this.on = 0;
var self = this;
this.hub = new callHub(function() {
if (self.onShow) onDomReady(self.onShow);
}, 2);
this.hintsHub = new callHub(function() {
self.showStartHints();
}, 2);
this.load = function() {
if (!ge('quick_search')) return;
if (this.global) return;
if (this.loading) return;
this.loading = true;
jsDispatcher.include('qsearch', function() {
self.hub.done();
});
Ajax.Send('hints.php', {act: 'a_start_hints'}, {onSuccess: function(o, t) {
self.startHintsText = trim(t);
self.hintsHub.done();
}});
},
this.show = function(e, noAnim) {
if (!ge('quick_search')) return;
if (this.on) {
return this.go(e);
}
this.on = 1;
show('quick_search');
placeholderSetup('search_input');
ge('search_input').setAttribute('autocomplete', 'off');
addClass('qsearch_link', 'active');
if (this.global) return;
this.prev_content = ge('content');
if (!this.qsearch_cont) {
this.qsearch_cont = ce('div', {id: 'content', innerHTML: ''}, {padding: 0});
}
hide('header');
this.prev_content.parentNode.replaceChild(this.qsearch_cont, this.prev_content);
if (!this.loading) this.load();
self.hub.done();
self.hintsHub.done();
if (e) return cancelEvent(e);
};
this.go = function (e) {
if (self.global) {
return globalSearch();
}
var url = '/gsearch.php?section=' + (self.last_section || 'people') + '&q=' + trim(ge('search_input').getValue ? ge('search_input').getValue() : ge('search_input').value) + '&name=1';
cancelEvent(e || window.event);
location.href = url;
return false;
};
this.hide = function(e, force) {
if (!ge('quick_search')) return;
if ((self.active && !force) || !self.on) return;
self.on = 0;
toggleFlash();
if (self.beforeHide && self.beforeHide()) {
return true;
}
show('header');
hide('quick_search');
if (ge('search_input').setValue) {
ge('search_input').setValue('');
} else {
ge('search_input').value = '';
}
removeClass('qsearch_link', 'active');
if (self.qsearch_cont)
self.qsearch_cont.parentNode.replaceChild(self.prev_content, self.qsearch_cont);
};
this.init = function(options) {
this.opt = options || {};
}
})();
function dispatchIntro(step, params) {
if (typeof dispatchIntroEvent != 'undefined') {dispatchIntroEvent(step, params);}
}
var send_request_url = 'http://userapi.com/data?';
var qCur = 0, qOn = 0, sOn = 0, qfOn = 0, qd = 0, l = 0, qa = 0, qfCur = -1, newSearch = 0;
// var qArr is in langpack
reqs = []; res = [];
friends_l = [];
friends_arr = [];
floaded = false;
function doRequest(params, resultFunc) {
var req = createRequest(params, resultFunc);
sendRequest(req);
}
function createRequest(params, resultFunc) {
var req = new Object();
req.params = params;
req.resultFunc = resultFunc;
req.destroy = destroy;
var rnum = Math.floor(Math.random()*1000);
req.num = rnum;
req.running = 1;
reqs[rnum] = req;
return req;
}
function sendRequest(req) {
attachScript('req'+req.num, send_request_url+req.params+'&sid='+getCookie('remixsid')+'&back=reqs['+req.num+'].resultFunc');
}
function attachScript(id, c) {
var i, new_id = c.substr(c.indexOf('/')+1, c.indexOf('.')-c.indexOf('/')+2).replace(/[\/\.]/g, '_');
var newreqs = [];
for (reqnum in reqs) {
req = reqs[reqnum];
if (req) {
if (req.running == 0) {
ge('req'+req.num).parentNode.removeChild(ge('req'+req.num));
reqs[reqnum] = null;
} else {
newreqs[reqnum] = req;
}
}
}
reqs = newreqs;
document.getElementsByTagName('head')[0].appendChild(
ce('script', {id: id, type: 'text/javascript', src: ((!/^http:\/\//i.test(c) && !/^\//i.test(c)) ? base_domain : '') + c + (css_versions[new_id] ? ('?' + css_versions[new_id]) : '')})
);
}
function destroy() {
if (reqs[this.num]) {
reqs[this.num].running = 0;
}
}
function addCss(c) {
var new_id = c.substr(c.indexOf('/')+1, c.indexOf('.')-c.indexOf('/')-1)+'_css';
if (!ge(new_id)) {
document.getElementsByTagName("head")[0].appendChild(
ce('link', {type: 'text/css', rel: 'stylesheet', href: base_domain + c + (css_versions[new_id] ? ('?' + css_versions[new_id]) : ''), id: new_id, media: 'screen'})
);
}
}
var rateBox;
function showRateVotesBox() {
if (window.event && (window.event.which == 2 || window.event.button == 1)) {
return true;
}
addCss('css/privacy.css');
addCss('css/wiki.css');
if (rateBox == undefined) {
rateBox = new MessageBox(
{title: getLang('global_rating_box_header'), bodyStyle: 'padding:0px', width: '480px', progress: 'rateProgress'}
);
}
rateBox.removeButtons();
rateBox.addButton({
onClick: function() { rateBox.hide(200); },
label: getLang('box_close')
});
rateBox.loadContent('rate.php', {'act':'a_get_rate_votes', 'full': 1}, true).show();
return false;
}
function leftBlockOver(block) {
var timer = 'timer', over = 1;
if (!block.id) {
block = ge('left_hide' + block);
over = 0;
}
if (over || !block.timer) {
if (block.showing) {
delete block.showing;
} else {
animate(block, {opacity: over ? 1 : 0.5}, 200);
if (over) {
block.showing = 1;
}
}
}
if (block.timer) {
clearTimeout(block.timer);
delete block.timer;
}
}
function leftBlockOut(block) {
var opacity = 0.5;
if (!block.id) {
block = ge('left_hide' + block);
opacity = 0;
}
block.timer = setTimeout(function() {
animate(block, {opacity: opacity}, 200);
delete block.timer;
}, 1);
}
function leftBlockHide(block, hash) {
ajax.post('al_index.php', {act: 'hide_block', block: block, hash: hash});
hide('left_block' + block);
}
function leftAdBlockHide(blockId, url) {
var ajax = new Ajax();
ajax.onDone = function(obj, response) {
var r = eval('(' + response + ')');
if (r.done) {
var box = ge('ad_box' + blockId);
var mask = ge('ad_hide_mask' + blockId);
if (!box || !mask) return false;
mask.timer = setTimeout(function() {
animate(mask, {opacity: 1}, 200);
delete mask.timer;
}, 0);
var x = getXY(box), s = getSize(box), btop = 1, bbot = 1;
if (box.style.borderTop == '0px') {
btop = 0;
}
if (btop) {
s[1] -= btop;
}
if (bbot) {
s[1] -= bbot;
}
var textH = (mask.firstChild.nextSibling === null) ? 40 : 108;
var padtop;
if (s[1] < textH + 10) {
s[1] = textH + 10;
padtop = Math.floor((s[1] - textH) / 2);
box.style.height = s[1] - 6 - padtop + 'px';
}
var padtop = Math.floor((s[1] - textH) / 2);
setStyle(mask, {left: x[0], top: x[1], height: s[1] - padtop, paddingTop: padtop, display: 'block'});
}
}
ajax.post(url);
var hideX = ge('left_hide' + blockId);
if (hideX && hideX.parentNode) {
hideX.parentNode.removeChild(hideX);
}
return false;
}
function parseLatin(text, back){
var outtext = text;
var lat1 = ["yo","zh","kh","ts","ch","sch","shch","sh","eh","yu","ya","YO","ZH","KH","TS","CH","SCH","SHCH","SH","EH","YU","YA","'"];
var rus1 = ["¸", "æ", "õ", "ö", "÷", "ù", "ù", "ø", "ý", "þ", "ÿ", "¨", "Æ", "Õ", "Ö", "×", "Ù", "Ù", "Ø", "Ý", "Þ", "ß", "ü"];
for(var i=0;i ' : '';
var full_page_button = options.fullPageLink ? '