From cb965c28207f4cd40274abb7e5afec1c34621cb4 Mon Sep 17 00:00:00 2001 From: Mole Shang <135e2@135e2.dev> Date: Wed, 26 Apr 2023 00:50:20 +0800 Subject: head.html: handle null header_td_form on homepage Fixes: Uncaught TypeError: header_td_form is null --- head.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'head.html') diff --git a/head.html b/head.html index 7ee78be..3796203 100644 --- a/head.html +++ b/head.html @@ -16,10 +16,12 @@ tabs.className = "tabs"; forms.className = "forms"; var header_td_form = document.querySelector("table#header td.form"); - while (header_td_form.firstChild) { - header_form.appendChild(header_td_form.firstChild); + if (header_td_form) { + while (header_td_form.firstChild) { + header_form.appendChild(header_td_form.firstChild); + } + header_td_form.parentNode.removeChild(header_td_form); } - header_td_form.parentNode.removeChild(header_td_form); var tab_items = Array.from(document.querySelectorAll("table.tabs td")).map( (v) => { var div = document.createElement("div"); -- cgit v1.2.3