This repository has been archived by the owner on Jan 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsololearn.js
360 lines (207 loc) · 8.02 KB
/
sololearn.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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
"use strict";
const proGroup=[
{id:9726746,name:'Diego'},
{id:6850261,name:'Seb TheS'},
{id:10654452,name:'Javier Felipe Toribio'},
{id:11595192,name:'Saboor Hakimi'},
{id:4826331,name:'Stark'},
{id:2200299,name:'Prometheus'},
{id:7429689,name:'Denis Robberg'},
{id:14057407,name:'Doriav isakov'},
{id:5371585,name:'Sick Line Bro'},
{id:12731601,name:'Man Of Action'},
{id:10631738,name:'Onyx'},
{id:7038378,name:'Arb Rahim Badsa'},
{id:5351922,name:'Orion'},
{id:5097984,name:'Mahesh Mahato'},
{id:6029224,name:'Cepagrave'},
{id:14045357,name:'dinku789 Mehta'},
{id:15314637,name:'M J'},
{id:3800510,name:'Dennis'},
{id:11694334,name:'Danik Davletshin'},
{id:10314085,name:'🇮🇳Omkar🕉'}, /*1*/
{id:917611,name:'Dmitry Ilin'},
{id:12691463,name:'Marko Krstic'},
{id:11932555,name:'Coder Kitten'},
{id:16738670,name:'Danilo Cintrao'},
{id:9223786,name:'HonFu'},
{id:1981140,name:'bahha'},
{id:13714142,name:'r1c5'},
{id:14558754,name:'César Eduardo Aguas Aldana'},
{id:9172889,name:'John Bryan Pit Acaso'},
{id:4446335,name:'Pawan Maurya'},
{id:8994942,name:'Alice'},
{id:2472699,name:'Saurabh Tiwari'},
{id:4819943,name:'Gamma001'},
{id:748195,name:'Janusz bujak'},
{id:13253423,name:'CarrieForle'},
{id:16537801,name:'XXX'},
{id:5680106,name:'Stanislav'},
{id:16761972,name:'molang'},
{id:14447570,name:'Kevin Star'},
{id:11186837,name:'Alpha5and5'},/*2*/
{id:4703173,name:'Igor Kostrikin'},
{id:8909178,name:'Julio Codesal'},
{id:4735163,name:'Mohit The Coder (M.S.D)'},
{id:12875805,name:'MCGA'},
{id:5327650,name:'LukArToDo'},
{id:15315513,name:'Preity'},
{id:15747130,name:'Manfrid Strengell'},
{id:13314481,name:'Alexandr'},
{id:10807810,name:'Gyorgi Theisz'},
{id:8159873,name:'Jax'},
{id:12361701,name:'OfficialAz3'},
{id:2520889,name:'Michal'},
{id:12687006,name:'Ankur Dingh Oli'},
{id:12586353,name:'Arbokcharm'},
{id:2271086,name:'Param Siddharth'},
{id:9479351,name:'Priya'},
{id:5044306,name:'Shadow'},
{id:2464021,name:'med gazzeh'},
{id:26195909,name:'Edword'},
{id:2670745,name:'Fabian blaz'},/*3*/
{id:10959671,name:'Manito'},
{id:16667392,name:'Kiril'},
{id:14810203,name:'Michal Straka'},
{id:12451288,name:'Partha Sarathi'},
{id:13943183,name:'lvl 1 crook'},
{id:1189743,name:'Jean Michel Furtado M\'Peko'},
{id:1502544,name:'Davy hermans'},
{id:10000369,name:'Matthew G'},
{id:12140080,name:'yessine'},
{id:9751950,name:'Juan Pablo Vila'},
{id:15687328,name:'Pavle'},
{id:15771326,name:'Vinay_GB'},
{id:1416592,name:'MorrisMoss'},
{id:12942084,name:'Aakanksha💕'},
{id:6965381,name:'Christian Stallberg'},
{id:5743989,name:'Mart yaziki'},
{id:10902790,name:'Rajesh Singh Rathore'},
{id:4825354,name:'Louis'},
{id:4776735,name:'Sam'},
{id:9710664,name:'Michail Getmanskiy'},
/*4*/
{id:15574926,name:'Thomas'},
{id:3426759,name:'Oma Falk'},
{id:2671088,name:'Barracoder'},
{id:13608843,name:'RadaR'},
{id:4469476,name:'Demahrix'},
{id:16685145,name:'Laura Stasiulė'},
{id:16465769,name:'Michele'},
{id:14159513,name:'Linda Schnabel'},
{id:15551308,name:'Steve'},
{id:12514810,name:'Julia'},
{id:5597395,name:'Princetronixx'},
{id:2443327,name:'nueutrino-4RD'},
{id:16768297,name:'Mihai Apostol'},
{id:6980352,name:'Александр Петроченко '},
{id:15122805,name:'yasir mulla'},
{id:8507344,name:'🌶️anssens'},
{id:5040440,name:'Daljeet Singh'},
{id:16130260,name:'Gabriel Altwarg-Peel'},
{id:16390036,name:'Antek Olszevski'},
{id:5355537,name:'Mehmet Süzer'},/*5*/
/*biggest Array of my life 😁*/
];
/*I haven't uploaded yet*/
const platforms=[
{
name:'Codepen',
link:'https://codepen.io/omkarj6/full/GRgPbNV',
logo:'https://blog.codepen.io/wp-content/uploads/2012/06/Button-White-Large.png',
},
{
name:'Github',
link:'https://github.com/Omkar76/Code-Coach',
logo:'https://cdn2.iconfinder.com/data/icons/black-white-social-media/64/social_media_logo_github-512.png'
},
{
name:'Sololearn',
link:'https://code.sololearn.com/cxvdJ5tLoFUr/?ref=app',
logo:'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcT0vd4Yv3GzTd1SrOMuJB8KOtVqYce1Oa3-YZIv022lIayy7sds'
}
];
/*sort alphabetically , case insensitive , and ascending . not needed anymore
proGroup.sort((a,b)=> a.name.toUpperCase()<b.name.toUpperCase()?-1:1);
*/
/*invoked when input given to searchbar*/
let sortByName=name=>{
for(let user of proGroup){
if(!user.name.toLowerCase().
includes(name.toLowerCase())) {
user.card.style.display='none';
}
else {
user.card.style.display='flex';
}
}
}
let setCards=()=>{
let main=document.getElementById('main');
for(let user of proGroup)
{
let card=document.
createElement('div');
let avt=new Image('100px','100px');
avt.onerror=()=>{
avt.onerror=null; avt.src="https://www.sololearn.com/Images/NoAvatar.jpg";
}
avt.src="https://api.sololearn.com/Uploads/Avatars/"+user.id+".jpg";
let link=document.createElement('a');
link.innerHTML=user.name;
link.setAttribute('href', "https://www.sololearn.com/Profile/"+user.id+"/?ref=app");
card.classList.add('card');
avt.classList.add('avtar');
link.classList.add('anch');
link.style['padding-left']='20px';
card.appendChild(avt);
card.appendChild(link);
main.appendChild(card);
user.card=card; /*new property of user that store reference to div (card) for that user to later manipulate it while searching
users are elements of proGroup array
*/
}
document.querySelector('main').
style.opacity=1;
}
/*default parameter 0*/
let setCount=(n=0)=>{
document.getElementById('count').
innerText=n;
if(n<100)setTimeout(setCount,20,++n);
}
const greetings="Congratulations to all winners of code coach challenge!";
let sayCongo=(n=0)=>{
let msgBox=document.
getElementById('congoMessage');
msgBox.innerText+=greetings[n];
if(n<greetings.length-1)
setTimeout(sayCongo,70,++n);
else
document.getElementsByTagName('svg')[0].
style.opacity=1;
}
let setFooter=()=>{
let foot=document.
querySelector('footer');
for(const code of platforms){
let a=document.
createElement('a');
a.setAttribute('href',code.link);
a.style.margin='auto';
let logo=new Image();
logo.src=code.logo;
logo.setAttribute('alt',code.name);
logo.classList.add('logo');
a.appendChild(logo);
foot.appendChild(a);
}
}
window.onload=()=>{
setCards();
setCount();
sayCongo();
setFooter();
//console.log(proGroup.length);
/*images set through html made dom loading slow , and I was facing problems in starting js at very beginning of code. so all done with js😴*/
}