Simply forceJS code

This commit is contained in:
Hillel Coren 2016-12-20 14:43:43 +02:00
parent 68d3322032
commit fa6ccc6015
2 changed files with 5 additions and 4 deletions

View File

@ -117,10 +117,11 @@
function refreshPDFCB(string) { function refreshPDFCB(string) {
if (!string) return; if (!string) return;
PDFJS.workerSrc = '{{ asset('js/pdf_viewer.worker.js') }}'; PDFJS.workerSrc = '{{ asset('js/pdf_viewer.worker.js') }}';
var forceJS = {{ Auth::check() && Auth::user()->force_pdfjs ? 'false' : 'true' }}; var forceJS = {{ Auth::check() && Auth::user()->force_pdfjs ? 'true' : 'false' }};
// Temporarily workaround for: https://code.google.com/p/chromium/issues/detail?id=574648 // Use the browser's built in PDF viewer
if (forceJS && (isFirefox || (isChrome && (!isChrome48 || {{ isset($viewPDF) && $viewPDF ? 'true' : 'false' }})))) { if ((isChrome || isFirefox) && ! forceJS) {
$('#theFrame').attr('src', string).show(); $('#theFrame').attr('src', string).show();
// Use PDFJS to view the PDF
} else { } else {
if (isRefreshing) { if (isRefreshing) {
needsRefresh = true; needsRefresh = true;

View File

@ -285,7 +285,7 @@
</script> </script>
@include('invoices.pdf', ['account' => $invoice->client->account, 'viewPDF' => true]) @include('invoices.pdf', ['account' => $invoice->client->account])
<p>&nbsp;</p> <p>&nbsp;</p>