MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / addCards

Function addCards

assets/js/makeMatchGame.js:189–235  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

187
188//functions
189function addCards(event)
190{
191 if(!event.target.classList.contains("disable") && !event.target.classList.contains("selected") ){
192 event.target.classList.add("selected");
193 if(event.target.classList.contains("one")){
194 index=0; loopSize2=8;}
195 else if(event.target.classList.contains("two")){
196 index=1; loopSize2=12;}
197 else if(event.target.classList.contains("three")){
198 index=2; loopSize2=16; loopSize4=8;}
199 else{
200 index=3;
201 loopSize2=24; loopSize4=12;}
202 if(index<3){
203 for(let i=0;i<4;i++){
204 const rowDiv =document.createElement("div");
205 rowDiv.classList.add("row");
206 for(let j=0;j<(2*(index+2));j++)
207 {
208 const cardDiv=document.createElement("div");
209 cardDiv.classList.add("card" );
210 rowDiv.appendChild(cardDiv);
211 }
212 playground.appendChild(rowDiv);
213 }
214 }
215 else{
216 for(let i=0;i<6;i++){
217 const rowDiv =document.createElement("div");
218 rowDiv.classList.add("row");
219 for(let j=0;j<8;j++)
220 {
221 const cardDiv=document.createElement("div");
222 cardDiv.classList.add("card" );
223 rowDiv.appendChild(cardDiv);
224 }
225 playground.appendChild(rowDiv);
226 }
227 }
228 sizeButton.forEach(button => {
229 if(!button.classList.contains("selected"))
230 button.classList.add("disable");
231 })
232
233 cards=[...document.querySelectorAll('.card')];
234 }
235};
236
237function cardo(event)
238{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected