hugo-toha/layouts/shortcodes/embed-pdf.html
Aaron Qian 02db3d3044
Bundling JS with ESBuild (#702)
* add npm dependencies used in this theme

* implement helper to configure JS and ESBuild

* migrate jquery popper.js bootstrap fontawesome to js bundle

* refactor main.js into smaller pieces, and moved navbar.js to assets

* remove list.js. It adjusts post card height to be the same, but is actually not needed.

* refactored notes.js, search.js, single.js into application.js

* move ityped to js asset, implement experiences horizontal vertical line in css

* align recent post height via css

* migrated home.js and refactored into various sections

* migrated darkMode feature to js bundle

* moved mermaid feature to js bundle

* migrate syntax highlight to js bundle

* migrate katex ( js portion ) to js bundle

* migrate pdf-js to js bundle by delegating to cdn

* set explicit comparisions for feature envvars so js can properly optimize

* removed goat-counter

* more fixes for broken achievements and small bugs

* more bug fixes

* allow configuration of hightlight.js, fix video-player shortcode

* remove jquery all together

* add null handling and fix merge conflicts

Co-authored-by: Aaron Qian <aaron@yeet.io>
2023-01-06 00:42:54 +06:00

68 lines
1.5 KiB
HTML
Executable file

{{ $url := .Get "src" }}
{{ $hidePaginator := .Get "hidePaginator" | default "false" }}
{{ $hideLoader := .Get "hidePaginator" | default "false" }}
{{ $pageNum := .Get "renderPageNum" | default "1"}}
<div
class="pdf-viewer"
data-url="{{ $url }}"
data-hide-paginator="{{ $hidePaginator }}"
data-hide-loader="{{ $hideLoader }}"
data-page-num="{{ $pageNum }}"
>
<div class="paginator">
<button class="prev">Previous</button>
<button class="next">Next</button>
<span>Page: <span class="page-num"></span> / <span class="page-count"></span></span>
</div>
<div class="embed-pdf-container">
<div class="loading-wrapper">
<div class="loading"></div>
</div>
<canvas class="pdf-canvas"></canvas>
</div>
</div>
<!-- Finally, make the canvas more beautiful -->
<style>
.pdf-viewer canvas {
border: 1px solid black;
direction: ltr;
width: 100%;
height: auto;
display: none;
}
.pdf-viewer .paginator {
display: none;
text-align: center;
margin-bottom: 10px;
}
.pdf-viewer .loading-wrapper {
display: none;
justify-content: center;
align-items: center;
width: 100%;
height: 350px;
}
.pdf-viewer .loading {
display: inline-block;
width: 50px;
height: 50px;
border: 3px solid #d2d0d0;;
border-radius: 50%;
border-top-color: #383838;
animation: spin 1s ease-in-out infinite;
-webkit-animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
to { -webkit-transform: rotate(360deg); }
}
@-webkit-keyframes spin {
to { -webkit-transform: rotate(360deg); }
}
</style>