Skip to content

Commit f4a683f

Browse files
committed
multiple bug fixes and optimization
1 parent bf83a9a commit f4a683f

File tree

7 files changed

+40
-29
lines changed

7 files changed

+40
-29
lines changed

assets/css/atcb.css

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add-to-Calendar Button
44
* ++++++++++++++++++++++
55
*
6-
* Version: 1.1.1
6+
* Version: 1.1.2
77
* Creator: Jens Kuerschner (https://jenskuerschner.de)
88
* Project: https://github.com/jekuer/add-to-calendar-button
99
* License: GNU General Public License v3.0 (gpl-3.0)
@@ -15,7 +15,7 @@
1515
}
1616

1717
.atcb_button_wrapper {
18-
display: block;
18+
display: inline-block;
1919
position: relative;
2020
}
2121

@@ -45,6 +45,11 @@
4545
-webkit-tap-highlight-color: transparent;
4646
width: auto;
4747
}
48+
@media only screen and (max-width: 575px) {
49+
.atcb_button {
50+
font-size: 14px;
51+
}
52+
}
4853

4954
.atcb_button.active {
5055
background: rgb(255, 255, 255);
@@ -108,6 +113,11 @@
108113
box-shadow: 1px 2px 10px 0px rgba(0,0,0,.4);
109114
color: rgb(0, 0, 0);
110115
}
116+
@media only screen and (max-width: 575px) {
117+
.atcb_list_item {
118+
font-size: 14px;
119+
}
120+
}
111121

112122
.atcb_list_item:first-child {
113123
padding-top: 25px;
@@ -122,7 +132,7 @@
122132
margin-right: 8px;
123133
}
124134

125-
#atcb_bgoverlay {
135+
.atcb_bgoverlay {
126136
background: rgba(20,20,20,.2);
127137
backdrop-filter: blur(2px);
128138
height: 100%;

assets/css/atcb.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/atcb.min.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/atcb.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Add-to-Calendar Button
44
* ++++++++++++++++++++++
55
*/
6-
const atcbVersion = '1.1.1';
6+
const atcbVersion = '1.1.2';
77
/* Creator: Jens Kuerschner (https://jenskuerschner.de)
88
* Project: https://github.com/jekuer/add-to-calendar-button
99
* License: GNU General Public License v3.0 (gpl-3.0)
@@ -32,14 +32,6 @@ function atcb_init() {
3232
if (atcb_validate(atcbConfig)) {
3333
// ... and generate the button on success
3434
atcb_generate(atcButtons[i], i, atcbConfig);
35-
// create the background overlay, which also acts as trigger to close any dropdowns
36-
let bgOverlay = document.createElement('div');
37-
bgOverlay.id = 'atcb_bgoverlay';
38-
bgOverlay.style.display = 'none';
39-
document.body.appendChild(bgOverlay);
40-
bgOverlay.addEventListener('click', atcb_close_all, {passive: true});
41-
bgOverlay.addEventListener('touchstart', atcb_close_all, {passive: true});
42-
bgOverlay.addEventListener('mouseenter', atcb_close_all, false);
4335
}
4436
}
4537
}
@@ -256,6 +248,15 @@ function atcb_generate(button, buttonId, data) {
256248
break;
257249
}
258250
});
251+
// create the background overlay, which also acts as trigger to close any dropdowns
252+
let bgOverlay = document.createElement('div');
253+
bgOverlay.id = 'atcb_bgoverlay_' + buttonId;
254+
bgOverlay.classList.add('atcb_bgoverlay');
255+
bgOverlay.style.display = 'none';
256+
button.appendChild(bgOverlay);
257+
bgOverlay.addEventListener('click', atcb_close_all, {passive: true});
258+
bgOverlay.addEventListener('touchstart', atcb_close_all, {passive: true});
259+
bgOverlay.addEventListener('mouseenter', atcb_close_all, false);
259260
// show the placeholder div
260261
button.style.display = 'block';
261262
// console log
@@ -279,17 +280,18 @@ function atcb_open() {
279280
this.classList.add('active');
280281
let list = document.getElementById('atcb_list_' + this.dataset.atcbtn);
281282
list.style.display = 'block';
282-
document.getElementById('atcb_bgoverlay').style.display = 'block';
283+
document.getElementById('atcb_bgoverlay_' + this.dataset.atcbtn).style.display = 'block';
283284
}
284285

285286
function atcb_close() {
286287
// remove the active class, hide the list and the background overlay
287288
this.classList.remove('active');
288289
let list = document.getElementById('atcb_list_' + this.dataset.atcbtn);
289290
list.style.display = 'none';
290-
document.getElementById('atcb_bgoverlay').style.display = 'none';
291+
document.getElementById('atcb_bgoverlay_' + this.dataset.atcbtn).style.display = 'none';
291292
}
292293

294+
293295
function atcb_close_all() {
294296
// get all buttons
295297
let atcButtons = document.querySelectorAll('.atcb_button');

assets/js/atcb.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/atcb.min.js.map

Lines changed: 10 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "add-to-calendar-button",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"description": "A convenient JavaScript snippet, which lets you create beautiful buttons, where people can add events to their calendars.",
55
"main": "assets/js/atcb.js",
66
"types": "index.d.ts",

0 commit comments

Comments
 (0)