Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <div class="content center vertical-center">
  <div class="col-sm-offset-1 col-sm-10">

       <div id="envelope-status" class="status"></div>
       <textarea class="form-control" placeholder="Message for the Uninitiated" id="envelope"></textarea>

  </div>
</div>
              
            
!

CSS

              
                body {
  background-image: url(http://blog.thornyeternity.com/wp-content/uploads/2012/05/tile-arabesques-dark-preview.jpg);
}

.content {
  margin: 10px;
}

.status {
  color: white;
  font-size: 18px;
}

.ghost {
  color: cyan;
  display:inline;
}

.code {
  color: gray;
  display:inline;
}

#envelope{
  height:400px;
}

.center {
     float: none;
     margin-left: auto;
     margin-right: auto;
}

.vertical-center {
  min-height: 100%;  /* Fallback for browsers do NOT support vh unit */
  min-height: 100vh; /* These two lines are counted as one :-)       */

  display: flex;
  align-items: center;
}
              
            
!

JS

              
                function word_count(s) {
  s = s.replace(/\s\s+/g, ' '); //exclude  any whitespace with single space
  s = s.replace(/[ ]{2,}/gi, " "); //2 or more space to 1
  s = s.replace(/\n /, "\n"); // exclude newline with a start spacing
  return s.split(' ').filter(function(_in) {
    return _in != "";
  }).length;
}

function get_senteces(s) {
  return s.split(/[.\?]/)
}

function decode_envelope(s) {
  var r_non_word = new RegExp("^[.\?]*$");
  return get_senteces(s.trim()).filter(function(_s) {
    return !r_non_word.test(_s);
  }).map(function(_s) {
    return word_count(_s);
  });
}

function kabala_decode_1(a) {
  var alphabet = " abcdefghijklmnopqrstuvwxyz1234567890".split('');
  var decoded = [];
  for (var l = 0; l < a.length; l++)
    decoded[l] = alphabet[(Number(a[l])-1)%alphabet.length];

  return decoded;
}

$(document).ready(function() {

  $('#envelope').keyup(function() {
    var _in = $(this).val();
    var coded = decode_envelope(_in);
    var decoded = kabala_decode_1(coded);
    $('#envelope-status').html("<div class='code'>" + decode_envelope(_in).join(":") + " </div>  | Occult Message for the Initiated: <div class='ghost'>" + decoded.join("") + "</div>");
  });

});
              
            
!
999px

Console