index.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Lee Morgan</title>
  6. <link rel="stylesheet" href="/style">
  7. <link href='https://api.mapbox.com/mapbox-gl-js/v2.3.1/mapbox-gl.css' rel='stylesheet'>
  8. </head>
  9. <body>
  10. <div id="menu">
  11. <button id="aboutButton" class="active">
  12. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  13. <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
  14. <circle cx="12" cy="7" r="4"></circle>
  15. </svg>
  16. <p>About Me</p>
  17. </button>
  18. <button id="projectsButton">
  19. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  20. <polyline points="16 18 22 12 16 6"></polyline>
  21. <polyline points="8 6 2 12 8 18"></polyline>
  22. </svg>
  23. <p>Projects</p>
  24. </button>
  25. <button id="blogButton">
  26. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  27. <path d="M12 19l7-7 3 3-7 7-3-3z"></path>
  28. <path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"></path>
  29. <path d="M2 2l7.586 7.586"></path>
  30. <circle cx="11" cy="11" r="2"></circle>
  31. </svg>
  32. <p>Blog</p>
  33. </button>
  34. <button id="linksButton">
  35. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  36. <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
  37. <line x1="3" y1="9" x2="21" y2="9"></line>
  38. <line x1="9" y1="21" x2="9" y2="9"></line>
  39. </svg>
  40. <p>Fun Links</p>
  41. </button>
  42. <button id="galleryButton">
  43. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  44. <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
  45. <circle cx="8.5" cy="8.5" r="1.5"></circle>
  46. <polyline points="21 15 16 10 5 21"></polyline>
  47. </svg>
  48. <p>Gallery</p>
  49. </button>
  50. <button id="learnButton">
  51. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  52. <path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"></path>
  53. <path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"></path>
  54. </svg>
  55. <p>Learn</p>
  56. </button>
  57. </div>
  58. <div id="main">
  59. <div id="about">
  60. <div class="aboutLeft">
  61. <h2 class="center">Critical Statistics</h2>
  62. <h3>Name: Lee Morgan</h3>
  63. <p>Gender: Male</p>
  64. <p>Born: March 9, 1990</p>
  65. <p>SSA Life Expectancy: 81.2 years</p>
  66. <p>Likely Death: May 1, 2071</p>
  67. <div class="borderLine"></div>
  68. <div id=ageDiv>
  69. <h3 class="center">Age</h3>
  70. <p id="age"></p>
  71. <p><span class="boldy">Years: </span><span id="ageYears"></span></p>
  72. <p><span class="boldy">Days: </span><span id="ageDays"></span></p>
  73. <p><span class="boldy">Hours: </span><span id="ageHours"></span></p>
  74. <p><span class="boldy">Minutes: </span><span id="ageMinutes"></span></p>
  75. <p><span class="boldy">Seconds: </span><span id="ageSeconds"></span></p>
  76. </div>
  77. <div class="borderLine"></div>
  78. <div id=deathDiv>
  79. <h3 class="center">Time to Likely Death</h3>
  80. <p id="death"></p>
  81. <p><span class="boldy">Years: </span><span id="deathYears"></span></p>
  82. <p><span class="boldy">Days: </span><span id="deathDays"></span></p>
  83. <p><span class="boldy">Hours: </span><span id="deathHours"></span></p>
  84. <p><span class="boldy">Minutes: </span><span id="deathMinutes"></span></p>
  85. <p><span class="boldy">Seconds: </span><span id="deathSeconds"></span></p>
  86. </div>
  87. </div>
  88. <div class="aboutCenter">
  89. <h1>Who Am I?</h1>
  90. <p>Hey, my name is Lee Morgan. I am primarily a web developer, though I like to dabble in a lot of different things. I mostly do freelance work and work on my own projects whenever life presentst me the opportunity to do so. I also enjoy teaching English as a second language from time to time and a few other things.</p>
  91. <p>You can find a lot of content from my hobbies here on my site. Occasionally I like to write about things that I feel strongly about. I also enjoy traveling a bit and doing smartphone photography of different places. My real passion though is programming. That is why I create video lectures to teach people program as well. Check out the menu on the left if you are interested in seeing the results of any of my hobbies.</p>
  92. <p>Currently, I am an expat living in Nizhny Novgorod, Russia. I am enjoying traveling around Russia while attempting to learn Russian as well. However, I am originally from Maine, USA and have lived in several different places in the US in my life.</p>
  93. </div>
  94. <div class="aboutRight">
  95. <a class="meLink" href="/resume">
  96. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  97. <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path>
  98. <polyline points="13 2 13 9 20 9"></polyline>
  99. </svg>
  100. Resume/CV
  101. </a>
  102. <a class="meLink" href="https://github.com/MorganLee909">
  103. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  104. <path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path>
  105. </svg>
  106. GitHub
  107. </a>
  108. <a class="meLink" href="https://www.facebook.com/lee.morgan.33/">
  109. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  110. <path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z"></path>
  111. </svg>
  112. Facebook
  113. </a>
  114. <a class="meLink" href="https://www.linkedin.com/in/leemorganio">
  115. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  116. <path d="M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z"></path>
  117. <rect x="2" y="9" width="4" height="12"></rect>
  118. <circle cx="4" cy="4" r="2"></circle>
  119. </svg>
  120. LinkedIn
  121. </a>
  122. <a class="meLink" href="https://www.minds.com/leemorganio">
  123. <svg width="24" height="24" aria-hidden="true" viewBox="0 0 352 512">
  124. <path fill="currentColor" d="M96.06 454.35c.01 6.29 1.87 12.45 5.36 17.69l17.09 25.69a31.99 31.99 0 0 0 26.64 14.28h61.71a31.99 31.99 0 0 0 26.64-14.28l17.09-25.69a31.989 31.989 0 0 0 5.36-17.69l.04-38.35H96.01l.05 38.35zM0 176c0 44.37 16.45 84.85 43.56 115.78 16.52 18.85 42.36 58.23 52.21 91.45.04.26.07.52.11.78h160.24c.04-.26.07-.51.11-.78 9.85-33.22 35.69-72.6 52.21-91.45C335.55 260.85 352 220.37 352 176 352 78.61 272.91-.3 175.45 0 73.44.31 0 82.97 0 176zm176-80c-44.11 0-80 35.89-80 80 0 8.84-7.16 16-16 16s-16-7.16-16-16c0-61.76 50.24-112 112-112 8.84 0 16 7.16 16 16s-7.16 16-16 16z"></path>
  125. </svg>
  126. Minds
  127. </a>
  128. <a class="meLink" href="https://vk.com/id385316502">
  129. <svg wdith="24" height="24" aria-hidden="true"viewBox="0 0 576 512">
  130. <path fill="currentColor" d="M545 117.7c3.7-12.5 0-21.7-17.8-21.7h-58.9c-15 0-21.9 7.9-25.6 16.7 0 0-30 73.1-72.4 120.5-13.7 13.7-20 18.1-27.5 18.1-3.7 0-9.4-4.4-9.4-16.9V117.7c0-15-4.2-21.7-16.6-21.7h-92.6c-9.4 0-15 7-15 13.5 0 14.2 21.2 17.5 23.4 57.5v86.8c0 19-3.4 22.5-10.9 22.5-20 0-68.6-73.4-97.4-157.4-5.8-16.3-11.5-22.9-26.6-22.9H38.8c-16.8 0-20.2 7.9-20.2 16.7 0 15.6 20 93.1 93.1 195.5C160.4 378.1 229 416 291.4 416c37.5 0 42.1-8.4 42.1-22.9 0-66.8-3.4-73.1 15.4-73.1 8.7 0 23.7 4.4 58.7 38.1 40 40 46.6 57.9 69 57.9h58.9c16.8 0 25.3-8.4 20.4-25-11.2-34.9-86.9-106.7-90.3-111.5-8.7-11.2-6.2-16.2 0-26.2.1-.1 72-101.3 79.4-135.6z"></path>
  131. </svg>
  132. VK
  133. </a>
  134. <a class="meLink" href="https://www.bitchute.com/channel/Dn8vPaD4hqD6/">
  135. <img src="/images/bitchute" alt="BitChute logo">
  136. BitChute
  137. </a>
  138. <a class="meLink" href="https://rumble.com/user/LeeMorganIO">
  139. <img src="/images/rumble" alt="Rumble logo">
  140. Rumble
  141. </a>
  142. <a class="meLink" href="https://www.youtube.com/channel/UCjAUvyOuOEEXFr3K2oXldRg">
  143. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  144. <path d="M22.54 6.42a2.78 2.78 0 0 0-1.94-2C18.88 4 12 4 12 4s-6.88 0-8.6.46a2.78 2.78 0 0 0-1.94 2A29 29 0 0 0 1 11.75a29 29 0 0 0 .46 5.33A2.78 2.78 0 0 0 3.4 19c1.72.46 8.6.46 8.6.46s6.88 0 8.6-.46a2.78 2.78 0 0 0 1.94-2 29 29 0 0 0 .46-5.25 29 29 0 0 0-.46-5.33z"></path>
  145. <polygon points="9.75 15.02 15.5 11.75 9.75 8.48 9.75 15.02"></polygon>
  146. </svg>
  147. YouTube
  148. </a>
  149. </div>
  150. </div>
  151. <div id="projects" class="cardContainer" style="display:none">
  152. <a class="card" href="https://thesubline.com">
  153. <h2>The Subline</h2>
  154. <img src="/images/subline" alt="The Subline">
  155. <p>A web application to assist restaurant owners in managing their inventories. Providing insights into usage, waste and other details through the use of data.</p>
  156. </a>
  157. <a class="card" href="https://budgeteer.money">
  158. <h2>Budgeteer</h2>
  159. <img src="/images/budgeteer" alt="Budgeteer">
  160. <p>A simple web application to help people to budget their money in a simple and approachable manner.</p>
  161. </a>
  162. <a class="card" href="markket.xyz">
  163. <h2>Local Markets</h2>
  164. <img src="/images/market" alt="Market">
  165. <p>A website for people to find farmers markets and vendors of local products in their area.</p>
  166. </a>
  167. <a class="card" href="/sudoku">
  168. <h2>Sudoku Solver</h2>
  169. <img src="/images/sudoku" alt="Sudoku">
  170. <p>Stuck on a particularly difficult game of sudoku? Enter any sudoku puzzle and have it solved immediately.</p>
  171. </a>
  172. <a class="card" href="/birthdayparadox">
  173. <h2>The Birthday Paradox</h2>
  174. <img src="/images/birthday" alt="Birthday Hat">
  175. <p>A demonstration of the counterintuitive birthday paradox.</p>
  176. </a>
  177. <a class="card" href="https://blacklist.aero">
  178. <h2>Blacklist.aero</h2>
  179. <img src="/images/blacklist" alt="Blacklist.aero logo">
  180. <p>A site to enable airports to blacklist and check on the status of those who use their services.</p>
  181. </a>
  182. </div>
  183. <div id="blog" style="display:none;">
  184. <div id="blogTags" class="tagContainer"></div>
  185. <div id="blogs" class="cardContainer"></div>
  186. <template id="blogCard">
  187. <a class="card">
  188. <h1></h1>
  189. <img>
  190. </a>
  191. </template>
  192. </div>
  193. <div id="links" class="cardContainer" style="display:none;">
  194. <a class="card" href="https://cs-online.club/en/servers">
  195. <h2>CS:GO in the browser</h2>
  196. <p>A website to play CS:GO in the browser with other people online.</p>
  197. </a>
  198. <a class="card" href="https://driveandlisten.herokuapp.com/">
  199. <h2>Drive and Listen</h2>
  200. <p>Pretend to be driving your car and listening to the radio. Watch cars driving down the road all over the world while listening to local radio stations.</p>
  201. </a>
  202. <a class="card" href="https://www.ekzhang.com/game-of-life">
  203. <h2>Conway's Game of Life</h2>
  204. <p>Play around and experiment with different situations in Conway's Game of Life</p>
  205. </a>
  206. <a class="card" href="https://librivox.org/">
  207. <h2>LibriVox</h2>
  208. <p>Free public domain audiobooks. Listen to books for free, or volunteer your time to read them for others to listen to</p>
  209. </a>
  210. <a class="card" href="https://rocketcrab.com/">
  211. <h2>rocketcrab.com</h2>
  212. <p>Party games right on your phone</p>
  213. </a>
  214. <a class="card" href="https://thetruesize.com/">
  215. <h2>The True Size of</h2>
  216. <p>The common Mercator projection map that we are used to distorts the real size of countries. This site will let you move and directly compare the real size of different countries to see how big they really are</p>
  217. </a>
  218. <a class="card" href="https://win95.ajf.me/">
  219. <h2>Windows 95</h2>
  220. <p>Use a virtual Windows 95 computer right in your browser</p>
  221. </a>
  222. <a class="card" href="https://pointerpointer.com/">
  223. <h2>Pointer Pointer</h2>
  224. <p>Point to your pointer</p>
  225. </a>
  226. <a class="card" href="https://pudding.cool/2020/12/judge-my-spotify">
  227. <h2>Judge My Spotify</h2>
  228. <p>Let an AI criticize your taste in music</p>
  229. </a>
  230. </div>
  231. <div id="gallery" style="display:none">
  232. <div id="galleryTags" class="tagContainer"></div>
  233. <div id='map' style='width: 400px; height: 300px;'></div>
  234. </div>
  235. <div id="learn" class="cardContainer" style="display:none"></div>
  236. </div>
  237. <script>
  238. //GALLERY MAP
  239. let mapped = false;
  240. let mapPromise = new Promise((resolve, reject)=>{
  241. let script = document.createElement("script");
  242. script.src = "https://api.mapbox.com/mapbox-gl-js/v2.3.1/mapbox-gl.js";
  243. script.onload = resolve;
  244. document.getElementById("gallery").appendChild(script);
  245. });
  246. let buttons = document.getElementById("menu").children;
  247. let content = document.getElementById("main").children;
  248. for(let i = 0; i < buttons.length; i++){
  249. buttons[i].onclick = ()=>{
  250. for(let j = 0; j < buttons.length; j++){
  251. buttons[j].classList.remove("active");
  252. }
  253. buttons[i].classList.add("active");
  254. for(let j = 0; j < content.length; j++){
  255. content[j].style.display = "none";
  256. }
  257. if(buttons[i].id === "galleryButton" && mapped === false){
  258. Promise.all([
  259. mapPromise,
  260. fetch("/gallery/retrieve").then(response => response.json())
  261. ])
  262. .then(loadGallery)
  263. .catch((err)=>{});
  264. mapped = true;
  265. }
  266. let string = buttons[i].id.replace("Button", "");
  267. document.getElementById(string).style.display = "flex";
  268. };
  269. }
  270. let searchTags = (content, tag)=>{
  271. let galleryList = [];
  272. for(let i = 0; i < content.length; i++){
  273. for(let j = 0; j < content[i].tags.length; j++){
  274. if(content[i].tags[j].toLowerCase() === tag){
  275. galleryList.push(content[i]);
  276. break;
  277. }
  278. }
  279. }
  280. return galleryList;
  281. }
  282. //Age display
  283. let ageYears = document.getElementById("ageYears");
  284. let ageDays = document.getElementById("ageDays");
  285. let ageHours = document.getElementById("ageHours");
  286. let ageMinutes = document.getElementById("ageMinutes");
  287. let ageSeconds = document.getElementById("ageSeconds");
  288. let dYears = document.getElementById("deathYears");
  289. let dDays = document.getElementById("deathDays");
  290. let dHours = document.getElementById("deathHours");
  291. let dMinutes = document.getElementById("deathMinutes");
  292. let dSeconds = document.getElementById("deathSeconds");
  293. let msYear = 1000 * 60 * 60 * 24 * 365;
  294. let birth = new Date(Date.UTC(90, 2, 9, 10, 5));
  295. let death = new Date(birth.getTime() + (msYear * 81.2));
  296. let displayAge = ()=>{
  297. let now = new Date();
  298. let msDiff = now - birth;
  299. let deathDiff = death - now;
  300. let msDay = 1000 * 60 * 60 * 24;
  301. let msHour = 1000 * 60 * 60;
  302. let msMinute = 1000 * 60;
  303. let msSecond = 1000;
  304. ageYears.innerText = msDiff / msYear;
  305. ageDays.innerText = msDiff / msDay;
  306. ageHours.innerText = msDiff / msHour;
  307. ageMinutes.innerText = msDiff / msMinute;
  308. ageSeconds.innerText = parseInt(msDiff / msSecond);
  309. dYears.innerText = deathDiff / msYear;
  310. dDays.innerText = deathDiff / msDay;
  311. dHours.innerText = deathDiff / msHour;
  312. dMinutes.innerText = deathDiff / msMinute;
  313. dSeconds.innerText = parseInt(deathDiff / msSecond);
  314. let years = Math.floor(msDiff / msYear);
  315. msDiff -= msYear * years;
  316. let days = Math.floor(msDiff / msDay);
  317. msDiff -= msDay * days;
  318. let hours = Math.floor(msDiff / msHour);
  319. msDiff -= msHour * hours;
  320. let minutes = Math.floor(msDiff / msMinute);
  321. msDiff -= msMinute * minutes;
  322. let seconds = Math.floor(msDiff / msSecond);
  323. let deathYears = Math.floor(deathDiff / msYear);
  324. deathDiff -= msYear * deathYears;
  325. let deathDays = Math.floor(deathDiff / msDay);
  326. deathDiff -= msDay * deathDays;
  327. let deathHours = Math.floor(deathDiff / msHour);
  328. deathDiff -= msHour * deathHours;
  329. let deathMinutes = Math.floor(deathDiff / msMinute);
  330. deathDiff -= msMinute * deathMinutes;
  331. let deathSeconds = Math.floor(deathDiff / msSecond);
  332. document.getElementById("age").innerText = `${years} years, ${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`;
  333. document.getElementById("death").innerText = `${deathYears} years, ${deathDays} days, ${deathHours} hours, ${deathMinutes} minutes and ${deathSeconds} seconds`;
  334. }
  335. displayAge();
  336. setInterval(displayAge, 1000);
  337. //Get blog content
  338. let populateBlogs = (blogs)=>{
  339. let container = document.getElementById("blogs");
  340. let template = document.getElementById("blogCard").content.children[0];
  341. while(container.children.length > 0){
  342. container.removeChild(container.firstChild);
  343. }
  344. for(let i = 0; i < blogs.length; i++){
  345. let card = template.cloneNode(true);
  346. card.href = `/blog/${blogs[i]._id}`;
  347. card.children[0].innerText = blogs[i].title;
  348. card.children[1].src = blogs[i].thumbnail;
  349. card.children[1].alt = `${blogs[i].title} thumbnail`;
  350. container.appendChild(card);
  351. }
  352. }
  353. fetch("/blog/retrieve")
  354. .then(response => response.json())
  355. .then((response)=>{
  356. let tagContainer = document.getElementById("blogTags");
  357. let tags = [];
  358. let tag = document.createElement("button");
  359. tag.innerText = "All";
  360. tag.classList.add("tag");
  361. tag.onclick = ()=>{populateBlogs(response)};
  362. tagContainer.appendChild(tag);
  363. for(let i = 0; i < response.length; i++){
  364. for(let j = 0; j < response[i].tags.length; j++){
  365. if(tags.includes(response[i].tags[j].toLowerCase()) === true) continue;
  366. tags.push(response[i].tags[j].toLowerCase());
  367. let tag = document.createElement("button");
  368. tag.innerText = response[i].tags[j];
  369. tag.classList.add("tag");
  370. tag.onclick = ()=>{populateBlogs(searchTags(response, response[i].tags[j].toLowerCase()))};
  371. tagContainer.appendChild(tag);
  372. }
  373. }
  374. populateBlogs(response);
  375. })
  376. .catch((err)=>{});
  377. let loadGallery = (response)=>{
  378. let galleries = response[1].galleries;
  379. //MAP
  380. mapboxgl.accessToken = response[1].mapboxKey;
  381. let map = new mapboxgl.Map({
  382. container: 'map',
  383. style: 'mapbox://styles/mapbox/streets-v11',
  384. center: [46.313332, 56.183037],
  385. zoom: 7
  386. });
  387. let mapDiv = document.getElementById("map");
  388. mapDiv.style.height = "90%";
  389. mapDiv.style.width = "90%";
  390. map.resize();
  391. //GALLERY DATA
  392. let tagContainer = document.getElementById("galleryTags");
  393. let tags = [];
  394. let tag = document.createElement("button");
  395. tag.innerText = "All";
  396. tag.classList.add("tag");
  397. tagContainer.appendChild(tag);
  398. for(let i = 0; i < galleries.length; i++){
  399. let tags = galleries[i].tags.toString();
  400. tags = tags.replaceAll(",", ", ");
  401. let popup = new mapboxgl.Popup()
  402. .on("open", ()=>{
  403. popup.setHTML(`
  404. <a class="galleryPopup" href="/gallery/${galleries[i]._id}">
  405. <h1>${galleries[i].title}</h1>
  406. <p>${tags}</p>
  407. <img class="popupImage" src="${galleries[i].images[0]}" alt="${galleries[i].title} image">
  408. </a>
  409. `)
  410. });
  411. let marker = new mapboxgl.Marker()
  412. .setLngLat([galleries[i].location.coordinates[1], galleries[i].location.coordinates[0]])
  413. .addTo(map)
  414. .setPopup(popup);
  415. for(let j = 0; j < galleries[i].tags.length; j++){
  416. if(tags.includes(galleries[i].tags[j]) === true) continue;
  417. tags.push(galleries[i].tags[j]);
  418. let tag = document.createElement("button");
  419. tag.innerText = galleries[i].tags[j];
  420. tag.classList.add("tag");
  421. tagContainer.appendChild(tag);
  422. }
  423. }
  424. }
  425. //Get "learn" content
  426. fetch("/learn/courses/json")
  427. .then(response => response.json())
  428. .then((response)=>{
  429. let container = document.getElementById("learn");
  430. for(let i = 0; i < response.length; i++){
  431. let card = document.createElement("a");
  432. card.classList.add("card");
  433. card.href = `/learn/courses/${response[i]._id}`;
  434. container.appendChild(card);
  435. let h2 = document.createElement("h2");
  436. h2.innerText = response[i].title;
  437. card.appendChild(h2);
  438. let img = document.createElement("img");
  439. img.src = response[i].thumbNail;
  440. img.alt = `${response[i].title} thumbnail`;
  441. card.appendChild(img);
  442. }
  443. })
  444. .catch((err)=>{});
  445. </script>
  446. </body>
  447. </html>