PageSourceSearch

https://www.washingtoncrossingpark.org/wp-content/plugins/real3d-flipbook-lite/js/frontend.js?ver=5.0.8

js washingtoncrossingpark.org collected 2026-09-24 09:36:26 UTC 5,733 bytes, 196 lines download raw bytes

1"use strict";
2
3window.addEventListener("DOMContentLoaded", function () {
4  r3d_frontend.options = flipbookOptions_global;
5  const withClass = r3d_frontend.options.convertPDFLinksWithClass;
6  const withoutClass = r3d_frontend.options.convertPDFLinksWithoutClass;
7
8  function findIncludedLinks(withClass) {
9    if (withClass) {
10      return document.querySelectorAll(
11        `.${withClass} a[href$=".pdf"], a.${withClass}[href$=".pdf"]`
12      );
13    } else {
14      return document.querySelectorAll('a[href$=".pdf"]');
15    }
16  }
17
18  function findExcludedLinks(withoutClass) {
19    if (withoutClass) {
20      return document.querySelectorAll(
21        `.${withoutClass} a[href$=".pdf"], a.${withoutClass}[href$=".pdf"]`
22      );
23    } else {
24      return [];
25    }
26  }
27
28  const includedLinks = findIncludedLinks(withClass);
29  const excludedLinks = findExcludedLinks(withoutClass);
30
31  const includedLinksArray = Array.from(includedLinks);
32  const excludedLinksSet = new Set(Array.from(excludedLinks));
33
34  const pdfLinks = includedLinksArray.filter(
35    (link) => !excludedLinksSet.has(link)
36  );
37
38  if (pdfLinks.length > 0) {
39    const rootFolder = r3d_frontend.rootFolder;
40    const options = r3d_frontend.options;
41
42    function convertStrings(obj) {
43      if (typeof obj === "object" && obj !== null) {
44        Object.entries(obj).forEach(([key, value]) => {
45          if (typeof value === "object" && value !== null) {
46            convertStrings(value);
47          } else {
48            if (!isNaN(value) && value !== "") {
49              obj[key] = Number(value);
50            } else if (value === "true") {
51              obj[key] = true;
52            } else if (value === "false") {
53              obj[key] = false;
54            } else if (value === "") {
55              delete obj[key];
56            }
57          }
58        });
59      }
60    }
61
62    convertStrings(options);
63
64    options.lightBox = true;
65    options.assets = {
66      preloader: rootFolder + "assets/images/preloader.jpg",
67      left: rootFolder + "assets/images/left.png",
68      overlay: rootFolder + "assets/images/overlay.jpg",
69      flipMp3: rootFolder + "assets/mp3/turnPage.mp3",
70      shadowPng: rootFolder + "assets/images/shadow.png",
71      spinner: rootFolder + "assets/images/spinner.gif",
72    };
73    options.pdfjsworkerSrc = rootFolder + "js/libs/pdf.worker.min.js";
74    options.flipbookSrc = rootFolder + "js/flipbook.min.js";
75    options.cMapUrl = rootFolder + "assets/cmaps/";
76
77    if (window.FLIPBOOK) {
78      pdfLinks.forEach((link, index) => createFlipbook(link, index, options));
79    } else {
80      Promise.all([
81        loadScript(
82          rootFolder + "js/flipbook.min.js?ver=" + r3d_frontend.version
83        ),
84        loadCSS(
85          rootFolder + "css/flipbook.min.css?ver=" + r3d_frontend.version
86        ),
87      ])
88        .then(() => {
89          pdfLinks.forEach((link, index) =>
90            createFlipbook(link, index + 1, options)
91          );
92        })
93        .catch((error) => {
94          console.error(
95            "An error occurred while loading the resources:",
96            error
97          );
98        });
99    }
100  }
101
102  function getOptionsFromClasses(element) {
103    const options = {};
104
105    while (element) {
106      if (element.classList) {
107        Array.from(element.classList).forEach((cls) => {
108          if (cls.startsWith("r3d-")) {
109            const [, keyPart, ...valueParts] = cls.split("-");
110            if (keyPart && valueParts.length) {
111              const key = keyPart;
112              let value = valueParts.join("-");
113
114              if (value === "true") value = true;
115              else if (value === "false") value = false;
116              else if (!isNaN(value) && value.trim() !== "")
117                value = Number(value);
118
119              options[key] = value;
120            }
121          }
122        });
123      }
124      element = element.parentElement;
125    }
126
127    return options;
128  }
129
130  function createFlipbook(link, index, options) {
131    options.pdfUrl = link.href;
132
133    const classOptions = getOptionsFromClasses(link);
134    Object.assign(options, classOptions);
135
136    // Handle deeplinking prefix logic
137    if (options.deeplinkingPrefix) {
138      options.deeplinking = options.deeplinking || {};
139      options.deeplinking.prefix = options.deeplinkingPrefix;
140    } else if (options.deeplinking && options.deeplinking.enabled) {
141      options.deeplinking.prefix = "book" + index + "_";
142    }
143
144    new FlipBook(link, options);
145  }
146
147  function loadScript(src) {
148    return new Promise(function (resolve, reject) {
149      var script = document.createElement("script");
150      var prior = document.getElementsByTagName("script")[0];
151      script.async = true;
152      script.src = src;
153
154      script.onload = script.onreadystatechange = function (_, isAbort) {
155        if (
156          isAbort ||
157          !script.readyState ||
158          /loaded|complete/.test(script.readyState)
159        ) {
160          script.onload = script.onreadystatechange = null;
161          script = undefined;
162
163          if (!isAbort) {
164            resolve();
165          }
166        }
167      };
168
169      script.onerror = function (error) {
170        reject(error);
171      };
172
173      prior.parentNode.insertBefore(script, prior);
174    });
175  }
176
177  function loadCSS(href) {
178    return new Promise(function (resolve, reject) {
179      var link = document.createElement("link");
180      var prior =
181        document.getElementsByTagName("link")[0] ||
182        document.getElementsByTagName("script")[0];
183      link.rel = "stylesheet";
184      link.href = href;
185
186      link.onload = () => resolve();
187      link.onerror = (error) => reject(error);
188
189      if (prior) {
190        prior.parentNode.insertBefore(link, prior);
191      } else {
192        document.head.appendChild(link);
193      }
194    });
195  }
196});

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.