Skip to content

Instantly share code, notes, and snippets.

@novi
Last active December 19, 2015 15:29
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 novi/5977158 to your computer and use it in GitHub Desktop.
Save novi/5977158 to your computer and use it in GitHub Desktop.
片仮名と平仮名を抜くブックマークレット。140文字は無理だった。
javascript:o='childNodes';p='nodeValue';function%20m(n){var%20c=n[o];for(i%20in%20c){e=c[i];e.nodeType==3&&(e[p]=e[p].replace(/[ぁ-んァ-ヶー]/g,''));e[o]&&m(e)}}m(document)
Yahoo ニュースの例 http://twitpic.com/d23do7
1文字コードずらす
javascript:o='childNodes';p='nodeValue';function%20m(n)%7Bvar%20c=n%5Bo%5D;for(i%20in%20c)%7Be=c%5Bi%5D;e.nodeType==3&&(e%5Bp%5D=e%5Bp%5D.replace(/%5B%E3%81%81-%E3%82%93%E3%82%A1-%E3%83%B6%5D/g,function(a,b)%7breturn%20String.fromCharCode(a.charCodeAt(0)-1)%7d));e%5Bo%5D&&m(e)%7D%7Dm(document)
平仮名片仮名交換
javascript:o='childNodes';p='nodeValue';function m(n){var c=n[o];for(i in c){e=c[i];e.nodeType==3&&(e[p]=e[p].replace(/([ぁ-ん])|([ァ-ヶ])/g,function(a,b){return String.fromCharCode(a.charCodeAt(0)+(b?0x60:-0x60))}));e[o]&&m(e)}}m(document)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment