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