Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> -->

<body onload="selectInput()">
<h2 class="pad-top">Regional Indicator Emoji Writer

</h2>

<p class="txt-right">Click/Enter to copy. <strong>Ctrl/CMD&thinsp;+&hairsp;V</strong> in FB/TW to paste.</p>

    
    

    
  <strong>String</strong>
  <input type="text" id="from" class="right" placeholder="write stuff here" value="" tabindex="0" autofocus> 
    <br>
    
<div class="right">
<input type="text" value="๐Ÿ‡ชโ€Š๐Ÿ‡ฒโ€Š๐Ÿ‡ดโ€Š๐Ÿ‡ฏโ€Š๐Ÿ‡ฎโ€Š   โ€Š๐Ÿ‡ดโ€Š๐Ÿ‡บโ€Š๐Ÿ‡นโ€Š๐Ÿ‡ตโ€Š๐Ÿ‡บโ€Š๐Ÿ‡น" id="myInput3" maxlength="2000">

    <div class="tooltip">
        <button onclick="myFunction3()" onmouseout="outFunc()">
  <span class="tooltiptext" id="myTooltip">Copy to clipboard</span>
  Copy
  </button>
    </div>
</div>    
  
  <h4>Currently Supports</h4>
  <ul>
    <li>letters</li>
    <li>numbers</li>
    <li> ! ? </li>
    <li>spaces</li>    <li>#</li> <li>-</li>

  </ul>
</body>
              
            
!

CSS

              
                *
  margin: 0
  padding: 0

html
  background-color: #131313

body
  color: #ddd
  
@import url('https://fonts.googleapis.com/css?family=Kurale|Laila')

\:root
  --dark:#5B4E3E
  --accent:#B5C7DD
  --midtone:#897052
  --light:#fdfcf6
  --txt:#999590
  --display:'Kurale', Serif
  --body:'Laila', serif

html
  display: flex
  background-color: var(--accent)
  background-image: url(cssimg/left-piece-shad.png), url(cssimg/right-piece-shad.png), url(cssimg/heart-repeat-03.svg)
  background-repeat: repeat-y, repeat-y, repeat
  background-attachment: scroll, scroll, fixed
  background-size: 40px, 46px, 110px
  background-position: calc(50% - 360px), calc(50% + 360px)

body
  // background: var(--light)
  padding: 0 49px
  color: var(--txt)
  font-family: var(--body)
  font-size: 1.22rem
  line-height: 1.9em
  text-align: left
  margin-left: auto
  margin-right: auto
  min-height: 100%

html, body
  height: 99.98%

h1, h2, h3, h4, a, h5, button
  font-family: var(--display)
  text-shadow: 0.025em 0.025em 0.025em var(--dark)
  line-height: 1.25em
  // color: var(--white)
  
h1 + h4, h3 + p
  text-align: center
  padding: 0

h1
  color: var(--accent)
  font-size: 4em
  text-align: center
  line-height: 1em
  padding: .46em 0 .08em .15em
  text-shadow: 0.015em 0.015em 0.04em var(--dark)

h4
  color: var(--txt)
  font-size: 1.3em
  text-align: Left
  padding-left: 0

.center
  display: block
  margin-left: auto
  margin-right: auto
  padding: .15em 0 1.8em 0

h2
  text-transform: uppercase
  color: var(--midtone)
  // color: var(--light)
  font-size: 1.2em
  padding-left: .5em
  padding-bottom: .3em
  letter-spacing: .04em

h3
  font-size: 1.7em
  color: var(--midtone)
  padding-bottom: .5em
  text-align: center

strong
  font-family: var(--display)
  text-shadow: 0.025em 0.025em 0.025em var(--dark)
  font-size: 112%

a, button
  color: var(--accent)
  text-decoration: none
  font-size: 1.2em

.block
  display: block

button
  font-size: 1.1em

input
  font-family: var(--body)
  color: var(--midtone)
  font-size: .8em
  border: 1.05pt solid var(--txt)
  background: var(--light)
  padding: .18em .5em
  margin: 10pt 6pt
  width: 475px

#from
  width: 250px
  margin-right: 10em

