PageSourceSearch

https://nensa.net/wp-content/plugins/real3d-flipbook-lite/js/embed.js?ver=5.5

js nensa.net collected 2026-10-01 11:52:37 UTC 13,601 bytes, 370 lines download raw bytes

1"use strict";
2(function () {
3  document.addEventListener("DOMContentLoaded", function () {
4    var books = document.querySelectorAll(".real3dflipbook");
5    if (books.length > 0) {
6      var globalScript = document.getElementById(
7        "real3dflipbook-global-options"
8      );
9      var o_global = globalScript ? JSON.parse(globalScript.textContent) : {};
10
11      var claimedTriggers = [];
12
13      books.forEach(function (bookElement) {
14        var configScript = document.querySelector(
15          '.real3dflipbook-options[data-book-id="' + bookElement.id + '"]'
16        );
17
18        if (!configScript) return;
19
20        var o = JSON.parse(configScript.textContent);
21
22        function convertStrings(obj) {
23          Object.keys(obj).forEach(function (key) {
24            var value = obj[key];
25            if (
26              value === null ||
27              value === undefined ||
28              (Array.isArray(value) && value.length == 0)
29            )
30              delete obj[key];
31            else if (typeof value === "object") {
32              convertStrings(value);
33            } else if (!isNaN(value)) {
34              if (obj[key] === "") delete obj[key];
35              else obj[key] = Number(value);
36            } else if (value === "true") {
37              obj[key] = true;
38            } else if (value === "false") {
39              obj[key] = false;
40            }
41          });
42        }
43
44        var s = o.s;
45        convertStrings(o);
46        convertStrings(o_global);
47
48        function r3d_stripslashes(str) {
49          return (str + "").replace(/\\(.?)/g, function (s, n1) {
50            switch (n1) {
51              case "\\":
52                return "\\";
53              case "0":
54                return "\u0000";
55              case "":
56                return "";
57              default:
58                return n1;
59            }
60          });
61        }
62
63        function decode(obj) {
64          Object.keys(obj).forEach(function (key) {
65            if (typeof obj[key] === "string")
66              obj[key] = r3d_stripslashes(obj[key]);
67            else if (typeof obj[key] === "object") obj[key] = decode(obj[key]);
68          });
69          return obj;
70        }
71
72        o = decode(o);
73        o_global = decode(o_global);
74        o.s = s;
75
76        if (o.pages) {
77          if (!Array.isArray(o.pages)) {
78            var pages = [];
79            Object.keys(o.pages).forEach(function (key) {
80              pages[key] = o.pages[key];
81            });
82            o.pages = pages;
83          }
84
85          o.pages.forEach(function (page) {
86            if (page.htmlContent) page.htmlContent = unescape(page.htmlContent);
87            if (page.items) {
88              page.items.forEach(function (item, itemIndex) {
89                if (item.url) item.url = unescape(item.url);
90              });
91            }
92          });
93        }
94
95        o = FLIPBOOK.extend(true, {}, o_global, o);
96
97        // Compose the preview message from the structured fields. Per-flipbook values
98        // already override the global ones via the deep merge above. If nothing is set,
99        // previewMessage stays empty so the viewer's built-in defaults are shown.
100        if (!o.previewMessage) {
101          var previewMsg = "";
102          if (o.previewTitle)
103            previewMsg +=
104              '<h2 style="margin:0 0 10px;font-size:20px;">' + o.previewTitle + "</h2>";
105          if (o.previewDescription)
106            previewMsg +=
107              '<div style="margin:0 0 14px;">' + o.previewDescription + "</div>";
108          if (o.previewButtonText && o.previewButtonUrl)
109            previewMsg +=
110              '<a href="' +
111              o.previewButtonUrl +
112              '" target="_blank" style="display:inline-block;background:#2C6ECB;color:#fff;padding:10px 20px;border-radius:6px;text-decoration:none;font-weight:bold;">' +
113              o.previewButtonText +
114              "</a>";
115          if (previewMsg) o.previewMessage = previewMsg;
116        }
117
118        o.assets = {
119          preloader: o.rootFolder + "assets/images/preloader.jpg",
120          left: o.rootFolder + "assets/images/left.png",
121          overlay: o.rootFolder + "assets/images/overlay.jpg",
122          flipMp3: o.rootFolder + "assets/mp3/turnPage.mp3",
123          shadowPng: o.rootFolder + "assets/images/shadow.png",
124          spinner: o.rootFolder + "assets/images/spinner.gif",
125        };
126
127        o.pdfjsworkerSrc =
128          o.rootFolder + "js/libs/pdf.worker.min.js?ver=" + o.version;
129        o.flipbookSrc = o.rootFolder + "js/flipbook.min.js?ver=" + o.version;
130        o.cMapUrl = o.rootFolder + "assets/cmaps/";
131
132        o.social = [];
133
134        if (o.btnDownloadPages && o.btnDownloadPages.url) {
135          o.btnDownloadPages.url = o.btnDownloadPages.url.replace(/\\/g, "/");
136        }
137
138        if (o.btnDownloadPdf) {
139          if (o.btnDownloadPdfUrl)
140            o.btnDownloadPdf.url = o.btnDownloadPdfUrl.replace(/\\/g, "/");
141          else if (o.btnDownloadPdf && o.btnDownloadPdf.url)
142            o.btnDownloadPdf.url = o.btnDownloadPdf.url.replace(/\\/g, "/");
143          else if (o.pdfUrl)
144            o.btnDownloadPdf.url = o.pdfUrl.replace(/\\/g, "/");
145        }
146
147        var bookContainer = bookElement;
148        var parentContainer = bookContainer.parentNode;
149
150        var isMobile =
151          /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
152            navigator.userAgent
153          ) ||
154          (navigator.maxTouchPoints &&
155            navigator.maxTouchPoints > 2 &&
156            /MacIntel/.test(navigator.platform));
157
158        o.mode = isMobile && o.modeMobile ? o.modeMobile : o.mode;
159
160        o.doubleClickZoomDisabled = !o.doubleClickZoom;
161        o.pageDragDisabled = !o.pageDrag;
162
163        //options from url parameters
164        function getUrlVars() {
165          var vars = {};
166          var parts = window.location.href.replace(
167            /[?&]+([^=&]+)=([^&]*)/gi,
168            function (m, key, value) {
169              vars[key] = value.split("#")[0];
170            }
171          );
172          return vars;
173        }
174
175        var urlParams = getUrlVars();
176
177        Object.keys(urlParams).forEach(function (key) {
178          if (key.indexOf("r3d-") !== -1)
179            o[key.replace("r3d-", "")] = decodeURIComponent(urlParams[key]);
180        });
181
182        o.shareImage = o.shareImage || o.lightboxThumbnailUrl;
183
184        var book;
185
186        function expandBasePath(o) {
187          if (!o || !o.basePath || !Array.isArray(o.pages)) return;
188
189          const base = o.basePath;
190
191          if (typeof base !== "string" || base.length < 8) return;
192
193          for (const page of o.pages) {
194            if (!page || typeof page !== "object") continue;
195
196            for (const key of ["src", "thumb", "json"]) {
197              if (!page[key] || typeof page[key] !== "string") continue;
198
199              const value = page[key];
200
201              if (/^(https?:)?\/\//i.test(value)) continue;
202
203              if (value.startsWith(base)) continue;
204
205              page[key] = base + value;
206            }
207          }
208        }
209        expandBasePath(o);
210
211        switch (o.mode) {
212          case "normal":
213            bookContainer.className += "-" + bookContainer.id;
214            o.lightBox = false;
215            bookElement.style.position = "relative";
216            bookElement.style.display = "block";
217            bookElement.style.width = "100%";
218
219            let width = bookContainer.getBoundingClientRect().width;
220            if (width < o.responsiveViewTreshold) {
221              bookContainer.style.height = width / 0.65 + "px";
222            } else {
223              bookContainer.style.height = width / 1.3 + "px";
224            }
225
226            book = new FlipBook(bookElement, o);
227            break;
228          case "lightbox":
229            bookElement.style.display = "inline";
230            o.lightBox = true;
231
232            bookContainer.className += "-" + bookContainer.id;
233            bookElement.setAttribute("style", o.lightboxContainerCSS);
234
235            if (o.hideThumbnail) o.lightboxThumbnailUrl = "";
236
237            o.lightboxText = o.lightboxText || "";
238
239            if (o.showTitle) o.lightboxText += o.name;
240            if (o.showDate) o.lightboxText += o.date;
241
242            if (o.lightboxThumbnailUrl) {
243              if (location.protocol === "https:")
244                o.lightboxThumbnailUrl = o.lightboxThumbnailUrl.replace(
245                  "http://",
246                  "https://"
247                );
248              else if (location.protocol === "http:")
249                o.lightboxThumbnailUrl = o.lightboxThumbnailUrl.replace(
250                  "https://",
251                  "http://"
252                );
253
254              var thumbWrapper = document.createElement("div");
255              thumbWrapper.setAttribute("style", "position: relative;");
256              bookElement.appendChild(thumbWrapper);
257
258              var thumb = document.createElement("img");
259              thumb.setAttribute("src", o.lightboxThumbnailUrl);
260              thumbWrapper.appendChild(thumb);
261              thumb.setAttribute("style", o.lightboxThumbnailUrlCSS);
262
263              if (o.thumbAlt) thumb.setAttribute("alt", o.thumbAlt);
264
265              if (o.lightboxThumbnailInfo) {
266                var defaultLightboxThumbnailInfoCSS =
267                  "position: absolute; display: grid; align-items: center; text-align: center; top: 0;  width: 100%; height: 100%; font-size: 16px; color: #000; background: rgba(255,255,255,.8); ";
268
269                var thumbInfo = document.createElement("span");
270                thumbWrapper.appendChild(thumbInfo);
271                thumbInfo.setAttribute(
272                  "style",
273                  defaultLightboxThumbnailInfoCSS + o.lightboxThumbnailInfoCSS
274                );
275                thumbInfo.textContent = o.lightboxThumbnailInfoText || o.name;
276                thumbInfo.style.display = "none";
277
278                thumbWrapper.addEventListener("mouseenter", function () {
279                  thumbInfo.style.display = "block";
280                });
281
282                thumbWrapper.addEventListener("mouseleave", function () {
283                  thumbInfo.style.display = "none";
284                });
285              }
286            }
287
288            if (o.lightboxText && o.lightboxText !== "") {
289              var text = document.createElement("span");
290              text.textContent = o.lightboxText;
291              var style = "text-align:center; padding: 10px 0;";
292              style += o.lightboxTextCSS;
293
294              if (o.lightboxTextPosition === "top") {
295                bookElement.insertBefore(text, bookElement.firstChild);
296              } else {
297                bookElement.appendChild(text);
298              }
299              text.setAttribute("style", style);
300            }
301
302            // Its own thumbnail always opens this occurrence, so two shortcodes for the
303            // same book keep their own options. Elements carrying the class that no
304            // shortcode rendered (custom links, images) go to the first occurrence only.
305            var triggers = [bookElement];
306
307            if (!o.lightboxCssClass || o.lightboxCssClass === "") {
308              o.lightboxCssClass = bookContainer.className;
309            } else {
310              bookElement.classList.add(o.lightboxCssClass);
311
312              document
313                .querySelectorAll("." + o.lightboxCssClass)
314                .forEach(function (el) {
315                  if (el === bookElement) return;
316                  if (Array.prototype.indexOf.call(books, el) !== -1) return;
317                  if (claimedTriggers.indexOf(el) !== -1) return;
318                  claimedTriggers.push(el);
319                  triggers.push(el);
320                });
321            }
322
323            if (o.lightboxLink) {
324              triggers.forEach(function (el) {
325                el.addEventListener("click", function () {
326                  var target = o.lightboxLinkNewWindow ? "_blank" : "_self";
327                  window.open(o.lightboxLink, target);
328                });
329              });
330            } else {
331              book = new FlipBook(triggers, o);
332            }
333            break;
334
335          case "fullscreen":
336            o.lightBox = false;
337            document.body.appendChild(bookElement);
338            bookElement.classList.add("flipbook-browser-fullscreen");
339            if (
340              !(
341                "fullscreenEnabled" in document ||
342                "webkitFullscreenEnabled" in document ||
343                "mozFullScreenEnabled" in document
344              )
345            ) {
346              o.btnExpand = { enabled: false };
347            }
348
349            book = new FlipBook(bookElement, o);
350            document.body.style.overflow = "hidden";
351
352            if (o.menuSelector) {
353              var menu = document.querySelector(o.menuSelector);
354              var height = window.innerHeight - menu.offsetHeight;
355              bookElement.style.top = menu.offsetHeight + "px";
356              bookElement.style.height = height + "px";
357
358              window.onresize = function () {
359                height = window.innerHeight - menu.offsetHeight;
360                bookElement.style.top = menu.offsetHeight + "px";
361                bookElement.style.height = height + "px";
362              };
363            }
364            break;
365        }
366
367        });
368    }
369  });
370})();

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.