Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let AlbumScroller = (()=>{
  2.    
  3.     class AlbumScroller{
  4.         constructor(serviceUrl, containerElm){
  5.             this.InfiniteScroller = new InfiniteScroller(serviceUrl);
  6.             this.ContainerElm = containerElm;
  7.             this.OnFetch = function(r){
  8.                 for(let item of r.Items){
  9.                     let img = document.createElement("img");
  10.                     img.src = item.Url;
  11.                     img.alt = item.Description;
  12.                     img.dataset.name = item.Name;
  13.                     img.dataset.albumid = item.AlbumId;
  14.                     img.dataset.albumguid = item.AlbumGuid;
  15.                     img.dataset.date = item.Date;
  16.                     img.dataset.userid = item.UserId;
  17.                     img.dataset.username = item.Username;
  18.                     item.dataset.guid = item.Guid;
  19.                     img.dataset.guid = item.Guid;
  20.                     img.dataset.id = item.Id;
  21.                     containerElm.appendChild(img);
  22.                 }
  23.             }
  24.         }
  25.         Initialize(){
  26.             let scope = this;
  27.             this.InfiniteScroller.OnScroll = (r)=>{
  28.                 scope.OnFetch(r);
  29.             };
  30.             this.InfiniteScroller.Initialize();
  31.         }
  32.        
  33.     }
  34.    
  35.     return Album;
  36.    
  37. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement