This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const tableContainer = document.getElementById('tableContainer'); | |
let resultsTableBody = document.createElement('tbody'); | |
for (let i = 0; i < allBoxes.length; i++) { | |
let row = document.createElement('tr'); | |
for (let j = 0; j < 8; j++) { | |
let cell = document.createElement('td'); | |
let cellText = document.createTextNode(goalArray[i][j]); | |
cell.appendChild(cellText); | |
row.appendChild(cell); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const right = document.getElementById('buttonRight') | |
right.addEventListener('click', slideRight); | |
function slideRight() { | |
let myCurrent = document.getElementById(positionArray.indexOf(position) + 1); | |
myCurrent.classList.remove('current') | |
position += imageWidth; | |
position %= images * imageWidth; | |
gallery.querySelector('#gallery-inner').style.marginLeft = '-' + position + 'px'; | |
myCurrent = document.getElementById(positionArray.indexOf(position) + 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (let i = 0; i < placeLinks.length; i++) { | |
placeLinks[i].addEventListener('click', function (event) { | |
let li = document.createElement('li'); | |
li.innerHTML = event.target.innerHTML; | |
selectedOptions.appendChild(li); | |
}); | |
selectedOptions.style.left = `${search.getBoundingClientRect().left + 5}px`; | |
selectedOptions.style.top = `${search.getBoundingClientRect().bottom - 40 + this.pageYOffset}px`; | |
selectedOptions.style.width = `${search.getBoundingClientRect().width - 2}px`; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Promise.all([ | |
fetch('/api/movies', { | |
headers: new Headers({ | |
'ApiKey': 'USER_KEY_2', | |
}), | |
}), | |
fetch('/api/series', { | |
headers: new Headers({ | |
'ApiKey': 'USER_KEY_2', | |
}), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
updateExpiry = () => { | |
let today = new Date(); | |
const options = { day: 'numeric', month: 'long', year: 'numeric' }; | |
today.setDate(today.getDate() + this.state.daysLeft); | |
today = today.toLocaleDateString('en-GB', options); | |
this.setState({ expiry: today }); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getData(event) { | |
event.preventDefault(); | |
document.querySelector('.output').classList.add('visible'); | |
let createdDate; | |
let data = []; | |
const user = document.getElementById('username').value; | |
await fetch(`https://api.github.com/users/${user}`) | |
.then(response => response.json()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mainNav = document.querySelector('.main-nav'); | |
const menu = document.querySelector('#menu'); | |
toggleMenu = () => { | |
mainNav.classList.toggle('isDisplayed'); | |
if (menu.getAttribute('src') === './images/menu.svg') { | |
menu.setAttribute('src', './images/menu-purple.svg'); | |
} else { | |
menu.setAttribute('src', './images/menu.svg'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removeTags() { | |
const tags = document.querySelectorAll('.css-viz'); | |
tags.forEach((element) => { | |
element.parentNode.removeChild(element) | |
}); | |
const all = document.querySelectorAll('*'); | |
all.forEach((element, index) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sortLetters() { | |
this.dataService.contacts[0].forEach(contact => { | |
this.letters.push(contact.name.toUpperCase().slice(0, 1)); | |
}); | |
this.letters = this.letters.filter( (elem, index, self) => index === self.indexOf(elem)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const values = data.map(element => element[1]); | |
const scaleColors = getColor(); | |
let color = d3.scaleLinear() | |
.domain([d3.min(values), d3.max(values)]) | |
.range(scaleColors); |
OlderNewer