]> OzVa Git service - chester/commitdiff
Implemented aggregating slideshow with includeOnly
authorMax Value <greenwoodw50@gmail.com>
Mon, 23 Mar 2026 17:45:05 +0000 (17:45 +0000)
committerMax Value <greenwoodw50@gmail.com>
Mon, 23 Mar 2026 17:45:05 +0000 (17:45 +0000)
+ fixed future issue with multiple slideshows on one page

personal/riders/index.html
script.js
slideshow.js
style.css

index 92acbbcf6af2b75da210ecdf2ec91dea3b44ea4f..3babb6d31de0d852312ebaf73c36263a4b4526e3 100644 (file)
@@ -55,6 +55,7 @@
 
 <div class="blockquoteImage reversed">
        <img
+               class="include"
                srcset="/media/photos_960/cristian.jpg,
                        /media/photos_1920/cristian.jpg x2,
                        /media/photos_3840/cristian.jpg x4"
@@ -90,6 +91,7 @@
                <b>Anonymous 2</b><br>
                        "Now I'm living here for like three years, I want to- I don't know. I want to see, because I'm confused. Before it was good, but now I'm confused."
        </blockquote><img
+               class="include"
                srcset="/media/photos_960/anonymous2.jpg,
                        /media/photos_1920/anonymous2.jpg x2,
                        /media/photos_3840/anonymous2.jpg x4"
        Many of the Riders I spoke to, or who saw me speaking to others and taking their photos, were suspicious that I might be working with the police or with their companies. Having explained the project to them, many didn't want to show their faces or be seen to be involved in what I was trying to do. I learnt from some Riders that this was probably because lots of people work on fake or shared work permits. The reason for this is that so many migrants that come into the UK are unable to obtain legitimate work permits from the government, forcing them to go down illegitimate routes. I spoke to one Rider who expanded on this, referring to a "mafia" from which Riders can buy fake work permits and other papers they might need. With no other options, people are forced into shady deals, paying fees of well over a few hundred pounds to get everything they need to appear as though they are working lawfully.
 </p>
 
-<div class="slideshow">
-       <img
-               srcset="/media/photos_960/anonymous3.jpg,
-                       /media/photos_1920/anonymous3.jpg x2,
-                       /media/photos_3840/anonymous3.jpg x4"
-               src="/media/photos_3840/anonymous3.jpg">
-       <img
-               srcset="/media/photos_960/ataklti.jpg,
-                       /media/photos_1920/ataklti.jpg x2,
-                       /media/photos_3840/ataklti.jpg x4"
-               src="/media/photos_3840/ataklti.jpg">
-       <img
-               srcset="/media/photos_960/anonymous1.jpg,
-                       /media/photos_1920/anonymous1.jpg x2,
-                       /media/photos_3840/anonymous1.jpg x4"
-               src="/media/photos_3840/anonymous1.jpg">
-       <p class="prev">
-               <span><span class="arrow">&#x25c4;</span> <span class="fadeOut">Prev.</span><span>
-       </p><p class="next">
-               <span><span class="fadeOut">Next</span> <span class="arrow">&#x25ba;</span><span>
-       </p>
-</div>
+
+<div class="slideshow aggregating"></div>
 
 <p>
        False permits are not the only cause for suspicion and unease. Riders are also constantly facing trouble from the police, with bike seizures being a regular occurrence. Some electric bikes are rented out from legitimate companies. Some, however, are homemade, taped and strapped together with duct tape and bungee cord, built with batteries and motors salvaged or ordered online, some of which happen to be illegal in the UK. Lots of riders told me about the enormous setbacks that police seizures cause, with bikes costing up to a thousand pounds, if not more. Not only could that be months worth of wages gone with no reprieve, it also forces Riders to stop working for however long it takes them to get back up and running again.
