@@ -183,6 +183,21 @@ function fmtTags(cell: CellComponent) {
183183 return container ;
184184}
185185
186+ function makePreviewImage ( brand : string ) {
187+ return function fmtPreviewImage ( cell : CellComponent ) {
188+ const val = cell . getValue ( ) as string ;
189+ if ( ! val ) {
190+ return "" ;
191+ }
192+ const codepoints = val
193+ . split ( " " )
194+ . map ( ( cp ) => cp . toLowerCase ( ) )
195+ . join ( "-" ) ;
196+ const url = `https://images.emojisearch.org/${ brand } /${ codepoints } .png` ;
197+
198+ return `<img src="${ url } " alt="${ brand } version" title="${ brand } version" onerror="this.src='/images/broken.svg';this.alt=this.title='not supported by ${ brand } yet';" style="height:2rem;">` ;
199+ }
200+ }
186201
187202function showError ( msg : string ) {
188203 console . log ( `ERROR: ${ msg } ` ) ;
@@ -356,6 +371,39 @@ async function main() {
356371 title : "Emoji" ,
357372 width : 150 ,
358373 } ,
374+ {
375+ cssClass : "pt-2 flex justify-content-center align-items-center" ,
376+ field : "codepoints" ,
377+ formatter : makePreviewImage ( "apple" ) ,
378+ headerHozAlign : "center" ,
379+ headerSort : false ,
380+ hozAlign : "center" ,
381+ responsive : 100 ,
382+ title : `<img src="https://www.vectorlogo.zone/logos/apple/apple-icon.svg" style="height:2rem;" />` ,
383+ width : 75 ,
384+ } ,
385+ {
386+ cssClass : "pt-2 flex justify-content-center align-items-center" ,
387+ field : "codepoints" ,
388+ formatter : makePreviewImage ( "google" ) ,
389+ headerHozAlign : "center" ,
390+ headerSort : false ,
391+ hozAlign : "center" ,
392+ responsive : 100 ,
393+ title : `<img src="https://www.vectorlogo.zone/logos/android/android-icon.svg" style="height:2rem;" />` ,
394+ width : 75 ,
395+ } ,
396+ {
397+ cssClass : "pt-2 flex justify-content-center align-items-center" ,
398+ field : "codepoints" ,
399+ formatter : makePreviewImage ( "microsoft" ) ,
400+ headerHozAlign : "center" ,
401+ headerSort : false ,
402+ hozAlign : "center" ,
403+ responsive : 100 ,
404+ title : `<img src="https://www.vectorlogo.zone/logos/microsoft/microsoft-icon.svg" style="height:2rem;" />` ,
405+ width : 75 ,
406+ } ,
359407 {
360408 field : "codepoints" ,
361409 formatter : fmtCodepoints ,
@@ -416,7 +464,7 @@ async function main() {
416464 responsiveLayout : "hide" ,
417465 footerElement : `<span class="w-100 mx-2 my-1">
418466 <img id="favicon" src="/favicon.svg" class="pe-2 mb-1" style="height:1.5em;" alt="EmojiSearch logo"/><span style="font-size: 1.2em;font-family: 'Emilys Candy'">EmojiSearch</span>
419- <span id="rowcount" class="px-3">Rows : ${ data . length . toLocaleString ( ) } </span>
467+ <span id="rowcount" class="px-3">Emoji : ${ data . length . toLocaleString ( ) } </span>
420468 <a class="d-none d-lg-block float-end" href="https://github.com/FileFormatInfo/emojisearch">Source</a>
421469 </span>` ,
422470 } ) ;
@@ -428,12 +476,12 @@ async function main() {
428476 qs . delete ( col . getField ( ) ) ;
429477 }
430478 if ( filters && filters . length > 0 ) {
431- el ! . innerHTML = `Rows : ${ rows . length . toLocaleString ( ) } of ${ data . length . toLocaleString ( ) } ` ;
479+ el ! . innerHTML = `Emoji : ${ rows . length . toLocaleString ( ) } of ${ data . length . toLocaleString ( ) } ` ;
432480 for ( const f of filters ) {
433481 qs . set ( f . field , f . value as string ) ;
434482 }
435483 } else {
436- el ! . innerHTML = `Rows : ${ data . length . toLocaleString ( ) } ` ;
484+ el ! . innerHTML = `Emoji : ${ data . length . toLocaleString ( ) } ` ;
437485 }
438486 window . history . replaceState ( null , "" , "?" + qs ) ;
439487 } ) ;
0 commit comments