var flUser = window.flUser || {
data: {
id: 1,
firstName: 'Hugo'
}
};
function toggleChatHolder() {
$('.chat-iframe-holder').toggleClass('active');
}
function hideAssistant() {
$('.chat-iframe-holder').addClass('hidden');
$('.fl-assistant-btn').addClass('hidden');
if ($('.chat-iframe-holder').hasClass('active')) {
toggleChatHolder();
}
}
function showAssistant() {
$('.chat-iframe-holder').removeClass('hidden');
$('.fl-assistant-btn').removeClass('hidden');
toggleChatHolder();
}
// Function to create and start the observer
function watchForElementAppearance(targetSelector, callback) {
// Configuration of the observer
var config = {
childList: true,
subtree: true
};
// Callback function to execute when mutations are observed
function observerCallback(mutationsList, observer) {
for (var i = 0; i < mutationsList.length; i++) {
var mutation = mutationsList[i];
if (mutation.type === 'childList') {
for (var j = 0; j < mutation.addedNodes.length; j++) {
var node = mutation.addedNodes[j];
if (node.nodeType === Node.ELEMENT_NODE) {
var foundElement = node.querySelector(targetSelector);
if (foundElement) {
callback(foundElement);
observer.disconnect(); // Optional: stop observing after the first detection
return; // Exit once the target is found
} else if (node.matches(targetSelector)) { // If the node itself matches the selector
callback(node);
observer.disconnect();
return;
}
}
}
}
}
}
// Create an observer instance linked to the callback function
var observer = new MutationObserver(observerCallback);
// Start observing the document with the configured parameters
observer.observe(document.body, config);
}
function attachOverlayClick() {
$('.overlay.data-source-overlay .overlay-close a').on('click',...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.