mirror of
https://github.com/alex-s168/website.git
synced 2025-09-10 01:05:07 +02:00
init
This commit is contained in:
24
components/pcb-view.typ
Normal file
24
components/pcb-view.typ
Normal file
@@ -0,0 +1,24 @@
|
||||
#import "../common.typ": *
|
||||
|
||||
#let pcb(front,back, size-percent:100) = {
|
||||
context if is-html() {
|
||||
if is-web {
|
||||
html.elem("img", attrs:(draggable:"false", tite:"Click Me!", src:front, data-other:back, onclick:"swapFrontBack(this);", style:"width:"+str(size-percent)+"%; cursor:pointer;"))
|
||||
} else {
|
||||
html.elem("img", attrs:(src:front, style:"width:100%;"))
|
||||
}
|
||||
} else {
|
||||
[#image(front) #image(back)]
|
||||
}
|
||||
context if is-html() and is-web {
|
||||
html-script("
|
||||
function swapFrontBack(img) {
|
||||
let oldsrc = img.src;
|
||||
img.src = img.dataset.other;
|
||||
img.dataset.other = oldsrc;
|
||||
}
|
||||
")
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user