|
18 | 18 | fontSize: '15px', |
19 | 19 | 'font-style': 'italic', |
20 | 20 | }, |
21 | | - shared: { |
| 21 | + toast: { |
22 | 22 | maxWidth: '320px', |
23 | 23 | padding: '5px 8px', |
24 | 24 | borderRadius: '3px', |
|
27 | 27 | cursor: 'pointer', |
28 | 28 | color: '#fafeff', |
29 | 29 | margin: '4px', |
30 | | - }, |
31 | | - toast: { |
32 | 30 | textShadow: '#3498db 1px 2px 1px', |
33 | 31 | background: '#2980b9', |
34 | 32 | }, |
|
99 | 97 | if (!text) return; |
100 | 98 | const id = count++; |
101 | 99 | const el = document.createElement('div'); |
102 | | - el.setAttribute('id', `AlertToast-${id}`); |
103 | | - applyCSS(el, style.shared); |
104 | 100 | applyCSS(el, style.toast); |
105 | 101 | applyCSS(el, css.toast || css); |
106 | 102 |
|
107 | 103 | // Add title, body |
108 | 104 | if (title) { |
109 | 105 | const tel = document.createElement('span'); |
110 | 106 | applyCSS(tel, style.title); |
111 | | - applyCSS(tel, title.css); |
112 | | - tel.textContent = title.text || title; |
| 107 | + applyCSS(tel, css.title); |
| 108 | + tel.textContent = title; |
113 | 109 | el.appendChild(tel); |
114 | 110 | } |
115 | 111 | const body = document.createElement('span'); |
|
141 | 137 | } |
142 | 138 | let prev = {}; |
143 | 139 | elb.onmouseover = () => { |
144 | | - // Apply default style |
145 | | - const original = applyCSS(elb, style.button.mouseOver); |
146 | | - // Apply CSS style |
147 | | - const custom = applyCSS(elb, css.button && css.button.mouseOver); |
148 | | - // Apply button style |
149 | | - const custom2 = applyCSS(elb, button.css && button.css.mouseOver); |
150 | | - // Remember the original styles, do this in reverse |
151 | | - Object.assign(prev, custom2, custom, original); |
| 140 | + const hoverStyle = Object.assign( |
| 141 | + {}, |
| 142 | + style.button.mouseOver, |
| 143 | + css.button && css.button.mouseOver, |
| 144 | + button.css && button.css.mouseOver |
| 145 | + ); |
| 146 | + prev = applyCSS(hoverStyle); |
152 | 147 | }; |
153 | 148 | elb.onmouseout = () => { |
154 | 149 | applyCSS(elb, prev); |
|
0 commit comments