Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
3 lines
No EOL
1.1 KiB
JavaScript
3 lines
No EOL
1.1 KiB
JavaScript
;'use strict';function ThumbnailItem(fileData){if(!fileData){throw new Error('fileData should not be null or undefined.');}
|
|
this.data=fileData;this.htmlNode=document.createElement('div');this.htmlNode.classList.add('thumbnail');this.htmlNode.setAttribute('role','button');this.htmlNode.setAttribute('tabindex',0);this.imgNode=document.createElement('img');this.imgNode.alt='';this.imgNode.classList.add('thumbnailImage');this.imgNode.dataset.filename=fileData.name;var url=URL.createObjectURL(fileData.metadata.thumbnail);this.imgNode.src=url;this.htmlNode.appendChild(this.imgNode);this.localize();}
|
|
ThumbnailItem.formatter=new Intl.DateTimeFormat(navigator.languages,{hour:'numeric',minute:'numeric',month:'long',day:'numeric',year:'numeric',});ThumbnailItem.resetFormatter=()=>{ThumbnailItem.formatter=new Intl.DateTimeFormat(navigator.languages,{hour:'numeric',minute:'numeric',month:'long',day:'numeric',year:'numeric',});};ThumbnailItem.prototype.localize=function(){var date=new Date(this.data.date);var descId=!this.data.metadata.video?'imageDated':'videoDated';document.l10n.setAttributes(this.imgNode,descId,{timeStamp:ThumbnailItem.formatter.format(date)});}; |