1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Disable outline button when unavailable

This commit is contained in:
Jakob Miland 2013-04-06 16:01:44 +02:00
parent 5ceac52a6b
commit 6b4f72a2c3
26 changed files with 9 additions and 67 deletions

View file

@ -1061,7 +1061,6 @@ html[dir='rtl'] .outlineItem > a {
color: hsla(0,0%,100%,1);
}
.noOutline,
.noResults {
font-size: 12px;
color: hsla(0,0%,100%,.8);

View file

@ -1444,6 +1444,7 @@ var PDFView = {
PDFJS.Promise.all(promises).then(function() {
pdfDocument.getOutline().then(function(outline) {
self.outline = new DocumentOutlineView(outline);
document.getElementById('viewOutline').disabled = !outline;
});
// Make all navigation keys work on document load,
@ -2622,9 +2623,17 @@ var ThumbnailView = function thumbnailView(container, id, defaultViewport) {
var DocumentOutlineView = function documentOutlineView(outline) {
var outlineView = document.getElementById('outlineView');
var outlineButton = document.getElementById('viewOutline');
while (outlineView.firstChild)
outlineView.removeChild(outlineView.firstChild);
if (!outline) {
if (!outlineView.classList.contains('hidden'))
PDFView.switchSidebarView('thumbs');
return;
}
function bindItemLink(domObj, item) {
domObj.href = PDFView.getDestinationHash(item.dest);
domObj.onclick = function documentOutlineViewOnclick(e) {
@ -2633,14 +2642,6 @@ var DocumentOutlineView = function documentOutlineView(outline) {
};
}
if (!outline) {
var noOutline = document.createElement('div');
noOutline.classList.add('noOutline');
noOutline.textContent = mozL10n.get('no_outline', null,
'No Outline Available');
outlineView.appendChild(noOutline);
return;
}
var queue = [{parent: outlineView, items: outline}];
while (queue.length > 0) {