MCPcopy Index your code
hub / github.com/webodf/ViewerJS / PDFViewerPlugin

Function PDFViewerPlugin

PDFViewerPlugin.js:28–374  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26
27
28function PDFViewerPlugin() {
29 "use strict";
30
31 function loadScript(path, callback) {
32 var script = document.createElement('script');
33 script.async = false;
34 script.src = path;
35 script.type = 'text/javascript';
36 script.onload = callback || script.onload;
37 document.getElementsByTagName('head')[0].appendChild(script);
38 }
39
40 function init(callback) {
41 var pluginCSS;
42
43 loadScript('./compatibility.js', function () {
44 loadScript('./pdf.js');
45 loadScript('./ui_utils.js');
46 loadScript('./text_layer_builder.js');
47 loadScript('./pdfjsversion.js', callback);
48 });
49
50 pluginCSS = /**@type{!HTMLStyleElement}*/(document.createElementNS(document.head.namespaceURI, 'style'));
51 pluginCSS.setAttribute('media', 'screen, print, handheld, projection');
52 pluginCSS.setAttribute('type', 'text/css');
53 pluginCSS.appendChild(document.createTextNode(PDFViewerPlugin_css));
54 document.head.appendChild(pluginCSS);
55 }
56
57 var self = this,
58 pages = [],
59 domPages = [],
60 pageText = [],
61 renderingStates = [],
62 RENDERING = {
63 BLANK: 0,
64 RUNNING: 1,
65 FINISHED: 2,
66 RUNNINGOUTDATED: 3
67 },
68 TEXT_LAYER_RENDER_DELAY = 200, // ms
69 container = null,
70 pdfDocument = null,
71 pageViewScroll = null,
72 isGuessedSlideshow = true, // assume true as default, any non-matching page will unset this
73 isPresentationMode = false,
74 scale = 1,
75 currentPage = 1,
76 maxPageWidth = 0,
77 maxPageHeight = 0,
78 createdPageCount = 0;
79
80 function scrollIntoView(elem) {
81 elem.parentNode.scrollTop = elem.offsetTop;
82 }
83
84 function isScrolledIntoView(elem) {
85 if (elem.style.display === "none") {

Callers

nothing calls this directly

Calls 5

updatePageDimensionsFunction · 0.85
isScrolledIntoViewFunction · 0.85
ensurePageRenderedFunction · 0.85
scrollIntoViewFunction · 0.85
initFunction · 0.70

Tested by

no test coverage detected