Explorar el Código

Remove all of the code for the "travel" part of the site.

Lee Morgan hace 5 años
padre
commit
40f055f5a5
Se han modificado 5 ficheros con 1 adiciones y 225 borrados
  1. 0 46
      controllers/travel.js
  2. 0 7
      routes.js
  3. 1 0
      views/gallery/index.css
  4. 0 75
      views/travel/index.css
  5. 0 97
      views/travel/index.html

+ 0 - 46
controllers/travel.js

@@ -1,46 +0,0 @@
-const fs = require("fs");
-
-module.exports = {
-    listDirectories: function(req, res){
-        let traverse = (dir)=>{
-            let contents = fs.readdirSync(dir);
-
-            let array = [];
-            for(let i = 0; i < contents.length; i++){
-                let route = `${dir.substring(dir.indexOf("/content") + 8)}/${contents[i]}`;
-                if(contents[i].includes(".") === false){
-                    array.push({
-                        name: contents[i],
-                        route: route,
-                        contents: traverse(`${dir}/${contents[i]}`)
-                    });
-                }else{
-                    array.push({
-                        src: route
-                    });
-                }
-            }
-
-            return array;
-        }
-
-        return res.json(traverse(`${__dirname}/../content/travel`));
-    },
-
-    getImages: function(req, res){
-        let path = req.originalUrl
-            .split("/")
-            .slice(3)
-            .join("/");
-
-        let pictures = fs.readdirSync(`${__dirname}/../content/travel/${path}`);
-
-        let response = [];
-        
-        for(let i = 0; i < pictures.length; i++){
-            response.push(`/travel/${path}/${pictures[i]}`);
-        }
-
-        return res.json(response);
-    }
-}

+ 0 - 7
routes.js

@@ -1,5 +1,4 @@
 const writing = require("./controllers/writing.js");
-const travel = require("./controllers/travel.js");
 const gallery = require("./controllers/gallery.js");
 const learn = require("./controllers/learn.js");
 
@@ -36,12 +35,6 @@ module.exports = function(app){
     app.get("/birthdayparadox/style", (req, res)=>{res.sendFile(`${views}/birthdayParadox/index.css`)});
     app.get("/birthdayparadox/code", (req, res)=>{res.sendFile(`${views}/birthdayParadox/index.js`)});
 
-    //TRAVEL
-    app.get("/travel/style", (req, res)=>{res.sendFile(`${views}/travel/index.css`)});
-    app.get("/travel/directories", travel.listDirectories);
-    app.get("/travel/images/*", travel.getImages);
-    app.get("/travel/*", (req, res)=>res.sendFile(`${views}/travel/index.html`));
-
     //GALLERY
     app.get("/gallery/style", (req, res)=>{res.sendFile(`${views}/gallery/index.css`)});
     app.get("/gallery", (req, res)=>{res.sendFile(`${views}/gallery/galleries.html`)});

+ 1 - 0
views/gallery/index.css

@@ -19,6 +19,7 @@ h1{
     #tags *{
         display: flex;
         align-items: center;
+        justify-content: center;
         background: #152730;
         color: #5FECE0;
         border-radius: 20px;

+ 0 - 75
views/travel/index.css

@@ -1,75 +0,0 @@
-*{margin:0;padding:0;}
-
-body{
-    background: rgb(196, 198, 192);
-}
-
-h1{
-    margin: 25px 0;
-    text-align: center;
-    border-bottom: 2px solid black;
-}
-
-#images{
-    display: flex;
-    flex-wrap: wrap;
-    justify-content: space-around;
-    width: 100%;
-}
-
-    #images img{
-        max-height: 250px;
-        margin: 25px;
-        cursor: pointer;
-        box-shadow: 0 0 5px black;
-    }
-
-        #images img:hover{
-            box-shadow: 0 0 10px black;
-        }
-
-#fullPage{
-    position: fixed;
-    top: 0;
-    left: 0;
-    justify-content: center;
-    align-items: center;
-    height: 100vh;
-    width: 100vw;
-    background: rgba(0, 0, 0, 0.85);
-    z-index: 1;
-}
-
-    #fullPage img{
-        max-height: 90%;
-        max-width: 90%;
-        cursor: default;
-        box-shadow: none;
-    }
-
-    #fullPage svg{
-        position: absolute;
-        color: white;
-        cursor: pointer;
-        border-radius: 50%;
-        padding: 5px;
-        z-index: 2;
-    }
-
-        #fullPage svg:hover{
-            background: white;
-            color: black;
-        }
-
-    #closeImg{
-        top: 25px;
-        right: 25px;
-    }
-
-    #nextImg{
-        right: 50px;
-    }
-
-    #previousImg{
-        left: 50px;
-    }

+ 0 - 97
views/travel/index.html

@@ -1,97 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-    <head>
-        <meta charset="utf-8">
-        <title>Lee Morgan</title>
-        <link rel="stylesheet" href="/travel/style">
-    </head>
-    <body>
-        <h1 id="title"></h1>
-
-        <div id="images"></div>
-
-        <div id="fullPage" style="display:none">
-            <svg id="closeImg" width="50" height="50" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
-                <line x1="18" y1="6" x2="6" y2="18"></line>
-                <line x1="6" y1="6" x2="18" y2="18"></line>
-            </svg>
-
-            <svg id="nextImg" width="50" height="50" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
-                <line x1="5" y1="12" x2="19" y2="12"></line>
-                <polyline points="12 5 19 12 12 19"></polyline>
-            </svg>
-
-            <svg id="previousImg" width="50" height="50" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
-                <line x1="19" y1="12" x2="5" y2="12"></line>
-                <polyline points="12 19 5 12 12 5"></polyline>
-            </svg>
-        </div>
-
-        <script>
-            let fullPage = document.getElementById("fullPage");
-            let container = document.getElementById("images");
-            let path = window.location.pathname
-                .split("/")
-                .slice(2)
-                .join("/");
-            window.imageIndex = 0;
-
-            fetch(`/travel/images/${path}`)
-                .then(response => response.json())
-                .then((response)=>{
-                    for(let i = 0; i < response.length; i++){
-                        let img = document.createElement("img");
-                        img.src = response[i];
-                        img.alt = "A picture";
-                        img.onclick = ()=>{
-                            imageIndex = i;
-
-                            let newImg = img.cloneNode(true);
-                            fullPage.appendChild(newImg);
-                            fullPage.style.display = "flex";
-                            newImg.onclick = ()=>{event.stopPropagation()}
-                        };
-                        container.appendChild(img);
-                    }
-                })
-                .catch(err => {});
-
-            let newPath = path.split("/");
-            let title = "";
-
-            for(let i = newPath.length - 1; i >= 0; i--){
-                if(newPath[i] === "") continue;
-                title += `${newPath[i].replaceAll("-", " ")}, `;
-            }
-
-            document.getElementById("title").innerText = title.substring(0, title.length-2);
-
-            document.getElementById("fullPage").onclick = ()=>{
-                fullPage.removeChild(document.querySelector("#fullPage img"));
-                fullPage.style.display = "none";
-            };
-
-            document.getElementById("nextImg").onclick = ()=>{
-                event.stopPropagation();
-                if(imageIndex >= container.children.length - 1) return;
-                imageIndex++;
-                let newImg = container.children[imageIndex].cloneNode(true);
-                newImg.onclick = ()=>{event.stopPropagation()};
-
-                fullPage.removeChild(document.querySelector("#fullPage img"));
-                fullPage.appendChild(newImg);
-            }
-
-            document.getElementById("previousImg").onclick = ()=>{
-                event.stopPropagation();
-                if(imageIndex <= 0) return;
-                imageIndex--;
-                let newImg = container.children[imageIndex].cloneNode(true);
-                newImg.onclick = ()=>{event.stopPropagation()};
-
-                fullPage.removeChild(document.querySelector("#fullPage img"));
-                fullPage.appendChild(newImg);
-            }
-        </script>
-    </body>
-</html>