Add "danger". like tooltip, but orange and scary

This commit is contained in:
Will Toohey 2022-09-13 20:39:39 +10:00
parent 615abed220
commit 34854282a4
2 changed files with 28 additions and 0 deletions

View File

@ -162,6 +162,15 @@ input:checked.sectionToggle + div {
display: none;
}
.danger {
background: #ff6000 !important;
}
.danger:before {
content: '!!';
background: #ff6000;
}
body {
margin: 40px auto;
max-width: 1300px;

View File

@ -67,6 +67,7 @@ class StandardPatch {
this.name = options.name;
this.patches = options.patches;
this.tooltip = options.tooltip;
this.danger = options.danger;
}
createUI(parent) {
@ -79,6 +80,9 @@ class StandardPatch {
if(this.tooltip) {
patch.appendChild(createElementClass('div', 'tooltip', this.tooltip));
}
if(this.danger) {
patch.appendChild(createElementClass('div', 'danger tooltip', this.danger));
}
parent.appendChild(patch);
}
@ -137,6 +141,7 @@ class DynamicPatch {
this.name = options.name;
this.patches = options.patches;
this.tooltip = options.tooltip;
this.danger = options.danger;
this.mode = options.mode;
this.target = options.target;
}
@ -151,6 +156,9 @@ class DynamicPatch {
if(this.tooltip) {
this.ui.appendChild(createElementClass('div', 'tooltip', this.tooltip));
}
if(this.danger) {
this.ui.appendChild(createElementClass('div', 'danger tooltip', this.danger));
}
parent.appendChild(this.ui);
}
@ -401,6 +409,7 @@ class UnionPatch {
this.offset = options.offset;
this.patches = options.patches;
this.tooltip = options.tooltip;
this.danger = options.danger;
}
createUI(parent) {
@ -412,6 +421,9 @@ class UnionPatch {
if(this.tooltip) {
container.appendChild(createElementClass('div', 'tooltip', this.tooltip));
}
if(this.danger) {
container.appendChild(createElementClass('div', 'danger tooltip', this.danger));
}
container.appendChild(document.createElement('span'));
for(var i = 0; i < this.patches.length; i++) {
@ -428,6 +440,9 @@ class UnionPatch {
if(patch.tooltip) {
patchDiv.appendChild(createElementClass('div', 'tooltip', patch.tooltip));
}
if(patch.danger) {
patchDiv.appendChild(createElementClass('div', 'danger tooltip', patch.danger));
}
container.appendChild(patchDiv);
}
parent.appendChild(container);
@ -475,6 +490,7 @@ class NumberPatch {
constructor(options) {
this.name = options.name;
this.tooltip = options.tooltip;
this.danger = options.danger;
this.offset = options.offset;
this.size = options.size;
@ -503,6 +519,9 @@ class NumberPatch {
if (this.tooltip) {
patch.appendChild(createElementClass('div', 'tooltip', this.tooltip));
}
if (this.danger) {
patch.appendChild(createElementClass('div', 'danger tooltip', this.danger));
}
parent.appendChild(patch);
}