index.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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 rel="icon" type="img/ico" href="/images/favicon">
  8. <link href='https://api.mapbox.com/mapbox-gl-js/v2.3.1/mapbox-gl.css' rel='stylesheet'>
  9. </head>
  10. <body>
  11. <div id="menu">
  12. <button id="aboutButton" class="active">
  13. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  14. <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
  15. <circle cx="12" cy="7" r="4"></circle>
  16. </svg>
  17. <p>About Me</p>
  18. </button>
  19. <button id="projectsButton">
  20. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  21. <polyline points="16 18 22 12 16 6"></polyline>
  22. <polyline points="8 6 2 12 8 18"></polyline>
  23. </svg>
  24. <p>Projects</p>
  25. </button>
  26. <button id="blogButton">
  27. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  28. <path d="M12 19l7-7 3 3-7 7-3-3z"></path>
  29. <path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"></path>
  30. <path d="M2 2l7.586 7.586"></path>
  31. <circle cx="11" cy="11" r="2"></circle>
  32. </svg>
  33. <p>Blog</p>
  34. </button>
  35. <button id="galleryButton">
  36. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  37. <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
  38. <circle cx="8.5" cy="8.5" r="1.5"></circle>
  39. <polyline points="21 15 16 10 5 21"></polyline>
  40. </svg>
  41. <p>Gallery</p>
  42. </button>
  43. <button id="currencyButton">
  44. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  45. <line x1="12" y1="1" x2="12" y2="23"></line>
  46. <path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"></path>
  47. </svg>
  48. <p>Currency</p>
  49. </button>
  50. </div>
  51. <div id="main">
  52. <div id="about">
  53. <div class="aboutCenter">
  54. <h1>Who Am I?</h1>
  55. <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 presents 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>
  56. <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>
  57. <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>
  58. </div>
  59. <div class="aboutRight">
  60. <a class="meLink" href="/resume">
  61. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  62. <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path>
  63. <polyline points="13 2 13 9 20 9"></polyline>
  64. </svg>
  65. Resume/CV
  66. </a>
  67. <a class="meLink" href="https://github.com/MorganLee909">
  68. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  69. <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>
  70. </svg>
  71. GitHub
  72. </a>
  73. <a class="meLink" href="https://www.linkedin.com/in/leemorganio">
  74. <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  75. <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>
  76. <rect x="2" y="9" width="4" height="12"></rect>
  77. <circle cx="4" cy="4" r="2"></circle>
  78. </svg>
  79. LinkedIn
  80. </a>
  81. </div>
  82. </div>
  83. <div id="projects" class="cardContainer" style="display:none">
  84. <a class="card" href="https://thesubline.com">
  85. <h2>The Subline</h2>
  86. <img src="/images/subline" alt="The Subline">
  87. <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>
  88. </a>
  89. <a class="card" href="https://budgeteer.money">
  90. <h2>Budgeteer</h2>
  91. <img src="/images/budgeteer" alt="Budgeteer">
  92. <p>A simple web application to help people to budget their money in a simple and approachable manner.</p>
  93. </a>
  94. <a class="card" href="/sudoku">
  95. <h2>Sudoku Solver</h2>
  96. <img src="/images/sudoku" alt="Sudoku">
  97. <p>Stuck on a particularly difficult game of sudoku? Enter any sudoku puzzle and have it solved immediately.</p>
  98. </a>
  99. <a class="card" href="/birthdayparadox">
  100. <h2>The Birthday Paradox</h2>
  101. <img src="/images/birthday" alt="Birthday Hat">
  102. <p>A demonstration of the counterintuitive birthday paradox.</p>
  103. </a>
  104. <a class="card" href="https://blacklist.aero">
  105. <h2>Blacklist.aero</h2>
  106. <img src="/images/blacklist" alt="Blacklist.aero logo">
  107. <p>A site to enable airports to blacklist and check on the status of those who use their services.</p>
  108. </a>
  109. </div>
  110. <div id="blog" style="display:none;">
  111. <div id="blogTags" class="tagContainer"></div>
  112. <div id="blogs" class="cardContainer"></div>
  113. <template id="blogCard">
  114. <a class="card">
  115. <h1></h1>
  116. <img>
  117. </a>
  118. </template>
  119. </div>
  120. <div id="gallery" style="display:none">
  121. <div id="galleryTags" class="tagContainer"></div>
  122. <div id='map' style='width: 400px; height: 300px;'></div>
  123. </div>
  124. <div id="learn" class="cardContainer" style="display:none"></div>
  125. <div id="currency" style="display:none">
  126. <div id="locations"></div>
  127. <div id="currencyContainer"></div>
  128. <template id="currencyTemplate">
  129. <div class="currency">
  130. <h1 class="location"></h1>
  131. <p class="info"></p>
  132. <div class="currencyImages">
  133. <img class="frontImage">
  134. <img class="backImage">
  135. </div>
  136. <p class="comment"></p>
  137. </div>
  138. </template>
  139. </div>
  140. </div>
  141. <script>
  142. //GALLERY MAP
  143. let mapped = false;
  144. let mapPromise = new Promise((resolve, reject)=>{
  145. let script = document.createElement("script");
  146. script.src = "https://api.mapbox.com/mapbox-gl-js/v2.3.1/mapbox-gl.js";
  147. script.onload = resolve;
  148. document.getElementById("gallery").appendChild(script);
  149. });
  150. let buttons = document.getElementById("menu").children;
  151. let content = document.getElementById("main").children;
  152. for(let i = 0; i < buttons.length; i++){
  153. buttons[i].onclick = ()=>{
  154. for(let j = 0; j < buttons.length; j++){
  155. buttons[j].classList.remove("active");
  156. }
  157. buttons[i].classList.add("active");
  158. for(let j = 0; j < content.length; j++){
  159. content[j].style.display = "none";
  160. }
  161. if(buttons[i].id === "galleryButton" && mapped === false){
  162. Promise.all([
  163. mapPromise,
  164. fetch("/gallery/retrieve").then(response => response.json())
  165. ])
  166. .then(loadGallery)
  167. .catch((err)=>{});
  168. mapped = true;
  169. }
  170. let string = buttons[i].id.replace("Button", "");
  171. document.getElementById(string).style.display = "flex";
  172. };
  173. }
  174. let searchTags = (content, tag)=>{
  175. let galleryList = [];
  176. for(let i = 0; i < content.length; i++){
  177. for(let j = 0; j < content[i].tags.length; j++){
  178. if(content[i].tags[j].toLowerCase() === tag){
  179. galleryList.push(content[i]);
  180. break;
  181. }
  182. }
  183. }
  184. return galleryList;
  185. }
  186. //Get blog content
  187. let populateBlogs = (blogs)=>{
  188. let container = document.getElementById("blogs");
  189. let template = document.getElementById("blogCard").content.children[0];
  190. while(container.children.length > 0){
  191. container.removeChild(container.firstChild);
  192. }
  193. for(let i = 0; i < blogs.length; i++){
  194. let card = template.cloneNode(true);
  195. card.href = `/blog/${blogs[i]._id}`;
  196. card.children[0].innerText = blogs[i].title;
  197. card.children[1].src = blogs[i].thumbnail;
  198. card.children[1].alt = `${blogs[i].title} thumbnail`;
  199. container.appendChild(card);
  200. }
  201. }
  202. fetch("/blog/retrieve")
  203. .then(response => response.json())
  204. .then((response)=>{
  205. let tagContainer = document.getElementById("blogTags");
  206. let tags = [];
  207. let tag = document.createElement("button");
  208. tag.innerText = "All";
  209. tag.classList.add("tag");
  210. tag.onclick = ()=>{populateBlogs(response)};
  211. tagContainer.appendChild(tag);
  212. for(let i = 0; i < response.length; i++){
  213. for(let j = 0; j < response[i].tags.length; j++){
  214. if(tags.includes(response[i].tags[j].toLowerCase()) === true) continue;
  215. tags.push(response[i].tags[j].toLowerCase());
  216. let tag = document.createElement("button");
  217. tag.innerText = response[i].tags[j];
  218. tag.classList.add("tag");
  219. tag.onclick = ()=>{populateBlogs(searchTags(response, response[i].tags[j].toLowerCase()))};
  220. tagContainer.appendChild(tag);
  221. }
  222. }
  223. populateBlogs(response);
  224. })
  225. .catch((err)=>{});
  226. let loadGallery = (response)=>{
  227. let galleries = response[1].galleries;
  228. //MAP
  229. mapboxgl.accessToken = response[1].mapboxKey;
  230. let map = new mapboxgl.Map({
  231. container: 'map',
  232. style: 'mapbox://styles/mapbox/streets-v11',
  233. center: [-6.2764, 48.3623],
  234. zoom: 3
  235. });
  236. let mapDiv = document.getElementById("map");
  237. mapDiv.style.height = "90%";
  238. mapDiv.style.width = "90%";
  239. map.resize();
  240. //GALLERY DATA
  241. let tagContainer = document.getElementById("galleryTags");
  242. let tags = [];
  243. let tag = document.createElement("button");
  244. tag.innerText = "All";
  245. tag.classList.add("tag");
  246. tagContainer.appendChild(tag);
  247. for(let i = 0; i < galleries.length; i++){
  248. let tags = galleries[i].tags.toString();
  249. tags = tags.replaceAll(",", ", ");
  250. let popup = new mapboxgl.Popup()
  251. .on("open", ()=>{
  252. popup.setHTML(`
  253. <a class="galleryPopup" href="/gallery/${galleries[i]._id}">
  254. <h1>${galleries[i].title}</h1>
  255. <p>${tags}</p>
  256. <img class="popupImage" src="${galleries[i].images[0]}" alt="${galleries[i].title} image">
  257. </a>
  258. `)
  259. });
  260. let marker = new mapboxgl.Marker()
  261. .setLngLat([galleries[i].location.coordinates[1], galleries[i].location.coordinates[0]])
  262. .addTo(map)
  263. .setPopup(popup);
  264. for(let j = 0; j < galleries[i].tags.length; j++){
  265. if(tags.includes(galleries[i].tags[j]) === true) continue;
  266. tags.push(galleries[i].tags[j]);
  267. let tag = document.createElement("button");
  268. tag.innerText = galleries[i].tags[j];
  269. tag.classList.add("tag");
  270. tagContainer.appendChild(tag);
  271. }
  272. }
  273. }
  274. //Get "learn" content
  275. fetch("/learn/courses/json")
  276. .then(response => response.json())
  277. .then((response)=>{
  278. let container = document.getElementById("learn");
  279. for(let i = 0; i < response.length; i++){
  280. let card = document.createElement("a");
  281. card.classList.add("card");
  282. card.href = `/learn/courses/${response[i]._id}`;
  283. container.appendChild(card);
  284. let h2 = document.createElement("h2");
  285. h2.innerText = response[i].title;
  286. card.appendChild(h2);
  287. let img = document.createElement("img");
  288. img.src = response[i].thumbNail;
  289. img.alt = `${response[i].title} thumbnail`;
  290. card.appendChild(img);
  291. }
  292. })
  293. .catch((err)=>{});
  294. //Get currency data
  295. let displayImage = (image, cType)=>{
  296. let div = document.createElement("div");
  297. div.classList.add("fullImageBackground");
  298. div.onclick = ()=>{document.body.removeChild(div)};
  299. document.body.appendChild(div);
  300. image.className = "";
  301. image.style.margin = "auto";
  302. if(cType === "paper"){
  303. image.style.height = "";
  304. image.style.width = "100%";
  305. }else{
  306. image.style.width = "";
  307. image.style.height = "100%";
  308. }
  309. div.appendChild(image);
  310. }
  311. let imageSize = (image)=>{
  312. let width = `${image.clientWidth * 0.35}px`;
  313. image.style.height = `${image.clientHeight * 0.35}px`;
  314. image.style.width = width;
  315. }
  316. let filterLocations = (location, currencies)=>{
  317. let container = document.getElementById("currencyContainer");
  318. let template = document.getElementById("currencyTemplate").content.children[0];
  319. while(container.children.length > 0){
  320. container.removeChild(container.firstChild);
  321. }
  322. for(let i = 0; i < currencies.length; i++){
  323. if(currencies[i].location.toLowerCase() === location){
  324. let currency = template.cloneNode(true);
  325. let frontImage = currency.querySelector(".frontImage");
  326. let backImage = currency.querySelector(".backImage");
  327. let code = currencies[i].currencyCode;
  328. currency.querySelector(".location").innerText = `${currencies[i].location.toUpperCase()} (${currencies[i].name})`;
  329. currency.querySelector(".info").innerText = `${currencies[i].value} ${code ? code : ""}`;
  330. frontImage.src = currencies[i].frontImage;
  331. frontImage.onload = ()=>{imageSize(frontImage)};
  332. frontImage.onclick = ()=>{displayImage(frontImage.cloneNode(true), currencies[i].type)};
  333. backImage.src = currencies[i].backImage;
  334. backImage.onload = ()=>{imageSize(backImage)};
  335. backImage.onclick = ()=>{displayImage(backImage.cloneNode(true), currencies[i].type)};
  336. currency.querySelector(".comment").innerText = currencies[i].comment;
  337. container.appendChild(currency);
  338. }
  339. }
  340. }
  341. fetch("/currency/data")
  342. .then(r=>r.json())
  343. .then((response)=>{
  344. let locationsContainer = document.getElementById("locations");
  345. let locations = [];
  346. for(let i = 0; i < response.length; i++){
  347. if(!locations.includes(response[i].location.toLowerCase())){
  348. locations.push(response[i].location.toLowerCase());
  349. let button = document.createElement("button");
  350. button.classList.add("locationBtn");
  351. button.innerText = response[i].location.toUpperCase();
  352. button.onclick = ()=>{
  353. let btnLocations = document.querySelectorAll(".locationBtn");
  354. for(let j = 0; j < btnLocations.length; j++){
  355. btnLocations[j].classList.remove("curSelected");
  356. }
  357. button.classList.add("curSelected");
  358. filterLocations(response[i].location.toLowerCase(), response);
  359. }
  360. locationsContainer.appendChild(button);
  361. }
  362. }
  363. })
  364. .catch((err)=>{});
  365. </script>
  366. </body>
  367. </html>