New code:

if (posts != null) {
		posts = JSON.parse(posts);
		var $nav = document.getElementsByTagName('nav')[0];
		for (var i=0; i<posts.length; i++) {
			if (posts[i].id == "{{.ID}}") {
				$nav.innerHTML = $nav.innerHTML + '<a class="xtra-feature" href="/edit/{{.ID}}" dir="{{.Direction}}">Edit</a>';
				$nav.innerHTML = $nav.innerHTML + '<a class="xtra-feature" id="share-post" href="#share" dir="{{.Direction}}">Share</a>';
				var $ownerVis = document.querySelectorAll('.owner-visible');
				for (var i=0; i<$ownerVis.length; i++) {
					$ownerVis[i].classList.remove('owner-visible');
				}
				break;
			}
		}
		{{if not .Username}}
		$nav.innerHTML = $nav.innerHTML + '<a class="xtra-feature dash-nav" href="/pad/posts" dir="{{.Direction}}">Posts</a>';
		{{end}}
	}

Get future updates via RSS and ActivityPub: @devlog@matt.writefreely.dev.