Skip to content

Commit cb01e2c

Browse files
committed
feat(banner.js): split minimal to animation & size
1 parent 008c801 commit cb01e2c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

public/banner.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* Set link=none to disable the link
1919
* hidebutton=on Show an X close button (default: on)
2020
* Set hidebutton=off to hide the close button
21+
* animation=on Add animation to border of banner (default: on)
22+
* Set animation=off to disable
2123
*/
2224
(function () {
2325
"use strict";
@@ -136,7 +138,6 @@
136138
"0px 3px 0px #751111," +
137139
"0px 4px 0px #5e0d0d," +
138140
"0px 6px 10px rgba(0,0,0,0.5);" +
139-
"animation:kao-pulse 2s infinite;" +
140141
"padding:0.5rem 2.5rem;" +
141142
"line-height:1.6;" +
142143
"box-sizing:border-box;" +
@@ -159,7 +160,6 @@
159160
"0px 1px 0px #9e1a1a," +
160161
"0px 2px 0px #8a1515," +
161162
"0px 3px 5px rgba(0,0,0,0.4);" +
162-
"animation:kao-pulse 2s infinite;" +
163163
"padding:0.25rem 1.5rem;" +
164164
"line-height:1.4;" +
165165
"box-sizing:border-box;" +
@@ -205,15 +205,20 @@
205205
"line-height:1;" +
206206
"text-shadow:none;" +
207207
"}" +
208-
".kao-banner-close:hover{opacity:1;}" +
208+
".kao-banner-close:hover{opacity:1;}";
209+
210+
var cssKaoPulse =
211+
".kao-banner { animation:kao-pulse 2s infinite; }" +
209212
"@keyframes kao-pulse{" +
210213
"0%{box-shadow:0 0 0 0 rgba(211,47,47,0.7)}" +
211214
"70%{box-shadow:0 0 0 15px rgba(211,47,47,0)}" +
212215
"100%{box-shadow:0 0 0 0 rgba(211,47,47,0)}" +
213216
"}";
214217

215218
var style = document.createElement("style");
216-
style.textContent = (size === "mini" ? cssMini : size === "minimal" ? cssMinimal : cssNormal) + cssCommon;
219+
style.textContent = (size === "mini" ? cssMini : size === "minimal" ? cssMinimal : cssNormal)
220+
+ (params.animation === "off" ? "" : cssKaoPulse)
221+
+ cssCommon;
217222
document.head.appendChild(style);
218223

219224
// ── Check if previously dismissed (reappears after dismissDays) ─────

0 commit comments

Comments
 (0)