Browse Source

加入一些常量

tags/v24.9
枫谷剑仙 3 years ago
parent
commit
b93d7ea6e4
2 changed files with 8 additions and 5 deletions
  1. +1
    -1
      css/svg-icon.css
  2. +7
    -4
      script-custom_elements.js

+ 1
- 1
css/svg-icon.css View File

@@ -43,7 +43,7 @@ svg {
--front-color: url(../images/icon-awoken-count.svg#full-awoken-assist-front);
}
[type="awoken-count"][flags~="full"][flags~="can-assist"]:not([icon-type="latent"]) text,
[type="awoken-count"][flags~="full"][flags~="8-latent"][icon-type="latent"] text
[type="awoken-count"][flags~="8-latent-full"][flags~="8-latent"][icon-type="latent"] text
{
stroke: none;
fill: url(../images/icon-awoken-count.svg#full-awoken-star);


+ 7
- 4
script-custom_elements.js View File

@@ -291,11 +291,14 @@ class PadIcon extends HTMLElement {
'flags', //各种选项开关,类似className
];
}
static ELEMENT_TYPE_AWOKEN = 'awoken';
static ELEMENT_TYPE_TYPE = 'type';
static ELEMENT_TYPE_AWOKEN_COUNT = 'awoken-count';
#svg = document.createElementNS(svgNS,'svg');
#flags = null;
get flagsList() { return this.#flags; }
#number = 0;
#type = 'awoken';
#type = PadIcon.ELEMENT_TYPE_AWOKEN;
#iconType = null;
get number() { return this.#number; }
set number(x) {
@@ -373,18 +376,18 @@ class PadIcon extends HTMLElement {
const use = svg.querySelector(':scope>use');
svg.setAttribute("viewBox", "0 0 32 32");
switch (this.#type) {
case 'awoken': {
case PadIcon.ELEMENT_TYPE_AWOKEN: {
if (/^(?:en|ko)/.test(lang) && [40,46,47,48].includes(number)) number += '-en'; //英文不一样的觉醒
if (/^(?:zh)/.test(lang) && [46,47].includes(number)) number += '-zh'; //中文不一样的觉醒
use.href.baseVal = `images/icon-awoken.svg#awoken-${number}`;
break;
}
case 'type': {
case PadIcon.ELEMENT_TYPE_TYPE: {
if (/^(?:en|ko)/.test(lang) && [9,12].includes(number)) number += '-en'; //英文不一样的类型
use.href.baseVal = `images/icon-type.svg#type-${number}`;
break;
}
case 'awoken-count': {
case PadIcon.ELEMENT_TYPE_AWOKEN_COUNT: {
const full = this.flagsList.contains("full");
const weapon = this.flagsList.contains("weapon");
const canAssist = this.flagsList.contains("can-assist");


Loading…
Cancel
Save