- Migrated from https://github.com/Yetangitu/owncloud-apps
- substantial bit rot accrued in 4 years of non-maintenance which made Reader unusable - Reader now works reliably on public pages - or at least it _Works For Me™_ - Refactored a substantial part of the code to comply to the "current" (ha ha) Nextcloud API - Dropped Owncloud compatibility for lack of a testing installation - Dropped IE (<11) support - Dropped compatibility with older (<20) Nextcloud versions - Dropped app-specific ajax code, now handled by SettingsController - Updated dependencies where applicable
This commit is contained in:
parent
16afbe45fe
commit
b190e180ef
137 changed files with 30984 additions and 2 deletions
74
vendor/pdfjs/controllers/outline_controller.js
vendored
Normal file
74
vendor/pdfjs/controllers/outline_controller.js
vendored
Normal file
|
@ -0,0 +1,74 @@
|
|||
PDFJS.reader.OutlineController = function(_outline) {
|
||||
|
||||
var reader = this,
|
||||
book = this.book,
|
||||
outline = _outline || [];
|
||||
|
||||
var outlineView = document.getElementById("outlineView");
|
||||
|
||||
var DEFAULT_TITLE = '\u2013';
|
||||
|
||||
var generateOutlineItems = function (outline, level) {
|
||||
|
||||
var container = document.createElement("ul");
|
||||
|
||||
if(!level) level = 1;
|
||||
|
||||
outline.forEach(function (chapter) {
|
||||
|
||||
var listitem = document.createElement("li"),
|
||||
link = document.createElement("a"),
|
||||
toggle = document.createElement("a"),
|
||||
subitems;
|
||||
|
||||
listitem.id = "outline-"+chapter.dest;
|
||||
listitem.classList.add('list_item');
|
||||
|
||||
link.textContent = PDFJS.removeNullCharacters(chapter.title) || DEFAULT_TITLE;
|
||||
reader.bindLink(link, chapter);
|
||||
reader.setStyles(link, chapter);
|
||||
link.classList.add('outline_link');
|
||||
|
||||
listitem.appendChild(link);
|
||||
|
||||
if(chapter.items.length > 0) {
|
||||
level++;
|
||||
subitems = generateOutlineItems(chapter.items, level);
|
||||
toggle.classList.add('outline_toggle');
|
||||
listitem.insertBefore(toggle, link);
|
||||
listitem.appendChild(subitems);
|
||||
}
|
||||
|
||||
container.appendChild(listitem);
|
||||
});
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
var onShow = function() {
|
||||
outlineView.classList.add('open');
|
||||
};
|
||||
|
||||
var onHide = function() {
|
||||
outlineView.classList.remove('open');
|
||||
};
|
||||
|
||||
outlineView.appendChild(generateOutlineItems(outline));
|
||||
|
||||
$(outlineView).find(".outline_toggle").on("click", function(event){
|
||||
var $el = $(this).parent('li'),
|
||||
open = $el.hasClass("openChapter");
|
||||
|
||||
event.preventDefault();
|
||||
if(open){
|
||||
$el.removeClass("openChapter");
|
||||
} else {
|
||||
$el.addClass("openChapter");
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
"show" : onShow,
|
||||
"hide" : onHide
|
||||
};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue