Dash
Items
user
Switch User
JavaScript personnalisé
Enregistrer
Annuler
$(document).ready(function () { const base = (document.querySelector("base") || {}).href || '/'; const container = $("#sortable"); const liveStats = () => { let hidden, visibilityChange; if (typeof document.hidden !== "undefined") { hidden = "hidden"; visibilityChange = "visibilitychange"; } else if (typeof document.msHidden !== "undefined") { hidden = "msHidden"; visibilityChange = "msvisibilitychange"; } else if (typeof document.webkitHidden !== "undefined") { hidden = "webkitHidden"; visibilityChange = "webkitvisibilitychange"; } const livestatsRefreshTimeouts = []; const livestatsFuncs = []; const livestatsContainers = $(".livestats-container"); function stopLivestatsRefresh() { livestatsRefreshTimeouts.forEach(timeoutId => { window.clearTimeout(timeoutId); }); } function startLivestatsRefresh() { livestatsFuncs.forEach(fun => fun()); } if (livestatsContainers.length > 0) { if (typeof document.addEventListener !== "undefined" && hidden !== undefined) { document.addEventListener(visibilityChange, function () { if (document[hidden]) { stopLivestatsRefresh(); } else { startLivestatsRefresh(); } }, false); } else { console.log("Browser does not support visibilityChange"); } livestatsContainers.each(function (index) { const id = $(this).data("id"); const dataonly = $(this).data("dataonly"); const increaseby = dataonly == 1 ? 20000 : 1000; const container = $(this); const max_timer = 30000; let timer = 5000; const fun = function worker() { $.ajax({ url: base + "get_stats/" + id, dataType: "json", success: function (data) { if (data && data.html) { container.html(data.html); timer = data.status == "active" ? increaseby : Math.min(timer + 2000, max_timer); } }, error: function(xhr, status, error) { console.error('Error fetching stats:', error); }, complete: function () { livestatsRefreshTimeouts[index] = window.setTimeout(worker, timer); } }); }; livestatsFuncs[index] = fun; fun(); }); } }; const customMain = () => { if (window.location.pathname !== "/") { console.log("Not on home page, skipping customization"); return; } if (!container.length) { console.error("Sortable container not found"); return; } // Store the existing content const existingContent = container.children().not('.add-item'); // Create wrapper for the content const wrapper = document.createElement("div"); wrapper.classList.add("tags-container"); // Move the content into the wrapper $(wrapper).append(existingContent); // Clear the container and add the wrapped content container.empty() .append(wrapper) .append($('.add-item')); // Re-add the "Pin item to dashboard" section // Make sure container is visible container.css("opacity", "1"); // Initialize live stats liveStats(); }; customMain(); }); document.addEventListener('DOMContentLoaded', function() { // Create background container const bgContainer = document.createElement('div'); bgContainer.className = 'background-container'; // Get the background image directly from inline style const appElement = document.getElementById('app'); const bgImage = appElement.style.backgroundImage; // Set the background directly on the container bgContainer.style.backgroundImage = bgImage; // Clear the app background appElement.style.background = 'none'; // Insert the background container at the start of body document.body.insertBefore(bgContainer, document.body.firstChild); });
Tableau de bord
Liste des applications
Liste des labels
Réglages