', {href: img.attr('src'),'data-fancybox': 'article-image','data-caption': img.attr('alt')});img.wrap(a);});const voteTimers = {};$('.vote-btn').click(function(){if (!hm.userInfo || !hm.userInfo.uid){window.location.href = hm.link.passApiUrl;return;}var btn = $(this);var id = btn.data('id');var group = $('.vote-btn[data-id="' + id + '"]');var upBtn = group.filter('.vote-up');var countEl = upBtn.find('.vote-count');let action = 0;if (btn.hasClass('active')){btn.removeClass('active');if (btn.hasClass('vote-up')){var count = parseInt(countEl.text()) || 0;countEl.text(Math.max(count - 1, 0));}}else{if (upBtn.hasClass('active')){var count = parseInt(countEl.text()) || 0;countEl.text(Math.max(count - 1, 0));}group.removeClass('active');btn.addClass('active');action = btn.hasClass('vote-up') ? 1 : -1;if (btn.hasClass('vote-up')){var count = parseInt(countEl.text()) || 0;countEl.text(count + 1);}}if (voteTimers[id]) clearTimeout(voteTimers[id]);voteTimers[id] = setTimeout(function(){$.post('/api/vote/article', {objId: id,action: action});delete voteTimers[id];}, 1000);});