s.length > 0) { var counter = results[0]; counter.fetchWhenSave(true); counter.increment("time"); var $element = $(document.getElementById(url)); $element.find('.leancloud-visitors-count').text(counter.get('time')); counter.save(null, { success: function(counter) { }, error: function(counter, error) { console.log('Failed to save Visitor num, with error message: ' + error.message); } }); } else { var $element = $(document.getElementById(url)); $element.find('.leancloud-visitors-count').text('Counter not initialized! See more at console err msg.'); console.error('ATTENTION! LeanCloud counter has security bug, see here how to solve it: https://github.com/theme-next/hexo-leancloud-counter-security. \n But you also can use LeanCloud without security, by set \'security\' option to \'false\'.'); } }, error: function(error) { console.log('Error:' + error.code + " " + error.message); } }); } $(function() { var Counter = AV.Object.extend("Counter"); if ($('.leancloud_visitors').length == 1) { addCount(Counter); } else if ($('.post-title-link').length > 1) { showTime(Counter); } });