Popup to join discord server when page loads, option to check don't show again.

This commit is contained in:
PrestonT500 2024-09-18 18:29:28 -07:00
parent 7d0e8f7819
commit e8e7ec0c50
4 changed files with 270 additions and 130 deletions

128
css/index.css Normal file
View File

@ -0,0 +1,128 @@
body {
font-family: 'Arial', sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
text-align: center;
display: flex;
flex-direction: column;
min-height: 100vh;
overflow-x: hidden;
}
h1 {
color: #333;
}
h2,
p {
color: #555;
}
button,
.dropdown-btn {
background-color: #4caf50;
color: white;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
border: none;
border-radius: 5px;
margin: 10px auto;
text-decoration: none;
display: inline-block;
max-width: 200px;
}
.source-btn {
background-color: #333333;
color: white;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
border: none;
border-radius: 5px;
margin: 10px auto;
text-decoration: none;
display: inline-block;
max-width: 200px;
}
.dsc-btn {
background-color: #9656ce;
color: white;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
border: none;
border-radius: 5px;
margin: 10px auto;
text-decoration: none;
display: inline-block;
max-width: 200px;
}
button:hover {
background-color: #45a049;
}
.source-btn:hover {
background-color: #000000;
}
.dsc-btn:hover {
background-color: #5b209a;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {
background-color: #ddd;
}
.dropdown-btn:hover .dropdown-content {
display: block;
}
.pick-client {
color: #555;
}
.line {
width: 50%;
border-top: 1px solid #888;
margin: 10px auto;
}
.version-text {
margin: 10px 0;
color: #555;
}
.footer {
margin-top: auto;
background-color: #ddd;
padding: 20px;
width: 100%;
}
.recommended {
vertical-align: middle;
margin-left: 5px;
width: 20px;
height: 20px;
}

81
css/popup.css Normal file
View File

@ -0,0 +1,81 @@
body {
font-family: 'Arial', sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
text-align: center;
display: flex;
flex-direction: column;
min-height: 100vh;
}
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
justify-content: center;
align-items: center;
}
.modal-content {
background-color: white;
padding: 20px;
border-radius: 10px;
width: 80%;
max-width: 400px;
text-align: center;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
}
.modal h2 {
color: #333;
}
.modal p {
color: #555;
margin-bottom: 20px;
}
.modal button {
background-color: #4caf50;
color: white;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
border: none;
border-radius: 5px;
margin: 5px;
}
.modal button.cancel-btn {
background-color: #f44336;
}
.modal button:hover {
background-color: #45a049;
}
.modal button.cancel-btn:hover {
background-color: #e53935;
}
.copy-link {
background-color: #f4f4f4;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
margin-bottom: 15px;
}
.copy-btn {
background-color: #9656ce;
}
.copy-btn:hover {
background-color: #5b209a;
}

View File

@ -6,140 +6,37 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EaglerCraftX</title> <title>EaglerCraftX</title>
<link rel="icon" type="image/x-icon" href="icon.jpeg"> <link rel="icon" type="image/x-icon" href="icon.jpeg">
<style> <link rel="stylesheet" href="css/index.css">
body { <link rel="stylesheet" href="css/popup.css">
font-family: 'Arial', sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
text-align: center;
display: flex;
flex-direction: column;
min-height: 100vh;
overflow-x: hidden;
}
h1 {
color: #333;
}
h2,
p {
color: #555;
}
button,
.dropdown-btn {
background-color: #4caf50;
color: white;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
border: none;
border-radius: 5px;
margin: 10px auto;
text-decoration: none;
display: inline-block;
max-width: 200px;
}
.source-btn {
background-color: #333333;
color: white;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
border: none;
border-radius: 5px;
margin: 10px auto;
text-decoration: none;
display: inline-block;
max-width: 200px;
}
.dsc-btn {
background-color: #9656ce;
color: white;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
border: none;
border-radius: 5px;
margin: 10px auto;
text-decoration: none;
display: inline-block;
max-width: 200px;
}
button:hover {
background-color: #45a049;
}
.source-btn:hover {
background-color: #000000;
}
.dsc-btn:hover {
background-color: #5b209a;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {
background-color: #ddd;
}
.dropdown-btn:hover .dropdown-content {
display: block;
}
.pick-client {
color: #555;
}
.line {
width: 50%;
border-top: 1px solid #888;
margin: 10px auto;
}
.version-text {
margin: 10px 0;
color: #555;
}
.footer {
margin-top: auto;
background-color: #ddd;
padding: 20px;
width: 100%;
}
.recommended {
vertical-align: middle;
margin-left: 5px;
width: 20px;
height: 20px;
}
</style>
</head> </head>
<body> <body>
<h1>Welcome to EaglerCraftX</h1> <h1>Welcome to EaglerCraftX</h1>
<div id="joinModal" class="modal">
<div class="modal-content">
<h2>Join Our Discord Server!</h2>
<p>Join for voting, bug reports, suggestions, help, etc.</p>
<button onclick="openCopyModal()">Yes</button>
<button class="cancel-btn" onclick="closeModal()">Cancel</button>
<div style="margin-top: 20px;">
<input type="checkbox" id="dontShowCheckbox">
<label for="dontShowCheckbox">Don't show again</label>
</div>
</div>
</div>
<div id="copyModal" class="modal">
<div class="modal-content">
<h2>Copy Discord Link</h2>
<p class="copy-link" id="discordLink">https://discord.gg/czV7M8JXXM</p>
<button class="copy-btn" onclick="copyLink()">Copy Link</button>
<button class="cancel-btn" onclick="closeModal()">Close</button>
</div>
</div>
<script src="js/popup.js"></script>
<p>Site views counter:</p> <p>Site views counter:</p>
<div align='center'><a><img src='https://www.free-website-hit-counter.com/c.php?d=9&id=177632&s=16' border='0' alt='View Counter'></a></div> <div align='center'><a><img src='https://www.free-website-hit-counter.com/c.php?d=9&id=177632&s=16' border='0' alt='View Counter'></a></div>
<p>These clients might be outdated.</p> <p>These clients might be outdated.</p>

34
js/popup.js Normal file
View File

@ -0,0 +1,34 @@
window.onload = function() {
if (!localStorage.getItem('dontShowPopup')) {
document.getElementById('joinModal').style.display = 'flex';
}
}
function openModal() {
document.getElementById('joinModal').style.display = 'flex';
}
function openCopyModal() {
document.getElementById('joinModal').style.display = 'none';
document.getElementById('copyModal').style.display = 'flex';
if (document.getElementById('dontShowCheckbox').checked) {
localStorage.setItem('dontShowPopup', true);
}
}
function closeModal() {
document.getElementById('joinModal').style.display = 'none';
document.getElementById('copyModal').style.display = 'none';
if (document.getElementById('dontShowCheckbox').checked) {
localStorage.setItem('dontShowPopup', true);
}
}
function copyLink() {
const copyText = document.getElementById('discordLink').textContent;
navigator.clipboard.writeText(copyText).then(function() {
alert("Discord link copied to clipboard!");
}, function() {
alert("Failed to copy the link.");
});
}