/    Sign up×
Community /Pin to ProfileBookmark

I need help turning this client side script into pseudocode

[code]var slideIndex,slides,dots,captionText;
function initGallery(){
slideIndex = 0;
slides=document.getElementsByClassName(“imageHolder”);
slides[slideIndex].style.opacity=1;
captionText=document.querySelector(“.captionTextHolder .captionText”);
captionText.innerText=slides[slideIndex].querySelector(“.captionText”).innerText;
if(slides.length<2){
var nextPrevBtns=document.querySelector(“.leftArrow,.rightArrow”);
nextPrevBtns.style.display=”none”;
for (i = 0; i < nextPrevBtn.length; i++) {
nextPrevBtn.style.display=”none”;
}
}
dots=[];
var dotsContainer=document.getElementById(“dotsContainer”),i;
for (i = 0; i < slides.length; i++) {
var dot=document.createElement(“span”);
dot.classList.add(“dots”);
dotsContainer.append(dot);
dot.setAttribute(“onclick”,”moveSlide(“+i+”)”);
dots.push(dot);
}
dots[slideIndex].classList.add(“active”);
}
initGallery();
function plusSlides(n) {
moveSlide(slideIndex+n);
}
function moveSlide(n){
var i;
var current,next;
var moveSlideAnimClass={
forCurrent:””,
forNext:””
};
var slideTextAnimClass;
if(n>slideIndex) {
if(n >= slides.length){n=0;}
moveSlideAnimClass.forCurrent=”moveLeftCurrentSlide”;
moveSlideAnimClass.forNext=”moveLeftNextSlide”;
slideTextAnimClass=”slideTextFromTop”;
}else if(n<slideIndex){
if(n<0){n=slides.length-1;}
moveSlideAnimClass.forCurrent=”moveRightCurrentSlide”;
moveSlideAnimClass.forNext=”moveRightPrevSlide”;
slideTextAnimClass=”slideTextFromBottom”;
}

if(n!=slideIndex){
next = slides[n];
current=slides[slideIndex];
for (i = 0; i < slides.length; i++) {
slides[i].className = “imageHolder”;
slides[i].style.opacity=0;
dots[i].classList.remove(“active”);
}
current.classList.add(moveSlideAnimClass.forCurrent);
next.classList.add(moveSlideAnimClass.forNext);
dots[n].classList.add(“active”);
slideIndex=n;
captionText.style.display=”none”;
captionText.className=”captionText “+slideTextAnimClass;
captionText.innerText=slides[n].querySelector(“.captionText”).innerText;
captionText.style.display=”block”;
}
}
var timer=null;
function setTimer(){
timer=setInterval(function () {
plusSlides(1) ;
},3000);
}
setTimer();
function playPauseSlides() {
var playPauseBtn=document.getElementById(“playPause”);
if(timer==null){
setTimer();
playPauseBtn.style.backgroundPositionY=”0px”
}else{
clearInterval(timer);
timer=null;
playPauseBtn.style.backgroundPositionY=”-33px”
}
}[/code]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumDec 08.2020 — 
  • 1. Please open only one thread for the same subject.

  • 2. Please use code tags: `your code here` or triple backtics when posting code.

    I edited your posting accordingly.
  • ×

    Success!

    Help @VinceL spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...