MediaWiki:BibleGet.js: Difference between revisions
Content deleted Content added
Johnrdorazio (talk | contribs) Created page with "(function($){ $(document).ready(function(){ if( $('.BibleGetQuote').length > 0 ){ console.log("There are bible quotes on this page!"); } }); })(jQuery);" |
Johnrdorazio (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
(function($){ |
(function($){ |
||
$(document).ready(function(){ |
$(document).ready(function(){ |
||
if( $('. |
if( $('.bibleGetQuote').length > 0 ){ |
||
console.log("There are bible quotes on this page!"); |
console.log("There are bible quotes on this page!"); |
||
$('.bibleGetQuote').each(function(){ |
|||
let version = $(this).attr('data-version'); |
|||
let ref = $(this).attr('data-ref'); |
|||
let $div = $(this); |
|||
$.ajax({ |
|||
method: 'POST', |
|||
url: 'https://query.bibleget.io/', |
|||
data: { |
|||
"version": version, |
|||
"query": ref, |
|||
"appid": 'SeminaVerbi', |
|||
"return": 'html' |
|||
}, |
|||
success: function(data){ |
|||
$div.html(data); |
|||
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); |
|||
} |
|||
}); |
|||
}); |
|||
} |
} |
||
}); |
}); |
Revision as of 20:31, September 4, 2020
(function($){
$(document).ready(function(){
if( $('.bibleGetQuote').length > 0 ){
console.log("There are bible quotes on this page!");
$('.bibleGetQuote').each(function(){
let version = $(this).attr('data-version');
let ref = $(this).attr('data-ref');
let $div = $(this);
$.ajax({
method: 'POST',
url: 'https://query.bibleget.io/',
data: {
"version": version,
"query": ref,
"appid": 'SeminaVerbi',
"return": 'html'
},
success: function(data){
$div.html(data);
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);