1(function () { 2 wisebookcrop = function () { 3 this.init(); 4 }; 5 6 wisebookcrop.prototype = { 7 isCrop: false, 8 cropElem: null, 9 croproadmap: 10 '<div class="jcrop-roadmap-top"></div>' + 11 '<div class="jcrop-roadmap-left"></div>' + 12 '<div class="jcrop-roadmap-magnifying-glass">' + 13 '<div class="jcrop-roadmap-magnifying-line-left"></div>' + 14 ' <div class="jcrop-roadmap-magnifying-line-top"></div>' + 15 '</div>', 16 roadmapTop: null, 17 roadmapLeft: null, 18 roadmapGlass: null, 19 roadmapLine: 0, 20 roadmapMagnifyingLine: 0, 21 22 jcropLib: null, 23 scale: 0, 24 originalImg: null, 25 cropDrawImg: null, 26 originalImgZoom: "", 27 originalParts: {zoom: "", width: 0, height: 0, list: []}, 28 cropImgSize: { 29 width: 0, 30 height: 0 31 }, 32 originalImgSize: { 33 width: 0, 34 height: 0 35 }, 36 37 start_x: 0, 38 start_y: 0, 39 croppointstart: false, 40 isDomImageUrlCORS: false, 41 42 init: function () { 43 this.originalImgZoom = (PARAM.zoominfo["200"].enable) ? "200" : "100"; 44 this.cropElem = $('#crop-space'); 45 this.cropEvent(); 46 }, 47 48 cropEvent: function () { 49 var that = this; 50 51 $(document).keyup(function (e) { 52 if (viewUtils.device === "pc" && PARAM.nowBusy === "crop" && e.keyCode === 27) { 53 that.closeCrop(); 54 } 55 }); 56 57 $(document).bind(viewdefind.CROP_MODE_OPEN, function () { 58 if (PARAM.isZoom) { 59 viewMessageProc.alert(PARAM.viewLang.cropZoomCkMsg, PARAM.viewLang.alertTitle); 60 } else { 61 (!that.isCrop) ? that.refresh() : that.closeCrop(); 62 } 63 }); 64 65 $(document).on(viewdefind.ADDONS_RESIZE, function () { 66 that.cropElem.css('display', 'none'); 67 waitForResizeEvent(function () { 68 if (PARAM.nowBusy === "crop") { 69 that.refresh(true); 70 } 71 }, 500); 72 }); 73 74 $(document).on(viewdefind.PAGE_BEFORE_EVENT, function () { 75 that.originalImg = null; 76 that.closeCrop(); 77 }); 78 79 $(document).on(viewdefind.ZOOM_ANIMATION_END, function () { 80 if (PARAM.nowBusy === "crop" && PARAM.isZoom) { 81 that.closeCrop(); 82 } 83 }); 84 85 $(document).on(viewdefind.CROP_ORIGINALIMG_CREATE, function () { 86 if (that.originalImg != null) { 87 that.setRoadmapGlass(); 88 ADDONS.loadingImgView('none'); 89 } else { 90 that.originalimgCreate(); 91 } 92 }); 93 }, 94 95 cropStartInit: function () { 96 var that = this; 97 //that.jcropLib.ui.holder.find('.crop-target').css({opacity:0.2}); 98 PARAM.wisebook.off('mousemove.wisebook-crop'); 99 this.start_x = 0; 100 this.start_y = 0; 101 this.croppointstart = false;
102 103 if (viewUtils.device === "pc") { 104 PARAM.wisebook.hammer().on('mousemove.wisebook-crop', '.jcrop-tracker', function (e) { 105 var offset = $(this).offset(); 106 107 var x = (e.offsetX === undefined) ? e.pageX - offset.left : e.offsetX, 108 y = (e.offsetY === undefined) ? e.pageY - offset.top : e.offsetY; 109 110 that.roadmapGlassAction(x - that.roadmapMagnifyingLine, y - that.roadmapMagnifyingLine); 111 }); 112 } 113 }, 114 115 checkCORS: function () { 116 if (!this.isCrop) { 117 this.isCrop = true; 118 htmlview.viewActionDisable(); 119 ADDONS.loadingImgView('show'); 120 } 121 if (/(https?:)+[^\s]+[\w]/.test(viewInfo.bookurl)) { 122 var parser = document.createElement('a'); 123 parser.href = viewInfo.bookurl; 124 if (viewInfo.bookshelf_url !== parser.origin) { 125 this.changeUrlToProxyUrl(); 126 return; 127 } 128 } 129 this.openCrop(); 130 return; 131 }, 132 133 changeUrlToProxyUrl: function () { 134 for (var i in PARAM.side.view) { 135 var page = PARAM.side.view[i]; 136 if (page <= 0) { continue; } 137 var pageObj = htmlview._pages[page - 1]; 138 var imageSpaceDom = htmlview.domDisplay[pageObj.countpage].find('.image-space'); 139 var bgImageArr = $(imageSpaceDom).css('background-image').split(','); 140 141 for (var j in bgImageArr){ 142 var url = bgImageArr[j].trim().replace(/("|url\(|\))/g, ''); 143 bgImageArr[j] = "url(/api/imageProxy/?url="+url+")"; 144 } 145 var cssObject = {}; 146 cssObject["background-image"] = bgImageArr.join(", "); 147 $(imageSpaceDom).css(cssObject); 148 } 149 this.openCrop(); 150 }, 151 152 openCrop: function () { 153 this.cropElem.css('display', 'block').html(''); 154 var that = this, 155 objCss = { 156 position: "absolute", 157 width: PARAM.onesizePage, 158 height: PARAM.imageHeight, 159 left: 0 160 }; 161 162 for (var i in PARAM.side.view) { 163 var page = PARAM.side.view[i]; 164 if (page <= 0) { 165 continue; 166 } 167 var pageObj = htmlview._pages[page - 1]; 168 var domDisplay = htmlview.domDisplay[pageObj.countpage]; 169 170 if (!domDisplay) { 171 setTimeout(function () { 172 that.openCrop() 173 }, 10); 174 return false; 175 } 176 177 var imageSpaceDom = domDisplay.find('.image-space').clone(); 178 179 imageSpaceDom.removeClass("image-space").css(objCss); 180 this.cropElem.append(imageSpaceDom); 181 182 $.extend(that.cropImgSize, {width: this.cropElem.width(), height: PARAM.imageHeight}); 183 objCss.left += PARAM.onesizePage; 184 } 185 this.makeCropTarget(this.cropElem[0]); 186 }, 187 188 makeCropTarget: function (target) { 189 function changePosition(c) { 190 var x, y, direct = []; 191 if (that.start_x > c.x) { 192 x = c.x; 193 direct.push("n"); 194 } else if (that.start_x < c.x2) { 195 x = c.x2; 196 direct.push("e"); 197 } 198 199 if (that.start_y > c.y) { 200 y = c.y; 201 direct.push("s"); 202 } else if (that.start_y < c.y2) { 203 y = c.y2; 204 direct.push("w"); 205 } 206 207 return {x: x, y: y, direct: direct}; 208 } 209 210 function cropShow(c) { 211 PARAM.wisebook.off('mousemove.wisebook-crop'); 212 213 if (!that.croppointstart) { 214 that.croppointstart = true; 215 that.start_x = c.x; 216 that.start_y = c.y; 217 } else { 218 var position = changePosition(c); 219 if (position.direct.length <= 0) { 220 return false;
221 } 222 that.roadmapGlassAction(position.x, position.y, position.direct); 223 } 224 } 225 226 function cropSelect(c) { 227 that.start_x = 0; 228 that.start_y = 0; 229 that.croppointstart = false; 230 that.cropDrawImage(c); 231 } 232 233 function cropClear() { 234 that.roadmapGlass.css("display", "none"); 235 that.cropStartInit(); 236 } 237 238 var that = this; 239 html2canvas(target, { 240 letterRendering: true, 241 width: that.cropImgSize.width, 242 height: that.cropImgSize.height 243 }).then(function (canvas) { 244 var cropImage = canvas.toDataURL("image/jpeg"); 245 that.cropElem[0].innerHTML = '<img class="crop-target" src="' + cropImage + '"/>'; 246 that.cropElem.append(that.croproadmap); 247 that.roadmapTop = that.cropElem.find(".jcrop-roadmap-top"); 248 that.roadmapLelf = that.cropElem.find(".jcrop-roadmap-left"); 249 that.roadmapLine = that.roadmapLelf.width(); 250 251 that.roadmapGlass = that.cropElem.find(".jcrop-roadmap-magnifying-glass"); 252 that.roadmapMagnifyingLine = that.cropElem.find(".jcrop-roadmap-magnifying-line-left").width(); 253 254 $(document).trigger(viewdefind.CROP_ORIGINALIMG_CREATE); 255 256 $('#crop-space').find('.crop-target').Jcrop({ 257 bgOpacity: .5, 258 keySupport: false, 259 onChange: cropShow, 260 onSelect: cropSelect, 261 onRelease: cropClear 262 }, function () { 263 that.jcropLib = this; 264 that.cropStartInit(); 265 }); 266 }); 267 }, 268 269 roadmapGlassAction: function (x, y, direct) { 270 if (!this.roadmapGlass) { 271 return false; 272 } 273 274 if (typeof direct !== "undefined") { 275 if (direct[0] === "n" && direct[1] === "w") { 276 this.roadmapLelf.css({left: x - this.roadmapLine}); 277 this.roadmapTop.css({top: y}); 278 } else if (direct[0] === "n" && direct[1] === "s") { 279 this.roadmapLelf.css({left: x - this.roadmapLine}); 280 this.roadmapTop.css({top: y - this.roadmapLine}); 281 } else if (direct[0] === "e" && direct[1] === "s") { 282 this.roadmapLelf.css({left: x}); 283 this.roadmapTop.css({top: y - this.roadmapLine}); 284 } else { 285 this.roadmapLelf.css({left: x}); 286 this.roadmapTop.css({top: y}); 287 } 288 } else { 289 this.roadmapLelf.css({left: x}); 290 this.roadmapTop.css({top: y}); 291 } 292 293 var cropImgSize_w = this.cropImgSize.width; 294 var cropImgSize_h = this.cropImgSize.height; 295 296 297 //var mx = x / this.scale; 298 //var my = y / this.scale; 299 //2022-06-20 WBCLOUD-37 300 //this.scaleã¯ä¿¡ç¨ã§ããªããhtmlview.setScaleãå®ãµã¤ãºã確å®ããåã«è¨ç®ãã¦ããããããªã®ã§ãã®ã¿ã¤ãã³ã°ã§å®ä½ããè¨ç®ããã 301 let scale = $('.wisebook-view-container').height() / this.originalImgSize.height; 302 303 var mx = x / scale; 304 var my = y / scale; 305 306 307 var roadmapGlass_w = this.roadmapGlass.width(); 308 var roadmapGlass_h = this.roadmapGlass.height(); 309 310 var rx = Math.round(mx / this.jcropLib.ui.holder.width() * cropImgSize_w - roadmapGlass_w / 2) * -1; 311 var ry = Math.round(my / this.jcropLib.ui.holder.height() * cropImgSize_h - roadmapGlass_h / 2) * -1; 312 var bgp = rx + "px " + ry + "px"; 313 314 var cssObject = {}, 315 roadmapLine_x = this.roadmapLelf.position().left - this.roadmapLine - roadmapGlass_w, 316 roadmapLine_y = this.roadmapTop.position().top + (this.roadmapLine * 2), 317 lineOffset_left = this.roadmapLelf.position().left, 318 lineOffset_top = this.roadmapTop.position().top; 319 320 if (typeof direct !== "undefined") { 321 if (direct[0] === "e" && direct[1] === "w" || direct[0] === "
321n" && direct[1] === "s") { 322 if ((y + roadmapGlass_h) > PARAM.imageHeight) { 323 cssObject["left"] = lineOffset_left + (this.roadmapLine * 3); 324 cssObject["top"] = lineOffset_top - (this.roadmapLine * 2) - roadmapGlass_h; 325 } else { 326 cssObject["left"] = roadmapLine_x - (this.roadmapLine * 3); 327 cssObject["top"] = roadmapLine_y + this.roadmapLine; 328 } 329 } else if (direct[0] === "n" && direct[1] === "w") { 330 if ((y + roadmapGlass_h) > PARAM.imageHeight) { 331 cssObject["left"] = roadmapLine_x - (this.roadmapLine * 3); 332 cssObject["top"] = lineOffset_top - roadmapGlass_h - (this.roadmapLine * 3); 333 } else { 334 cssObject["left"] = roadmapLine_x - (this.roadmapLine * 3); 335 cssObject["top"] = roadmapLine_y + this.roadmapLine; 336 } 337 } else if (direct[0] === "e" && direct[1] === "s") { 338 if ((y - roadmapGlass_h) < 0) { 339 cssObject["left"] = lineOffset_left + (this.roadmapLine * 3); 340 cssObject["top"] = roadmapLine_y + this.roadmapLine; 341 } else { 342 cssObject["left"] = lineOffset_left + (this.roadmapLine * 3); 343 cssObject["top"] = lineOffset_top - roadmapGlass_h - (this.roadmapLine * 3); 344 } 345 } 346 } else { 347 if ((y + roadmapGlass_h) > PARAM.imageHeight) { 348 cssObject["left"] = lineOffset_left + (this.roadmapLine * 3); 349 cssObject["top"] = lineOffset_top - roadmapGlass_h - (this.roadmapLine * 3); 350 } else { 351 cssObject["left"] = roadmapLine_x - (this.roadmapLine * 3); 352 cssObject["top"] = roadmapLine_y + this.roadmapLine; 353 } 354 } 355 cssObject["background-position"] = rx + "px " + ry + "px"; 356 cssObject["display"] = "block"; 357 this.roadmapGlass.css(cssObject); 358 }, 359 360 setRoadmapGlass: function () { 361 if (this.roadmapGlass) { 362 var cssObject = {"background": 'url(' + this.originalImg + ') no-repeat'}; 363 this.roadmapGlass.css(cssObject); 364 } 365 }, 366 367 originalimgCreate: function () { 368 var that = this, canvasElem, 369 originalsize = {width: 0, height: PARAM.zoominfo[this.originalImgZoom].height}, 370 elementArr = []; 371 372 for (var i in PARAM.side.view) { 373 var page = PARAM.side.view[i]; 374 if (page <= 0) { 375 continue; 376 } 377 378 var pageObj = htmlview._pages[page - 1], 379 img = (this.originalImgZoom === "100") ? pageObj.image[0].srcList : pageObj.image[1].srcList; 380 381 if (img.length !== this.originalParts.list.length) { 382 this.originalPartData(this.originalImgZoom); 383 } 384 385 var originalData = this.makeOriginaldata(pageObj, img, originalsize.width); 386 elementArr.push(originalData); 387 originalsize.width += PARAM.zoominfo[this.originalImgZoom].width; 388 } 389 this.originalImgSize = originalsize; 390 391 var tempIframe = this.createIframe("tmp-element"); 392 var html = this.docType() + "<html><haed></haed>" + this.setBody() + "</html>"; 393 tempIframe.write(html); 394 canvasElem = tempIframe.getElementById('canvas-image-body'); 395 canvasElem = $(canvasElem); 396 397 elementArr.forEach(function (elem) { 398 $(canvasElem).append(elem); 399 }); 400 401 402 html2canvas(canvasElem[0], { 403 letterRendering: true, 404 allowTaint: true, 405 useCORS: true, 406 width: originalsize.width, 407 height: originalsize.height 408 }).then(function (canvas) { 409 that.originalImg = canvas.toDataURL("image/jpeg"); 410 that.setRoadmapGlass(); 411 $('#tmp-element').remove();
412 ADDONS.loadingImgView('none'); 413 //window.open(that.originalImg); 414 }); 415 }, 416 417 originalPartData: function (zoomvalue, index) { 418 var page = (index) ? htmlview._pages[index] : htmlview._pages[0], 419 img, dataPageImgWidth = 0, dataPageImgHeight = 0, 420 imageWidth, imageHeight; 421 422 if (zoomvalue === "200") { 423 dataPageImgWidth = page.image[1].width; 424 dataPageImgHeight = page.image[1].height; 425 imageWidth = PARAM.zoominfo['200'].width; 426 imageHeight = PARAM.zoominfo['200'].height; 427 img = page.image[1].srcList; 428 } else { 429 dataPageImgWidth = page.image[0].width; 430 dataPageImgHeight = page.image[0].height; 431 imageWidth = PARAM.zoominfo['100'].width; 432 imageHeight = PARAM.zoominfo['100'].height; 433 img = page.image[0].srcList; 434 } 435 436 this.originalParts.list = []; 437 438 $.extend(this.originalParts, {zoom: zoomvalue, width: dataPageImgWidth, height: dataPageImgHeight}); 439 440 var w = 0, h = 0, x = 0, y = 0, total = 0; 441 442 for (var i = 0; i < img.length; i++) { 443 w = img[i].width; 444 h = img[i].height; 445 total += w; 446 var pos = { 447 x: x, 448 y: y, 449 width: w, 450 height: h 451 }; 452 453 this.originalParts.list.push(pos); 454 455 if (img.length !== 1) { 456 if (total >= imageWidth) { 457 x = 0; 458 y += h; 459 total = 0; 460 } else { 461 x += w; 462 } 463 } 464 } //for end 465 }, 466 467 makeOriginaldata: function (pageObj, img, leftx) { 468 var x = 0, y = 0, w = 0, h = 0, 469 width = this.originalParts.width, 470 height = this.originalParts.height, 471 parts = this.originalParts.list; 472 473 var bgsize = []; 474 var bgposition = []; 475 var bgrepeat = []; 476 477 //var domDisplay = htmlview.domDisplay[pageObj.number]; 478 var domDisplay = htmlview.domDisplay[pageObj.countpage];//2022-04-21 WISE_HOSYU-1411 479 var bgimage = domDisplay.find('.image-space').css('background-image'); 480 481 for (var i = 0; i < img.length; i++) { 482 if (i === 0) { 483 x = parts[i].x; 484 y = parts[i].y; 485 } 486 bgposition.push(img[i].x + "px" + " " + img[i].y + "px"); 487 bgsize.push(img[i].width + "px" + " " + img[i].height + "px"); 488 bgrepeat.push("no-repeat"); 489 } 490 491 var tmpDom = document.createElement('img'); 492 var cssObject = {}; 493 cssObject["position"] = "absolute"; 494 cssObject["width"] = width; 495 cssObject["height"] = height; 496 cssObject["left"] = leftx; 497 cssObject["top"] = 0; 498 cssObject["display"] = "block"; 499 cssObject["background-image"] = bgimage; 500 cssObject["background-repeat"] = bgrepeat.join(","); 501 cssObject["background-position"] = bgposition.join(","); 502 cssObject["background-size"] = bgsize.join(","); 503 504 return $(tmpDom).css(cssObject); 505 }, 506 507 closeCrop: function (resize) { 508 this.isCrop = false; 509 this.cropElem.css({width: 0, height: 0}).html(""); 510 $('#tmp-element').remove(); 511 512 if (!resize && PARAM.nowBusy === "crop") { 513 ADDONS.busyDestroy(); 514 $('#btn-crop').removeClass("active"); 515 } 516 517 this.cropDrawImg = null; 518 this.roadmapGlass = null; 519 if (this.jcropLib != null) { 520 this.jcropLib.destroy(); 521 this.jcropLib = null; 522 } 523 }, 524 525 cropDrawImage: function (position) { 526 527 //2022-05-25 WISE_HOSYU-1411 528 //this.scaleã¯ä¿¡ç¨ã§ããªããhtmlview.setScaleãå®ãµã¤ãºã確å®ããåã«è¨ç®ãã¦ãããããã
528ªã®ã§ãã®ã¿ã¤ãã³ã°ã§å®ä½ããè¨ç®ããã 529 let scale = $('.wisebook-view-container').height() / this.originalImgSize.height; 530 var img = new Image(); 531 var w = position.w / scale; 532 var h = position.h / scale; 533 var x = position.x / scale; 534 var y = position.y / scale; 535 536 var that=this; 537 538 //2021-05-14 safariã§ã¯img.srcã¸ã®è¨å®ã¯éåæãªã®ã§onloadãå¾ ã¤å¿ è¦ãããã 539 img.onload=function(){ 540 var tempElement = $('<div id="tmp-element" class="crop-tmp-element">').appendTo(document.body); 541 var tempCanvas = $('<canvas width="' + w + '" height="' + h + '" />').appendTo(tempElement); 542 var ctx = tempCanvas[0].getContext("2d"); 543 ctx.drawImage(img, x, y, w, h, 0, 0, w, h); 544 console.log("x=",x); 545 console.log("y=",y); 546 console.log("w=",w); 547 console.log("h=",h); 548 549 that.cropDrawImg = this.cropDrawImg = tempCanvas[0].toDataURL("image/jpeg"); 550 that.downloadCropImg(that.cropDrawImg, PARAM.uniqID() + ".jpg", "image/jpeg"); 551 that.closeCrop(); 552 $("#tmp-element").remove() 553 } 554 img.src = this.originalImg; 555 img.crossOrigin = "Anonymous"; 556 }, 557 558 downloadCropImg: function (data, strFileName, strMimeType) { 559 var self = window, 560 u = "application/octet-stream", 561 m = strMimeType || u, 562 x = data, 563 D = document, 564 a = D.createElement("a"), 565 z = function (a) { 566 return String(a); 567 }, 568 B = (self.Blob || self.MozBlob || self.WebKitBlob || z); 569 B = B.call ? B.bind(self) : Blob; 570 var fn = strFileName || "download", 571 blob, 572 fr; 573 574 if (String(this) === "true") { 575 x = [x, m]; 576 m = x[0]; 577 x = x[1]; 578 } 579 580 if (String(x).match(/^data\:[\w+\-]+\/[\w+\-]+[,;]/)) { 581 return navigator.msSaveBlob ? // IE10 can't do a[download], only Blobs: 582 navigator.msSaveBlob(d2b(x), fn) : 583 saver(x); // everyone else can save dataURLs un-processed 584 } 585 586 blob = x instanceof B ? x : new B([x], {type: m}); 587 588 function d2b(u) { 589 var p = u.split(/[:;,]/), 590 t = p[1], 591 dec = (p[2] === "base64") ? atob : decodeURIComponent, 592 bin = dec(p.pop()), 593 mx = bin.length, 594 uia = new Uint8Array(mx); 595 596 for (var i = 0; i < mx; ++i) { 597 uia[i] = bin.charCodeAt(i); 598 } 599 return new B([uia], {type: t}); 600 } 601 602 function saver(url, winMode) { 603 604 if ('download' in a) { 605 a.href = url; 606 a.setAttribute("download", fn); 607 D.body.appendChild(a); 608 setTimeout(function () { 609 a.click(); 610 D.body.removeChild(a); 611 if (winMode === true) { 612 setTimeout(function () { 613 self.URL.revokeObjectURL(a.href); 614 }, 250); 615 } 616 }, 66); 617 return true; 618 } 619 620 if (typeof safari !== "undefined") { 621 url = "data:" + url.replace(/^data:([\w\/\-\+]+)/, u); 622 if (!window.open(url)) { 623 var stringConfirm = "Displaying New Document\n\nUse Save As... to download, then click back to return to this page."; 624 if (confirm(stringConfirm)) { 625 location.href = url; 626 } 627 } 628 return true; 629 } 630 631 632 var f = D.createElement("iframe"); 633 D.body.appendChild(f); 634 635 if (!winMode) { 636 url = "data:" + url.replace(/^data:([\w\/\-\+]+)/, u); 637 } 638 f.src = url; 639 setTimeout(function () { 640 D.body.removeChild(f); 641 }, 333); 642 } 643 644 if (navigator.msSaveBlob) { // IE10+ : (has Blob, but not a[download] or URL) 645 return navigator.msSaveBlob(blob, fn); 646 } 647 648 if (self.URL) { 649 saver(self.URL.createObjectURL(blob), true); 650 } else { 651 if (typeof blob === "string" || blob.constructor === z) { 652 try { 653 return saver("data:" + m + ";base64," + self.btoa(blob)); 654 } catch (y) { 655 return saver("data:" + m + "," + encodeURIComponent(blob)); 656 } 657 } 658 659 // Blob but not URL: 660 fr = new FileReader(); 661 fr.onload = function (e) { 662 saver(this.result); 663 };
664 fr.readAsDataURL(blob); 665 } 666 667 return true; 668 }, 669 670 createIframe: function (iframeid) { 671 var iframeStyle = 'border:0;position:absolute;left:0px;top:0px;opacity:0;'; 672 673 try { 674 var iframe = document.createElement('iframe'); 675 document.body.appendChild(iframe); 676 $(iframe).attr({style: iframeStyle, id: iframeid}); 677 iframe.doc = null; 678 iframe.doc = iframe.contentDocument ? iframe.contentDocument : (iframe.contentWindow ? iframe.contentWindow.document : iframe.document); 679 } catch (e) { 680 throw e + ". iframes may not be supported in this browser."; 681 } 682 683 return iframe.doc; 684 }, 685 686 docType: function () { 687 return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; 688 }, 689 690 setBody: function () { 691 var imageBody = 692 '<body style="margin: 0;padding: 0;">' + 693 ' <div id="canvas-image-body" style="width:' + this.originalImgSize.width + 'px;height:' + this.originalImgSize.height + 'px;top:0;left:0;position: absolute;"/>' + 694 '</body>'; 695 return imageBody; 696 }, 697 698 refresh: function (resize) { 699 this.scale = htmlview.setScale(this.originalImgZoom); 700 if (PARAM.pagenumShow === 1 && viewUtils.device === 'pc') { 701 this.scale += 0.015; 702 } 703 if (resize && this.isCrop) { 704 this.closeCrop(resize); 705 } 706 707 var widthsize = PARAM.imageWidth, left = 0; 708 if (PARAM.viewMode === 'twopage') { 709 if (PARAM.side.left === 0) { 710 widthsize = PARAM.onesizePage; 711 left = PARAM.side.rightstartx; 712 } else if (PARAM.side.right === 0) { 713 widthsize = PARAM.onesizePage; 714 } 715 } else { 716 widthsize = PARAM.onesizePage; 717 } 718 //onepage setting 719 this.cropElem.css({width: widthsize, height: PARAM.imageHeight, left: left}); 720 this.checkCORS(); 721 } 722 }; 723})();
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.