/** * Copyright (C) 2012-2015 KO GmbH * * @licstart * This file is part of WebODF. * * WebODF is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License (GNU AGPL) * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * WebODF is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with WebODF. If not, see . * @licend * * @source: http://www.webodf.org/ * @source: https://github.com/kogmbh/WebODF/ */ /* * This file is a derivative from a part of Mozilla's PDF.js project. The * original license header follows. */ /* Copyright 2012 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. */ /*global document, window*/ function Viewer(viewerPlugin, parameters) { "use strict"; var self = this, kScrollbarPadding = 40, kMinScale = 0.25, kMaxScale = 4.0, kDefaultScaleDelta = 1.1, kDefaultScale = 'auto', presentationMode = false, isFullScreen = false, initialized = false, isSlideshow = false, url, viewerElement = document.getElementById('viewer'), canvasContainer = document.getElementById('canvasContainer'), overlayNavigator = document.getElementById('overlayNavigator'), titlebar = document.getElementById('titlebar'), toolbar = document.getElementById('toolbarContainer'), pageSwitcher = document.getElementById('toolbarLeft'), zoomWidget = document.getElementById('toolbarMiddleContainer'), scaleSelector = document.getElementById('scaleSelect'), dialogOverlay = document.getElementById('dialogOverlay'), toolbarRight = document.getElementById('toolbarRight'), aboutDialog, pages = [], currentPage, scaleChangeTimer, touchTimer, toolbarTouchTimer, /**@const*/ UI_FADE_DURATION = 5000; function isBlankedOut() { return (blanked.style.display === 'block'); } function initializeAboutInformation() { var aboutDialogCentererTable, aboutDialogCentererCell, aboutButton, pluginName, pluginVersion, pluginURL; if (viewerPlugin) { pluginName = viewerPlugin.getPluginName(); pluginVersion = viewerPlugin.getPluginVersion(); pluginURL = viewerPlugin.getPluginURL(); } // Create dialog aboutDialogCentererTable = document.createElement('div'); aboutDialogCentererTable.id = "aboutDialogCentererTable"; aboutDialogCentererCell = document.createElement('div'); aboutDialogCentererCell.id = "aboutDialogCentererCell"; aboutDialog = document.createElement('div'); aboutDialog.id = "aboutDialog"; aboutDialog.innerHTML = "

ViewerJS

" + "

Open Source document viewer for webpages, built with HTML and JavaScript.

" + "

Learn more and get your own copy on the ViewerJS website.

" + (viewerPlugin ? ("

Using the " + pluginName + " " + "(" + pluginVersion + ") " + "plugin to show you this document.

") : "") + "

Supported by
\"NLnet

" + "

Made by
\"KO

" + ""; dialogOverlay.appendChild(aboutDialogCentererTable); aboutDialogCentererTable.appendChild(aboutDialogCentererCell); aboutDialogCentererCell.appendChild(aboutDialog); // Create button to open dialog that says "ViewerJS" aboutButton = document.createElement('button'); aboutButton.id = "about"; aboutButton.className = "toolbarButton textButton about"; aboutButton.title = "About"; aboutButton.innerHTML = "ViewerJS" toolbarRight.appendChild(aboutButton); // Attach events to the above aboutButton.addEventListener('click', function () { showAboutDialog(); }); document.getElementById('aboutDialogCloseButton').addEventListener('click', function () { hideAboutDialog(); }); } function showAboutDialog() { dialogOverlay.style.display = "block"; } function hideAboutDialog() { dialogOverlay.style.display = "none"; } function selectScaleOption(value) { // Retrieve the options from the zoom level