function hidePDFviewer() { showPDFviewer.shown = false; $('table').show(); $('#controls').html(showPDFviewer.oldcode); $("#viewer").remove(); $("#loading").remove() document.title = showPDFviewer.lastTitle; } function showPDFviewer(dir,filename){ if(!showPDFviewer.shown){ $("#editor").hide(); var url = OC.filePath('files','ajax','download.php')+'?files='+encodeURIComponent(filename)+"&dir="+encodeURIComponent(dir); $('table').hide(); function im(path) { return OC.filePath('files_pdfviewer','js','pdfjs/web/images/'+path); } showPDFviewer.oldcode = $("#controls").html(); $("#controls").empty(); $("#controls").html('
/--
--'); var oldcontent = $("#content").html(); $("#content").html(oldcontent+'
Loading... 0%
'); showPDFviewer.lastTitle = document.title; PDFView.Ptitle = filename; PDFView.open(url,1.00); $("#pageWidthOption").attr("selected","selected"); showPDFviewer.shown = true; } } showPDFviewer.shown=false; showPDFviewer.oldCode=''; showPDFviewer.lastTitle=''; var extrahtml = ''; $(document).ready(function(){ if(location.href.indexOf("files")!=-1) { PDFJS.workerSrc = OC.filePath('files_pdfviewer','js','pdfjs/build/pdf.js'); if(typeof FileActions!=='undefined'){ FileActions.register('application/pdf','Edit','',function(filename){ showPDFviewer($('#dir').val(),filename); }); FileActions.setDefault('application/pdf','Edit'); } } });