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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <center>
<div>
  <form>
    <input id='inputText' type='text' placeholder='your text here'></input>
    <input id='reset' type='reset' value='Clear'></input>
  </form>
  <div>
    <button onClick="clap()">👏</button>
    <button onClick="sassyClap()">👏🙄</button>
    <button onClick="sassy()">🙄</button>
    <button onClick="threaten()">💰</button>
  </div>
  <div id='results'>
    <input id="code" type='text'></input>
    <button id='btn_copy' onClick='copyText()'>Copy to Clipboard</button>
  </div>
</div>

</center>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Raleway);

button {
  border-radius: 12px;
  -webkit-transition-duration: 0.4s;
  transition-duration: 0.4s;
  background-color: #b9cfd6;
  margin: 10px;
  font-family: 'Raleway';
  font-weight: bold;
  padding: 10px;
  font-size: 20px;
}

button:hover {
  background-color: #4e7a87;
  color: white;
  box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
    -webkit-transform: rotate(10deg);
          transform: rotate(10deg);
}

button:active {
    background-color: #3e8e41;
    box-shadow: 0 5px #666;
    transform: translateY(4px);
}

input {
  border: none;
  border-bottom: 2px solid black;
  margin: 15px;
  font-family: 'Raleway';
  font-weight: bold;
}
              
            
!

JS

              
                var output = '';
document.getElementById('results').style.display = "none";

// Add clap emojis between words
function clap() {
  output = '';  
  output = createResponse(getRequest(), 'clap');  
  document.getElementById('code').value = output;
}

// Spongebob Casing
function sassy() {
  output = '';
  output = createResponse(getRequest(), 'sassy');
  document.getElementById('code').value = output;
}

// Ransom Note
function threaten(){
  output = '';
  output = createResponse(getRequest(), 'threaten');
  document.getElementById('code').value = output;
}

// Get text from input
function getRequest() {
  document.getElementById('results').style.display = "block";
  return document.getElementById('inputText').value;
}

// Returns response from respective get calls
function createResponse(input, formatType) {
  if (formatType == 'clap')
    return getClapResponse(input);  
  else if (formatType == 'sassy')
    return getSassyResponse(input);
}

function getSassyResponse(input) {
  for (var i = 0; i < input.length; i++) {
    if (input[i] == 'i' || input[i] == 'I')
      output += 'i'; // i's should never be capitalized
    else if (input[i] == 'l' || input[i] == 'L')
      output += 'L'; // L's should never be lower case
    else if (i % 2 == 0)
     output += input[i].toUpperCase();
   else
     output += input[i];
  }
  
  return output;
}

// Split text by spaces; add in spaces and clap emojis
function getClapResponse(input) {
  output = input.split(" ").join(" 👏 ");
  return output.toUpperCase();
}

function sassyClap() {
  output = '';
  output = createResponse(getRequest(), 'sassy').split(" ").join(" 👏 ");
  document.getElementById('code').value = output;
}

// Copy text in output field
function copyText() {
  var copyText = document.getElementById("code");
  copyText.select();
  document.execCommand("copy");
}
              
            
!
999px

Console