MediaWiki:BibleGet.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 3: Line 3:
let domCheckInterval = [];
let domCheckInterval = [];
let ajaxCount = 0;
let ajaxCount = 0;
let BibleQuotesDomElements = [];
(function($,mw){
(function($,mw){
$(document).ready(function(){
$(document).ready(function(){
Line 63: Line 64:
});
});
$bGetTIP.append($('<p>',{"text": " — powered by BibleGet I/O","css":{"font-size":".9em","text-align":"right","font-style":"italic","font-weight":"bold","color":"gray"}}));
$bGetTIP.append($('<p>',{"text": " — powered by BibleGet I/O","css":{"font-size":".9em","text-align":"right","font-style":"italic","font-weight":"bold","color":"gray"}}));
$('body').append($bGetTIP);
//$('body').append($bGetTIP);
BibleQuotesDomElements.push($bGetTIP);
$span.on('mouseenter', function(){
$span.on('mouseenter', function(){
Line 99: Line 102:
$(document).ajaxStop(function(){
$(document).ajaxStop(function(){
console.log("ajaxStop has fired " + ++ajaxCount + " time(s)");
console.log("ajaxStop has fired " + ++ajaxCount + " time(s)");
//just because ajax requests have finished doesn't mean the dom manipulation is done...
//let's create a check for all elements before doing any further manipulation
//let's create a check for all elements before doing any further manipulation
if(domCheckInterval.length === 0){
if(domCheckInterval.length === 0){
//We have decided not to append anything to the document during the ajax calls
//We have simply collected the elements to append in an array
//So let's append them now...
$('body').append(BibleQuotesDomElements);
domCheckInterval.push(setInterval(onBGetDomElementsReady,100));
domCheckInterval.push(setInterval(onBGetDomElementsReady,100));
}
}