('widgets.comments.new_comment', function(num, last_comment, date, sign, wID, n) { if ( typeof VKWidgetsComments[n - 1] !== 'undefined' && typeof VKWidgetsComments[n - 1].page_id !== 'undefined' ) new_data.page_id = VKWidgetsComments[n - 1].page_id; else new_data.page_id = VKWidgetsComments[0].page_id; //console.log(new_data); // if (!evcCommentsRefresh) { evcCommentsRefresh = true; jQuery.ajax({ url: ajaxurl, data: new_data, type:"POST", dataType: 'json', success: function(data) { //console.log(data); // evcCommentsRefresh = false; } }); } }); VK.Observer.subscribe('widgets.comments.delete_comment', function(num, last_comment, date, sign) { //console.log(date); }); } //console.log(VKWidgetsPolls); // Polls if (typeof VKWidgetsPolls !== 'undefined' ) { //console.log(VKWidgetsPolls); for (index = 0; index < VKWidgetsPolls.length; ++index) { VK.Widgets.Poll( VKWidgetsPolls[index].element_id, VKWidgetsPolls[index].options, VKWidgetsPolls[index].poll_id ); } evcCommentsRefresh = false; var new_data = { post_id: evc_post_id, url: document.URL, widget_api_id: jQuery('meta[property="vk:app_id"]').attr('content'), action: 'evc_comments_refresh' }; VK.Observer.subscribe('widgets.comments.new_comment', function(num, last_comment, date, sign, wID, n) { if ( typeof VKWidgetsComments[n - 1] !== 'undefined' && typeof VKWidgetsComments[n - 1].page_id !== 'undefined' ) new_data.page_id = VKWidgetsComments[n - 1].page_id; else new_data.page_id = VKWidgetsComments[0].page_id; //console.log(new_data); // if (!evcCommentsRefresh) { evcCommentsRefresh = true; jQuery.ajax({ url: ajaxurl, data: new_data, type:"POST", dataType: 'json', success: function(data) { //console.log(data); // evcCommentsRefresh = false; } }); } }); VK.Observer.subscribe('widgets.comments.delete_comment', function(num, last_comment, date, sign) { //console.log(date); }); } //console.log(VKWidgetsSubscribe); // Widget Subscribe if (typeof VKWidgetsSubscribe !== 'undefined' ) { var subscribeCookieExpires = 1; // !!! for (index = 0; index < VKWidgetsSubscribe.length; ++index) { VK.Widgets.Subscribe( VKWidgetsSubscribe[index].element_id, VKWidgetsSubscribe[index].options, VKWidgetsSubscribe[index].owner_id ); } VK.Observer.subscribe('widgets.subscribed', function(n) { vkwidget = jQuery("#vkwidget" + n).parent(); vkwidgetID = jQuery(vkwidget).attr('id'); if (jQuery(vkwidget).hasClass('evc-vk-lock')) { console.log('Fire'); //vkwidgetID = jQuery("#vkwidget" + n).parent().attr('id'); subscribeObj = jQuery.grep(VKWidgetsSubscribe, function(e){ return e.element_id == vkwidgetID; }); if (subscribeObj.length != 0) { o = subscribeObj[0].owner_id; if (jQuery.cookie('vkUnLock' + o) == 'undefined' || !jQuery.cookie('vkUnLock' + o) || jQuery.cookie('vkUnLock' + o) != subscribeObj[0].owner_id ) { jQuery.cookie('vkUnLock' + o, subscribeObj[0].owner_id, { expires: subscribeCookieExpires, path: '/' }); } location.reload(); } } }); VK.Observer.subscribe('widgets.unsubscribed', function(n) { vkwidget = jQuery("#vkwidget" + n).parent(); vkwidgetID = jQuery(vkwidget).attr('id'); if (jQuery(vkwidget).hasClass('evc-vk-lock')) { console.log('Fire'); subscribeObj = jQuery.grep(VKWidgetsSubscribe, function(e){ return e.element_id == vkwidgetID;}); if (subscribeObj.length != 0) { o = subscribeObj[0].owner_id; if (jQuery.cookie('vkUnLock' + o) != 'undefined') { jQuery.removeCookie('vkUnLock' + o); } } } }); } // console.log(VKWidgetsContactUs); // Contact Us if (typeof VKWidgetsCommunityMessages !== 'undefined') { console.log(VKWidgetsCommunityMessages); for (index = 0; index < VKWidgetsCommunityMessages.length; ++index) { VK.Widgets.CommunityMessages( VKWidgetsCommunityMessages[index].element_id, VKWidgetsCommunityMessages[index].group_id, VKWidgetsCommunityMessages[index].options ); } } }; /* ]]> */