$(document).ready(function(){ $('.yandex_news_title a, .gsInformer a, .yandex_title a, .yandex_allnews a').attr('rel','nofollow').attr('target','_blank'); $('.glyphicon-remove').on('click',function(){ $('#searchfield').val(''); $('.glyphicon-remove').hide(); }); $('.glyphicon-search').on({ click:function() { if($('#searchfield').val()!=''){ $('.form').submit(); }}}); $('#search_form').on('submit',function(e){ e.preventDefault(); var search_param=$('meta[name="SEARCH_PARAMETER"]').attr('content'); var query=$('#search_form input').val(); var url='/'+search_param+'/'+encodeURI(query);location.assign(url);}); $('#searchfield').on({ keydown:function(event){toggleClearBtn();}, focus:toggleClearBtn}); function toggleClearBtn(){if($('#searchfield').val()==''){$('.glyphicon-remove').hide();}else{$('.glyphicon-remove').show();}}$('#searchfield').bind('typeahead:select',function(ev,suggestion){$('.form').submit();});if($('.counter').length>0){var i=10;setInterval(function(){if(i>-1){$('.counter').text(i);i--;}else{$('.counterWrapper').hide();$('.outlink').show();return;}},1000);}});function addToBookmarks(){if(window.sidebar&&window.sidebar.addPanel){window.sidebar.addPanel(document.title,window.location.href,'');}else if(window.external&&('AddFavorite'in window.external)){window.external.AddFavorite(location.href,document.title);}else if(window.opera&&window.print){this.title=document.title;return true;}else{alert('Press '+(navigator.userAgent.toLowerCase().indexOf('mac')!=-1?'Command/Cmd':'CTRL')+' + D to bookmark this page.');}}function getSuggestions(query,callback){$.ajax({url:'/autocomplete',type:'GET',dataType:'json',data:{query:query},success:function(data){callback(data);}});}function go(url){url='out?url='+url;window.open(url);}function out(url){window.open(atob(url));}