testing the settings function
This commit is contained in:
parent
681abf0527
commit
f6f077ba4f
@ -140,6 +140,12 @@
|
|||||||
<p class="copy-link" id="discordLink" style="color: black;">https://discord.gg/czV7M8JXXM</p>
|
<p class="copy-link" id="discordLink" style="color: black;">https://discord.gg/czV7M8JXXM</p>
|
||||||
<button class="copy-btn" onclick="copyLink()" style="background-color: rgb(76, 175, 80);">Copy Link</button>
|
<button class="copy-btn" onclick="copyLink()" style="background-color: rgb(76, 175, 80);">Copy Link</button>
|
||||||
<button class="cancel-btn" onclick="closeModal()" style="background-color: rgb(76, 175, 80);">Close</button>
|
<button class="cancel-btn" onclick="closeModal()" style="background-color: rgb(76, 175, 80);">Close</button>
|
||||||
|
<script>
|
||||||
|
window.addEventListener('message', (event) => {
|
||||||
|
// Set the received color as the background color of the page
|
||||||
|
document.body.style.backgroundColor = event.data;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="js/popup.js"></script>
|
<script src="js/popup.js"></script>
|
||||||
|
@ -1,35 +1,30 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>DON'T USE OR YOU WILL BE STUCK ON ONE BACKGROUND</title>
|
<title>Page 1 - Color Controller</title>
|
||||||
<script>
|
<script>
|
||||||
// Function to apply the background color on page load
|
let newWindow;
|
||||||
function applySavedBackgroundColor() {
|
|
||||||
const savedColor = localStorage.getItem('backgroundColor');
|
function openPage2() {
|
||||||
if (savedColor) {
|
newWindow = window.open('index.html', 'main');
|
||||||
document.body.style.backgroundColor = savedColor;
|
}
|
||||||
}
|
|
||||||
}
|
function changeWindowColor(color) {
|
||||||
|
if (newWindow) {
|
||||||
// Function to change the background color and save it
|
newWindow.postMessage(color, '*');
|
||||||
function changeBackgroundColor(color) {
|
} else {
|
||||||
document.body.style.backgroundColor = color;
|
alert('Please open the main page first.');
|
||||||
localStorage.setItem('backgroundColor', color);
|
}
|
||||||
}
|
}
|
||||||
|
</script>
|
||||||
// Apply the saved background color when the page loads
|
|
||||||
window.onload = applySavedBackgroundColor;
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<h1>Open and Control Background Color of Page 2</h1>
|
||||||
<h2>Choose Background Color</h2>
|
<button onclick="openPage2()">Open Main Page</button><br><br>
|
||||||
<button onclick="changeBackgroundColor('lightblue')">Light Blue</button>
|
<button onclick="changeWindowColor('lightblue')">Light Blue</button>
|
||||||
<button onclick="changeBackgroundColor('lightgreen')">Light Green</button>
|
<button onclick="changeWindowColor('lightgreen')">Light Green</button>
|
||||||
<button onclick="changeBackgroundColor('lightcoral')">Light Coral</button>
|
<button onclick="changeWindowColor('lightcoral')">Light Coral</button>
|
||||||
<button onclick="changeBackgroundColor('white')">Reset</button>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user