Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
### A Pluto.jl notebook ###
# v0.17.5
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
local el = $(esc(element))
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : iv(el)
el
end
end
# ╔═╡ 3a97b3e8-9dcc-48a7-b713-35993e8189b1
using HypertextLiteral
# ╔═╡ a0b1da10-7a2d-11ec-3aba-c780435839cc
function BindCellId()
@htl("""
<div>
<script>
const myInput = currentScript.parentElement;
console.log(myInput)
function getCellId(el) {
console.log(el.tagName);
if(el.hasAttribute('id') && el.tagName.toLowerCase() == 'pluto-cell') {
return el.getAttribute('id');
}
else {
return getCellId(el.parentElement);
}
}
myInput.value = getCellId(myInput);
myInput.dispatchEvent(new CustomEvent("input"));
</script>
</div>
""")
end
# ╔═╡ 94b298e6-e9d3-4b14-852a-72780f899028
@bind id BindCellId()
# ╔═╡ ae4e58e2-fc7f-4df1-8b71-b6593e077bea
@bind id2 BindCellId()
# ╔═╡ 28b09c3a-b790-4411-b2b9-99e05d11912d
id, id2
# ╔═╡ 00000000-0000-0000-0000-000000000001
PLUTO_PROJECT_TOML_CONTENTS = """
[deps]
HypertextLiteral = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2"
[compat]
HypertextLiteral = "~0.9.3"
"""
# ╔═╡ 00000000-0000-0000-0000-000000000002
PLUTO_MANIFEST_TOML_CONTENTS = """
# This file is machine-generated - editing it directly is not advised
julia_version = "1.7.1"
manifest_format = "2.0"
[[deps.HypertextLiteral]]
git-tree-sha1 = "2b078b5a615c6c0396c77810d92ee8c6f470d238"
uuid = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2"
version = "0.9.3"
"""
# ╔═╡ Cell order:
# ╠═3a97b3e8-9dcc-48a7-b713-35993e8189b1
# ╠═a0b1da10-7a2d-11ec-3aba-c780435839cc
# ╠═94b298e6-e9d3-4b14-852a-72780f899028
# ╠═ae4e58e2-fc7f-4df1-8b71-b6593e077bea
# ╠═28b09c3a-b790-4411-b2b9-99e05d11912d
# ╟─00000000-0000-0000-0000-000000000001
# ╟─00000000-0000-0000-0000-000000000002
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment