Black_Sun / youtube autocount voices

// ==UserScript==
// @name         youtube autocount voices
// @namespace    http://youtube.com
// @version      1.1
// @author       Black_Sun
// @include        https://www.youtube.com/live_chat?v=*
// @include        https://www.youtube.com/live_chat?is_popout=1&v=*
// @grant        none
// @require      https://github.com/Black-Sunlight/lib-files/releases/download/jquery/jquery.js
// ==/UserScript==

(function($) {
	'use strict';
	var cpos=0,cneg=0,mes='',fint='',sint='';
	/*jshint multistr: true */
	$('#title').after("<div id='voicecount' style='margin-right:10px'></div><div style='margin:-5px 0 0 0;cursor:pointer;width: 205px;display:inline-block;'><button id='Pluses' style='cursor:pointer;border: 1px black solid;margin-right:5px;padding:1px 5px'>Пара +/-</button><button id='Yeses' style='cursor:pointer;border: 1px black solid;margin-right:5px;padding:1px 5px'>Пара Да/Нет</button><button id='stopall' style='cursor:pointer;border: 1px black solid;margin-right:5px;padding:1px 5px'>Стоп всё!</button></div>");
	$('#Pluses').on('click',function(){
		clearInterval(sint);
		clearInterval(fint);
		cpos=0;
		cneg=0;
		$('#voicecount').text("");
		count('clear','clear','clear');
		fint=setInterval(function(){
			count(/\+/ig,/\-/ig,'p');
		},500);
	});
	$('#Yeses').on('click',function(){
		clearInterval(sint);
		clearInterval(fint);
		cpos=0;
		cneg=0;
		$('#voicecount').text("");
		count('clear','clear','clear');
		sint=setInterval(function(){
			count(/да/ig,/нет/ig,'y');
		},500);
	});
	$('#stopall').on('click',function(){
		clearInterval(sint);
		clearInterval(fint);
		cpos=0;
		cneg=0;
		count('clear','clear','clear');
	});
	function count(repos,reneg,t){
		$('span[id^="message"]').each(function(){
			mes=$(this).text();
			if(repos != "clear" & reneg !="clear" & mes.search(repos)!=-1 & !$(this).attr('readed')){
				cpos+=1;
				$(this).attr('readed','readed');
			}
			if(repos != "clear" & reneg !="clear" & mes.search(reneg)!=-1 & !$(this).attr('readed')){
				cneg+=1;
				$(this).attr('readed','readed');
			}
			if(t=="p")$('#voicecount').text("Плюсов: "+cpos+" ; Минусов: "+cneg);
			if(t=="y")$('#voicecount').text("За ДА: "+cpos+" ; За Нет: "+cneg);
			if(t=="clear")$(this).removeAttr('readed');
		});
	}
})(jQuery);