MediaWiki:BibleGet.js: Difference between revisions
Content deleted Content added
Johnrdorazio (talk | contribs) No edit summary |
Johnrdorazio (talk | contribs) No edit summary |
||
Line 22: | Line 22: | ||
"html": data |
"html": data |
||
}); |
}); |
||
$bGetTIP.append($('<p>',{"text": " — powered by BibleGet I/O","css":{"font-size":".9em","text-align":"right"}})); |
$bGetTIP.append($('<p>',{"text": " — powered by BibleGet I/O","css":{"font-size":".9em","text-align":"right","font-style":"italic"}})); |
||
$('body').append($bGetTIP); |
$('body').append($bGetTIP); |
||
Revision as of 00:43, September 5, 2020
(function($){
$(document).ready(function(){
if( $('.bibleQuoteRef').length > 0 ){
console.log("There are bible quotes on this page!");
$('.bibleQuoteRef').each(function(){
let version = $(this).attr('data-version');
let ref = $(this).attr('data-ref');
let $span = $(this);
$.ajax({
method: 'POST',
url: 'https://query.bibleget.io/',
data: {
"version": version,
"query": ref,
"appid": 'SeminaVerbi',
"return": 'html'
},
success: function(data){
let $bGetTIP = $('<div>', {
"class": "bibleGetQuote",
"data-ref": ref,
"html": data
});
$bGetTIP.append($('<p>',{"text": " — powered by BibleGet I/O","css":{"font-size":".9em","text-align":"right","font-style":"italic"}}));
$('body').append($bGetTIP);
$span.on('mouseenter', function(){
$bGetTIP.show();
let top = $span.offset().top;
let left = $span.offset().left + $span.outerWidth() + 15;
$bGetTIP.css({"top":top,"left":left});
});
/*
$span.on('mousemove', function(){
let top = $span.offset().top;
let left = $span.offset().left + $span.outerWidth();
$bGetTIP.css({"top":top,"left":left});
});
*/
$span.on('mouseleave', function(){
$bGetTIP.fadeOut('slow');
});
console.log("Injected Bible quote for ref = " + ref + " with value obtained from BibleGet service:");
console.log(data);
},
error: function(jqXHR, textStatus, errorThrown){
console.log("There was an error while trying to communicate with the BibleGet server:")
console.log(errorThrown + ' ' + textStatus + ': ' + jqXHR.responseText);
}
});
});
}
});
})(jQuery);