lazy_scroll_video 0.1.0 → 0.1.1
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: 543977cc18e0d8930abf868747b9561ad5abbb9a0c1bf65a8ffb25d6041022db
|
4
|
+
data.tar.gz: e5ba3d87e0b28370246302a146c6fa6d9890efe994cb140ed66eeac89d198fdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bdca840bb479355c70957ff23a7ebf2c2d037e5ee643b8d4a26a78bc15cf911cc765d48913834a95f20bbe0b92fb219b7106a30674345b157fdd702ddd4a493
|
7
|
+
data.tar.gz: 5e11da4e45ba354eedd633b7b7157939f82e5f80d937c2c975bc3b616af91dd20664703e3b93961d2453bea4c30ca84693a1d9aec534b2b936e1e8e7b382d304
|
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,33 @@
|
|
1
|
+
(function () {
|
2
|
+
document.addEventListener("DOMContentLoaded", function () {
|
3
|
+
console.log('initiating lazy scroll video');
|
4
|
+
const observer = new IntersectionObserver((entries, obs) => {
|
5
|
+
entries.forEach(entry => {
|
6
|
+
if (entry.isIntersecting) {
|
7
|
+
const container = entry.target;
|
8
|
+
const videoSrc = container.dataset.videoSrc;
|
9
|
+
|
10
|
+
const video = document.createElement("video");
|
11
|
+
video.src = videoSrc;
|
12
|
+
video.controls = true;
|
13
|
+
video.autoplay = false;
|
14
|
+
video.muted = true; // Autoplay without mute won't work in many browsers
|
15
|
+
video.playsInline = true;
|
16
|
+
video.style.width = "100%";
|
17
|
+
video.style.height = "100%";
|
18
|
+
video.style.objectFit = "contain";
|
19
|
+
|
20
|
+
container.innerHTML = "";
|
21
|
+
container.appendChild(video);
|
22
|
+
|
23
|
+
obs.unobserve(container);
|
24
|
+
}
|
25
|
+
});
|
26
|
+
});
|
27
|
+
|
28
|
+
document.querySelectorAll(".lazy-video-container").forEach(container => {
|
29
|
+
console.log('initiating content observer');
|
30
|
+
observer.observe(container);
|
31
|
+
});
|
32
|
+
});
|
33
|
+
})();
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Prosenjit Chongder
|
@@ -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
|
- - ">="
|