Skip to content

Commit

Permalink
Merge pull request #5175 from FireLemons/fix_js_deprecation
Browse files Browse the repository at this point in the history
remove if false, make for loop more readable
  • Loading branch information
FireLemons authored Sep 6, 2023
2 parents 2d21113 + 4c2ee45 commit fcefbb3
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app/javascript/src/add_to_calendar_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ const Add2Calendar = require('add2calendar')

function createCalendarEvents () {
const calendarButtons = document.querySelectorAll('div.cal-btn')
if (!calendarButtons) return
calendarButtons.forEach((btn) => {

for (const calendarButton of calendarButtons) {
const calendarEvent = new Add2Calendar({
title: btn.dataset.title,
start: btn.dataset.start,
end: btn.dataset.end,
description: btn.dataset.title,
title: calendarButton.dataset.title,
start: calendarButton.dataset.start,
end: calendarButton.dataset.end,
description: calendarButton.dataset.title,
isAllDay: true
})

calendarEvent.createWidget(`#${btn.id}`)
btn.title = btn.dataset.tooltip
})
calendarEvent.createWidget(`#${calendarButton.id}`)
calendarButton.title = calendarButton.dataset.tooltip
}
}

$(() => { // JQuery's callback for the DOM loading
Expand Down

0 comments on commit fcefbb3

Please sign in to comment.