Fix popups in 0.113. Fix #115
This commit is contained in:
parent
88ca719af4
commit
954c960789
@ -258,6 +258,7 @@ will display the specified `entities` card as a popup on the current device and
|
||||
|
||||
The optional parameter `large: true` will make the popup wider.
|
||||
The optional parameter `style:` will apply CSS style options to the popup.
|
||||
The optional parameter `hide_header: true` will hide the header bar and close button.
|
||||
The optional parameter `auto_close: true` will make the popup close automatically when the mouse is moved or a key is pressed on the keyboard. This also removes the header bar.
|
||||
The optional parameter `time:` (only useable if `auto_close: true` is also set) will turn the popup into a "screensaver". See the `blackout` command below.
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -199,8 +199,6 @@ class BrowserMod {
|
||||
}
|
||||
|
||||
popup_card(ev) {
|
||||
const moreInfoEl = document.querySelector("home-assistant")._moreInfoEl;
|
||||
if(moreInfoEl && !moreInfoEl.getAttribute('aria-hidden')) return;
|
||||
if(!lovelace()) return;
|
||||
const ll = lovelace();
|
||||
const data = {
|
||||
@ -211,7 +209,10 @@ class BrowserMod {
|
||||
if(!ev.detail || !ev.detail.entityId) return;
|
||||
const d = data[ev.detail.entityId];
|
||||
if(!d) return;
|
||||
window.setTimeout(() => {
|
||||
fireEvent("hass-more-info", {entityId: "."}, document.querySelector("home-assistant"));
|
||||
popUp(d.title, d.card, d.large || false, d.style);
|
||||
}, 50);
|
||||
}
|
||||
|
||||
debug(msg) {
|
||||
@ -274,7 +275,7 @@ class BrowserMod {
|
||||
if(!msg.card) return;
|
||||
|
||||
const fn = () => {
|
||||
popUp(msg.title, msg.card, msg.large, msg.style, msg.auto_close);
|
||||
popUp(msg.title, msg.card, msg.large, msg.style, msg.auto_close||msg.hide_header);
|
||||
if(msg.auto_close)
|
||||
this.autoclose_popup_active = true;
|
||||
};
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "browser_mod",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.4",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -655,7 +655,7 @@
|
||||
"dev": true
|
||||
},
|
||||
"card-tools": {
|
||||
"version": "github:thomasloven/lovelace-card-tools#abef0b7e89ac9430f2ff2e2663fa411d380a705a",
|
||||
"version": "github:thomasloven/lovelace-card-tools#adba94f7a24d7d9e87856613530190b8a13b740c",
|
||||
"from": "github:thomasloven/lovelace-card-tools"
|
||||
},
|
||||
"chalk": {
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "browser_mod",
|
||||
"private": true,
|
||||
"version": "1.0.4",
|
||||
"version": "1.1.0",
|
||||
"description": "",
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
|
@ -1,4 +1,10 @@
|
||||
name: browser_mod
|
||||
popup_cards:
|
||||
sun.sun:
|
||||
title: Popup-card
|
||||
card:
|
||||
type: markdown
|
||||
content: Popup for sun.sun
|
||||
views:
|
||||
- title: Player
|
||||
cards:
|
||||
@ -16,3 +22,59 @@ views:
|
||||
type: markdown
|
||||
content: Hello!
|
||||
|
||||
- type: button
|
||||
entity: sun.sun
|
||||
name: large
|
||||
tap_action:
|
||||
action: call-service
|
||||
service: browser_mod.popup
|
||||
service_data:
|
||||
deviceID: this
|
||||
title: Test
|
||||
large: true
|
||||
card:
|
||||
type: markdown
|
||||
content: Hello!
|
||||
|
||||
- type: button
|
||||
entity: sun.sun
|
||||
name: Style
|
||||
tap_action:
|
||||
action: call-service
|
||||
service: browser_mod.popup
|
||||
service_data:
|
||||
deviceID: this
|
||||
title: Test
|
||||
style:
|
||||
border-radius: 20px
|
||||
card:
|
||||
type: markdown
|
||||
content: Hello!
|
||||
|
||||
- type: button
|
||||
entity: sun.sun
|
||||
name: Auto Close
|
||||
tap_action:
|
||||
action: call-service
|
||||
service: browser_mod.popup
|
||||
service_data:
|
||||
deviceID: this
|
||||
title: Test
|
||||
auto_close: true
|
||||
card:
|
||||
type: markdown
|
||||
content: Hello!
|
||||
|
||||
- type: button
|
||||
entity: sun.sun
|
||||
name: Hide Header
|
||||
tap_action:
|
||||
action: call-service
|
||||
service: browser_mod.popup
|
||||
service_data:
|
||||
deviceID: this
|
||||
title: Test
|
||||
hide_header: true
|
||||
card:
|
||||
type: markdown
|
||||
content: Hello!
|
||||
|
Loading…
x
Reference in New Issue
Block a user