Compare commits
2 commits
47b348f724
...
a99a3eee7a
Author | SHA1 | Date | |
---|---|---|---|
a99a3eee7a | |||
32a73f402b |
5 changed files with 51 additions and 20 deletions
|
@ -59,7 +59,7 @@ Ox.PDFViewer = function(options, self) {
|
|||
.attr({
|
||||
frameborder: 0,
|
||||
height: self.options.height + 'px',
|
||||
src: self.options.pdfjsURL + '?file=' + encodeURIComponent(self.options.url) + '#page=' + self.options.page,
|
||||
src: self.options.pdfjsURL + '?' + pandora.getVersion() + '&file=' + encodeURIComponent(self.options.url) + '#page=' + self.options.page,
|
||||
width: self.options.width + 'px'
|
||||
})
|
||||
.onMessage(function(data, event) {
|
||||
|
|
|
@ -253,6 +253,7 @@ appPanel
|
|||
});
|
||||
}
|
||||
});
|
||||
window.pandora.getVersion = getPandoraVersion
|
||||
}
|
||||
|
||||
function loadPandoraFiles(callback) {
|
||||
|
|
|
@ -33,9 +33,9 @@ See https://github.com/adobe-type-tools/cmap-resources
|
|||
|
||||
<script src="/static/oxjs/min/Ox.js"></script>
|
||||
<script src="embeds.js"></script>
|
||||
<link rel="stylesheet" href="pandora.css">
|
||||
|
||||
<link rel="stylesheet" href="viewer.css">
|
||||
<link rel="stylesheet" href="pandora.css">
|
||||
|
||||
<script src="viewer.js"></script>
|
||||
</head>
|
||||
|
|
|
@ -20,9 +20,11 @@
|
|||
|
||||
.verticalToolbarSeparator.hiddenMediumView,
|
||||
#print,
|
||||
#secondaryPrint,
|
||||
#openFile,
|
||||
#secondaryOpenFile,
|
||||
#editorModeButtons {
|
||||
display: none;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.page .crop-overlay {
|
||||
|
|
|
@ -29,6 +29,35 @@ embedPage.addEventListener("click", event => {
|
|||
});
|
||||
})
|
||||
|
||||
// secondary menu
|
||||
div.innerHTML = `
|
||||
<button id="secondaryCropFile" class="secondaryToolbarButton visibleMediumView cropFile" title="Crop" tabindex="50" data-l10n-id="crop">
|
||||
<span data-l10n-id="crop_label">Crop</span>
|
||||
</button>
|
||||
`
|
||||
var secondaryCropFile = div.querySelector("#secondaryCropFile")
|
||||
document.querySelector('#secondaryToolbarButtonContainer').insertBefore(
|
||||
secondaryCropFile,
|
||||
document.querySelector('#secondaryToolbarButtonContainer').firstChild
|
||||
)
|
||||
|
||||
div.innerHTML = `
|
||||
<button id="secondaryEmbedPage" class="secondaryToolbarButton visibleMediumView embedPage" title="Embed" tabindex="50" data-l10n-id="embed">
|
||||
<span data-l10n-id="embed_label">Embed</span>
|
||||
</button>
|
||||
`
|
||||
var secondaryEmbedPage = div.querySelector("#secondaryEmbedPage")
|
||||
document.querySelector('#secondaryToolbarButtonContainer').insertBefore(
|
||||
secondaryEmbedPage,
|
||||
document.querySelector('#secondaryToolbarButtonContainer').firstChild
|
||||
)
|
||||
secondaryEmbedPage.addEventListener("click", event => {
|
||||
Ox.$parent.postMessage('embed', {
|
||||
page: PDFViewerApplication.page
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
async function archiveAPI(action, data) {
|
||||
var url = baseUrl + '/api/'
|
||||
var key = JSON.stringify([action, data])
|
||||
|
@ -180,7 +209,8 @@ const addToRecent = obj => {
|
|||
}
|
||||
|
||||
function initOverlay() {
|
||||
document.querySelector('#cropFile').addEventListener('click', event=> {
|
||||
document.querySelectorAll('#cropFile,.secondaryToolbarButton.cropFile').forEach(btn => {
|
||||
btn.addEventListener('click', event=> {
|
||||
if (cropInactive) {
|
||||
event.target.style.background = 'red'
|
||||
cropInactive = false
|
||||
|
@ -195,6 +225,7 @@ function initOverlay() {
|
|||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
var first = true
|
||||
PDFViewerApplication.initializedPromise.then(function() {
|
||||
PDFViewerApplication.pdfViewer.eventBus.on("pagesinit", function(event) {
|
||||
|
@ -222,9 +253,6 @@ function initOverlay() {
|
|||
div.appendChild(overlay)
|
||||
renderCropOverlay(overlay, documentId, page)
|
||||
})
|
||||
PDFViewerApplication.pdfViewer.eventBus.on("pagechanging", function(event) {
|
||||
console.log("pagechanging", event, event.pageNumber.toString())
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue