Repository navigation
Expand file tree
/
Copy pathapp.js
More file actions
160 lines (145 loc) · 5.62 KB
/
Copy pathapp.js
File metadata and controls
160 lines (145 loc) · 5.62 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import { changeState, commandSize, createlement, menuOpen, recherche, userToken} from "./function/Dom.js";
import { createAccount, validationForm } from "./function/form.js";
import { Librairie,Book } from "./function/lib.js";
changeState()
const libFromPage=document.getElementById("lib")
let templateLib=libFromPage.content.cloneNode(true)
const books=templateLib.querySelectorAll('.book')
const textTemp=document.getElementById('temp-desc')
const text=textTemp.content.cloneNode(true)
const paragraph=text.querySelector('p')
const commandeSize=text.querySelector('.size')
const commandeMarque=text.querySelector('.marque')
const size1=commandeSize.querySelectorAll('.cmd div')
let libs=new Librairie(templateLib)
libs.Append()
for (const book of books) {
book.addEventListener('click',(e)=>{
document.querySelector('.heroSection').classList.add('none')
for (const b of books) {
b.classList.add('none')
}
//recuperation de donnees du book
const imgBook=e.currentTarget.querySelector('.book-img img').cloneNode(true)
imgBook.style.width='200px'//style img
const bookHeader=e.currentTarget.querySelector('.book-title').cloneNode(true)
const bookDescription=e.currentTarget.querySelector('.book-description').cloneNode(true)
const textContainer=document.createElement('div')
textContainer.innerHTML=text
// creation boutton go back
const btnBack=createlement('div',{class:'back'})
btnBack.innerText='Back to acceuil'
// creation header pour book
const headTemp=document.getElementById('book-header');
let headBook=headTemp.content.cloneNode(true)
let head=headBook.querySelector('.book-header')
head.append(bookHeader.cloneNode(true))//<img src="asset/positif.jpg" alt="positif-thinking-img">
head.append(bookDescription.cloneNode(true))
document.body.append(headBook)
const containerBook=createlement('div',{
class:'container'
})
const containerElement=createlement('div',{
class:'container jf-center'
})
const containerElementHorizontal=createlement('div',{
class:'container jf-column'
})
console.log(containerBook)
containerElementHorizontal.append(bookHeader)
containerElementHorizontal.append(bookDescription)
containerElement.append(imgBook)
containerElement.append(containerElementHorizontal)
containerBook.append(containerElement)
containerBook.append(text)
containerBook.append(btnBack)
let bk=new Book(containerBook)
bk.AppendBook()
btnBack.addEventListener('click',function(){
document.querySelector('.heroSection').classList.remove('none')
this.classList.toggle('none')
for (const b of books) {
b.classList.remove('none')
}
containerBook.classList.toggle('none')
// headBook.classList.toggle('none')
head.classList.toggle('none')
})
// link acceuil
let btnAcceuil=document.querySelector('.back-link')
btnAcceuil.addEventListener('click',function(e){
e.preventDefault()
document.querySelector('.heroSection').classList.remove('none')
this.classList.toggle('none')
for (const b of books) {
b.classList.remove('none')
}
containerBook.classList.toggle('none')
// headBook.classList.toggle('none')
head.classList.toggle('none')
btnAcceuil.classList.remove('none')
})
})
}
// comment to go back
// commande pour la lecture
commandSize(commandeSize,commandeMarque)
size1.forEach(sizes => {
sizes.addEventListener('click',(e)=>{
let dataget=e.currentTarget.dataset.size
console.log(dataget)
// console.log(paragraph)
switch(dataget){
case '24':
paragraph.style.fontSize="24px"
break
case '14':
paragraph.style.fontSize="14px"
break
case '16':
paragraph.style.fontSize="16px"
break
case '18':
paragraph.style.fontSize="18px"
break
case '32':
paragraph.style.fontSize="32px"
break
}
})
});
// user fomction
createAccount()
userToken()
//onclick to btn Premuim
let btnPremuim=document.querySelectorAll('.btnBuy')
let singinzone=document.querySelector('#sing-in-place')
btnPremuim.forEach(btn=>{
btn.addEventListener('click',(e)=>{
singinzone.classList.add('sing-in-place')
document.body.style.overflow='hidden'
window.scrollTo(0,0)
e.preventDefault()
})
})
// raccouurcie ecran
document.addEventListener('keydown',(e)=>{
// console.log(e)
if(e.ctrlKey==true && e.key=='b'){
e.preventDefault()
console.log('raccourcie')
document.querySelector('#search').classList.toggle('clickSearch')
document.querySelector('#searchSuggession').classList.toggle('searchSuggession')
}
})
document.querySelector('#searchSuggession img').addEventListener('click',(e)=>{
document.querySelector('#searchSuggession').classList.remove('searchSuggession')
document.querySelector('#search').classList.remove('clickSearch')
})
// click sur l'input
document.querySelector('#search').addEventListener('click',()=>{
document.querySelector('#search').classList.toggle('clickSearch')
document.querySelector('#searchSuggession').classList.toggle('searchSuggession')
})
recherche()
validationForm()