[?]ネイティオ語自動翻訳

  • // @title [?]ネイティオ語自動翻訳
    // @description トゥート中のトゥートゥーを日本語に変換します。
    // @include https://*/web/*
    // @license MIT License
    // @javascript_url
    
    // http://kachikachi.net/xatu/
    
    (
     (f,
      t = document.querySelector('.columns-area'),
      p = l => Array.from(l, (
       c, n, i = 0, x = c.nodeType == 3 ? 0 : document.evaluate('//div[contains(@class,"status__content ")]//text()', c, null, 6, null)
      ) => {
       if (x) while (n = x.snapshotItem(i++)) n.nodeValue = f(n.nodeValue)
      })
     ) => { p([t], new MutationObserver(m => m.forEach(r => p(r.addedNodes))).observe(t, { childList: 1, subtree: 1 })) }
    )(
     // ここに置換用 function を入れる
     (
      s, a = [233,,5,,14,,215,,148,49,,211,,41,,71,,80,,212,,232,,239,,160,,79,,7,,43,,,52,,152,,130,,16,70,40,77,44,67,,,230,,,76,,,1,,,22,,,68,131,2,203,205,,17,,206,,8,13,25,214,26,50,,23,149,157,53,151,,,,,,4,133]
     ) => s.split(/\s+/).map(g => 
      ~(c = a.indexOf(parseInt(+g.replace(/トゥ(ー?)/g, (_, l) => l ? 2 : 1) , 3)))
      ? String.fromCharCode(12354 + c) : g.trim() + ' '
     ).join('')
    );
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2018/01/07 00:23:09 - 2018-01-07
  2. 2017/12/13 22:57:47 - 2017-12-13
  3. 2017/12/13 22:51:14 - 2017-12-13
  4. 2017/12/13 22:50:38 - 2017-12-13