Replace header collapse/expand for link copying.

This commit is contained in:
Sergio Martínez Portela 2023-04-28 00:11:15 +02:00
parent fce2d3c935
commit bdda2f3676
2 changed files with 7 additions and 23 deletions

View File

@ -755,7 +755,7 @@ def render(headline, doc, graph, headlineLevel):
title = render_inline(headline.title, render_tag, headline, graph) title = render_inline(headline.title, render_tag, headline, graph)
if headlineLevel > 0: if headlineLevel > 0:
title = f"<a href=\"javascript:toggle_expand('{html.escape(headline.id)}')\">{title}</a>" title = f"<a href=\"#{html.escape(headline.id)}\">{title}</a>"
return f""" return f"""
<div id="{html.escape(headline.id)}" class="node {todo_state} {display_state}"> <div id="{html.escape(headline.id)}" class="node {todo_state} {display_state}">
@ -792,20 +792,6 @@ def as_document(html, title, global_toc):
<meta name="HandheldFriendly" content="True"> <meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320"> <meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript">
function toggle_expand(header_id) {{
var e = document.getElementById(header_id);
if (e.classList.contains('expanded')) {{
e.classList.add('collapsed');
e.classList.remove('expanded');
}}
else {{
e.classList.add('expanded');
e.classList.remove('collapsed');
}}
}}
</script>
</head> </head>
<body> <body>
<nav> <nav>

View File

@ -247,15 +247,10 @@ img {
border-color: transparent; border-color: transparent;
} }
.node .node.collapsed > .title::before { .node .node > .title::before {
content: ""; content: "#";
vertical-align: text-bottom;
}
.node .node.expanded > .title::before {
content: "";
transform: rotate(90deg);
display: inline-block; display: inline-block;
color: #888;
} }
.node .title { .node .title {
@ -488,6 +483,9 @@ tr.__table-separator {
border-color: #8c9ea0; border-color: #8c9ea0;
} }
.node .node > .title::before {
color: #aaa;
}
h2 a { h2 a {
color: #fafafe; color: #fafafe;