1(function($) { 2 $(document).ready(function(){ 3 4 var books = $(".real3dflipbook"); 5 6 $.each(books, function(){ 7 // console.log(this) 8 var id = $(this).attr('id') 9 // var optionsName = 10 // var options = window["options"+id] 11 var options = $(this).find("#options").html() 12 13 var json_str = options.replace(/"/g, '"'); 14 json_str = json_str.replace(/â/g, '"'); 15 json_str = json_str.replace(/â/g, '"'); 16 json_str = json_str.replace(/â³/g, '"'); 17 json_str = json_str.replace(/â/g, '"'); 18 19 json_str = json_str.replace(/« /g, '"'); 20 json_str = json_str.replace(/ »/g, '"'); 21 22 23 options = jQuery.parseJSON(json_str); 24 options.assets = { 25 preloader:options.rootFolder+"images/preloader.jpg", 26 left:options.rootFolder+"images/left.png", 27 overlay:options.rootFolder+"images/overlay.jpg", 28 flipMp3:options.rootFolder+"mp3/turnPage.mp3" 29 }; 30 31 options.social = []; 32 33 // if(options.facebook != "") 34 // options.social.push({name:"facebook", icon:"fa-facebook", url:options.facebook}); 35 // if(options.twitter != "") 36 // options.social.push({name:"twitter", icon:"fa-twitter", url:options.twitter}); 37 // if(options.googleplus != "") 38 // options.social.push({name:"googleplus", icon:"fa-google-plus", url:options.googleplus}); 39 // if(options.linkedin != "") 40 // options.social.push({name:"linkedin", icon:"fa-linkedin", url:options.linkedin}); 41 // if(options.youtube != "") 42 // options.social.push({name:"youtube", icon:"fa-youtube", url:options.youtube}); 43 44 45 if(typeof(options.btnShare) == 'undefined' || !options.btnShare) options.btnShare = {enabled:false} 46 if(typeof(options.btnNext) == 'undefined' || !options.btnNext) options.btnNext = {enabled:false} 47 if(typeof(options.btnPrev) == 'undefined' || !options.btnPrev) options.btnPrev = {enabled:false} 48 if(typeof(options.btnZoomIn) == 'undefined' || !options.btnZoomIn) options.btnZoomIn = {enabled:false} 49 if(typeof(options.btnZoomOut) == 'undefined' || !options.btnZoomOut) options.btnZoomOut = {enabled:false} 50 if(typeof(options.btnToc) == 'undefined' || !options.btnToc) options.btnToc = {enabled:false} 51 if(typeof(options.btnThumbs) == 'undefined' || !options.btnThumbs) options.btnThumbs = {enabled:false} 52 if(typeof(options.btnDownloadPages) == 'undefined' || !options.btnDownloadPages) options.btnDownloadPages = {enabled:false} 53 if(typeof(options.btnDownloadPdf) == 'undefined' || !options.btnDownloadPdf) options.btnDownloadPdf = {enabled:false} 54 if(typeof(options.btnExpand) == 'undefined' || !options.btnExpand) options.btnExpand = {enabled:false} 55 if(typeof(options.btnExpandLightbox) == 'undefined' || !options.btnExpandLightbox) options.btnExpandLightbox = {enabled:false} 56 if(typeof(options.btnSound) == 'undefined' || !options.btnSound) options.btnSound = {enabled:false} 57 58 59 options.btnShare.enabled = (options.socialShare.length > 0) 60 if(typeof(options.btnShare.icon) == 'undefined' || options.btnShare.icon == '') options.btnShare.icon = "fa-share"; 61 if(typeof(options.btnShare.title) == 'undefined' || options.btnShare.title == '') options.btnShare.title = "Share"; 62 63 if(typeof(options.btnNext.icon) == 'undefined' || options.btnNext.icon == '') options.btnNext.icon = "fa-chevron-right"; 64 if(typeof(options.btnNext.title) == 'undefined' || options.btnNext.title == '') options.btnNext.title = "Next page"; 65 66 if(typeof(options.btnPrev.icon) == 'undefined' || options.btnPrev.icon == '') options.btnPrev.icon = "fa-chevron-left"; 67 if(typeof(options.btnPrev.title) == 'undefined' || options.btnPrev.title == '') options.btnPrev.title = "Previous page"; 68 69 if(typeof(options.btnZoomIn.icon) == 'undefined' || options.btnZoomIn.icon == '') options.btnZoomIn.icon = "fa-plus"; 70 if(typeof(options.btnZoomIn.title) == 'undefined' || options.btnZoomIn.title == '') options.btnZoomIn.title = "Zoom in"; 71 72 if(typeof(options.btnZoomOut.icon) == 'undefined' || options.btnZoomOut.icon == '') options.btnZoomOut.icon = "fa-minus"; 73 if(typeof(options.btnZoomOut.title) == 'undefined' || options.btnZoomOut.title == '') options.btnZoomOut.title = "Zoom out"; 74 75 if(typeof(options.btnToc.icon) == 'undefined' || options.btnToc.icon == '') options.btnToc.icon = "fa-list-ol"; 76 if(typeof(options.btnToc.title) == 'undefined' || options.btnToc.title == '') options.btnToc.title = "Table of content"; 77 78 if(typeof(options.btnThumbs.icon) == 'undefined' || options.btnThumbs.icon == '') options.btnThumbs.icon = "fa-th-large"; 79 if(typeof(options.btnThumbs.title) == 'undefined' || options.btnThumbs.title == '') options.btnThumbs.title = "Pages"; 80 81 if(typeof(options.btnDownloadPages.icon) == 'undefined' || options.btnDownloadPages.icon == '') options.btnDownloadPages.icon = "fa-download"; 82 if(typeof(options.btnDownloadPages.title) == 'undefined' || options.btnDownloadPages.title == '') options.btnDownloadPages.title = "Download pages"; 83 // if(options.downloadPagesUrl) 84 // options.btnDownloadPages.url = options.downloadPagesUrl; 85 86 if(typeof(options.btnDownloadPdf.icon) == 'undefined' || options.btnDownloadPdf.icon == '') options.btnDownloadPdf.icon = "fa-file"; 87 if(typeof(options.btnDownloadPdf.title) == 'undefined' || options.btnDownloadPdf.title == '') options.btnDownloadPdf.title = "Download PDF"; 88 // if(options.downloadPdfUrl) 89 // options.btnDownloadPdf.url = options.downloadPdfUrl; 90 91 if(typeof(options.btnExpand.icon) == 'undefined' || options.btnExpand.icon == '') options.btnExpand.icon = "fa-expand"; 92 if(typeof(options.btnExpand.iconAlt) == 'undefined' || options.btnExpand.iconAlt == '') options.btnExpand.iconAlt = "fa-compress"; 93 if(typeof(options.btnExpand.title) == 'undefined' || options.btnExpand.title == '') options.btnExpand.title = "Toggle fullscreen"; 94 95 if(typeof(options.btnExpandLightbox.icon) == 'undefined' || options.btnExpandLightbox.icon == '') options.btnExpandLightbox.icon = "fa-expand"; 96 if(typeof(options.btnExpandLightbox.iconAlt) == 'undefined' || options.btnExpandLightbox.iconAlt == '') options.btnExpandLightbox.iconAlt = "fa-compress"; 97 if(typeof(options.btnExpandLightbox.title) == 'undefined' || options.btnExpandLightbox.title == '') options.btnExpandLightbox.title = "Toggle fullscreen"; 98 99 if(typeof(options.btnSound.icon) == 'undefined' || options.btnSound.icon == '') options.btnSound.icon = "fa-volume-up"; 100 if(typeof(options.btnSound.title) == 'undefined' || options.btnSound.title == '') options.btnSound.title = "Sound"; 101 102 if(typeof(options.viewMode) == 'undefined') 103 options.viewMode = "webgl" 104 105 if(options.btnDownloadPages.url){ 106 options.btnDownloadPages.url = options.btnDownloadPages.url.replace(/\\/g, '/') 107 options.btnDownloadPages.enabled = true 108 }else 109 options.btnDownloadPages.enabled = false 110 111 if(options.btnDownloadPdf.url){ 112 options.btnDownloadPdf.url = options.btnDownloadPdf.url.replace(/\\/g, '/') 113 options.btnDownloadPdf.enabled = true 114 }else 115 options.btnDownloadPdf.enabled = false 116 117 var bookContainer = $(this); 118 119 switch(options.mode){ 120 case "normal": 121 var containerClass = bookContainer.attr("class") 122 var containerId = bookContainer.attr("id") 123 124 bookContainer.removeClass(containerClass).addClass(containerClass+"-"+containerId) 125 options.lightBox = false;
126 bookContainer 127 .css("position","relative") 128 .css("display","block") 129 .css("height",String(options.height)+"px") 130 bookContainer.flipBook(options); 131 132 133 if(options.fitToWindow){ 134 window.onresize = function(event) { 135 fitToWindow() 136 }; 137 function fitToWindow(){ 138 bookContainer.css("width",String($(window).width())+"px"); 139 bookContainer.css("height",String($(window).height())+"px"); 140 } 141 fitToWindow(); 142 }else if(options.fitToParent){ 143 window.onresize = function(event) { 144 fitToParent() 145 }; 146 function fitToParent(){ 147 //find parent that has width & height != 0 148 var parent = findParent(bookContainer); 149 150 bookContainer.css("width",String(parent.width())+"px") 151 bookContainer.css("height",String(parent.height())+"px") 152 153 function findParent(elem){ 154 if(elem.parent().width() > 0 && elem.parent().height() > 0) 155 return elem.parent() 156 else 157 return findParent(elem.parent()) 158 } 159 } 160 fitToParent(); 161 }else if(options.fitToHeight){ 162 window.onresize = function(event) { 163 fitToHeight() 164 }; 165 function fitToHeight(){ 166 if($(window).height() < options.height + bookContainer.offset().top) 167 bookContainer.css("height",String($(window).height() - bookContainer.offset().top)+"px") 168 else 169 bookContainer.css("height",String(options.height)+"px") 170 } 171 fitToHeight(); 172 } 173 174 if(typeof(options.responsiveHeight) != 'undefined' && options.responsiveHeight){ 175 window.onresize = function(event) { 176 resizeHeight() 177 }; 178 function resizeHeight(){ 179 bookContainer.css("height",String(bookContainer.width() / options.aspectRatio)+"px") 180 } 181 resizeHeight(); 182 } 183 184 break; 185 case "lightbox": 186 bookContainer 187 .css("display","inline") 188 options.lightBox = true; 189 190 var containerClass = "real3dflipbook-" + bookContainer.attr("id") 191 192 if(options.lightboxCssClass != ""){ 193 if($("."+options.lightboxCssClass).length > 0) 194 $("."+options.lightboxCssClass).addClass(containerClass) 195 } 196 else if(options.lightboxThumbnailUrl != ""){ 197 var img = $('<img></img>').attr('src', options.lightboxThumbnailUrl ) 198 .addClass(containerClass) 199 ; 200 bookContainer.before(img) 201 bookContainer.remove(); 202 }else{ 203 var text =$('<a/>').text(options.lightboxText) 204 .addClass(containerClass) 205 ; 206 bookContainer.before(text) 207 bookContainer.remove(); 208 } 209 210 $("."+containerClass).flipBook(options); 211 break; 212 case "fullscreen": 213 options.lightBox = false; 214 bookContainer 215 .appendTo('body') 216 .css("position","fixed") 217 // .css("top","0") 218 .css("bottom","0") 219 .css("left","0") 220 .css("right","0") 221 .css('top', options.offsetTop+'px') 222 .css('z-index', '999999') 223 ; 224 bookContainer.flipBook(options); 225 break; 226 } 227 228 }) 229 230 }); 231}(jQuery));
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.