MediaWiki:BibleGet.js: Difference between revisions
no edit summary
Johnrdorazio (talk | contribs) No edit summary |
Johnrdorazio (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
(function($){ | (function($){ | ||
$(document).ready(function(){ | $(document).ready(function(){ | ||
if( $('. | if( $('.bibleQuoteRef').length > 0 ){ | ||
console.log("There are bible quotes on this page!"); | console.log("There are bible quotes on this page!"); | ||
$('. | $('.bibleQuoteRef').each(function(){ | ||
let version = $(this).attr('data-version'); | let version = $(this).attr('data-version'); | ||
let ref = $(this).attr('data-ref'); | let ref = $(this).attr('data-ref'); | ||
let $ | let $span = $(this); | ||
$.ajax({ | $.ajax({ | ||
method: 'POST', | method: 'POST', | ||
Line 17: | Line 17: | ||
}, | }, | ||
success: function(data){ | success: function(data){ | ||
$div. | let $bGetTIP = $('<div>', { | ||
"class": "bibleGetQuote", | |||
"data-ref": ref, | |||
"html": data | |||
}); | |||
$(body).append($bGetTIP); | |||
$span.on('mouseenter', function(){ | |||
$bGetTIP.show(); | |||
let top = $span.offset().top; | |||
let left = $span.offset().left + $span.outerWidth(); | |||
$bGetTIP.css({"top":top,"left":left}); | |||
}); | |||
console.log("Injected Bible quote for ref = " + ref + " with value obtained from BibleGet service:"); | console.log("Injected Bible quote for ref = " + ref + " with value obtained from BibleGet service:"); | ||
console.log(data); | console.log(data); |