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: 86d48f3f7486029021c28222551d56f4bbc39ad7b643e5a11e8bbaf1db11d873
4
- data.tar.gz: 4edd5bef20b9010331a09a1daae9222d3c23aa397cdf56faf36e98667a506dbd
3
+ metadata.gz: 3c70e6233ce70798c65be1d5a1f99779c2878413c21848f9c958a19c4e8573a0
4
+ data.tar.gz: e775bd49f3950d593d06182c678f382f4a526d47ca8ad515960e8476a3579721
5
5
  SHA512:
6
- metadata.gz: 5f83fdb9dd39d81bb2464e7dc5e42e571a2c5e16405d80b7117fea17fa7abf04aa33584c5b837b3b3db6c3d951db311511af5b435a332ffe3d10037020c2cd63
7
- data.tar.gz: 7c42ce3e36e58ecf61b9905725550e6d0e749846388d437ad3794b81d628b724db3b7a40811ad9aa1a0fa6fd18769077ce0717d45273c1be0e1ed505a3ed55b4
6
+ metadata.gz: e2d4f64cbdd66b5712d9a90c4803c720ad0dbc47276669595c8462dca340711adb036b0fbfdaa4c64dc956e29138f0d9cb0fcc9e35027b9a4a3ceda1c9e97988
7
+ data.tar.gz: 5d67fc18c4df5f5e5c03e9cb178f9e27b7af85cd567bfaeaa2618e32b46c35a8cb1a4ba7991339a5265ce71b9dc485a9ac286ff6ab7d4581d201136828b0bb88
@@ -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 = ">= 3.0.0"
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,4 @@
1
+ module LazyScrollVideo
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LazyScrollVideo
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
@@ -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.0
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-04-09 00:00:00.000000000 Z
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: 3.0.0
46
+ version: 2.7.0
45
47
  required_rubygems_version: !ruby/object:Gem::Requirement
46
48
  requirements:
47
49
  - - ">="