From 9b9159c3e0bfc38ec5774448282cb4ea18047861 Mon Sep 17 00:00:00 2001 From: cellargalaxy Date: Sun, 19 Nov 2023 22:55:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbanner=E4=B8=8B=E6=A0=87?= =?UTF-8?q?=E7=BB=9D=E5=AF=B9=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/404.ejs | 2 +- layout/about.ejs | 2 +- layout/archive.ejs | 2 +- layout/categories.ejs | 2 +- layout/category.ejs | 2 +- layout/links.ejs | 2 +- layout/page.ejs | 2 +- layout/post.ejs | 2 +- layout/tag.ejs | 2 +- layout/tags.ejs | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/layout/404.ejs b/layout/404.ejs index 174a1c5e..0f56d3fb 100644 --- a/layout/404.ejs +++ b/layout/404.ejs @@ -18,7 +18,7 @@ function hash(text) { } page.banner_group = page.banner_group || theme.page404.banner_group || theme.index.banner_group if (Array.isArray(page.banner_group) && page.banner_group.length) { - var index = hash(page.subtitle || page.title) % page.banner_group.length + var index = Math.abs(hash(page.subtitle || page.title)) % page.banner_group.length page.banner_img = page.banner_group[index].img || page.banner_img page.banner_text = page.banner_group[index].text || page.subtitle || page.title page.banner_img_height = parseFloat(page.banner_group[index].height || 100) diff --git a/layout/about.ejs b/layout/about.ejs index 42574da6..daf5f45d 100644 --- a/layout/about.ejs +++ b/layout/about.ejs @@ -18,7 +18,7 @@ function hash(text) { } page.banner_group = page.banner_group || theme.about.banner_group || theme.index.banner_group if (Array.isArray(page.banner_group) && page.banner_group.length) { - var index = hash(page.subtitle || page.title) % page.banner_group.length + var index = Math.abs(hash(page.subtitle || page.title)) % page.banner_group.length page.banner_img = page.banner_group[index].img || page.banner_img page.banner_text = page.banner_group[index].text || page.subtitle || page.title page.banner_img_height = parseFloat(page.banner_group[index].height || 50) diff --git a/layout/archive.ejs b/layout/archive.ejs index e83e1b9b..7daff1a6 100644 --- a/layout/archive.ejs +++ b/layout/archive.ejs @@ -18,7 +18,7 @@ function hash(text) { } page.banner_group = page.banner_group || theme.archive.banner_group || theme.index.banner_group if (Array.isArray(page.banner_group) && page.banner_group.length) { - var index = hash(page.subtitle || page.title) % page.banner_group.length + var index = Math.abs(hash(page.subtitle || page.title)) % page.banner_group.length page.banner_img = page.banner_group[index].img || page.banner_img page.banner_text = page.banner_group[index].text || page.subtitle || page.title page.banner_img_height = parseFloat(page.banner_group[index].height || 50) diff --git a/layout/categories.ejs b/layout/categories.ejs index 8b5d04d7..c46a6371 100644 --- a/layout/categories.ejs +++ b/layout/categories.ejs @@ -20,7 +20,7 @@ function hash(text) { } page.banner_group = page.banner_group || theme.category.banner_group || theme.index.banner_group if (Array.isArray(page.banner_group) && page.banner_group.length) { - var index = hash(page.subtitle || page.title) % page.banner_group.length + var index = Math.abs(hash(page.subtitle || page.title)) % page.banner_group.length page.banner_img = page.banner_group[index].img || page.banner_img page.banner_text = page.banner_group[index].text || page.subtitle || page.title page.banner_img_height = parseFloat(page.banner_group[index].height || 50) diff --git a/layout/category.ejs b/layout/category.ejs index a9cfc4c6..3ef6e72c 100644 --- a/layout/category.ejs +++ b/layout/category.ejs @@ -20,7 +20,7 @@ function hash(text) { } page.banner_group = page.banner_group || theme.category.banner_group || theme.index.banner_group if (Array.isArray(page.banner_group) && page.banner_group.length) { - var index = hash(page.subtitle || page.title) % page.banner_group.length + var index = Math.abs(hash(page.subtitle || page.title)) % page.banner_group.length page.banner_img = page.banner_group[index].img || page.banner_img page.banner_text = page.banner_group[index].text || page.subtitle || page.title page.banner_img_height = parseFloat(page.banner_group[index].height || 50) diff --git a/layout/links.ejs b/layout/links.ejs index 7f3b6201..745498c6 100644 --- a/layout/links.ejs +++ b/layout/links.ejs @@ -19,7 +19,7 @@ function hash(text) { } page.banner_group = page.banner_group || theme.links.banner_group || theme.index.banner_group if (Array.isArray(page.banner_group) && page.banner_group.length) { - var index = hash(page.subtitle || page.title) % page.banner_group.length + var index = Math.abs(hash(page.subtitle || page.title)) % page.banner_group.length page.banner_img = page.banner_group[index].img || page.banner_img page.banner_text = page.banner_group[index].text || page.subtitle || page.title page.banner_img_height = parseFloat(page.banner_group[index].height || 50) diff --git a/layout/page.ejs b/layout/page.ejs index f1818d67..208d513b 100644 --- a/layout/page.ejs +++ b/layout/page.ejs @@ -18,7 +18,7 @@ function hash(text) { } page.banner_group = page.banner_group || theme.page.banner_group || theme.index.banner_group if (Array.isArray(page.banner_group) && page.banner_group.length) { - var index = hash(page.subtitle || page.title) % page.banner_group.length + var index = Math.abs(hash(page.subtitle || page.title)) % page.banner_group.length page.banner_img = page.banner_group[index].img || page.banner_img page.banner_text = page.banner_group[index].text || page.subtitle || page.title page.banner_img_height = parseFloat(page.banner_group[index].height || 50) diff --git a/layout/post.ejs b/layout/post.ejs index 527b30c1..4c1be3aa 100644 --- a/layout/post.ejs +++ b/layout/post.ejs @@ -15,7 +15,7 @@ function hash(text) { } page.banner_group = page.banner_group || theme.post.banner_group || theme.index.banner_group if (Array.isArray(page.banner_group) && page.banner_group.length) { - var index = hash(page.subtitle || page.title) % page.banner_group.length + var index = Math.abs(hash(page.subtitle || page.title)) % page.banner_group.length page.banner_img = page.banner_group[index].img || page.banner_img page.banner_text = page.banner_group[index].text || page.subtitle || page.title page.banner_img_height = parseFloat(page.banner_group[index].height || 50) diff --git a/layout/tag.ejs b/layout/tag.ejs index 2f46b64e..358a0e99 100644 --- a/layout/tag.ejs +++ b/layout/tag.ejs @@ -20,7 +20,7 @@ function hash(text) { } page.banner_group = page.banner_group || theme.tag.banner_group || theme.index.banner_group if (Array.isArray(page.banner_group) && page.banner_group.length) { - var index = hash(page.subtitle || page.title) % page.banner_group.length + var index = Math.abs(hash(page.subtitle || page.title)) % page.banner_group.length page.banner_img = page.banner_group[index].img || page.banner_img page.banner_text = page.banner_group[index].text || page.subtitle || page.title page.banner_img_height = parseFloat(page.banner_group[index].height || 50) diff --git a/layout/tags.ejs b/layout/tags.ejs index 89b929bc..d84d2037 100644 --- a/layout/tags.ejs +++ b/layout/tags.ejs @@ -24,7 +24,7 @@ function hash(text) { } page.banner_group = page.banner_group || theme.tag.banner_group || theme.index.banner_group if (Array.isArray(page.banner_group) && page.banner_group.length) { - var index = hash(page.subtitle || page.title) % page.banner_group.length + var index = Math.abs(hash(page.subtitle || page.title)) % page.banner_group.length page.banner_img = page.banner_group[index].img || page.banner_img page.banner_text = page.banner_group[index].text || page.subtitle || page.title page.banner_img_height = parseFloat(page.banner_group[index].height || 50)