index daa02830c895928f2b916052193056dd0f815784..6db60fa3974d6ac062ef80030801fa2de3ed06cb 100644 (file)
--- a/script.js
+++ b/script.js
@@ -151,13 +151,13 @@ function setup () {
        <ul>
                <li>Removed "Overview" page from the nav menu, now accessed by clicking your name as is common with many sites. Page is now effectively the homepage</li>
                <li>Actual defocus on the background elements when in focus mode</li>
+
+               <li>Added education heading to CV, can remove if you want.</li>
        </ul>
        !-->
 </details>`;
 
        main.parentNode.insertBefore(template.content.childNodes[0], main);
-       console.log();
-
 }
 
 setup();
index 23835166394e38c39710f8b02a781a478ec9b535..6aa88bfd9b26e1878857e0da12d140682eeba1ed 100644 (file)
@@ -6,42 +6,78 @@ function setupSlideshow () {
        slideshows = document.getElementsByClassName("slideshow");
        let s = 0;
        for (slideshow of slideshows) {
+               slideshow.dataset.slideCount = 1;
+               slideshow.dataset.slideCurrent = 0;
+
                let i = 0;
-               for (child of slideshow.children) {
-                       if (child.tagName == "IMG") {
+               if (slideshow.classList.contains("aggregating")) {
+                       let selector = "img";
+                       if (slideshow.classList.contains("includeOnly")) {
+                               selector = "img.include";
+                       }
+
+                       for (image of document.querySelectorAll(selector)) {
+                               const slide = image.cloneNode(false);
+                               slide.style.display = "none";
+                               slide.id = `show${s}slide${i}`;
+
+                               slideshow.appendChild(slide);
+
+                               i++;
+                       }
+               } else {
+                       for (child of slideshow.children) {
                                child.style.display = "none";
                                child.id = `show${s}slide${i}`;
                                i++;
-                       } else if (child.classList.contains("next")) {
-                               var si = s;
-                               child.addEventListener("click", (e) => {
-                                       e.preventDefault();
-                                       document.getElementById(`show${si}slide${slideCurrent}`)
-                                       .style.display = "none";
-                                       slideCurrent ++;
-                                       if (slideCurrent >= slideCount) {
-                                               slideCurrent = 0;
-                                       }
-                                       document.getElementById(`show${si}slide${slideCurrent}`)
-                                       .style.display = "block";
-                               });
-                       } else {
-                               var si = s;
-                               child.addEventListener("click", (e) => {
-                                       e.preventDefault();
-                                       document.getElementById(`show${si}slide${slideCurrent}`)
-                                       .style.display = "none";
-                                       slideCurrent --;
-                                       if (slideCurrent < 0) {
-                                               slideCurrent = slideCount - 1;
-                                       }
-                                       document.getElementById(`show${si}slide${slideCurrent}`)
-                                       .style.display = "block";
-                               });
                        }
                }
-               slideCount = i;
+
+               slideshow.dataset.slideCount = i;
                slideshow.children[0].style.display = "block";
+
+               // add slideshow buttons
+               var si = s;
+
+               const prev = document.createElement("span");
+               prev.classList.add("prev");
+               prev.innerHTML = "Prev";
+               prev.addEventListener("click", (e) => {
+                       e.preventDefault();
+
+                       let slideCount = e.target.parentNode.dataset.slideCount;
+
+                       document.getElementById(`show${si}slide${e.target.parentNode.dataset.slideCurrent}`)
+                       .style.display = "none";
+                       e.target.parentNode.dataset.slideCurrent --;
+                       if (e.target.parentNode.dataset.slideCurrent < 0) {
+                               e.target.parentNode.dataset.slideCurrent = slideCount - 1;
+                       }
+                       document.getElementById(`show${si}slide${e.target.parentNode.dataset.slideCurrent}`)
+                       .style.display = "block";
+               });
+
+               const next = document.createElement("span");
+               next.classList.add("next");
+               next.innerHTML = "Next";
+               next.addEventListener("click", (e) => {
+                       e.preventDefault();
+
+                       let slideCount = e.target.parentNode.dataset.slideCount;
+
+                       document.getElementById(`show${si}slide${e.target.parentNode.dataset.slideCurrent}`)
+                       .style.display = "none";
+                       e.target.parentNode.dataset.slideCurrent ++;
+                       if (e.target.parentNode.dataset.slideCurrent >= slideCount) {
+                               e.target.parentNode.dataset.slideCurrent = 0;
+                       }
+                       document.getElementById(`show${si}slide${e.target.parentNode.dataset.slideCurrent}`)
+                       .style.display = "block";
+               });
+
+               slideshow.appendChild(prev);
+               slideshow.appendChild(next);
+
                s++;
        }
 }
index c4653cd86cb9004c6410fc243d68915ede068680..ecd40a718e76334d871e7bdc3213348d2cb19ceb 100644 (file)
--- a/style.css
+++ b/style.css
@@ -127,14 +127,14 @@ blockquote {
        width: calc(55vw - 25px);
 }
 .slideshow img { width: calc(55vw - 25px); }
-.slideshow p {
+.slideshow span {
        display: inline-block;
        width: 30%;
        padding: 0 10% 0 10%;
        color: var(--darkgray);
 }
-.slideshow p:hover { color: var(--mediumgray); }
-.slideshow span { cursor: pointer; }
+.slideshow span:hover { color: var(--mediumgray); }
+.slideshow span { cursor: pointer; }
 .next { text-align: right; }
 .prev { text-align: left; }
 .arrow {