Ported PDF viewer to Jekyll layout
This commit is contained in:
parent
f2c8985b85
commit
7ffb9858e2
2 changed files with 78 additions and 103 deletions
|
|
@ -1,103 +1,3 @@
|
|||
<!DOCTYPE html>
|
||||
<html style="background-color: #1d1d1d">
|
||||
<head>
|
||||
<title>pcjs.org | PDF Viewer</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="initial-scale=1">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/versions/images/current/favicon.ico">
|
||||
<link rel="stylesheet" type="text/css" href="/modules/shared/templates/common.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="common">
|
||||
<div class="common-top">
|
||||
<div class="common-top-left">
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/apps/pc/">Apps</a></li>
|
||||
<li><a href="/disks/pc/">Disks</a></li>
|
||||
<li><a href="/devices/">Machines</a></li>
|
||||
<li><a href="/docs/">Docs</a></li>
|
||||
<li><a href="/pubs/">Pubs</a></li>
|
||||
<li><a href="/blog/">Blog</a></li>
|
||||
<li><a href="/docs/about/">About</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="common-top-right">
|
||||
<p>Powered by <a href="http://nodejs.org" target="_blank">Node.js</a> and <a href="http://aws.amazon.com/about-aws/whats-new/2013/03/11/announcing-aws-elastic-beanstalk-for-node-js/" target="_blank">AWS</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="common-middle">
|
||||
<h4>Return to C:\<a href="/">PCJS.ORG</a><a id="returnLink"><span id="returnPath"></span></a></h4>
|
||||
<div class="common-sidebar">
|
||||
<ul class="common-list">
|
||||
</ul>
|
||||
</div>
|
||||
<div class="common-main">
|
||||
<div style="width:680px;margin-left:auto;margin-right:auto;">
|
||||
<div style="float:left;margin-top:350px;margin-right:8px;">
|
||||
<button id="prevPDF" style="font-size:large;"><</button>
|
||||
</div>
|
||||
<div style="float:left;">
|
||||
<iframe id="framePDF" src="" width="550" height="800"></iframe>
|
||||
</div>
|
||||
<div style="float:left;margin-top:350px;margin-left:8px;">
|
||||
<button id="nextPDF" style="font-size:large;">></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="common-bottom">
|
||||
<p class="common-reference"></p>
|
||||
<p class="common-copyright">
|
||||
<span class="common-copyright"><a href="http://www.pcjs.org/">pcjs.org</a> website © 2012-2015 by <a href="http://twitter.com/jeffpar">@jeffpar</a></span><br/>
|
||||
<span class="common-copyright">PCjs and C1Pjs released under <a href="http://gnu.org/licenses/gpl.html">GPL version 3 or later</a></span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script id="initFrame" type="text/javascript">
|
||||
(function() {
|
||||
var aParms = {};
|
||||
var sParms = window.location.search.substr(1);
|
||||
var match, pl = /\+/g, search = /([^&=]+)=?([^&]*)/g;
|
||||
var decode = function(s) { return decodeURIComponent(s.replace(pl, " ")); };
|
||||
while ((match = search.exec(sParms))) aParms[decode(match[1])] = decode(match[2]);
|
||||
var pdf = aParms['url'];
|
||||
var curPage = parseInt(aParms['page'], 10) || 1;
|
||||
var totalPages = parseInt(aParms['total'], 10) || 999;
|
||||
var frame = document.getElementById('framePDF');
|
||||
if (pdf && frame) {
|
||||
pdf = pdf.replace('/static/', '/');
|
||||
var i = pdf.indexOf("/pages/");
|
||||
if (i > 0) {
|
||||
var sReturnLink = pdf.substr(0, i+1);
|
||||
var sReturnPath = sReturnLink.slice(0, -1).toUpperCase().replace(/\//g, '\\');
|
||||
var e = document.getElementById('returnLink');
|
||||
if (e) e.setAttribute('href', sReturnLink);
|
||||
e = document.getElementById('returnPath');
|
||||
if (e) e.textContent = sReturnPath;
|
||||
}
|
||||
i = pdf.indexOf('%20');
|
||||
if (i < 0) i = pdf.indexOf(' ');
|
||||
if (i > 0) pdf = pdf.substr(0, i);
|
||||
var setPage = function(page) {
|
||||
frame.setAttribute('src', 'http://static.pcjs.org' + pdf + ' ' + curPage + '.pdf');
|
||||
};
|
||||
setPage(curPage);
|
||||
var buttonPrev = document.getElementById('prevPDF');
|
||||
if (buttonPrev) {
|
||||
buttonPrev.onclick = function() {
|
||||
if (curPage > 1) setPage(--curPage);
|
||||
};
|
||||
}
|
||||
var buttonNext = document.getElementById('nextPDF');
|
||||
if (buttonNext) {
|
||||
buttonNext.onclick = function() {
|
||||
if (curPage < totalPages) setPage(++curPage);
|
||||
};
|
||||
}
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
---
|
||||
layout: viewer
|
||||
---
|
||||
|
|
|
|||
Loading…
Reference in a new issue