Skip to content

Commit 2cabd00

Browse files
committed
q
1 parent b0c9eef commit 2cabd00

File tree

3 files changed

+73
-72
lines changed

3 files changed

+73
-72
lines changed

i.html

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,24 @@
2121
height: 100vh;
2222
}
2323

24-
body.media img, body.media video {
24+
body.media img,
25+
body.media video {
2526
max-width: 100%;
2627
max-height: 100vh;
2728
width: auto;
2829
height: auto;
2930
display: block;
3031
}
31-
32+
3233
video:focus {
3334
outline: none;
3435
}
35-
36+
3637
.video-container {
3738
position: relative;
3839
display: none;
3940
}
40-
41+
4142
.play-button {
4243
position: absolute;
4344
top: 50%;
@@ -53,13 +54,13 @@
5354
align-items: center;
5455
z-index: 10;
5556
}
56-
57+
5758
.play-button:hover {
5859
background-color: rgba(0, 0, 0, 0.8);
5960
}
60-
61+
6162
.play-button::after {
62-
content: '';
63+
content: "";
6364
display: block;
6465
width: 0;
6566
height: 0;
@@ -68,7 +69,7 @@
6869
border-left: 30px solid white;
6970
margin-left: 8px;
7071
}
71-
72+
7273
#doc {
7374
display: none;
7475
}
@@ -80,9 +81,9 @@
8081
</style>
8182
</head>
8283
<body>
83-
<img style="display: none;" />
84+
<img style="display: none" />
8485
<div class="video-container">
85-
<video controls loop style="display: block;"></video>
86+
<video controls loop style="display: block"></video>
8687
<div class="play-button"></div>
8788
</div>
8889
<div id="doc">
@@ -161,51 +162,52 @@
161162

