Skip to content

Commit

Permalink
Display no internet connection warning only in offline YouTube videos (
Browse files Browse the repository at this point in the history
…#1442)

* Refactor: Add offline theme conditional internet warning
  • Loading branch information
ibrahimjaved12 authored Aug 29, 2024
1 parent 22e0908 commit 6e7fece
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
3 changes: 0 additions & 3 deletions base-offline/layouts/partials/video.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
{{ $context := . }}

<div class="video-page">
<div class="show-offline d-none alert alert-warning" role="alert">
Viewing videos requires an internet connection
</div>
<div class="description">
{{ .Content }}
</div>
Expand Down
2 changes: 1 addition & 1 deletion base-offline/layouts/partials/video_player.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{ $archiveVideoSearchResuts := $staticResourcesBundle.Resources.Match $archiveFile }}
{{ $archiveVideoFound = gt (len $archiveVideoSearchResuts) 0 }}
{{ if not $archiveVideoFound }}
{{ partial "youtube_player.html" (dict "context" .context "youtubeKey" .youtubeKey "archiveUrl" $archiveUrl "startTime" .startTime "endTime" .endTime)}}
{{ partial "youtube_player.html" (dict "context" .context "youtubeKey" .youtubeKey "archiveUrl" $archiveUrl "startTime" .startTime "endTime" .endTime "isOffline" true)}}
{{ else }}
{{ partial "local_video_player.html" (dict "context" .context "youtubeKey" .youtubeKey "archiveUrl" $archiveUrl "startTime" .startTime "endTime" .endTime)}}
{{ end }}
3 changes: 0 additions & 3 deletions base-theme/layouts/partials/video.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
{{ end }}

<div class="video-page">
<div class="show-offline d-none alert alert-warning" role="alert">
Viewing videos requires an internet connection
</div>
<div class="description">
{{ .Content }}
</div>
Expand Down
5 changes: 5 additions & 0 deletions base-theme/layouts/partials/youtube_player.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
{{$youtubeParams = printf "%s" (delimit (slice `"end": ` .endTime `, `) "") | printf "%s%s" $youtubeParams }}
{{end}}
{{$youtubeParams = printf "%s" `"ytControls":2}` | printf "%s%s" $youtubeParams |}}
{{ if .isOffline }}
<div class="show-offline d-none alert alert-warning" role="alert">
Viewing videos requires an internet connection
</div>
{{ end }}
<div class="video-container embedded-video-container youtube-container">
<video
id="video-player-{{ .youtubeKey }}-{{ $random }}"
Expand Down

0 comments on commit 6e7fece

Please sign in to comment.