1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 17:33:18 +00:00

[odf view] improvement: fixed bugs, improved ui, rm unused files

This commit is contained in:
llj
2014-01-06 18:36:23 +08:00
parent 78fd222e81
commit 03add04c86
9 changed files with 94 additions and 46223 deletions

View File

@@ -1,37 +0,0 @@
.page {
margin: 7px auto 7px auto;
position: relative;
overflow: visible;
background-clip: content-box;
background-color: white;
box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.75);
-webkit-box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.75);
-ms-box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.75);
-o-box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.75);
}
.textLayer {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
color: #000;
font-family: sans-serif;
overflow: hidden;
}
.textLayer > div {
color: transparent;
position: absolute;
line-height: 1;
white-space: pre;
cursor: text;
overflow: hidden;
}
::selection { background:rgba(0,0,255,0.3); }
::-moz-selection { background:rgba(0,0,255,0.3); }

View File

@@ -1,320 +0,0 @@
/**
* @license
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* The JavaScript code in this page 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. The code is distributed
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* As a special exception to the AGPL, any HTML file which merely makes function
* calls to this code, and for that purpose includes it by reference shall be
* deemed a separate work for copyright law purposes. In addition, the copyright
* holders of this code give you permission to combine this code with free
* software libraries that are released under the GNU LGPL. You may copy and
* distribute such a system following the terms of the GNU AGPL for this code
* and the LGPL for the libraries. If you modify this code, you may extend this
* exception to your version of the code, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
*
* This license applies to this entire compilation.
* @licend
* @source: http://viewerjs.org/
* @source: http://github.com/kogmbh/Viewer.js
*/
/*global document, PDFJS, console, TextLayerBuilder*/
function PDFViewerPlugin() {
"use strict";
function init(callback) {
var pdfLib, textLayerLib, pluginCSS;
pdfLib = document.createElement('script');
pdfLib.async = false;
pdfLib.src = './pdf.js';
pdfLib.type = 'text/javascript';
pdfLib.onload = function () {
textLayerLib = document.createElement('script');
textLayerLib.async = false;
textLayerLib.src = './TextLayerBuilder.js';
textLayerLib.type = 'text/javascript';
textLayerLib.onload = callback;
document.getElementsByTagName('head')[0].appendChild(textLayerLib);
};
document.getElementsByTagName('head')[0].appendChild(pdfLib);
pluginCSS = document.createElement('link');
pluginCSS.setAttribute("rel", "stylesheet");
pluginCSS.setAttribute("type", "text/css");
pluginCSS.setAttribute("href", "./PDFViewerPlugin.css");
document.head.appendChild(pluginCSS);
}
var self = this,
pages = [],
domPages = [],
pageText = [],
renderingStates = [],
RENDERING = {
BLANK: 0,
RUNNING: 1,
FINISHED: 2
},
startedTextExtraction = false,
container = null,
initialized = false,
pdfDocument = null,
pageViewScroll = null,
isPresentationMode = false,
scale = 1,
currentPage = 1,
pageWidth,
pageHeight,
createdPageCount = 0;
function scrollIntoView(elem) {
elem.parentNode.scrollTop = elem.offsetTop;
}
function isScrolledIntoView(elem) {
var docViewTop = container.scrollTop,
docViewBottom = docViewTop + container.clientHeight,
elemTop = elem.offsetTop,
elemBottom = elemTop + elem.clientHeight;
// Is in view if either the top or the bottom of the page is between the
// document viewport bounds,
// or if the top is above the viewport and the bottom is below it.
return (elemTop >= docViewTop && elemTop < docViewBottom)
|| (elemBottom >= docViewTop && elemBottom < docViewBottom)
|| (elemTop < docViewTop && elemBottom >= docViewBottom);
}
function getDomPage(page) {
return domPages[page.pageInfo.pageIndex];
}
function getPageText(page) {
return pageText[page.pageInfo.pageIndex];
}
function getRenderingStatus(page) {
return renderingStates[page.pageInfo.pageIndex];
}
function setRenderingStatus(page, renderStatus) {
renderingStates[page.pageInfo.pageIndex] = renderStatus;
}
function updatePageDimensions(page, width, height) {
var domPage = getDomPage(page),
canvas = domPage.getElementsByTagName('canvas')[0],
textLayer = domPage.getElementsByTagName('div')[0];
domPage.style.width = width;
domPage.style.height = height;
canvas.width = width;
canvas.height = height;
textLayer.style.width = width;
textLayer.style.height = height;
// Once the page dimension is updated, the rendering state is blank.
setRenderingStatus(page, RENDERING.BLANK);
}
function renderPage(page) {
var domPage = getDomPage(page),
textLayer = getPageText(page),
canvas = domPage.getElementsByTagName('canvas')[0];
if (getRenderingStatus(page) === RENDERING.BLANK) {
setRenderingStatus(page, RENDERING.RUNNING);
page.render({
canvasContext: canvas.getContext('2d'),
textLayer: textLayer,
viewport: page.getViewport(scale)
}).then(function () {
setRenderingStatus(page, RENDERING.FINISHED);
});
}
}
function createPage(page) {
var pageNumber,
textLayerDiv,
textLayer,
canvas,
domPage,
viewport;
pageNumber = page.pageInfo.pageIndex + 1;
viewport = page.getViewport(scale);
domPage = document.createElement('div');
domPage.id = 'pageContainer' + pageNumber;
domPage.className = 'page';
canvas = document.createElement('canvas');
canvas.id = 'canvas' + pageNumber;
textLayerDiv = document.createElement('div');
textLayerDiv.className = 'textLayer';
textLayerDiv.id = 'textLayer' + pageNumber;
container.appendChild(domPage);
domPage.appendChild(canvas);
domPage.appendChild(textLayerDiv);
pages.push(page);
domPages.push(domPage);
renderingStates.push(RENDERING.BLANK);
updatePageDimensions(page, viewport.width, viewport.height);
pageWidth = viewport.width;
pageHeight = viewport.height;
textLayer = new TextLayerBuilder({
textLayerDiv: textLayerDiv,
pageIndex: pageNumber - 1
});
page.getTextContent().then(function (textContent) {
textLayer.setTextContent(textContent);
});
pageText.push(textLayer);
createdPageCount += 1;
if (createdPageCount === (pdfDocument.numPages)) {
self.onLoad();
}
}
this.initialize = function (viewContainer, location) {
var self = this,
i,
pluginCSS;
init(function () {
PDFJS.workerSrc = "./pdf.worker.js";
PDFJS.getDocument(location).then(function loadPDF(doc) {
pdfDocument = doc;
container = viewContainer;
for (i = 0; i < pdfDocument.numPages; i += 1) {
pdfDocument.getPage(i + 1).then(createPage);
}
initialized = true;
});
});
};
this.isSlideshow = function () {
// A very simple but generally true guess - if the width is greater than the height, treat it as a slideshow
return pageWidth > pageHeight;
};
this.onLoad = function () {};
this.getPages = function () {
return domPages;
};
this.getWidth = function () {
return pageWidth;
};
this.getHeight = function () {
return pageHeight;
};
this.fitToWidth = function (width) {
var zoomLevel;
if (self.getWidth() === width) {
return;
}
zoomLevel = width / pageWidth;
self.setZoomLevel(zoomLevel);
};
this.fitToHeight = function (height) {
var zoomLevel;
if (self.getHeight() === height) {
return;
}
zoomLevel = height / pageHeight;
self.setZoomLevel(zoomLevel);
};
this.fitToPage = function (width, height) {
var zoomLevel = width / pageWidth;
if (height / pageHeight < zoomLevel) {
zoomLevel = height / pageHeight;
}
self.setZoomLevel(zoomLevel);
};
this.fitSmart = function (width, height) {
var zoomLevel = width / pageWidth;
if (height && (height / pageHeight) < zoomLevel) {
zoomLevel = height / pageHeight;
}
zoomLevel = Math.min(1.0, zoomLevel);
self.setZoomLevel(zoomLevel);
};
this.setZoomLevel = function (zoomLevel) {
var i;
if (scale !== zoomLevel) {
scale = zoomLevel;
for (i = 0; i < pages.length; i += 1) {
updatePageDimensions(pages[i], pageWidth * scale, pageHeight * scale);
}
}
};
this.getZoomLevel = function () {
return scale;
};
this.onScroll = function () {
var i;
for (i = 0; i < domPages.length; i += 1) {
if (isScrolledIntoView(domPages[i])) {
if (getRenderingStatus(pages[i]) === RENDERING.BLANK) {
renderPage(pages[i]);
}
}
}
};
this.getPageInView = function () {
var i;
for (i = 0; i < domPages.length; i += 1) {
if (isScrolledIntoView(domPages[i])) {
return i + 1;
}
}
};
this.showPage = function (n) {
scrollIntoView(domPages[n - 1]);
};
}

View File

@@ -1,27 +0,0 @@
/* This is just a sample file with CSS rules. You should write your own @font-face declarations
* to add support for your desired fonts.
*/
@font-face {
font-family: 'Novecentowide Book';
src: url("/Viewer.js/fonts/Novecentowide-Bold-webfont.eot");
src: url("/Viewer.js/fonts/Novecentowide-Bold-webfont.eot?#iefix") format("embedded-opentype"),
url("/Viewer.js/fonts/Novecentowide-Bold-webfont.woff") format("woff"),
url("/fonts/Novecentowide-Bold-webfont.ttf") format("truetype"),
url("/fonts/Novecentowide-Bold-webfont.svg#NovecentowideBookBold") format("svg");
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'exotica';
src: url('/Viewer.js/fonts/Exotica-webfont.eot');
src: url('/Viewer.js/fonts/Exotica-webfont.eot?#iefix') format('embedded-opentype'),
url('/Viewer.js/fonts/Exotica-webfont.woff') format('woff'),
url('/Viewer.js/fonts/Exotica-webfont.ttf') format('truetype'),
url('/Viewer.js/fonts/Exotica-webfont.svg#exoticamedium') format('svg');
font-weight: normal;
font-style: normal;
}

View File

@@ -1,10 +1,6 @@
<!doctype html>
<html dir="ltr" lang="en-US"> <html dir="ltr" lang="en-US">
<head> <head>
<!-- If you want to use custom CSS (@font-face rules, for example) you should uncomment
the following reference and use a local.css file for that. See the example.local.css
file for a sample.
<link rel="stylesheet" type="text/css" href="local.css" media="screen"/>
-->
<link rel="stylesheet" type="text/css" href="viewer.css" media="screen"/> <link rel="stylesheet" type="text/css" href="viewer.css" media="screen"/>
<script src="viewer.js" type="text/javascript" charset="utf-8"></script> <script src="viewer.js" type="text/javascript" charset="utf-8"></script>
<script src="PluginLoader.js" type="text/javascript" charset="utf-8"></script> <script src="PluginLoader.js" type="text/javascript" charset="utf-8"></script>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -290,141 +290,141 @@ html[dir='rtl'] .dropdownToolbarButton {
.toolbarButton, .toolbarButton,
.dropdownToolbarButton { .dropdownToolbarButton {
min-width: 16px; min-width: 16px;
padding: 2px 6px 2px; padding: 2px 6px 2px;
border: 1px solid transparent; border: 1px solid transparent;
border-radius: 2px; border-radius: 2px;
color: hsl(0,0%,95%); color: hsl(0,0%,95%);
font-size: 12px; font-size: 12px;
line-height: 14px; line-height: 14px;
-webkit-user-select:none; -webkit-user-select:none;
-moz-user-select:none; -moz-user-select:none;
-ms-user-select:none; -ms-user-select:none;
/* Opera does not support user-select, use <... unselectable="on"> instead */ /* Opera does not support user-select, use <... unselectable="on"> instead */
cursor: default; cursor: default;
-webkit-transition-property: background-color, border-color, box-shadow; -webkit-transition-property: background-color, border-color, box-shadow;
-webkit-transition-duration: 150ms; -webkit-transition-duration: 150ms;
-webkit-transition-timing-function: ease; -webkit-transition-timing-function: ease;
-moz-transition-property: background-color, border-color, box-shadow; -moz-transition-property: background-color, border-color, box-shadow;
-moz-transition-duration: 150ms; -moz-transition-duration: 150ms;
-moz-transition-timing-function: ease; -moz-transition-timing-function: ease;
-ms-transition-property: background-color, border-color, box-shadow; -ms-transition-property: background-color, border-color, box-shadow;
-ms-transition-duration: 150ms; -ms-transition-duration: 150ms;
-ms-transition-timing-function: ease; -ms-transition-timing-function: ease;
-o-transition-property: background-color, border-color, box-shadow; -o-transition-property: background-color, border-color, box-shadow;
-o-transition-duration: 150ms; -o-transition-duration: 150ms;
-o-transition-timing-function: ease; -o-transition-timing-function: ease;
transition-property: background-color, border-color, box-shadow; transition-property: background-color, border-color, box-shadow;
transition-duration: 150ms; transition-duration: 150ms;
transition-timing-function: ease; transition-timing-function: ease;
} }
html[dir='ltr'] .toolbarButton, html[dir='ltr'] .toolbarButton,
html[dir='ltr'] .dropdownToolbarButton { html[dir='ltr'] .dropdownToolbarButton {
margin: 3px 2px 4px 0; margin: 3px 2px 4px 0;
} }
html[dir='rtl'] .toolbarButton, html[dir='rtl'] .toolbarButton,
html[dir='rtl'] .dropdownToolbarButton { html[dir='rtl'] .dropdownToolbarButton {
margin: 3px 0 4px 2px; margin: 3px 0 4px 2px;
} }
.splitToolbarButton:hover > .splitToolbarButtonSeparator, .splitToolbarButton:hover > .splitToolbarButtonSeparator,
.splitToolbarButton.toggled > .splitToolbarButtonSeparator { .splitToolbarButton.toggled > .splitToolbarButtonSeparator {
padding: 12px 0; padding: 12px 0;
margin: 0; margin: 0;
box-shadow: 0 0 0 1px hsla(0,0%,100%,.03); box-shadow: 0 0 0 1px hsla(0,0%,100%,.03);
-webkit-transition-property: padding; -webkit-transition-property: padding;
-webkit-transition-duration: 10ms; -webkit-transition-duration: 10ms;
-webkit-transition-timing-function: ease; -webkit-transition-timing-function: ease;
-moz-transition-property: padding; -moz-transition-property: padding;
-moz-transition-duration: 10ms; -moz-transition-duration: 10ms;
-moz-transition-timing-function: ease; -moz-transition-timing-function: ease;
-ms-transition-property: padding; -ms-transition-property: padding;
-ms-transition-duration: 10ms; -ms-transition-duration: 10ms;
-ms-transition-timing-function: ease; -ms-transition-timing-function: ease;
-o-transition-property: padding; -o-transition-property: padding;
-o-transition-duration: 10ms; -o-transition-duration: 10ms;
-o-transition-timing-function: ease; -o-transition-timing-function: ease;
transition-property: padding; transition-property: padding;
transition-duration: 10ms; transition-duration: 10ms;
transition-timing-function: ease; transition-timing-function: ease;
} }
.toolbarButton.toggled:hover:active, .toolbarButton.toggled:hover:active,
.splitToolbarButton > .toolbarButton:hover:active { .splitToolbarButton > .toolbarButton:hover:active {
background-color: hsla(0,0%,0%,.4); background-color: hsla(0,0%,0%,.4);
border-color: hsla(0,0%,0%,.4) hsla(0,0%,0%,.5) hsla(0,0%,0%,.55); border-color: hsla(0,0%,0%,.4) hsla(0,0%,0%,.5) hsla(0,0%,0%,.55);
box-shadow: 0 1px 1px hsla(0,0%,0%,.2) inset, box-shadow: 0 1px 1px hsla(0,0%,0%,.2) inset,
0 0 1px hsla(0,0%,0%,.3) inset, 0 0 1px hsla(0,0%,0%,.3) inset,
0 1px 0 hsla(0,0%,100%,.05); 0 1px 0 hsla(0,0%,100%,.05);
} }
html[dir='ltr'] .splitToolbarButton > .toolbarButton:first-child, html[dir='ltr'] .splitToolbarButton > .toolbarButton:first-child,
html[dir='rtl'] .splitToolbarButton > .toolbarButton:last-child { html[dir='rtl'] .splitToolbarButton > .toolbarButton:last-child {
position: relative; position: relative;
margin: 0; margin: 0;
margin-left: 4px; margin-left: 4px;
margin-right: -1px; margin-right: -1px;
border-top-left-radius: 2px; border-top-left-radius: 2px;
border-bottom-left-radius: 2px; border-bottom-left-radius: 2px;
border-right-color: transparent; border-right-color: transparent;
} }
html[dir='ltr'] .splitToolbarButton > .toolbarButton:last-child, html[dir='ltr'] .splitToolbarButton > .toolbarButton:last-child,
html[dir='rtl'] .splitToolbarButton > .toolbarButton:first-child { html[dir='rtl'] .splitToolbarButton > .toolbarButton:first-child {
position: relative; position: relative;
margin: 0; margin: 0;
margin-left: -1px; margin-left: -1px;
border-top-right-radius: 2px; border-top-right-radius: 2px;
border-bottom-right-radius: 2px; border-bottom-right-radius: 2px;
border-left-color: transparent; border-left-color: transparent;
} }
.splitToolbarButtonSeparator { .splitToolbarButtonSeparator {
padding: 8px 0; padding: 8px 0;
width: 1px; width: 1px;
background-color: hsla(0,0%,00%,.5); background-color: hsla(0,0%,00%,.5);
z-index: 99; z-index: 99;
box-shadow: 0 0 0 1px hsla(0,0%,100%,.08); box-shadow: 0 0 0 1px hsla(0,0%,100%,.08);
display: inline-block; display: inline-block;
margin: 5px 0; margin: 5px 0;
} }
html[dir='ltr'] .splitToolbarButtonSeparator { html[dir='ltr'] .splitToolbarButtonSeparator {
float:left; float:left;
} }
html[dir='rtl'] .splitToolbarButtonSeparator { html[dir='rtl'] .splitToolbarButtonSeparator {
float:right; float:right;
} }
.dropdownToolbarButton { .dropdownToolbarButton {
min-width: 120px; min-width: 120px;
max-width: 120px; max-width: 120px;
padding: 4px 2px 4px; padding: 4px 2px 4px;
overflow: hidden; overflow: hidden;
background: url(images/toolbarButton-menuArrows.png) no-repeat; background: url(images/toolbarButton-menuArrows.png) no-repeat;
} }
.dropdownToolbarButton > select { .dropdownToolbarButton > select {
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; /* in the future this might matter, see bugzilla bug #649849 */ -moz-appearance: none; /* in the future this might matter, see bugzilla bug #649849 */
min-width: 140px; min-width: 140px;
font-size: 12px; font-size: 12px;
color: hsl(0,0%,95%); color: hsl(0,0%,95%);
margin:0; margin:0;
padding:0; padding:0;
border:none; border:none;
background: rgba(0,0,0,0); /* Opera does not support 'transparent' <select> background */ background: rgba(0,0,0,0); /* Opera does not support 'transparent' <select> background */
} }
.dropdownToolbarButton > select > option { .dropdownToolbarButton > select > option {
background: hsl(0,0%,24%); background: hsl(0,0%,24%);
} }
#pageWidthOption { #pageWidthOption {
border-bottom: 1px rgba(255, 255, 255, .5) solid; border-bottom: 1px rgba(255, 255, 255, .5) solid;
} }
html[dir='ltr'] .dropdownToolbarButton { html[dir='ltr'] .dropdownToolbarButton {
background-position: 95%; background-position: 95%;
} }
html[dir='rtl'] .dropdownToolbarButton { html[dir='rtl'] .dropdownToolbarButton {
background-position: 5%; background-position: 5%;

View File

@@ -35,7 +35,7 @@
function Viewer(c){function p(){return document.isFullScreen||document.mozFullScreen||document.webkitIsFullScreen}function u(a){var b=E.options,c,f=!1,d;for(d=0;d<b.length;d+=1)c=b[d],c.value!==a?c.selected=!1:f=c.selected=!0;return f}function v(a,c,d){a!==b.getZoomLevel()&&(b.setZoomLevel(a),d=document.createEvent("UIEvents"),d.initUIEvent("scalechange",!1,!1,window,0),d.scale=a,d.resetAutoSettings=c,window.dispatchEvent(d))}function w(){var a;if(c.onScroll)c.onScroll();c.getPageInView&&(a=c.getPageInView())&& function Viewer(c){function p(){return document.isFullScreen||document.mozFullScreen||document.webkitIsFullScreen}function u(a){var b=E.options,c,f=!1,d;for(d=0;d<b.length;d+=1)c=b[d],c.value!==a?c.selected=!1:f=c.selected=!0;return f}function v(a,c,d){a!==b.getZoomLevel()&&(b.setZoomLevel(a),d=document.createEvent("UIEvents"),d.initUIEvent("scalechange",!1,!1,window,0),d.scale=a,d.resetAutoSettings=c,window.dispatchEvent(d))}function w(){var a;if(c.onScroll)c.onScroll();c.getPageInView&&(a=c.getPageInView())&&
(e=a,document.getElementById("pageNumber").value=a)}function x(a){window.clearTimeout(y);y=window.setTimeout(function(){w()},a)}function g(a,b,g){var f,e;if(f="custom"===a?parseFloat(document.getElementById("customScaleOption").textContent)/100:parseFloat(a))v(f,!0,g);else{f=d.clientWidth-k;e=d.clientHeight-k;switch(a){case "page-actual":v(1,b,g);break;case "page-width":c.fitToWidth(f);break;case "page-height":c.fitToHeight(e);break;case "page-fit":c.fitToPage(f,e);break;case "auto":c.isSlideshow()? (e=a,document.getElementById("pageNumber").value=a)}function x(a){window.clearTimeout(y);y=window.setTimeout(function(){w()},a)}function g(a,b,g){var f,e;if(f="custom"===a?parseFloat(document.getElementById("customScaleOption").textContent)/100:parseFloat(a))v(f,!0,g);else{f=d.clientWidth-k;e=d.clientHeight-k;switch(a){case "page-actual":v(1,b,g);break;case "page-width":c.fitToWidth(f);break;case "page-height":c.fitToHeight(e);break;case "page-fit":c.fitToPage(f,e);break;case "auto":c.isSlideshow()?
c.fitToPage(f+k,e+k):c.fitSmart(f)}u(a)}x(300)}function q(){l&&!p()&&b.togglePresentationMode()}function r(){m&&(s.className="touched",window.clearTimeout(z),z=window.setTimeout(function(){s.className=""},2E3))}var b=this,k=40,l=!1,A=!1,m=!1,t,B,d=document.getElementById("canvasContainer"),s=document.getElementById("overlayNavigator"),C=document.getElementById("toolbarLeft"),F=document.getElementById("toolbarMiddleContainer"),E=document.getElementById("scaleSelect"),D,n=[],e,y,z;this.initialize=function(){var a= c.fitToPage(f+k,e+k):c.fitSmart(f)}u(a)}x(300)}function q(){l&&!p()&&b.togglePresentationMode()}function r(){m&&(s.className="touched",window.clearTimeout(z),z=window.setTimeout(function(){s.className=""},2E3))}var b=this,k=40,l=!1,A=!1,m=!1,t,B,d=document.getElementById("canvasContainer"),s=document.getElementById("overlayNavigator"),C=document.getElementById("toolbarLeft"),F=document.getElementById("toolbarMiddleContainer"),E=document.getElementById("scaleSelect"),D,n=[],e,y,z;this.initialize=function(){var a=
String(document.location),h=a.indexOf("#"),a=a.substr(h+1);-1===h||0===a.length?console.log("Could not parse file path argument."):(B=document.getElementById("viewer"),t=a,D=t.replace(/^.*[\\\/]/,""),document.title=D,document.getElementById("documentName").innerHTML=document.title,c.onLoad=function(){(m=c.isSlideshow())?(d.style.padding=0,C.style.visibility="visible"):(F.style.visibility="visible",c.getPageInView&&(C.style.visibility="visible"));A=!0;n=c.getPages();document.getElementById("numPages").innerHTML= String(document.location),h=a.indexOf("#"),a=a.substr(h+1);-1===h||0===a.length?console.log("Could not parse file path argument."):(B=document.getElementById("viewer"),t=a,D=decodeURIComponent(t.replace(/^.*[\\\/]/,"")),document.title=D,document.getElementById("documentName").innerHTML=document.title,c.onLoad=function(){(m=c.isSlideshow())?(d.style.padding=0,C.style.visibility="visible"):(F.style.visibility="visible",c.getPageInView&&(C.style.visibility="visible"));A=!0;n=c.getPages();document.getElementById("numPages").innerHTML=
"of "+n.length;b.showPage(1);g("auto");d.onscroll=w;x()},c.initialize(d,a))};this.showPage=function(a){0>=a?a=1:a>n.length&&(a=n.length);c.showPage(a);e=a;document.getElementById("pageNumber").value=e};this.showNextPage=function(){b.showPage(e+1)};this.showPreviousPage=function(){b.showPage(e-1)};this.download=function(){var a=t.split("#")[0];window.open(a+"#viewer.action=download","_parent")};this.toggleFullScreen=function(){var a=B;p()?document.cancelFullScreen?document.cancelFullScreen():document.mozCancelFullScreen? "of "+n.length;b.showPage(1);g("auto");d.onscroll=w;x()},c.initialize(d,a))};this.showPage=function(a){0>=a?a=1:a>n.length&&(a=n.length);c.showPage(a);e=a;document.getElementById("pageNumber").value=e};this.showNextPage=function(){b.showPage(e+1)};this.showPreviousPage=function(){b.showPage(e-1)};this.download=function(){var a=t.split("#")[0];window.open(a+"#viewer.action=download","_parent")};this.toggleFullScreen=function(){var a=B;p()?document.cancelFullScreen?document.cancelFullScreen():document.mozCancelFullScreen?
document.mozCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():a.requestFullScreen?a.requestFullScreen():a.mozRequestFullScreen?a.mozRequestFullScreen():a.webkitRequestFullScreen&&a.webkitRequestFullScreen()};this.togglePresentationMode=function(){var a=document.getElementById("titlebar"),h=document.getElementById("toolbarContainer"),e=document.getElementById("overlayCloseButton");l?(a.style.display=h.style.display="block",e.style.display="none",d.className="",d.onmouseup= document.mozCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():a.requestFullScreen?a.requestFullScreen():a.mozRequestFullScreen?a.mozRequestFullScreen():a.webkitRequestFullScreen&&a.webkitRequestFullScreen()};this.togglePresentationMode=function(){var a=document.getElementById("titlebar"),h=document.getElementById("toolbarContainer"),e=document.getElementById("overlayCloseButton");l?(a.style.display=h.style.display="block",e.style.display="none",d.className="",d.onmouseup=
function(){},d.oncontextmenu=function(){},d.onmousedown=function(){},g("auto"),m=c.isSlideshow()):(a.style.display=h.style.display="none",e.style.display="block",d.className="presentationMode",m=!0,d.onmousedown=function(a){a.preventDefault()},d.oncontextmenu=function(a){a.preventDefault()},d.onmouseup=function(a){a.preventDefault();1===a.which?b.showNextPage():b.showPreviousPage()},g("page-fit"));l=!l};this.getZoomLevel=function(){return c.getZoomLevel()};this.setZoomLevel=function(a){c.setZoomLevel(a)}; function(){},d.oncontextmenu=function(){},d.onmousedown=function(){},g("auto"),m=c.isSlideshow()):(a.style.display=h.style.display="none",e.style.display="block",d.className="presentationMode",m=!0,d.onmousedown=function(a){a.preventDefault()},d.oncontextmenu=function(a){a.preventDefault()},d.onmouseup=function(a){a.preventDefault();1===a.which?b.showNextPage():b.showPreviousPage()},g("page-fit"));l=!l};this.getZoomLevel=function(){return c.getZoomLevel()};this.setZoomLevel=function(a){c.setZoomLevel(a)};

View File

@@ -4,9 +4,7 @@
{% block file_view %} {% block file_view %}
{% if not err %} {% if not err %}
<center> <iframe id="viewer" src="{{MEDIA_URL}}js/Viewer.js/index.html#{{ raw_path }}" style="width:95%;height:600px;border:0;margin:0 auto;" allowfullscreen webkitallowfullscreen></iframe>
<iframe id="viewer" src="{{MEDIA_URL}}js/Viewer.js/#{{ raw_path }}" style='width:95%;height:600px;' allowfullscreen webkitallowfullscreen></iframe>
</center>
{% endif %} {% endif %}
{% endblock %} {% endblock %}