diff --git a/static/pdf.js/debugger.css b/static/pdf.js/debugger.css new file mode 100644 index 000000000..c66160dd7 --- /dev/null +++ b/static/pdf.js/debugger.css @@ -0,0 +1,111 @@ +/* Copyright 2014 Mozilla Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +:root { + --panel-width: 300px; +} + +#PDFBug, +#PDFBug :is(input, button, select) { + font: message-box; +} +#PDFBug { + background-color: rgba(255, 255, 255, 1); + border: 1px solid rgba(102, 102, 102, 1); + position: fixed; + top: 32px; + right: 0; + bottom: 0; + font-size: 10px; + padding: 0; + width: var(--panel-width); +} +#PDFBug .controls { + background: rgba(238, 238, 238, 1); + border-bottom: 1px solid rgba(102, 102, 102, 1); + padding: 3px; +} +#PDFBug .panels { + inset: 27px 0 0; + overflow: auto; + position: absolute; +} +#PDFBug .panels > div { + padding: 5px; +} +#PDFBug button.active { + font-weight: bold; +} +.debuggerShowText, +.debuggerHideText:hover { + background-color: rgba(255, 255, 0, 1); +} +#PDFBug .stats { + font-family: courier; + font-size: 10px; + white-space: pre; +} +#PDFBug .stats .title { + font-weight: bold; +} +#PDFBug table { + font-size: 10px; + white-space: pre; +} +#PDFBug table.showText { + border-collapse: collapse; + text-align: center; +} +#PDFBug table.showText, +#PDFBug table.showText :is(tr, td) { + border: 1px solid black; + padding: 1px; +} +#PDFBug table.showText td.advance { + color: grey; +} + +#viewer.textLayer-visible .textLayer { + opacity: 1; +} + +#viewer.textLayer-visible .canvasWrapper { + background-color: rgba(128, 255, 128, 1); +} + +#viewer.textLayer-visible .canvasWrapper canvas { + mix-blend-mode: screen; +} + +#viewer.textLayer-visible .textLayer span { + background-color: rgba(255, 255, 0, 0.1); + color: rgba(0, 0, 0, 1); + border: solid 1px rgba(255, 0, 0, 0.5); + box-sizing: border-box; +} + +#viewer.textLayer-visible .textLayer span[aria-owns] { + background-color: rgba(255, 0, 0, 0.3); +} + +#viewer.textLayer-hover .textLayer span:hover { + background-color: rgba(255, 255, 255, 1); + color: rgba(0, 0, 0, 1); +} + +#viewer.textLayer-shadow .textLayer span { + background-color: rgba(255, 255, 255, 0.6); + color: rgba(0, 0, 0, 1); +} diff --git a/static/pdf.js/debugger.js b/static/pdf.js/debugger.js index 19d29163d..9160f840f 100644 --- a/static/pdf.js/debugger.js +++ b/static/pdf.js/debugger.js @@ -12,45 +12,48 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* globals PDFJS */ -'use strict'; +const { OPS } = globalThis.pdfjsLib || (await import("pdfjs-lib")); -var FontInspector = (function FontInspectorClosure() { - var fonts; - var active = false; - var fontAttribute = 'data-font-name'; +const opMap = Object.create(null); +for (const key in OPS) { + opMap[OPS[key]] = key; +} + +const FontInspector = (function FontInspectorClosure() { + let fonts; + let active = false; + const fontAttribute = "data-font-name"; function removeSelection() { - var divs = document.querySelectorAll('div[' + fontAttribute + ']'); - for (var i = 0, ii = divs.length; i < ii; ++i) { - var div = divs[i]; - div.className = ''; + const divs = document.querySelectorAll(`span[${fontAttribute}]`); + for (const div of divs) { + div.className = ""; } } function resetSelection() { - var divs = document.querySelectorAll('div[' + fontAttribute + ']'); - for (var i = 0, ii = divs.length; i < ii; ++i) { - var div = divs[i]; - div.className = 'debuggerHideText'; + const divs = document.querySelectorAll(`span[${fontAttribute}]`); + for (const div of divs) { + div.className = "debuggerHideText"; } } function selectFont(fontName, show) { - var divs = document.querySelectorAll('div[' + fontAttribute + '=' + - fontName + ']'); - for (var i = 0, ii = divs.length; i < ii; ++i) { - var div = divs[i]; - div.className = show ? 'debuggerShowText' : 'debuggerHideText'; + const divs = document.querySelectorAll( + `span[${fontAttribute}=${fontName}]` + ); + for (const div of divs) { + div.className = show ? "debuggerShowText" : "debuggerHideText"; } } function textLayerClick(e) { - if (!e.target.dataset.fontName || - e.target.tagName.toUpperCase() !== 'DIV') { + if ( + !e.target.dataset.fontName || + e.target.tagName.toUpperCase() !== "SPAN" + ) { return; } - var fontName = e.target.dataset.fontName; - var selects = document.getElementsByTagName('input'); - for (var i = 0; i < selects.length; ++i) { - var select = selects[i]; + const fontName = e.target.dataset.fontName; + const selects = document.getElementsByTagName("input"); + for (const select of selects) { if (select.dataset.fontName !== fontName) { continue; } @@ -61,23 +64,22 @@ var FontInspector = (function FontInspectorClosure() { } return { // Properties/functions needed by PDFBug. - id: 'FontInspector', - name: 'Font Inspector', + id: "FontInspector", + name: "Font Inspector", panel: null, manager: null, - init: function init() { - var panel = this.panel; - panel.setAttribute('style', 'padding: 5px;'); - var tmp = document.createElement('button'); - tmp.addEventListener('click', resetSelection); - tmp.textContent = 'Refresh'; - panel.appendChild(tmp); + init() { + const panel = this.panel; + const tmp = document.createElement("button"); + tmp.addEventListener("click", resetSelection); + tmp.textContent = "Refresh"; + panel.append(tmp); - fonts = document.createElement('div'); - panel.appendChild(fonts); + fonts = document.createElement("div"); + panel.append(fonts); }, - cleanup: function cleanup() { - fonts.textContent = ''; + cleanup() { + fonts.textContent = ""; }, enabled: false, get active() { @@ -86,202 +88,184 @@ var FontInspector = (function FontInspectorClosure() { set active(value) { active = value; if (active) { - document.body.addEventListener('click', textLayerClick, true); + document.body.addEventListener("click", textLayerClick, true); resetSelection(); } else { - document.body.removeEventListener('click', textLayerClick, true); + document.body.removeEventListener("click", textLayerClick, true); removeSelection(); } }, // FontInspector specific functions. - fontAdded: function fontAdded(fontObj, url) { + fontAdded(fontObj, url) { function properties(obj, list) { - var moreInfo = document.createElement('table'); - for (var i = 0; i < list.length; i++) { - var tr = document.createElement('tr'); - var td1 = document.createElement('td'); - td1.textContent = list[i]; - tr.appendChild(td1); - var td2 = document.createElement('td'); - td2.textContent = obj[list[i]].toString(); - tr.appendChild(td2); - moreInfo.appendChild(tr); + const moreInfo = document.createElement("table"); + for (const entry of list) { + const tr = document.createElement("tr"); + const td1 = document.createElement("td"); + td1.textContent = entry; + tr.append(td1); + const td2 = document.createElement("td"); + td2.textContent = obj[entry].toString(); + tr.append(td2); + moreInfo.append(tr); } return moreInfo; } - var moreInfo = properties(fontObj, ['name', 'type']); - var fontName = fontObj.loadedName; - var font = document.createElement('div'); - var name = document.createElement('span'); + const moreInfo = properties(fontObj, ["name", "type"]); + const fontName = fontObj.loadedName; + const font = document.createElement("div"); + const name = document.createElement("span"); name.textContent = fontName; - var download = document.createElement('a'); + const download = document.createElement("a"); if (url) { - url = /url\(['"]?([^\)"']+)/.exec(url); + url = /url\(['"]?([^)"']+)/.exec(url); download.href = url[1]; } else if (fontObj.data) { - url = URL.createObjectURL(new Blob([fontObj.data], { - type: fontObj.mimeType - })); - download.href = url; + download.href = URL.createObjectURL( + new Blob([fontObj.data], { type: fontObj.mimetype }) + ); } - download.textContent = 'Download'; - var logIt = document.createElement('a'); - logIt.href = ''; - logIt.textContent = 'Log'; - logIt.addEventListener('click', function(event) { + download.textContent = "Download"; + const logIt = document.createElement("a"); + logIt.href = ""; + logIt.textContent = "Log"; + logIt.addEventListener("click", function (event) { event.preventDefault(); console.log(fontObj); }); - var select = document.createElement('input'); - select.setAttribute('type', 'checkbox'); + const select = document.createElement("input"); + select.setAttribute("type", "checkbox"); select.dataset.fontName = fontName; - select.addEventListener('click', (function(select, fontName) { - return (function() { - selectFont(fontName, select.checked); - }); - })(select, fontName)); - font.appendChild(select); - font.appendChild(name); - font.appendChild(document.createTextNode(' ')); - font.appendChild(download); - font.appendChild(document.createTextNode(' ')); - font.appendChild(logIt); - font.appendChild(moreInfo); - fonts.appendChild(font); + select.addEventListener("click", function () { + selectFont(fontName, select.checked); + }); + font.append(select, name, " ", download, " ", logIt, moreInfo); + fonts.append(font); // Somewhat of a hack, should probably add a hook for when the text layer // is done rendering. - setTimeout(function() { + setTimeout(() => { if (this.active) { resetSelection(); } - }.bind(this), 2000); - } + }, 2000); + }, }; })(); // Manages all the page steppers. -var StepperManager = (function StepperManagerClosure() { - var steppers = []; - var stepperDiv = null; - var stepperControls = null; - var stepperChooser = null; - var breakPoints = Object.create(null); +const StepperManager = (function StepperManagerClosure() { + let steppers = []; + let stepperDiv = null; + let stepperControls = null; + let stepperChooser = null; + let breakPoints = Object.create(null); return { // Properties/functions needed by PDFBug. - id: 'Stepper', - name: 'Stepper', + id: "Stepper", + name: "Stepper", panel: null, manager: null, - init: function init() { - var self = this; - this.panel.setAttribute('style', 'padding: 5px;'); - stepperControls = document.createElement('div'); - stepperChooser = document.createElement('select'); - stepperChooser.addEventListener('change', function(event) { + init() { + const self = this; + stepperControls = document.createElement("div"); + stepperChooser = document.createElement("select"); + stepperChooser.addEventListener("change", function (event) { self.selectStepper(this.value); }); - stepperControls.appendChild(stepperChooser); - stepperDiv = document.createElement('div'); - this.panel.appendChild(stepperControls); - this.panel.appendChild(stepperDiv); - if (sessionStorage.getItem('pdfjsBreakPoints')) { - breakPoints = JSON.parse(sessionStorage.getItem('pdfjsBreakPoints')); + stepperControls.append(stepperChooser); + stepperDiv = document.createElement("div"); + this.panel.append(stepperControls, stepperDiv); + if (sessionStorage.getItem("pdfjsBreakPoints")) { + breakPoints = JSON.parse(sessionStorage.getItem("pdfjsBreakPoints")); } }, - cleanup: function cleanup() { - stepperChooser.textContent = ''; - stepperDiv.textContent = ''; + cleanup() { + stepperChooser.textContent = ""; + stepperDiv.textContent = ""; steppers = []; }, enabled: false, active: false, // Stepper specific functions. - create: function create(pageIndex) { - var debug = document.createElement('div'); - debug.id = 'stepper' + pageIndex; - debug.setAttribute('hidden', true); - debug.className = 'stepper'; - stepperDiv.appendChild(debug); - var b = document.createElement('option'); - b.textContent = 'Page ' + (pageIndex + 1); + create(pageIndex) { + const debug = document.createElement("div"); + debug.id = "stepper" + pageIndex; + debug.hidden = true; + debug.className = "stepper"; + stepperDiv.append(debug); + const b = document.createElement("option"); + b.textContent = "Page " + (pageIndex + 1); b.value = pageIndex; - stepperChooser.appendChild(b); - var initBreakPoints = breakPoints[pageIndex] || []; - var stepper = new Stepper(debug, pageIndex, initBreakPoints); + stepperChooser.append(b); + const initBreakPoints = breakPoints[pageIndex] || []; + const stepper = new Stepper(debug, pageIndex, initBreakPoints); steppers.push(stepper); if (steppers.length === 1) { this.selectStepper(pageIndex, false); } return stepper; }, - selectStepper: function selectStepper(pageIndex, selectPanel) { - var i; - pageIndex = pageIndex | 0; + selectStepper(pageIndex, selectPanel) { + pageIndex |= 0; if (selectPanel) { this.manager.selectPanel(this); } - for (i = 0; i < steppers.length; ++i) { - var stepper = steppers[i]; - if (stepper.pageIndex === pageIndex) { - stepper.panel.removeAttribute('hidden'); - } else { - stepper.panel.setAttribute('hidden', true); - } + for (const stepper of steppers) { + stepper.panel.hidden = stepper.pageIndex !== pageIndex; } - var options = stepperChooser.options; - for (i = 0; i < options.length; ++i) { - var option = options[i]; + for (const option of stepperChooser.options) { option.selected = (option.value | 0) === pageIndex; } }, - saveBreakPoints: function saveBreakPoints(pageIndex, bps) { + saveBreakPoints(pageIndex, bps) { breakPoints[pageIndex] = bps; - sessionStorage.setItem('pdfjsBreakPoints', JSON.stringify(breakPoints)); - } + sessionStorage.setItem("pdfjsBreakPoints", JSON.stringify(breakPoints)); + }, }; })(); -// The stepper for each page's IRQueue. -var Stepper = (function StepperClosure() { +// The stepper for each page's operatorList. +class Stepper { // Shorter way to create element and optionally set textContent. - function c(tag, textContent) { - var d = document.createElement(tag); + #c(tag, textContent) { + const d = document.createElement(tag); if (textContent) { d.textContent = textContent; } return d; } - var opMap = null; - - function simplifyArgs(args) { - if (typeof args === 'string') { - var MAX_STRING_LENGTH = 75; - return args.length <= MAX_STRING_LENGTH ? args : - args.substr(0, MAX_STRING_LENGTH) + '...'; + #simplifyArgs(args) { + if (typeof args === "string") { + const MAX_STRING_LENGTH = 75; + return args.length <= MAX_STRING_LENGTH + ? args + : args.substring(0, MAX_STRING_LENGTH) + "..."; } - if (typeof args !== 'object' || args === null) { + if (typeof args !== "object" || args === null) { return args; } - if ('length' in args) { // array - var simpleArgs = [], i, ii; - var MAX_ITEMS = 10; + if ("length" in args) { + // array + const MAX_ITEMS = 10, + simpleArgs = []; + let i, ii; for (i = 0, ii = Math.min(MAX_ITEMS, args.length); i < ii; i++) { - simpleArgs.push(simplifyArgs(args[i])); + simpleArgs.push(this.#simplifyArgs(args[i])); } if (i < args.length) { - simpleArgs.push('...'); + simpleArgs.push("..."); } return simpleArgs; } - var simpleObj = {}; - for (var key in args) { - simpleObj[key] = simplifyArgs(args[key]); + const simpleObj = {}; + for (const key in args) { + simpleObj[key] = this.#simplifyArgs(args[key]); } return simpleObj; } - function Stepper(panel, pageIndex, initialBreakPoints) { + constructor(panel, pageIndex, initialBreakPoints) { this.panel = panel; this.breakPoint = 0; this.nextBreakPoint = null; @@ -289,164 +273,175 @@ var Stepper = (function StepperClosure() { this.breakPoints = initialBreakPoints; this.currentIdx = -1; this.operatorListIdx = 0; + this.indentLevel = 0; } - Stepper.prototype = { - init: function init() { - var panel = this.panel; - var content = c('div', 'c=continue, s=step'); - var table = c('table'); - content.appendChild(table); - table.cellSpacing = 0; - var headerRow = c('tr'); - table.appendChild(headerRow); - headerRow.appendChild(c('th', 'Break')); - headerRow.appendChild(c('th', 'Idx')); - headerRow.appendChild(c('th', 'fn')); - headerRow.appendChild(c('th', 'args')); - panel.appendChild(content); - this.table = table; - if (!opMap) { - opMap = Object.create(null); - for (var key in PDFJS.OPS) { - opMap[PDFJS.OPS[key]] = key; - } + + init(operatorList) { + const panel = this.panel; + const content = this.#c("div", "c=continue, s=step"); + const table = this.#c("table"); + content.append(table); + table.cellSpacing = 0; + const headerRow = this.#c("tr"); + table.append(headerRow); + headerRow.append( + this.#c("th", "Break"), + this.#c("th", "Idx"), + this.#c("th", "fn"), + this.#c("th", "args") + ); + panel.append(content); + this.table = table; + this.updateOperatorList(operatorList); + } + + updateOperatorList(operatorList) { + const self = this; + + function cboxOnClick() { + const x = +this.dataset.idx; + if (this.checked) { + self.breakPoints.push(x); + } else { + self.breakPoints.splice(self.breakPoints.indexOf(x), 1); } - }, - updateOperatorList: function updateOperatorList(operatorList) { - var self = this; + StepperManager.saveBreakPoints(self.pageIndex, self.breakPoints); + } - function cboxOnClick() { - var x = +this.dataset.idx; - if (this.checked) { - self.breakPoints.push(x); - } else { - self.breakPoints.splice(self.breakPoints.indexOf(x), 1); - } - StepperManager.saveBreakPoints(self.pageIndex, self.breakPoints); - } + const MAX_OPERATORS_COUNT = 15000; + if (this.operatorListIdx > MAX_OPERATORS_COUNT) { + return; + } - var MAX_OPERATORS_COUNT = 15000; - if (this.operatorListIdx > MAX_OPERATORS_COUNT) { - return; - } + const chunk = document.createDocumentFragment(); + const operatorsToDisplay = Math.min( + MAX_OPERATORS_COUNT, + operatorList.fnArray.length + ); + for (let i = this.operatorListIdx; i < operatorsToDisplay; i++) { + const line = this.#c("tr"); + line.className = "line"; + line.dataset.idx = i; + chunk.append(line); + const checked = this.breakPoints.includes(i); + const args = operatorList.argsArray[i] || []; - var chunk = document.createDocumentFragment(); - var operatorsToDisplay = Math.min(MAX_OPERATORS_COUNT, - operatorList.fnArray.length); - for (var i = this.operatorListIdx; i < operatorsToDisplay; i++) { - var line = c('tr'); - line.className = 'line'; - line.dataset.idx = i; - chunk.appendChild(line); - var checked = this.breakPoints.indexOf(i) !== -1; - var args = operatorList.argsArray[i] || []; + const breakCell = this.#c("td"); + const cbox = this.#c("input"); + cbox.type = "checkbox"; + cbox.className = "points"; + cbox.checked = checked; + cbox.dataset.idx = i; + cbox.onclick = cboxOnClick; - var breakCell = c('td'); - var cbox = c('input'); - cbox.type = 'checkbox'; - cbox.className = 'points'; - cbox.checked = checked; - cbox.dataset.idx = i; - cbox.onclick = cboxOnClick; - - breakCell.appendChild(cbox); - line.appendChild(breakCell); - line.appendChild(c('td', i.toString())); - var fn = opMap[operatorList.fnArray[i]]; - var decArgs = args; - if (fn === 'showText') { - var glyphs = args[0]; - var newArgs = []; - var str = []; - for (var j = 0; j < glyphs.length; j++) { - var glyph = glyphs[j]; - if (typeof glyph === 'object' && glyph !== null) { - str.push(glyph.fontChar); - } else { - if (str.length > 0) { - newArgs.push(str.join('')); - str = []; - } - newArgs.push(glyph); // null or number - } + breakCell.append(cbox); + line.append(breakCell, this.#c("td", i.toString())); + const fn = opMap[operatorList.fnArray[i]]; + let decArgs = args; + if (fn === "showText") { + const glyphs = args[0]; + const charCodeRow = this.#c("tr"); + const fontCharRow = this.#c("tr"); + const unicodeRow = this.#c("tr"); + for (const glyph of glyphs) { + if (typeof glyph === "object" && glyph !== null) { + charCodeRow.append(this.#c("td", glyph.originalCharCode)); + fontCharRow.append(this.#c("td", glyph.fontChar)); + unicodeRow.append(this.#c("td", glyph.unicode)); + } else { + // null or number + const advanceEl = this.#c("td", glyph); + advanceEl.classList.add("advance"); + charCodeRow.append(advanceEl); + fontCharRow.append(this.#c("td")); + unicodeRow.append(this.#c("td")); } - if (str.length > 0) { - newArgs.push(str.join('')); - } - decArgs = [newArgs]; } - line.appendChild(c('td', fn)); - line.appendChild(c('td', JSON.stringify(simplifyArgs(decArgs)))); + decArgs = this.#c("td"); + const table = this.#c("table"); + table.classList.add("showText"); + decArgs.append(table); + table.append(charCodeRow, fontCharRow, unicodeRow); + } else if (fn === "restore" && this.indentLevel > 0) { + this.indentLevel--; } - if (operatorsToDisplay < operatorList.fnArray.length) { - line = c('tr'); - var lastCell = c('td', '...'); - lastCell.colspan = 4; - chunk.appendChild(lastCell); + line.append(this.#c("td", " ".repeat(this.indentLevel * 2) + fn)); + if (fn === "save") { + this.indentLevel++; } - this.operatorListIdx = operatorList.fnArray.length; - this.table.appendChild(chunk); - }, - getNextBreakPoint: function getNextBreakPoint() { - this.breakPoints.sort(function(a, b) { return a - b; }); - for (var i = 0; i < this.breakPoints.length; i++) { - if (this.breakPoints[i] > this.currentIdx) { - return this.breakPoints[i]; - } - } - return null; - }, - breakIt: function breakIt(idx, callback) { - StepperManager.selectStepper(this.pageIndex, true); - var self = this; - var dom = document; - self.currentIdx = idx; - var listener = function(e) { - switch (e.keyCode) { - case 83: // step - dom.removeEventListener('keydown', listener, false); - self.nextBreakPoint = self.currentIdx + 1; - self.goTo(-1); - callback(); - break; - case 67: // continue - dom.removeEventListener('keydown', listener, false); - var breakPoint = self.getNextBreakPoint(); - self.nextBreakPoint = breakPoint; - self.goTo(-1); - callback(); - break; - } - }; - dom.addEventListener('keydown', listener, false); - self.goTo(idx); - }, - goTo: function goTo(idx) { - var allRows = this.panel.getElementsByClassName('line'); - for (var x = 0, xx = allRows.length; x < xx; ++x) { - var row = allRows[x]; - if ((row.dataset.idx | 0) === idx) { - row.style.backgroundColor = 'rgb(251,250,207)'; - row.scrollIntoView(); - } else { - row.style.backgroundColor = null; - } + + if (decArgs instanceof HTMLElement) { + line.append(decArgs); + } else { + line.append(this.#c("td", JSON.stringify(this.#simplifyArgs(decArgs)))); } } - }; - return Stepper; -})(); + if (operatorsToDisplay < operatorList.fnArray.length) { + const lastCell = this.#c("td", "..."); + lastCell.colspan = 4; + chunk.append(lastCell); + } + this.operatorListIdx = operatorList.fnArray.length; + this.table.append(chunk); + } -var Stats = (function Stats() { - var stats = []; + getNextBreakPoint() { + this.breakPoints.sort(function (a, b) { + return a - b; + }); + for (const breakPoint of this.breakPoints) { + if (breakPoint > this.currentIdx) { + return breakPoint; + } + } + return null; + } + + breakIt(idx, callback) { + StepperManager.selectStepper(this.pageIndex, true); + this.currentIdx = idx; + + const listener = evt => { + switch (evt.keyCode) { + case 83: // step + document.removeEventListener("keydown", listener); + this.nextBreakPoint = this.currentIdx + 1; + this.goTo(-1); + callback(); + break; + case 67: // continue + document.removeEventListener("keydown", listener); + this.nextBreakPoint = this.getNextBreakPoint(); + this.goTo(-1); + callback(); + break; + } + }; + document.addEventListener("keydown", listener); + this.goTo(idx); + } + + goTo(idx) { + const allRows = this.panel.getElementsByClassName("line"); + for (const row of allRows) { + if ((row.dataset.idx | 0) === idx) { + row.style.backgroundColor = "rgb(251,250,207)"; + row.scrollIntoView(); + } else { + row.style.backgroundColor = null; + } + } + } +} + +const Stats = (function Stats() { + let stats = []; function clear(node) { - while (node.hasChildNodes()) { - node.removeChild(node.lastChild); - } + node.textContent = ""; // Remove any `node` contents from the DOM. } function getStatIndex(pageNumber) { - for (var i = 0, ii = stats.length; i < ii; ++i) { - if (stats[i].pageNumber === pageNumber) { + for (const [i, stat] of stats.entries()) { + if (stat.pageNumber === pageNumber) { return i; } } @@ -454,165 +449,163 @@ var Stats = (function Stats() { } return { // Properties/functions needed by PDFBug. - id: 'Stats', - name: 'Stats', + id: "Stats", + name: "Stats", panel: null, manager: null, - init: function init() { - this.panel.setAttribute('style', 'padding: 5px;'); - PDFJS.enableStats = true; - }, + init() {}, enabled: false, active: false, // Stats specific functions. - add: function(pageNumber, stat) { + add(pageNumber, stat) { if (!stat) { return; } - var statsIndex = getStatIndex(pageNumber); + const statsIndex = getStatIndex(pageNumber); if (statsIndex !== false) { - var b = stats[statsIndex]; - this.panel.removeChild(b.div); + stats[statsIndex].div.remove(); stats.splice(statsIndex, 1); } - var wrapper = document.createElement('div'); - wrapper.className = 'stats'; - var title = document.createElement('div'); - title.className = 'title'; - title.textContent = 'Page: ' + pageNumber; - var statsDiv = document.createElement('div'); + const wrapper = document.createElement("div"); + wrapper.className = "stats"; + const title = document.createElement("div"); + title.className = "title"; + title.textContent = "Page: " + pageNumber; + const statsDiv = document.createElement("div"); statsDiv.textContent = stat.toString(); - wrapper.appendChild(title); - wrapper.appendChild(statsDiv); - stats.push({ pageNumber: pageNumber, div: wrapper }); - stats.sort(function(a, b) { return a.pageNumber - b.pageNumber; }); + wrapper.append(title, statsDiv); + stats.push({ pageNumber, div: wrapper }); + stats.sort(function (a, b) { + return a.pageNumber - b.pageNumber; + }); clear(this.panel); - for (var i = 0, ii = stats.length; i < ii; ++i) { - this.panel.appendChild(stats[i].div); + for (const entry of stats) { + this.panel.append(entry.div); } }, - cleanup: function () { + cleanup() { stats = []; clear(this.panel); - } + }, }; })(); // Manages all the debugging tools. -var PDFBug = (function PDFBugClosure() { - var panelWidth = 300; - var buttons = []; - var activePanel = null; +class PDFBug { + static #buttons = []; - return { - tools: [ - FontInspector, - StepperManager, - Stats - ], - enable: function(ids) { - var all = false, tools = this.tools; - if (ids.length === 1 && ids[0] === 'all') { - all = true; - } - for (var i = 0; i < tools.length; ++i) { - var tool = tools[i]; - if (all || ids.indexOf(tool.id) !== -1) { - tool.enabled = true; - } - } - if (!all) { - // Sort the tools by the order they are enabled. - tools.sort(function(a, b) { - var indexA = ids.indexOf(a.id); - indexA = indexA < 0 ? tools.length : indexA; - var indexB = ids.indexOf(b.id); - indexB = indexB < 0 ? tools.length : indexB; - return indexA - indexB; - }); - } - }, - init: function init() { - /* - * Basic Layout: - * PDFBug - * Controls - * Panels - * Panel - * Panel - * ... - */ - var ui = document.createElement('div'); - ui.id = 'PDFBug'; + static #activePanel = null; - var controls = document.createElement('div'); - controls.setAttribute('class', 'controls'); - ui.appendChild(controls); + static tools = [FontInspector, StepperManager, Stats]; - var panels = document.createElement('div'); - panels.setAttribute('class', 'panels'); - ui.appendChild(panels); - - var container = document.getElementById('viewerContainer'); - container.appendChild(ui); - container.style.right = panelWidth + 'px'; - - // Initialize all the debugging tools. - var tools = this.tools; - var self = this; - for (var i = 0; i < tools.length; ++i) { - var tool = tools[i]; - var panel = document.createElement('div'); - var panelButton = document.createElement('button'); - panelButton.textContent = tool.name; - panelButton.addEventListener('click', (function(selected) { - return function(event) { - event.preventDefault(); - self.selectPanel(selected); - }; - })(i)); - controls.appendChild(panelButton); - panels.appendChild(panel); - tool.panel = panel; - tool.manager = this; - if (tool.enabled) { - tool.init(); - } else { - panel.textContent = tool.name + ' is disabled. To enable add ' + - ' "' + tool.id + '" to the pdfBug parameter ' + - 'and refresh (seperate multiple by commas).'; - } - buttons.push(panelButton); - } - this.selectPanel(0); - }, - cleanup: function cleanup() { - for (var i = 0, ii = this.tools.length; i < ii; i++) { - if (this.tools[i].enabled) { - this.tools[i].cleanup(); - } - } - }, - selectPanel: function selectPanel(index) { - if (typeof index !== 'number') { - index = this.tools.indexOf(index); - } - if (index === activePanel) { - return; - } - activePanel = index; - var tools = this.tools; - for (var j = 0; j < tools.length; ++j) { - if (j === index) { - buttons[j].setAttribute('class', 'active'); - tools[j].active = true; - tools[j].panel.removeAttribute('hidden'); - } else { - buttons[j].setAttribute('class', ''); - tools[j].active = false; - tools[j].panel.setAttribute('hidden', 'true'); - } + static enable(ids) { + const all = ids.length === 1 && ids[0] === "all"; + const tools = this.tools; + for (const tool of tools) { + if (all || ids.includes(tool.id)) { + tool.enabled = true; } } - }; -})(); + if (!all) { + // Sort the tools by the order they are enabled. + tools.sort(function (a, b) { + let indexA = ids.indexOf(a.id); + indexA = indexA < 0 ? tools.length : indexA; + let indexB = ids.indexOf(b.id); + indexB = indexB < 0 ? tools.length : indexB; + return indexA - indexB; + }); + } + } + + static init(container, ids) { + this.loadCSS(); + this.enable(ids); + /* + * Basic Layout: + * PDFBug + * Controls + * Panels + * Panel + * Panel + * ... + */ + const ui = document.createElement("div"); + ui.id = "PDFBug"; + + const controls = document.createElement("div"); + controls.setAttribute("class", "controls"); + ui.append(controls); + + const panels = document.createElement("div"); + panels.setAttribute("class", "panels"); + ui.append(panels); + + container.append(ui); + container.style.right = "var(--panel-width)"; + + // Initialize all the debugging tools. + for (const tool of this.tools) { + const panel = document.createElement("div"); + const panelButton = document.createElement("button"); + panelButton.textContent = tool.name; + panelButton.addEventListener("click", event => { + event.preventDefault(); + this.selectPanel(tool); + }); + controls.append(panelButton); + panels.append(panel); + tool.panel = panel; + tool.manager = this; + if (tool.enabled) { + tool.init(); + } else { + panel.textContent = + `${tool.name} is disabled. To enable add "${tool.id}" to ` + + "the pdfBug parameter and refresh (separate multiple by commas)."; + } + this.#buttons.push(panelButton); + } + this.selectPanel(0); + } + + static loadCSS() { + const { url } = import.meta; + + const link = document.createElement("link"); + link.rel = "stylesheet"; + link.href = url.replace(/.js$/, ".css"); + + document.head.append(link); + } + + static cleanup() { + for (const tool of this.tools) { + if (tool.enabled) { + tool.cleanup(); + } + } + } + + static selectPanel(index) { + if (typeof index !== "number") { + index = this.tools.indexOf(index); + } + if (index === this.#activePanel) { + return; + } + this.#activePanel = index; + for (const [j, tool] of this.tools.entries()) { + const isActive = j === index; + this.#buttons[j].classList.toggle("active", isActive); + tool.active = isActive; + tool.panel.hidden = !isActive; + } + } +} + +globalThis.FontInspector = FontInspector; +globalThis.StepperManager = StepperManager; +globalThis.Stats = Stats; + +export { PDFBug }; diff --git a/static/pdf.js/embeds.js b/static/pdf.js/embeds.js index d6e52d068..2d2ca536d 100644 --- a/static/pdf.js/embeds.js +++ b/static/pdf.js/embeds.js @@ -3,7 +3,7 @@ Ox.load({ loadCSS: false } }, function() { - var currentPage = PDFView.page; + var currentPage = PDFViewerApplication.page; window.addEventListener('pagechange', function (evt) { var page = evt.pageNumber; if (page && page != currentPage) { @@ -15,13 +15,13 @@ Ox.load({ }); Ox.$parent.bindMessage({ page: function(data) { - if (data.page != PDFView.page) { - PDFView.page = data.page; + if (data.page != PDFViewerApplication.page) { + PDFViewerApplication.page = data.page; } }, pdf: function(data) { - if (PDFView.url != data.pdf) { - PDFView.open(data.pdf); + if (PDFViewerApplication.url != data.pdf) { + PDFViewerApplication.open(data.pdf); } } }); diff --git a/static/pdf.js/images/altText_add.svg b/static/pdf.js/images/altText_add.svg new file mode 100644 index 000000000..3451b536c --- /dev/null +++ b/static/pdf.js/images/altText_add.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/altText_done.svg b/static/pdf.js/images/altText_done.svg new file mode 100644 index 000000000..f54924ebf --- /dev/null +++ b/static/pdf.js/images/altText_done.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/annotation-paperclip.svg b/static/pdf.js/images/annotation-paperclip.svg new file mode 100644 index 000000000..2bed2250a --- /dev/null +++ b/static/pdf.js/images/annotation-paperclip.svg @@ -0,0 +1,6 @@ + + + + diff --git a/static/pdf.js/images/annotation-pushpin.svg b/static/pdf.js/images/annotation-pushpin.svg new file mode 100644 index 000000000..6e0896cf4 --- /dev/null +++ b/static/pdf.js/images/annotation-pushpin.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/static/pdf.js/images/cursor-editorFreeText.svg b/static/pdf.js/images/cursor-editorFreeText.svg new file mode 100644 index 000000000..de2838ef1 --- /dev/null +++ b/static/pdf.js/images/cursor-editorFreeText.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/cursor-editorInk.svg b/static/pdf.js/images/cursor-editorInk.svg new file mode 100644 index 000000000..1dadb5c01 --- /dev/null +++ b/static/pdf.js/images/cursor-editorInk.svg @@ -0,0 +1,4 @@ + + + + diff --git a/static/pdf.js/images/findbarButton-next-rtl.png b/static/pdf.js/images/findbarButton-next-rtl.png deleted file mode 100644 index bef02743f..000000000 Binary files a/static/pdf.js/images/findbarButton-next-rtl.png and /dev/null differ diff --git a/static/pdf.js/images/findbarButton-next-rtl@2x.png b/static/pdf.js/images/findbarButton-next-rtl@2x.png deleted file mode 100644 index 1da6dc949..000000000 Binary files a/static/pdf.js/images/findbarButton-next-rtl@2x.png and /dev/null differ diff --git a/static/pdf.js/images/findbarButton-next.png b/static/pdf.js/images/findbarButton-next.png deleted file mode 100644 index de1d0fc90..000000000 Binary files a/static/pdf.js/images/findbarButton-next.png and /dev/null differ diff --git a/static/pdf.js/images/findbarButton-next.svg b/static/pdf.js/images/findbarButton-next.svg new file mode 100644 index 000000000..8cb39bec6 --- /dev/null +++ b/static/pdf.js/images/findbarButton-next.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/findbarButton-next@2x.png b/static/pdf.js/images/findbarButton-next@2x.png deleted file mode 100644 index 0250307c0..000000000 Binary files a/static/pdf.js/images/findbarButton-next@2x.png and /dev/null differ diff --git a/static/pdf.js/images/findbarButton-previous-rtl.png b/static/pdf.js/images/findbarButton-previous-rtl.png deleted file mode 100644 index de1d0fc90..000000000 Binary files a/static/pdf.js/images/findbarButton-previous-rtl.png and /dev/null differ diff --git a/static/pdf.js/images/findbarButton-previous-rtl@2x.png b/static/pdf.js/images/findbarButton-previous-rtl@2x.png deleted file mode 100644 index 0250307c0..000000000 Binary files a/static/pdf.js/images/findbarButton-previous-rtl@2x.png and /dev/null differ diff --git a/static/pdf.js/images/findbarButton-previous.png b/static/pdf.js/images/findbarButton-previous.png deleted file mode 100644 index bef02743f..000000000 Binary files a/static/pdf.js/images/findbarButton-previous.png and /dev/null differ diff --git a/static/pdf.js/images/findbarButton-previous.svg b/static/pdf.js/images/findbarButton-previous.svg new file mode 100644 index 000000000..b610879da --- /dev/null +++ b/static/pdf.js/images/findbarButton-previous.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/findbarButton-previous@2x.png b/static/pdf.js/images/findbarButton-previous@2x.png deleted file mode 100644 index 1da6dc949..000000000 Binary files a/static/pdf.js/images/findbarButton-previous@2x.png and /dev/null differ diff --git a/static/pdf.js/images/grab.cur b/static/pdf.js/images/grab.cur deleted file mode 100644 index db7ad5aed..000000000 Binary files a/static/pdf.js/images/grab.cur and /dev/null differ diff --git a/static/pdf.js/images/grabbing.cur b/static/pdf.js/images/grabbing.cur deleted file mode 100644 index e0dfd04e4..000000000 Binary files a/static/pdf.js/images/grabbing.cur and /dev/null differ diff --git a/static/pdf.js/images/gv-toolbarButton-download.svg b/static/pdf.js/images/gv-toolbarButton-download.svg new file mode 100644 index 000000000..d56cf3ce7 --- /dev/null +++ b/static/pdf.js/images/gv-toolbarButton-download.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/gv-toolbarButton-openinapp.svg b/static/pdf.js/images/gv-toolbarButton-openinapp.svg new file mode 100644 index 000000000..80ec891aa --- /dev/null +++ b/static/pdf.js/images/gv-toolbarButton-openinapp.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/static/pdf.js/images/loading-dark.svg b/static/pdf.js/images/loading-dark.svg new file mode 100644 index 000000000..fa5269b1a --- /dev/null +++ b/static/pdf.js/images/loading-dark.svg @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/static/pdf.js/images/loading-small.png b/static/pdf.js/images/loading-small.png deleted file mode 100644 index 8831a8058..000000000 Binary files a/static/pdf.js/images/loading-small.png and /dev/null differ diff --git a/static/pdf.js/images/loading-small@2x.png b/static/pdf.js/images/loading-small@2x.png deleted file mode 100644 index b25b4452a..000000000 Binary files a/static/pdf.js/images/loading-small@2x.png and /dev/null differ diff --git a/static/pdf.js/images/loading.svg b/static/pdf.js/images/loading.svg new file mode 100644 index 000000000..0a15ff688 --- /dev/null +++ b/static/pdf.js/images/loading.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/pdf.js/images/secondaryToolbarButton-documentProperties.png b/static/pdf.js/images/secondaryToolbarButton-documentProperties.png deleted file mode 100644 index 40925e25a..000000000 Binary files a/static/pdf.js/images/secondaryToolbarButton-documentProperties.png and /dev/null differ diff --git a/static/pdf.js/images/secondaryToolbarButton-documentProperties.svg b/static/pdf.js/images/secondaryToolbarButton-documentProperties.svg new file mode 100644 index 000000000..dd3917b91 --- /dev/null +++ b/static/pdf.js/images/secondaryToolbarButton-documentProperties.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/secondaryToolbarButton-documentProperties@2x.png b/static/pdf.js/images/secondaryToolbarButton-documentProperties@2x.png deleted file mode 100644 index adb240eaa..000000000 Binary files a/static/pdf.js/images/secondaryToolbarButton-documentProperties@2x.png and /dev/null differ diff --git a/static/pdf.js/images/secondaryToolbarButton-firstPage.png b/static/pdf.js/images/secondaryToolbarButton-firstPage.png deleted file mode 100644 index e68846aa5..000000000 Binary files a/static/pdf.js/images/secondaryToolbarButton-firstPage.png and /dev/null differ diff --git a/static/pdf.js/images/secondaryToolbarButton-firstPage.svg b/static/pdf.js/images/secondaryToolbarButton-firstPage.svg new file mode 100644 index 000000000..f5c917f12 --- /dev/null +++ b/static/pdf.js/images/secondaryToolbarButton-firstPage.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/secondaryToolbarButton-firstPage@2x.png b/static/pdf.js/images/secondaryToolbarButton-firstPage@2x.png deleted file mode 100644 index 3ad8af517..000000000 Binary files a/static/pdf.js/images/secondaryToolbarButton-firstPage@2x.png and /dev/null differ diff --git a/static/pdf.js/images/secondaryToolbarButton-handTool.png b/static/pdf.js/images/secondaryToolbarButton-handTool.png deleted file mode 100644 index cb85a841b..000000000 Binary files a/static/pdf.js/images/secondaryToolbarButton-handTool.png and /dev/null differ diff --git a/static/pdf.js/images/secondaryToolbarButton-handTool.svg b/static/pdf.js/images/secondaryToolbarButton-handTool.svg new file mode 100644 index 000000000..b7073b598 --- /dev/null +++ b/static/pdf.js/images/secondaryToolbarButton-handTool.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/secondaryToolbarButton-handTool@2x.png b/static/pdf.js/images/secondaryToolbarButton-handTool@2x.png deleted file mode 100644 index 5c13f77ff..000000000 Binary files a/static/pdf.js/images/secondaryToolbarButton-handTool@2x.png and /dev/null differ diff --git a/static/pdf.js/images/secondaryToolbarButton-lastPage.png b/static/pdf.js/images/secondaryToolbarButton-lastPage.png deleted file mode 100644 index be763e0c4..000000000 Binary files a/static/pdf.js/images/secondaryToolbarButton-lastPage.png and /dev/null differ diff --git a/static/pdf.js/images/secondaryToolbarButton-lastPage.svg b/static/pdf.js/images/secondaryToolbarButton-lastPage.svg new file mode 100644 index 000000000..c04f65079 --- /dev/null +++ b/static/pdf.js/images/secondaryToolbarButton-lastPage.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/secondaryToolbarButton-lastPage@2x.png b/static/pdf.js/images/secondaryToolbarButton-lastPage@2x.png deleted file mode 100644 index 8570984f2..000000000 Binary files a/static/pdf.js/images/secondaryToolbarButton-lastPage@2x.png and /dev/null differ diff --git a/static/pdf.js/images/secondaryToolbarButton-rotateCcw.png b/static/pdf.js/images/secondaryToolbarButton-rotateCcw.png deleted file mode 100644 index 675d6da2c..000000000 Binary files a/static/pdf.js/images/secondaryToolbarButton-rotateCcw.png and /dev/null differ diff --git a/static/pdf.js/images/secondaryToolbarButton-rotateCcw.svg b/static/pdf.js/images/secondaryToolbarButton-rotateCcw.svg new file mode 100644 index 000000000..da73a1b16 --- /dev/null +++ b/static/pdf.js/images/secondaryToolbarButton-rotateCcw.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/secondaryToolbarButton-rotateCcw@2x.png b/static/pdf.js/images/secondaryToolbarButton-rotateCcw@2x.png deleted file mode 100644 index b9e743122..000000000 Binary files a/static/pdf.js/images/secondaryToolbarButton-rotateCcw@2x.png and /dev/null differ diff --git a/static/pdf.js/images/secondaryToolbarButton-rotateCw.png b/static/pdf.js/images/secondaryToolbarButton-rotateCw.png deleted file mode 100644 index e1c759888..000000000 Binary files a/static/pdf.js/images/secondaryToolbarButton-rotateCw.png and /dev/null differ diff --git a/static/pdf.js/images/secondaryToolbarButton-rotateCw.svg b/static/pdf.js/images/secondaryToolbarButton-rotateCw.svg new file mode 100644 index 000000000..c41ce7365 --- /dev/null +++ b/static/pdf.js/images/secondaryToolbarButton-rotateCw.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/secondaryToolbarButton-rotateCw@2x.png b/static/pdf.js/images/secondaryToolbarButton-rotateCw@2x.png deleted file mode 100644 index cb257b41c..000000000 Binary files a/static/pdf.js/images/secondaryToolbarButton-rotateCw@2x.png and /dev/null differ diff --git a/static/pdf.js/images/secondaryToolbarButton-scrollHorizontal.svg b/static/pdf.js/images/secondaryToolbarButton-scrollHorizontal.svg new file mode 100644 index 000000000..fb440b946 --- /dev/null +++ b/static/pdf.js/images/secondaryToolbarButton-scrollHorizontal.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/secondaryToolbarButton-scrollPage.svg b/static/pdf.js/images/secondaryToolbarButton-scrollPage.svg new file mode 100644 index 000000000..64a9f5007 --- /dev/null +++ b/static/pdf.js/images/secondaryToolbarButton-scrollPage.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/secondaryToolbarButton-scrollVertical.svg b/static/pdf.js/images/secondaryToolbarButton-scrollVertical.svg new file mode 100644 index 000000000..dc7e80520 --- /dev/null +++ b/static/pdf.js/images/secondaryToolbarButton-scrollVertical.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/secondaryToolbarButton-scrollWrapped.svg b/static/pdf.js/images/secondaryToolbarButton-scrollWrapped.svg new file mode 100644 index 000000000..75fe26bcf --- /dev/null +++ b/static/pdf.js/images/secondaryToolbarButton-scrollWrapped.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/secondaryToolbarButton-selectTool.svg b/static/pdf.js/images/secondaryToolbarButton-selectTool.svg new file mode 100644 index 000000000..94d51410d --- /dev/null +++ b/static/pdf.js/images/secondaryToolbarButton-selectTool.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/secondaryToolbarButton-spreadEven.svg b/static/pdf.js/images/secondaryToolbarButton-spreadEven.svg new file mode 100644 index 000000000..ce201e33c --- /dev/null +++ b/static/pdf.js/images/secondaryToolbarButton-spreadEven.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/secondaryToolbarButton-spreadNone.svg b/static/pdf.js/images/secondaryToolbarButton-spreadNone.svg new file mode 100644 index 000000000..e8d487fa3 --- /dev/null +++ b/static/pdf.js/images/secondaryToolbarButton-spreadNone.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/secondaryToolbarButton-spreadOdd.svg b/static/pdf.js/images/secondaryToolbarButton-spreadOdd.svg new file mode 100644 index 000000000..9211a427b --- /dev/null +++ b/static/pdf.js/images/secondaryToolbarButton-spreadOdd.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/shadow.png b/static/pdf.js/images/shadow.png deleted file mode 100644 index 31d3bdb14..000000000 Binary files a/static/pdf.js/images/shadow.png and /dev/null differ diff --git a/static/pdf.js/images/texture.png b/static/pdf.js/images/texture.png deleted file mode 100644 index eb5ccb5ec..000000000 Binary files a/static/pdf.js/images/texture.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-bookmark.png b/static/pdf.js/images/toolbarButton-bookmark.png deleted file mode 100644 index a187be6c9..000000000 Binary files a/static/pdf.js/images/toolbarButton-bookmark.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-bookmark.svg b/static/pdf.js/images/toolbarButton-bookmark.svg new file mode 100644 index 000000000..c4c37c905 --- /dev/null +++ b/static/pdf.js/images/toolbarButton-bookmark.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-bookmark@2x.png b/static/pdf.js/images/toolbarButton-bookmark@2x.png deleted file mode 100644 index 4efbaa675..000000000 Binary files a/static/pdf.js/images/toolbarButton-bookmark@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-currentOutlineItem.svg b/static/pdf.js/images/toolbarButton-currentOutlineItem.svg new file mode 100644 index 000000000..01e67623b --- /dev/null +++ b/static/pdf.js/images/toolbarButton-currentOutlineItem.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-download.png b/static/pdf.js/images/toolbarButton-download.png deleted file mode 100644 index eaab35f09..000000000 Binary files a/static/pdf.js/images/toolbarButton-download.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-download.svg b/static/pdf.js/images/toolbarButton-download.svg new file mode 100644 index 000000000..e2e850adf --- /dev/null +++ b/static/pdf.js/images/toolbarButton-download.svg @@ -0,0 +1,4 @@ + + + + diff --git a/static/pdf.js/images/toolbarButton-download@2x.png b/static/pdf.js/images/toolbarButton-download@2x.png deleted file mode 100644 index 896face45..000000000 Binary files a/static/pdf.js/images/toolbarButton-download@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-editorFreeText.svg b/static/pdf.js/images/toolbarButton-editorFreeText.svg new file mode 100644 index 000000000..e4db3a57c --- /dev/null +++ b/static/pdf.js/images/toolbarButton-editorFreeText.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-editorInk.svg b/static/pdf.js/images/toolbarButton-editorInk.svg new file mode 100644 index 000000000..b579eec7e --- /dev/null +++ b/static/pdf.js/images/toolbarButton-editorInk.svg @@ -0,0 +1,4 @@ + + + + diff --git a/static/pdf.js/images/toolbarButton-editorStamp.svg b/static/pdf.js/images/toolbarButton-editorStamp.svg new file mode 100644 index 000000000..f0469b1b1 --- /dev/null +++ b/static/pdf.js/images/toolbarButton-editorStamp.svg @@ -0,0 +1,8 @@ + + + + + + diff --git a/static/pdf.js/images/toolbarButton-fullscreen.png b/static/pdf.js/images/toolbarButton-fullscreen.png deleted file mode 100644 index fa7309550..000000000 Binary files a/static/pdf.js/images/toolbarButton-fullscreen.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-menuArrow.svg b/static/pdf.js/images/toolbarButton-menuArrow.svg new file mode 100644 index 000000000..82ffeaabb --- /dev/null +++ b/static/pdf.js/images/toolbarButton-menuArrow.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-menuArrows.png b/static/pdf.js/images/toolbarButton-menuArrows.png deleted file mode 100644 index 306eb43b8..000000000 Binary files a/static/pdf.js/images/toolbarButton-menuArrows.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-menuArrows@2x.png b/static/pdf.js/images/toolbarButton-menuArrows@2x.png deleted file mode 100644 index f7570bc0d..000000000 Binary files a/static/pdf.js/images/toolbarButton-menuArrows@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-openFile.png b/static/pdf.js/images/toolbarButton-openFile.png deleted file mode 100644 index b5cf1bd06..000000000 Binary files a/static/pdf.js/images/toolbarButton-openFile.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-openFile.svg b/static/pdf.js/images/toolbarButton-openFile.svg new file mode 100644 index 000000000..e773781d6 --- /dev/null +++ b/static/pdf.js/images/toolbarButton-openFile.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-openFile@2x.png b/static/pdf.js/images/toolbarButton-openFile@2x.png deleted file mode 100644 index 91ab76593..000000000 Binary files a/static/pdf.js/images/toolbarButton-openFile@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-pageDown-rtl.png b/static/pdf.js/images/toolbarButton-pageDown-rtl.png deleted file mode 100644 index 1957f79ab..000000000 Binary files a/static/pdf.js/images/toolbarButton-pageDown-rtl.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-pageDown-rtl@2x.png b/static/pdf.js/images/toolbarButton-pageDown-rtl@2x.png deleted file mode 100644 index 16ebcb8ef..000000000 Binary files a/static/pdf.js/images/toolbarButton-pageDown-rtl@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-pageDown.png b/static/pdf.js/images/toolbarButton-pageDown.png deleted file mode 100644 index 8219ecf83..000000000 Binary files a/static/pdf.js/images/toolbarButton-pageDown.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-pageDown.svg b/static/pdf.js/images/toolbarButton-pageDown.svg new file mode 100644 index 000000000..1fc12e733 --- /dev/null +++ b/static/pdf.js/images/toolbarButton-pageDown.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-pageDown@2x.png b/static/pdf.js/images/toolbarButton-pageDown@2x.png deleted file mode 100644 index 758c01d83..000000000 Binary files a/static/pdf.js/images/toolbarButton-pageDown@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-pageUp-rtl.png b/static/pdf.js/images/toolbarButton-pageUp-rtl.png deleted file mode 100644 index 98e7ce481..000000000 Binary files a/static/pdf.js/images/toolbarButton-pageUp-rtl.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-pageUp-rtl@2x.png b/static/pdf.js/images/toolbarButton-pageUp-rtl@2x.png deleted file mode 100644 index a01b02380..000000000 Binary files a/static/pdf.js/images/toolbarButton-pageUp-rtl@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-pageUp.png b/static/pdf.js/images/toolbarButton-pageUp.png deleted file mode 100644 index fb9daa337..000000000 Binary files a/static/pdf.js/images/toolbarButton-pageUp.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-pageUp.svg b/static/pdf.js/images/toolbarButton-pageUp.svg new file mode 100644 index 000000000..0936b9a57 --- /dev/null +++ b/static/pdf.js/images/toolbarButton-pageUp.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-pageUp@2x.png b/static/pdf.js/images/toolbarButton-pageUp@2x.png deleted file mode 100644 index a5cfd755b..000000000 Binary files a/static/pdf.js/images/toolbarButton-pageUp@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-presentationMode.png b/static/pdf.js/images/toolbarButton-presentationMode.png deleted file mode 100644 index 3ac21244d..000000000 Binary files a/static/pdf.js/images/toolbarButton-presentationMode.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-presentationMode.svg b/static/pdf.js/images/toolbarButton-presentationMode.svg new file mode 100644 index 000000000..901d5672b --- /dev/null +++ b/static/pdf.js/images/toolbarButton-presentationMode.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-presentationMode@2x.png b/static/pdf.js/images/toolbarButton-presentationMode@2x.png deleted file mode 100644 index cada9e791..000000000 Binary files a/static/pdf.js/images/toolbarButton-presentationMode@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-print.png b/static/pdf.js/images/toolbarButton-print.png deleted file mode 100644 index 51275e54b..000000000 Binary files a/static/pdf.js/images/toolbarButton-print.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-print.svg b/static/pdf.js/images/toolbarButton-print.svg new file mode 100644 index 000000000..97a390474 --- /dev/null +++ b/static/pdf.js/images/toolbarButton-print.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-print@2x.png b/static/pdf.js/images/toolbarButton-print@2x.png deleted file mode 100644 index 53d18daf7..000000000 Binary files a/static/pdf.js/images/toolbarButton-print@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-search.png b/static/pdf.js/images/toolbarButton-search.png deleted file mode 100644 index f9b75579b..000000000 Binary files a/static/pdf.js/images/toolbarButton-search.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-search.svg b/static/pdf.js/images/toolbarButton-search.svg new file mode 100644 index 000000000..0cc7ae21a --- /dev/null +++ b/static/pdf.js/images/toolbarButton-search.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-search@2x.png b/static/pdf.js/images/toolbarButton-search@2x.png deleted file mode 100644 index 456b13324..000000000 Binary files a/static/pdf.js/images/toolbarButton-search@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-secondaryToolbarToggle-rtl.png b/static/pdf.js/images/toolbarButton-secondaryToolbarToggle-rtl.png deleted file mode 100644 index 843709527..000000000 Binary files a/static/pdf.js/images/toolbarButton-secondaryToolbarToggle-rtl.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-secondaryToolbarToggle-rtl@2x.png b/static/pdf.js/images/toolbarButton-secondaryToolbarToggle-rtl@2x.png deleted file mode 100644 index 9d9bfa4f6..000000000 Binary files a/static/pdf.js/images/toolbarButton-secondaryToolbarToggle-rtl@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-secondaryToolbarToggle.png b/static/pdf.js/images/toolbarButton-secondaryToolbarToggle.png deleted file mode 100644 index 1f90f83da..000000000 Binary files a/static/pdf.js/images/toolbarButton-secondaryToolbarToggle.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-secondaryToolbarToggle.svg b/static/pdf.js/images/toolbarButton-secondaryToolbarToggle.svg new file mode 100644 index 000000000..cace86372 --- /dev/null +++ b/static/pdf.js/images/toolbarButton-secondaryToolbarToggle.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-secondaryToolbarToggle@2x.png b/static/pdf.js/images/toolbarButton-secondaryToolbarToggle@2x.png deleted file mode 100644 index b066fe5cb..000000000 Binary files a/static/pdf.js/images/toolbarButton-secondaryToolbarToggle@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-sidebarToggle-rtl.png b/static/pdf.js/images/toolbarButton-sidebarToggle-rtl.png deleted file mode 100644 index 6f85ec061..000000000 Binary files a/static/pdf.js/images/toolbarButton-sidebarToggle-rtl.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-sidebarToggle-rtl@2x.png b/static/pdf.js/images/toolbarButton-sidebarToggle-rtl@2x.png deleted file mode 100644 index 291e00679..000000000 Binary files a/static/pdf.js/images/toolbarButton-sidebarToggle-rtl@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-sidebarToggle.png b/static/pdf.js/images/toolbarButton-sidebarToggle.png deleted file mode 100644 index 025dc9040..000000000 Binary files a/static/pdf.js/images/toolbarButton-sidebarToggle.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-sidebarToggle.svg b/static/pdf.js/images/toolbarButton-sidebarToggle.svg new file mode 100644 index 000000000..1d8d0e4b2 --- /dev/null +++ b/static/pdf.js/images/toolbarButton-sidebarToggle.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-sidebarToggle@2x.png b/static/pdf.js/images/toolbarButton-sidebarToggle@2x.png deleted file mode 100644 index 7f834df94..000000000 Binary files a/static/pdf.js/images/toolbarButton-sidebarToggle@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-viewAttachments.png b/static/pdf.js/images/toolbarButton-viewAttachments.png deleted file mode 100644 index fcd0b268a..000000000 Binary files a/static/pdf.js/images/toolbarButton-viewAttachments.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-viewAttachments.svg b/static/pdf.js/images/toolbarButton-viewAttachments.svg new file mode 100644 index 000000000..ab73f6e6e --- /dev/null +++ b/static/pdf.js/images/toolbarButton-viewAttachments.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-viewAttachments@2x.png b/static/pdf.js/images/toolbarButton-viewAttachments@2x.png deleted file mode 100644 index b979e523e..000000000 Binary files a/static/pdf.js/images/toolbarButton-viewAttachments@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-viewLayers.svg b/static/pdf.js/images/toolbarButton-viewLayers.svg new file mode 100644 index 000000000..1d7266826 --- /dev/null +++ b/static/pdf.js/images/toolbarButton-viewLayers.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-viewOutline-rtl.png b/static/pdf.js/images/toolbarButton-viewOutline-rtl.png deleted file mode 100644 index aaa943021..000000000 Binary files a/static/pdf.js/images/toolbarButton-viewOutline-rtl.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-viewOutline-rtl@2x.png b/static/pdf.js/images/toolbarButton-viewOutline-rtl@2x.png deleted file mode 100644 index 3410f70df..000000000 Binary files a/static/pdf.js/images/toolbarButton-viewOutline-rtl@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-viewOutline.png b/static/pdf.js/images/toolbarButton-viewOutline.png deleted file mode 100644 index 976365a50..000000000 Binary files a/static/pdf.js/images/toolbarButton-viewOutline.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-viewOutline.svg b/static/pdf.js/images/toolbarButton-viewOutline.svg new file mode 100644 index 000000000..7ed1bd97f --- /dev/null +++ b/static/pdf.js/images/toolbarButton-viewOutline.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-viewOutline@2x.png b/static/pdf.js/images/toolbarButton-viewOutline@2x.png deleted file mode 100644 index b6a197fdf..000000000 Binary files a/static/pdf.js/images/toolbarButton-viewOutline@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-viewThumbnail.png b/static/pdf.js/images/toolbarButton-viewThumbnail.png deleted file mode 100644 index 584ba5588..000000000 Binary files a/static/pdf.js/images/toolbarButton-viewThumbnail.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-viewThumbnail.svg b/static/pdf.js/images/toolbarButton-viewThumbnail.svg new file mode 100644 index 000000000..040d12326 --- /dev/null +++ b/static/pdf.js/images/toolbarButton-viewThumbnail.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-viewThumbnail@2x.png b/static/pdf.js/images/toolbarButton-viewThumbnail@2x.png deleted file mode 100644 index fb7db9383..000000000 Binary files a/static/pdf.js/images/toolbarButton-viewThumbnail@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-zoomIn.png b/static/pdf.js/images/toolbarButton-zoomIn.png deleted file mode 100644 index 513d081bc..000000000 Binary files a/static/pdf.js/images/toolbarButton-zoomIn.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-zoomIn.svg b/static/pdf.js/images/toolbarButton-zoomIn.svg new file mode 100644 index 000000000..30ec51a2f --- /dev/null +++ b/static/pdf.js/images/toolbarButton-zoomIn.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-zoomIn@2x.png b/static/pdf.js/images/toolbarButton-zoomIn@2x.png deleted file mode 100644 index d5d49d5ff..000000000 Binary files a/static/pdf.js/images/toolbarButton-zoomIn@2x.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-zoomOut.png b/static/pdf.js/images/toolbarButton-zoomOut.png deleted file mode 100644 index 156c26b94..000000000 Binary files a/static/pdf.js/images/toolbarButton-zoomOut.png and /dev/null differ diff --git a/static/pdf.js/images/toolbarButton-zoomOut.svg b/static/pdf.js/images/toolbarButton-zoomOut.svg new file mode 100644 index 000000000..f273b5995 --- /dev/null +++ b/static/pdf.js/images/toolbarButton-zoomOut.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/pdf.js/images/toolbarButton-zoomOut@2x.png b/static/pdf.js/images/toolbarButton-zoomOut@2x.png deleted file mode 100644 index 959e1919d..000000000 Binary files a/static/pdf.js/images/toolbarButton-zoomOut@2x.png and /dev/null differ diff --git a/static/pdf.js/images/treeitem-collapsed-rtl.png b/static/pdf.js/images/treeitem-collapsed-rtl.png deleted file mode 100644 index 1c8b9f701..000000000 Binary files a/static/pdf.js/images/treeitem-collapsed-rtl.png and /dev/null differ diff --git a/static/pdf.js/images/treeitem-collapsed-rtl@2x.png b/static/pdf.js/images/treeitem-collapsed-rtl@2x.png deleted file mode 100644 index 84279368d..000000000 Binary files a/static/pdf.js/images/treeitem-collapsed-rtl@2x.png and /dev/null differ diff --git a/static/pdf.js/images/treeitem-collapsed.png b/static/pdf.js/images/treeitem-collapsed.png deleted file mode 100644 index 06d4d3769..000000000 Binary files a/static/pdf.js/images/treeitem-collapsed.png and /dev/null differ diff --git a/static/pdf.js/images/treeitem-collapsed.svg b/static/pdf.js/images/treeitem-collapsed.svg new file mode 100644 index 000000000..831cddfc8 --- /dev/null +++ b/static/pdf.js/images/treeitem-collapsed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/pdf.js/images/treeitem-collapsed@2x.png b/static/pdf.js/images/treeitem-collapsed@2x.png deleted file mode 100644 index eec1e58c1..000000000 Binary files a/static/pdf.js/images/treeitem-collapsed@2x.png and /dev/null differ diff --git a/static/pdf.js/images/treeitem-expanded.png b/static/pdf.js/images/treeitem-expanded.png deleted file mode 100644 index c8d557351..000000000 Binary files a/static/pdf.js/images/treeitem-expanded.png and /dev/null differ diff --git a/static/pdf.js/images/treeitem-expanded.svg b/static/pdf.js/images/treeitem-expanded.svg new file mode 100644 index 000000000..2d45f0c8d --- /dev/null +++ b/static/pdf.js/images/treeitem-expanded.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/pdf.js/images/treeitem-expanded@2x.png b/static/pdf.js/images/treeitem-expanded@2x.png deleted file mode 100644 index 3b3b6103b..000000000 Binary files a/static/pdf.js/images/treeitem-expanded@2x.png and /dev/null differ diff --git a/static/pdf.js/index.html b/static/pdf.js/index.html index 5b1038315..c99589187 100644 --- a/static/pdf.js/index.html +++ b/static/pdf.js/index.html @@ -20,50 +20,56 @@ Adobe CMap resources are covered by their own copyright but the same license: See https://github.com/adobe-type-tools/cmap-resources --> - + - - - - - - - - - - + PDF.js viewer - - - + + + + + + - - - - + - +
-
- - - +
+
+ + + + +
+
+ +
+
@@ -73,79 +79,171 @@ See https://github.com/adobe-type-tools/cmap-resources
+
+
- + +
+ + + + +
+
+ + + + +
+ +
+ + +
+
+ + + + + + +
@@ -155,81 +253,85 @@ See https://github.com/adobe-type-tools/cmap-resources
-
- -
-
-
- - +
- - - - - - - Current View - -
+
- + + +
+ +
+ +
-
-
-
- -
- -
- - - +
+
+ +
+
+ + +
@@ -241,187 +343,149 @@ See https://github.com/adobe-type-tools/cmap-resources
- - - - - - -
- -
-