From fdfbcd16a9a8fef49b75fd30841893e760ab8c24 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (l)" <j.wuttke@fz-juelich.de> Date: Thu, 27 Feb 2020 09:53:34 +0100 Subject: [PATCH] remove pdf2html No need for this extra complication, it seems. --- Doc/pdf2html/README | 9 - Doc/pdf2html/base.min.css | 207 ------- Doc/pdf2html/bullet.gif | Bin 62 -> 0 bytes Doc/pdf2html/compatibility.min.js | 7 - Doc/pdf2html/fancy.css | 83 --- Doc/pdf2html/manifest | 140 ----- Doc/pdf2html/minus.gif | Bin 87 -> 0 bytes Doc/pdf2html/mktree.css | 23 - Doc/pdf2html/mktree.js | 168 ------ Doc/pdf2html/pdf2htmlEX-64x64.png | Bin 3422 -> 0 bytes Doc/pdf2html/pdf2htmlEX.js | 970 ------------------------------ Doc/pdf2html/plus.gif | Bin 89 -> 0 bytes 12 files changed, 1607 deletions(-) delete mode 100644 Doc/pdf2html/README delete mode 100644 Doc/pdf2html/base.min.css delete mode 100644 Doc/pdf2html/bullet.gif delete mode 100644 Doc/pdf2html/compatibility.min.js delete mode 100644 Doc/pdf2html/fancy.css delete mode 100644 Doc/pdf2html/manifest delete mode 100644 Doc/pdf2html/minus.gif delete mode 100644 Doc/pdf2html/mktree.css delete mode 100644 Doc/pdf2html/mktree.js delete mode 100644 Doc/pdf2html/pdf2htmlEX-64x64.png delete mode 100644 Doc/pdf2html/pdf2htmlEX.js delete mode 100644 Doc/pdf2html/plus.gif diff --git a/Doc/pdf2html/README b/Doc/pdf2html/README deleted file mode 100644 index bf159c4300a..00000000000 --- a/Doc/pdf2html/README +++ /dev/null @@ -1,9 +0,0 @@ -Convert the manual from PDF to HTML: - -Use patched pdf2htmlEX from https://github.com/jwuttke/pdf2htmlEX, branch mktree - -Run in this directory: -pdf2htmlEX --zoom 1.4 --data-dir . /home/jwu/prj/ba/manual-arch/BornAgainManual-1.5.1.pdf - -Copy result: -scp BornAgainManual-1.5.1.html apps@a:/www/apps/src/BornAgain/ \ No newline at end of file diff --git a/Doc/pdf2html/base.min.css b/Doc/pdf2html/base.min.css deleted file mode 100644 index bfc8165e4da..00000000000 --- a/Doc/pdf2html/base.min.css +++ /dev/null @@ -1,207 +0,0 @@ -/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab filetype=css: */ -/*! - * Base CSS for pdf2htmlEX - * Copyright 2012,2013 Lu Wang <coolwanglu@gmail.com> - * https://github.com/coolwanglu/pdf2htmlEX/blob/master/share/LICENSE - */ -/* Part 1: Web Page Layout: Free to modify, except for a few of them which are required by pdf2htmlEX.js, see the comments */ -#sidebar { /* Sidebar */ - position:absolute; - top:0; - left:0; - bottom:0; - width:300px; - padding:0; - margin:0px; - overflow:auto; -} -#page-container { /* PDF container */ - position:absolute; /* required for calculating relative positions of pages in pdf2htmlEX.js */ - top:0; - left:0px; - margin:0; - padding:0; - border:0; /* required for lazy page loading in pdf2htmlEX.js (page visibility test) */ -} -@media screen { - /* for sidebar */ - #sidebar.opened + #page-container { left:300px; } /* same width as in #sidebar [-> above] */ - #page-container { - /* `bottom' and `right' are required for lazy page loading in pdf2htmlEX.js (page visibility test) - * alternatively you may set width and height - */ - bottom:0; - right:0; - overflow:auto; - } - .loading-indicator { - display:none; - } - .loading-indicator.active { - display:block; - position:absolute; - width:64px; - height:64px; - top:50%; - left:50%; - margin-top:-32px; - margin-left:-32px; - } - .loading-indicator img { - position:absolute; - top:0; - left:0; - bottom:0; - right:0; - } -} -@media print { - @page { margin:0; } - html { margin:0; } - body { - margin:0; - -webkit-print-color-adjust:exact; /* enable printing background images for WebKit */ - } - #sidebar { display:none; } - #page-container { - width:auto; - height:auto; - overflow:visible; - background-color:transparent; - } - .d { display:none; } -} -/* Part 2: Page Elements: Modify with caution - * The followings are base classes, some of which are meant to be override by PDF specific classes - * So do not increase the specificity (e.g. ".classname" -> "#page-container .classname") - */ -.pf { /* page */ - position:relative; - background-color:white; - overflow: hidden; - margin:0; - border:0; /* required by pdf2htmlEX.js for page visibility test */ -} -.pc { /* content of a page */ - position:absolute; - border:0; - padding:0; - margin:0; - top:0; - left:0; - width:100%; - height:100%; - overflow:hidden; - display:block; - /* set transform-origin for scaling */ - transform-origin:0% 0%; - -ms-transform-origin:0% 0%; - -webkit-transform-origin:0% 0%; -} -.pc.opened { /* used by pdf2htmlEX.js, to show/hide pages */ - display:block; -} -.bf { /* images that occupies the whole page */ - position:absolute; - border:0; - margin:0; - top:0; - bottom:0; - width:100%; - height:100%; - -ms-user-select:none; - -moz-user-select:none; - -webkit-user-select:none; - user-select:none; -} -.bi { /* images that cover only a part of the page */ - position:absolute; - border:0; - margin:0; - -ms-user-select:none; - -moz-user-select:none; - -webkit-user-select:none; - user-select:none; -} -@media print { - .pf { - margin:0; - box-shadow:none; - page-break-after:always; - page-break-inside:avoid; - } - @-moz-document url-prefix() { - /* fix page truncation for FireFox */ - .pf { - overflow:visible; - border:1px solid #FFFFFF; - } - .pc {overflow:visible;} - } -} -.c { /* clip box */ - position:absolute; - border:0; - padding:0; - margin:0; - overflow:hidden; - display:block; -} -.t { /* text line */ - position:absolute; - white-space:pre; - font-size:1px; - transform-origin:0% 100%; - -ms-transform-origin:0% 100%; - -webkit-transform-origin:0% 100%; - unicode-bidi:bidi-override;/* For rtl languages, e.g. Hebrew, we don't want the default Unicode behaviour */ - -moz-font-feature-settings:"liga" 0;/* We don't want Firefox to recognize ligatures */ -} -.t:after { /* webkit #35443 */ - content: ''; -} -.t:before { /* Workaround Blink(up to 41)/Webkit bug of word-spacing with leading spaces (chromium #404444 and pdf2htmlEX #412) */ - content: ''; - display: inline-block; -} -.t span { /* text blocks within a line */ - /* Blink(up to 41)/Webkit have bug with negative word-spacing and inline-block (pdf2htmlEX #416), so keep normal span inline. */ - position:relative; - unicode-bidi:bidi-override; /* For rtl languages, e.g. Hebrew, we don't want the default Unicode behaviour */ -} -._ { /* text shift */ - /* Blink(up to 41)/Webkit have bug with inline element, continuous spaces and word-spacing. Workaround by inline-block. */ - display: inline-block; - color: transparent; - z-index: -1; -} -/* selection background should not be opaque, for fallback mode */ -::selection{ - background: rgba(127,255,255,0.4); -} -::-moz-selection{ - background: rgba(127,255,255,0.4); -} -.pi { /* info for Javascript */ - display:none; -} -.l { /* annotation links */ -} -/* transparent color - WebKit */ -.d { /* css drawing */ - position:absolute; - transform-origin:0% 100%; - -ms-transform-origin:0% 100%; - -webkit-transform-origin:0% 100%; -} -/* for the forms */ -.it { - border: none; - background-color: rgba(255, 255, 255, 0.0); -} - -.ir:hover { - cursor: pointer; -} - -/* Base CSS END */ diff --git a/Doc/pdf2html/bullet.gif b/Doc/pdf2html/bullet.gif deleted file mode 100644 index 6305baea0d4abcf93396243e8f8964c5c392ed0a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 62 zcmZ?wbhEHb6lM@+XkcUjf_LxUDgI;uG8q|kKzxu41CwY^|H{*E`4`XGqSv6wW_6pt L?U9EQD}yxv$P^G% diff --git a/Doc/pdf2html/compatibility.min.js b/Doc/pdf2html/compatibility.min.js deleted file mode 100644 index e5100988cc0..00000000000 --- a/Doc/pdf2html/compatibility.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - Copyright 2012 Mozilla Foundation - Copyright 2013 Lu Wang <coolwanglu@gmail.com> - Apachine License Version 2.0 -*/ -(function(){function b(a,b,e,f){var c=(a.className||"").split(/\s+/g);""===c[0]&&c.shift();var d=c.indexOf(b);0>d&&e&&c.push(b);0<=d&&f&&c.splice(d,1);a.className=c.join(" ");return 0<=d}if(!("classList"in document.createElement("div"))){var e={add:function(a){b(this.element,a,!0,!1)},contains:function(a){return b(this.element,a,!1,!1)},remove:function(a){b(this.element,a,!1,!0)},toggle:function(a){b(this.element,a,!0,!0)}};Object.defineProperty(HTMLElement.prototype,"classList",{get:function(){if(this._classList)return this._classList; -var a=Object.create(e,{element:{value:this,writable:!1,enumerable:!0}});Object.defineProperty(this,"_classList",{value:a,writable:!1,enumerable:!1});return a},enumerable:!0})}})(); diff --git a/Doc/pdf2html/fancy.css b/Doc/pdf2html/fancy.css deleted file mode 100644 index d4caa5cb285..00000000000 --- a/Doc/pdf2html/fancy.css +++ /dev/null @@ -1,83 +0,0 @@ -/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab filetype=css: */ -/*! - * Fancy styles for pdf2htmlEX - * Copyright 2012,2013 Lu Wang <coolwanglu@gmail.com> - * https://github.com/coolwanglu/pdf2htmlEX/blob/master/share/LICENSE - */ -@keyframes fadein { from { opacity:0;} to { opacity:1;} } -@-webkit-keyframes fadein { from { opacity:0;} to { opacity:1;} } -@keyframes swing { - 0% { transform: rotate(0deg); } - 10% { transform: rotate(0deg); } - 90% { transform: rotate(720deg); } - 100%{ transform: rotate(720deg); } -} -@-webkit-keyframes swing { - 0% { -webkit-transform: rotate(0deg); } - 10% { -webkit-transform: rotate(0deg); } - 90% { -webkit-transform: rotate(720deg); } - 100%{ -webkit-transform: rotate(720deg); } -} -@media screen { - #sidebar { - background-color:#ddd; - font-family:Helvetica; - font-size:13px; - margin: 0em 0em; - padding-top: 2em; - padding-left: 2em; - /* modified from http://philbit.com/svgpatterns/#crossstripes */ - # background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0IiBoZWlnaHQ9IjQiPgo8cmVjdCB3aWR0aD0iNCIgaGVpZ2h0PSI0IiBmaWxsPSIjNDAzYzNmIj48L3JlY3Q+CjxwYXRoIGQ9Ik0wIDBMNCA0Wk00IDBMMCA0WiIgc3Ryb2tlLXdpZHRoPSIxIiBzdHJva2U9IiMxZTI5MmQiPjwvcGF0aD4KPC9zdmc+"); - } - #sidebar a, - #sidebar a:visited, - #sidebar a:hover, - #sidebar a:active { - line-height:1.2; - color:#000; - text-decoration:none; - } - #sidebar a:hover { - color:#00f; - } - #outline { - width:280px; - margin: 0px -20px; - /*text-overflow:ellipsis; - overflow:hidden; - display:block; - outline:0; - white-space:nowrap; */ - } - #page-container { - background-color:#9e9e9e; - /* http://philbit.com/svgpatterns/#thinstripes */ - background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1IiBoZWlnaHQ9IjUiPgo8cmVjdCB3aWR0aD0iNSIgaGVpZ2h0PSI1IiBmaWxsPSIjOWU5ZTllIj48L3JlY3Q+CjxwYXRoIGQ9Ik0wIDVMNSAwWk02IDRMNCA2Wk0tMSAxTDEgLTFaIiBzdHJva2U9IiM4ODgiIHN0cm9rZS13aWR0aD0iMSI+PC9wYXRoPgo8L3N2Zz4="); - /* -webkit-transition:left 500ms; */ - /* transition:left 500ms; */ - } - .pf { - margin: 13px auto; - box-shadow: 1px 1px 3px 1px #333; - /* Needed by IE to make box-shadow works * https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow */ - border-collapse: separate; - } - .pc.opened { /* used by pdf2htmlEX.js, to show/hide pages */ - -webkit-animation: fadein 10ms; - animation: fadein 10ms; - } - .loading-indicator.active { - /* - * use 0.01s instead of 0s, - * since YUI Compressor will change 0s to 0, - * which is not recognized by Firefox - */ - -webkit-animation: swing 0.15s ease-in-out 0.01s infinite alternate none; - animation: swing 0.15s ease-in-out 0.01s infinite alternate none; - } -/* - .checked { - background: no-repeat url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3goQDSYgDiGofgAAAslJREFUOMvtlM9LFGEYx7/vvOPM6ywuuyPFihWFBUsdNnA6KLIh+QPx4KWExULdHQ/9A9EfUodYmATDYg/iRewQzklFWxcEBcGgEplDkDtI6sw4PzrIbrOuedBb9MALD7zv+3m+z4/3Bf7bZS2bzQIAcrmcMDExcTeXy10DAFVVAQDksgFUVZ1ljD3yfd+0LOuFpmnvVVW9GHhkZAQcxwkNDQ2FSCQyRMgJxnVdy7KstKZpn7nwha6urqqfTqfPBAJAuVymlNLXoigOhfd5nmeiKL5TVTV+lmIKwAOA7u5u6Lped2BsbOwjY6yf4zgQQkAIAcedaPR9H67r3uYBQFEUFItFtLe332lpaVkUBOHK3t5eRtf1DwAwODiIubk5DA8PM8bYW1EU+wEgCIJqsCAIQAiB7/u253k2BQDDMJBKpa4mEon5eDx+UxAESJL0uK2t7XosFlvSdf0QAEmlUnlRFJ9Waho2Qghc1/U9z3uWz+eX+Wr+lL6SZfleEAQIggA8z6OpqSknimIvYyybSCReMsZ6TislhCAIAti2Dc/zejVNWwCAavN8339j27YbTg0AGGM3WltbP4WhlRWq6Q/btrs1TVsYHx+vNgqKoqBUKn2NRqPFxsbGJzzP05puUlpt0ukyOI6z7zjOwNTU1OLo6CgmJyf/gA3DgKIoWF1d/cIY24/FYgOU0pp0z/Ityzo8Pj5OTk9PbwHA+vp6zWghDC+VSiuRSOQgGo32UErJ38CO42wdHR09LBQK3zKZDDY2NupmFmF4R0cHVlZWlmRZ/iVJUn9FeWWcCCE4ODjYtG27Z2Zm5juAOmgdGAB2d3cBADs7O8uSJN2SZfl+WKlpmpumaT6Yn58vn/fs6XmbhmHMNjc3tzDGFI7jYJrm5vb29sDa2trPC/9aiqJUy5pOp4f6+vqeJ5PJBAB0dnZe/t8NBajx/z37Df5OGX8d13xzAAAAAElFTkSuQmCC); - } */ -} -/* Fancy CSS END */ diff --git a/Doc/pdf2html/manifest b/Doc/pdf2html/manifest deleted file mode 100644 index 8de95fb33f5..00000000000 --- a/Doc/pdf2html/manifest +++ /dev/null @@ -1,140 +0,0 @@ -# pdf2htmlEX manifest -# Copyright (C) 2012,2013 Lu Wang <coolwanglu@gmail.com> -# -# Syntax -# The first char of each line is the command -# Empty lines are ignored -# -# # - comment -# @ - embed or link to a file from data dir, depending on the values of --embed-*** options -# $ - special use for pdf2htmlEX -# -# Special -# If a line contains """ only, all text until next """ will be included -# #TEST_IGNORE_BEGIN & #TEST_IGNORE_END are used for unittest - -############# -# Declaration - Do not modify -""" -<!DOCTYPE html> -<!-- Created by pdf2htmlEX (https://github.com/jwuttke/pdf2htmlex) --> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta charset="utf-8"/> -<meta name="generator" content="pdf2htmlEX"/> -<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> -<link rel="shortcut icon" href="../img/BornAgain_48x48.png" type="image/png" /> -<title>BornAgain Manual</title> -""" - -############# -# Styles -# base CSS styles - Do not modify -@base.min.css - -# fancy CSS styles - Optional -@fancy.css - -# PDF specific CSS styles - Do not modify -$css - - -@mktree.js -@mktree.css - -############# -# UI stuffs, optional - -# compatibility.min.js, extracted from PDF.js -# To support old browsers like IE9 -#TEST_IGNORE_BEGIN -@compatibility.min.js -#TEST_IGNORE_END - -# entry point of pdf2htmlEX.Viewer -# You can override default configuration by passing an object to the constructor of Viewer -# Refer to DEFAULT_CONFIG in viewer.js for possible keys -# E.g. -# pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({ -# 'key_handler' : false -# }); -#TEST_IGNORE_BEGIN -@pdf2htmlEX.js -""" -<script> -try{ - pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({}); -}catch(e){} -</script> -""" -#TEST_IGNORE_END - - -############# -# Do not modify -""" -<title></title> -</head> -<body> -""" - -############# -# The sidebar -# By default this is hidden, pdf2htmlEX.js will add the 'opened' class if it is not empty -# You can add a class 'opened' here if you want it always opened or you don't use pdf2htmlEX.js -# e.g. -# <div id="sidebar" class="opened"> - -#TEST_IGNORE_BEGIN -""" -<div id="sidebar"> -<a href="http://bornagainproject.org"> <img src="../img/BornAgain_64x64.png" alt="BornAgain" /><br/> -<a href="http://bornagainproject.org">➔ <b>BornAgain home</b></a><br/> -<a href="http://apps.jcns.fz-juelich.de/src/BornAgain">➔ <b>downloads</b></a><br/> -<a href="http://bornagainproject.org/contact">➔ <b>contact</b></a><br/> -<br/><br/> -<b>User Manual online</b><br/> -<div id="outline"> -""" -$outline -""" -</div> -</div> -""" -#TEST_IGNORE_END - -############# -# The container of PDF pages -# check base.css for an example and requirements of its CSS styles -""" -<div id="page-container"> -""" -$pages -""" -</div> -""" - -############# -# The loading indicator -# shown when loading a page via ajax -# The default appearance should be invisible -# The 'active' class will be added when it is used - -#TEST_IGNORE_BEGIN -""" -<div class="loading-indicator"> -""" -@pdf2htmlEX-64x64.png -""" -</div> -""" -#TEST_IGNORE_END - -############# -# Do not modify -""" -</body> -</html> -""" - -# MANIFEST END diff --git a/Doc/pdf2html/minus.gif b/Doc/pdf2html/minus.gif deleted file mode 100644 index 154e45a5ee2baa0bd114ee01417a3c595e13a7b4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 87 zcmZ?wbhEHb6lM@+n8?iV|NsAnh6V-(hIjAYDgI<(WME)s&;fFRvce1uOd50gSDt>$ rpUk}_OuXTqLc+dE;T4@eYD+S|Pkc6Mr|u7}Yr0Q=o%`<0$Y2cs-bNsJ diff --git a/Doc/pdf2html/mktree.css b/Doc/pdf2html/mktree.css deleted file mode 100644 index f4374e33d92..00000000000 --- a/Doc/pdf2html/mktree.css +++ /dev/null @@ -1,23 +0,0 @@ -/* Put this inside a @media qualifier so Netscape 4 ignores it */ -@media screen { - /* Turn off list bullets */ - ul.mktree li { list-style: none; } - /* Control how "spaced out" the tree is */ - ul.mktree, ul.mktree ul , ul.mktree li { margin-left:10px; padding:0px; text-indent: -20px} - /* Provide space for our own "bullet" inside the LI */ - ul.mktree li .bullet { padding-left: 15px; } - /* Show "bullets" in the links, depending on the class of the LI that the link's in */ - ul.mktree li.liOpen .bullet { cursor: pointer; background: url(../img/minus.gif) center left no-repeat; } - ul.mktree li.liClosed .bullet { cursor: pointer; background: url(../img/plus.gif) center left no-repeat; } - ul.mktree li.liBullet .bullet { cursor: default; background: url(../img/bullet.gif) center left no-repeat; } - /* Sublists are visible or not based on class of parent LI */ - ul.mktree li.liOpen ul { display: block; } - ul.mktree li.liClosed ul { display: none; } - - /* Format menu items differently depending on what level of the tree they are in */ - /* Uncomment this if you want your fonts to decrease in size the deeper they are in the tree */ -/* - ul.mktree li ul li { font-size: 90% } -*/ - -} diff --git a/Doc/pdf2html/mktree.js b/Doc/pdf2html/mktree.js deleted file mode 100644 index 857cd64ce4e..00000000000 --- a/Doc/pdf2html/mktree.js +++ /dev/null @@ -1,168 +0,0 @@ -/** - * Copyright (c)2005-2009 Matt Kruse (javascripttoolbox.com) - * - * Dual licensed under the MIT and GPL licenses. - * This basically means you can use this code however you want for - * free, but don't claim to have written it yourself! - * Donations always accepted: http://www.JavascriptToolbox.com/donate/ - * - * Please do not link to the .js files on javascripttoolbox.com from - * your site. Copy the files locally to your server instead. - * - */ -/* -This code is inspired by and extended from Stuart Langridge's aqlist code: - http://www.kryogenix.org/code/browser/aqlists/ - Stuart Langridge, November 2002 - sil@kryogenix.org - Inspired by Aaron's labels.js (http://youngpup.net/demos/labels/) - and Dave Lindquist's menuDropDown.js (http://www.gazingus.org/dhtml/?id=109) -*/ - -// Automatically attach a listener to the window onload, to convert the trees -addEvent(window,"load",convertTrees); - -// Utility function to add an event listener -function addEvent(o,e,f){ - if (o.addEventListener){ o.addEventListener(e,f,false); return true; } - else if (o.attachEvent){ return o.attachEvent("on"+e,f); } - else { return false; } -} - -// utility function to set a global variable if it is not already set -function setDefault(name,val) { - if (typeof(window[name])=="undefined" || window[name]==null) { - window[name]=val; - } -} - -// Full expands a tree with a given ID -function expandTree(treeId) { - var ul = document.getElementById(treeId); - if (ul == null) { return false; } - expandCollapseList(ul,nodeOpenClass); -} - -// Fully collapses a tree with a given ID -function collapseTree(treeId) { - var ul = document.getElementById(treeId); - if (ul == null) { return false; } - expandCollapseList(ul,nodeClosedClass); -} - -// Expands enough nodes to expose an LI with a given ID -function expandToItem(treeId,itemId) { - var ul = document.getElementById(treeId); - if (ul == null) { return false; } - var ret = expandCollapseList(ul,nodeOpenClass,itemId); - if (ret) { - var o = document.getElementById(itemId); - if (o.scrollIntoView) { - o.scrollIntoView(false); - } - } -} - -// Performs 3 functions: -// a) Expand all nodes -// b) Collapse all nodes -// c) Expand all nodes to reach a certain ID -function expandCollapseList(ul,cName,itemId) { - if (!ul.childNodes || ul.childNodes.length==0) { return false; } - // Iterate LIs - for (var itemi=0;itemi<ul.childNodes.length;itemi++) { - var item = ul.childNodes[itemi]; - if (itemId!=null && item.id==itemId) { return true; } - if (item.nodeName == "LI") { - // Iterate things in this LI - var subLists = false; - for (var sitemi=0;sitemi<item.childNodes.length;sitemi++) { - var sitem = item.childNodes[sitemi]; - if (sitem.nodeName=="UL") { - subLists = true; - var ret = expandCollapseList(sitem,cName,itemId); - if (itemId!=null && ret) { - item.className=cName; - return true; - } - } - } - if (subLists && itemId==null) { - item.className = cName; - } - } - } -} - -// Search the document for UL elements with the correct CLASS name, then process them -function convertTrees() { - setDefault("treeClass","mktree"); - setDefault("nodeClosedClass","liClosed"); - setDefault("nodeOpenClass","liOpen"); - setDefault("nodeBulletClass","liBullet"); - setDefault("nodeLinkClass","bullet"); - setDefault("preProcessTrees",true); - if (preProcessTrees) { - if (!document.createElement) { return; } // Without createElement, we can't do anything - var uls = document.getElementsByTagName("ul"); - if (uls==null) { return; } - var uls_length = uls.length; - for (var uli=0;uli<uls_length;uli++) { - var ul=uls[uli]; - if (ul.nodeName=="UL" && ul.className==treeClass) { - processList(ul); - } - } - } -} - -function treeNodeOnclick() { - this.parentNode.className = (this.parentNode.className==nodeOpenClass) ? nodeClosedClass : nodeOpenClass; - return false; -} -function retFalse() { - return false; -} -// Process a UL tag and all its children, to convert to a tree -function processList(ul) { - if (!ul.childNodes || ul.childNodes.length==0) { return; } - // Iterate LIs - var childNodesLength = ul.childNodes.length; - for (var itemi=0;itemi<childNodesLength;itemi++) { - var item = ul.childNodes[itemi]; - if (item.nodeName == "LI") { - // Iterate things in this LI - var subLists = false; - var itemChildNodesLength = item.childNodes.length; - for (var sitemi=0;sitemi<itemChildNodesLength;sitemi++) { - var sitem = item.childNodes[sitemi]; - if (sitem.nodeName=="UL") { - subLists = true; - processList(sitem); - } - } - var s= document.createElement("SPAN"); - var t= '\u00A0'; // - s.className = nodeLinkClass; - if (subLists) { - // This LI has UL's in it, so it's a +/- node - if (item.className==null || item.className=="") { - item.className = nodeClosedClass; - } - // If it's just text, make the text work as the link also - if (item.firstChild.nodeName=="#text") { - t = t+item.firstChild.nodeValue; - item.removeChild(item.firstChild); - } - s.onclick = treeNodeOnclick; - } - else { - // No sublists, so it's just a bullet node - item.className = nodeBulletClass; - s.onclick = retFalse; - } - s.appendChild(document.createTextNode(t)); - item.insertBefore(s,item.firstChild); - } - } -} diff --git a/Doc/pdf2html/pdf2htmlEX-64x64.png b/Doc/pdf2html/pdf2htmlEX-64x64.png deleted file mode 100644 index e3276fa03062e9cf32bd4e55fbe9cfbcd949d221..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3422 zcmb`JS5VUn)5e2<pmYMEL+HJQUZsRygwR8835O<K1f?TL5m5mVIf4{Hl-?9jIEo-h zN5Mmt4u&2QLXv-8&h>Zu?fiCkW-oT;nb~J%AK2NNF<s}q4g!IgEX?7E%Wm*r(o<j7 z@~%|OWurkG+8BaBEd>lDUs@1|8f0hfXmUCKe-EnvmV@Z2s2HzMLuhD)Xz69>8DR7* z+6=4|rbsgLEedl4o+V_2)q%(wie%;cz-EbH<GQ4g9p1xk+0Sk>$L@N<j;64Oj)3i} z!1}FVlOu2d8Z6`i=2_ryE8);s<#0dZ2w3JszU4I7hxi^t{C-1_6i9F(m(m%Re-5`? z1GgTQ+b@)de~Sl+=kdex`25AoTg$7p&Fcp6qE30eqxb{}e15n1_;GwbiTol_`~nI5 z!T^838Nb(U0ipYXA}N9*w*>|72nuBiiQN-|0z$rLLhi9pJ{;8jP}qec;$1DOlrAQ8 zBJK=`dtQjU;l!OQB;?8@Mej=r0#fc|X(UnFg)HOxTvnVc>-tbu=&>9WkaNMv+2G|6 zWO-*m-uaKbHD2CsU%`4;!SX@@v7=}XC^}v!*&Qfb0?LREnAADU7O!HxuWEL#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!Dn$;h(A1b7n5d_i;<l64SEPLS)EA|@NobGs zGY{7Tn4aDHwMgW(pk29c;2TeTdHnQs!g@n8)QT-<FN$;V3y$UqBXm~o#cyyw2Gdma zn)P!?RXB&e9BeL5y2!~9icm7G^XTE2#PN0KbzRNCTi<$-aCXF1Z7)1@KdbX6PCu}z zHSlG$ndj2x$VgjjNUP%-q94qmM8qw%Ieho+V;g=79E-klCPp-SSJ~h0s7Cm;TW%V{ z3U@XL+YyqoX7TzV$Qi|#wMs8ne)bvthzkgy$+or%(-p6+G^^QD@3=vq_Lk;Y`e@bj z)E;L~{yrKhmco<R&hz$9$3OAvnab7shTD${7FMRA%oMR0@rB=&=n7aZQ`Jq@jBf$3 zXQWEzFd<D^?X1}+E*E|SI;<^EI{FfIPPfiN)@7Hzj1Co?kykm+<_@X8EG<i%1nU#~ z@4d>{y+AH)h(WTEk|NRE<;Hs!4Hw}g$?iNJ&)zCMSSs6rU6}pu{!Crw7bmJo;$+*@ zS6cX0*6*LW6!nYJyg4iO#hZunDvs;xEy@GW(?X9MNLZ6KdC|nGfgp~@!1<6ylCSKB nWTgr~Atq=jrhR^1BuL@n+AaR}80@6=-!o`oVhe9H@=5z2re{lU diff --git a/Doc/pdf2html/pdf2htmlEX.js b/Doc/pdf2html/pdf2htmlEX.js deleted file mode 100644 index decc612d6dc..00000000000 --- a/Doc/pdf2html/pdf2htmlEX.js +++ /dev/null @@ -1,970 +0,0 @@ -/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab filetype=javascript : */ -/** - * @license pdf2htmlEX.js: Core UI functions for pdf2htmlEX - * Copyright 2012,2013 Lu Wang <coolwanglu@gmail.com> and other contributors - * https://github.com/coolwanglu/pdf2htmlEX/blob/master/share/LICENSE - */ - -/* - * Attention: - * This files is to be optimized by closure-compiler, - * so pay attention to the forms of property names: - * - * string/bracket form is safe, won't be optimized: - * var obj={ 'a':'b' }; obj['a'] = 'b'; - * name/dot form will be optimized, the name is likely to be modified: - * var obj={ a:'b' }; obj.a = 'b'; - * - * Either form can be used for internal objects, - * but must be consistent for each one respectively. - * - * string/bracket form must be used for external objects - * e.g. DEFAULT_CONFIG, object stored in page-data - * property names are part of the `protocol` in these cases. - * - */ - -'use strict'; - -var pdf2htmlEX = window['pdf2htmlEX'] = window['pdf2htmlEX'] || {}; - -/** - * @const - * @struct - */ -var CSS_CLASS_NAMES = { - page_frame : 'pf', - page_content_box : 'pc', - page_data : 'pi', - background_image : 'bi', - link : 'l', - input_radio : 'ir', - __dummy__ : 'no comma' -}; - -/** - * configurations of Viewer - * @const - * @dict - */ -var DEFAULT_CONFIG = { - // id of the element to put the pages in - 'container_id' : 'page-container', - // id of the element for sidebar (to open and close) - 'sidebar_id' : 'sidebar', - // id of the element for outline - 'outline_id' : 'outline', - // class for the loading indicator - 'loading_indicator_cls' : 'loading-indicator', - // How many page shall we preload that are below the last visible page - 'preload_pages' : 3, - // how many ms should we wait before actually rendering the pages and after a scroll event - 'render_timeout' : 10, - // zoom ratio step for each zoom in/out event - 'scale_step' : 0.9, - // register global key handler, allowing navigation by keyboard - 'key_handler' : true, - // register hashchange handler, navigate to the location specified by the hash - 'hashchange_handler' : true, - // register view history handler, allowing going back to the previous location - 'view_history_handler' : true, - - '__dummy__' : 'no comma' -}; - -/** @const */ -var EPS = 1e-6; - -/************************************/ -/* utility function */ -/** - * @param{Array.<number>} ctm - */ -function invert(ctm) { - var det = ctm[0] * ctm[3] - ctm[1] * ctm[2]; - return [ ctm[3] / det - ,-ctm[1] / det - ,-ctm[2] / det - ,ctm[0] / det - ,(ctm[2] * ctm[5] - ctm[3] * ctm[4]) / det - ,(ctm[1] * ctm[4] - ctm[0] * ctm[5]) / det - ]; -}; -/** - * @param{Array.<number>} ctm - * @param{Array.<number>} pos - */ -function transform(ctm, pos) { - return [ctm[0] * pos[0] + ctm[2] * pos[1] + ctm[4] - ,ctm[1] * pos[0] + ctm[3] * pos[1] + ctm[5]]; -}; - -/** - * @param{Element} ele - */ -function get_page_number(ele) { - return parseInt(ele.getAttribute('data-page-no'), 16); -}; - -/** - * @param{NodeList} eles - */ -function disable_dragstart(eles) { - for (var i = 0, l = eles.length; i < l; ++i) { - eles[i].addEventListener('dragstart', function() { - return false; - }, false); - } -}; - -/** - * @param{...Object} var_args - */ -function clone_and_extend_objs(var_args) { - var result_obj = {}; - for (var i = 0, l = arguments.length; i < l; ++i) { - var cur_obj = arguments[i]; - for (var k in cur_obj) { - if (cur_obj.hasOwnProperty(k)) { - result_obj[k] = cur_obj[k]; - } - } - } - return result_obj; -}; - -/** - * @constructor - * @param{Element} page The element for the page - */ -function Page(page) { - if (!page) return; - - this.loaded = false; - this.shown = false; - this.page = page; // page frame element - - this.num = get_page_number(page); - - // page size - // Need to make rescale work when page_content_box is not loaded, yet - this.original_height = page.clientHeight; - this.original_width = page.clientWidth; - - // content box - var content_box = page.getElementsByClassName(CSS_CLASS_NAMES.page_content_box)[0]; - - // if page is loaded - if (content_box) { - this.content_box = content_box; - /* - * scale ratios - * - * original_scale : the first one - * cur_scale : currently using - */ - this.original_scale = this.cur_scale = this.original_height / content_box.clientHeight; - this.page_data = JSON.parse(page.getElementsByClassName(CSS_CLASS_NAMES.page_data)[0].getAttribute('data-data')); - - this.ctm = this.page_data['ctm']; - this.ictm = invert(this.ctm); - - this.loaded = true; - } -}; -Page.prototype = { - /* hide & show are for contents, the page frame is still there */ - hide : function(){ - if (this.loaded && this.shown) { - this.content_box.classList.remove('opened'); - this.shown = false; - } - }, - show : function(){ - if (this.loaded && !this.shown) { - this.content_box.classList.add('opened'); - this.shown = true; - } - }, - /** - * @param{number} ratio - */ - rescale : function(ratio) { - if (ratio === 0) { - // reset scale - this.cur_scale = this.original_scale; - } else { - this.cur_scale = ratio; - } - - // scale the content box - if (this.loaded) { - var cbs = this.content_box.style; - cbs.msTransform = cbs.webkitTransform = cbs.transform = 'scale('+this.cur_scale.toFixed(3)+')'; - } - - // stretch the page frame to hold the place - { - var ps = this.page.style; - ps.height = (this.original_height * this.cur_scale) + 'px'; - ps.width = (this.original_width * this.cur_scale) + 'px'; - } - }, - /* - * return the coordinate of the top-left corner of container - * in our coordinate system - * assuming that p.parentNode === p.offsetParent - */ - view_position : function () { - var p = this.page; - var c = p.parentNode; - return [c.scrollLeft - p.offsetLeft - p.clientLeft - ,c.scrollTop - p.offsetTop - p.clientTop]; - }, - height : function () { - return this.page.clientHeight; - }, - width : function () { - return this.page.clientWidth; - } -}; - -/** - * @constructor - * @param{Object=} config - */ -function Viewer(config) { - this.config = clone_and_extend_objs(DEFAULT_CONFIG, (arguments.length > 0 ? config : {})); - this.pages_loading = []; - this.init_before_loading_content(); - - var self = this; - document.addEventListener('DOMContentLoaded', function(){ - self.init_after_loading_content(); - }, false); -}; - -Viewer.prototype = { - scale : 1, - /* - * index of the active page (the one with largest visible area) - * which estimates the page currently being viewed - */ - cur_page_idx : 0, - - /* - * index of the first visible page - * used when determining current view - */ - first_page_idx : 0, - - init_before_loading_content : function() { - /* hide all pages before loading, will reveal only visible ones later */ - this.pre_hide_pages(); - }, - - initialize_radio_button : function() { - var elements = document.getElementsByClassName(CSS_CLASS_NAMES.input_radio); - - for(var i = 0; i < elements.length; i++) { - var r = elements[i]; - - r.addEventListener('click', function() { - this.classList.toggle("checked"); - }); - } - }, - - init_after_loading_content : function() { - this.sidebar = document.getElementById(this.config['sidebar_id']); - this.outline = document.getElementById(this.config['outline_id']); - this.container = document.getElementById(this.config['container_id']); - this.loading_indicator = document.getElementsByClassName(this.config['loading_indicator_cls'])[0]; - - - { - // Open the outline if nonempty - var empty = true; - var nodes = this.outline.childNodes; - for (var i = 0, l = nodes.length; i < l; ++i) { - var cur_node = nodes[i]; - if (cur_node.nodeName.toLowerCase() === 'ul') { - empty = false; - break; - } - } - if (!empty) - this.sidebar.classList.add('opened'); - } - - this.find_pages(); - // do nothing if there's nothing - if(this.pages.length == 0) return; - - // disable dragging of background images - disable_dragstart(document.getElementsByClassName(CSS_CLASS_NAMES.background_image)); - - if (this.config['key_handler']) - this.register_key_handler(); - - var self = this; - - if (this.config['hashchange_handler']) { - window.addEventListener('hashchange', function(e) { - self.navigate_to_dest(document.location.hash.substring(1)); - }, false); - } - - if (this.config['view_history_handler']) { - window.addEventListener('popstate', function(e) { - if(e.state) self.navigate_to_dest(e.state); - }, false); - } - - // register schedule rendering - // renew old schedules since scroll() may be called frequently - this.container.addEventListener('scroll', function() { - self.update_page_idx(); - self.schedule_render(true); - }, false); - - // handle links - [this.container, this.outline].forEach(function(ele) { - ele.addEventListener('click', self.link_handler.bind(self), false); - }); - - this.initialize_radio_button(); - this.render(); - }, - - /* - * set up this.pages and this.page_map - * pages is an array holding all the Page objects - * page-Map maps an original page number (in PDF) to the corresponding index in page - */ - find_pages : function() { - var new_pages = []; - var new_page_map = {}; - var nodes = this.container.childNodes; - for (var i = 0, l = nodes.length; i < l; ++i) { - var cur_node = nodes[i]; - if ((cur_node.nodeType === Node.ELEMENT_NODE) - && cur_node.classList.contains(CSS_CLASS_NAMES.page_frame)) { - var p = new Page(cur_node); - new_pages.push(p); - new_page_map[p.num] = new_pages.length - 1; - } - } - this.pages = new_pages; - this.page_map = new_page_map; - }, - - /** - * @param{number} idx - * @param{number=} pages_to_preload - * @param{function(Page)=} callback - * - * TODO: remove callback -> promise ? - */ - load_page : function(idx, pages_to_preload, callback) { - var pages = this.pages; - if (idx >= pages.length) - return; // Page does not exist - - var cur_page = pages[idx]; - if (cur_page.loaded) - return; // Page is loaded - - if (this.pages_loading[idx]) - return; // Page is already loading - - var cur_page_ele = cur_page.page; - var url = cur_page_ele.getAttribute('data-page-url'); - if (url) { - this.pages_loading[idx] = true; // set semaphore - - // add a copy of the loading indicator if not already present - var new_loading_indicator = cur_page_ele.getElementsByClassName(this.config['loading_indicator_cls'])[0]; - if (typeof new_loading_indicator === 'undefined'){ - new_loading_indicator = this.loading_indicator.cloneNode(true); - new_loading_indicator.classList.add('active'); - cur_page_ele.appendChild(new_loading_indicator); - } - - // load data - { - var self = this; - var _idx = idx; - var xhr = new XMLHttpRequest(); - xhr.open('GET', url, true); - xhr.onload = function(){ - if (xhr.status === 200 || xhr.status === 0) { - // find the page element in the data - var div = document.createElement('div'); - div.innerHTML = xhr.responseText; - - var new_page = null; - var nodes = div.childNodes; - for (var i = 0, l = nodes.length; i < l; ++i) { - var cur_node = nodes[i]; - if ((cur_node.nodeType === Node.ELEMENT_NODE) - && cur_node.classList.contains(CSS_CLASS_NAMES.page_frame)) { - new_page = cur_node; - break; - } - } - - // replace the old page with loaded data - // the loading indicator on this page should also be destroyed - var p = self.pages[_idx]; - self.container.replaceChild(new_page, p.page); - p = new Page(new_page); - self.pages[_idx] = p; - - p.hide(); - p.rescale(self.scale); - - // disable background image dragging - disable_dragstart(new_page.getElementsByClassName(CSS_CLASS_NAMES.background_image)); - - self.schedule_render(false); - - if (callback){ callback(p); } - } - - // Reset loading token - delete self.pages_loading[_idx]; - }; - xhr.send(null); - } - } - // Concurrent prefetch of the next pages - if (pages_to_preload === undefined) - pages_to_preload = this.config['preload_pages']; - - if (--pages_to_preload > 0) { - var self = this; - setTimeout(function() { - self.load_page(idx+1, pages_to_preload); - },0); - } - }, - - /* - * Hide all pages that have no 'opened' class - * The 'opened' class will be added to visible pages by JavaScript - * We cannot add this in the default CSS because JavaScript may be disabled - */ - pre_hide_pages : function() { - /* pages might have not been loaded yet, so add a CSS rule */ - var s = '@media screen{.'+CSS_CLASS_NAMES.page_content_box+'{display:none;}}'; - var n = document.createElement('style'); - if (n.styleSheet) { - n.styleSheet.cssText = s; - } else { - n.appendChild(document.createTextNode(s)); - } - document.head.appendChild(n); - }, - - /* - * show visible pages and hide invisible pages - */ - render : function () { - var container = this.container; - /* - * show the pages that are 'nearly' visible -- it's right above or below the container - * - * all the y values are in the all-page element's coordinate system - */ - var container_min_y = container.scrollTop; - var container_height = container.clientHeight; - var container_max_y = container_min_y + container_height; - var visible_min_y = container_min_y - container_height; - var visible_max_y = container_max_y + container_height; - - var cur_page_fully_visible = false; - var cur_page_idx = this.cur_page_idx; - var max_visible_page_idx = cur_page_idx; - var max_visible_ratio = 0.0; - - var pl = this.pages; - for (var i = 0, l = pl.length; i < l; ++i) { - var cur_page = pl[i]; - var cur_page_ele = cur_page.page; - var page_min_y = cur_page_ele.offsetTop + cur_page_ele.clientTop; - var page_height = cur_page_ele.clientHeight; - var page_max_y = page_min_y + page_height; - if ((page_min_y <= visible_max_y) && (page_max_y >= visible_min_y)) - { - // cur_page is 'nearly' visible, show it or load it - if (cur_page.loaded) { - cur_page.show(); - } else { - this.load_page(i); - } - } else { - cur_page.hide(); - } - } - }, - /* - * update cur_page_idx and first_page_idx - * normally called upon scrolling - */ - update_page_idx: function () { - var pages = this.pages; - var pages_len = pages.length; - // there is no chance that cur_page_idx or first_page_idx is modified - if (pages_len < 2) return; - - var container = this.container; - var container_min_y = container.scrollTop; - var container_max_y = container_min_y + container.clientHeight; - - // binary search for the first page - // whose bottom border is below the top border of the container - var first_idx = -1; - var last_idx = pages_len; - var rest_len = last_idx - first_idx; - // TODO: use current first_page_idx as a hint? - while(rest_len > 1) { - var idx = first_idx + Math.floor(rest_len / 2); - var cur_page_ele = pages[idx].page; - if (cur_page_ele.offsetTop + cur_page_ele.clientTop + cur_page_ele.clientHeight >= container_min_y) { - last_idx = idx; - } else { - first_idx = idx; - } - rest_len = last_idx - first_idx; - } - - /* - * with malformed settings it is possible that no page is visible, e.g. - * - the container is to thin, which lies in the margin between two pages - * - all pages are completely above or below the container - * but we just assume that they won't happen. - */ - this.first_page_idx = last_idx; - - // find the page with largest visible area - var cur_page_idx = this.cur_page_idx; - var max_visible_page_idx = cur_page_idx; - var max_visible_ratio = 0.0; - - for(var i = last_idx; i < pages_len; ++i) { - var cur_page_ele = pages[i].page; - var page_min_y = cur_page_ele.offsetTop + cur_page_ele.clientTop; - var page_height = cur_page_ele.clientHeight; - var page_max_y = page_min_y + page_height; - if (page_min_y > container_max_y) break; - - // check the visible fraction of the page - var page_visible_ratio = ( Math.min(container_max_y, page_max_y) - - Math.max(container_min_y, page_min_y) - ) / page_height; - - // stay with the current page if it is still fully visible - if ((i === cur_page_idx) && (Math.abs(page_visible_ratio - 1.0) <= EPS)) { - max_visible_page_idx = cur_page_idx; - break; - } - - if (page_visible_ratio > max_visible_ratio) { - max_visible_ratio = page_visible_ratio; - max_visible_page_idx = i; - } - } - - this.cur_page_idx = max_visible_page_idx; - }, - - /** - * @param{boolean} renew renew the existing schedule instead of using the old one - */ - schedule_render : function(renew) { - if (this.render_timer !== undefined) { - if (!renew) return; - clearTimeout(this.render_timer); - } - - var self = this; - this.render_timer = setTimeout(function () { - /* - * render() may trigger load_page(), which may in turn trigger another render() - * so delete render_timer first - */ - delete self.render_timer; - self.render(); - }, this.config['render_timeout']); - }, - - /* - * Handling key events, zooming, scrolling etc. - */ - register_key_handler: function () { - /* - * When user try to zoom in/out using ctrl + +/- or mouse wheel - * handle this and prevent the default behaviours - * - * Code credit to PDF.js - */ - var self = this; - - // Firefox specific event, so that we can prevent browser from zooming - window.addEventListener('DOMMouseScroll', function(e) { - if (e.ctrlKey) { - e.preventDefault(); - var container = self.container; - var rect = container.getBoundingClientRect(); - var fixed_point = [e.clientX - rect['left'] - container.clientLeft - ,e.clientY - rect['top'] - container.clientTop]; - self.rescale(Math.pow(self.config['scale_step'], e.detail), true, fixed_point); - } - }, false); - - window.addEventListener('keydown', function(e) { - var handled = false; - /* - var cmd = (e.ctrlKey ? 1 : 0) - | (e.altKey ? 2 : 0) - | (e.shiftKey ? 4 : 0) - | (e.metaKey ? 8 : 0) - ; - */ - var with_ctrl = e.ctrlKey || e.metaKey; - var with_alt = e.altKey; - switch (e.keyCode) { - case 61: // FF/Mac '=' - case 107: // FF '+' and '=' - case 187: // Chrome '+' - if (with_ctrl){ - self.rescale(1.0 / self.config['scale_step'], true); - handled = true; - } - break; - case 173: // FF/Mac '-' - case 109: // FF '-' - case 189: // Chrome '-' - if (with_ctrl){ - self.rescale(self.config['scale_step'], true); - handled = true; - } - break; - case 48: // '0' - if (with_ctrl){ - self.rescale(0, false); - handled = true; - } - break; - case 33: // Page UP: - if (with_alt) { // alt-pageup -> scroll one page up - self.scroll_to(self.cur_page_idx - 1); - handled = true; - } else if (!with_ctrl) { // pageup -> scroll one screen up - self.container.scrollTop -= self.container.clientHeight; - handled = true; - } - break; - case 34: // Page DOWN - if (with_alt) { // alt-pagedown -> scroll one page down - self.scroll_to(self.cur_page_idx + 1); - handled = true; - } else if (!with_ctrl) { // pagedown -> scroll one screen down - self.container.scrollTop += self.container.clientHeight; - handled = true; - } - break; - case 35: // End - self.container.scrollTop = self.container.scrollHeight; - handled = true; - break; - case 36: // Home - self.container.scrollTop = 0; - handled = true; - break; - } - if (handled) { - e.preventDefault(); - return; - } - }, false); - }, - - /** - * @param{number} ratio - * @param{boolean} is_relative - * @param{Array.<number>=} fixed_point preserve the position (relative to the top-left corner of the viewer) after rescaling - */ - rescale : function (ratio, is_relative, fixed_point) { - var old_scale = this.scale; - var new_scale = old_scale; - // set new scale - if (ratio === 0) { - new_scale = 1; - is_relative = false; - } else if (is_relative) - new_scale *= ratio; - else - new_scale = ratio; - - this.scale = new_scale; - - if (!fixed_point) - fixed_point = [0,0]; - - // translate fixed_point to the coordinate system of all pages - var container = this.container; - fixed_point[0] += container.scrollLeft; - fixed_point[1] += container.scrollTop; - - // find the visible page that contains the fixed point - // if the fixed point lies between two pages (including their borders), it's contained in the first one - var pl = this.pages; - var pl_len = pl.length; - for (var i = this.first_page_idx; i < pl_len; ++i) { - var p = pl[i].page; - if (p.offsetTop + p.clientTop >= fixed_point[1]) - break; - } - var fixed_point_page_idx = i - 1; - - // determine the new scroll position - // each-value consists of two parts, one inside the page, which is affected by rescaling, - // the other is outside, (e.g. borders and margins), which is not affected - - // if the fixed_point is above the first page, use the first page as the reference - if (fixed_point_page_idx < 0) - fixed_point_page_idx = 0; - - var fp_p = pl[fixed_point_page_idx].page; - var fp_p_width = fp_p.clientWidth; - var fp_p_height = fp_p.clientHeight; - - var fp_x_ref = fp_p.offsetLeft + fp_p.clientLeft; - var fp_x_inside = fixed_point[0] - fp_x_ref; - if (fp_x_inside < 0) - fp_x_inside = 0; - else if (fp_x_inside > fp_p_width) - fp_x_inside = fp_p_width; - - var fp_y_ref = fp_p.offsetTop + fp_p.clientTop; - var fp_y_inside = fixed_point[1] - fp_y_ref; - if (fp_y_inside < 0) - fp_y_inside = 0; - else if (fp_y_inside > fp_p_height) - fp_y_inside = fp_p_height; - - // Rescale pages - for (var i = 0; i < pl_len; ++i) - pl[i].rescale(new_scale); - - // Correct container scroll to keep view aligned while zooming - container.scrollLeft += fp_x_inside / old_scale * new_scale + fp_p.offsetLeft + fp_p.clientLeft - fp_x_inside - fp_x_ref; - container.scrollTop += fp_y_inside / old_scale * new_scale + fp_p.offsetTop + fp_p.clientTop - fp_y_inside - fp_y_ref; - - // some pages' visibility may be toggled, wait for next render() - // renew old schedules since rescale() may be called frequently - this.schedule_render(true); - }, - - fit_width : function () { - var page_idx = this.cur_page_idx; - this.rescale(this.container.clientWidth / this.pages[page_idx].width(), true); - this.scroll_to(page_idx); - }, - - fit_height : function () { - var page_idx = this.cur_page_idx; - this.rescale(this.container.clientHeight / this.pages[page_idx].height(), true); - this.scroll_to(page_idx); - }, - /** - * @param{Node} ele - */ - get_containing_page : function(ele) { - /* get the page obj containing obj */ - while(ele) { - if ((ele.nodeType === Node.ELEMENT_NODE) - && ele.classList.contains(CSS_CLASS_NAMES.page_frame)) { - /* - * Get original page number and map it to index of pages - * TODO: store the index on the dom element - */ - var pn = get_page_number(/** @type{Element} */(ele)); - var pm = this.page_map; - return (pn in pm) ? this.pages[pm[pn]] : null; - } - ele = ele.parentNode; - } - return null; - }, - - /** - * @param{Event} e - */ - link_handler : function (e) { - var target = /** @type{Node} */(e.target); - var detail_str = /** @type{string} */ (target.getAttribute('data-dest-detail')); - if (!detail_str) return; - - if (this.config['view_history_handler']) { - try { - var cur_hash = this.get_current_view_hash(); - window.history.replaceState(cur_hash, '', '#' + cur_hash); - window.history.pushState(detail_str, '', '#' + detail_str); - } catch(ex) { } - } - this.navigate_to_dest(detail_str, this.get_containing_page(target)); - e.preventDefault(); - }, - - /** - * @param{string} detail_str may come from user provided hashtag, need sanitizing - * @param{Page=} src_page page containing the source event (e.g. link) - */ - navigate_to_dest : function(detail_str, src_page) { - try { - var detail = JSON.parse(detail_str); - } catch(e) { - return; - } - - if(!(detail instanceof Array)) return; - - var target_page_no = detail[0]; - var page_map = this.page_map; - if (!(target_page_no in page_map)) return; - var target_page_idx = page_map[target_page_no]; - var target_page = this.pages[target_page_idx]; - - for (var i = 2, l = detail.length; i < l; ++i) { - var d = detail[i]; - if(!((d === null) || (typeof d === 'number'))) - return; - } - - while(detail.length < 6) - detail.push(null); - - // cur_page might be undefined, e.g. from Outline - var cur_page = src_page || this.pages[this.cur_page_idx]; - - var cur_pos = cur_page.view_position(); - cur_pos = transform(cur_page.ictm, [cur_pos[0], cur_page.height()-cur_pos[1]]); - - var zoom = this.scale; - var pos = [0,0]; - var upside_down = true; - var ok = false; - - // position specified in `detail` are in the raw coordinate system of the page (unscaled) - var scale = this.scale; - // TODO: fitb* - // TODO: BBox - switch(detail[1]) { - case 'XYZ': - pos = [ (detail[2] === null) ? cur_pos[0] : detail[2] * scale - , (detail[3] === null) ? cur_pos[1] : detail[3] * scale ]; - zoom = detail[4]; - if ((zoom === null) || (zoom === 0)) - zoom = this.scale; - ok = true; - break; - case 'Fit': - case 'FitB': - pos = [0,0]; - ok = true; - break; - case 'FitH': - case 'FitBH': - pos = [0, (detail[2] === null) ? cur_pos[1] : detail[2] * scale]; - ok = true; - break; - case 'FitV': - case 'FitBV': - pos = [(detail[2] === null) ? cur_pos[0] : detail[2] * scale, 0]; - ok = true; - break; - case 'FitR': - /* locate the top-left corner of the rectangle */ - // TODO - pos = [detail[2] * scale, detail[5] * scale]; - upside_down = false; - ok = true; - break; - default: - break; - } - - if (!ok) return; - - this.rescale(zoom, false); - - var self = this; - /** - * page should have type Page - * @param{Page} page - */ - var transform_and_scroll = function(page) { - pos = transform(page.ctm, pos); - if (upside_down) { - pos[1] = page.height() - pos[1]; - } - self.scroll_to(target_page_idx, pos); - }; - - if (target_page.loaded) { - transform_and_scroll(target_page); - } else { - // TODO: scroll_to may finish before load_page - - // Scroll to the exact position once loaded. - this.load_page(target_page_idx, undefined, transform_and_scroll); - - // In the meantime page gets loaded, scroll approximately position for maximum responsiveness. - this.scroll_to(target_page_idx); - } - }, - - /** - * @param{number} page_idx - * @param{Array.<number>=} pos [x,y] where (0,0) is the top-left corner - */ - scroll_to : function(page_idx, pos) { - var pl = this.pages; - if ((page_idx < 0) || (page_idx >= pl.length)) return; - var target_page = pl[page_idx]; - var cur_target_pos = target_page.view_position(); - - if (pos === undefined) - pos = [0,0]; - - var container = this.container; - container.scrollLeft += pos[0] - cur_target_pos[0]; - container.scrollTop += pos[1] - cur_target_pos[1]; - }, - - /** - * generate the hash for the current view - */ - get_current_view_hash : function() { - var detail = []; - var cur_page = this.pages[this.cur_page_idx]; - - detail.push(cur_page.num); - detail.push('XYZ'); - - var cur_pos = cur_page.view_position(); - cur_pos = transform(cur_page.ictm, [cur_pos[0], cur_page.height()-cur_pos[1]]); - detail.push(cur_pos[0] / this.scale); - detail.push(cur_pos[1] / this.scale); - - detail.push(this.scale); - - return JSON.stringify(detail); - } -}; - -// export pdf2htmlEX.Viewer -pdf2htmlEX['Viewer'] = Viewer; diff --git a/Doc/pdf2html/plus.gif b/Doc/pdf2html/plus.gif deleted file mode 100644 index 93d2ade3d4e3ee96950d68dfd0f5b5ce496ed07f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 89 zcmZ?wbhEHb6lM@+n8?iV|NsAnh6V-(hIjAYDgI<(WME)s&;fFRvce1uOj>jLSDt>$ tpUk}_OuXTq!UNr$dn{e^8y4MN-g@gq%39AN{j|tS=f3~5*I;0<1^_HKAv6F0 -- GitLab