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 if (isMobile && o.modeMobile) o.mode = o.modeMobile; 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.