src/lib/demo.js
function(num) {
    if(loading) {
      // Avoid sending too many requests to get new cells.
      return;
    }
    var fragment = document.createDocumentFragment();
    var cells = [];
    var images = [0, 286, 143, 270, 143, 190, 285, 152, 275, 285, 285, 128, 281, 242, 339, 236, 157, 286, 259, 267, 137, 253, 127, 190, 190, 225, 269, 264, 272, 126, 265, 287, 269, 125, 285, 190, 314, 141, 119, 274, 274, 285, 126, 279, 143, 266, 279, 600, 276, 285, 182, 143, 287, 126, 190, 285, 143, 241, 166, 240, 190];
    for(var j = 0; j < num; j++) {
      var key = Math.floor(Math.random() * 60) + 1;
      var cell = document.createElement('div');
      cell.className = 'cell pending';
      cell.tagLine = 'demo picture ' + key;
      cells.push(cell);
      front(cellTemplate, { 'title': 'demo picture ' + key, 'src': key, 'height': images[key], 'width': 190 }, cell);
      fragment.appendChild(cell);
    }
    // Faking network latency.
    setTimeout(function() {
      loading = false;
      cellsContainer.appendChild(fragment);
      adjustCells(cells);
    }, 2000);
  }
function(num) {
    if(loading) {
      // Avoid sending too many requests to get new cells.
      return;
    }
    var fragment = document.createDocumentFragment();
    var cells = [];
    var images = [0, 286, 143, 270, 143, 190, 285, 152, 275, 285, 285, 128, 281, 242, 339, 236, 157, 286, 259, 267, 137, 253, 127, 190, 190, 225, 269, 264, 272, 126, 265, 287, 269, 125, 285, 190, 314, 141, 119, 274, 274, 285, 126, 279, 143, 266, 279, 600, 276, 285, 182, 143, 287, 126, 190, 285, 143, 241, 166, 240, 190];
    for(var j = 0; j < num; j++) {
      var key = Math.floor(Math.random() * 60) + 1;
      var cell = document.createElement('div');
      cell.className = 'cell pending';
      cell.tagLine = 'demo picture ' + key;
      cells.push(cell);
      front(cellTemplate, { 'title': 'demo picture ' + key, 'src': key, 'height': images[key], 'width': 190 }, cell);
      fragment.appendChild(cell);
    }
    // Faking network latency.
    setTimeout(function() {
      loading = false;
      cellsContainer.appendChild(fragment);
      adjustCells(cells);
    }, 2000);
  }
function ( num ) { if ( loading ) { // Avoid sending too many requests to get new cells. return ; } var fragment = document . createDocumentFragment ( ) ; var cells = [ ] ; var images = [ 0 , 286 , 143 , 270 , 143 , 190 , 285 , 152 , 275 , 285 , 285 , 128 , 281 , 242 , 339 , 236 , 157 , 286 , 259 , 267 , 137 , 253 , 127 , 190 , 190 , 225 , 269 , 264 , 272 , 126 , 265 , 287 , 269 , 125 , 285 , 190 , 314 , 141 , 119 , 274 , 274 , 285 , 126 , 279 , 143 , 266 , 279 , 600 , 276 , 285 , 182 , 143 , 287 , 126 , 190 , 285 , 143 , 241 , 166 , 240 , 190 ] ; for ( var j = 0 ; j < num ; j ++ ) { var key = Math . floor ( Math . random ( ) * 60 ) + 1 ; var cell = document . createElement ( 'div' ) ; cell . className = 'cell pending' ; cell . tagLine = 'demo picture ' + key ; cells . push ( cell ) ; front ( cellTemplate , { 'title' : 'demo picture ' + key , 'src' : key , 'height' : images [ key ] , 'width' : 190 } , cell ) ; fragment . appendChild ( cell ) ; } // Faking network latency. setTimeout ( function ( ) { loading = false ; cellsContainer . appendChild ( fragment ) ; adjustCells ( cells ) ; } , 2000 ) ; }
Fake mode, only for GitHub demo. Delete this function in your project.
Fake mode only for GitHub demo . Delete this function in your project .