add cookie
This commit is contained in:
@@ -106,11 +106,11 @@ _tmr.push({id: "1069168", type: "pageView", start: (new Date()).getTime()});
|
||||
<div style="display: flex;flex-wrap:wrap;align-items:center;width: 100%;background: #f5f5f5;box-sizing: border-box;">
|
||||
<ul id="pdf-nav" style="font-size: 1.1em;width: 100%;font-weight:bold;display: flex;justify-content: center;padding:0px;">
|
||||
<?if (isset($prevurl)):?>
|
||||
<li style="list-style-type:none;margin-right: 15px;float: left;border: 3px solid #2c2e35;border-radius: 28px;padding: 2px 10px;font-size: 1.3em;display: flex;align-items: center;"><a id="prevbutton" style="color:#2c2e35;text-decoration: none;" href="<?=$prevurl?>">< Предыдущая страница</a></li>
|
||||
<li style="list-style-type:none;margin-right: 15px;float: left;border: 3px solid #2c2e35;border-radius: 28px;padding: 2px 10px;font-size: 1.3em;display: flex;align-items: center;"><a style="color:#2c2e35;text-decoration: none;" href="<?=$prevurl?>">< Предыдущая страница</a></li>
|
||||
<?endif?>
|
||||
<li style="list-style-type:none;color:#2c2e35;margin-right: 15px;float: left;font-size: 2em;"><?=$page?></li>
|
||||
<?if (isset($nexturl)):?>
|
||||
<li style="list-style-type:none;float: left;border: 3px solid #2c2e35;border-radius: 28px;padding: 2px 10px;font-size: 1.3em;display: flex;align-items: center;"><a id="nextbutton" style="color:#2c2e35;text-decoration: none;" href="<?=$nexturl?>">Следующая страница ></a></li>
|
||||
<li style="list-style-type:none;float: left;border: 3px solid #2c2e35;border-radius: 28px;padding: 2px 10px;font-size: 1.3em;display: flex;align-items: center;"><a style="color:#2c2e35;text-decoration: none;" href="<?=$nexturl?>">Следующая страница ></a></li>
|
||||
<?endif?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@ var pdfjsLib = window['pdfjs-dist/build/pdf'];
|
||||
|
||||
function renderPage() {
|
||||
|
||||
|
||||
document.getElementById('pdfprogress').innerHTML = 'Идет подготовка страницы ...';
|
||||
|
||||
pageRendering = true;
|
||||
@@ -35,30 +36,71 @@ function renderPage() {
|
||||
|
||||
document.getElementById('zoompdf').innerHTML = scale + 'x';
|
||||
document.getElementById('pdfprogress').innerHTML = 'Приятного чтения ↓';
|
||||
|
||||
if (typeof prevlink !== 'undefined')
|
||||
document.getElementById('prevbutton').href = prevlink + '/'+ scale;
|
||||
|
||||
if (typeof nextlink !== 'undefined')
|
||||
document.getElementById('nextbutton').href = nextlink + '/'+ scale;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function prevclick(){
|
||||
prevurl = prevlink + '/'+ scale;
|
||||
location.href = prevurl;
|
||||
return;
|
||||
}
|
||||
|
||||
function nextclick(){
|
||||
nexturl = nextlink + '/'+ scale;
|
||||
location.href = nexturl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
function pdfzoomin(){
|
||||
|
||||
scale += 0.25;
|
||||
setzoom(scale);
|
||||
renderPage();
|
||||
|
||||
|
||||
}
|
||||
|
||||
function pdfzoomout(){
|
||||
|
||||
scale -= 0.25;
|
||||
setzoom(scale);
|
||||
renderPage();
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getzoom(){
|
||||
|
||||
var cname = 'pdfscale';
|
||||
|
||||
var results = document.cookie.match ( '(^|;) ?' + cname + '=([^;]*)(;|$)' );
|
||||
|
||||
if ( results )
|
||||
return ( unescape ( results[2] ) );
|
||||
else
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
function setzoom( cvalue, exdays = 30 ) {
|
||||
|
||||
var d = new Date();
|
||||
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
||||
|
||||
var cname = 'pdfscale';
|
||||
document.cookie = cname + "=" + cvalue + "; expires=" + expires + "; path=/";
|
||||
|
||||
}
|
||||
|
||||
|
||||
function startpdfviewer(){
|
||||
|
||||
czoom = getzoom();
|
||||
|
||||
if (czoom !== null || isNaN(czoom))
|
||||
scale = czoom;
|
||||
|
||||
pdfjsLib.getDocument(url).promise.then(function(pdfDoc_) {
|
||||
pdfDoc = pdfDoc_;
|
||||
|
||||
Reference in New Issue
Block a user