lazy_scroll_video 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c70e6233ce70798c65be1d5a1f99779c2878413c21848f9c958a19c4e8573a0
|
|
4
|
+
data.tar.gz: e775bd49f3950d593d06182c678f382f4a526d47ca8ad515960e8476a3579721
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e2d4f64cbdd66b5712d9a90c4803c720ad0dbc47276669595c8462dca340711adb036b0fbfdaa4c64dc956e29138f0d9cb0fcc9e35027b9a4a3ceda1c9e97988
|
|
7
|
+
data.tar.gz: 5d67fc18c4df5f5e5c03e9cb178f9e27b7af85cd567bfaeaa2618e32b46c35a8cb1a4ba7991339a5265ce71b9dc485a9ac286ff6ab7d4581d201136828b0bb88
|
data/lazy_scroll_video.gemspec
CHANGED
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
|
12
12
|
spec.description = "A small JS gem for lazy-loading videos into view for Rails apps."
|
|
13
13
|
spec.homepage = "https://github.com/prosenjit98/lazy_scroll_video"
|
|
14
14
|
spec.license = "MIT"
|
|
15
|
-
spec.required_ruby_version = ">=
|
|
15
|
+
spec.required_ruby_version = ">= 2.7.0"
|
|
16
16
|
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
18
18
|
# spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
spec.files = Dir.chdir(__dir__) do
|
|
24
24
|
`git ls-files -z`.split("\x0").reject do |f|
|
|
25
25
|
(File.expand_path(f) == __FILE__) ||
|
|
26
|
-
f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
|
|
26
|
+
f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile]) || f.end_with?(".gem")
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
spec.bindir = "exe"
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
function initLazyVideoContainers() {
|
|
3
|
+
console.log('initiating lazy scroll video');
|
|
4
|
+
|
|
5
|
+
const observer = new IntersectionObserver((entries, obs) => {
|
|
6
|
+
entries.forEach(entry => {
|
|
7
|
+
if (entry.isIntersecting) {
|
|
8
|
+
const container = entry.target;
|
|
9
|
+
const videoSrc = container.dataset.videoSrc;
|
|
10
|
+
|
|
11
|
+
const video = document.createElement("video");
|
|
12
|
+
video.src = videoSrc;
|
|
13
|
+
video.controls = true;
|
|
14
|
+
video.autoplay = false;
|
|
15
|
+
video.muted = true;
|
|
16
|
+
video.playsInline = true;
|
|
17
|
+
video.style.width = "100%";
|
|
18
|
+
video.style.height = "100%";
|
|
19
|
+
video.style.objectFit = "contain";
|
|
20
|
+
|
|
21
|
+
container.innerHTML = "";
|
|
22
|
+
container.appendChild(video);
|
|
23
|
+
|
|
24
|
+
obs.unobserve(container);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
document.querySelectorAll(".lazy-video-container").forEach(container => {
|
|
30
|
+
console.log('initiating content observer');
|
|
31
|
+
observer.observe(container);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Auto-init on DOMContentLoaded
|
|
36
|
+
document.addEventListener("DOMContentLoaded", initLazyVideoContainers);
|
|
37
|
+
|
|
38
|
+
// Expose to global scope for manual use
|
|
39
|
+
window.initLazyVideoContainers = initLazyVideoContainers;
|
|
40
|
+
})();
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lazy_scroll_video
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Prosenjit Chongder
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-09-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A small JS gem for lazy-loading videos into view for Rails apps.
|
|
14
14
|
email:
|
|
@@ -25,8 +25,10 @@ files:
|
|
|
25
25
|
- Rakefile
|
|
26
26
|
- lazy_scroll_video.gemspec
|
|
27
27
|
- lib/lazy_scroll_video.rb
|
|
28
|
+
- lib/lazy_scroll_video/engine.rb
|
|
28
29
|
- lib/lazy_scroll_video/version.rb
|
|
29
30
|
- sig/lazy_scroll_video.rbs
|
|
31
|
+
- vendor/assets/javascripts/lazy_scroll_video.js
|
|
30
32
|
homepage: https://github.com/prosenjit98/lazy_scroll_video
|
|
31
33
|
licenses:
|
|
32
34
|
- MIT
|
|
@@ -41,7 +43,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
41
43
|
requirements:
|
|
42
44
|
- - ">="
|
|
43
45
|
- !ruby/object:Gem::Version
|
|
44
|
-
version:
|
|
46
|
+
version: 2.7.0
|
|
45
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
48
|
requirements:
|
|
47
49
|
- - ">="
|