162163
if (i) {
163164
// Check if the URL is an MP4 file
164-
const isVideo = i.toLowerCase().endsWith('.mp4');
165-
165+
const isVideo = i.toLowerCase().endsWith(".mp4");
166+
166167
if (isVideo) {
167168
const videoContainer = document.querySelector(".video-container");
168169
const videoElement = document.querySelector("video");
169170
const playButton = document.querySelector(".play-button");
170-
171+
171172
videoElement.src = i;
172173
videoContainer.style.display = "block";
173-
174+
174175
// Add click event to the play button
175-
playButton.addEventListener("click", function() {
176+
playButton.addEventListener("click", function () {
176177
videoElement.muted = false; // Ensure sound is on
177-
videoElement.play()
178+
videoElement
179+
.play()
178180
.then(() => {
179181
// Hide play button when video plays successfully
180182
playButton.style.display = "none";
181183
})
182-
.catch(e => {
184+
.catch((e) => {
183185
console.log("Play failed:", e);
184186
});
185187
});
186-
188+
187189
// Show play button again when video ends if not looping
188-
videoElement.addEventListener("ended", function() {
190+
videoElement.addEventListener("ended", function () {
189191
if (!videoElement.loop) {
190192
playButton.style.display = "flex";
191193
}
192194
});
193-
195+
194196
// Show play button if video is paused
195-
videoElement.addEventListener("pause", function() {
197+
videoElement.addEventListener("pause", function () {
196198
playButton.style.display = "flex";
197199
});
198-
200+
199201
// Hide play button if video is playing
200-
videoElement.addEventListener("playing", function() {
202+
videoElement.addEventListener("playing", function () {
201203
playButton.style.display = "none";
202204
});
203205
} else {
204206
const imgElement = document.querySelector("img");
205207
imgElement.src = i;
206208
imgElement.style.display = "block";
207209
}
208-
210+
209211
document.body.classList.add("media");
210212
} else {
211213
document.querySelector("#doc").removeAttribute("id");

pages/css/index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,15 @@ <h2>box-shadow</h2>
223223
</script>
224224

225225
<h2>clamp</h2>
226-
227-
<script type="editor" data-lang="css"></script>
226+
227+
<script type="editor" data-lang="css">
228228

229229
// https://youtu.be/rIOIeoX6QNw
230230

231231
h1 {
232232
font-size: clamp(50px, 8vw, 100px);
233233
text-align: center;
234234
}
235-
236235
</script>
237236
<h2>view() function rotate scroll</h2>
238237

pages/mac/index.html

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -888,69 +888,69 @@ <h2>VLC media player on mac backward, forward 4 sec</h2>
888888
<h2>IINA - Video Music player VLC alternative</h2>
889889
<a src="https://imgur.com/gallery/iina-pNSbEkn">https://imgur.com/gallery/iina-pNSbEkn</a>
890890
<br />
891-
<a href="https://i.imgur.com/PYPFdnh.png">https://i.imgur.com/SEaY38W.png</a> - <a href="https://github.com/iina/iina/wiki/FAQ#why-is-the-seeking-time-not-precise-when-pressing-arrow-keys">from</a>
891+
<a href="https://i.imgur.com/PYPFdnh.png">https://i.imgur.com/SEaY38W.png</a> -
892+
<a href="https://github.com/iina/iina/wiki/FAQ#why-is-the-seeking-time-not-precise-when-pressing-arrow-keys"
893+
>from</a
894+
>
892895
<h2>VLC alternative -> MPV</h2>
893896
<script type="editor" data-lang="sh">
894897

895-
Install: https://laboratory.stolendata.net/~djinn/mpv_osx/
896-
from: "macOS builds by stolendata" section from : https://mpv.io/installation/
897-
898-
to launch from cli:
899-
open -a /Applications/mpv.app ~/Desktop/Office\[create-orders\].mp4
900-
901-
debug:
902-
open -a /Applications/mpv.app --args --input-test --force-window --idle ~/Desktop/Office\[create-orders\].mp4
903-
904-
# to configure run:
905-
mkdir -p ~/.config/mpv/
906-
cat <<EEE > ~/.config/mpv/mpv.conf
907-
# Use exact seeking instead of keyframe seeking
908-
hr-seek=yes
898+
Install: https://laboratory.stolendata.net/~djinn/mpv_osx/
899+
from: "macOS builds by stolendata" section from : https://mpv.io/installation/
909900

910-
# Set default seek step (arrow keys) to 5 seconds
911-
default-seek=3
901+
to launch from cli:
902+
open -a /Applications/mpv.app ~/Desktop/Office\[create-orders\].mp4
912903

913-
EEE
904+
debug:
905+
open -a /Applications/mpv.app --args --input-test --force-window --idle ~/Desktop/Office\[create-orders\].mp4
914906

915-
mkdir -p ~/.config/mpv
916-
cat <<EEE > ~/.config/mpv/input.conf
917-
PREV seek -3
918-
NEXT seek +3
907+
# to configure run:
908+
mkdir -p ~/.config/mpv/
909+
cat <<EEE > ~/.config/mpv/mpv.conf
910+
# Use exact seeking instead of keyframe seeking
911+
hr-seek=yes
919912

920-
EEE
913+
# Set default seek step (arrow keys) to 5 seconds
914+
default-seek=3
921915

922-
mkdir -p ~/.config/mpv/script-opts
923-
cat <<EEE > ~/.config/mpv/script-opts/osc.conf
924-
visibility=always
916+
EEE
925917

926-
EEE
918+
mkdir -p ~/.config/mpv
919+
cat <<EEE > ~/.config/mpv/input.conf
920+
PREV seek -3
921+
NEXT seek +3
927922

928-
mkdir -p ~/.config/mpv/scripts/
929-
cat <<EEE > ~/.config/mpv/scripts/osc-visibility-toggle.lua
930-
-- ~/.config/mpv/scripts/osc-visibility-toggle.lua
923+
EEE
931924

932-
local mp = require 'mp'
925+
mkdir -p ~/.config/mpv/script-opts
926+
cat <<EEE > ~/.config/mpv/script-opts/osc.conf
927+
visibility=always
933928

934-
local visible = true
929+
EEE
935930

936-
local function toggle_osc_visibility()
937-
if visible then
938-
mp.commandv("script-message", "osc-visibility", "auto")
939-
mp.osd_message("OSC: auto-hide", 2)
940-
else
941-
mp.commandv("script-message", "osc-visibility", "always")
942-
mp.osd_message("OSC: always visible", 2)
943-
end
944-
visible = not visible
945-
end
931+
mkdir -p ~/.config/mpv/scripts/
932+
cat <<EEE > ~/.config/mpv/scripts/osc-visibility-toggle.lua
933+
-- ~/.config/mpv/scripts/osc-visibility-toggle.lua
946934

947-
-- Bind to Ctrl+O (or change to your preferred key)
948-
mp.add_key_binding("ctrl+o", "toggle-osc-visibility", toggle_osc_visibility)
935+
local mp = require 'mp'
949936

950-
EEE
937+
local visible = true
951938

939+
local function toggle_osc_visibility()
940+
if visible then
941+
mp.commandv("script-message", "osc-visibility", "auto")
942+
mp.osd_message("OSC: auto-hide", 2)
943+
else
944+
mp.commandv("script-message", "osc-visibility", "always")
945+
mp.osd_message("OSC: always visible", 2)
946+
end
947+
visible = not visible
948+
end
952949

950+
-- Bind to Ctrl+O (or change to your preferred key)
951+
mp.add_key_binding("ctrl+o", "toggle-osc-visibility", toggle_osc_visibility)
953952

953+
EEE
954954
</script>
955955
</div>
956956
</div>

0 commit comments

Comments
 (0)