B2G/gaia/apps/camera/js/filmstrip.js
// to display the thumbnail and preview the image or video
to display the thumbnail and preview the image or video
to display the thumbnail and preview the image or video
function addItem(item) {
    items.unshift(item);
    item.element = new Image();
    item.element.src = URL.createObjectURL(item.thumbnail);
    item.element.classList.add('thumbnail');
    filmstrip.insertBefore(item.element, filmstrip.firstElementChild);
    if (items.length > MAX_THUMBNAILS) {
      var oldest = items.pop();
      filmstrip.removeChild(oldest.element);
      URL.revokeObjectURL(oldest.element.src);
    }
    items.forEach(function(item, index) {
      item.element.dataset.index = index;
    });
  }
function addItem ( item ) { items . unshift ( item ) ; item . element = new Image ( ) ; item . element . src = URL . createObjectURL ( item . thumbnail ) ; item . element . classList . add ( 'thumbnail' ) ; filmstrip . insertBefore ( item . element , filmstrip . firstElementChild ) ; if ( items . length > MAX_THUMBNAILS ) { var oldest = items . pop ( ) ; filmstrip . removeChild ( oldest . element ) ; URL . revokeObjectURL ( oldest . element . src ) ; } items . forEach ( function ( item , index ) { item . element . dataset . index = index ; } ) ; }
to display the thumbnail and preview the image or video
to display the thumbnail and preview the image or video
// Thumbnails go from most recent to least recent. // Create an image element for this new thumbnail and display it // If we have too many thumbnails now, remove the oldest one from // the array, and remove its element from the filmstrip and release // its blob url // Now update the index associated with each of the remaining elements // so that the click event handle knows which one it clicked on