#png
  margin-right: 3em

.right
  position: absolute
  right: calc(50% - 290px)

.txt-right
  text-align: right

a:hover, input:hover, button:hover
  color: var(--midtone)

a:active, input:active, button:hover
  color: var(--dark)

footer
  a
    font-size: 1.4em

  background-color: var(--light)

p
  padding: 0 12px .618em 25px
  margin: auto
  max-width: 42em
  color: var(--midtone)

h5
  padding: 0 12px .618em 25px
  margin: auto
  max-width: 44em
  color: var(--midtone)
  color: var(--txt)
  text-transform: uppercase

p + h5
  padding: 0 12px .25rem 25px

footer
  text-align: center
  padding-top: .3em
  padding-bottom: 1.5em

em
  font-style: italic
  font-weight: 500

.stretch
  -moz-overflow: hidden
  overflow: hidden
  max-width: 800px

  /*
   *   padding: 100rem 47px;         
   *   margin: -100rem -47px;
  padding: 2000rem 47px 2.2rem
  margin: -2000rem -47px -2.2rem
  background: var(--light)

.hide
  visibility: none !important
  color: var(--light)

.bottom
  margin-bottom: auto
  display: block
  position: sticky
  border-bottom: 0 solid var(--light)

.pad-top
  padding-top: 1em

.nudge
  padding-top: .25em

td
  padding: 0 .618em

.ghost
  opacity: .33

button
  border: 1.15pt dashed var(--txt)
  background: var(--light)
  padding: 0 4pt 3pt 4pt
  margin: 10pt 6pt

form
  max-width: 44em

.tooltip
  position: left
  display: inline-block

  .tooltiptext
    visibility: hidden
    width: auto
    background-color: var(--dark)
    color: var(--light)
    text-align: center
    border-radius: 6px
    padding: .5em
    position: absolute
    z-index: 1
    bottom: 160%
    left: 50%
    margin-left: -75px
    opacity: 0
    transition: opacity 0.3s

    &::after
      content: ""
      position: absolute
      top: 100%
      left: 50%
      margin-left: -7px
      border-width: 7px
      border-style: solid
      border-color: var(--dark) transparent transparent transparent
      opacity: .9

  &:hover .tooltiptext
    visibility: visible
    opacity: .9
      
      
h4
  padding-top: 2.5em
ul
  color: var(--dark)
  
li
  display: inline-block
              
            
!

JS

              
                function selectInput()
    {var input = document.getElementById("from").focus();}

window.addEventListener('focus', selectInput);
 
  // var from = document.getElementById('from').value;       
  // var stringArray = from.split("");
  // var wordArray = from.split(" ");
var inpoot = document.getElementById("from");
inpoot.addEventListener("keyup", function(event) {
  if (event.keyCode === 13) {
   event.preventDefault();
   myFunction3();
  }
});

function myFunction3() 
{

  var emojiOutput = []; 
  // emojiOutput.push("โ€ฏ");
  var from = document.getElementById('from').value.toLowerCase();       
  var stringArray = from.split("");
  var wordArray = from.split(" ");
  // var stringArray = input.split("");
  // emojiOutput.push("โ€ƒ");
  var output = stringArray.forEach(reg);

  // var re = [a-z];
  
  function reg(letter, i) {
    if(/[a-z]/.test(letter)){
      var reg = { "a": "๐Ÿ‡ฆ", "b": "๐Ÿ‡ง", "c": "๐Ÿ‡จ", "d": "๐Ÿ‡ฉ", "e": "๐Ÿ‡ช", "f": "๐Ÿ‡ซ", "g": "๐Ÿ‡ฌ", "h": "๐Ÿ‡ญ", "i": "๐Ÿ‡ฎ", "j": "๐Ÿ‡ฏ", "k": "๐Ÿ‡ฐ", "l": "๐Ÿ‡ฑ", "m": "๐Ÿ‡ฒ", "n": "๐Ÿ‡ณ", "o": "๐Ÿ‡ด", "p": "๐Ÿ‡ต", "q": "๐Ÿ‡ถ", "r": "๐Ÿ‡ท", "s": "๐Ÿ‡ธ", "t": "๐Ÿ‡น", "u": "๐Ÿ‡บ", "v": "๐Ÿ‡ป", "w": "๐Ÿ‡ผ", "x": "๐Ÿ‡ฝ", "y": "๐Ÿ‡พ", "z": "๐Ÿ‡ฟ"}; 
      // emojiOutput.push(":regional_indicator_" + letter + ":");  
      emojiOutput.push(reg[letter]);
    }
    else if(/[0-9]/.test(letter)){
        // var num = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"];
        var num2 = ["0๏ธโƒฃ", "1๏ธโƒฃ", "2๏ธโƒฃ", "3๏ธโƒฃ", "4๏ธโƒฃ", "5๏ธโƒฃ", "6๏ธโƒฃ", "7๏ธโƒฃ", "8๏ธโƒฃ", "9๏ธโƒฃ"];
      // emojiOutput.push(":" + num[letter] + ":");
      emojiOutput.push(num2[letter]);

    }
    else if(/ /.test(letter)){
      // convert space to emspace + nbsp
      emojiOutput.push("โ€ƒ ");      
    }
    else if(/!/.test(letter)){
      // emojiOutput.push("โ•");      
      randQ = Math.floor(2 * Math.random());
      Q = ["โ•", "โ—"]
      // emojiOutput.push("โ”");
      emojiOutput.push(Q[randQ]);
    }
    else if(/\?/.test(letter)){
      randQ = Math.floor(2 * Math.random());
      Q = ["โ”", "โ“"]
      // emojiOutput.push("โ”");
      emojiOutput.push(Q[randQ]);
    }
    else if(/[\/]/.test(letter)){
      emojiOutput.push("๐Ÿ”ง");      
    }
    else if(/[\',โ€™]/.test(letter)){
      emojiOutput.push("๐Ÿงท");      
    }
    else if(/["]/.test(letter)){
      emojiOutput.push("๐Ÿงฆ");      
    }
    else if(/[\.]/.test(letter)){
      emojiOutput.push("โ–ซ๏ธ");      
    }
    else if(/-/.test(letter)){
      // emojiOutput.push(":small_blue_diamond:");
      emojiOutput.push("๐Ÿ”น");
    }
    else if(/[โ€“,โ€”]/.test(letter)){
      // emojiOutput.push(":small_blue_diamond:");
      emojiOutput.push("โž–");
    }
      
     else if(/#/.test(letter)){
      emojiOutput.push("#๏ธโƒฃ");
    } 
     else if(/\*/.test(letter)){
      emojiOutput.push("*๏ธโƒฃ");
    }    
    
     else if(/~/.test(letter)){
      emojiOutput.push("ใ€ฐ๏ธ");
    }
    
     else if(/:/.test(letter)){
      emojiOutput.push("โฃ๏ธ");
    }    
    
     else if(/\$/.test(letter)){
      emojiOutput.push("๐Ÿ’ฒ");
    }  
     else if(/\+/.test(letter)){
      emojiOutput.push("โž•");
    }  
    
    else {
      // regular thinspaces
      emojiOutput.push("โ€ฏ" + letter + "โ€ฏ");
    }
  }
  // nonbreaking thinspaces
  // var joined = emojiOutput.join;
  var final = [];
  var rejoined = emojiOutput.forEach(spays);
  function spays(emoji, i) {
    if (/\S/.test(emoji)){
      // nonbreaking thinsp
      final.push(emoji + "โ€ฏ")
    }
    else {
      final.push(emoji)
    };
  };
      document.getElementById("myInput3").value = final.join("");
  // document.getElementById("myInput3").value = emojiOutput.join("โ€ฏ");

  
 
    
  var copyText = document.getElementById("myInput3");
  copyText.select();
  document.execCommand("copy");
  
  var tooltip = document.getElementById("myTooltip");
  tooltip.innerHTML = "Copied: " + copyText.value;

}     
    
    
function outFunc() {
  var tooltip = document.getElementById("myTooltip");
  tooltip.innerHTML = "Copy to clipboard";
}
    
              
            
!
999px

Console