Skip to content

Commit

Permalink
Add youtube video
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Nov 24, 2024
1 parent fb0019c commit dcf4aba
Show file tree
Hide file tree
Showing 5 changed files with 303 additions and 4 deletions.
83 changes: 79 additions & 4 deletions AiServer/wwwroot/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,10 @@ select{
margin-top: auto;
}

.mt-24 {
margin-top: 6rem;
}

.block {
display: block;
}
Expand Down Expand Up @@ -1361,6 +1365,10 @@ select{
display: none;
}

.aspect-video {
aspect-ratio: 16 / 9;
}

.h-10 {
height: 2.5rem;
}
Expand Down Expand Up @@ -1601,6 +1609,14 @@ select{
max-width: 20rem;
}

.max-w-6xl {
max-width: 72rem;
}

.max-w-5xl {
max-width: 64rem;
}

.flex-1 {
flex: 1 1 0%;
}
Expand Down Expand Up @@ -2327,6 +2343,11 @@ select{
background-color: rgb(238 242 255 / var(--tw-bg-opacity, 1));
}

.bg-indigo-500 {
--tw-bg-opacity: 1;
background-color: rgb(99 102 241 / var(--tw-bg-opacity, 1));
}

.bg-indigo-600 {
--tw-bg-opacity: 1;
background-color: rgb(79 70 229 / var(--tw-bg-opacity, 1));
Expand Down Expand Up @@ -2543,6 +2564,11 @@ select{
padding-right: 0.75rem;
}

.px-3\.5 {
padding-left: 0.875rem;
padding-right: 0.875rem;
}

.px-4 {
padding-left: 1rem;
padding-right: 1rem;
Expand Down Expand Up @@ -2634,6 +2660,10 @@ select{
padding-bottom: 2.5rem;
}

.pb-16 {
padding-bottom: 4rem;
}

.pb-2 {
padding-bottom: 0.5rem;
}
Expand Down Expand Up @@ -2742,6 +2772,10 @@ select{
padding-top: 0.375rem;
}

.pt-16 {
padding-top: 4rem;
}

.pt-2 {
padding-top: 0.5rem;
}
Expand All @@ -2766,10 +2800,6 @@ select{
padding-top: 1.5rem;
}

.pt-12 {
padding-top: 3rem;
}

.text-left {
text-align: left;
}
Expand Down Expand Up @@ -3607,6 +3637,11 @@ select{
background-color: rgb(199 210 254 / var(--tw-bg-opacity, 1));
}

.hover\:bg-indigo-400:hover {
--tw-bg-opacity: 1;
background-color: rgb(129 140 248 / var(--tw-bg-opacity, 1));
}

.hover\:bg-indigo-500:hover {
--tw-bg-opacity: 1;
background-color: rgb(99 102 241 / var(--tw-bg-opacity, 1));
Expand Down Expand Up @@ -3913,6 +3948,10 @@ select{
outline-color: #000;
}

.focus-visible\:outline-indigo-400:focus-visible {
outline-color: #818cf8;
}

.focus-visible\:outline-indigo-600:focus-visible {
outline-color: #4f46e5;
}
Expand Down Expand Up @@ -4650,6 +4689,10 @@ select{
margin-top: 5rem;
}

.sm\:mt-5 {
margin-top: 1.25rem;
}

.sm\:block {
display: block;
}
Expand Down Expand Up @@ -4852,6 +4895,11 @@ select{
line-height: 1.25rem;
}

.sm\:text-xl {
font-size: 1.25rem;
line-height: 1.75rem;
}

.sm\:duration-700 {
transition-duration: 700ms;
}
Expand Down Expand Up @@ -5045,6 +5093,10 @@ select{
margin-top: 6rem;
}

.lg\:mt-6 {
margin-top: 1.5rem;
}

.lg\:block {
display: block;
}
Expand Down Expand Up @@ -5089,6 +5141,10 @@ select{
max-width: 768px;
}

.lg\:max-w-xl {
max-width: 36rem;
}

.lg\:grid-cols-2 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
Expand Down Expand Up @@ -5148,9 +5204,18 @@ select{
padding-top: 1rem;
}

.lg\:pt-8 {
padding-top: 2rem;
}

.lg\:text-center {
text-align: center;
}

.lg\:text-lg {
font-size: 1.125rem;
line-height: 1.75rem;
}
}

@media (min-width: 1280px) {
Expand Down Expand Up @@ -5192,6 +5257,16 @@ select{
padding-left: 1.25rem;
padding-right: 1.25rem;
}

.xl\:text-6xl {
font-size: 3.75rem;
line-height: 1;
}

.xl\:text-xl {
font-size: 1.25rem;
line-height: 1.75rem;
}
}

@media (min-width: 1536px) {
Expand Down
93 changes: 93 additions & 0 deletions AiServer/wwwroot/css/lite-yt-embed.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
lite-youtube {
background-color: #000;
transition: all 0.2s cubic-bezier(0, 0, 0.2, 1);
position: relative;
display: block;
contain: content;
background-position: center center;
background-size: cover;
cursor: pointer;
max-width: 720px;
}

lite-youtube:hover {
transition: all 0.2s cubic-bezier(0, 0, 0.2, 1);
}

/* gradient */
lite-youtube::before {
content: '';
display: block;
position: absolute;
top: 0;
/*background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADGCAYAAAAT+OqFAAAAdklEQVQoz42QQQ7AIAgEF/T/D+kbq/RWAlnQyyazA4aoAB4FsBSA/bFjuF1EOL7VbrIrBuusmrt4ZZORfb6ehbWdnRHEIiITaEUKa5EJqUakRSaEYBJSCY2dEstQY7AuxahwXFrvZmWl2rh4JZ07z9dLtesfNj5q0FU3A5ObbwAAAABJRU5ErkJggg==);*/
background-position: top;
background-repeat: repeat-x;
height: 60px;
padding-bottom: 50px;
width: 100%;
transition: all 0.2s cubic-bezier(0, 0, 0.2, 1);
}

/* responsive iframe with a 16:9 aspect ratio
thanks https://css-tricks.com/responsive-iframes/
*/
lite-youtube::after {
content: "";
display: block;
padding-bottom: calc(100% / (16 / 9));
}
lite-youtube > iframe {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border: 0;
}

/* play button */
lite-youtube > .lty-playbtn {
width: 60px;
height: 42px;
position: absolute;
cursor: pointer;
transform: translate3d(-50%, -50%, 0);
color: white;
top: 50%;
left: 50%;
z-index: 1;
opacity: 30%;
background: transparent url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 68 48"><path fill="%23f00" fill-opacity="0.8" d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z"></path><path d="M 45,24 27,14 27,34" fill="%23fff"></path></svg>') no-repeat;
filter: grayscale(100%);
border: none;
}

lite-youtube:hover > .lty-playbtn,
lite-youtube .lty-playbtn:focus {
filter: grayscale(0);
transition: opacity 0.5s, filter .1s cubic-bezier(0, 0, 0.2, 1);
-webkit-transition: opacity 0.5s;
opacity: 100%;
outline: none;
}

/* Post-click styles */
lite-youtube.lyt-activated {
cursor: unset;
}
lite-youtube.lyt-activated::before,
lite-youtube.lyt-activated > .lty-playbtn {
opacity: 0;
pointer-events: none;
}

.lyt-visually-hidden {
clip: rect(0 0 0 0);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
2 changes: 2 additions & 0 deletions AiServer/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<link rel="stylesheet" href="/css/app.css">
<link rel="stylesheet" href="/css/typography.css">
<link rel="stylesheet" href="/css/highlight.css">
<link rel="stylesheet" href="/css/lite-yt-embed.css">
<link rel="stylesheet" href="/css/asciinema-player.css">
<style>
::-webkit-scrollbar { width: 8px; height: 8px }
Expand Down Expand Up @@ -109,6 +110,7 @@
</script>


<script src="/lib/js/lite-yt-embed.js"></script>
<script src="/lib/js/asciinema-player.js"></script>

</body>
Expand Down
Loading

0 comments on commit dcf4aba

Please sign in to comment.