footer: add footer loader

This commit is contained in:
2026-06-03 03:42:39 +07:00
parent b7c10621b1
commit 42429b1509
29 changed files with 39 additions and 101 deletions
+2 -1
View File
@@ -308,6 +308,7 @@
<!-- Scripts -->
<script src="/components/header/headerLoader.js"></script>
<script src="aboutPages/aboutMain.js?v=1.0"></script>
<script src="aboutPages/aboutMain.js?v=1.1"></script>
<script src="/components/footer/footerLoader.js"></script>
</body>
</html>
+1 -6
View File
@@ -1,6 +1 @@
// Load footer
fetch("components/footer/footer.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
// views/aboutPages/aboutMain.js
+6
View File
@@ -0,0 +1,6 @@
// Load footer
fetch("components/footer/footer.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
+2 -1
View File
@@ -197,6 +197,7 @@
<!-- Scripts -->
<script src="/components/header/headerLoader.js"></script>
<script src="contactPages/contactMain.js"></script>
<script src="/components/footer/footerLoader.js"></script>
<script src="contactPages/contactMain.js?v=1.0"></script>
</body>
</html>
+2 -8
View File
@@ -1,10 +1,4 @@
////views\contactPage\contactMain.js
// Load footer
fetch("components/footer/footer.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
document.addEventListener("DOMContentLoaded", function () {
// Focus and blur effects for form elements
@@ -34,7 +28,7 @@ document.addEventListener("DOMContentLoaded", function () {
// Form progress bar
const progressBar = document.querySelector(".form-progress-bar");
const formInputs = document.querySelectorAll(
".contact-form input, .contact-form textarea"
".contact-form input, .contact-form textarea",
);
const totalInputs = formInputs.length;
@@ -197,7 +191,7 @@ document.addEventListener("DOMContentLoaded", function () {
// Show error message
showMessage(
"error",
"Đã xảy ra lỗi khi gửi tin nhắn. Vui lòng thử lại sau."
"Đã xảy ra lỗi khi gửi tin nhắn. Vui lòng thử lại sau.",
);
});
}
+2 -1
View File
@@ -601,7 +601,8 @@
<!-- Footer Component -->
<div id="footer"></div>
<script src="homePages/homeMain.js?v=1.1"></script>
<script src="homePages/homeMain.js?v=1.2"></script>
<script src="/components/header/headerLoader.js"></script>
<script src="/components/footer/footerLoader.js"></script>
</body>
</html>
+1 -6
View File
@@ -1,9 +1,4 @@
// Load footer
fetch("components/footer/footer.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
// views/homePages/homeMain.js
// MANUAL BANNER SLIDESHOW FUNCTIONALITY
document.addEventListener("DOMContentLoaded", function () {
@@ -493,6 +493,7 @@
<div id="footer"></div>
<script src="components/header/headerLoader.js"></script>
<script src="newsPages/newsArticle1/newsArticle1.js"></script>
<script src="/components/footer/footerLoader.js"></script>
<script src="newsPages/newsArticle1/newsArticle1.js?v=1.0"></script>
</body>
</html>
@@ -1,7 +1 @@
////views\newsPages\newsArticle1\newsArticle1.js
// Load footer
fetch("components/footer/footer.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
@@ -295,6 +295,7 @@
<div id="footer"></div>
<script src="components/header/headerLoader.js"></script>
<script src="newsPages/newsArticle1/newsArticle1.js"></script>
<script src="/components/footer/footerLoader.js"></script>
<script src="newsPages/newsArticle1/newsArticle1.js?v=1.0"></script>
</body>
</html>
@@ -1,7 +1 @@
////views\newsPages\newsArticle2\newsArticle2.js
// Load footer
fetch("components/footer/footer.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
+2 -1
View File
@@ -277,7 +277,8 @@
<!-- Footer Component -->
<div id="footer"></div>
<script src="newsPages/newsMain/newsMain.js"></script>
<script src="newsPages/newsMain/newsMain.js?v=1.0"></script>
<script src="/components/header/headerLoader.js"></script>
<script src="/components/footer/footerLoader.js"></script>
</body>
</html>
-6
View File
@@ -1,10 +1,4 @@
///// views\newsPage\newsMain\newsMain.js
// Load footer
fetch("components/footer/footer.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
//// NEWS FILTER JS
document.addEventListener("DOMContentLoaded", function () {
@@ -377,7 +377,8 @@
<!-- Footer Component -->
<div id="footer"></div>
<script src="productPages/productMain/productMain.js"></script>
<script src="productPages/productMain/productMain.js?v=1.0"></script>
<script src="/components/header/headerLoader.js"></script>
<script src="/components/footer/footerLoader.js"></script>
</body>
</html>
@@ -1,10 +1,4 @@
////views/productPages/productMain/productMain.js
// Load footer
fetch("components/footer/footer.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
// Product page specific JavaScript
document.addEventListener("DOMContentLoaded", function () {
@@ -36,7 +30,7 @@ document.addEventListener("DOMContentLoaded", function () {
if (hash) {
// Find the tab with matching data-category
const tab = document.querySelector(
`.category-tab[data-category="${hash}"]`
`.category-tab[data-category="${hash}"]`,
);
if (tab) {
// Remove active class from all tabs and contents
@@ -142,6 +142,7 @@
<div id="footer"></div>
<script src="components/header/headerLoader.js"></script>
<script src="productPages/productSeparateCommerceLNG/productSeparateCommerceLNG.js"></script>
<script src="/components/footer/footerLoader.js"></script>
<script src="productPages/productSeparateCommerceLNG/productSeparateCommerceLNG.js?v=1.0"></script>
</body>
</html>
@@ -1,10 +1,4 @@
////views/productPages/productSeparateCommerceLNG/productSeparateCommerceLNG.js
// Load footer
fetch("components/footer/footer.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
// Set products nav item as active
document.addEventListener("DOMContentLoaded", function () {
@@ -140,6 +140,7 @@
<div id="footer"></div>
<script src="components/header/headerLoader.js"></script>
<script src="productPages/productSeparateCommercePNG/productSeparateCommercePNG.js"></script>
<script src="/components/footer/footerLoader.js"></script>
<script src="productPages/productSeparateCommercePNG/productSeparateCommercePNG.js?v=1.0"></script>
</body>
</html>
@@ -1,10 +1,4 @@
////views/productPages/productSeparateCommercePNG/productSeparateCommercePNG.js
// Load footer
fetch("components/footer/footer.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
// Set products nav item as active
document.addEventListener("DOMContentLoaded", function () {
@@ -137,6 +137,7 @@
<div id="footer"></div>
<script src="components/header/headerLoader.js"></script>
<script src="productPages/productSeparateProductionGasMeter/productSeparateProductionGasMeter.js"></script>
<script src="/components/footer/footerLoader.js"></script>
<script src="productPages/productSeparateProductionGasMeter/productSeparateProductionGasMeter.js?v=1.0"></script>
</body>
</html>
@@ -1,10 +1,4 @@
// views/productPages/productSeparateProductionGasMeter/productSeparateProductionGasMeter.js
// Load footer
fetch("components/footer/footer.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
// Set products nav item as active
document.addEventListener("DOMContentLoaded", function () {
@@ -140,6 +140,7 @@
<div id="footer"></div>
<script src="components/header/headerLoader.js"></script>
<script src="productPages/productSeparateProductionPRU/productSeparateProductionPRU.js"></script>
<script src="/components/footer/footerLoader.js"></script>
<script src="productPages/productSeparateProductionPRU/productSeparateProductionPRU.js?v=1.0"></script>
</body>
</html>
@@ -1,10 +1,4 @@
// views/productPages/productSeparateProductionPRU/productSeparateProductionPRU.js
// Load footer
fetch("components/footer/footer.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
// Set products nav item as active
document.addEventListener("DOMContentLoaded", function () {
@@ -137,6 +137,7 @@
<div id="footer"></div>
<script src="components/header/headerLoader.js"></script>
<script src="productPages/productSeparateProductionPressureRegulatorValve/productSeparateProductionPressureRegulatorValve.js"></script>
<script src="/components/footer/footerLoader.js"></script>
<script src="productPages/productSeparateProductionPressureRegulatorValve/productSeparateProductionPressureRegulatorValve.js?v=1.0"></script>
</body>
</html>
@@ -1,10 +1,4 @@
// views/productPages/productSeparateProductionPressureRegulatorValve/productSeparateProductionPressureRegulatorValve.js
// Load footer
fetch("components/footer/footer.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
// Set products nav item as active
document.addEventListener("DOMContentLoaded", function () {
@@ -137,6 +137,7 @@
<div id="footer"></div>
<script src="components/header/headerLoader.js"></script>
<script src="productPages/productSeparateProductionVaporizer/productSeparateProductionVaporizer.js"></script>
<script src="/components/footer/footerLoader.js"></script>
<script src="productPages/productSeparateProductionVaporizer/productSeparateProductionVaporizer.js?v=1.0"></script>
</body>
</html>
@@ -1,10 +1,4 @@
// views/productPages/productSeparateProductionVaporizer/productSeparateProductionVaporizer.js
// Load footer
fetch("components/footer/footer.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
// Set products nav item as active
document.addEventListener("DOMContentLoaded", function () {
+2 -1
View File
@@ -319,7 +319,8 @@
<!-- Footer Component -->
<div id="footer"></div>
<script src="servicePages/serviceMain.js?v=1.0"></script>
<script src="servicePages/serviceMain.js?v=1.1"></script>
<script src="/components/header/headerLoader.js"></script>
<script src="/components/footer/footerLoader.js"></script>
</body>
</html>
-6
View File
@@ -1,10 +1,4 @@
//// views\servicePages\serviceMain.js
// Load footer
fetch("components/footer/footer.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("footer").innerHTML = data;
});
// Navigation highlighting
document.addEventListener("DOMContentLoaded", function () {