GoogleのBloggerで記事ページから直接編集画面に移動できるブックマークレットを作成しました



前から思っていたのですが、毎回管理画面に行って該当記事を探して編集するのが面倒だったため、記事ページから直接編集画面に行けるブックマークレットを作成しました。

新規に空のブックマークを作成してアドレス欄に
javascript:(function(){var b=document.querySelector(".post-body").id;b=b.replace("post-body-","");var a=document.querySelector("#comment-editor-src").href;a=a.match(/blogID=\d+/);a=a[0];a=a.replace("blogID=","");window.location.href="https://www.blogger.com/blogger.g?blogID="+a+"#editor/target=post;postID="+b})();
をコピペすれば動作すると思う。

一応元のコードがこちら。
var post = document.querySelector('.post-body');
var postId=post.id;
postId = postId.replace("post-body-", "");
var blog = document.querySelector("#comment-editor-src");
var blogID=blog.href;
blogID = blogID.match(/blogID=\d+/);
blogID=blogID[0];
blogID=blogID.replace("blogID=", "");
window.location.href = `https://www.blogger.com/blogger.g?blogID=${blogID}#editor/target=post;postID=${postId}`;

https://closure-compiler.appspot.comでこのコードをコンパイルし、
ブックマークのURLに
javascript:(function(){コンパイル後のコード})();
を記入すれば動作するはず

動作しなかったら教えてください

0 件のコメント :