lazy_scroll_video 0.1.1 → 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: 543977cc18e0d8930abf868747b9561ad5abbb9a0c1bf65a8ffb25d6041022db
4
- data.tar.gz: e5ba3d87e0b28370246302a146c6fa6d9890efe994cb140ed66eeac89d198fdf
3
+ metadata.gz: 3c70e6233ce70798c65be1d5a1f99779c2878413c21848f9c958a19c4e8573a0
4
+ data.tar.gz: e775bd49f3950d593d06182c678f382f4a526d47ca8ad515960e8476a3579721
5
5
  SHA512:
6
- metadata.gz: 9bdca840bb479355c70957ff23a7ebf2c2d037e5ee643b8d4a26a78bc15cf911cc765d48913834a95f20bbe0b92fb219b7106a30674345b157fdd702ddd4a493
7
- data.tar.gz: 5e11da4e45ba354eedd633b7b7157939f82e5f80d937c2c975bc3b616af91dd20664703e3b93961d2453bea4c30ca84693a1d9aec534b2b936e1e8e7b382d304
6
+ metadata.gz: e2d4f64cbdd66b5712d9a90c4803c720ad0dbc47276669595c8462dca340711adb036b0fbfdaa4c64dc956e29138f0d9cb0fcc9e35027b9a4a3ceda1c9e97988
7
+ data.tar.gz: 5d67fc18c4df5f5e5c03e9cb178f9e27b7af85cd567bfaeaa2618e32b46c35a8cb1a4ba7991339a5265ce71b9dc485a9ac286ff6ab7d4581d201136828b0bb88
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LazyScrollVideo
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
@@ -1,6 +1,7 @@
1
1
  (function () {
2
- document.addEventListener("DOMContentLoaded", function () {
2
+ function initLazyVideoContainers() {
3
3
  console.log('initiating lazy scroll video');
4
+
4
5
  const observer = new IntersectionObserver((entries, obs) => {
5
6
  entries.forEach(entry => {
6
7
  if (entry.isIntersecting) {
@@ -11,7 +12,7 @@
11
12
  video.src = videoSrc;
12
13
  video.controls = true;
13
14
  video.autoplay = false;
14
- video.muted = true; // Autoplay without mute won't work in many browsers
15
+ video.muted = true;
15
16
  video.playsInline = true;
16
17
  video.style.width = "100%";
17
18
  video.style.height = "100%";
@@ -29,5 +30,11 @@
29
30
  console.log('initiating content observer');
30
31
  observer.observe(container);
31
32
  });
32
- });
33
- })();
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.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-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: