Skip to content

Instantly share code, notes, and snippets.

@takehiko
Created October 21, 2011 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takehiko/1304711 to your computer and use it in GitHub Desktop.
Save takehiko/1304711 to your computer and use it in GitHub Desktop.
KWIC表示のbookmarklet
<ul>
<li><a href="javascript:(function(){var t='。',L=t.length,D='・',w=window,s=w.getSelection().toString(),d=w.open().document,m=10;for(q=m;q!=0;q--)s=D+s+D;d.writeln('<pre>');while((p=s.indexOf(t,q))!=-1){d.writeln(s.substr(p-m,L+2*m).replace(/[\u0000-\u001F|\u007F]/g,D).replace(/[\u0020-\u007E]/g,'$&_'));q=p+1;}d.writeln('</pre>');d.close();})();">「。」で検索</a></li>
<li><a href="javascript:(function(){var t='.',L=t.length,D='・',w=window,s=w.getSelection().toString(),d=w.open().document,m=10;for(q=m;q!=0;q--)s=D+s+D;d.writeln('<pre>');while((p=s.indexOf(t,q))!=-1){d.writeln(s.substr(p-m,L+2*m).replace(/[\u0000-\u001F|\u007F]/g,D).replace(/[\u0020-\u007E]/g,'$&_'));q=p+1;}d.writeln('</pre>');d.close();})();">「.」で検索</a></li>
<li><a href="javascript:(function(){var t='順',L=t.length,D='・',w=window,s=w.getSelection().toString(),d=w.open().document,m=10;for(q=m;q!=0;q--)s=D+s+D;d.writeln('<pre>');while((p=s.indexOf(t,q))!=-1){d.writeln(s.substr(p-m,L+2*m).replace(/[\u0000-\u001F|\u007F]/g,D).replace(/[\u0020-\u007E]/g,'$&_'));q=p+1;}d.writeln('</pre>');d.close();})();">「順」で検索</a></li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment