类似于 圣诞装饰,这里是一个分享万圣节装饰的主题。
恐怖幽灵
默认情况下,打开编辑器时幽灵出现的概率为 1/10。
- 在您的主题/组件中上传以下图片,并将变量名设置为 ghost:
来源
-
在您的主题或组件的
\u003c/head\u003e选项卡中添加此 JavaScript:
您可以增加或减少 rarity 变量的值,以调整幽灵出现的频率。\u003cscript type="text/discourse-plugin" version="1.4.0"\u003e const appEvents = api.container.lookup("service:app-events"); appEvents.on('composer:opened', () =\u003e { let rarity = 10 // 打开编辑器时,幽灵出现的概率为 1/[rarity 值] if (Math.floor(Math.random() * rarity) == 0) { let halloweenGhost = document.createElement("img"); halloweenGhost.id = "halloween-ghost"; halloweenGhost.src = settings.theme_uploads.ghost; document.getElementsByTagName("body")[0].appendChild(halloweenGhost); setTimeout(function () { halloweenGhost.classList.add("ghost-show"); }, 0); setTimeout(function(){ halloweenGhost.remove(); }, 1000); } }); \u003c/script\u003e -
在 CSS 选项卡中添加以下代码:
#halloween-ghost { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(.5); z-index: 10000; opacity: 1; pointer-events: none; transition: opacity .75s ease-in, top .75s ease, transform .75s cubic-bezier(0.175, 0.885, 0.32, 1.275); \u0026.ghost-show { transform: translate(-50%, -60%) scale(.6); opacity: 0; } } @media all and (min-width: 1024px) { #halloween-ghost { transform: translate(-50%, -50%) scale(.75); \u0026.ghost-show { transform: translate(-50%, -60%) scale(.9); } } }
在移动设备上,当虚拟键盘出现时,幽灵会“跳动”。
蜘蛛网
蜘蛛网将在较小屏幕上隐藏。
如何将其添加到您的论坛:
-
创建新的主题组件或编辑您的主题,上传此图片,并将变量名设置为 spiderweb:
来源 -
将以下 CSS 添加到您的主题或组件中:
@media all and (min-width: 1300px) { #main { \u0026:before, \u0026:after { content: ""; display: block; top: 4em; width: 300px; height: 300px; position: absolute; background: transparent url($spiderweb) top left no-repeat; background-size: contain; z-index: -1; } \u0026:after { right: 0; transform: scaleX(-1); } } }
表情选择器中的骷髅图标
一个微妙的改动,将消息编辑器中的笑脸图标替换为骷髅 ![]()
![]()
-
在您的 svg 图标子集 设置中添加
skull:
-
在您的主题/主题组件的
\u003c/head\u003e选项卡中替换图标:\u003cscript type="text/discourse-plugin" version="0.8.23"\u003e api.replaceIcon('far-smile', 'skull'); \u003c/script\u003e
因此,它也会在其他地方(如管理面板)替换笑脸图标。但这毕竟是万圣节,对吧?

杰克南瓜灯
一个简单的静态雕刻南瓜,位于您站点的右下角:
-
创建新的主题组件或编辑您的主题,上传此图片,并将变量名设置为 pumpkin:
来源 -
将以下 CSS 添加到您的主题或组件中:
body { background: transparent url($pumpkin) bottom right no-repeat; background-size: 10%; } @media all and (min-width: 1024px) { body { background-size: 7%; } }
如果论坛已在 \u003cbody\u003e 上使用背景图像,则此设置不兼容。
恐怖标志
如果您的标志使用纯文本或简单的文本图像,您可以将字体替换为更具万圣节风格的字体。
→ 
使用的字体:Creepster
- 如果您的标志使用图像,请编辑图像以更改字体。
- 如果您的标志是真实文本,请按照本教程更改标志中使用的字体:Include assets (e.g. images, fonts) in themes and components
- 在您的 CSS 中使用选择器
#site-text-logo。
- 在您的 CSS 中使用选择器





