Tiếng SKY

Teen code Sky code

by baivong

HTML

<script src="https://cdn.jsdelivr.net/clipboard.js/1.5.12/clipboard.min.js"></script>
<div class="wrap">
  <h1 class="title center">Công cụ tạo TEENCODE</h1>
  <textarea id="input" class="content" rows="7" placeholder="Gõ vào đây..."></textarea>
  <div class="config center">
    <label for="modelcode">
      <input type="checkbox" id="modelcode" name="modelcode"> Modelcode
    </label>
    <label for="teencode">
      <input type="checkbox" id="teencode" name="teencode" checked> Teencode</label>
    <label for="skycode">
      <input type="checkbox" id="skycode" name="skycode" checked> Skycode
    </label>
  </div>
  <pre id="output" class="content">Dành cho Fan của nghệ sĩ ❤ Sơn Tùng M-TP ❤</pre>
  <div class="center">
    <button id="copybtn" data-clipboard-target="#output">
      Sao chép vào Clipboard
    </button>
  </div>
</div>

CSS

.wrap {
  margin: 30px auto;
  width: 90%;
  font-family: 'Tahoma', san-serf;
  font-size: 14px;
}

.title {
  font-size: 1.7em;
  font-weight: lighter;
}

.content {
  display: block;
  width: 100%;
  padding: 5px 16px;
  border: 1px solid #ddd;
  border-radius: 3px;
  text-align: justify;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
}

#input {
  background: #fff;
}

#output {
  background: #eee;
  white-space: pre-wrap;
}

.config {
  font-size: smaller;
  color: #595656;
}

.config input {
  margin-right: 4px;
  vertical-align: middle;
}

.config label {
  margin: 0 7px;
}

.center {
  text-align: center;
  margin: 20px 0;
}

#copybtn {
  padding: 4px 0;
  display: block;
  width: 100%;
  color: #595656;
}

JavaScript

// by lelinhtinh - https://lelinhtinh.github.io/

(function() {
  'use strict';

  function bodau(str) {
    str = str.toLowerCase();

    str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, 'a');
    str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, 'e');
    str = str.replace(/ì|í|ị|ỉ|ĩ/g, 'i');
    str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, 'o');
    str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g, 'u');
    str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g, 'y');
    str = str.replace(/đ/g, 'd');

    return str;
  }

  function modelcode(str) {
    str = bodau(str);

    str = str.replace(/b/g, 'ß');
    str = str.replace(/c/g, '\(');
    str = str.replace(/d/g, '\]\)');
    str = str.replace(/e/g, 'F_');
    str = str.replace(/g/g, '\(¬');
    str = str.replace(/h/g, '†\|');
    str = str.replace(/i/g, '\]');
    str = str.replace(/k/g, '\]<');
    str = str.replace(/l/g, '\]_');
    str = str.replace(/n/g, '\]\[');
    str = str.replace(/o/g, 'º');
    str = str.replace(/p/g, '\]º');
    str = str.replace(/q/g, 'º\[');
    str = str.replace(/s/g, '§');
    str = str.replace(/t/g, '†');
    str = str.replace(/u/g, 'µ');
    str = str.replace(/v/g, '\\\/');
    str = str.replace(/w/g, 'v\/');
    str = str.replace(/x/g, '><');
    str = str.replace(/y/g, '¥');
    str = str.replace(/a/g, 'Cl');
    str = str.replace(/r/g, 'Pv');
    str = str.replace(/m/g, '\/v');

    return str;
  }

  function teencode(str) {
    str = bodau(str);

    str = str.replace(/_/g, '..');
    str = str.replace(/-/g, '~');
    str = str.replace(/\bkhong\b/g, 'h0k');
    str = str.replace(/o/g, '0');
    str = str.replace(/e/g, '3');
    str = str.replace(/a/g, '4');
    str = str.replace(/s/g, '_x');
    str = str.replace(/x/g, 's');
    str = str.replace(/_s/g, 'x');
    str = str.replace(/v/g, 'z');
    str = str.replace(/y/g, 'ij');
    str = str.replace(/\bgi/g, 'j');
    str = str.replace(/i(?!j)/g, 'j');
    str = str.replace(/\Bch\b|c(?!h)/g, 'k');
    str = str.replace(/\bth\B/g,...