@@ -185,7 +185,7 @@ function fmtTags(cell: CellComponent) {
185185
186186function makePreviewImage ( brand : string ) {
187187 return function fmtPreviewImage ( cell : CellComponent ) {
188- const val = cell . getValue ( ) as string ;
188+ const val = cell . getRow ( ) . getData ( ) . codepoints as string ;
189189 if ( ! val ) {
190190 return "" ;
191191 }
@@ -206,6 +206,19 @@ function showError(msg: string) {
206206 document . getElementById ( "errmsg" ) ! . innerHTML = msg ;
207207}
208208
209+ function toggleColumns ( tbl : Tabulator , columns : string [ ] , visible : boolean ) : void {
210+ for ( const col of columns ) {
211+ const column = tbl . getColumn ( col ) ;
212+ if ( column ) {
213+ if ( visible ) {
214+ column . show ( ) ;
215+ } else {
216+ column . hide ( ) ;
217+ }
218+ }
219+ }
220+ }
221+
209222function toggleTagFilter ( cell : CellComponent , tag : string ) : void {
210223 const tbl = cell . getTable ( ) ;
211224 var headerFilter = "" ;
@@ -249,6 +262,7 @@ async function main() {
249262 let data : EmojiData [ ] = [ ] ;
250263 let emojiVersion = 0.0 ;
251264 let emojiVersionStr = "" ;
265+ var detail = false ;
252266
253267 var rawData :any ;
254268 try {
@@ -307,6 +321,11 @@ async function main() {
307321 }
308322 if ( key == "dir" ) {
309323 initialSort [ 0 ] . dir = value == "desc" ? "desc" : "asc" ;
324+ continue ;
325+ }
326+ if ( key == "detail" ) {
327+ detail = value == "1" || value . toLowerCase ( ) == "true" ;
328+ continue ;
310329 }
311330 if ( key && value ) {
312331 filters . push ( { field : key , type : "=" , value : value } ) ;
@@ -372,36 +391,42 @@ async function main() {
372391 width : 150 ,
373392 } ,
374393 {
375- cssClass : "pt-2 flex justify-content-center align-items-center" ,
376- field : "codepoints" ,
394+ cssClass :
395+ "pt-2 pb-0 flex justify-content-center align-items-center" ,
396+ field : "apple" ,
377397 formatter : makePreviewImage ( "apple" ) ,
378398 headerHozAlign : "center" ,
379399 headerSort : false ,
380400 hozAlign : "center" ,
381401 responsive : 100 ,
382402 title : `<img src="https://www.vectorlogo.zone/logos/apple/apple-icon.svg" style="height:2rem;" />` ,
403+ visible : detail ,
383404 width : 75 ,
384405 } ,
385406 {
386- cssClass : "pt-2 flex justify-content-center align-items-center" ,
387- field : "codepoints" ,
407+ cssClass :
408+ "pt-2 pb-0 flex justify-content-center align-items-center" ,
409+ field : "google" ,
388410 formatter : makePreviewImage ( "google" ) ,
389411 headerHozAlign : "center" ,
390412 headerSort : false ,
391413 hozAlign : "center" ,
392414 responsive : 100 ,
393415 title : `<img src="https://www.vectorlogo.zone/logos/android/android-icon.svg" style="height:2rem;" />` ,
416+ visible : detail ,
394417 width : 75 ,
395418 } ,
396419 {
397- cssClass : "pt-2 flex justify-content-center align-items-center" ,
398- field : "codepoints" ,
420+ cssClass :
421+ "pt-2 pb-0 flex justify-content-center align-items-center" ,
422+ field : "microsoft" ,
399423 formatter : makePreviewImage ( "microsoft" ) ,
400424 headerHozAlign : "center" ,
401425 headerSort : false ,
402426 hozAlign : "center" ,
403427 responsive : 100 ,
404428 title : `<img src="https://www.vectorlogo.zone/logos/microsoft/microsoft-icon.svg" style="height:2rem;" />` ,
429+ visible : detail ,
405430 width : 75 ,
406431 } ,
407432 {
@@ -465,6 +490,9 @@ async function main() {
465490 footerElement : `<span class="w-100 mx-2 my-1">
466491 <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>
467492 <span id="rowcount" class="px-3">Emoji: ${ data . length . toLocaleString ( ) } </span>
493+ <input id="showhidecolumns" type="checkbox" class="mx-2" title="Toggle image columns" ${
494+ detail ? "checked" : ""
495+ } /> Images
468496 <a class="d-none d-lg-block float-end" href="https://github.com/FileFormatInfo/emojisearch">Source</a>
469497 </span>` ,
470498 } ) ;
@@ -498,6 +526,21 @@ async function main() {
498526 table . alert ( `Emoji v${ emojiVersionStr } (built on ${ statusData . lastmod } - ${ statusData . commit } )` ) ;
499527 setTimeout ( ( ) => table . clearAlert ( ) , 2500 ) ;
500528 }
529+ document . getElementById ( "showhidecolumns" ) ! . onclick = ( ) => {
530+ detail = ! detail ;
531+ toggleColumns ( table , [
532+ "apple" ,
533+ "google" ,
534+ "microsoft" ,
535+ ] , detail ) ;
536+ const qs = new URLSearchParams ( window . location . search ) ;
537+ if ( detail ) {
538+ qs . set ( "detail" , "1" ) ;
539+ } else {
540+ qs . delete ( "detail" ) ;
541+ }
542+ window . history . replaceState ( null , "" , "?" + qs . toString ( ) ) ;
543+ }
501544 } ) ;
502545
503546 document . getElementById ( "loading" ) ! . classList . add ( "d-none" ) ;
0 commit comments