add klanviewer.js
This commit is contained in:
149
app/pub/scripts/klanviewer.js
Normal file
149
app/pub/scripts/klanviewer.js
Normal file
@@ -0,0 +1,149 @@
|
||||
var pdfjsLib = window['pdfjs-dist/build/pdf'];
|
||||
var pdfcanvas = "the-canvas";
|
||||
var cnt = 100;
|
||||
|
||||
|
||||
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 resize_plus(){
|
||||
if (window.screen.width >= 560) {
|
||||
cnt += 5;
|
||||
}
|
||||
else{
|
||||
cnt += 20;
|
||||
}
|
||||
newpdfzoom(cnt);
|
||||
}
|
||||
|
||||
|
||||
function resize_minus(){
|
||||
if (window.screen.width >= 560) {
|
||||
cnt -= 5;
|
||||
}
|
||||
else{
|
||||
cnt -= 20;
|
||||
}
|
||||
newpdfzoom(cnt);
|
||||
}
|
||||
|
||||
function newpdfzoom(czoom){
|
||||
|
||||
var status = czoom+"%";
|
||||
|
||||
document.getElementById(pdfcanvas).style.width = status;
|
||||
document.getElementById('zoomstatus_up').innerHTML = status;
|
||||
//document.getElementById('zoomstatus_down').innerHTML = status;
|
||||
|
||||
setzoom('pdfscale', czoom);
|
||||
|
||||
}
|
||||
|
||||
function getzoom( name ){
|
||||
|
||||
|
||||
var results = document.cookie.match ( '(^|;) ?' + name + '=([^;]*)(;|$)' );
|
||||
|
||||
if ( results ){
|
||||
return parseFloat(unescape(results[2]));
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function setzoom( cname, cvalue, exdays = 30 ) {
|
||||
|
||||
var d = new Date();
|
||||
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
||||
|
||||
|
||||
var expires = "expires="+ d.toUTCString();
|
||||
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function startpdfviewer(newcurr){
|
||||
|
||||
pdcurr = getzoom('pdcurr');
|
||||
|
||||
if (pdcurr == newcurr){
|
||||
czoom = getzoom('pdfscale');
|
||||
if (czoom > 10) {
|
||||
cnt = czoom;
|
||||
newpdfzoom(czoom);
|
||||
}
|
||||
}
|
||||
else {
|
||||
setzoom('pdcurr', newcurr);
|
||||
setzoom('pdfscale', 100);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function changepage(){
|
||||
|
||||
var e = document.getElementById("pages");
|
||||
var currpage = e.options[e.selectedIndex].value;
|
||||
var newpage = baseurl + currpage;
|
||||
|
||||
location.href = newpage;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function changeyear(){
|
||||
|
||||
var e = document.getElementById("year_filter");
|
||||
var curryear = e.options[e.selectedIndex].value;
|
||||
|
||||
yearurl = '/mybooks/gazeta/';
|
||||
|
||||
if (curryear !== 'all')
|
||||
yearurl = yearurl + curryear + '/1';
|
||||
|
||||
location.href = yearurl;
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user