1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-20 10:58:33 +00:00

[pdf file view] bugfix

This commit is contained in:
llj
2016-04-07 18:52:47 +08:00
parent f3a269826a
commit c9c1d12d2d
2 changed files with 4 additions and 4 deletions

View File

@@ -92,7 +92,7 @@ window.onload = function () {
{% endif %} {% endif %}
{% if filetype == 'PDF' and use_pdfjs %} {% if filetype == 'PDF' and use_pdfjs %}
if (!($.browser.msie && parseInt($.browser.version) < 10)) { try {
PDFJS.workerSrc = '{{MEDIA_URL}}js/pdf.worker.js'; PDFJS.workerSrc = '{{MEDIA_URL}}js/pdf.worker.js';
$('#file-view').html('<div id="pdf"><span class="loading-icon loading-tip"></span></div>'); $('#file-view').html('<div id="pdf"><span class="loading-icon loading-tip"></span></div>');
PDFJS.getDocument("{{ raw_path|escapejs }}").then(function(pdf) { PDFJS.getDocument("{{ raw_path|escapejs }}").then(function(pdf) {
@@ -129,7 +129,7 @@ if (!($.browser.msie && parseInt($.browser.version) < 10)) {
getPageAndRender(1); getPageAndRender(1);
}); });
} else { } catch(e) {
$('#file-view').html('<div id="file-view-tip"><p>{% trans "You can use IE 10 or other browsers, for example, Firefox, to view it online." %}</p></div>'); $('#file-view').html('<div id="file-view-tip"><p>{% trans "You can use IE 10 or other browsers, for example, Firefox, to view it online." %}</p></div>');
} }
{% endif %} {% endif %}

View File

@@ -25,7 +25,7 @@
{% else %} {% else %}
<script type="text/javascript" src="{{MEDIA_URL}}js/pdf.js"></script> <script type="text/javascript" src="{{MEDIA_URL}}js/pdf.js"></script>
<script type="text/javascript"> <script type="text/javascript">
if (!($.browser.msie && parseInt($.browser.version) < 10)) { try {
PDFJS.workerSrc = '{{MEDIA_URL}}js/pdf.worker.js'; PDFJS.workerSrc = '{{MEDIA_URL}}js/pdf.worker.js';
$('#file-view').html('<div id="pdf"><span class="loading-icon loading-tip"></span></div>'); $('#file-view').html('<div id="pdf"><span class="loading-icon loading-tip"></span></div>');
PDFJS.getDocument("{{ raw_path|escapejs }}").then(function(pdf) { PDFJS.getDocument("{{ raw_path|escapejs }}").then(function(pdf) {
@@ -62,7 +62,7 @@ if (!($.browser.msie && parseInt($.browser.version) < 10)) {
getPageAndRender(1); getPageAndRender(1);
}); });
} else { } catch(e) {
var tip = "{% trans "You can use IE 10 or other browsers, for example, Firefox, to view it online." %}"; var tip = "{% trans "You can use IE 10 or other browsers, for example, Firefox, to view it online." %}";
$('#file-view').html('<div id="file-view-tip"><p>' + tip + '</p></div>'); $('#file-view').html('<div id="file-view-tip"><p>' + tip + '</p></div>');
} }