CSS personnalisé |
#app {
min-height: 100vh;
position: relative;
background: none !important;
}
/* Fixed background div */
.background-container {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 100vh;
width: 100vw;
z-index: -1;
overflow: hidden;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.background-container::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image: var(--bg-image);
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
body {
margin: 0;
padding: 0;
min-height: 100vh;
background: transparent;
overflow-y: auto;
}
.content {
position: relative;
z-index: 1;
min-height: 100vh;
overflow-y: auto;
}
#sortable {
display: flex;
flex-wrap: wrap;
align-items: start !important;
gap: 1rem;
padding: 1rem;
position: relative;
}
.module-container {
border: 0px;
border-radius: 18px;
box-shadow: 0 0 20px 0 #0053;
margin: 10px 40px;
max-width: 1000px;
overflow: hidden;
width: 100%;
}
.tags-container {
flex: 1;
background-color: rgba(255,255,255,0.4);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-radius: 18px;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 1rem;
padding: 1rem;
}
.tags-title {
color: #fff;
text-transform: capitalize;
margin: 20px;
text-shadow: 0px 0px 3px #0053;
display: none;
visibility: hidden;
}
#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);
z-index: 2;
}
#config-buttons a {
background: none;
}
#config-buttons a svg {
transition: all 0.1s ease-in-out;
color: rgba(255, 255, 255, 0.5);
}
#config-buttons a:hover svg {
transform: scale(1.1);
color: rgba(255, 255, 255, 0.95);
}
.item {
border: 0px;
border-radius: 12px;
box-shadow: 0px 0px 20px #0053;
transition: all .15s ease-in-out;
}
.item:hover {
border: 2px solid #fff;
box-shadow: 0px 0px 8px #0058;
}
.module-container header .section-title {
color: #fff;
font-size: 18px;
margin-left: 25px;
}
div.create .input input {
background-color: #0003;
border: hidden;
color: #fff;
}
div.create .input label:not(.switch) {
color: #fff;
}
.module-container .table tr {
background-color: #fff0;
}
.module-container .table tr td {
color: #fff;
}
.module-container .table thead th {
background-color: #fff2;
color: #fff;
border-top: hidden;
}
.module-container header,
#sapconfig h2,
.module-container footer {
background-color: #fff2;
border-bottom: hidden;
border-top: hidden !important;
}
.module-container {
backdrop-filter: blur(10px);
background: #5578;
}
.module-container .table {
background: #fff0;
}
.module-container .table tbody a {
color: #fff;
}
.module-container .module-actions .button {
border: hidden;
color: #fff;
}
.module-actions .button span {
color: #fff;
}
#sapconfig h2 {
color: #fff;
}
.toggleinput {
background-color: #fff3;
border-radius: 8px;
}
.toggleinput .name {
color: #fff;
margin: 5px;
}
.toggleinput .switch {
margin: 5px;
}
.toggleinput .switch .slider {
box-shadow: 0px 0px 5px 0 #0004 inset;
}
.textarea textarea {
border: hidden;
background-color: #0004;
color: #fff;
box-shadow: 0px 0px 10px 0 #0002 inset;
}
.input .select2-container .select2-selection {
background-color: #0003;
border-radius: 8px;
border: hidden;
}
.input .select2-container .select2-selection__choice {
background-color: #fff3;
border: 1px solid #fff7;
color: #fff;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
color: #fff;
}
.module-actions .button::after {
border-right: hidden;
}
div.create .input input,
div.create .input select {
border: hidden;
border-radius: 8px;
background-color: #0003;
color: #fff;
}
.module-container .table tbody tr:hover {
background: #fff3;
}
.module-container .table tbody tr:hover td:first-child:before {
display: none;
}
.alert {
background: #5578;
border-radius: 18px;
box-shadow: 0 0 15px 0 #0053;
backdrop-filter: blur(10px);
color: #fff;
}
.alert.alert-danger::before,
.alert.alert-success::before {
border-radius: 13px;
box-shadow: 0px 0px 20px #0034;
margin: 5px;
}
.searchform {
align-self: flex-start;
background: none;
border-bottom: none;
border-top: none;
box-shadow: none;
z-index: 0;
}
.searchform .input-container {
background: #fff7;
border-radius: 13px;
box-shadow: none;
display: flex;
overflow: hidden;
position: relative;
backdrop-filter: blur(10px);
}
.searchform select,
.searchform button {
background: #fff9;
border: none;
margin: 7px;
border-radius: 8px;
color: #333;
font-weight: bold;
}
.searchform button {
display: none;
}
@media (max-width: 680px) {
.background-container::after {
background-size: auto 100vh;
background-position: center top;
}
#sortable {
justify-content: center !important;
margin-top: 1rem;
}
.tags-container {
display: grid;
grid-template-columns: 1fr;
gap: 1rem;
background-color: rgba(255,255,255,0.6);
}
.item {
background-color: rgba(22,27,31,0.8);
}
}
|
|
JavaScript personnalisé |
$(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);
});
|
|