Custom CSS |
@import url("https://fonts.googleapis.com/css?family=Raleway");
#app {
background-position: center;
}
#app #sortable,
#app main {
padding: 25px;
}
#config-buttons {
bottom: 50%;
transform: translateY(50%);
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
box-shadow: rgba(255, 255, 255, 0.1) -1px 1px 1px 0, rgba(255, 255, 255, 0.1) 0 -1px 1px 0, rgba(0, 0, 0, 0.1) -1px 0 20px 5px;
background-color: rgba(40, 40, 40, 0.25);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
#config-buttons a {
background: none;
}
#config-buttons a svg {
transition: all 0.1s linear;
color: rgba(255, 255, 255, 0.5);
}
#config-buttons a:hover svg {
transform: scale(1.1);
color: rgba(255, 255, 255, 0.95);
}
.black {
color: white !important;
}
.item {
box-shadow: rgba(0, 0, 0, 0.1) -1px -1px 3px 0, rgba(0, 0, 0, 0.2) 0px 10px 10px -3px, rgba(0, 0, 0, 0.04) 0px 10px 10px -3px !important;
border-radius: 12% / 45%;
border: hidden;
outline: hidden;
height: 75px;
width: 275px;
margin: 1.0rem;
padding: 1rem 60px 1rem 1rem;
transition: all 1.0s easy-in-out;
transition-property: transform, box-shadow, background-color;
background-color: rgba(255, 255, 255, 0.2) !important;
font-family: 'Raleway', sans-serif;
font-size: 14px;
}
.item:hover {
background-color: rgba(40, 40, 40, 0.3) !important;
box-shadow: rgba(66, 66, 66, 0.1) 0px 30px 30px -17px !important;
}
|
|
Custom JavaScript |
$(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;
// Insert the background container at the start of body
document.body.insertBefore(bgContainer, document.body.firstChild);
});
|
|