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