var speedLoc = 0; var sLoc1 = 0; var sLoc2 = 0; var tgo = 0; var tgol = 0; var rgo_url = 0; var rgo_nm = ''; function AjaxlocGoLine(){ var line = document.getElementById('MoveLine'); if(line!=undefined){ prc = 100-Math.floor(tgo/tgol*100); sLoc1 = 64/100*prc; if(sLoc1<0){ sLoc1 = 0; } if(sLoc1>64){ sLoc1 = 64; } line.style.width = sLoc1+'px'; if(tgo>0){ tgo -= 1; setTimeout('AjaxlocGoLine()',100); }else{ if(rgo_url != 0){ AjaxGoTo(rgo_url); } } if($('#moveto') != null && $('#moveto') != undefined) { if(rgo_nm != '') { if( $('#moveto').html() == '' ) { $('#moveto').css({'display':'','height':'auto'}); $('#moveto').html('
Вы перейдете в: ' + rgo_nm + ' (отмена)
'); } }else{ $('#moveto').css({'display':'none','height':'1px'}); $('#moveto').html(''); } } } } function AjaxgoLocal(id,nm) { rgo_url = id; rgo_nm = nm; if($('#moveto') != null && $('#moveto') != undefined && nm != undefined) { if(rgo_nm != '') { $('#moveto').css({'display':'','height':'auto'}); $('#moveto').html('
Вы перейдете в: ' + nm + ' (отмена)
'); if(sLoc1 == 64) { AjaxGoTo(rgo_url); } }else{ $('#moveto').css({'display':'none','height':'1px'}); $('#moveto').html(''); } } } function AjaxgotoLocationCancel() { rgo_url = 0; rgo_nm = ''; $('#moveto').css({'display':'none','height':'1px'}); $('#moveto').html(''); } function AjaxGoTo(url){ $.ajax({ url: url, cache: false, dataType: 'json', success: function (json) { if(json['status'] == 'success'){ rgo_url = 0; rgo_nm = ''; tgo = json['location']['tgo']; tgo1 = json['location']['tgo1']; ViewLocation(json); parent.chat.reflesh(); }else if(json['status'] == 'update'){ window.location = '/main.php'; } } }); } function ViewLocation(json){ var html = '
'; html += '
'; for(var i = 0;i < json['goto'].length; i++){ html += '
' + json['goto'][i]['params'][1] + '
Сейчас в комнате ' + json['goto'][i]['params'][2] + ' чел.
\',event,0,1,1,1,\'max-height:240px\');" onMouseOut="top.hic();" onMouseDown="top.hic();" onClick="AjaxgoLocal(\'main.php?mAjax=true&loc=' + json['goto'][i]['params'][0] + '\',\'' + json['goto'][i]['params'][1] + '\');" onClick="location=\'main.php?mAjax=true&loc=' + json['goto'][i]['params'][0] + '\';"'; }else{ html += ' onMouseOver="top.hi(this,\'
' + json['goto'][i]['params'][1] + '
\',event,0,1,1,1,\'max-height:240px\');" onMouseOut="top.hic();" onMouseDown="top.hic();"'; } html += '>
'; } html += '
'; html += ''; $('#ViewLocation').html(html); // $('#ViewLocation').html(tmpl("vLocation", json)); AjaxlocGoLine(); } (function(){ var cache = {}; this.tmpl = function tmpl(str, data){ // Figure out if we're getting a template, or if we need to // load the template - and be sure to cache the result. var fn = !/\W/.test(str) ? cache[str] = cache[str] || tmpl(document.getElementById(str).innerHTML) : // Generate a reusable function that will serve as a template // generator (and which will be cached). new Function("obj", "var p=[],print=function(){p.push.apply(p,arguments);};" + // Introduce the data as local variables using with(){} "with(obj){p.push('" + // Convert the template into pure JavaScript str .replace(/[\r\t\n]/g, " ") .split("<%").join("\t") .replace(/((^|%>)[^\t]*)'/g, "$1\r") .replace(/\t=(.*?)%>/g, "',$1,'") .split("\t").join("');") .split("%>").join("p.push('") .split("\r").join("\\'") + "');}return p.join('');"); // Provide some basic currying to the user return data ? fn( data ) : fn; }; })();