From f412e9a957eddf0e27d3772b861edfc981558dcc Mon Sep 17 00:00:00 2001 From: mrdoob Date: Wed, 29 Jun 2022 14:00:22 +0900 Subject: [PATCH] Examples: Added external tag (#24281) * Examples: Added external tag. * Examples: Subtler external tag. * Removed unneeded style. --- examples/index.html | 25 +++++++++---------------- examples/tags.json | 3 ++- files/main.css | 10 ++++++++++ 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/examples/index.html b/examples/index.html index 6c1a11cdc57ab3..1658869da47ca9 100644 --- a/examples/index.html +++ b/examples/index.html @@ -77,18 +77,18 @@

three.js

for ( const key in files ) { - const section = files[ key ]; + const category = files[ key ]; const header = document.createElement( 'h2' ); header.textContent = key; header.setAttribute( 'data-category', key ); container.appendChild( header ); - for ( let i = 0; i < section.length; i ++ ) { + for ( let i = 0; i < category.length; i ++ ) { - const file = section[ i ]; + const file = category[ i ]; - const link = createLink( file ); + const link = createLink( file, tags[ file ] ); container.appendChild( link ); links[ file ] = link; @@ -201,15 +201,17 @@

three.js

} - function createLink( file ) { + function createLink( file, tags ) { + + const external = Array.isArray( tags ) && tags.includes( 'external' ) ? ' external' : ''; const template = `
- +
-
${getName( file )}
+
${ getName( file ) }${ external }
`; @@ -319,18 +321,9 @@

three.js

link.classList.remove( 'hidden' ); - for ( let i = 0; i < res.length; i ++ ) { - - text = name.replace( res[ i ], '' + res[ i ] + '' ); - - } - - link.querySelector( '.title' ).innerHTML = text; - } else { link.classList.add( 'hidden' ); - link.querySelector( '.title' ).innerHTML = name; } diff --git a/examples/tags.json b/examples/tags.json index 65bdf5c797ade7..7da06abac9388f 100644 --- a/examples/tags.json +++ b/examples/tags.json @@ -33,6 +33,7 @@ "webgl_loader_ttf": [ "text", "font" ], "webgl_loader_pdb": [ "molecules", "css2d" ], "webgl_loader_ldraw": [ "lego" ], + "webgl_loader_ifc": [ "external" ], "webgl_lod": [ "level", "details" ], "webgl_materials_blending": [ "alpha" ], "webgl_materials_blending_custom": [ "alpha" ], @@ -88,7 +89,7 @@ "webgl_postprocessing_unreal_bloom_selective": [ "glow" ], "webgl_postprocessing_3dlut": [ "color grading" ], "webgl_materials_modified": [ "onBeforeCompile" ], - "webgl_raycaster_bvh": [ "three-mesh-bvh", "query", "bounds", "tree", "accelerate", "performance", "community", "extension", "plugin", "library" ], + "webgl_raycaster_bvh": [ "external", "query", "bounds", "tree", "accelerate", "performance", "community", "extension", "plugin", "library", "three-mesh-bvh" ], "webgl_shadowmap_csm": [ "cascade" ], "webgl_shadowmap_pcss": [ "soft" ], "webgl_simple_gi": [ "global illumination" ], diff --git a/files/main.css b/files/main.css index 57b3a01a9a70c0..9ec7543ccc834c 100644 --- a/files/main.css +++ b/files/main.css @@ -537,6 +537,16 @@ iframe#viewer { line-height: calc(var(--line-height) - 6px); } +.card .tag { + background-color: var(--background-color); + color: var(--color-blue); + margin-left: 6px; + padding: 1px 6px 2px; + border-radius: 2px; + font-size: calc(var(--font-size) - 2px); + line-height: calc(var(--line-height) - 6px); +} + /* mobile */ @media all and ( max-width: 640px ) {