mirror of
https://github.com/nuttylmao/nutty.gg.git
synced 2026-09-19 04:00:59 -04:00
Updated to new Settings page
This commit is contained in:
@@ -1,58 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Settings</title>
|
||||
<link rel="icon" href="../../.resources/logo.png" type="image/png">
|
||||
<title>nutty</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
/* Remove default body margin */
|
||||
display: flex;
|
||||
/* Use flexbox for layout */
|
||||
background: #181818;
|
||||
}
|
||||
|
||||
#settings-container {
|
||||
width: 600px;
|
||||
/* 50% of viewport width */
|
||||
min-width: 600px;
|
||||
/* 50% of viewport width */
|
||||
#widgetContainer {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
/* 100% of viewport height */
|
||||
border: none;
|
||||
/* Remove default iframe border */
|
||||
}
|
||||
|
||||
#widget-container {
|
||||
flex-grow: 1;
|
||||
/* Allow the content-container to take up remaining space */
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.content-container {
|
||||
width: 50vw;
|
||||
height: 100vh;
|
||||
background-color: #f0f0f0;
|
||||
/* Example background for right side */
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
/* Include padding in width/height */
|
||||
border-width: 0px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<iframe id="settings-container"></iframe>
|
||||
<div id="widget-container">
|
||||
<iframe id="widget"></iframe>
|
||||
</div>
|
||||
<iframe id="widgetContainer"></iframe>
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
|
||||
<script src="./script.js"></script>
|
||||
</html>
|
||||
@@ -1,33 +1,26 @@
|
||||
let settingsContainer = document.getElementById('settings-container');
|
||||
settingsContainer.src = `../../.utilities/settings-page-builder?settingsJson=${window.location.href}/settings.json`
|
||||
//settingsContainer.src = `../../.utilities/settings-page-builder?settingsJson=../../multistream-alerts/settings/settings.json`
|
||||
console.log(settingsContainer.src);
|
||||
const widgetContainer = document.getElementById('widgetContainer');
|
||||
|
||||
function reloadWidget(data) {
|
||||
let widget = document.getElementById("widget");
|
||||
widget.src = `${getParentUrl()}?${data}`;
|
||||
}
|
||||
const settingsPageURL = '../../.utilities/settings-page-builder';
|
||||
|
||||
function getParentUrl() {
|
||||
const currentUrl = window.location.href;
|
||||
const urlParts = currentUrl.split('/');
|
||||
const currentURL = window.location.href;
|
||||
|
||||
// Remove the last part of the URL (the current page/file)
|
||||
urlParts.pop();
|
||||
let settingsJSON;
|
||||
let baseURL = currentURL;
|
||||
|
||||
// Remove the last part again to go one directory up
|
||||
urlParts.pop();
|
||||
if (baseURL.endsWith("index.html"))
|
||||
baseURL = baseURL.replace("index.html", "");
|
||||
|
||||
// Reconstruct the URL
|
||||
const parentUrl = urlParts.join('/');
|
||||
settingsJSON = "?settingsJson=" + baseURL + "settings.json";
|
||||
|
||||
// Ensure there's a trailing slash if necessary (if it was a directory)
|
||||
if (urlParts.length > 2 && !parentUrl.endsWith('/')) {
|
||||
return parentUrl + '/';
|
||||
}
|
||||
const lastSlashIndex = baseURL.lastIndexOf("/");
|
||||
let widgetURL = "&widgetURL=" + baseURL.replace("/settings", "");
|
||||
|
||||
return parentUrl;
|
||||
}
|
||||
console.debug("Window Ref: " + window.location.href);
|
||||
console.debug("Base URL: " + baseURL);
|
||||
console.debug("Settings JSON: " + settingsJSON);
|
||||
console.debug("Widget URL: " + widgetURL);
|
||||
|
||||
widgetContainer.src = settingsPageURL + settingsJSON + widgetURL;
|
||||
|
||||
function callFunction(functionName) {
|
||||
console.debug(`Calling ${functionName}`);
|
||||
|
||||
Reference in New Issue
Block a user