Advertisement
Guest User

Untitled

a guest
Apr 25th, 2022
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ((words, smile, size = 32) => {
  2.     const img = `<img src='${smile}' width="${size}" height="${size}" />`
  3.     const res = [
  4.         [],
  5.         [],
  6.         [],
  7.         [],
  8.         []
  9.     ]
  10.     let text = ""
  11.  
  12.     const map = {
  13.         " ": [
  14.             [0],
  15.             [0],
  16.             [0],
  17.             [0],
  18.             [0]
  19.         ],
  20.         a: [
  21.             [1, 1, 1],
  22.             [1, 0, 1],
  23.             [1, 1, 1],
  24.             [1, 0, 1],
  25.             [1, 0, 1]
  26.         ],
  27.         b: [
  28.             [1, 1, 0],
  29.             [1, 0, 1],
  30.             [1, 1, 0],
  31.             [1, 0, 1],
  32.             [1, 1, 0]
  33.         ],
  34.         c: [
  35.             [1, 1, 1],
  36.             [1, 0, 0],
  37.             [1, 0, 0],
  38.             [1, 0, 0],
  39.             [1, 1, 1]
  40.         ],
  41.         d: [
  42.             [0, 0, 1],
  43.             [0, 0, 1],
  44.             [1, 1, 1],
  45.             [1, 0, 1],
  46.             [1, 1, 1]
  47.         ],
  48.         e: [
  49.             [1, 1, 1],
  50.             [1, 0, 0],
  51.             [1, 1, 1],
  52.             [1, 0, 0],
  53.             [1, 1, 1]
  54.         ],
  55.         f: [
  56.             [1, 1, 1],
  57.             [1, 0, 0],
  58.             [1, 1, 1],
  59.             [1, 0, 0],
  60.             [1, 0, 0]
  61.         ],
  62.         g: [
  63.             [0, 1, 1, 1],
  64.             [1, 0, 0, 0],
  65.             [1, 0, 1, 1],
  66.             [1, 0, 0, 1],
  67.             [0, 1, 1, 0]
  68.         ],
  69.         h: [
  70.             [1, 0, 0, 1],
  71.             [1, 0, 0, 1],
  72.             [1, 1, 1, 1],
  73.             [1, 0, 0, 1],
  74.             [1, 0, 0, 1]
  75.         ],
  76.         i: [
  77.             [0, 1, 0],
  78.             [0, 0, 0],
  79.             [0, 1, 0],
  80.             [0, 1, 0],
  81.             [0, 1, 0]
  82.         ],
  83.         j: [
  84.             [0, 0, 1],
  85.             [0, 0, 1],
  86.             [0, 0, 1],
  87.             [1, 0, 1],
  88.             [0, 1, 0]
  89.         ],
  90.         k: [
  91.             [1, 0, 0, 1],
  92.             [1, 0, 1, 0],
  93.             [1, 1, 0, 0],
  94.             [1, 0, 1, 0],
  95.             [1, 0, 0, 1]
  96.         ],
  97.         l: [
  98.             [1, 0, 0],
  99.             [1, 0, 0],
  100.             [1, 0, 0],
  101.             [1, 0, 0],
  102.             [1, 1, 1]
  103.         ],
  104.         m: [
  105.             [1, 0, 1],
  106.             [1, 1, 1],
  107.             [1, 0, 1],
  108.             [1, 0, 1],
  109.             [1, 0, 1]
  110.         ],
  111.         n: [
  112.             [1, 0, 0, 1],
  113.             [1, 1, 0, 1],
  114.             [1, 0, 1, 1],
  115.             [1, 0, 0, 1],
  116.             [1, 0, 0, 1]
  117.         ],
  118.         o: [
  119.             [1, 1, 1],
  120.             [1, 0, 1],
  121.             [1, 0, 1],
  122.             [1, 0, 1],
  123.             [1, 1, 1]
  124.         ],
  125.         p: [
  126.             [1, 1, 0],
  127.             [1, 0, 1],
  128.             [1, 1, 0],
  129.             [1, 0, 0],
  130.             [1, 0, 0]
  131.         ],
  132.         q: [
  133.             [0, 1,],
  134.             [1, 0, 1],
  135.             [1, 0, 1],
  136.             [0, 1, 1],
  137.             [0, 0, 1]
  138.         ],
  139.         r: [
  140.             [1, 1, 1, 0],
  141.             [1, 0, 0, 1],
  142.             [1, 1, 1, 0],
  143.             [1, 0, 1, 0],
  144.             [1, 0, 0, 1]
  145.         ],
  146.         s: [
  147.             [1, 1, 1],
  148.             [1, 0, 0],
  149.             [1, 1, 1],
  150.             [0, 0, 1],
  151.             [1, 1, 1]
  152.         ],
  153.         t: [
  154.             [1, 1, 1],
  155.             [0, 1, 0],
  156.             [0, 1, 0],
  157.             [0, 1, 0],
  158.             [0, 1, 0]
  159.         ],
  160.         u: [
  161.             [1, 0, 0, 1],
  162.             [1, 0, 0, 1],
  163.             [1, 0, 0, 1],
  164.             [1, 0, 0, 1],
  165.             [0, 1, 1, 0]
  166.         ],
  167.         v: [
  168.             [1, 0, 0, 0, 1],
  169.             [1, 0, 0, 0, 1],
  170.             [0, 1, 0, 1, 0],
  171.             [0, 1, 0, 1, 0],
  172.             [0, 0, 1, 0, 0]
  173.         ],
  174.         w: [
  175.             [1, 0, 1, 0, 1],
  176.             [1, 0, 1, 0, 1],
  177.             [1, 0, 1, 0, 1],
  178.             [0, 1, 1, 1, 0],
  179.             [0, 0, 1, 0, 0]
  180.         ],
  181.         x: [
  182.             [1, 0, 0, 0, 1],
  183.             [0, 1, 0, 1, 0],
  184.             [0, 0, 1, 0, 0],
  185.             [0, 1, 0, 1, 0],
  186.             [1, 0, 0, 0, 1]
  187.         ],
  188.         y: [
  189.             [1, 0, 1],
  190.             [0, 1, 0],
  191.             [0, 1, 0],
  192.             [0, 1, 0],
  193.             [0, 1, 0]
  194.         ],
  195.         z: [
  196.             [1, 1, 1, 1, 1],
  197.             [0, 0, 0, 1, 0],
  198.             [0, 0, 1, 0, 0],
  199.             [0, 1, 0, 0, 0],
  200.             [1, 1, 1, 0, 0]
  201.         ]
  202.     }
  203.  
  204.     for (const e of words.toLowerCase().split("")) {
  205.         for (let i = 0; i < 5; i++) {
  206.             for (const j of map[e][i]) {
  207.                 res[i].push(j)
  208.             }
  209.         }
  210.  
  211.         for (let i = 0; i < 5; i++) {
  212.             res[i].push(0)
  213.         }
  214.     }
  215.  
  216.     for (const e of res) {
  217.         text += "<p>"
  218.         for (const j of e) {
  219.             if (j === 1) {
  220.                 text += img
  221.             } else {
  222.                 text += `<img width="${size}" height="${size}" src="https://i.ibb.co/Zd54Q5y/1x1-ffffff05.png"/>`
  223.             }
  224.         }
  225.         text += `</p>`
  226.     }
  227.  
  228.     tinymce.activeEditor.setContent(text)
  229. })("string", "/img/forum/emoticons/WispD.png", "25")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement