Skip to content

Commit

Permalink
Add search (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman authored Sep 24, 2024
1 parent 83499de commit 00baee7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/templates/header.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div>
{{{include "build/templates/languages.template"}}}
<a href="#toc">{{langInfo.toc}}</a>
<input type="search" placeholder="?" id="search">
</div>
</div>
<div class="webgpu_header">
Expand Down
6 changes: 6 additions & 0 deletions webgpu/lessons/resources/lesson.css
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ div[data-diagram] {
.webgpu_navbar {
background: black;
color: white;
color-scheme: dark;
}
.webgpu_navbar a {
color: white;
Expand All @@ -287,6 +288,8 @@ div[data-diagram] {
font-size: large;
color: white;
}


.home-lang select {
font-size: large;
}
Expand Down Expand Up @@ -818,6 +821,9 @@ pre.prettyprint.lighttheme .fun { color: #900; } /* function name */
.compare {
flex-direction: column;
}
#search {
display: none;
}

}

Expand Down
12 changes: 12 additions & 0 deletions webgpu/lessons/resources/lesson.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ $(document).ready(function($) {
window.location.href = this.dataset.href;
});

$('#search').on('keyup', function(e) {
if (e.key !== 'Enter') {
return;
}
const a = document.createElement('a');
a.target = '_blank';
const u = new URL('https://google.com/search');
u.searchParams.set('q', `site:webgpufundamentals.org ${this.value}`);
a.href = u.toString();
a.click();
});

$('[data-table]').html();

});
Expand Down

0 comments on commit 00baee7

Please sign in to comment.