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

    @@ -1,16 +1,22 @@ -// @title Mastodon - n7m -// @description トゥート中の3文字以上の英字列をnumeronymに変換します。 +// @title [?]ネイティオ語自動翻訳 +// @description トゥート中のトゥートゥーを日本語に変換します。 // @include https://*/web/* // @license MIT License // @javascript_url -// https://github.com/timrwood/n7m +// http://kachikachi.net/xatu/ -((target, p) => (new MutationObserver(m => m.forEach(r => p(r.addedNodes))).observe(target, {childList: 1, subtree: 1}), p([target])))( - document.querySelector('.columns-area'), - ns=> - Array.from(ns) - .reduce((p, c) => p.concat(c.querySelectorAll ? Array.from(c.querySelectorAll('.status__content, .status__content p, p>span')) : []), []) - .forEach(e=> - Array.from(e.childNodes, n=> n.nodeType === Node.TEXT_NODE && (n.textContent= n.textContent.replace(/[a-z]{4,}/gi, s => `${s[0]}${s.length-2}${s[s.length-1]}`)))) -); +( + ( + 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], + t = document.querySelector('.columns-area'), + p = l => Array.from(l, ( + c, n, i = 0, x = document.evaluate('//div[contains(@class,"status__content ")]//text()', c, p, 6, null) + ) => { + while (n = x.snapshotItem(i++)) n.nodeValue = n.nodeValue.split(/\s+/).map(g => + ~(c = a.indexOf(parseInt(+g.replace(/トゥ(ー?)/g, (_, l) => l ? 2 : 1) , 3))) + ? String.fromCharCode(12354 + c) : g.trim() + ' ' + ).join('') + }) + ) => p([t], new MutationObserver(m => m.forEach(r => p(r.addedNodes))).observe(t,{ childList: 1, subtree: 1 })) +)();
  • // @title [?]ネイティオ語自動翻訳
    // @description トゥート中のトゥートゥーを日本語に変換します。
    // @include https://*/web/*
    // @license MIT License
    // @javascript_url
    
    // http://kachikachi.net/xatu/
    
    (
     (
      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],
      t = document.querySelector('.columns-area'),
      p = l => Array.from(l, (
       c, n, i = 0, x = document.evaluate('//div[contains(@class,"status__content ")]//text()', c, p, 6, null)
      ) => {
       while (n = x.snapshotItem(i++)) n.nodeValue = n.nodeValue.split(/\s+/).map(g => 
        ~(c = a.indexOf(parseInt(+g.replace(/トゥ(ー?)/g, (_, l) => l ? 2 : 1) , 3)))
        ? String.fromCharCode(12354 + c) : g.trim() + ' '
       ).join('')
      })
     ) => p([t], new MutationObserver(m => m.forEach(r => p(r.addedNodes))).observe(t,{ childList: 1, subtree: 1 }))
    )();
    
  • 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