PageSourceSearch

https://cumblr.com/js/monetize.js

js cumblr.com collected 2026-10-05 01:22:01 UTC 5,580 bytes, 195 lines download raw bytes

1/**
2 * Monetization — Crak cam widget + optional native ads; ExoClick popunder + banners
3 */
4(function () {
5  "use strict";
6
7  var cfg = window.SITE_CONFIG || {};
8  var exo = cfg.exoclick || {};
9  var feats = cfg.features || {};
10  var crak = cfg.crakrevenue || {};
11  var widget = crak.camWidget;
12  var nativeAds = crak.nativeAds;
13  var exoScriptLoaded = false;
14  var exoServed = false;
15
16  var BP = { mobile: 767, desktop: 1100 };
17
18  function viewport() {
19    var w = window.innerWidth;
20    if (w <= BP.mobile) return "mobile";
21    if (w < BP.desktop) return "tablet";
22    return "desktop";
23  }
24
25  function setViewportClass() {
26    document.body.classList.remove("vp-mobile", "vp-tablet", "vp-desktop");
27    document.body.classList.add("vp-" + viewport());
28  }
29
30  function widgetScriptSrc() {
31    if (!widget || !widget.scriptSrc) return "";
32    var layout = (widget.layout && widget.layout[viewport()]) || { cols: 4, rows: 1, number: 4 };
33    return widget.scriptSrc
34      .replace(/([?&])cols=\d+/, "$1cols=" + layout.cols)
35      .replace(/([?&])rows=\d+/, "$1rows=" + layout.rows)
36      .replace(/([?&])number=\d+/, "$1number=" + layout.number);
37  }
38
39  function initPop() {
40    if (!exo.enabled || !feats.popunder || !exo.popunder) return;
41
42    var pop = {
43      ads_host: "a.pemsrv.com",
44      syndication_host: "s.pemsrv.com",
45      idzone: exo.popunder,
46      popup_fallback: true,
47      popup_force: false,
48      chrome_enabled: true,
49      new_tab: true,
50      frequency_period: exo.popunderFrequencyMinutes || 720,
51      frequency_count: exo.popunderMaxPerPeriod || 1,
52      trigger_method: 2,
53      trigger_class: "btn-yes",
54      trigger_delay: 0,
55      capping_enabled: true,
56      tcf_enabled: true,
57      only_inline: false
58    };
59
60    var s = document.createElement("script");
61    s.async = true;
62    s.src = "https://a.pemsrv.com/popunder1000.js";
63    Object.keys(pop).forEach(function (k) {
64      s.setAttribute("data-exo-" + k, pop[k]);
65    });
66    document.head.appendChild(s);
67  }
68
69  var NATIVE_SLOT_MAP = {
70    top: "zone-top",
71    sideLeft: "zone-left",
72    sideRight: "zone-right",
73    mid: "zone-mid",
74    sticky: "zone-sticky",
75    bottom: "zone-bottom",
76    native: "zone-native"
77  };
78
79  function injectNativeAds() {
80    if (!nativeAds || !nativeAds.enabled) return;
81
82    var map = nativeAds[viewport()] || {};
83    Object.keys(map).forEach(function (key) {
84      var html = map[key];
85      var slotId = NATIVE_SLOT_MAP[key];
86      if (!html || !slotId) return;
87      var el = document.getElementById(slotId);
88      if (!el) return;
89      el.innerHTML = html;
90      el.querySelectorAll("script").forEach(function (old) {
91        var s = document.createElement("script");
92        if (old.src) {
93          s.src = old.src;
94          s.async = true;
95        } else {
96          s.textContent = old.textContent;
97        }
98        old.replaceWith(s);
99      });
100      if (key === "sticky" || key === "bottom") {
101        document.body.classList.add("has-sticky-ad");
102      }
103    });
104  }
105
106  function exoSlotsForViewport(vp) {
107    var map = exo[vp] || {};
108    var slots = [];
109
110    if (map.top) slots.push(["zone-top", map.top]);
111    if (map.sideLeft) slots.push(["zone-left", map.sideLeft]);
112    if (map.sideRight) slots.push(["zone-right", map.sideRight]);
113    if (map.mid) slots.push(["zone-mid", map.mid]);
114    if (map.mid2) slots.push(["zone-mid-2", map.mid2]);
115    if (map.mid3) slots.push(["zone-mid-3", map.mid3]);
116    if (map.mid4) slots.push(["zone-mid-4", map.mid4]);
117    if (map.bottom) slots.push(["zone-bottom", map.bottom]);
118    if (map.sticky) slots.push(["zone-sticky", map.sticky]);
119    if (map.native) slots.push(["zone-native", map.native]);
120
121    return slots;
122  }
123
124  function injectExoZone(id, zoneId) {
125    var el = document.getElementById(id);
126    if (!el || el.querySelector("ins")) return;
127    var ins = document.createElement("ins");
128    ins.className = "eas6a97888e20";
129    ins.dataset.zoneid = String(zoneId);
130    el.appendChild(ins);
131    if (id === "zone-sticky" || id === "zone-bottom") {
132      document.body.classList.add("has-sticky-ad");
133    }
134  }
135
136  function loadExoScript(cb) {
137    if (exoScriptLoaded) {
138      cb();
139      return;
140    }
141    exoScriptLoaded = true;
142    var s = document.createElement("script");
143    s.async = true;
144    s.src = "https://a.pemsrv.com/ad-provider.js";
145    s.onload = cb;
146    s.onerror = function () {
147      exoScriptLoaded = false;
148    };
149    document.head.appendChild(s);
150  }
151
152  function initExoBanners() {
153    if (!exo.enabled || exo.bannersEnabled === false) return;
154
155    var slots = exoSlotsForViewport(viewport());
156    if (!slots.length) return;
157
158    var midRow = document.querySelector(".zone-mid-row");
159    if (midRow && slots.some(function (x) { return x[0].indexOf("zone-mid") === 0; })) {
160      midRow.classList.add("is-active");
161    }
162
163    loadExoScript(function () {
164      slots.forEach(function (x) { injectExoZone(x[0], x[1]); });
165      if (!exoServed) {
166        exoServed = true;
167        (window.AdProvider = window.AdProvider || []).push({ serve: {} });
168      }
169    });
170  }
171
172  function initWidget() {
173    if (!widget || !widget.enabled) return;
174    var src = widgetScriptSrc();
175    if (!src) return;
176    var slot = document.getElementById("widget");
177    if (!slot) return;
178    var s = document.createElement("script");
179    s.async = true;
180    s.src = src;
181    slot.appendChild(s);
182  }
183
184  window.Monetize = {
185    bootPop: initPop,
186    bootPage: function () {
187      setViewportClass();
188      initWidget();
189      initExoBanners();
190      injectNativeAds();
191    }
192  };
193
194  initPop();
195})();

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.