diff --git a/public/header.js b/public/header.js new file mode 100644 index 0000000..90f7a86 --- /dev/null +++ b/public/header.js @@ -0,0 +1,37 @@ +function displayHeader() { + const links = [ + { + href: "/", + name: "Home", + }, + { + href: "/register/", + name: "Register", + }, + { + href: "/login/", + name: "Login", + }, + { + href: "/upload/", + name: "Upload", + }, + ].map(({name, href}) => { + if (href === window.location.pathname) { + return `${name}` + } else { + return `${name}` + } + }).join(" - "); + + document.querySelector("h1").outerHTML = ` +
+

MaoTube

+ +
+ ` +} + +displayHeader(); diff --git a/public/index.html b/public/index.html index f01503e..02aed75 100644 --- a/public/index.html +++ b/public/index.html @@ -6,26 +6,17 @@ -
-

MaoTube

- -
-
-
+

MaoTube

- + +

The chairman The chairman The chairman + diff --git a/public/login/index.html b/public/login/index.html index 4e29d13..934d7a0 100644 --- a/public/login/index.html +++ b/public/login/index.html @@ -6,18 +6,7 @@ -
-

MaoTube

- -
-
-
+

MaoTube

@@ -41,6 +30,7 @@
+ diff --git a/public/register/index.html b/public/register/index.html index e703637..8b69018 100644 --- a/public/register/index.html +++ b/public/register/index.html @@ -6,18 +6,7 @@ -
-

MaoTube

- -
-
-
+

MaoTube

@@ -41,6 +30,7 @@
+ diff --git a/public/search/index.html b/public/search/index.html index ed21770..a0f1844 100644 --- a/public/search/index.html +++ b/public/search/index.html @@ -6,23 +6,14 @@ -
-

MaoTube

- -
-
-
-
- +

MaoTube

+ + +

+
+ diff --git a/public/upload/index.html b/public/upload/index.html index c1f2f7a..ed868c2 100644 --- a/public/upload/index.html +++ b/public/upload/index.html @@ -6,18 +6,7 @@ -
-

MaoTube

- -
-
-
+

MaoTube

@@ -27,6 +16,7 @@
+