<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">var main_socket, socket_server, old_title, interval_id;

var main_connected = function(){};

var main_disconnected = function(){};

var main_error = function(data){}

var new_ann = function(data){
	if(data.text){
		show_new = false
		show_offer = true
		arr = (data.text).split('_')
		country = (arr[4]).replace('www.', '')
		region = arr[5]
		reg = RegExp("http\:\/\/"+arr[1]+"\.("+region+"|"+country+")(\/|\/"+arr[6]+"\/)category\/"+arr[2]+"(\#topbar$|$)")
		if(reg.test(location.href)){
			show_new = true
		}else{
			if(arr[7]!=0){
				ids = arr[3]+'\/'+arr[7]
			}else{
				ids = arr[3]
			}
			reg = RegExp("http\:\/\/"+arr[1]+"\.("+region+"|"+country+")(\/|\/"+arr[6]+"\/)category\/"+ids+"(\#topbar$|$)")
			creg = RegExp("http\:\/\/"+arr[1]+"\.("+region+"|"+country+")(\/|\/"+arr[6]+"\/)category\/"+arr[3])
			if(reg.test(location.href)){
				show_new = true
				show_offer = false
			}else if(creg.test(location.href)){
				if($("#count-in-tab-"+arr[7]+" b").html()){
					count_off_ann = parseInt($("#count-in-tab-"+arr[7]+" b").html())
					count_off_ann += 1
					$("#count-in-tab-"+arr[7]+" b").css('opacity', 1)
					$("#count-in-tab-"+arr[7]+" b").html("+"+count_off_ann)
					if(count_off_ann &gt; 9){
						$("#count-in-tab-"+arr[7]+" span").animate({'width':'17px'}, 1000)
					}
				}else{
					count_off_ann = 1
					$("#count-in-tab-"+arr[7]+" b").html("+"+count_off_ann)
					$("#count-in-tab-"+arr[7]).show()
					$("#count-in-tab-"+arr[7]+" span").css('width', '12px')
					$("#count-in-tab-"+arr[7]+" b").css('opacity', 1)
				}
			}else{
				if(arr[8] == 1 || arr[8] == '1'){
					reg2 = RegExp("http:\/\/"+arr[1]+"\.("+region+"|"+country+")(\/(\#topbar$|$)|\/"+arr[6]+"(\#topbar$|$)|\/"+arr[6]+"\/(\#topbar$|$)|(\#topbar$|$))")
				}else{
					reg2 = RegExp("http:\/\/"+arr[1]+"\.("+region+"|"+country+")(\/19\/(\#topbar$|$)|\/"+arr[6]+"\/19\/(\#topbar$|$)|\/19(\#topbar$|$)|\/19)")
				}
				if(reg2.test(location.href)){
					show_new = true
				}
			}
		}
		
		if(show_new){
			element_in_array = false
			if($("#count-stream-ann").html()){
				old_arr_ann_id = ($("#arr_ann_id").val()).split("_")
				for(i=0; i &lt; old_arr_ann_id.length; i++){
					if(old_arr_ann_id[i] == arr[0]){
						element_in_array = true
					}	
				}
				if(!element_in_array){
					count_new_ann = parseInt($("#count-stream-ann").html())
					count_new_ann += 1
					if(count_new_ann&gt;1&amp;&amp;count_new_ann&lt;5){
						title_ann = 'РѕР±СЉСЏРІР»РµРЅРёСЏ'
					}else{
						title_ann = 'РѕР±СЉСЏРІР»РµРЅРёР№'
					} 
					tmp = '&lt;div class="new-ann-bar"&gt;&lt;span id="count-stream-ann" class="label label-warning"&gt;+'+count_new_ann+'&lt;/span&gt; РЅРѕРІС‹С… '+title_ann+'&lt;/div&gt;'
					$("#arr_ann_id").val($("#arr_ann_id").val() + '_' + arr[0])
					$("#stream-ann").html(tmp)
				}
			}else{
				$("#auto-upload-ann").show()
				count_new_ann = 1
				tmp = '&lt;div id="stream-ann" style="height:5px;" onclick="show_new_ann('+show_offer+');"&gt;&lt;div class="new-ann-bar"&gt;&lt;span id="count-stream-ann" class="label label-warning"&gt;+1&lt;/span&gt; РЅРѕРІРѕРµ РѕР±СЉСЏРІР»РµРЅРёРµ&lt;/div&gt;&lt;/div&gt;'
				$("#auto-upload-ann").prepend(tmp)
				$("#arr_ann_id").val(arr[0])
				$("#stream-ann").animate({'height':'38px'}, 1000)	
			}
			if(!element_in_array){
				if(count_new_ann &gt; 1){
					tmp_t = (document.title).replace(/\([0-9]+\)\s/, '')	
				}else{
					tmp_t = document.title
				}
				document.title = "("+count_new_ann+") " + tmp_t
			}
		}
	}
}


var new_forum_message = function(data){
	if(data.text){
		show_new = false
		show_offer = true
		arr = (data.text).split('_')
		reg = RegExp("http\:\/\/forum\."+arr[2]+"\.ru((\/"+arr[1]+"\/?)|\/)?(\#topbar$|$)")
		if(reg.test(location.href)){
			element_in_array = false
			if($("#count-stream-ann").html()){
				old_arr_ann_id = ($("#arr_mess_id").val()).split("_")
				for(i=0; i &lt; old_arr_ann_id.length; i++){
					if(old_arr_ann_id[i] == arr[0]){
						element_in_array = true
					}	
				}
				if(!element_in_array){
					count_new_mess = parseInt($("#count-stream-ann").html())
					count_new_mess += 1
					if(count_new_mess&gt;1&amp;&amp;count_new_mess&lt;5){
						title_ann = 'СЃРѕРѕР±С‰РµРЅРёСЏ'
					}else{
						title_ann = 'СЃРѕРѕР±С‰РµРЅРёР№'
					} 
					tmp = '&lt;div class="new-ann-bar"&gt;&lt;span id="count-stream-ann"&gt;'+count_new_mess+'&lt;/span&gt; РЅРѕРІС‹С… '+title_ann+'&lt;/div&gt;'
					$("#arr_mess_id").val($("#arr_mess_id").val() + '_' + arr[0])
					$("#stream-ann").html(tmp)
				}
			}else{
				count_new_mess = 1
				tmp = '&lt;div id="stream-ann" style="height:5px;" onclick="show_new_message_forum();"&gt;&lt;div class="new-ann-bar"&gt;&lt;span id="count-stream-ann"&gt;1&lt;/span&gt; РЅРѕРІРѕРµ СЃРѕРѕР±С‰РµРЅРёРµ&lt;/div&gt;&lt;/div&gt;'
				$("#index-message").prepend(tmp)
				$("#arr_mess_id").val(arr[0])
				$("#stream-ann").animate({'height':'38px'}, 1000)	
			}
			if(!element_in_array){
				if(!old_title){
					old_title = document.title
				}
				if(interval_id){
					tmp_t = old_title.replace(/\([0-9]+\)\s/, '')
					old_title = "("+count_new_mess+") " + tmp_t
					document.title = old_title
				}else{
					document.title = "("+count_new_mess+") " + old_title
				}
			}
		}
	}
}



var main_socket_start = function(server) {
    main_socket = io.connect('https://'+server+':5000');
    socket_server = server
    main_socket.on('connect', main_connected);
    main_socket.on('disconnect', main_disconnected);
    main_socket.on('new-ann', new_ann);
    main_socket.on('new-forum-message', new_forum_message);
    main_socket.on('error', main_error)
};
</pre></body></html>