public inbox for [email protected]
 help / color / mirror / Atom feed
From: Alviro Iskandar Setiawan <[email protected]>
To: "Fernanda Ma'rouf" <[email protected]>,
	Akiekano <[email protected]>
Cc: Alviro Iskandar Setiawan <[email protected]>,
	"GNU/Weeb Mailing List" <[email protected]>,
	Ammar Faizi <[email protected]>,
	Ammar Alifian Fahdan <[email protected]>,
	Irvan Malik Azantha <[email protected]>,
	Khoiri <[email protected]>,
	Muhammad Irvan Hakim <[email protected]>
Subject: [PATCH buubuu v1 08/10] view: Put the style and JS preload script to top
Date: Sun, 12 Jun 2022 12:07:18 +0000	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAOG64qP3rjgbr2h0J9UdWEHE0-oc7XSn_av1JNMQAW=cA-e5Vw@mail.gmail.com>

This makes sure we load the CSS and JS first before the HTML. While in
there, also fix up the </tr> tag placement in register.html. And also,
remove unnecessary indentation.

Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
 view/login.html    | 64 ++++++++++++++++++------------------
 view/register.html | 82 ++++++++++++++++++++++++----------------------
 2 files changed, 74 insertions(+), 72 deletions(-)

diff --git a/view/login.html b/view/login.html
index 4d8d237..b820d6c 100644
--- a/view/login.html
+++ b/view/login.html
@@ -2,8 +2,29 @@
 <html>
 <head>
     <title>Login</title>
+    <script type="text/javascript" src="/assets/common.js"></script>
 </head>
 <body>
+<style type="text/css">
+body {
+    font-family: Arial;
+}
+.login_form_box {
+    padding: 10px;
+    padding-bottom: 40px;
+    margin: auto;
+    margin-top: 30px;
+    width: 40%;
+    border: 1px solid #000;
+    text-align: center;
+}
+#login_table {
+    padding: 10px;
+    margin: auto;
+    width: 90%;
+    text-align: left;
+}
+</style>
 <div class="login_form_box">
     <h1>Login Form</h1>
     <form id="login_form" method="POST" action="javascript:void(0);">
@@ -28,40 +49,19 @@
         </table>
     </form>
 </div>
-<style type="text/css">
-    body {
-        font-family: Arial;
-    }
-    .login_form_box {
-        padding: 10px;
-        padding-bottom: 40px;
-        margin: auto;
-        margin-top: 30px;
-        width: 40%;
-        border: 1px solid #000;
-        text-align: center;
-    }
-    #login_table {
-        padding: 10px;
-        margin: auto;
-        width: 90%;
-        text-align: left;
-    }
-</style>
-<script type="text/javascript" src="/assets/common.js"></script>
 <script type="text/javascript">
-    function do_login() {
-        let json = {
-            name:       get_eid("email").value.trim(),
-            password:   get_eid("password").value.trim()
-        };
+function do_login() {
+    let json = {
+        name:       get_eid("email").value.trim(),
+        password:   get_eid("password").value.trim()
+    };
 
-        let xhr = new XMLHttpRequest();
-        xhr.open("POST", "/auth/login");
-        xhr.setRequestHeader("Content-type", "application/json");
-        xhr.send(JSON.stringify(json));
-    }
-    get_eid("login_form").addEventListener("submit", do_login);
+    let xhr = new XMLHttpRequest();
+    xhr.open("POST", "/auth/login");
+    xhr.setRequestHeader("Content-type", "application/json");
+    xhr.send(JSON.stringify(json));
+}
+get_eid("login_form").addEventListener("submit", do_login);
 </script>
 </body>
 </html>
diff --git a/view/register.html b/view/register.html
index 0c78975..c54cddd 100644
--- a/view/register.html
+++ b/view/register.html
@@ -2,8 +2,29 @@
 <html>
 <head>
     <title>Register</title>
+    <script type="text/javascript" src="/assets/common.js"></script>
 </head>
 <body>
+<style type="text/css">
+body {
+    font-family: Arial;
+}
+.register_form_box {
+    padding: 10px;
+    padding-bottom: 40px;
+    margin: auto;
+    margin-top: 30px;
+    width: 40%;
+    border: 1px solid #000;
+    text-align: center;
+}
+#register_table {
+    padding: 10px;
+    margin: auto;
+    width: 90%;
+    text-align: left;
+}
+</style>
 <div class="register_form_box">
     <h1>Registration Form</h1>
     <form id="register_form" method="POST" action="javascript:void(0);">
@@ -16,11 +37,13 @@
             <tr>
                 <td align="left">Email</td>
                 <td>:</td>
-                <td><input type="text" id="email" name="email" required="1"/></td></tr>
+                <td><input type="text" id="email" name="email" required="1"/></td>
+            </tr>
             <tr>
                 <td align="left">Password</td>
                 <td>:</td>
-                <td><input type="password" id="password" name="password" required="1"/></td></tr>
+                <td><input type="password" id="password" name="password" required="1"/></td>
+            </tr>
             <tr>
                 <td align="left">Retype Password</td>
                 <td>:</td>
@@ -36,46 +59,25 @@
         </table>
     </form>
 </div>
-<style type="text/css">
-    body {
-        font-family: Arial;
-    }
-    .register_form_box {
-        padding: 10px;
-        padding-bottom: 40px;
-        margin: auto;
-        margin-top: 30px;
-        width: 40%;
-        border: 1px solid #000;
-        text-align: center;
-    }
-    #register_table {
-        padding: 10px;
-        margin: auto;
-        width: 90%;
-        text-align: left;
-    }
-</style>
-<script type="text/javascript" src="/assets/common.js"></script>
 <script type="text/javascript">
-    function do_register() {
-        let json = {
-            name:       get_eid("nama").value.trim(),
-            email:      get_eid("email").value.trim(),
-            /*
-             * Do not trim password, it should be stored as
-             * what it is actually written by the user.
-             */
-            password:   get_eid("password").value,
-            cpassword:  get_eid("cpassword").value,
-        };
+function do_register() {
+    let json = {
+        name:       get_eid("nama").value.trim(),
+        email:      get_eid("email").value.trim(),
+        /*
+         * Do not trim password, it should be stored as
+         * what it is actually written by the user.
+         */
+        password:   get_eid("password").value,
+        cpassword:  get_eid("cpassword").value,
+    };
 
-        let xhr = new XMLHttpRequest();
-        xhr.open("POST", "/auth/register");
-        xhr.setRequestHeader("Content-type", "application/json");
-        xhr.send(JSON.stringify(json));
-    }
-    get_eid("register_form").addEventListener("submit", do_register);
+    let xhr = new XMLHttpRequest();
+    xhr.open("POST", "/auth/register");
+    xhr.setRequestHeader("Content-type", "application/json");
+    xhr.send(JSON.stringify(json));
+}
+get_eid("register_form").addEventListener("submit", do_register);
 </script>
 </body>
 </html>
-- 
Alviro Iskandar Setiawan


  parent reply	other threads:[~2022-06-12 12:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-12 12:06 [PATCH buubuu v1 00/10] Frontend updates Alviro Iskandar Setiawan
2022-06-12 12:07 ` [PATCH buubuu v1 01/10] assets: Create common.js to place common used helpers Alviro Iskandar Setiawan
2022-06-12 12:07 ` [PATCH buubuu v1 02/10] assets: Create common.css to place common used CSS rules Alviro Iskandar Setiawan
2022-06-12 12:07 ` [PATCH buubuu v1 03/10] view: Avoid redefining `get_eid()` function Alviro Iskandar Setiawan
2022-06-12 12:07 ` [PATCH buubuu v1 04/10] view: Rework index.html view Alviro Iskandar Setiawan
2022-06-12 12:07 ` [PATCH buubuu v1 05/10] controller: Crate Index() method in authController Alviro Iskandar Setiawan
2022-06-12 12:26   ` Ammar Faizi
2022-06-12 12:07 ` [PATCH buubuu v1 06/10] server: Load `./assets` directory for `/assets` route Alviro Iskandar Setiawan
2022-06-12 12:07 ` [PATCH buubuu v1 07/10] server: Add route '/' to load the Index Alviro Iskandar Setiawan
2022-06-12 12:07 ` Alviro Iskandar Setiawan [this message]
2022-06-12 12:46   ` [PATCH buubuu v1 08/10] view: Put the style and JS preload script to top Ammar Faizi
2022-06-12 12:07 ` [PATCH buubuu v1 09/10] view: Allow user to navigate between pages Alviro Iskandar Setiawan
2022-06-12 12:07 ` [PATCH buubuu v1 10/10] view: index: Add meta tags for Facebook link preview Alviro Iskandar Setiawan
2022-06-12 12:29   ` Ammar Faizi
2022-06-12 13:19     ` Ammar Faizi
2022-06-24  7:50 ` [PATCH buubuu v1 00/10] Frontend updates Alviro Iskandar Setiawan
2022-06-24  8:04   ` Ammar Faizi
2022-06-24  8:28     ` Alviro Iskandar Setiawan
2022-06-24  9:01       ` Ammar Faizi
2022-06-24  9:09         ` Alviro Iskandar Setiawan
2022-06-24  9:23           ` Ammar Faizi
     [not found]   ` <[email protected]>
2022-06-24  8:34     ` Alviro Iskandar Setiawan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220612120720.2750101-8-alviro.iskandar@gnuweeb.org \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox