Merge branch '6.0'
Conflicts: media/js/base.js seahub/api2/views.py seahub/views/ajax.py tests/api/test_repo_user_folder_perm.py
@@ -1,159 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright (C) 2012 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://www.webodf.org/
|
||||
* @source: http://gitorious.org/webodf/webodf/
|
||||
*/
|
||||
|
||||
/*global runtime, document, odf, console*/
|
||||
|
||||
function ODFViewerPlugin() {
|
||||
"use strict";
|
||||
|
||||
function init(callback) {
|
||||
var lib = document.createElement('script');
|
||||
lib.async = false;
|
||||
lib.src = './webodf.js';
|
||||
lib.type = 'text/javascript';
|
||||
lib.onload = function () {
|
||||
runtime.currentDirectory = function () {
|
||||
return "../../webodf/lib";
|
||||
};
|
||||
runtime.libraryPaths = function () {
|
||||
return [ runtime.currentDirectory() ];
|
||||
};
|
||||
|
||||
runtime.loadClass('odf.OdfCanvas');
|
||||
callback();
|
||||
};
|
||||
|
||||
document.getElementsByTagName('head')[0].appendChild(lib);
|
||||
}
|
||||
|
||||
// that should probably be provided by webodf
|
||||
function nsResolver(prefix) {
|
||||
var ns = {
|
||||
'draw' : "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",
|
||||
'presentation' : "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",
|
||||
'text' : "urn:oasis:names:tc:opendocument:xmlns:text:1.0",
|
||||
'office' : "urn:oasis:names:tc:opendocument:xmlns:office:1.0"
|
||||
};
|
||||
return ns[prefix] || console.log('prefix [' + prefix + '] unknown.');
|
||||
}
|
||||
|
||||
var self = this,
|
||||
odfCanvas = null,
|
||||
odfElement = null,
|
||||
initialized = false,
|
||||
root = null,
|
||||
documentType = null,
|
||||
pages = [],
|
||||
currentPage = null;
|
||||
|
||||
this.initialize = function (viewerElement, documentUrl) {
|
||||
// If the URL has a fragment (#...), try to load the file it represents
|
||||
init(function () {
|
||||
odfElement = document.getElementById('canvas');
|
||||
odfCanvas = new odf.OdfCanvas(odfElement);
|
||||
odfCanvas.load(documentUrl);
|
||||
|
||||
odfCanvas.addListener('statereadychange', function () {
|
||||
root = odfCanvas.odfContainer().rootElement;
|
||||
initialized = true;
|
||||
documentType = odfCanvas.odfContainer().getDocumentType(root);
|
||||
if (documentType === 'text') {
|
||||
odfCanvas.enableAnnotations(true);
|
||||
}
|
||||
self.onLoad();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
this.isSlideshow = function () {
|
||||
return documentType === 'presentation';
|
||||
};
|
||||
|
||||
this.onLoad = function () {};
|
||||
|
||||
this.getWidth = function () {
|
||||
return odfElement.clientWidth;
|
||||
};
|
||||
|
||||
this.getHeight = function () {
|
||||
return odfElement.clientHeight;
|
||||
};
|
||||
|
||||
this.fitToWidth = function (width) {
|
||||
odfCanvas.fitToWidth(width);
|
||||
};
|
||||
|
||||
this.fitToHeight = function (height) {
|
||||
odfCanvas.fitToHeight(height);
|
||||
};
|
||||
|
||||
this.fitToPage = function (width, height) {
|
||||
odfCanvas.fitToContainingElement(width, height);
|
||||
};
|
||||
|
||||
this.fitSmart = function (width) {
|
||||
odfCanvas.fitSmart(width);
|
||||
};
|
||||
|
||||
this.getZoomLevel = function () {
|
||||
return odfCanvas.getZoomLevel();
|
||||
};
|
||||
|
||||
this.setZoomLevel = function (value) {
|
||||
odfCanvas.setZoomLevel(value);
|
||||
};
|
||||
|
||||
// return a list of tuples (pagename, pagenode)
|
||||
this.getPages = function () {
|
||||
var pageNodes = Array.prototype.slice.call(root.getElementsByTagNameNS(nsResolver('draw'), 'page')),
|
||||
pages = [],
|
||||
i,
|
||||
tuple;
|
||||
|
||||
for (i = 0; i < pageNodes.length; i += 1) {
|
||||
tuple = [
|
||||
pageNodes[i].getAttribute('draw:name'),
|
||||
pageNodes[i]
|
||||
];
|
||||
pages.push(tuple);
|
||||
}
|
||||
return pages;
|
||||
};
|
||||
|
||||
this.showPage = function (n) {
|
||||
odfCanvas.showPage(n);
|
||||
};
|
||||
|
||||
}
|
@@ -1,82 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright (C) 2012 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/thz/Viewer.js
|
||||
*/
|
||||
|
||||
/*global document, window, Viewer, ODFViewerPlugin, PDFViewerPlugin*/
|
||||
|
||||
var viewer;
|
||||
|
||||
function loadPlugin(pluginName, callback) {
|
||||
"use strict";
|
||||
var script, style;
|
||||
|
||||
// Load script
|
||||
script = document.createElement('script');
|
||||
script.async = false;
|
||||
script.onload = callback;
|
||||
script.src = pluginName + '.js';
|
||||
script.type = 'text/javascript';
|
||||
document.getElementsByTagName('head')[0].appendChild(script);
|
||||
}
|
||||
|
||||
function loadDocument(documentUrl) {
|
||||
"use strict";
|
||||
|
||||
if (documentUrl) {
|
||||
var extension = documentUrl.split('.').pop(),
|
||||
Plugin;
|
||||
extension = extension.toLowerCase();
|
||||
switch (extension) {
|
||||
case 'odt':
|
||||
case 'odp':
|
||||
case 'ods':
|
||||
case 'fodt':
|
||||
loadPlugin('./ODFViewerPlugin', function () {
|
||||
Plugin = ODFViewerPlugin;
|
||||
});
|
||||
break;
|
||||
case 'pdf':
|
||||
loadPlugin('./PDFViewerPlugin', function () {
|
||||
Plugin = PDFViewerPlugin;
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
if (Plugin) {
|
||||
viewer = new Viewer(new Plugin());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@@ -1,425 +0,0 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
// adapted for Viewer.js by KO GmbH
|
||||
|
||||
/**
|
||||
* TextLayerBuilder provides text-selection
|
||||
* functionality for the PDF. It does this
|
||||
* by creating overlay divs over the PDF
|
||||
* text. This divs contain text that matches
|
||||
* the PDF text they are overlaying. This
|
||||
* object also provides for a way to highlight
|
||||
* text that is being searched for.
|
||||
*/
|
||||
var CustomStyle = (function CustomStyleClosure() {
|
||||
|
||||
// As noted on: http://www.zachstronaut.com/posts/2009/02/17/
|
||||
// animate-css-transforms-firefox-webkit.html
|
||||
// in some versions of IE9 it is critical that ms appear in this list
|
||||
// before Moz
|
||||
var prefixes = ['ms', 'Moz', 'Webkit', 'O'];
|
||||
var _cache = { };
|
||||
|
||||
function CustomStyle() {
|
||||
}
|
||||
|
||||
CustomStyle.getProp = function get(propName, element) {
|
||||
// check cache only when no element is given
|
||||
if (arguments.length == 1 && typeof _cache[propName] == 'string') {
|
||||
return _cache[propName];
|
||||
}
|
||||
|
||||
element = element || document.documentElement;
|
||||
var style = element.style, prefixed, uPropName;
|
||||
|
||||
// test standard property first
|
||||
if (typeof style[propName] == 'string') {
|
||||
return (_cache[propName] = propName);
|
||||
}
|
||||
|
||||
// capitalize
|
||||
uPropName = propName.charAt(0).toUpperCase() + propName.slice(1);
|
||||
|
||||
// test vendor specific properties
|
||||
for (var i = 0, l = prefixes.length; i < l; i++) {
|
||||
prefixed = prefixes[i] + uPropName;
|
||||
if (typeof style[prefixed] == 'string') {
|
||||
return (_cache[propName] = prefixed);
|
||||
}
|
||||
}
|
||||
|
||||
//if all fails then set to undefined
|
||||
return (_cache[propName] = 'undefined');
|
||||
};
|
||||
|
||||
CustomStyle.setProp = function set(propName, element, str) {
|
||||
var prop = this.getProp(propName);
|
||||
if (prop != 'undefined')
|
||||
element.style[prop] = str;
|
||||
};
|
||||
|
||||
return CustomStyle;
|
||||
})();
|
||||
|
||||
var TextLayerBuilder = function textLayerBuilder(options) {
|
||||
var textLayerFrag = document.createDocumentFragment();
|
||||
|
||||
this.textLayerDiv = options.textLayerDiv;
|
||||
this.layoutDone = false;
|
||||
this.divContentDone = false;
|
||||
this.pageIdx = options.pageIndex;
|
||||
this.matches = [];
|
||||
this.lastScrollSource = options.lastScrollSource;
|
||||
|
||||
if(typeof PDFFindController === 'undefined') {
|
||||
window.PDFFindController = null;
|
||||
}
|
||||
|
||||
if(typeof this.lastScrollSource === 'undefined') {
|
||||
this.lastScrollSource = null;
|
||||
}
|
||||
|
||||
this.beginLayout = function textLayerBuilderBeginLayout() {
|
||||
this.textDivs = [];
|
||||
this.renderingDone = false;
|
||||
};
|
||||
|
||||
this.endLayout = function textLayerBuilderEndLayout() {
|
||||
this.layoutDone = true;
|
||||
this.insertDivContent();
|
||||
};
|
||||
|
||||
this.renderLayer = function textLayerBuilderRenderLayer() {
|
||||
var self = this;
|
||||
var textDivs = this.textDivs;
|
||||
var bidiTexts = this.textContent.bidiTexts;
|
||||
var textLayerDiv = this.textLayerDiv;
|
||||
var canvas = document.createElement('canvas');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
// No point in rendering so many divs as it'd make the browser unusable
|
||||
// even after the divs are rendered
|
||||
var MAX_TEXT_DIVS_TO_RENDER = 100000;
|
||||
if (textDivs.length > MAX_TEXT_DIVS_TO_RENDER)
|
||||
return;
|
||||
|
||||
for (var i = 0, ii = textDivs.length; i < ii; i++) {
|
||||
var textDiv = textDivs[i];
|
||||
if ('isWhitespace' in textDiv.dataset) {
|
||||
continue;
|
||||
}
|
||||
textLayerFrag.appendChild(textDiv);
|
||||
|
||||
ctx.font = textDiv.style.fontSize + ' ' + textDiv.style.fontFamily;
|
||||
var width = ctx.measureText(textDiv.textContent).width;
|
||||
|
||||
if (width > 0) {
|
||||
var textScale = textDiv.dataset.canvasWidth / width;
|
||||
var rotation = textDiv.dataset.angle;
|
||||
var transform = 'scale(' + textScale + ', 1)';
|
||||
if (bidiTexts[i].dir === 'ttb') {
|
||||
rotation += 90;
|
||||
}
|
||||
transform = 'rotate(' + rotation + 'deg) ' + transform;
|
||||
CustomStyle.setProp('transform' , textDiv, transform);
|
||||
CustomStyle.setProp('transformOrigin' , textDiv, '0% 0%');
|
||||
|
||||
textLayerDiv.appendChild(textDiv);
|
||||
}
|
||||
}
|
||||
|
||||
this.renderingDone = true;
|
||||
this.updateMatches();
|
||||
|
||||
textLayerDiv.appendChild(textLayerFrag);
|
||||
};
|
||||
|
||||
this.setupRenderLayoutTimer = function textLayerSetupRenderLayoutTimer() {
|
||||
// Schedule renderLayout() if user has been scrolling, otherwise
|
||||
// run it right away
|
||||
var RENDER_DELAY = 200; // in ms
|
||||
var self = this;
|
||||
var lastScroll = this.lastScrollSource === null ?
|
||||
0 : this.lastScrollSource.lastScroll;
|
||||
|
||||
if (Date.now() - lastScroll > RENDER_DELAY) {
|
||||
// Render right away
|
||||
this.renderLayer();
|
||||
} else {
|
||||
// Schedule
|
||||
if (this.renderTimer)
|
||||
clearTimeout(this.renderTimer);
|
||||
this.renderTimer = setTimeout(function() {
|
||||
self.setupRenderLayoutTimer();
|
||||
}, RENDER_DELAY);
|
||||
}
|
||||
};
|
||||
|
||||
this.appendText = function textLayerBuilderAppendText(geom) {
|
||||
var textDiv = document.createElement('div');
|
||||
|
||||
// vScale and hScale already contain the scaling to pixel units
|
||||
var fontHeight = geom.fontSize * Math.abs(geom.vScale);
|
||||
textDiv.dataset.canvasWidth = geom.canvasWidth * Math.abs(geom.hScale);
|
||||
textDiv.dataset.fontName = geom.fontName;
|
||||
textDiv.dataset.angle = geom.angle * (180 / Math.PI);
|
||||
|
||||
textDiv.style.fontSize = fontHeight + 'px';
|
||||
textDiv.style.fontFamily = geom.fontFamily;
|
||||
textDiv.style.left = (geom.x + (fontHeight * Math.sin(geom.angle))) + 'px';
|
||||
textDiv.style.top = (geom.y - (fontHeight * Math.cos(geom.angle))) + 'px';
|
||||
|
||||
// The content of the div is set in the `setTextContent` function.
|
||||
|
||||
this.textDivs.push(textDiv);
|
||||
};
|
||||
|
||||
this.insertDivContent = function textLayerUpdateTextContent() {
|
||||
// Only set the content of the divs once layout has finished, the content
|
||||
// for the divs is available and content is not yet set on the divs.
|
||||
if (!this.layoutDone || this.divContentDone || !this.textContent)
|
||||
return;
|
||||
|
||||
this.divContentDone = true;
|
||||
|
||||
var textDivs = this.textDivs;
|
||||
var bidiTexts = this.textContent.bidiTexts;
|
||||
|
||||
for (var i = 0; i < bidiTexts.length; i++) {
|
||||
var bidiText = bidiTexts[i];
|
||||
var textDiv = textDivs[i];
|
||||
if (!/\S/.test(bidiText.str)) {
|
||||
textDiv.dataset.isWhitespace = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
textDiv.textContent = bidiText.str;
|
||||
// bidiText.dir may be 'ttb' for vertical texts.
|
||||
textDiv.dir = bidiText.dir === 'rtl' ? 'rtl' : 'ltr';
|
||||
}
|
||||
|
||||
this.setupRenderLayoutTimer();
|
||||
};
|
||||
|
||||
this.setTextContent = function textLayerBuilderSetTextContent(textContent) {
|
||||
this.textContent = textContent;
|
||||
this.insertDivContent();
|
||||
};
|
||||
|
||||
this.convertMatches = function textLayerBuilderConvertMatches(matches) {
|
||||
var i = 0;
|
||||
var iIndex = 0;
|
||||
var bidiTexts = this.textContent.bidiTexts;
|
||||
var end = bidiTexts.length - 1;
|
||||
var queryLen = PDFFindController === null ?
|
||||
0 : PDFFindController.state.query.length;
|
||||
|
||||
var lastDivIdx = -1;
|
||||
var pos;
|
||||
|
||||
var ret = [];
|
||||
|
||||
// Loop over all the matches.
|
||||
for (var m = 0; m < matches.length; m++) {
|
||||
var matchIdx = matches[m];
|
||||
// # Calculate the begin position.
|
||||
|
||||
// Loop over the divIdxs.
|
||||
while (i !== end && matchIdx >= (iIndex + bidiTexts[i].str.length)) {
|
||||
iIndex += bidiTexts[i].str.length;
|
||||
i++;
|
||||
}
|
||||
|
||||
// TODO: Do proper handling here if something goes wrong.
|
||||
if (i == bidiTexts.length) {
|
||||
console.error('Could not find matching mapping');
|
||||
}
|
||||
|
||||
var match = {
|
||||
begin: {
|
||||
divIdx: i,
|
||||
offset: matchIdx - iIndex
|
||||
}
|
||||
};
|
||||
|
||||
// # Calculate the end position.
|
||||
matchIdx += queryLen;
|
||||
|
||||
// Somewhat same array as above, but use a > instead of >= to get the end
|
||||
// position right.
|
||||
while (i !== end && matchIdx > (iIndex + bidiTexts[i].str.length)) {
|
||||
iIndex += bidiTexts[i].str.length;
|
||||
i++;
|
||||
}
|
||||
|
||||
match.end = {
|
||||
divIdx: i,
|
||||
offset: matchIdx - iIndex
|
||||
};
|
||||
ret.push(match);
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
this.renderMatches = function textLayerBuilder_renderMatches(matches) {
|
||||
// Early exit if there is nothing to render.
|
||||
if (matches.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var bidiTexts = this.textContent.bidiTexts;
|
||||
var textDivs = this.textDivs;
|
||||
var prevEnd = null;
|
||||
var isSelectedPage = PDFFindController === null ?
|
||||
false : (this.pageIdx === PDFFindController.selected.pageIdx);
|
||||
|
||||
var selectedMatchIdx = PDFFindController === null ?
|
||||
-1 : PDFFindController.selected.matchIdx;
|
||||
|
||||
var highlightAll = PDFFindController === null ?
|
||||
false : PDFFindController.state.highlightAll;
|
||||
|
||||
var infty = {
|
||||
divIdx: -1,
|
||||
offset: undefined
|
||||
};
|
||||
|
||||
function beginText(begin, className) {
|
||||
var divIdx = begin.divIdx;
|
||||
var div = textDivs[divIdx];
|
||||
div.textContent = '';
|
||||
|
||||
var content = bidiTexts[divIdx].str.substring(0, begin.offset);
|
||||
var node = document.createTextNode(content);
|
||||
if (className) {
|
||||
var isSelected = isSelectedPage &&
|
||||
divIdx === selectedMatchIdx;
|
||||
var span = document.createElement('span');
|
||||
span.className = className + (isSelected ? ' selected' : '');
|
||||
span.appendChild(node);
|
||||
div.appendChild(span);
|
||||
return;
|
||||
}
|
||||
div.appendChild(node);
|
||||
}
|
||||
|
||||
function appendText(from, to, className) {
|
||||
var divIdx = from.divIdx;
|
||||
var div = textDivs[divIdx];
|
||||
|
||||
var content = bidiTexts[divIdx].str.substring(from.offset, to.offset);
|
||||
var node = document.createTextNode(content);
|
||||
if (className) {
|
||||
var span = document.createElement('span');
|
||||
span.className = className;
|
||||
span.appendChild(node);
|
||||
div.appendChild(span);
|
||||
return;
|
||||
}
|
||||
div.appendChild(node);
|
||||
}
|
||||
|
||||
function highlightDiv(divIdx, className) {
|
||||
textDivs[divIdx].className = className;
|
||||
}
|
||||
|
||||
var i0 = selectedMatchIdx, i1 = i0 + 1, i;
|
||||
|
||||
if (highlightAll) {
|
||||
i0 = 0;
|
||||
i1 = matches.length;
|
||||
} else if (!isSelectedPage) {
|
||||
// Not highlighting all and this isn't the selected page, so do nothing.
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = i0; i < i1; i++) {
|
||||
var match = matches[i];
|
||||
var begin = match.begin;
|
||||
var end = match.end;
|
||||
|
||||
var isSelected = isSelectedPage && i === selectedMatchIdx;
|
||||
var highlightSuffix = (isSelected ? ' selected' : '');
|
||||
if (isSelected)
|
||||
scrollIntoView(textDivs[begin.divIdx], {top: -50});
|
||||
|
||||
// Match inside new div.
|
||||
if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {
|
||||
// If there was a previous div, then add the text at the end
|
||||
if (prevEnd !== null) {
|
||||
appendText(prevEnd, infty);
|
||||
}
|
||||
// clears the divs and set the content until the begin point.
|
||||
beginText(begin);
|
||||
} else {
|
||||
appendText(prevEnd, begin);
|
||||
}
|
||||
|
||||
if (begin.divIdx === end.divIdx) {
|
||||
appendText(begin, end, 'highlight' + highlightSuffix);
|
||||
} else {
|
||||
appendText(begin, infty, 'highlight begin' + highlightSuffix);
|
||||
for (var n = begin.divIdx + 1; n < end.divIdx; n++) {
|
||||
highlightDiv(n, 'highlight middle' + highlightSuffix);
|
||||
}
|
||||
beginText(end, 'highlight end' + highlightSuffix);
|
||||
}
|
||||
prevEnd = end;
|
||||
}
|
||||
|
||||
if (prevEnd) {
|
||||
appendText(prevEnd, infty);
|
||||
}
|
||||
};
|
||||
|
||||
this.updateMatches = function textLayerUpdateMatches() {
|
||||
// Only show matches, once all rendering is done.
|
||||
if (!this.renderingDone)
|
||||
return;
|
||||
|
||||
// Clear out all matches.
|
||||
var matches = this.matches;
|
||||
var textDivs = this.textDivs;
|
||||
var bidiTexts = this.textContent.bidiTexts;
|
||||
var clearedUntilDivIdx = -1;
|
||||
|
||||
// Clear out all current matches.
|
||||
for (var i = 0; i < matches.length; i++) {
|
||||
var match = matches[i];
|
||||
var begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);
|
||||
for (var n = begin; n <= match.end.divIdx; n++) {
|
||||
var div = textDivs[n];
|
||||
div.textContent = bidiTexts[n].str;
|
||||
div.className = '';
|
||||
}
|
||||
clearedUntilDivIdx = match.end.divIdx + 1;
|
||||
}
|
||||
|
||||
if (PDFFindController === null || !PDFFindController.active)
|
||||
return;
|
||||
|
||||
// Convert the matches on the page controller into the match format used
|
||||
// for the textLayer.
|
||||
this.matches = matches =
|
||||
this.convertMatches(PDFFindController === null ?
|
||||
[] : (PDFFindController.pageMatches[this.pageIdx] || []));
|
||||
|
||||
this.renderMatches(this.matches);
|
||||
};
|
||||
};
|
||||
|
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 512 B |
Before Width: | Height: | Size: 491 B |
Before Width: | Height: | Size: 237 B |
Before Width: | Height: | Size: 353 B |
Before Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 143 B |
@@ -1,74 +0,0 @@
|
||||
<!doctype html>
|
||||
<html dir="ltr" lang="en-US">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="viewer.css" media="screen"/>
|
||||
<script src="viewer.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="PluginLoader.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
loadDocument(window.location.hash);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id = "viewer">
|
||||
<div id = "titlebar">
|
||||
<div id = "documentName"></div>
|
||||
<div id = "toolbarRight">
|
||||
<button id = "presentation" class = "toolbarButton presentation" title = "Presentation"></button>
|
||||
<button id = "fullscreen" class = "toolbarButton fullscreen" title = "Fullscreen"></button>
|
||||
<button id = "download" class = "toolbarButton download" title = "Download"></button>
|
||||
</div>
|
||||
</div>
|
||||
<div id = "toolbarContainer">
|
||||
<div id = "toolbar">
|
||||
<div id = "toolbarLeft">
|
||||
<div id = "navButtons" class = "splitToolbarButton">
|
||||
<button id = "previous" class = "toolbarButton pageUp" title = "Previous Page"></button>
|
||||
<div class="splitToolbarButtonSeparator"></div>
|
||||
<button id = "next" class = "toolbarButton pageDown" title = "Next Page"></button>
|
||||
</div>
|
||||
<label id = "pageNumberLabel" class = "toolbarLabel" for = "pageNumber">Page:</label>
|
||||
<input type = "number" id = "pageNumber" class = "toolbarField pageNumber"></input>
|
||||
<span id = "numPages" class = "toolbarLabel"></span>
|
||||
</div>
|
||||
<div id = "toolbarMiddleContainer" class = "outerCenter">
|
||||
<div id = "toolbarMiddle" class = "innerCenter">
|
||||
<div id = 'zoomButtons' class = "splitToolbarButton">
|
||||
<button id = "zoomOut" class = "toolbarButton zoomOut" title = "Zoom Out"></button>
|
||||
<div class="splitToolbarButtonSeparator"></div>
|
||||
<button id = "zoomIn" class = "toolbarButton zoomIn" title = "Zoom In"></button>
|
||||
</div>
|
||||
<span id="scaleSelectContainer" class="dropdownToolbarButton">
|
||||
<select id="scaleSelect" title="Zoom" oncontextmenu="return false;">
|
||||
<option id="pageAutoOption" value="auto" selected>Automatic</option>
|
||||
<option id="pageActualOption" value="page-actual">Actual Size</option>
|
||||
<option id="pageWidthOption" value="page-width">Full Width</option>
|
||||
<option id="customScaleOption" value="custom"></option>
|
||||
<option value="0.5">50%</option>
|
||||
<option value="0.75">75%</option>
|
||||
<option value="1">100%</option>
|
||||
<option value="1.25">125%</option>
|
||||
<option value="1.5">150%</option>
|
||||
<option value="2">200%</option>
|
||||
</select>
|
||||
</span>
|
||||
<div id = "sliderContainer">
|
||||
<div id = "slider"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id = "canvasContainer">
|
||||
<div id = "canvas"></div>
|
||||
</div>
|
||||
<div id = "overlayNavigator">
|
||||
<div id = "previousPage"></div>
|
||||
<div id = "nextPage"></div>
|
||||
</div>
|
||||
<div id = "overlayCloseButton">
|
||||
✖
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@@ -1,643 +0,0 @@
|
||||
* {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
.titlebar > span,
|
||||
.toolbarLabel,
|
||||
input,
|
||||
button,
|
||||
select {
|
||||
font: message-box;
|
||||
}
|
||||
|
||||
#titlebar {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
height: 32px;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
|
||||
-webkit-box-shadow: 0px 1px 3px rgba(50, 50, 50, 0.75);
|
||||
-moz-box-shadow: 0px 1px 3px rgba(50, 50, 50, 0.75);
|
||||
box-shadow: 0px 1px 3px rgba(50, 50, 50, 0.75);
|
||||
|
||||
background-image: url(images/texture.png), linear-gradient(rgba(69, 69, 69, .95), rgba(82, 82, 82, .99));
|
||||
background-image: url(images/texture.png), -webkit-linear-gradient(rgba(69, 69, 69, .95), rgba(82, 82, 82, .99));
|
||||
background-image: url(images/texture.png), -moz-linear-gradient(rgba(69, 69, 69, .95), rgba(82, 82, 82, .99));
|
||||
background-image: url(images/texture.png), -ms-linear-gradient(rgba(69, 69, 69, .95), rgba(82, 82, 82, .99));
|
||||
background-image: url(images/texture.png), -o-linear-gradient(rgba(69, 69, 69, .95), rgba(82, 82, 82, .99));
|
||||
}
|
||||
|
||||
#documentName {
|
||||
margin-left: 10px;
|
||||
margin-top: 8px;
|
||||
color: #F2F2F2;
|
||||
font-size: 14px;
|
||||
line-height: 14px;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
#toolbarContainer {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
bottom: 0px;
|
||||
left: 0px;
|
||||
height: 32px;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
|
||||
-webkit-box-shadow: 0px -1px 3px rgba(50, 50, 50, 0.75);
|
||||
-moz-box-shadow: 0px -1px 3px rgba(50, 50, 50, 0.75);
|
||||
box-shadow: 0px -1px 3px rgba(50, 50, 50, 0.75);
|
||||
|
||||
background-image: url(images/texture.png), linear-gradient(rgba(82, 82, 82, .99), rgba(69, 69, 69, .95));
|
||||
background-image: url(images/texture.png), -webkit-linear-gradient(rgba(82, 82, 82, .99), rgba(69, 69, 69, .95));
|
||||
background-image: url(images/texture.png), -moz-linear-gradient(rgba(82, 82, 82, .99), rgba(69, 69, 69, .95));
|
||||
background-image: url(images/texture.png), -ms-linear-gradient(rgba(82, 82, 82, .99), rgba(69, 69, 69, .95));
|
||||
background-image: url(images/texture.png), -o-linear-gradient(rgba(82, 82, 82, .99), rgba(69, 69, 69, .95));
|
||||
}
|
||||
|
||||
#toolbar {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#toolbarMiddleContainer, #toolbarLeft {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
html[dir='ltr'] #toolbarLeft {
|
||||
margin-left: -1px;
|
||||
}
|
||||
html[dir='rtl'] #toolbarRight {
|
||||
margin-left: -1px;
|
||||
}
|
||||
html[dir='ltr'] #toolbarLeft,
|
||||
html[dir='rtl'] #toolbarRight {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
html[dir='ltr'] #toolbarRight,
|
||||
html[dir='rtl'] #toolbarLeft {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
html[dir='ltr'] #toolbarLeft > *,
|
||||
html[dir='ltr'] #toolbarMiddle > *,
|
||||
html[dir='ltr'] #toolbarRight > * {
|
||||
float: left;
|
||||
}
|
||||
html[dir='rtl'] #toolbarLeft > *,
|
||||
html[dir='rtl'] #toolbarMiddle > *,
|
||||
html[dir='rtl'] #toolbarRight > * {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* outer/inner center provides horizontal center */
|
||||
html[dir='ltr'] .outerCenter {
|
||||
float: right;
|
||||
position: relative;
|
||||
right: 50%;
|
||||
}
|
||||
html[dir='rtl'] .outerCenter {
|
||||
float: left;
|
||||
position: relative;
|
||||
left: 50%;
|
||||
}
|
||||
html[dir='ltr'] .innerCenter {
|
||||
float: right;
|
||||
position: relative;
|
||||
right: -50%;
|
||||
}
|
||||
html[dir='rtl'] .innerCenter {
|
||||
float: left;
|
||||
position: relative;
|
||||
left: -50%;
|
||||
}
|
||||
|
||||
html[dir='ltr'] .splitToolbarButton {
|
||||
margin: 3px 2px 4px 0;
|
||||
display: inline-block;
|
||||
}
|
||||
html[dir='rtl'] .splitToolbarButton {
|
||||
margin: 3px 0 4px 2px;
|
||||
display: inline-block;
|
||||
}
|
||||
html[dir='ltr'] .splitToolbarButton > .toolbarButton {
|
||||
border-radius: 0;
|
||||
float: left;
|
||||
}
|
||||
html[dir='rtl'] .splitToolbarButton > .toolbarButton {
|
||||
border-radius: 0;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.splitToolbarButton.toggled .toolbarButton {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.toolbarButton {
|
||||
border: 0 none;
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
width: 32px;
|
||||
height: 25px;
|
||||
border-radius: 2px;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
html[dir='ltr'] .toolbarButton,
|
||||
html[dir='ltr'] .dropdownToolbarButton {
|
||||
margin: 3px 2px 4px 0;
|
||||
}
|
||||
html[dir='rtl'] .toolbarButton,
|
||||
html[dir='rtl'] .dropdownToolbarButton {
|
||||
margin: 3px 0 4px 2px;
|
||||
}
|
||||
|
||||
.toolbarButton:hover,
|
||||
.toolbarButton:focus,
|
||||
.dropdownToolbarButton {
|
||||
background-color: hsla(0,0%,0%,.12);
|
||||
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: -webkit-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: -moz-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: -ms-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: -o-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-clip: padding-box;
|
||||
border: 1px solid hsla(0,0%,0%,.35);
|
||||
border-color: hsla(0,0%,0%,.32) hsla(0,0%,0%,.38) hsla(0,0%,0%,.42);
|
||||
box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset,
|
||||
0 0 1px hsla(0,0%,100%,.15) inset,
|
||||
0 1px 0 hsla(0,0%,100%,.05);
|
||||
}
|
||||
|
||||
.toolbarButton:hover:active,
|
||||
.dropdownToolbarButton:hover:active {
|
||||
background-color: hsla(0,0%,0%,.2);
|
||||
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: -webkit-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: -moz-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: -ms-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: -o-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
border-color: hsla(0,0%,0%,.35) hsla(0,0%,0%,.4) hsla(0,0%,0%,.45);
|
||||
box-shadow: 0 1px 1px hsla(0,0%,0%,.1) inset,
|
||||
0 0 1px hsla(0,0%,0%,.2) inset,
|
||||
0 1px 0 hsla(0,0%,100%,.05);
|
||||
}
|
||||
|
||||
.splitToolbarButton:hover > .toolbarButton,
|
||||
.splitToolbarButton:focus > .toolbarButton,
|
||||
.splitToolbarButton.toggled > .toolbarButton,
|
||||
.toolbarButton.textButton {
|
||||
background-color: hsla(0,0%,0%,.12);
|
||||
background-image: -webkit-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: -moz-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: -ms-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: -o-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-clip: padding-box;
|
||||
border: 1px solid hsla(0,0%,0%,.35);
|
||||
border-color: hsla(0,0%,0%,.32) hsla(0,0%,0%,.38) hsla(0,0%,0%,.42);
|
||||
box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset,
|
||||
0 0 1px hsla(0,0%,100%,.15) inset,
|
||||
0 1px 0 hsla(0,0%,100%,.05);
|
||||
-webkit-transition-property: background-color, border-color, box-shadow;
|
||||
-webkit-transition-duration: 150ms;
|
||||
-webkit-transition-timing-function: ease;
|
||||
-moz-transition-property: background-color, border-color, box-shadow;
|
||||
-moz-transition-duration: 150ms;
|
||||
-moz-transition-timing-function: ease;
|
||||
-ms-transition-property: background-color, border-color, box-shadow;
|
||||
-ms-transition-duration: 150ms;
|
||||
-ms-transition-timing-function: ease;
|
||||
-o-transition-property: background-color, border-color, box-shadow;
|
||||
-o-transition-duration: 150ms;
|
||||
-o-transition-timing-function: ease;
|
||||
transition-property: background-color, border-color, box-shadow;
|
||||
transition-duration: 150ms;
|
||||
transition-timing-function: ease;
|
||||
|
||||
}
|
||||
.splitToolbarButton > .toolbarButton:hover,
|
||||
.splitToolbarButton > .toolbarButton:focus,
|
||||
.dropdownToolbarButton:hover,
|
||||
.toolbarButton.textButton:hover,
|
||||
.toolbarButton.textButton:focus {
|
||||
background-color: hsla(0,0%,0%,.2);
|
||||
box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset,
|
||||
0 0 1px hsla(0,0%,100%,.15) inset,
|
||||
0 0 1px hsla(0,0%,0%,.05);
|
||||
z-index: 199;
|
||||
}
|
||||
|
||||
|
||||
.splitToolbarButton:hover > .toolbarButton,
|
||||
.splitToolbarButton:focus > .toolbarButton,
|
||||
.splitToolbarButton.toggled > .toolbarButton,
|
||||
.toolbarButton.textButton {
|
||||
background-color: hsla(0,0%,0%,.12);
|
||||
background-image: -webkit-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: -moz-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: -ms-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: -o-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-clip: padding-box;
|
||||
border: 1px solid hsla(0,0%,0%,.35);
|
||||
border-color: hsla(0,0%,0%,.32) hsla(0,0%,0%,.38) hsla(0,0%,0%,.42);
|
||||
box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset,
|
||||
0 0 1px hsla(0,0%,100%,.15) inset,
|
||||
0 1px 0 hsla(0,0%,100%,.05);
|
||||
-webkit-transition-property: background-color, border-color, box-shadow;
|
||||
-webkit-transition-duration: 150ms;
|
||||
-webkit-transition-timing-function: ease;
|
||||
-moz-transition-property: background-color, border-color, box-shadow;
|
||||
-moz-transition-duration: 150ms;
|
||||
-moz-transition-timing-function: ease;
|
||||
-ms-transition-property: background-color, border-color, box-shadow;
|
||||
-ms-transition-duration: 150ms;
|
||||
-ms-transition-timing-function: ease;
|
||||
-o-transition-property: background-color, border-color, box-shadow;
|
||||
-o-transition-duration: 150ms;
|
||||
-o-transition-timing-function: ease;
|
||||
transition-property: background-color, border-color, box-shadow;
|
||||
transition-duration: 150ms;
|
||||
transition-timing-function: ease;
|
||||
|
||||
}
|
||||
.splitToolbarButton > .toolbarButton:hover,
|
||||
.splitToolbarButton > .toolbarButton:focus,
|
||||
.dropdownToolbarButton:hover,
|
||||
.toolbarButton.textButton:hover,
|
||||
.toolbarButton.textButton:focus {
|
||||
background-color: hsla(0,0%,0%,.2);
|
||||
box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset,
|
||||
0 0 1px hsla(0,0%,100%,.15) inset,
|
||||
0 0 1px hsla(0,0%,0%,.05);
|
||||
z-index: 199;
|
||||
}
|
||||
|
||||
.dropdownToolbarButton {
|
||||
border: 1px solid #333 !important;
|
||||
}
|
||||
|
||||
.toolbarButton,
|
||||
.dropdownToolbarButton {
|
||||
min-width: 16px;
|
||||
padding: 2px 6px 2px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 2px;
|
||||
color: hsl(0,0%,95%);
|
||||
font-size: 12px;
|
||||
line-height: 14px;
|
||||
-webkit-user-select:none;
|
||||
-moz-user-select:none;
|
||||
-ms-user-select:none;
|
||||
/* Opera does not support user-select, use <... unselectable="on"> instead */
|
||||
cursor: default;
|
||||
-webkit-transition-property: background-color, border-color, box-shadow;
|
||||
-webkit-transition-duration: 150ms;
|
||||
-webkit-transition-timing-function: ease;
|
||||
-moz-transition-property: background-color, border-color, box-shadow;
|
||||
-moz-transition-duration: 150ms;
|
||||
-moz-transition-timing-function: ease;
|
||||
-ms-transition-property: background-color, border-color, box-shadow;
|
||||
-ms-transition-duration: 150ms;
|
||||
-ms-transition-timing-function: ease;
|
||||
-o-transition-property: background-color, border-color, box-shadow;
|
||||
-o-transition-duration: 150ms;
|
||||
-o-transition-timing-function: ease;
|
||||
transition-property: background-color, border-color, box-shadow;
|
||||
transition-duration: 150ms;
|
||||
transition-timing-function: ease;
|
||||
}
|
||||
|
||||
html[dir='ltr'] .toolbarButton,
|
||||
html[dir='ltr'] .dropdownToolbarButton {
|
||||
margin: 3px 2px 4px 0;
|
||||
}
|
||||
html[dir='rtl'] .toolbarButton,
|
||||
html[dir='rtl'] .dropdownToolbarButton {
|
||||
margin: 3px 0 4px 2px;
|
||||
}
|
||||
|
||||
.splitToolbarButton:hover > .splitToolbarButtonSeparator,
|
||||
.splitToolbarButton.toggled > .splitToolbarButtonSeparator {
|
||||
padding: 12px 0;
|
||||
margin: 0;
|
||||
box-shadow: 0 0 0 1px hsla(0,0%,100%,.03);
|
||||
-webkit-transition-property: padding;
|
||||
-webkit-transition-duration: 10ms;
|
||||
-webkit-transition-timing-function: ease;
|
||||
-moz-transition-property: padding;
|
||||
-moz-transition-duration: 10ms;
|
||||
-moz-transition-timing-function: ease;
|
||||
-ms-transition-property: padding;
|
||||
-ms-transition-duration: 10ms;
|
||||
-ms-transition-timing-function: ease;
|
||||
-o-transition-property: padding;
|
||||
-o-transition-duration: 10ms;
|
||||
-o-transition-timing-function: ease;
|
||||
transition-property: padding;
|
||||
transition-duration: 10ms;
|
||||
transition-timing-function: ease;
|
||||
}
|
||||
|
||||
.toolbarButton.toggled:hover:active,
|
||||
.splitToolbarButton > .toolbarButton:hover:active {
|
||||
background-color: hsla(0,0%,0%,.4);
|
||||
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,
|
||||
0 0 1px hsla(0,0%,0%,.3) inset,
|
||||
0 1px 0 hsla(0,0%,100%,.05);
|
||||
}
|
||||
|
||||
html[dir='ltr'] .splitToolbarButton > .toolbarButton:first-child,
|
||||
html[dir='rtl'] .splitToolbarButton > .toolbarButton:last-child {
|
||||
position: relative;
|
||||
margin: 0;
|
||||
margin-left: 4px;
|
||||
margin-right: -1px;
|
||||
border-top-left-radius: 2px;
|
||||
border-bottom-left-radius: 2px;
|
||||
border-right-color: transparent;
|
||||
}
|
||||
html[dir='ltr'] .splitToolbarButton > .toolbarButton:last-child,
|
||||
html[dir='rtl'] .splitToolbarButton > .toolbarButton:first-child {
|
||||
position: relative;
|
||||
margin: 0;
|
||||
margin-left: -1px;
|
||||
border-top-right-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
border-left-color: transparent;
|
||||
}
|
||||
.splitToolbarButtonSeparator {
|
||||
padding: 8px 0;
|
||||
width: 1px;
|
||||
background-color: hsla(0,0%,00%,.5);
|
||||
z-index: 99;
|
||||
box-shadow: 0 0 0 1px hsla(0,0%,100%,.08);
|
||||
display: inline-block;
|
||||
margin: 5px 0;
|
||||
}
|
||||
html[dir='ltr'] .splitToolbarButtonSeparator {
|
||||
float:left;
|
||||
}
|
||||
html[dir='rtl'] .splitToolbarButtonSeparator {
|
||||
float:right;
|
||||
}
|
||||
|
||||
.dropdownToolbarButton {
|
||||
min-width: 120px;
|
||||
max-width: 120px;
|
||||
padding: 4px 2px 4px;
|
||||
overflow: hidden;
|
||||
background: url(images/toolbarButton-menuArrows.png) no-repeat;
|
||||
}
|
||||
|
||||
.dropdownToolbarButton > select {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none; /* in the future this might matter, see bugzilla bug #649849 */
|
||||
min-width: 140px;
|
||||
font-size: 12px;
|
||||
color: hsl(0,0%,95%);
|
||||
margin:0;
|
||||
padding:0;
|
||||
border:none;
|
||||
background: rgba(0,0,0,0); /* Opera does not support 'transparent' <select> background */
|
||||
}
|
||||
|
||||
.dropdownToolbarButton > select > option {
|
||||
background: hsl(0,0%,24%);
|
||||
}
|
||||
|
||||
#pageWidthOption {
|
||||
border-bottom: 1px rgba(255, 255, 255, .5) solid;
|
||||
}
|
||||
|
||||
|
||||
html[dir='ltr'] .dropdownToolbarButton {
|
||||
background-position: 95%;
|
||||
}
|
||||
html[dir='rtl'] .dropdownToolbarButton {
|
||||
background-position: 5%;
|
||||
}
|
||||
|
||||
|
||||
.toolbarButton.fullscreen::before {
|
||||
display: inline-block;
|
||||
content: url(images/toolbarButton-fullscreen.png);
|
||||
}
|
||||
|
||||
.toolbarButton.presentation::before {
|
||||
display: inline-block;
|
||||
content: url(images/toolbarButton-presentation.png);
|
||||
}
|
||||
|
||||
.toolbarButton.download::before {
|
||||
display: inline-block;
|
||||
content: url(images/toolbarButton-download.png);
|
||||
}
|
||||
|
||||
.toolbarButton.zoomOut::before {
|
||||
display: inline-block;
|
||||
content: url(images/toolbarButton-zoomOut.png);
|
||||
}
|
||||
|
||||
.toolbarButton.zoomIn::before {
|
||||
display: inline-block;
|
||||
content: url(images/toolbarButton-zoomIn.png);
|
||||
}
|
||||
|
||||
.toolbarButton.pageUp::before {
|
||||
display: inline-block;
|
||||
content: url(images/toolbarButton-pageUp.png);
|
||||
}
|
||||
|
||||
.toolbarButton.pageDown::before {
|
||||
display: inline-block;
|
||||
content: url(images/toolbarButton-pageDown.png);
|
||||
}
|
||||
|
||||
.toolbarField.pageNumber {
|
||||
min-width: 16px;
|
||||
text-align: right;
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
.toolbarField {
|
||||
padding: 3px 6px;
|
||||
margin: 4px 0 4px 0;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 2px;
|
||||
background-color: hsla(0,0%,100%,.09);
|
||||
background-image: -moz-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
|
||||
background-clip: padding-box;
|
||||
border: 1px solid hsla(0,0%,0%,.35);
|
||||
border-color: hsla(0,0%,0%,.32) hsla(0,0%,0%,.38) hsla(0,0%,0%,.42);
|
||||
box-shadow: 0 1px 0 hsla(0,0%,0%,.05) inset,
|
||||
0 1px 0 hsla(0,0%,100%,.05);
|
||||
color: hsl(0,0%,95%);
|
||||
font-size: 12px;
|
||||
line-height: 14px;
|
||||
outline-style: none;
|
||||
-moz-transition-property: background-color, border-color, box-shadow;
|
||||
-moz-transition-duration: 150ms;
|
||||
-moz-transition-timing-function: ease;
|
||||
}
|
||||
|
||||
.toolbarField.pageNumber::-webkit-inner-spin-button,
|
||||
.toolbarField.pageNumber::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.toolbarField:hover {
|
||||
background-color: hsla(0,0%,100%,.11);
|
||||
border-color: hsla(0,0%,0%,.4) hsla(0,0%,0%,.43) hsla(0,0%,0%,.45);
|
||||
}
|
||||
|
||||
.toolbarField:focus {
|
||||
background-color: hsla(0,0%,100%,.15);
|
||||
border-color: hsla(204,100%,65%,.8) hsla(204,100%,65%,.85) hsla(204,100%,65%,.9);
|
||||
}
|
||||
|
||||
.toolbarLabel {
|
||||
min-width: 16px;
|
||||
padding: 3px 6px 3px 2px;
|
||||
margin: 4px 2px 4px 0;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 2px;
|
||||
color: hsl(0,0%,85%);
|
||||
font-size: 12px;
|
||||
line-height: 14px;
|
||||
text-align: left;
|
||||
-webkit-user-select:none;
|
||||
-moz-user-select:none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
#canvasContainer {
|
||||
overflow: auto;
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px;
|
||||
position: absolute;
|
||||
top: 32px;
|
||||
right: 0;
|
||||
bottom: 32px;
|
||||
left: 0;
|
||||
|
||||
text-align: center;
|
||||
|
||||
background-color: #888;
|
||||
background-image: url(images/texture.png);
|
||||
}
|
||||
|
||||
.presentationMode {
|
||||
top: 0 !important;
|
||||
bottom: 0 !important;
|
||||
background-color: black !important;
|
||||
cursor: default !important;
|
||||
}
|
||||
|
||||
#canvas {
|
||||
overflow: hidden;
|
||||
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);
|
||||
}
|
||||
|
||||
#sliderContainer {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#overlayNavigator {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
top: calc(50% - 50px);
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
z-index: 3;
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity 1s ease-out;
|
||||
-moz-transition: opacity 1s ease-out;
|
||||
transition: opacity 1s ease-out;
|
||||
}
|
||||
#previousPage {
|
||||
float: left;
|
||||
margin-left: 10px;
|
||||
|
||||
/* CSS triangle */
|
||||
border-top: 50px solid transparent;
|
||||
border-bottom: 50px solid transparent;
|
||||
border-right: 50px solid black;
|
||||
|
||||
opacity: 0.5;
|
||||
}
|
||||
#nextPage {
|
||||
float: right;
|
||||
margin-right: 10px;
|
||||
|
||||
/* CSS triangle */
|
||||
border-top: 50px solid transparent;
|
||||
border-bottom: 50px solid transparent;
|
||||
border-left: 50px solid black;
|
||||
|
||||
opacity: 0.5;
|
||||
}
|
||||
#previousPage:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
#nextPage:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
#overlayCloseButton {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
z-index: 3;
|
||||
font-size: 35px;
|
||||
color: white;
|
||||
background-color: black;
|
||||
opacity: 0.5;
|
||||
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
-webkit-border-radius: 20px;
|
||||
-moz-border-radius: 20px;
|
||||
border-radius: 20px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
}
|
||||
#overlayCloseButton:active {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 600px) and (max-height: 1000px) {
|
||||
#canvasContainer {
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
#titlebar, #toolbarContainer {
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
background-image: none;
|
||||
}
|
||||
#overlayNavigator.touched {
|
||||
display: block;
|
||||
opacity: 1;
|
||||
height: 100px;
|
||||
}
|
||||
#next, #previous {
|
||||
display: none;
|
||||
}
|
||||
}
|
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
|
||||
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://www.webodf.org/
|
||||
@source: http://gitorious.org/webodf/webodf/
|
||||
*/
|
||||
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()?
|
||||
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=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?
|
||||
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)};
|
||||
this.zoomOut=function(){var a=(b.getZoomLevel()/1.1).toFixed(2),a=Math.max(0.25,a);g(a,!0)};this.zoomIn=function(){var a=(1.1*b.getZoomLevel()).toFixed(2),a=Math.min(4,a);g(a,!0)};(function(){b.initialize();document.cancelFullScreen||(document.mozCancelFullScreen||document.webkitCancelFullScreen)||(document.getElementById("fullscreen").style.visibility="hidden");document.getElementById("overlayCloseButton").addEventListener("click",b.toggleFullScreen);document.getElementById("fullscreen").addEventListener("click",
|
||||
b.toggleFullScreen);document.getElementById("presentation").addEventListener("click",function(){p()||b.toggleFullScreen();b.togglePresentationMode()});document.addEventListener("fullscreenchange",q);document.addEventListener("webkitfullscreenchange",q);document.addEventListener("mozfullscreenchange",q);document.getElementById("download").addEventListener("click",function(){b.download()});document.getElementById("zoomOut").addEventListener("click",function(){b.zoomOut()});document.getElementById("zoomIn").addEventListener("click",
|
||||
function(){b.zoomIn()});document.getElementById("previous").addEventListener("click",function(){b.showPreviousPage()});document.getElementById("next").addEventListener("click",function(){b.showNextPage()});document.getElementById("previousPage").addEventListener("click",function(){b.showPreviousPage()});document.getElementById("nextPage").addEventListener("click",function(){b.showNextPage()});document.getElementById("pageNumber").addEventListener("change",function(){b.showPage(this.value)});document.getElementById("scaleSelect").addEventListener("change",
|
||||
function(){g(this.value)});d.addEventListener("click",r);s.addEventListener("click",r);window.addEventListener("scalechange",function(a){var b=document.getElementById("customScaleOption"),c=u(String(a.scale));b.selected=!1;c||(b.textContent=Math.round(1E4*a.scale)/100+"%",b.selected=!0)},!0);window.addEventListener("resize",function(a){A&&(document.getElementById("pageWidthOption").selected||document.getElementById("pageAutoOption").selected)&&g(document.getElementById("scaleSelect").value);r()});
|
||||
window.addEventListener("keydown",function(a){var c=a.shiftKey;switch(a.keyCode){case 38:case 37:b.showPreviousPage();break;case 40:case 39:b.showNextPage();break;case 32:c?b.showPreviousPage():b.showNextPage()}})})()};
|
@@ -128,6 +128,18 @@ function addConfirmTo(op_ele, popup) {
|
||||
});
|
||||
}
|
||||
|
||||
function showConfirm(title, content, yesCallback) {
|
||||
var $popup = $("#confirm-popup");
|
||||
var $cont = $('#confirm-con');
|
||||
var $yesBtn = $('#confirm-yes');
|
||||
|
||||
$cont.html('<h3>' + title + '</h3><p>' + content + '</p>');
|
||||
$popup.modal({appendTo: '#main'});
|
||||
$('#simplemodal-container').css({'height':'auto'});
|
||||
|
||||
$yesBtn.click(yesCallback);
|
||||
}
|
||||
|
||||
function addFormPost(op_ele) {
|
||||
op_ele.click(function() {
|
||||
$('<form>', {
|
||||
@@ -617,3 +629,31 @@ var FileTree = {
|
||||
this.renderTree($container, $form, initial_data, {'dir_only': true});
|
||||
}
|
||||
};
|
||||
|
||||
function quotaSizeFormat(bytes, precision) {
|
||||
var kilobyte = 1000;
|
||||
var megabyte = kilobyte * 1000;
|
||||
var gigabyte = megabyte * 1000;
|
||||
var terabyte = gigabyte * 1000;
|
||||
|
||||
var precision = precision || 0;
|
||||
|
||||
if ((bytes >= 0) && (bytes < kilobyte)) {
|
||||
return bytes + ' B';
|
||||
|
||||
} else if ((bytes >= kilobyte) && (bytes < megabyte)) {
|
||||
return (bytes / kilobyte).toFixed(precision) + ' KB';
|
||||
|
||||
} else if ((bytes >= megabyte) && (bytes < gigabyte)) {
|
||||
return (bytes / megabyte).toFixed(precision) + ' MB';
|
||||
|
||||
} else if ((bytes >= gigabyte) && (bytes < terabyte)) {
|
||||
return (bytes / gigabyte).toFixed(precision) + ' GB';
|
||||
|
||||
} else if (bytes >= terabyte) {
|
||||
return (bytes / terabyte).toFixed(precision) + ' TB';
|
||||
|
||||
} else {
|
||||
return bytes + ' B';
|
||||
}
|
||||
}
|
||||
|