-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
34 lines (30 loc) · 1.15 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import './src/module/index.css';
import { DateTime } from 'luxon';
import ObjectBook from './src/module/script.js';
import { ListDisplay, NewBook, Getinfo } from './src/module/navbar.js';
const ShowList = document.querySelector('#list-link');
const AddNew = document.querySelector('#addlink');
const ContactInfo = document.querySelector('#contact-link');
const inputTitle = document.querySelector('#title-id');
const inputAuthor = document.querySelector('#author-id');
const Store = new ObjectBook(inputTitle, inputAuthor);
Store.booksList = JSON.parse(localStorage.getItem('storageFormData')) || [];
Store.createElement(Store.booksList);
Store.addBook();
window.addEventListener('load', () => {
Store.onPageLoad();
});
AddNew.addEventListener('click', NewBook);
ShowList.addEventListener('click', ListDisplay);
ContactInfo.addEventListener('click', Getinfo);
const displayTime = () => {
const Date = DateTime.now();
const date = Date.toLocaleString(DateTime.DATETIME_MED_WITH_SECONDS);
document.querySelector('#timer-p').innerHTML = date;
};
document.addEventListener('DOMContentLoaded', () => {
displayTime();
setInterval(() => {
displayTime();
}, 1000);
});