wip
This commit is contained in:
@@ -10,8 +10,42 @@
|
||||
</button>
|
||||
<button
|
||||
class="action-btn print-btn"
|
||||
onclick="printFriendly()"
|
||||
aria-label="{{if eq .Lang "es"}}Imprimir amigable{{else}}Print Friendly{{end}}">
|
||||
aria-label="{{if eq .Lang "es"}}Imprimir amigable{{else}}Print Friendly{{end}}"
|
||||
_="on click
|
||||
-- Store current state
|
||||
set wasClean to .cv-container.classList.contains('theme-clean')
|
||||
set wasLong to .cv-paper.classList.contains('cv-long')
|
||||
set currentZoom to localStorage.getItem('cv-zoom') or '100'
|
||||
|
||||
-- Apply print-friendly settings
|
||||
if not wasClean then add .theme-clean to .cv-container end
|
||||
remove .cv-long from .cv-paper
|
||||
add .cv-short to .cv-paper
|
||||
|
||||
-- Reset zoom for printing (directly set wrapper zoom to 1)
|
||||
set #zoom-wrapper's *zoom to 1
|
||||
|
||||
-- Let CSS apply, then print
|
||||
wait 50ms
|
||||
call window.print()
|
||||
|
||||
-- Wait for print dialog to close, then restore
|
||||
wait 100ms
|
||||
|
||||
-- Restore original theme
|
||||
if not wasClean then remove .theme-clean from .cv-container end
|
||||
|
||||
-- Restore original length
|
||||
if wasLong
|
||||
remove .cv-short from .cv-paper
|
||||
add .cv-long to .cv-paper
|
||||
end
|
||||
|
||||
-- Restore original zoom by triggering slider input event
|
||||
if currentZoom !== '100'
|
||||
set #zoom-slider's value to currentZoom
|
||||
send input to #zoom-slider
|
||||
end">
|
||||
<iconify-icon icon="mdi:leaf" width="18" height="18"></iconify-icon>
|
||||
{{if eq .Lang "es"}}Imprimir amigable{{else}}Print Friendly{{end}}
|
||||
</button>
|
||||
|
||||
@@ -158,7 +158,34 @@
|
||||
<span>{{if eq .Lang "es"}}Descargar como PDF{{else}}Download as PDF{{end}}</span>
|
||||
</button>
|
||||
|
||||
<button class="menu-action-btn" onclick="printFriendly()">
|
||||
<button class="menu-action-btn"
|
||||
_="on click
|
||||
-- Store current state
|
||||
set wasClean to .cv-container.classList.contains('theme-clean')
|
||||
set wasLong to .cv-paper.classList.contains('cv-long')
|
||||
set currentZoom to localStorage.getItem('cv-zoom') or '100'
|
||||
|
||||
-- Apply print-friendly settings
|
||||
if not wasClean then add .theme-clean to .cv-container end
|
||||
remove .cv-long from .cv-paper
|
||||
add .cv-short to .cv-paper
|
||||
set #zoom-wrapper's *zoom to 1
|
||||
|
||||
-- Print and restore
|
||||
wait 50ms
|
||||
call window.print()
|
||||
wait 100ms
|
||||
|
||||
-- Restore original state
|
||||
if not wasClean then remove .theme-clean from .cv-container end
|
||||
if wasLong
|
||||
remove .cv-short from .cv-paper
|
||||
add .cv-long to .cv-paper
|
||||
end
|
||||
if currentZoom !== '100'
|
||||
set #zoom-slider's value to currentZoom
|
||||
send input to #zoom-slider
|
||||
end">
|
||||
<iconify-icon icon="mdi:leaf" width="20" height="20"></iconify-icon>
|
||||
<span>{{if eq .Lang "es"}}Imprimir amigable{{else}}Print Friendly{{end}}</span>
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user