Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function rabbitCommand (arguments, receivedMessage){
  2.  // LINE BREAKER HERE
  3.     const fetch = require("node-fetch");
  4.     const numItemsToGenerate = 1; //how many gallery items you want on the screen
  5.     const imageWidth = 480; //your desired image width in pixels
  6.     const imageHeight = 480; //desired image height in pixels
  7.     const collectionID = 1501883; //the collection ID from the original url
  8.     function renderGalleryItem(){
  9.         fetch(`https://source.unsplash.com/collection/${collectionID}/${imageWidth}x${imageHeight}/`).then((response)=> {
  10.             let galleryItem = document.createElement('div');
  11.             galleryItem.classList.add('gallery-item');
  12.             galleryItem.innerHTML = `
  13.       <img class="gallery-image" src="${response.url}" alt="gallery image"/>
  14.     `
  15.             document.body.appendChild(galleryItem);
  16.         })
  17.     }
  18.     for(let i=0;i<numItemsToGenerate;i++){
  19.         renderGalleryItem();
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement