Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bookmarklet that lets you open and close zenkaku-parenthesis parts 全角括弧内を開閉できるようにするブックマークレット
// 括弧内を開閉できるようにする。
javascript:(() => {
var s=document.createElement('style');s.innerText='.toggler0 { text-indent:0; width:16px; display: inline-block; animation: 0.2s ease-in forwards rotation; } .toggler1 { text-indent:0; width:16px; display: inline-block; animation: 0.2s ease-in reverse forwards rotation; } @keyframes rotation { 0%25 { transform: rotate(0deg) } 100%25 { transform: rotate(-90deg) } }';document.getElementsByTagName('head')[0].appendChild(s);
})();
[0,1].forEach((l) => {
const d=document;var s=d.body.innerHTML;d.body.innerHTML=s.replace(/(([^(]+?))/g,"<span style=\"\"><span onclick=\"var n=this.nextSibling;if(n.style.display === 'none'){n.style.display = '';this.className='';this.className = 'toggler1';}else{ n.style.display = 'none';this.className='';this.className = 'toggler0';} \" class=\"toggler0\" style=\"color: #aaa; cursor: pointer;\">▼</span><span style=\"display: none\"> ($1) </span></span>");
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment