From a679ad20bb0437f5170fe9fef6a3a8d049c2f77c Mon Sep 17 00:00:00 2001 From: yelang Date: Fri, 21 Jun 2024 20:59:58 +0800 Subject: [PATCH] [refactor]: check for the ispc-html class is done using a regular expression to ensure that the class is only added once when the browser window is resized (#301) --- web/src/render/index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/src/render/index.html b/web/src/render/index.html index e555720c..7a55f7f4 100644 --- a/web/src/render/index.html +++ b/web/src/render/index.html @@ -15,7 +15,9 @@ if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) { width = width < PC_W ? width : PC_W - docEl.className += ' ispc-html' + if (!docEl.className.includes('ispc-html')) { + docEl.className += ' ispc-html' + } } var f = Math.min(width / 7.5, 50)