Like poor Blogger user User 7100044714607836407, I have missed the quick edit button on newer Blogger templates. So I wrote a little snippet of JavaScript to bring it back.
Differences:
- Appears in the title instead of at the bottom.
- Does not appear until you press ctrl-e.
- In theory will show even when readers press ctrl-e, but of course they would still need to log in as you to actually get to the edit page.
- Just uses the blog and post IDs already viewable on the page.
Code
window.addEventListener ("keydown", function (ev) { if (ev.code == "KeyE" && ev.ctrlKey == true) { let posts = document.querySelectorAll ("DIV.post-outer:not(.edit_link_added)") ?? []; for (let post of posts) { const blog_id = post.querySelector("meta[itemprop='blogId']").getAttribute ("content"); const post_id = post.querySelector("meta[itemprop='postId']").getAttribute ("content"); const post_title_h3 = post.querySelector (".post-title"); let edit_a = document.createElement ("A"); edit_a.href = `https://www.blogger.com/post-edit.g?blogID=${blog_id}&postID=${post_id}&from=pencil`; edit_a.target = "_blank"; edit_a.innerText = "[✏]"; post_title_h3.appendChild (edit_a); post.classList.add ("edit_link_added"); } } });
Keine Kommentare:
Kommentar veröffentlichen