MediaWiki:BibleGet.js: Difference between revisions
no edit summary
Johnrdorazio (talk | contribs) No edit summary |
Johnrdorazio (talk | contribs) No edit summary |
||
Line 11: | Line 11: | ||
if(bibleQuoteCollection.includes(version+"/"+ref)){ | if(bibleQuoteCollection.includes(version+"/"+ref)){ | ||
//we already have an instance of this bible quote, avoid creating new div | //we already have an instance of this bible quote, avoid creating new div | ||
//This will also save us an ajax call | |||
console.log('We seem to have already dealt with the same bible quote on this page: '+version+'/'+ref); | console.log('We seem to have already dealt with the same bible quote on this page: '+version+'/'+ref); | ||
//however since the ajax calls are asynchronous, we probably won't have the actual div at the bottom of the page yet | |||
//so let's look for it inside the mouseover event | |||
$span.on('mouseenter', function(){ | $span.on('mouseenter', function(){ | ||
$bGetTIP = $("div[data-version='"+version+"'][data-ref='"+ref+"']"); | |||
console.log('I found ' + $bGetTIP.length + ' div(s) at the bottom of the page with this bible quote'); | |||
$bGetTIP.show(); | $bGetTIP.show(); | ||
let top = $span.offset().top; | let top = $span.offset().top; | ||
Line 31: | Line 34: | ||
$span.on('mouseleave', function(){ | $span.on('mouseleave', function(){ | ||
$bGetTIP = $("div[data-version='"+version+"'][data-ref='"+ref+"']"); | |||
//console.log('I found ' + $bGetTIP.length + ' div(s) at the bottom of the page with this bible quote'); | |||
setTimeout(function(){ $bGetTIP.fadeOut('slow') },500); | setTimeout(function(){ $bGetTIP.fadeOut('slow') },500); | ||
}); | }); |