book-view.html
792 lines
| 1 | <div id="fb3d-ctx" class="flip-book"> |
| 2 | <div class="view"> |
| 3 | <div class="fnav"> |
| 4 | <div class="prev"> |
| 5 | <a class="cmdBackward but-show" href="/#"><span class="icon previous-page-icon"> |
| 6 | <svg title="<$tr>Previous page</$tr>" width="28.947" height="49.999" viewBox="0 0 28.947 49.999" fill="none" |
| 7 | xmlns="http://www.w3.org/2000/svg"> |
| 8 | <path |
| 9 | d="M1.372 22.096a4.12 4.12 0 0 0 0 5.821l20.559 20.559a4.118 4.118 0 0 0 5.821-5.821L10.097 25 27.739 7.345a4.118 4.118 0 0 0-5.821-5.821L1.359 22.083z" |
| 10 | fill="#666" /> |
| 11 | </svg> |
| 12 | </span></a> |
| 13 | </div> |
| 14 | <div class="next"> |
| 15 | <a class="cmdForward but-show" href="/#"><span class="icon next-page-icon"> |
| 16 | <svg title="<$tr>Next page</$tr>" width="29.605" height="50" viewBox="0 0 29.605 50" fill="none" |
| 17 | xmlns="http://www.w3.org/2000/svg"> |
| 18 | <path |
| 19 | d="M27.904 22.096a4.12 4.12 0 0 1 0 5.821L7.345 48.476a4.118 4.118 0 0 1-5.821-5.821L19.179 25 1.537 7.345a4.118 4.118 0 0 1 5.821-5.821l20.559 20.559z" |
| 20 | fill="#666" /> |
| 21 | </svg> |
| 22 | |
| 23 | </span></a> |
| 24 | </div> |
| 25 | </div> |
| 26 | <div class="widLoadingProgress loading-progress hidden"> |
| 27 | <div class="progress"> |
| 28 | </div> |
| 29 | <div class="txtLoadingProgress caption"> |
| 30 | </div> |
| 31 | </div> |
| 32 | <div class="widLoading page-loading hidden"> |
| 33 | </div> |
| 34 | </div> |
| 35 | |
| 36 | <div class="widFloatWnd float-wnd hidden"> |
| 37 | <div class="header"> |
| 38 | <$tr>Table of contents</$tr> |
| 39 | <a href="/#" title="<$tr>Close</$tr>" class="close cmdCloseToc"> |
| 40 | <span class="icon"> |
| 41 | <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">> |
| 42 | <path |
| 43 | d="M18.249 4.385a1.709 1.709 0 0 0-2.413-2.412l-5.609 5.614-5.614-5.609A1.709 1.709 0 0 0 2.2 4.391L7.815 10l-5.61 5.615a1.709 1.709 0 0 0 2.413 2.412l5.609-5.615 5.615 5.609a1.709 1.709 0 0 0 2.413-2.413L12.64 10z" |
| 44 | fill="#fff" /> |
| 45 | </svg> |
| 46 | |
| 47 | </span> |
| 48 | </a> |
| 49 | </div> |
| 50 | <div class="body"> |
| 51 | <div class="ctrl"> |
| 52 | <div class="toc"> |
| 53 | <div class="toc-menu widTocMenu"> |
| 54 | <ul> |
| 55 | <li class="cmdBookmarks"><a href="/#"> |
| 56 | <$tr>Bookmarks</$tr> |
| 57 | </a></li> |
| 58 | <li class="cmdThumbnails"><a href="/#"> |
| 59 | <$tr>Thumbnails</$tr> |
| 60 | </a></li> |
| 61 | <li class="cmdSearch"><a href="/#"> |
| 62 | <$tr>Search</$tr> |
| 63 | </a></li> |
| 64 | </ul> |
| 65 | </div> |
| 66 | <div class="widBookmarks toc-view"> |
| 67 | |
| 68 | </div> |
| 69 | <div class="widThumbnails toc-view"> |
| 70 | |
| 71 | </div> |
| 72 | <div class="widSearch toc-view"> |
| 73 | |
| 74 | </div> |
| 75 | </div> |
| 76 | </div> |
| 77 | </div> |
| 78 | </div> |
| 79 | |
| 80 | <div class="controls"> |
| 81 | |
| 82 | <div class="ctrl js-center"> |
| 83 | <nav class="fnavbar"> |
| 84 | <ul class="fnav"> |
| 85 | |
| 86 | <li class="fnav-item cmdZoomIn"><a href="/#"><span class="icon"> |
| 87 | <svg title="<$tr>Zoom in</$tr>" width="30" height="30" viewBox="0 0 30 30" fill="none" |
| 88 | xmlns="http://www.w3.org/2000/svg"> |
| 89 | <path |
| 90 | d="M24.375 12.188c0 2.689-.873 5.174-2.344 7.189l7.418 7.424c.732.732.732 1.922 0 2.654s-1.922.732-2.654 0l-7.418-7.424a12.1 12.1 0 0 1-7.189 2.344C5.455 24.375 0 18.92 0 12.188S5.455 0 12.188 0s12.188 5.455 12.188 12.188m-13.594 5.156c0 .779.627 1.406 1.406 1.406s1.406-.627 1.406-1.406v-3.75h3.75c.779 0 1.406-.627 1.406-1.406s-.627-1.406-1.406-1.406h-3.75v-3.75c0-.779-.627-1.406-1.406-1.406s-1.406.627-1.406 1.406v3.75h-3.75c-.779 0-1.406.627-1.406 1.406s.627 1.406 1.406 1.406h3.75z" |
| 91 | fill="#fff" /> |
| 92 | </svg> |
| 93 | </span></a></li> |
| 94 | <li class="fnav-item cmdZoomOut"><a href="/#"><span class="icon"> |
| 95 | <svg title="<$tr>Zoom out</$tr>" width="30" height="30" viewBox="0 0 30 30" fill="none" |
| 96 | xmlns="http://www.w3.org/2000/svg"> |
| 97 | <g clip-path="url(#a)"> |
| 98 | <path |
| 99 | d="M24.375 12.188c0 2.689-.873 5.174-2.344 7.189l7.418 7.424c.732.732.732 1.922 0 2.654s-1.922.732-2.654 0l-7.418-7.424a12.1 12.1 0 0 1-7.189 2.344C5.455 24.375 0 18.92 0 12.188S5.455 0 12.188 0s12.188 5.455 12.188 12.188M7.97 10.782c-.779 0-1.406.627-1.406 1.406s.627 1.406 1.406 1.406h8.438c.779 0 1.406-.627 1.406-1.406s-.627-1.406-1.406-1.406z" |
| 100 | fill="#fff" /> |
| 101 | </g> |
| 102 | <defs> |
| 103 | <clipPath id="a"> |
| 104 | <path fill="#fff" d="M0 0h30v30H0z" /> |
| 105 | </clipPath> |
| 106 | </defs> |
| 107 | </svg> |
| 108 | </span></a></li> |
| 109 | <li class="fnav-item cmdDefaultZoom but-show"><a href="/#"><span class="icon"> |
| 110 | |
| 111 | <svg title="<$tr>Fit view</$tr>" width="30" height="30" viewBox="0 0 30 30" fill="none" |
| 112 | xmlns="http://www.w3.org/2000/svg"> |
| 113 | <path |
| 114 | d="M.005.005v7.498h1.874V1.879h5.623V.005zm28.116 22.493v5.623h-5.623v1.874h7.498v-7.497zM29.995.005v7.498h-1.874V1.879h-5.623V.005zM1.879 22.498v5.623h5.623v1.874H.005v-7.497z" |
| 115 | fill="#fff" /> |
| 116 | <path fill-rule="evenodd" clip-rule="evenodd" |
| 117 | d="M5.628 5.628v18.744h18.744V5.628zm1.874 1.874h14.995v14.995H7.502z" fill="#fff" /> |
| 118 | </svg> |
| 119 | |
| 120 | </span></a></li> |
| 121 | <li class="fnav-item cmdToc"><a href="/#"><span class="icon"> |
| 122 | <svg title="<$tr>Table of contents</$tr>" width="30" height="40" viewBox="0 0 30 40" fill="none" |
| 123 | xmlns="http://www.w3.org/2000/svg"> |
| 124 | <path |
| 125 | d="M0 3.75v34.352a1.9 1.9 0 0 0 2.992 1.554L15 31.25l12.008 8.406A1.9 1.9 0 0 0 30 38.102V3.75C30 1.68 28.32 0 26.25 0H3.75C1.68 0 0 1.68 0 3.75" |
| 126 | fill="#fff" /> |
| 127 | </svg> |
| 128 | </span></a></li> |
| 129 | |
| 130 | <!-- <li class="fnav-item cmdFastBackward"><a href="/#"><span class="icon icon-backward"> |
| 131 | <svg title="<$tr>10 pages backward</$tr>" width="30" height="17" viewBox="0 0 30 17" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 132 | <path d="M0 0L10.6105 8.11579L0 16.2316V0ZM13.7368 0L24.3789 8.11579L13.7368 16.2316V0ZM26.2421 0.631578H30V15.6316H26.2421V0.631578Z" fill="white"/> |
| 133 | </svg> |
| 134 | </span></a></li> --> |
| 135 | |
| 136 | |
| 137 | <li class="fnav-item cmdBackward"><a href="/#"><span class="icon"> |
| 138 | <svg class="rotate-180" width="25" height="17" viewBox="0 0 25 17" fill="none" |
| 139 | xmlns="http://www.w3.org/2000/svg"> |
| 140 | <path d="M0 0L10.6105 8.11579L0 16.2316V0ZM13.7368 0L24.3789 8.11579L13.7368 16.2316V0Z" |
| 141 | fill="white" /> |
| 142 | </svg> |
| 143 | </span></a></li> |
| 144 | |
| 145 | <li class="fnav-item"> |
| 146 | <div class="pages"> |
| 147 | <input type="text" class="number inpPage" maxlength="4" placeholder="1"> |
| 148 | <input type="text" class="amount inpPages" readOnly maxlength="4" placeholder="1"> |
| 149 | </div> |
| 150 | </li> |
| 151 | <li class="fnav-item cmdForward"><a href="/#"><span class="icon"> |
| 152 | <svg title="<$tr>Next page</$tr>" width="25" height="17" viewBox="0 0 25 17" fill="none" |
| 153 | xmlns="http://www.w3.org/2000/svg"> |
| 154 | <path d="M0 0L10.6105 8.11579L0 16.2316V0ZM13.7368 0L24.3789 8.11579L13.7368 16.2316V0Z" |
| 155 | fill="white" /> |
| 156 | </svg> |
| 157 | </span></a></li> |
| 158 | |
| 159 | <!-- <li class="fnav-item cmdFastForward"><a href="/#"><span class="icon"> |
| 160 | <svg title="<$tr>10 pages forward</$tr>" width="30" height="17" viewBox="0 0 30 17" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 161 | <path d="M0 0L10.6105 8.11579L0 16.2316V0ZM13.7368 0L24.3789 8.11579L13.7368 16.2316V0ZM26.2421 0.631578H30V15.6316H26.2421V0.631578Z" fill="white"/> |
| 162 | </svg> |
| 163 | |
| 164 | </span></a></li> --> |
| 165 | |
| 166 | <li class="fnav-item but-show cmdDownload"><a id="download-pdf" href="/#"><span class="icon"> |
| 167 | <svg title="<$tr>Download</$tr>" width="20" height="20" viewBox="0 0 20 20" fill="none" |
| 168 | xmlns="http://www.w3.org/2000/svg"> |
| 169 | <path |
| 170 | d="M11.25 1.25a1.25 1.25 0 1 0-2.5 0v9.48L5.883 7.863a1.252 1.252 0 0 0-1.77 1.77l5 5a1.253 1.253 0 0 0 1.77 0l5-5a1.252 1.252 0 0 0-1.77-1.77L11.25 10.73zM2.5 13.75a2.5 2.5 0 0 0-2.5 2.5v1.25C0 18.879 1.121 20 2.5 20h15c1.379 0 2.5-1.121 2.5-2.5v-1.25c0-1.379-1.121-2.5-2.5-2.5h-3.965l-1.77 1.77a2.5 2.5 0 0 1-3.535 0l-1.765-1.77zm14.375 2.188c.249 0 .487.099.663.275a.94.94 0 0 1 0 1.326.94.94 0 0 1-1.326 0 .94.94 0 0 1 0-1.326.94.94 0 0 1 .663-.275" |
| 171 | fill="#fff" /> |
| 172 | </svg> |
| 173 | </span></a></li> |
| 174 | <li class="fnav-item cmdPrint"><a href="/#"><span class="icon"> |
| 175 | <svg title="<$tr>Print</$tr>" width="30" height="30" viewBox="0 0 30 30" fill="none" |
| 176 | xmlns="http://www.w3.org/2000/svg"> |
| 177 | <g clip-path="url(#a)"> |
| 178 | <path |
| 179 | d="M7.5 0a3.754 3.754 0 0 0-3.75 3.75v5.625H7.5V3.75h13.283L22.5 5.467v3.908h3.75V5.467c0-.996-.393-1.951-1.096-2.654l-1.716-1.717A3.76 3.76 0 0 0 20.783 0zm15 20.625v5.625h-15v-5.625zm3.75 1.875h1.875A1.873 1.873 0 0 0 30 20.625V15a3.755 3.755 0 0 0-3.75-3.75H3.75A3.754 3.754 0 0 0 0 15v5.625C0 21.662.838 22.5 1.875 22.5H3.75v3.75A3.754 3.754 0 0 0 7.5 30h15a3.755 3.755 0 0 0 3.75-3.75zm-.938-7.969a1.406 1.406 0 1 1 0 2.812 1.406 1.406 0 0 1 0-2.812" |
| 180 | fill="#fff" /> |
| 181 | </g> |
| 182 | <defs> |
| 183 | <clipPath id="a"> |
| 184 | <path fill="#fff" d="M0 0h30v30H0z" /> |
| 185 | </clipPath> |
| 186 | </defs> |
| 187 | </svg> |
| 188 | |
| 189 | </span></a></li> |
| 190 | <li class="fnav-item cmdFullScreen"><a href="/#"><span class="icon"> |
| 191 | <svg title="<$tr>Full screen</$tr>" width="20" height="20" viewBox="0 0 20 20" fill="none" |
| 192 | xmlns="http://www.w3.org/2000/svg"> |
| 193 | <path |
| 194 | d="M1.429 0C.638 0 0 .638 0 1.429v4.286c0 .79.638 1.429 1.429 1.429s1.429-.638 1.429-1.429V2.857h2.857A1.427 1.427 0 1 0 5.714 0zm1.429 14.286c0-.79-.638-1.429-1.429-1.429S0 13.496 0 14.286v4.286c0 .79.638 1.429 1.429 1.429h4.286c.79 0 1.429-.638 1.429-1.429s-.638-1.429-1.429-1.429H2.857zM14.286 0c-.79 0-1.429.638-1.429 1.429s.638 1.429 1.429 1.429h2.857v2.857c0 .79.638 1.429 1.429 1.429s1.429-.638 1.429-1.429V1.429c0-.79-.638-1.429-1.429-1.429zM20 14.286c0-.79-.638-1.429-1.429-1.429s-1.429.638-1.429 1.429v2.857h-2.857c-.79 0-1.429.638-1.429 1.429s.638 1.429 1.429 1.429h4.286c.79 0 1.429-.638 1.429-1.429z" |
| 195 | fill="#fff" /> |
| 196 | </svg> |
| 197 | |
| 198 | </span></a></li> |
| 199 | |
| 200 | <li class="dropup fnav-item toggle widSettings"> |
| 201 | <a href="/#"> |
| 202 | <div class="icon-caret"><span class="icon"> |
| 203 | |
| 204 | <svg width="112" height="432" viewBox="0 0 112 432" fill="none" xmlns="http://www.w3.org/2000/svg">> |
| 205 | <path |
| 206 | d="M56 320C41.1479 320 26.9041 325.9 16.402 336.402C5.89998 346.904 0 361.148 0 376C0 390.852 5.89998 405.096 16.402 415.598C26.9041 426.1 41.1479 432 56 432C70.8521 432 85.0959 426.1 95.598 415.598C106.1 405.096 112 390.852 112 376C112 361.148 106.1 346.904 95.598 336.402C85.0959 325.9 70.8521 320 56 320ZM56 160C41.1479 160 26.9041 165.9 16.402 176.402C5.89998 186.904 0 201.148 0 216C0 230.852 5.89998 245.096 16.402 255.598C26.9041 266.1 41.1479 272 56 272C70.8521 272 85.0959 266.1 95.598 255.598C106.1 245.096 112 230.852 112 216C112 201.148 106.1 186.904 95.598 176.402C85.0959 165.9 70.8521 160 56 160ZM112 56C112 41.1479 106.1 26.9041 95.598 16.402C85.0959 5.89998 70.8521 0 56 0C41.1479 0 26.9041 5.89998 16.402 16.402C5.89998 26.9041 0 41.1479 0 56C0 70.8521 5.89998 85.0959 16.402 95.598C26.9041 106.1 41.1479 112 56 112C70.8521 112 85.0959 106.1 95.598 95.598C106.1 85.0959 112 70.8521 112 56Z" |
| 207 | fill="white" /> |
| 208 | </svg> |
| 209 | |
| 210 | </span></div> |
| 211 | </a> |
| 212 | |
| 213 | <ul class="menu hidden"> |
| 214 | <li class="cmdSmartPan"><a href="/#"><span class="icon"> |
| 215 | <svg width="25.714" height="20" viewBox="0 0 25.714 20" fill="none" |
| 216 | xmlns="http://www.w3.org/2000/svg"> |
| 217 | <path |
| 218 | d="M12.857 2.143c-2.911 0-5.304 1.321-7.138 3.022C4 6.763 2.812 8.661 2.205 10c.607 1.339 1.795 3.236 3.509 4.835 1.839 1.701 4.232 3.022 7.143 3.022s5.304-1.321 7.138-3.022c1.719-1.599 2.907-3.496 3.514-4.835-.607-1.339-1.795-3.237-3.509-4.835-1.839-1.701-4.232-3.022-7.143-3.022M4.259 3.598C6.362 1.643 9.25 0 12.857 0s6.495 1.643 8.598 3.598c2.089 1.942 3.487 4.259 4.152 5.853.147.353.147.746 0 1.098-.665 1.594-2.062 3.915-4.152 5.853C19.352 18.357 16.464 20 12.857 20s-6.495-1.643-8.598-3.598C2.17 14.464.772 12.143.112 10.549a1.42 1.42 0 0 1 0-1.098c.66-1.594 2.058-3.915 4.147-5.853m8.598 9.973c1.973 0 3.571-1.598 3.571-3.571s-1.598-3.571-3.571-3.571h-.089a2.86 2.86 0 0 1-3.482 3.482V10a3.57 3.57 0 0 0 3.571 3.571m0-9.286a5.7 5.7 0 0 1 4.041 1.674 5.714 5.714 0 0 1 0 8.081 5.714 5.714 0 0 1-8.081 0 5.714 5.714 0 0 1 0-8.081 5.7 5.7 0 0 1 4.04-1.673" |
| 219 | fill="#fff" /> |
| 220 | </svg> |
| 221 | </span> |
| 222 | <$tr>Smart pan</$tr> |
| 223 | </a></li> |
| 224 | <li class="cmdSinglePage"><a href="/#"><span class="icon"> |
| 225 | <svg width="15" height="20" viewBox="0 0 15 20" fill="none" xmlns="http://www.w3.org/2000/svg">> |
| 226 | <g clip-path="url(#a)"> |
| 227 | <path |
| 228 | d="M2.5 18.125a.627.627 0 0 1-.625-.625v-15c0-.344.281-.625.625-.625h6.25V5c0 .692.558 1.25 1.25 1.25h3.125V17.5a.627.627 0 0 1-.625.625zM2.5 0A2.5 2.5 0 0 0 0 2.5v15C0 18.879 1.121 20 2.5 20h10c1.379 0 2.5-1.121 2.5-2.5V6.035a2.5 2.5 0 0 0-.731-1.77L10.73.73A2.5 2.5 0 0 0 8.965 0zm2.188 10c-.519 0-.938.418-.938.938s.418.938.938.938h5.625c.519 0 .938-.418.938-.938S10.832 10 10.313 10zm0 3.75c-.519 0-.938.418-.938.938s.418.938.938.938h5.625c.519 0 .938-.418.938-.938s-.418-.938-.938-.938z" |
| 229 | fill="#fff" /> |
| 230 | </g> |
| 231 | <defs> |
| 232 | <clipPath id="a"> |
| 233 | <path fill="#fff" d="M0 0h15v20H0z" /> |
| 234 | </clipPath> |
| 235 | </defs> |
| 236 | </svg></span> |
| 237 | <$tr>Single page</$tr> |
| 238 | </a></li> |
| 239 | <li class="cmdSounds"><a href="/#"><span class="icon sound-icon"> |
| 240 | <svg width="25" height="20" viewBox="0 0 25 20" fill="none" xmlns="http://www.w3.org/2000/svg">> |
| 241 | <path |
| 242 | d="M20.844 1.27C23.379 3.328 25 6.477 25 10s-1.621 6.668-4.156 8.73c-.402.328-.992.266-1.32-.137s-.266-.992.137-1.32c2.117-1.719 3.465-4.336 3.465-7.273s-1.348-5.555-3.465-7.277c-.402-.328-.461-.918-.137-1.32s.918-.461 1.32-.137zM18.48 4.18c1.688 1.375 2.77 3.473 2.77 5.82s-1.082 4.445-2.77 5.82c-.402.328-.992.266-1.32-.137s-.266-.992.137-1.32c1.269-1.031 2.078-2.601 2.078-4.363s-.809-3.332-2.078-4.367c-.402-.328-.461-.918-.137-1.32s.918-.461 1.32-.137zm-2.363 2.91a3.755 3.755 0 0 1 0 5.82c-.402.328-.992.266-1.32-.137s-.266-.992.137-1.32c.421-.344.691-.867.691-1.453s-.27-1.109-.691-1.457c-.402-.328-.461-.918-.137-1.32s.918-.461 1.32-.137zm-4.355-5.731c.449.204.738.649.738 1.141v15c0 .492-.289.938-.738 1.141s-.977.121-1.344-.207l-5.27-4.684H2.5a2.5 2.5 0 0 1-2.5-2.5v-2.5c0-1.379 1.121-2.5 2.5-2.5h2.648l5.27-4.684a1.26 1.26 0 0 1 1.344-.207" |
| 243 | fill="#fff" /> |
| 244 | </svg> |
| 245 | </span> |
| 246 | <$tr>Sounds</$tr> |
| 247 | </a></li> |
| 248 | <li class="cmdStats"><a href="/#"><span class="icon"> |
| 249 | <svg width="22.857" height="20" viewBox="0 0 22.857 20" fill="none" |
| 250 | xmlns="http://www.w3.org/2000/svg"> |
| 251 | <path |
| 252 | d="M2.857 1.429C2.857 0.638 2.219 0 1.429 0S0 0.638 0 1.429v15c0 1.973 1.598 3.571 3.571 3.571h17.857c0.79 0 1.429 -0.638 1.429 -1.429s-0.638 -1.429 -1.429 -1.429H3.571c-0.393 0 -0.714 -0.321 -0.714 -0.714zm18.152 3.866c0.558 -0.558 0.558 -1.464 0 -2.022s-1.464 -0.558 -2.022 0L14.286 7.978l-2.562 -2.562c-0.558 -0.558 -1.464 -0.558 -2.022 0l-5 5c-0.558 0.558 -0.558 1.464 0 2.022s1.464 0.558 2.022 0l3.991 -3.987 2.562 2.562c0.558 0.558 1.464 0.558 2.022 0l5.714 -5.714z" |
| 253 | fill="#fff" /> |
| 254 | </svg> |
| 255 | </span> |
| 256 | <$tr>Stats</$tr> |
| 257 | </a></li> |
| 258 | <!-- <li class="divider"></li> --> |
| 259 | <!-- <li class="cmdLightingUp"><a href="/#"><span class="icon arrow-icon"> |
| 260 | <svg width="35.019" height="20" viewBox="0 0 35.019 20" fill="none" |
| 261 | xmlns="http://www.w3.org/2000/svg"> |
| 262 | <path |
| 263 | d="M15.751.732a2.493 2.493 0 0 1 3.525 0l14.941 14.941a2.493 2.493 0 0 1-3.525 3.525L17.509 6.015 4.327 19.19a2.493 2.493 0 0 1-3.525-3.525L15.743.724z" |
| 264 | fill="#fff" /> |
| 265 | </svg> |
| 266 | </span> |
| 267 | <$tr>Increase lighting</$tr> |
| 268 | </a></li> |
| 269 | <li class="cmdLightingDown"><a href="/#"><span class="icon arrow-icon"> |
| 270 | <svg width="35.019" height="20" viewBox="0 0 35.019 20" fill="none" |
| 271 | xmlns="http://www.w3.org/2000/svg"> |
| 272 | <path |
| 273 | d="M15.751 19.268c0.973 0.973 2.552 0.973 3.525 0l14.941 -14.941c0.973 -0.973 0.973 -2.552 0 -3.525s-2.552 -0.973 -3.525 0L17.509 13.984 4.327 0.809c-0.973 -0.973 -2.552 -0.973 -3.525 0s-0.973 2.552 0 3.525l14.941 14.941z" |
| 274 | fill="#fff" /> |
| 275 | </svg> |
| 276 | </span> |
| 277 | <$tr>Reduce lighting</$tr> |
| 278 | </a></li> --> |
| 279 | </ul> |
| 280 | </li> |
| 281 | </ul> |
| 282 | </nav> |
| 283 | </div> |
| 284 | |
| 285 | </div> |
| 286 | </div> |
| 287 | |
| 288 | |
| 289 | <script> |
| 290 | |
| 291 | const adjustHexColor = (hexColor, percentage) => { |
| 292 | if (!hexColor || typeof hexColor !== 'string' || !hexColor.startsWith('#') || hexColor.length < 4) { |
| 293 | return hexColor || '#38383d'; |
| 294 | } |
| 295 | // Convert hex color to RGB values |
| 296 | const r = parseInt(hexColor.slice(1, 3), 16); |
| 297 | const g = parseInt(hexColor.slice(3, 5), 16); |
| 298 | const b = parseInt(hexColor.slice(5, 7), 16); |
| 299 | |
| 300 | // Calculate adjusted RGB values |
| 301 | const adjustment = Math.round((percentage / 100) * 255); |
| 302 | const newR = Math.max(Math.min(r + adjustment, 255), 0); |
| 303 | const newG = Math.max(Math.min(g + adjustment, 255), 0); |
| 304 | const newB = Math.max(Math.min(b + adjustment, 255), 0); |
| 305 | |
| 306 | // Convert adjusted RGB values back to hex color |
| 307 | const newHexColor = '#' + ((1 << 24) + (newR << 16) + (newG << 8) + newB).toString(16).slice(1); |
| 308 | |
| 309 | return newHexColor; |
| 310 | } |
| 311 | |
| 312 | |
| 313 | const getColorBrightness = (hexColor) => { |
| 314 | if (!hexColor || typeof hexColor !== 'string' || !hexColor.startsWith('#') || hexColor.length < 4) { |
| 315 | return 50; |
| 316 | } |
| 317 | const r = parseInt(hexColor.slice(1, 3), 16); |
| 318 | const g = parseInt(hexColor.slice(3, 5), 16); |
| 319 | const b = parseInt(hexColor.slice(5, 7), 16); |
| 320 | |
| 321 | // Convert the RGB color to HSL |
| 322 | const max = Math.max(r, g, b); |
| 323 | const min = Math.min(r, g, b); |
| 324 | const l = (max + min) / 2; |
| 325 | |
| 326 | // Calculate the brightness position in percentage |
| 327 | const brightnessPercentage = Math.round(l / 255 * 100); |
| 328 | |
| 329 | return brightnessPercentage; |
| 330 | } |
| 331 | |
| 332 | try { |
| 333 | // Access the parent iframe from the nested iframe |
| 334 | var parentIframe = window.parent.frameElement; |
| 335 | |
| 336 | // Check if the parentIframe exists |
| 337 | if (parentIframe) { |
| 338 | // Get the src attribute of the parent iframe |
| 339 | var parentSrc = parentIframe.getAttribute("src"); |
| 340 | |
| 341 | // Extract the data attribute from the src (assuming it's in the query string) |
| 342 | var dataUrlParams = new URLSearchParams(new URL(parentSrc).search); |
| 343 | var dataKey = dataUrlParams.get('key'); |
| 344 | var dataFile = dataUrlParams.get('file'); |
| 345 | |
| 346 | var dataParams = atob(dataKey); |
| 347 | |
| 348 | } else { |
| 349 | console.error('Parent iframe not found'); |
| 350 | } |
| 351 | } catch (error) { |
| 352 | console.error('An error occurred:', error); |
| 353 | } |
| 354 | |
| 355 | // Step 2: Create URLSearchParams object |
| 356 | const urlParams = new URLSearchParams(dataParams); |
| 357 | |
| 358 | // Step 3: Convert URLSearchParams to Object |
| 359 | const params = {}; |
| 360 | for (const [key, value] of urlParams.entries()) { |
| 361 | params[key] = (value === 'yes' || value === 'true') ? true : (value === 'no' || value === 'false' ? false : value); |
| 362 | } |
| 363 | |
| 364 | |
| 365 | // Ensure the DOM is fully loaded before manipulating it |
| 366 | if (!(params?.toolbar)) { |
| 367 | document.querySelector(".flip-book .controls")?.remove(); |
| 368 | } |
| 369 | if (!(params?.download)) { |
| 370 | document.querySelector("li.fnav-item.cmdDownload")?.remove(); |
| 371 | document.querySelector("li.fnav-item.cmdPrint")?.remove(); |
| 372 | } |
| 373 | if (!(params?.presentation)) { |
| 374 | document.querySelector("li.fnav-item.cmdFullScreen")?.remove(); |
| 375 | } |
| 376 | if (!(params?.zoom_in)) { |
| 377 | document.querySelector("li.fnav-item.cmdZoomIn")?.remove(); |
| 378 | } |
| 379 | if (!(params?.zoom_out)) { |
| 380 | document.querySelector("li.fnav-item.cmdZoomOut")?.remove(); |
| 381 | } |
| 382 | if (!(params?.fit_view)) { |
| 383 | document.querySelector("li.fnav-item.cmdDefaultZoom")?.remove(); |
| 384 | } |
| 385 | if (!(params?.bookmark)) { |
| 386 | document.querySelector("li.fnav-item.cmdToc")?.remove(); |
| 387 | } |
| 388 | if (!(params?.sound)) { |
| 389 | document.querySelector("li.cmdSounds")?.remove(); |
| 390 | } |
| 391 | |
| 392 | |
| 393 | |
| 394 | const flipBookElement = document.querySelector(".flip-book"); |
| 395 | const controlsElement = document.querySelector(".flip-book .controls"); |
| 396 | |
| 397 | if (params?.flipbook_toolbar_position === 'top') { |
| 398 | if (flipBookElement) { |
| 399 | flipBookElement.classList.add('toolbar-position-top'); |
| 400 | } |
| 401 | if (controlsElement) { |
| 402 | controlsElement.classList.add('toolbar-position-top'); |
| 403 | } |
| 404 | } |
| 405 | else { |
| 406 | if (controlsElement) { |
| 407 | controlsElement.classList.add('toolbar-position-bottom'); |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | |
| 412 | //Create theme mode function |
| 413 | const setThemeMode = (themeMode) => { |
| 414 | const htmlEL = document.getElementsByTagName("html")[0]; |
| 415 | if (htmlEL) { |
| 416 | htmlEL.setAttribute('ep-data-theme', themeMode); |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | |
| 421 | setThemeMode(params.themeMode); |
| 422 | |
| 423 | |
| 424 | const pdfIframeStyle = () => { |
| 425 | const otherhead = document.getElementsByTagName("head")[0]; |
| 426 | |
| 427 | const style = document.createElement("style"); |
| 428 | style.setAttribute('id', 'EBiframeStyleID'); |
| 429 | |
| 430 | let pdfCustomColor = ''; |
| 431 | |
| 432 | if (params.themeMode == 'custom') { |
| 433 | |
| 434 | if (!params.customColor) { |
| 435 | params.customColor = '#38383d'; |
| 436 | } |
| 437 | |
| 438 | let colorBrightness = getColorBrightness(params.customColor); |
| 439 | |
| 440 | let iconsTextsColor = 'white'; |
| 441 | if (colorBrightness > 60) { |
| 442 | iconsTextsColor = 'black'; |
| 443 | } |
| 444 | |
| 445 | pdfCustomColor = `[ep-data-theme=custom] { |
| 446 | --body-bg-color: ${params.customColor}; |
| 447 | --toolbar-bg-color: ${adjustHexColor(params.customColor, 15)}; |
| 448 | --toolbar-icon-color: ${iconsTextsColor}; |
| 449 | --toolbar-active-icon-bg-color: ${adjustHexColor(params.customColor, 25)}; |
| 450 | --toolbar-item-hover-bg-color: ${adjustHexColor(params.customColor, 25)}; |
| 451 | --toolbar-current-page-number-bg-color: ${adjustHexColor(params.customColor, 10)}; |
| 452 | --toolbar-page-number-bg-color: ${adjustHexColor(params.customColor, 20)}; |
| 453 | } |
| 454 | `; |
| 455 | |
| 456 | style.textContent = ` |
| 457 | ${pdfCustomColor} |
| 458 | `; |
| 459 | |
| 460 | |
| 461 | if (otherhead) { |
| 462 | if (document.getElementById("EBiframeStyleID")) { |
| 463 | document.getElementById("EBiframeStyleID").remove(); |
| 464 | } |
| 465 | otherhead.appendChild(style); |
| 466 | } |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | pdfIframeStyle(); |
| 471 | |
| 472 | // Set watermark config in this context from decoded params |
| 473 | // (viewer.html sets it on its own window, but this template may run |
| 474 | // inside the 3D FlipBook's internal iframe — a separate window scope) |
| 475 | if (params.watermark_text) { |
| 476 | window._epWmConfig = { |
| 477 | text: params.watermark_text, |
| 478 | fontSize: parseInt(params.watermark_font_size, 10) || 48, |
| 479 | color: (function() { var c = params.watermark_color; if (c && c.charAt(0) !== '#') c = '#' + c; return c || '#000000'; })(), |
| 480 | opacity: (parseInt(params.watermark_opacity, 10) || 15) / 100, |
| 481 | style: params.watermark_style || 'center' |
| 482 | }; |
| 483 | } |
| 484 | |
| 485 | // Draw watermark on a canvas (standalone for download use) |
| 486 | const _epDrawWmOnCanvas = (canvas, wm) => { |
| 487 | if (!wm || !wm.text) return; |
| 488 | const ctx = canvas.getContext('2d'); |
| 489 | if (!ctx) return; |
| 490 | ctx.save(); |
| 491 | ctx.setTransform(1, 0, 0, 1, 0, 0); |
| 492 | |
| 493 | const hexToRgba = (hex, alpha) => { |
| 494 | if (!hex || hex === 'transparent') return 'rgba(0,0,0,' + alpha + ')'; |
| 495 | hex = hex.replace(/^#/, ''); |
| 496 | if (hex.length === 3) hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]; |
| 497 | if (!/^[0-9A-Fa-f]{6}$/.test(hex)) return 'rgba(0,0,0,' + alpha + ')'; |
| 498 | return 'rgba(' + parseInt(hex.slice(0,2),16) + ',' + parseInt(hex.slice(2,4),16) + ',' + parseInt(hex.slice(4,6),16) + ',' + alpha + ')'; |
| 499 | }; |
| 500 | |
| 501 | ctx.fillStyle = hexToRgba(wm.color, wm.opacity); |
| 502 | ctx.font = 'bold ' + wm.fontSize + 'px sans-serif'; |
| 503 | ctx.textAlign = 'center'; |
| 504 | ctx.textBaseline = 'middle'; |
| 505 | |
| 506 | if (wm.style === 'tiled') { |
| 507 | const tw = ctx.measureText(wm.text).width; |
| 508 | const stepX = tw + 80; |
| 509 | const stepY = wm.fontSize * 3; |
| 510 | const diag = Math.sqrt(canvas.width * canvas.width + canvas.height * canvas.height); |
| 511 | ctx.translate(canvas.width / 2, canvas.height / 2); |
| 512 | ctx.rotate(-Math.PI / 6); |
| 513 | for (let y = -diag; y < diag; y += stepY) { |
| 514 | for (let x = -diag; x < diag; x += stepX) { |
| 515 | ctx.fillText(wm.text, x, y); |
| 516 | } |
| 517 | } |
| 518 | } else { |
| 519 | ctx.translate(canvas.width / 2, canvas.height / 2); |
| 520 | ctx.rotate(-Math.atan2(canvas.height, canvas.width)); |
| 521 | const tw = ctx.measureText(wm.text).width; |
| 522 | const maxW = Math.sqrt(canvas.width * canvas.width + canvas.height * canvas.height) * 0.8; |
| 523 | if (tw > maxW) { |
| 524 | ctx.font = 'bold ' + Math.floor(wm.fontSize * (maxW / tw)) + 'px sans-serif'; |
| 525 | } |
| 526 | ctx.fillText(wm.text, 0, 0); |
| 527 | } |
| 528 | ctx.restore(); |
| 529 | }; |
| 530 | |
| 531 | // Resolve pdfjsLib from current or parent window and load PDF with proper font config |
| 532 | const _epGetPdfjsLib = () => { |
| 533 | return (typeof pdfjsLib !== 'undefined' && pdfjsLib) |
| 534 | || (window.parent && window.parent.pdfjsLib) |
| 535 | || null; |
| 536 | }; |
| 537 | |
| 538 | const _epLoadPdf = (pdfUrl) => { |
| 539 | const lib = _epGetPdfjsLib(); |
| 540 | if (!lib) throw new Error('pdfjsLib not available'); |
| 541 | const docPromise = lib.getDocument({ |
| 542 | url: pdfUrl, |
| 543 | cMapPacked: true, |
| 544 | disableFontFace: true, |
| 545 | isEvalSupported: true |
| 546 | }).promise; |
| 547 | // Timeout: reject if document doesn't load within 30 seconds |
| 548 | const timeout = new Promise((_, reject) => |
| 549 | setTimeout(() => reject(new Error('PDF load timed out')), 30000) |
| 550 | ); |
| 551 | return Promise.race([docPromise, timeout]); |
| 552 | }; |
| 553 | |
| 554 | // Download PDF with watermark baked into pages as JPEG images |
| 555 | const _epWatermarkDownload = async (pdfUrl, wm) => { |
| 556 | const pdf = await _epLoadPdf(pdfUrl); |
| 557 | const numPages = pdf.numPages; |
| 558 | const scale = 2; |
| 559 | const jpgQuality = 0.92; |
| 560 | const pageImages = []; |
| 561 | |
| 562 | for (let i = 1; i <= numPages; i++) { |
| 563 | const page = await pdf.getPage(i); |
| 564 | const vp = page.getViewport({ scale: scale }); |
| 565 | const canvas = document.createElement('canvas'); |
| 566 | canvas.width = vp.width; |
| 567 | canvas.height = vp.height; |
| 568 | const ctx = canvas.getContext('2d'); |
| 569 | await page.render({ canvasContext: ctx, viewport: vp }).promise; |
| 570 | _epDrawWmOnCanvas(canvas, wm); |
| 571 | |
| 572 | const dataUrl = canvas.toDataURL('image/jpeg', jpgQuality); |
| 573 | const raw = atob(dataUrl.split(',')[1]); |
| 574 | const arr = new Uint8Array(raw.length); |
| 575 | for (let j = 0; j < raw.length; j++) arr[j] = raw.charCodeAt(j); |
| 576 | pageImages.push({ jpeg: arr, w: vp.width / scale, h: vp.height / scale }); |
| 577 | } |
| 578 | |
| 579 | // Build minimal PDF with JPEG images |
| 580 | const enc = new TextEncoder(); |
| 581 | const parts = []; |
| 582 | const offsets = []; |
| 583 | |
| 584 | function writeStr(s) { parts.push(enc.encode(s)); } |
| 585 | function writeBytes(b) { parts.push(b); } |
| 586 | function currentSize() { return parts.reduce((a, p) => a + p.length, 0); } |
| 587 | |
| 588 | const nl = '\n'; |
| 589 | writeStr('%PDF-1.4' + nl); |
| 590 | |
| 591 | offsets[1] = currentSize(); |
| 592 | writeStr('1 0 obj' + nl + '<< /Type /Catalog /Pages 2 0 R >>' + nl + 'endobj' + nl); |
| 593 | |
| 594 | let nextObj = 3; |
| 595 | const pageObjNumbers = []; |
| 596 | const allPageData = []; |
| 597 | |
| 598 | for (let i = 0; i < pageImages.length; i++) { |
| 599 | const pg = pageImages[i]; |
| 600 | const ptW = (pg.w * 72 / 96).toFixed(2); |
| 601 | const ptH = (pg.h * 72 / 96).toFixed(2); |
| 602 | const imgObj = nextObj++; |
| 603 | const contObj = nextObj++; |
| 604 | const pgObj = nextObj++; |
| 605 | pageObjNumbers.push(pgObj); |
| 606 | const contentStr = 'q ' + ptW + ' 0 0 ' + ptH + ' 0 0 cm /Im0 Do Q'; |
| 607 | const contentBytes = enc.encode(contentStr); |
| 608 | allPageData.push({ imgObj, contObj, pgObj, ptW, ptH, jpeg: pg.jpeg, contentBytes, pgIndex: i }); |
| 609 | } |
| 610 | |
| 611 | offsets[2] = currentSize(); |
| 612 | writeStr('2 0 obj' + nl + '<< /Type /Pages /Kids [' + pageObjNumbers.map(n => n + ' 0 R').join(' ') + '] /Count ' + pageImages.length + ' >>' + nl + 'endobj' + nl); |
| 613 | |
| 614 | for (const pd of allPageData) { |
| 615 | const pg = pageImages[pd.pgIndex]; |
| 616 | |
| 617 | offsets[pd.imgObj] = currentSize(); |
| 618 | writeStr(pd.imgObj + ' 0 obj' + nl + |
| 619 | '<< /Type /XObject /Subtype /Image /Width ' + (pg.w * 2) + |
| 620 | ' /Height ' + (pg.h * 2) + |
| 621 | ' /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ' + pd.jpeg.length + ' >>' + nl + |
| 622 | 'stream' + nl); |
| 623 | writeBytes(pd.jpeg); |
| 624 | writeStr(nl + 'endstream' + nl + 'endobj' + nl); |
| 625 | |
| 626 | offsets[pd.contObj] = currentSize(); |
| 627 | writeStr(pd.contObj + ' 0 obj' + nl + |
| 628 | '<< /Length ' + pd.contentBytes.length + ' >>' + nl + |
| 629 | 'stream' + nl); |
| 630 | writeBytes(pd.contentBytes); |
| 631 | writeStr(nl + 'endstream' + nl + 'endobj' + nl); |
| 632 | |
| 633 | offsets[pd.pgObj] = currentSize(); |
| 634 | writeStr(pd.pgObj + ' 0 obj' + nl + |
| 635 | '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ' + pd.ptW + ' ' + pd.ptH + ']' + |
| 636 | ' /Contents ' + pd.contObj + ' 0 R' + |
| 637 | ' /Resources << /XObject << /Im0 ' + pd.imgObj + ' 0 R >> >> >>' + nl + 'endobj' + nl); |
| 638 | } |
| 639 | |
| 640 | const xrefOffset = currentSize(); |
| 641 | writeStr('xref' + nl + '0 ' + nextObj + nl); |
| 642 | writeStr('0000000000 65535 f ' + nl); |
| 643 | for (let i = 1; i < nextObj; i++) { |
| 644 | writeStr(String(offsets[i]).padStart(10, '0') + ' 00000 n ' + nl); |
| 645 | } |
| 646 | writeStr('trailer' + nl + '<< /Size ' + nextObj + ' /Root 1 0 R >>' + nl); |
| 647 | writeStr('startxref' + nl + xrefOffset + nl + '%%EOF'); |
| 648 | |
| 649 | const totalLen = parts.reduce((a, p) => a + p.length, 0); |
| 650 | const result = new Uint8Array(totalLen); |
| 651 | let pos = 0; |
| 652 | for (const p of parts) { result.set(p, pos); pos += p.length; } |
| 653 | |
| 654 | const blob = new Blob([result], { type: 'application/pdf' }); |
| 655 | const url = URL.createObjectURL(blob); |
| 656 | const link = document.createElement('a'); |
| 657 | link.href = url; |
| 658 | link.download = pdfUrl.split('/').pop() || 'document.pdf'; |
| 659 | document.body.appendChild(link); |
| 660 | link.click(); |
| 661 | document.body.removeChild(link); |
| 662 | setTimeout(() => URL.revokeObjectURL(url), 5000); |
| 663 | }; |
| 664 | |
| 665 | const DownloadPDF = (pdfUrl) => { |
| 666 | // If watermark is configured, render watermarked version |
| 667 | if (window._epWmConfig && window._epWmConfig.text) { |
| 668 | _epWatermarkDownload(pdfUrl, window._epWmConfig) |
| 669 | .catch(error => { |
| 670 | console.error('EmbedPress: Watermarked download failed, falling back to original', error); |
| 671 | _epOriginalDownload(pdfUrl); |
| 672 | }); |
| 673 | return; |
| 674 | } |
| 675 | _epOriginalDownload(pdfUrl); |
| 676 | }; |
| 677 | |
| 678 | const _epOriginalDownload = (pdfUrl) => { |
| 679 | const fileName = pdfUrl.split('/').pop(); |
| 680 | |
| 681 | fetch(pdfUrl) |
| 682 | .then(response => response.blob()) |
| 683 | .then(blob => { |
| 684 | const url = URL.createObjectURL(blob); |
| 685 | const link = document.createElement('a'); |
| 686 | link.href = url; |
| 687 | link.download = fileName; |
| 688 | document.body.appendChild(link); |
| 689 | link.click(); |
| 690 | document.body.removeChild(link); |
| 691 | URL.revokeObjectURL(url); |
| 692 | }) |
| 693 | .catch(error => console.error('Error downloading the PDF:', error)); |
| 694 | }; |
| 695 | |
| 696 | document.getElementById('download-pdf').addEventListener('click', function (e) { |
| 697 | e.preventDefault(); |
| 698 | DownloadPDF(dataFile); |
| 699 | }); |
| 700 | |
| 701 | // Print with watermark support using a hidden iframe (no popup window) |
| 702 | const _epWatermarkPrint = (pdfUrl, wm) => { |
| 703 | return _epLoadPdf(pdfUrl).then(function (pdf) { |
| 704 | var numPages = pdf.numPages; |
| 705 | var scale = 2; |
| 706 | var chain = Promise.resolve(); |
| 707 | var pageDataUrls = []; |
| 708 | |
| 709 | for (var i = 1; i <= numPages; i++) { |
| 710 | (function (pageNum) { |
| 711 | chain = chain.then(function () { |
| 712 | return pdf.getPage(pageNum).then(function (page) { |
| 713 | var vp = page.getViewport({ scale: scale }); |
| 714 | var canvas = document.createElement('canvas'); |
| 715 | canvas.width = vp.width; |
| 716 | canvas.height = vp.height; |
| 717 | var ctx = canvas.getContext('2d'); |
| 718 | return page.render({ canvasContext: ctx, viewport: vp }).promise.then(function () { |
| 719 | _epDrawWmOnCanvas(canvas, wm); |
| 720 | pageDataUrls.push(canvas.toDataURL('image/jpeg', 0.92)); |
| 721 | }); |
| 722 | }); |
| 723 | }); |
| 724 | })(i); |
| 725 | } |
| 726 | |
| 727 | return chain.then(function () { |
| 728 | var imgs = pageDataUrls.map(function (dataUrl) { |
| 729 | return '<img src="' + dataUrl + '" style="width:100%;height:auto;page-break-after:always;display:block;" />'; |
| 730 | }).join(''); |
| 731 | |
| 732 | // Use a hidden iframe to trigger the print dialog directly |
| 733 | var iframe = document.createElement('iframe'); |
| 734 | iframe.style.cssText = 'position:fixed;left:-9999px;width:0;height:0;border:none;'; |
| 735 | document.body.appendChild(iframe); |
| 736 | |
| 737 | var doc = iframe.contentDocument || iframe.contentWindow.document; |
| 738 | doc.open(); |
| 739 | doc.write( |
| 740 | '<!DOCTYPE html><html><head><meta charset="utf-8"><title>Print</title>' + |
| 741 | '<style>*{margin:0;padding:0}img{width:100%;height:auto;display:block;page-break-after:always}img:last-child{page-break-after:auto}</style>' + |
| 742 | '</head><body>' + imgs + '</body></html>' |
| 743 | ); |
| 744 | doc.close(); |
| 745 | |
| 746 | // Wait for images to load, then print |
| 747 | var images = doc.querySelectorAll('img'); |
| 748 | var loaded = 0; |
| 749 | var total = images.length; |
| 750 | |
| 751 | var triggerPrint = function () { |
| 752 | iframe.contentWindow.focus(); |
| 753 | iframe.contentWindow.print(); |
| 754 | // Clean up after print dialog closes |
| 755 | setTimeout(function () { |
| 756 | document.body.removeChild(iframe); |
| 757 | }, 1000); |
| 758 | }; |
| 759 | |
| 760 | if (total === 0) { triggerPrint(); return; } |
| 761 | for (var j = 0; j < total; j++) { |
| 762 | images[j].onload = images[j].onerror = function () { |
| 763 | if (++loaded >= total) triggerPrint(); |
| 764 | }; |
| 765 | } |
| 766 | }); |
| 767 | }); |
| 768 | }; |
| 769 | |
| 770 | // Override cmdPrint button when watermark is configured |
| 771 | const printBtn = document.querySelector('li.fnav-item.cmdPrint a'); |
| 772 | if (printBtn && window._epWmConfig && window._epWmConfig.text) { |
| 773 | var _epPrintBusy = false; |
| 774 | printBtn.addEventListener('click', function (e) { |
| 775 | if (_epPrintBusy) return; // let default 3D FlipBook handler run on fallback re-click |
| 776 | e.preventDefault(); |
| 777 | e.stopImmediatePropagation(); |
| 778 | _epPrintBusy = true; |
| 779 | _epWatermarkPrint(dataFile, window._epWmConfig) |
| 780 | .catch(function (err) { |
| 781 | console.error('EmbedPress: Watermarked print failed, falling back to default', err); |
| 782 | // Re-trigger click without our interception so 3D FlipBook handles it |
| 783 | _epPrintBusy = true; |
| 784 | printBtn.click(); |
| 785 | }) |
| 786 | .finally(function () { |
| 787 | _epPrintBusy = false; |
| 788 | }); |
| 789 | }, true); |
| 790 | } |
| 791 | |
| 792 | </script> |