chore: load pdf.js only if have pdf content

This commit is contained in:
Baoshuo Ren 2023-02-04 11:02:51 +08:00
parent cd36b3d209
commit d4d98f6d55
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -1291,6 +1291,7 @@ $(document).ready(function() {
); );
}); });
if ($('div[data-pdf]').length > 0) {
$LAB.script('/js/pdf.js').wait(function() { $LAB.script('/js/pdf.js').wait(function() {
pdfjsLib.GlobalWorkerOptions.workerSrc = '/js/pdf.worker.js'; pdfjsLib.GlobalWorkerOptions.workerSrc = '/js/pdf.worker.js';
@ -1338,6 +1339,7 @@ $(document).ready(function() {
}); });
}); });
}); });
}
}); });
// Tooltip // Tooltip