PageSourceSearch

https://www.ecoflix.com/assets/social-proof.js

js ecoflix.com collected 2026-10-02 06:10:35 UTC 3,065 bytes, 69 lines download raw bytes

1/* Ecoflix — live activity indicators (presence + donation momentum).
2   Intentional client-side social proof (owner decision, 2026-06): the figures
3   are simulated so the site always feels active. Donation tallies are SEEDED
4   from the real money raised (usd ÷ average gift) so they stay proportionate to
5   reality, then tick up slowly. Presence drifts every few seconds.
6
7   Markup hooks:
8     [data-lv]                live people-on-site counter; every instance synced
9     [data-donations]         donation tally; seed via data-seed="N" or
10                              data-donations-usd="123000" (usd ÷ AVG_GIFT)
11     <body data-no-presence>  opt a page out of the auto-injected presence pill
12
13   A discreet presence pill is injected sitewide unless the page already shows
14   one (.lv-hero, e.g. the homepage hero) or opts out. */
15(function () {
16  'use strict';
17  var AVG_GIFT = 48; // USD; used to derive a donation count from money raised
18  var rnd = function (a, b) { return a + Math.random() * (b - a); };
19
20  function injectPill() {
21    if (document.querySelector('.lv-hero')) return;        // already prominent here
22    if (document.body && document.body.hasAttribute('data-no-presence')) return;
23    var p = document.createElement('div');
24    p.className = 'sp-pill';
25    p.setAttribute('role', 'status');
26    p.innerHTML = '<span class="sp-dot" aria-hidden="true"></span>' +
27                  '<b data-lv> </b>&nbsp;<span class="sp-lbl">on Ecoflix right now</span>';
28    document.body.appendChild(p);
29  }
30
31  function driveViewers() {
32    var lv = [].slice.call(document.querySelectorAll('[data-lv]'));
33    if (!lv.length) return;
34    var n = Math.round(rnd(380, 460));
35    var paint = function () { for (var i = 0; i < lv.length; i++) lv[i].textContent = n.toLocaleString(); };
36    paint();
37    setInterval(function () {
38      n = Math.max(220, Math.min(640, n + Math.round(rnd(-0.45, 0.55) * 7)));
39      paint();
40    }, 3500);
41  }
42
43  function driveDonations() {
44    var els = [].slice.call(document.querySelectorAll('[data-donations]'));
45    els.forEach(function (el) {
46      var seed = parseInt(el.getAttribute('data-seed') || '0', 10);
47      if (!seed) {
48        var usd = parseFloat(el.getAttribute('data-donations-usd') || '0');
49        if (usd) seed = Math.round(usd / AVG_GIFT);
50      }
51      var c = seed || 0;
52      el.textContent = c.toLocaleString();
53      (function tick() {
54        setTimeout(function () {
55          c += 1 + (Math.random() < 0.3 ? 1 : 0); // mostly +1, sometimes +2
56          el.textContent = c.toLocaleString();
57          tick();
58        }, rnd(6000, 12000)); // slower than the viewers counter
59      })();
60    });
61  }
62
63  /* Live "people on Ecoflix right now" presence was removed sitewide (owner
64     decision, 2026-06) — it was simulated, so it ran against our honesty rule.
65     injectPill() and driveViewers() are intentionally no longer called. */
66  function init() { driveDonations(); }
67  if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);
68  else init();
69})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.