<script type="text/javascript">
var ajax_cache = {};
$(document).ready(function(){
$('[data-toggle="popover"]').popover({
html: true,
title: $(this).attr('title'),
content: ajax_cache[$(this).attr('id’)] ? ajax_cache[$(this).attr('id’)] : function() {
NProgress.start();
var saveid = $(this).attr('id’);
return $.ajax({
url: '//shikimori.org/api/animes/'+$(this).attr('id'),
dataType: 'json',
async: false,
success: function (data){
ajax_cache[saveid] = data;
setTimeout(function() {NProgress.done();}, 1000)}
}).responseText;
},
trigger: 'hover',
placement: 'left',
});
});
</script>
console.log("<!-- -->".replace(/(<!--).*?(-->)/, '$1 some text $2'));