Commit bbacabcc by Daniel Bawag

WG-66 - Seperated the config to project and app specific

parent d1eff105
......@@ -4,7 +4,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> Login Page </title>
<link rel="stylesheet" href="./login.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="./src/fetchConfig/fetchConfig.js"></script>
<script>fetchConfig()</script>
</head>
<body>
<div class="main-div">
......
const ALLOWED_KPH = 8000;
const ALLOWED_DIMENSION_WIDTH = 1366;
const ALLOWED_DIMENSION_HEIGHT = 768;
const ALLOWED_BROWSERS = "Chrome";
\ No newline at end of file
......@@ -13,9 +13,9 @@ console.log(getBrowserName());
function validateForm() {
const reqWindowWidth = 1366;
const reqWindowHeight = 768;
const reqBrowser = 'Chrome';
const reqWindowWidth = ALLOWED_DIMENSION_WIDTH;
const reqWindowHeight = ALLOWED_DIMENSION_HEIGHT;
const reqBrowser = ALLOWED_BROWSERS;
var windowWidth = getWindowWidth();
var windowHeight = getWindowHeight();
......
......@@ -2,18 +2,27 @@ var found = true; //variable to return
var embed = 0; //checker if which file is using the function
const fetchConfig = () => {
$.ajax({ //locates the config file
url: './config.js',
url: './config.js',
async: false,
success: function(data){},
error: function(data){
handleError();
success: function (data) { },
error: function (data) {
handleError("application config");
},
})
})
$.ajax({ //locates the project config file
url: './project_config.js',
async: false,
success: function (data) { },
error: function (data) {
handleError("project config");
},
})
}
const handleError = () => {
const handleError = (file) => {
if (embed == 0) {//to ensure the prompt appears only once
if (confirm("config.js not found, application will not commence")) {}
}
if (confirm(`${file} not found, application will not commence`)) { }
}
found = false;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment