1VNP.Areas.Reader.module.Toolbar = new function () { 2 3 var self = this; 4 var stopToolTip = false; 5 var visible = "hidden"; 6 var _parent = VNP.Areas.Reader; 7 let awsS3Activated; 8 let s3URL = new Map(); 9 10 self.openShare = function(){ 11 12 var $share = $("#shareIcon"); 13 var options = { 14 message : $share.show(), 15 size : "sm", 16 title : VNP.getLanguagesKey["reader_share_title"], 17 buttons : [], 18 classname : "vc_reset_margin", 19 useBin :true 20 } ; 21 22 eModal.alert(options); 23 }; 24 25 self.setUpS3URL = async function(awsS3){ 26 awsS3Activated = awsS3; 27 if(awsS3){ 28 try{ 29 let param = { 30 "key": VNP.getEdition(), 31 "thumb": true 32 }; 33 const data = await VNP.Areas.Reader.getS3URL(param); 34 Object.entries(data).forEach(([key, value]) => { 35 s3URL.set(parseInt(key), value); 36 }); 37 }catch(error){ 38 console.error("Error fetching URL for page " + i, error); 39 } 40 } 41 } 42 43 self.getS3URLByKey = function(page){ 44 return s3URL.get(page); 45 } 46 47 /* 48 * set and show the pdf pages available 49 * */ 50 self.openPagesPdf = function () { 51 52 var page = _parent.getActivePage(); 53 54 var $pages = $("#thumbsToShow"); 55 56 if (page === 1 || page === _parent.totalPages || VNP.getIsMobile() ) { 57 58 _parent.openSinglePagePdf(page); 59 eModal.close(); 60 61 } else { 62 63 $pages.empty(); 64 $pages.append("<p class='vc_subtitle'>" + VNP.getLanguagesKey["pageflip_pdf_to_open"] + "</p>"); 65 for(let i = 0; i < 2; i++){ 66 let imageSrc = VNP.baseUrl + VNP.Areas.Reader.getBooksPath() + "images/thumbnails/Thumb-" + (page + i) + ".jpg"; 67 if(awsS3Activated){ 68 imageSrc = self.getS3URLByKey(page + i); 69 } 70 $pages.append( 71 "<div class='single-page'>" + 72 "<a onclick='VNP.Areas.Reader.openSinglePagePdf(" + (page + i) + ")' href='javascript:void(0)'>" + 73 "<img src='" + imageSrc + "' />" + 74 "</a>" + 75 "</div>" 76 ); 77 } 78 79 var options = { 80 message : $($pages).show(), 81 size : "sm", 82 title : VNP.getLanguagesKey["msg_pdfDownloadTitle_header"], 83 buttons : [], 84 classname : "vc_reset_margin", 85 useBin :true 86 } ; 87 88 eModal.alert(options); 89 } 90 91 }; 92 93 /* 94 * set and show the pdf pages available 95 * */ 96 self.openFavorites = function () { 97 98 var page = _parent.getActivePage(); 99 var $pages = $("#thumbsToShow"); 100 101 if (page === 1 || page === _parent.totalPages || VNP.getIsMobile() ) { 102 103 self.addFavorite(page); 104 105 } else { 106 107 $pages.empty(); 108 $pages.append("<p class='vc_subtitle'>" + VNP.getLanguagesKey["pageflip_favorites_to_add"] + "</p>"); 109 for(let i = 0; i < 2; i++){ 110 let imageSrc = VNP.baseUrl + VNP.Areas.Reader.getBooksPath() + "images/thumbnails/Thumb-" + (page + i) + ".jpg"; 111 if(awsS3Activated){ 112 imageSrc = self.getS3URLByKey(page + i); 113 } 114 $pages.append( 115 "<div class='single-page'>" + 116 "<a onclick='VNP.Areas.Reader.module.Toolbar.addFavorite(" + (page + i) + ")' href='javascript:void(0)'>" + 117 "<img src='" + imageSrc + "' />" + 118 "</a>" + 119 "</div>" 120 ); 121 } 122 123 var options = { 124 message : $($pages).show(), 125 size : "sm", 126 title : VNP.getLanguagesKey["favorites"], 127 buttons : [], 128 classname : "vc_modal_favorites", 129 useBin : true 130 } ; 131 132 eModal.alert(options); 133 134 } 135 136 }; 137 138 /* 139 * add to favorite 140 * */ 141 self.addFavorite = function (page) { 142 143 var title = VNP.getTitle(); 144 var editionDate = VNP.editionDate; 145 var notificationSent = false; 146 147 $.ajax({ 148 url: VNP.baseUrl + "/reader/addpreferiti.jsp", 149 dataType: "XML", 150 method: "POST", 151 cache: false, 152 data: {pag: page, edizione: editionDate, testata: title}, 153 success: function (data) { 154 if (!notificationSent) { 155 var options = { 156 message: $(data).find("message").text(), 157 classname: "alert-info", 158 close: { 159 auto: true, 160 dealy: 2000 161 } 162 } 163 VNP.setNotifications(options); 164 $("#vc_notifications").css({"z-index":"10001"}); 165 } 166 notificationSent = true; 167 } 168 }); 169 170 }; 171 172 self.twitterSharing = function (url, target) { 173 var newUrl = "https://twitter.com/intent/tweet?text=" + url; 174 var activePage = VNP.Areas.Reader.getActivePage(); 175 window.open(newUrl, target); 176 push_stats(stats.category.title, stats.event.share + '-' + EDITION_LABEL, "twitter" + '-' + activePage
176+ '-' + hasAccess_label); 177 return; 178 }; 179 180 self.facebookSharing = function( url, target ){ 181 182 var urlFb = 'http://www.facebook.com/sharer.php?u='; 183 var linkVNP = decodeURIComponent( $.trim(url) ); 184 linkVNP = linkVNP.replace("index.html",""); 185 186 //get number page 187 var activePage = VNP.Areas.Reader.getActivePage(); 188 var urlL = $.trim(url); 189 linkVNP = encodeURIComponent(linkVNP.replace("/#/","/?pagenum="+ activePage + "#/")); 190 var newUrl = urlFb + linkVNP; 191 window.open(newUrl, target); 192 push_stats(stats.category.title, stats.event.share + '-' + EDITION_LABEL, "facebook" + '-' + activePage + '-' + hasAccess_label); 193 return; 194 195 }; 196 197 //share by email 198 self.emailSharing = function () { 199 var activePage = VNP.Areas.Reader.getActivePage(); 200 var edition = VNP.getEdition(); 201 var title = VNP.getTitle(); 202 var urlPages = VNP.baseUrl + "/" + "pageflip" + "/" + VNP.Areas.Reader.getReader() + "/" + title + "/" + edition + "/"; 203 204 var url = VNP.baseUrl + "/pageflip/modals/sendMail.jsp?url=" + urlPages + "&pageNumber=" + activePage; 205 eModal.iframe({ 206 url:url, 207 title:VNP.getLanguagesKey["reader_sharing"], 208 classname:"vc_email_sharing", 209 size:"sm" 210 }); 211 push_stats(stats.category.title, stats.event.share + '-' + EDITION_LABEL, "email" + '-' + activePage
211+ '-' + hasAccess_label); 212 }; 213 214 /* 215 * open the modal to go to page (n) 216 * @param element {String} html element 217 * */ 218 self.openGoToPage = function () { 219 220 var $goToPage = $("#gotopage"); 221 var options = { 222 message : $goToPage.show(), 223 size : "sm", 224 title : VNP.getLanguagesKey["vai_pagina"], 225 buttons : [], 226 classname : "vc_reset_margin", 227 useBin :true 228 }; 229 eModal.alert(options); 230 231 $(document).on("keypress", function(e) { 232 if (e.which == 13) { 233 234 self.goToPage($("#vc-page").val()); 235 return false; 236 } 237 }); 238 239 }; 240 241 /* 242 * go to n page 243 * @param page {Integer} page number 244 * 245 */ 246 self.goToPage = function (page) { 247 var pageToGo = page; 248 var $goForm = $(".vc_go_to_page"); // use class because there are 2 form one for mobile and one for desktop 249 var alert = $(".vc_alert_gotopage"); 250 251 if (pageToGo.trim() != "" && pageToGo.trim() > 0 && ! isNaN(pageToGo) ) { 252 253 if ( (pageToGo > VNP.Areas.Reader.getTotalPages()) ) { 254 255 $(alert).html("Page number is not valid").show(); 256 257 } else { 258 //hide the alert and reset the form 259 $(alert).empty().hide(); 260 $($goForm).find("#vc-page").val(""); 261 // close modal 262 eModal.close(); 263 //go to page 264 VNP.Areas.Reader.goToSlide(parseInt(pageToGo)); 265 } 266 267 } else { 268 269 $(alert).html("Page number is not valid").show(); 270 271 } 272 273 }; 274}
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.