mirror of
https://github.com/xiaoshi930/xiaoshi-pad-card.git
synced 2025-11-28 16:49:42 +00:00
Update xiaoshi-device-consumables-button.js
This commit is contained in:
@@ -1044,7 +1044,7 @@ class XiaoshiConsumablesButton extends LitElement {
|
|||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
color: var(--fg-color, #000);
|
color: var(--fg-color, #000);
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
font-size: 10px;
|
font-size: 11px;
|
||||||
width: 12px;
|
width: 12px;
|
||||||
height: 12px;
|
height: 12px;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -1054,7 +1054,7 @@ class XiaoshiConsumablesButton extends LitElement {
|
|||||||
|
|
||||||
.device-name {
|
.device-name {
|
||||||
color: var(--fg-color, #000);
|
color: var(--fg-color, #000);
|
||||||
font-size: 9px;
|
font-size: 11px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
@@ -1064,7 +1064,7 @@ class XiaoshiConsumablesButton extends LitElement {
|
|||||||
|
|
||||||
.device-value {
|
.device-value {
|
||||||
color: var(--fg-color, #000);
|
color: var(--fg-color, #000);
|
||||||
font-size: 9px;
|
font-size: 11px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
max-width: 45%;
|
max-width: 45%;
|
||||||
@@ -1078,7 +1078,7 @@ class XiaoshiConsumablesButton extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.device-unit {
|
.device-unit {
|
||||||
font-size: 9px;
|
font-size: 11px;
|
||||||
color: var(--fg-color, #000);
|
color: var(--fg-color, #000);
|
||||||
margin-left: 0.5px;
|
margin-left: 0.5px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@@ -1260,12 +1260,12 @@ class XiaoshiConsumablesButton extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_handleRefresh() {
|
_handleRefresh() {
|
||||||
|
this._handleClick();
|
||||||
this._loadOilPriceData();
|
this._loadOilPriceData();
|
||||||
navigator.vibrate(50);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleEntityClick(entity) {
|
_handleEntityClick(entity) {
|
||||||
navigator.vibrate(50);
|
this._handleClick();
|
||||||
// 点击实体时打开实体详情页
|
// 点击实体时打开实体详情页
|
||||||
if (entity.entity_id) {
|
if (entity.entity_id) {
|
||||||
const evt = new Event('hass-more-info', { composed: true });
|
const evt = new Event('hass-more-info', { composed: true });
|
||||||
@@ -1273,6 +1273,18 @@ class XiaoshiConsumablesButton extends LitElement {
|
|||||||
this.dispatchEvent(evt);
|
this.dispatchEvent(evt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_handleClick(){
|
||||||
|
if (navigator.vibrate) {
|
||||||
|
navigator.vibrate(50);
|
||||||
|
}
|
||||||
|
else if (navigator.webkitVibrate) {
|
||||||
|
navigator.webkitVibrate(50);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*button新元素 开始*/
|
/*button新元素 开始*/
|
||||||
_handleButtonClick() {
|
_handleButtonClick() {
|
||||||
const tapAction = this.config.tap_action;
|
const tapAction = this.config.tap_action;
|
||||||
@@ -1306,7 +1318,7 @@ class XiaoshiConsumablesButton extends LitElement {
|
|||||||
console.warn('browser_mod not available, cannot show popup');
|
console.warn('browser_mod not available, cannot show popup');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
navigator.vibrate(50);
|
this._handleClick();
|
||||||
}
|
}
|
||||||
/*button新元素 结束*/
|
/*button新元素 结束*/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user