diff options
author | Frank Karlitschek <frank@owncloud.org> | 2012-08-26 17:30:07 +0200 |
---|---|---|
committer | Frank Karlitschek <frank@owncloud.org> | 2012-08-26 17:30:07 +0200 |
commit | 72e9a2ce57ee88503db83614cec5ccda71f0b58e (patch) | |
tree | 8bc301ca22d9ca08ea54426bcb61f62bd1c1cb75 /apps/files_pdfviewer/js/viewer.js | |
parent | 32bad688bdb4fea55eba9d4255fc55f1c60a0aca (diff) | |
download | nextcloud-server-72e9a2ce57ee88503db83614cec5ccda71f0b58e.tar.gz nextcloud-server-72e9a2ce57ee88503db83614cec5ccda71f0b58e.zip |
moved to apps repository
Diffstat (limited to 'apps/files_pdfviewer/js/viewer.js')
-rw-r--r-- | apps/files_pdfviewer/js/viewer.js | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/apps/files_pdfviewer/js/viewer.js b/apps/files_pdfviewer/js/viewer.js deleted file mode 100644 index 4f9cc1a0d40..00000000000 --- a/apps/files_pdfviewer/js/viewer.js +++ /dev/null @@ -1,59 +0,0 @@ -function hidePDFviewer() { - showPDFviewer.shown = false; - $('table').show(); - $('#controls').html(showPDFviewer.oldcode); - $("#viewer").remove(); - $("#loading").remove() - $("#editor").show(); - document.title = showPDFviewer.lastTitle; - PDFView.active=false; - $('iframe').remove(); -} - -function showPDFviewer(dir,filename){ - if(!showPDFviewer.shown){ - $("#editor").hide(); - var url = OC.filePath('files','ajax','download.php')+encodeURIComponent('?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( - '<button id="previous" onclick="PDFView.page--;" oncontextmenu="return false;"><img src="'+im('go-up.svg')+'" align="top" height="10"/>'+t('files_odfviewer','Previous')+'</button>'+ - '<button id="next" onclick="PDFView.page++;" oncontextmenu="return false;"><img src="'+im('go-down.svg')+'" align="top" height="10"/>'+t('files_odfviewer','Next')+'</button>'+ - '<div class="separator"></div><input style="width:25px;" type="number" id="pageNumber" onchange="PDFView.page = this.value;" value="1" size="4" min="1" /><span>/</span><span id="numPages">--</span><div class="separator"></div>'+ - '<button id="zoomOut" title="Zoom Out" onclick="PDFView.zoomOut();" oncontextmenu="return false;"><img src="'+im('zoom-out.svg')+'" align="top" height="10"/></button>'+ - '<button id="zoomIn" title="Zoom In" onclick="PDFView.zoomIn();" oncontextmenu="return false;"><img src="'+im('zoom-in.svg')+ '" align="top" height="10"/></button>'+ - '<div class="separator"></div><select id="scaleSelect" onchange="PDFView.parseScale(this.value);" oncontextmenu="return false;"><option id="customScaleOption" value="custom"></option>'+ - '<option value="0.5">50%</option><option value="0.75">75%</option><option value="1">100%</option><option value="1.25" selected="selected">125%</option><option value="1.5">150%</option><option value="2">200%</option>'+ - '<option id="pageWidthOption" value="page-width">'+t('files_odfviewer', 'Page Width')+'</option><option id="pageFitOption" value="page-fit">'+t('files_odfviewer', 'Page Fit')+'</option></select>'+ - '<div class="separator"></div><button id="print" onclick="window.print();" oncontextmenu="return false;"><img src="'+im('document-print.svg')+'" align="top" height="10"/>'+t('files_odfviewer', 'Print')+'</button>'+ - '<button id="download" title="Download" onclick="PDFView.download();" oncontextmenu="return false;">'+ - '<img src="'+im('download.svg')+'" align="top" height="10"/>'+t('files_odfviewer', 'Download')+'</button><button id="close" title="Close viewer" onclick="hidePDFviewer();" oncontextmenu="return false;">x</button><span id="info">--</span></div>'); - var oldcontent = $("#content").html(); - $("#content").html(oldcontent+'<div id="loading">Loading... 0%</div><div id="viewer"></div>'); - showPDFviewer.lastTitle = document.title; - PDFView.Ptitle = filename; - PDFView.open(url,1.00); - PDFView.active=true; - $("#pageWidthOption").attr("selected","selected"); - showPDFviewer.shown = true; - } -} -showPDFviewer.shown=false; -showPDFviewer.oldCode=''; -showPDFviewer.lastTitle=''; - -$(document).ready(function(){ - if(!$.browser.msie){//doesnt work on IE - 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', FileActions.PERMISSION_READ, '',function(filename){ - showPDFviewer($('#dir').val(),filename); - }); - FileActions.setDefault('application/pdf','Edit'); - } - } - } -}); |