Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Online CSS Editor

/*
First version:
    I'll have a word. That word will not be immediately displayed on the page
    With a click the word will appear. With another click the word will hide

//var words = ["One", "Two", "Three", "Four", "Five"];

/* var signs;

  $(document).ready(function() {

    var options = {
      "url": "https://portal.oldnational.com/divisions/it/marioSite/_api/web/lists/getbytitle('signsLearned')/items?$top=500",
      "method": "GET",
      "headers": {
        "Accept": "application/json; odata=verbose"
      }
    }

    $.ajax(options).done(function(response) {
      console.log(response);
      console.log(response.d.results);
      signs = response.d.results;
    });

  });
//////////////// SharePoint version//////////////
function nextWord() {
  document.getElementById("showWord").innerHTML = signs[i].Title;
  if (i < signs.length - 1) {
    i++;
  } else {
    i = 0;
  }
}
*/
//////////////////Local version//////////////////
var words = [
  "Name",
  "I (self)",
  "You",
  "We",
  "Us",
  "Our",
  "girl",
  "boy",
  "daughter",
  "son",
  "Woman",
  "Man",
  "Wife",
  "Husband",
  "Marriage",
  "Baby",
  "Mom",
  "Dad",
  "Parents",
  "Grandma",
  "Grandpa",
  "Aunt",
  "Uncle",
  "Family",
  "team",
  "Home",
  "House",
  "fire",
  "Outside",
  "Inside",
  "up",
  "down",
  "Rain",
  "Sunshine",
  "wet",
  "dry",
  "time",
  "temperature",
  "hot",
  "Cold",
  "cool (temperature)",
  "warm (temperature)",
  "Sunday",
  "Monday",
  "Tuesday",
  "Wednesday",
  "Thursday",
  "Friday",
  "Saturday",
  "Morning",
  "This morning",
  "Night",
  "Tonight",
  "Last Night",
  "Yesterday",
  "Yes. Morning",
  "Today",
  "tomorrow",
  "Day",
  "Week",
  "Weekend",
  "Month",
  "Year",
  "future / would",
  "always",
  "forever",
  "never",
  "past",
  "Far",
  "Near",
  "yes",
  "no",
  "can / could",
  "can't",
  "from",
  "need / should",
  "want",
  "take",
  "put",
  "get",
  "have",
  "make",
  "some",
  "a lot",
  "a little",
  "all",
  "full (limit)",
  "nothing",
  "Everything",
  "mistake",
  "hard / difficult",
  "easy",
  "practice",
  "more",
  "slow",
  "fast",
  "stop",
  "but",
  "so",
  "and",
  "to",
  "for",
  "like",
  "don't",
  "Good",
  "Bad",
  "Very",
  "gross",
  "sloppy",
  "confusing",
  "super / awesome",
  "again",
  "same",
  "Switch",
  "Other",
  "Still",
  "Color",
  "red",
  "orange",
  "yellow",
  "green",
  "blue",
  "purple",
  "black",
  "live",
  "America",
  "American",
  "France",
  "English",
  "Mexico",
  "share",
  "it",
  "with",
  "What's up?",
  "help",
  "Please",
  "Thank You",
  "who",
  "what",
  "when",
  "where",
  "Why",
  "How",
  "Feel",
  "love",
  "Tired",
  "Mad / Angry",
  "Happy",
  "Sad",
  "Surprise",
  "Sick",
  "Cold (sick)",
  "Sneeze",
  "Annoying",
  "Mean (not nice)",
  "hurt",
  "Understand",
  "Complain",
  "Explain",
  "Enjoy",
  "Fun",
  "Try",
  "Idea",
  "touch",
  "Walk",
  "Run",
  "fall (down)",
  "dance",
  "swim",
  "scuba",
  "paint",
  "pee",
  "poop",
  "say",
  "conversation",
  "talk",
  "draw (art)",
  "Design",
  "learn",
  "learning",
  "Student",
  "read",
  "study",
  "spell",
  "know",
  "don't know",
  "Forget",
  "see",
  "work",
  "alphabet",
  "cool (neat)",
  "photography",
  "typing",
  "score (a point)",
  "point (action)",
  "invent (make up)",
  "make-up (face)",
  "Sign (language)",
  "Words",
  "Progress",
  "Report",
  "list",
  "Ordinals",
  "Paper",
  "Staple",
  "Table",
  "Tree",
  "Gym",
  "Chair",
  "Computer",
  "Lazy",
  "Sleep",
  "Motorcycle",
  "street",
  "car",
  "book",
  "fish",
  "video game",
  "Pencil",
  "Phone",
  "angle",
  "spider",
  "shop",
  "ghost",
  "mermaid",
  "Web",
  "Eat",
  "Drink",
  "Coffee",
  "Wine",
  "Water",
  "chocolate",
  "ice cream",
  "Pizza",
  "banana",
  "sandwich",
  "chicken",
  "salad",
  "candy",
  "apple",
  "popcorn",
  "Dessert",
  "Sweet",
  "Cupcake",
  "cookie",
  "fruit",
  "vegetable",
  "strawberry",
  "meat",
  "juice",
  "snack",
  "bacon",
  "egg",
  "pancake",
  "lunch",
  "breakfast",
  "dinner",
  "syrup",
  "toast",
  "bread",
  "wheat",
  "cereal",
  "soup",
  "Cup",
  "full (stomach)",
  "hungry",
  "Go",
  "Scare / Scary",
  "Monster",
  "Fine",
  "Print",
  "Flower",
  "Rose",
  "Restaurant",
  "favorite",
  "yet",
  "grow up",
  "on",
  "off",
  "turn",
  "video",
  "hate",
  "new",
  "old",
  "young",
  "people",
  "better",
  "worse",
  "above",
  "below",
  "before",
  "after",
  "later",
  "earlier",
  "video",
  "movie",
  "story",
  "sleep",
  "wake",
  "ask",
  "question",
  "answer",
  "black",
  "white",
  "boring",
  "interesting",
  "funny",
  "fun",
  "laugh",
  "cry",
  "something",
  "almost",
  "yet",
  "sometimes",
  "Win",
  "Winner",
  "Loser",
  "hate",
  "less",
  "pop",
  "that",
  "this",
  "Haircut",
  "build",
  "Laptop",
  "weird",
  "trouble",
  "Headache",
  "glove",
  "order",
  "laugh",
  "strong",
  "weak",
  "glove",
  "order",
  "do",
  "peek"
];
words.sort(function(a, b) {
  return 0.5 - Math.random();
});





