$(document.head).append(''); window.SkipIfAllObjectsAreHidden = function() { if ($("#firstPage").val() == "1") { var allHidden = true; $('[id*="_question"]').each((function(index, value) { if ($(this).is(":visible") && $(this).css("visibility") != "hidden") allHidden = false } )); $('[id*="_text"]').each((function(index, value) { if ($(this).is(":visible") && $(this).css("visibility") != "hidden") allHidden = false } )); $('[id*="_image"]').each((function(index, value) { if ($(this).is(":visible") && $(this).css("visibility") != "hidden") allHidden = false } )); $('[id*="_table"]').each((function(index, value) { if ($(this).is(":visible") && $(this).css("visibility") != "hidden") allHidden = false } )); $('[id*="_social"]').each((function(index, value) { if ($(this).is(":visible") && $(this).css("visibility") != "hidden") allHidden = false } )); $('.alleg-hide').each(function() { allHidden = false; }); if (allHidden) $("#survey").fadeOut(100, (function() { nextButtonClicked() } )) } } window.customSpinner = { create: function() { var url = 'https://platform-services.custom.eu.mcx.cloud/bonfire-extensibility/basic-patches/spinner/spinner.php'; var s = 'rgb(0, 0, 0)'; // default black secondary colour var p = $('button.nextButton').css('background-color'); // get primary colour if (!p) { p = 'rgb(255, 255, 255)' // default black primary colour; } else { // determine if black or white should be the background colour depending on primary colour's closeness to white var pSplit = p.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/); if (pSplit && pSplit.length == 4) { pSplit = pSplit.slice(1, 4); // W3C guidelines and formula pSplit = pSplit.map(function(c) { c = c / 255.0; return c <= 0.03928? c/12.92 : Math.pow((c+0.055)/1.055, 2.4); }); if (pSplit[0] * 0.2126 + pSplit[1] * 0.7152 + pSplit[2] * 0.0722 < 0.180) { // if closer to black use white s = 'rgb(255, 255, 255)'; } } } url += '?primary=' + encodeURIComponent(p) + '&secondary=' + encodeURIComponent(s); $('') .attr('rel','stylesheet') .attr('href', url) .appendTo('head'); $('
') .appendTo('body'); }, show: function() { $('#customSpinner-cover').attr('active', 'active'); }, hide: function() { $('#customSpinner-cover').removeAttr('active'); } }