Skip to content

Instantly share code, notes, and snippets.

@Nyoho
Last active October 28, 2018 04:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nyoho/3d0647fbf6c6e98b9b8c552ddeaab22f to your computer and use it in GitHub Desktop.
Save Nyoho/3d0647fbf6c6e98b9b8c552ddeaab22f to your computer and use it in GitHub Desktop.
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