var i = undefined;


// This is where Dalon's code starts
    
// Here we create a class called Card, Card contains Card Word and Card Number along with future functions that I will add

let Card =  class{
  constructor(CWord, CNumb){
    this.CWord = CWord;
  this.CNumb = CNumb;
  }
};

// Here we create empty arrays Deck and DeckHolder, Deck holds all the card objects we create and Deck holder is made
// to hold and sort all the decks we create

var Deck = [];
var DeckHolder = [];

// This function does a lot, First it makes sure that the Deck object is empty every time it is called(pretty much clearing it)
// , Then it makes a new variable that is just a copy of words, Then it sorts that variable. Then it runs a foreach
// Which I will change to a for soon, that pushes every string in the array and converts them to a Card object using
// The string as the CardWord and the array index as the CardNumber, Then every time a card is created it pushes that 
// card into the Deck array. Then when all the words in Containr are converted and placed into the Deck Array
// the Deck is then placed into the DeckHolder array

function MakeDeck() {
  Deck = [];
  var Containr = words;
  Containr.sort(function(a,b){
    return a - b;
  });
  Containr.forEach( function(value, i)  {
    
    var Filler = new Card(value, i);
    console.log(Filler.CWord, Filler.CNumb);
    Deck.push(Filler);
    
    
  });
  DeckHolder.push(Deck);

}

// Here I am just testing to make sure that each deck is the same size and that each deck is properly pushed into the 
// DeckHolder Array, If I didnt make sure that Deck was empty on every call of the DeckMaker function, it would just 
// make an array of deck and deck would just be give 300+ cards over and over again

function PrintDeck(){
  console.log(DeckHolder, DeckHolder.length);
  DeckHolder.forEach(function(value){
    console.log(value[0].CWord, value[1].CWord, value[2].CWord);
  })
}

// Here we make a class called Update, we're gonna use this to update the cards instead of manually 
// typing out "update x card"

let Update = class{
  constructor(EleName, EleNum){
    this.EleName = EleName;
    this.EleNum = EleNum;
  }

  UpDisplay(UpInput) {
    document.getElementById(String(this.EleName)).innerHTML = UpInput;
  }
}
  let ElementList =  [
    new Update ("showWord0", 0),
    new Update ("showWord1", 1),
    new Update ("showWord2", 2),
    new Update ("showWord3", 3)
  ];

  let CurrentDeck;
  let CurrentDeckNum = 0;

  let CurrentCard = 0;

  function nextWord() {

    CurrentDeck = DeckHolder[CurrentDeckNum];
    if (i < CurrentDeck.length - 1 ){
      i++;
    }else{
      i = 0;
    }  
    if(CurrentCard < ElementList.length - 1){
      CurrentCard++;
    }else{
      CurrentCard = 0;
    }
    ElementList[CurrentCard].UpDisplay(CurrentDeck[i].CWord);
    console.log(ElementList.length, CurrentCard);
  }

  function CreateCards(){
    var type2 = document.createElement("div");
    var butn = document.createTextNode("Test Boy");
    type2.appendChild(butn);
    type2.setAttribute("id", ("Test" + ElementList.length));
    type2.setAttribute("class", "card");
    var elem = document.getElementById("cards");
    elem.appendChild(type2);
    ElementList.push(new Update(type2.id, (ElementList.length + 1)));
    console.log(ElementList);
  }

  function ChangeDeck(){
    CurrentDeckNum = Number(document.getElementById("NumVal").value);
    console.log(CurrentDeckNum, document.getElementById("NumVal").value);

    if(CurrentDeckNum > DeckHolder.length || CurrentDeckNum < 0){
      CurrentDeckNum = 0;
      document.getElementById("NumVal").value = CurrentDeckNum;
    }
    console.log(CurrentDeckNum);
    
  }
// function nextWord() {
//   if (i < words.length - 1) {
//     i++;
//   } else {
//     i = 0;
//   }
//   document.getElementById("showWord").innerHTML = words[i];
//   if (i < words.length - 1) {
//     i++;
//   } else {
//     i = 0;
//   }
//   document.getElementById("showWord1").innerHTML = words[i];
//   if (i < words.length - 1) {
//     i++;
//   } else {
//     i = 0;
//   }
//   document.getElementById("showWord2").innerHTML = words[i];
//   if (i < words.length - 1) {
//     i++;
//   } else {
//     i = 0;
//   }
//   document.getElementById("showWord3").innerHTML = words[i];
// }

// function LastWord() {
//   if (i >= 1 && i <= words.length - 1) {
//     i--;
//   } else {
//     i = words.length - 1;
//   }
//   document.getElementById("showWord").innerHTML = words[i];
//   if (i >= 1 && i <= words.length - 1) {
//     i--;
//   } else {
//     i = words.length - 1;
//   }
//   document.getElementById("showWord1").innerHTML = words[i];
//   if (i >= 1 && i <= words.length - 1) {
//     i--;
//   } else {
//     i = words.length - 1;
//   }
//   document.getElementById("showWord2").innerHTML = words[i];
//   if (i >= 1 && i <= words.length - 1) {
//     i--;
//   } else {
//     i = words.length - 1;
//   }
//   document.getElementById("showWord3").innerHTML = words[i];
// }

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.