Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Cedrake1027 committed May 20, 2024
1 parent 35ef7c7 commit 1731e72
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 57 deletions.
5 changes: 4 additions & 1 deletion index.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ h1 {
h3 {
text-align: left;
color: #ffffff;

}

p {
Expand Down Expand Up @@ -128,6 +129,8 @@ input[type=number]::-webkit-outer-spin-button {
.oper-hint {
color: red;
text-align: center;
font-size: 10px;
font-weight: bolder;
margin-bottom: 10px;
}

Expand All @@ -138,4 +141,4 @@ input[type=number] {

.hidden {
display: none;
}
}
111 changes: 60 additions & 51 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,54 +1,63 @@
<!DOCTYPE html>
<html lang="en">
<link rel="icon" type="image/png" href="lg.png">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Cache-control" content="public">
<title>Omada Captive Portal</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<div class="container">
<div class="greeting-container">
<h3>Good Day! ☀️😎</h3>
</div>
<div id="oper-hint" class="oper-hint"></div>
<img class="logo" src="lg.png" alt="Logo">
<h1>₱5.00 <span class="hours">for 3 hours</span>
</h1>
<p>By connecting to the Wi-Fi you agree to the <a href="https://www.maridenresort.com/wi-fi-terms-of-service" class="terms-link">Terms of Service.</a>
<div id="hotspot-section" class="hidden">
<select id="hotspot-selector"></select>
</div>
<form id="login-form"> <!--"will change get to post depends on the result"-->
<div id="input-voucher" class="input-voucher">
<input type="number" maxlength="7" id="voucherCode" name="voucherCode" placeholder="VOUCHER CODE" inputmode="numeric" style="-webkit-appearance: textfield; -moz-appearance: textfield; appearance: textfield;">
</div>
<div id="input-user" class="hidden">
<input id="username" name="username" type="text" placeholder="Username" />
</div>
<div id="input-password" class="hidden user-input">
<input id="password" name="password" type="password" placeholder="Password" />
</div>
<div id="input-simple" class="hidden">
<input id="simplePassword" name="simplePassword" type="password" placeholder="Password" />
</div>
<div id="input-phone-num" class="hidden"> + <input id="country-code" />
<input id="phone-number" name="phone-number" type="text" placeholder="Phone Number" />
</div>
<div id="input-verify-code" class="hidden">
<input id="verify-code" name="verify-code" type="text" placeholder="Verification Code" />
<button id="get-code"> Get Code </button>
</div>
<button type="button" id="button-login">CONNECT</button> <!--"will change "submitData" to"button-login" depends on the result"-->
<input name="clientMac" id="cMac" style="display:none" />
<input name="radiusSvrIp" id="radiusServerIp" style="display:none" />
</form>
<div id="button-area" class="hidden">
<button id="button-facebook" class="hidden">Facebook</button>
</div>
</div>
<script src="index.js"></script>
</body>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Cache-control" content="public">
<title>Captive Portal</title>
<link rel="icon" type="image/png" href="lg.png">
<link rel="stylesheet" href="index.css">

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-S0ED32181B"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-S0ED32181B');
</script>
</head>
<body>
<div class="container">
<div class="greeting-container">
<h3 id="greeting"></h3>
</div>
<div id="oper-hint" class="oper-hint"></div>
<img class="logo" src="lg.png" alt="Logo">
<!-- <h1>₱5.00 <span class="hours">for 3 hours</span> -->
</h1>
<p>By connecting to the Wi-Fi you agree to the <a href="https://www.maridenresort.com/wi-fi-terms-of-service" class="terms-link">Terms of Service.</a>
<div id="hotspot-section" class="hidden">
<select id="hotspot-selector" class="hidden"></select>
</div>
<form id="login-form">
<div id="input-voucher" class="input-voucher">
<input type="number" maxlength="7" id="voucherCode" name="voucherCode" placeholder="VOUCHER CODE" inputmode="numeric" style="-webkit-appearance: textfield; -moz-appearance: textfield; appearance: textfield;">
</div>
<div id="input-user" class="hidden">
<input id="username" name="username" type="text" placeholder="Username" />
</div>
<div id="input-password" class="hidden user-input">
<input id="password" name="password" type="password" placeholder="Password" />
</div>
<div id="input-simple" class="hidden">
<input id="simplePassword" name="simplePassword" type="password" placeholder="Password" />
</div>
<div id="input-phone-num" class="hidden"> + <input id="country-code" />
<input id="phone-number" name="phone-number" type="text" placeholder="Phone Number" />
</div>
<div id="input-verify-code" class="hidden">
<input id="verify-code" name="verify-code" type="text" placeholder="Verification Code" />
<button id="get-code"> Get Code </button>
</div>
<input name="clientMac" id="cMac" style="display:none" />
<input name="radiusSvrIp" id="radiusServerIp" style="display:none" />
<button type="button" id="button-login">CONNECT</button>
</form>
<div id="button-area" class="hidden">
<button id="button-facebook" class="hidden">Facebook</button>
</div>
</div>
<script src="index.js"></script>
</body>
</html>
44 changes: 39 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ const inputVoucherCode = document.getElementById("voucherCode");
if (inputVoucherCode.value.length > inputVoucherCode.maxLength)
inputVoucherCode.value = inputVoucherCode.value.slice(0, inputVoucherCode.maxLength);
};
inputVoucherCode.onkeyup = (e) => {
if (e.keyCode === 13 || e.keyCode === "Enter") {
e.preventDefault();
setTimeout(() => document.getElementById("button-login").click(), 1);
inputVoucherCode.onkeydown = (e) => {
if (e.keyCode === 13 || e.keyCode === 9 || e.key === "Enter" || e.key === "Tab") {
e.preventDefault();
setTimeout(() => {
if (e.keyCode === 13 || e.key === "Enter") {
document.getElementById("button-login").click();
} else if (e.keyCode === 9 || e.key === "Tab") {
document.getElementById("button-login").focus();
}
}, 1);
}
};


var Ajax = {
post: function (url, data, fn) {
var xhr = new XMLHttpRequest();
Expand Down Expand Up @@ -42,7 +50,7 @@ var hotspotMap = {
};

var errorHintMap = {
"0": "ok",
"0": "",
"-1": "General error.",
"-41500": "Invalid authentication type.",
"-41501": "Failed to authenticate.",
Expand Down Expand Up @@ -125,7 +133,30 @@ function getQueryStringAsObject () {
}
return r;
}
// Function to set the greeting dynamically
function setGreeting() {
// Get the current hour
var currentHour = new Date().getHours();

// Get the greeting container
var greetingContainer = document.getElementById("greeting");

// Update the greeting based on the current hour
if (currentHour >= 0 && currentHour < 5) {
greetingContainer.textContent = "Good Morning! 😴💤";
} else if (currentHour >= 5 && currentHour < 12) {
greetingContainer.textContent = "Good Morning! 🌞☕";
} else if (currentHour >= 12 && currentHour < 18) {
greetingContainer.textContent = "Good Afternoon! 🌤️😎";
} else {
greetingContainer.textContent = "Good Evening! 🌙🥂";
}
}

// Call setGreeting function after the DOM content is loaded
document.addEventListener("DOMContentLoaded", function() {
setGreeting();
});
Ajax.post(
'/portal/getPortalPageSetting',
JSON.stringify({
Expand Down Expand Up @@ -325,6 +356,9 @@ Ajax.post(
document.getElementById("oper-hint").innerHTML = "Sending Authorization Code...";
});
pageConfigParse();

// Call setGreeting to set the greeting dynamically
setGreeting();
}
);

Expand Down
Binary file added index.zip
Binary file not shown.

0 comments on commit 1731e72

Please sign in to comment.