cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <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>
            
          
!
            
              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: yellow;
  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;
}
            
          
!
            
              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
Loading ..................

Console