jQuery(function($) { $('.poll-form').on('submit', function(e) { var $this = $(this); e.preventDefault(); $.post(window.location.href, $this.serialize(), function(data) { if(getCookie('polls')=="undefined") setCookie('polls',$this.find('.poll_id').val() ,"31-Dec-2020 00:00:00 GMT", '/'); else{setCookie('polls',getCookie('polls')+","+$this.find('.poll_id').val() ,"31-Dec-2020 00:00:00 GMT", '/');} var newVote = $this.find(':checked').val(); $this.find('label').hide(); $this.find('button').hide(); var total = parseInt($this.find('.poll_total').val()) + 1; if (total == "0") total = 1; $this.find('.bar-container').fadeIn().find('.bar').each(function() { var $this = $(this); var value = parseFloat($this.attr('data-value')); if ($this.attr('data-id') == newVote) { value++; } var percent = value / total * 100; $this.animate({ width: percent * 0.8 + '%' }, 2000).next().text(percent.toFixed(2) + '%'); }); }); }); $('body').on("mouseover",".instalive img",function(){ $('.instalive img').removeClass('addclass'); $(this).addClass('addclass');}) $('#v1').click(function(){ $('.active_tab').removeClass('active_tab'); $('#v1').addClass('active_tab '); $('#t1').css('display','block'); $('#t2').css('display','none'); $('#t3').css('display','none');}) $('#v2').click(function(){ $('.active_tab').removeClass('active_tab'); $('#v2').addClass('active_tab '); $('#t1').css('display','none'); $('#t2').css('display','block'); $('#t3').css('display','none');}) $('#v3').click(function(){ $('.active_tab').removeClass('active_tab'); $('#v3').addClass('active_tab '); $('#t1').css('display','none'); $('#t2').css('display','none'); $('#t3').css('display','block');}) $('#v11').click(function(){ $('.active_tab1').removeClass('active_tab1'); $('#v11').addClass('active_tab1 '); $('#t11').css('display','block'); $('#t12').css('display','none'); $('#t13').css('display','none');}) $('#v12').click(function(){ $('.active_tab1').removeClass('active_tab1'); $('#v12').addClass('active_tab1 '); $('#t11').css('display','none'); $('#t12').css('display','block'); $('#t13').css('display','none');}) $('#v13').click(function(){ $('.active_tab1').removeClass('active_tab1'); $('#v13').addClass('active_tab1 '); $('#t11').css('display','none'); $('#t12').css('display','none'); $('#t13').css('display','block');}) $('.like_c').click(function(e){ document.getElementById('com_id').value= $(this).parent().children('.like1').children('a')[0].innerHTML; document.getElementById('com_st').value='plus'; submitform($(this).parent().children('.like1').children('a')[1].innerHTML); }) $('.unlike_c').click(function(){ document.getElementById('com_id').value= $(this).parent().children('.like1').children('a')[0].innerHTML; document.getElementById('com_st').value='minus'; submitform($(this).parent().children('.like1').children('a')[1].innerHTML); }) /*$('#mycarousel-vertical img').click(function(){ $strid=$(this).attr('src'); $strid=$strid.substr(18,11); $('iframe').attr('src','http://www.youtube.com/embed/'+$strid+'?rel=0'); $('.media_text')[0].innerHTML=$(this).next('div')[0].innerHTML; })*/ $('.minus').click(function(){ //preventDefault(); // $('.p_col')[0].innerHTML=parseInt($('.p_col')[0].innerHTML)-1; }) $('.plus').click(function(){ // $('.p_col')[0].innerHTML=parseInt($('.p_col')[0].innerHTML)+1; }) }); function newPopup(url) { popupWindow = window.open( url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes') } function submitform($act) { document.forms["com_for"].setAttribute('action', $act); document.forms["com_for"].submit(); } function setCookie (name, value, expires, path, domain, secure) { document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } // возвращает cookie с именем name, если есть, если нет, то undefined function getCookie(name) { var matches = document.cookie.match(new RegExp( "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" )); return matches ? decodeURIComponent(matches[1]) : undefined; }