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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <div id="credit-card-information">
</div>
<div id="ledger-input">
  <h2>Accounts Recievable Form</h2>
  <select class="act-type">
    <option>Deduction</option>
    <option>Addition</option>
  </select>
  <input type="text" class="amount" name="amount" placeholder="Amount" />
  <input type="text" class="company" name="Company" placeholder="Company" />
  <input type="text" class="invoice" name="invoice-number" placeholder="Invoice #" />
  <input type="text" class="datepicker" placeholder="Select a Date" />
  <button id="ledger-add-button">ADD</button>
</div>

<div id="balance-checker">
  <div class="wallet">
    <h2>My Wallets<span id="add-credit-card">+</span></h2>
    <!--ADD CREDIT CARD FORM -->
    <div id="add-cc-form" class="hidden">
      <div id="cc-type" class="nothing"></div>
      <input id="cc-number-input" type="text" placeholder="Credit Card #" maxlength="19" />
      <select class="cc-exp-month">
        <option value="01">JAN</option>
        <option value="02">FEB</option>
        <option value="03">MAR</option>
        <option value="04">APR</option>
        <option value="05">MAY</option>
        <option value="06">JUN</option>
        <option value="07">JUL</option>
        <option value="08">AUG</option>
        <option value="09">SEPT</option>
        <option value="10">OCT</option>
        <option value="11">NOV</option>
        <option value="12">DEC</option>
      </select>
      <select class="cc-exp-year">
        <option value="17">2017</option>
        <option value="18">2018</option>
        <option value="19">2019</option>
        <option value="20">2020</option>
        <option value="21">2021</option>
        <option value="22">2022</option>
      </select>
      <button id="cc-add-button">ADD</button>
    </div>
    
    <div class="scrollme">
      <div class="credit-card"><div id="cc-card-logo" class="visa"></div>
        <p class="cc-num"><sub>**** **** ****</sub> 2562</p>
        <p class="cc-exp">Valid Thru: 12/17</p>
        <span class="remove-data">Remove</span>
      </div>
      <div class="credit-card selected"><div id="cc-card-logo" class="mc"></div>
        <p class="cc-num"><sub>**** **** ****</sub> 2562</p>
        <p class="cc-exp">Valid Thru: 12/17</p>
        <span class="remove-data">Remove</span>
      </div>
      <div class="credit-card"><div id="cc-card-logo" class="visa"></div>
        <p class="cc-num"><sub>**** **** ****</sub> 2562</p>
        <p class="cc-exp">Valid Thru: 12/17</p>
        <span class="remove-data">Remove</span>
      </div>
      <div class="credit-card"><div id="cc-card-logo" class="amex"></div>
        <p class="cc-num"><sub>**** **** ****</sub> 2562</p>
        <p class="cc-exp">Valid Thru: 12/17</p>
        <span class="remove-data">Remove</span>
      </div>
    </div>
  </div>
  <div class="ledger">
    <h2>Current Balance
    <span>$729.<sup>00</sup></span>
    </h2>
    <div class="scrollme">
    <table class="transactions"><tbody>
      <tr class="deduction">
        <td class="icon"><div></div></td>
        <td class="name">
          <p class="bill">Apple iPhone 6, 6g GB<p>
          <p class="invoice-date">Electronics #343223  - 12 July, 2015</p>
        </td>
        <td class="amount">$650.<sup>00</sup><span class="remove-data">Remove</span></td>
      </tr>
      <tr class="addition">
        <td class="icon"><div></div></td>
        <td class="name">
          <p class="bill">Apple iPhone 6, 6g GB<p>
          <p class="invoice-date">Electronics #343223  - 12 July, 2015</p>
        </td>
        <td class="amount">$650.<sup>75</sup><span class="remove-data">Remove</span></td>
      </tr>
      <tr class="deduction">
        <td class="icon"><div></div></td>
        <td class="name">
          <p class="bill">Apple iPhone 6, 6g GB<p>
          <p class="invoice-date">Electronics #343223  - 12 July, 2015</p>
        </td>
        <td class="amount">$650.<sup>26</sup><span class="remove-data">Remove</span></td>
      </tr>
      <tr class="deduction">
        <td class="icon"><div></div></td>
        <td class="name">
          <p class="bill">Apple iPhone 6, 6g GB<p>
          <p class="invoice-date">Electronics #343223  - 12 July, 2015</p>
        </td>
        <td class="amount">$650.<sup>00</sup><span class="remove-data">Remove</span></td>
      </tr>
      <tr class="deduction">
        <td class="icon"><div></div></td>
        <td class="name">
          <p class="bill">Apple iPhone 6, 6g GB<p>
          <p class="invoice-date">Electronics #343223  - 12 July, 2015</p>
        </td>
        <td class="amount">$650.<sup>00</sup><span class="remove-data">Remove</span></td>
      </tr>
      <tr class="deduction">
        <td class="icon"><div></div></td>
        <td class="name">
          <p class="bill">Apple iPhone 6, 6g GB<p>
          <p class="invoice-date">Electronics #343223  - 12 July, 2015</p>
        </td>
        <td class="amount">$650.<sup>00</sup><span class="remove-data">Remove</span></td>
      </tr>
      <tr class="addition">
        <td class="icon"><div></div></td>
        <td class="name">
          <p class="bill">Apple iPhone 6, 6g GB<p>
          <p class="invoice-date">Electronics #343223  - 12 July, 2015</p>
        </td>
        <td class="amount">$650.<sup>00</sup><span class="remove-data">Remove</span></td>
      </tr>
      </tbody></table></div>
  </div>
</div>

<div id="modal">
  <div id="modal_content">
    <h1>What's going on with this build?<h1>
      <h2>1. Using local browser storage to persist data.</h2>
      <h2>2. You leave/close/reload this page your data is still here.</h2> 
      <h2>3. Luhn formula for credit card validation</h2>
      <h2>4. Custom calendar date picker system</h2>
      <h2>5. Automatic ledger logic for instance balance calculation</h2>
      
     <h1>OOP / vanilla JS / SASS<h1>
    <a href="#" title="Close">✖</a>  
  </div>
</div> 
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Open+Sans:600,800');
/********************/
// VARIABLES
/*******************/
$white: #FFF;
$black: #000;
$shared-gray: #b2b2b2;
$shared-dark-gray: #666;
$dark-red: #AA0000;
$transparent-black: rgba(0, 0, 0, 0.2);
$font-serif: "Open Sans";

$font-size-small: 13px;
$font-size-mid: 17px;
$font-size-large: 24px;
$font-size-xlarge: 36px;
$font-size-xxlarge: 48px;

$border-rad: 4px;

// END VARIABLES
/*******************/

body { background-color: #ffcc66; padding: 50px 0; }

input[type=text], select {
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid $shared-gray;
  border-radius: $border-rad;
  box-sizing: border-box;
}

/****************************/
// TOP BAR TRANSACTION INPUT
/***************************/
#ledger-input {
  background-color: #48a0dc;
  margin: auto;
  margin-bottom: 30px;
  padding: 10px;
  border-radius: $border-rad;
  width: 880px;
  box-sizing: border-box;
  
  h2 {
    font-size: $font-size-large;
    font-family: $font-serif;
    color: $white;
  }
  input[type=text], select { width: 19.6%; }
  select { width: auto; }
  input.datepicker { width: 15%; }

  button {
    width: 8.5%;
    margin-left: .5%;
    border-radius: $border-rad;
    height: 42px;
    background-color: #22608a;
    color: $white;
    font-size: $font-size-small;
    font-weight: 700;
    line-height: 40px;
    border: none;
  }
}

/**********************/
// MAIN APP COMPONENT
/*********************/
#balance-checker {
  border-radius: $border-rad;
  background-color: $white;
  box-shadow: 0px 0px 15px 10px rgba(255, 170, 35, 0.4);
  width: 880px;
  height: 700px;
  overflow: hidden;
  margin: auto;

  #add-credit-card {
    float: right;
    font-size: $font-size-xxlarge;
    margin-top: -12px;
    color: #c6cce2;
    cursor: pointer;
    transition-duration: 500ms;
    
    &.enabled { transform: rotate(135deg); }
  }
  
  #add-cc-form {
    box-sizing: border-box;
    background: #333333;
    text-align: center;
    margin-bottom: 20px;
    margin-top: -40px;
    overflow: hidden;
    transition: height 500ms;
    height: 220px;
    
    &.hidden { height: 0; }
    
    input { margin-bottom: 2px; }
    button {
      margin-top: 8px;
      width: 85%;
      border-radius: $border-rad;
      height: 42px;
      background-color: #22608a;
      color: $white;
      font-size: $font-size-small;
      font-weight: 700;
      line-height: 40px;
      border: none;
    }
    #cc-type {
      background: url("http://www.ozanimalhospital.com/images/Credit-Card-Logos.png") no-repeat;
      background-size: 200px;
      height: 30px;
      width: 50px;
      margin: 10px 0 10px 20px;
      
      &.nothing { background: none; }
      &.visa { background-position: 0px 0px; }
      &.mc { background-position: -50px 0px; }
      &.discover { background-position: -148px 0px; }
      &.amex { background-position: -99px 0px; }
    }
    select { width: 104px; }
  }
  
  .wallet {
    background-color: #f2f2f2;
    width: 250px;
    float: left;
    height: 100%;
    padding: 55px;
    
    .scrollme { 
      overflow-y: scroll; 
      height: 510px; 
      width: 275px; 
      &.enabled { height: 340px; }
    }
    
    h2 {
      font-size: $font-size-large;
      font-family: $font-serif;
      color: rgb(112, 117, 132);
      text-align: left;
      margin-bottom: 60px;
    }
    .credit-card {
      height: 150px;
      width: 250px;
      background-color: $white;
      padding: 15px;
      box-sizing: border-box;
      border-radius: $border-rad;
      margin-bottom: 30px;
      box-shadow: 0px 1px 2px 0px $transparent-black;
      border: 2px solid rgb(225, 225, 225);
      
      &.selected { border: 4px solid #8393CA; }

      p {
        font-family: $font-serif;
        display: block;
        margin-bottom: 10px;
        
        &.cc-num {
          font-size: $font-size-mid;
          font-family: $font-serif;
          color: $shared-dark-gray;
          letter-spacing: 2px;
        }
        &.cc-exp {
          font-size: $font-size-mid;
          font-family: $font-serif;
          color: $shared-gray;
        }
      }
      #cc-card-logo {
        width: 64px;
        height: 44px;
        background: url('http://oi66.tinypic.com/11iobps.jpg') no-repeat;
        margin-bottom: 20px;
        &.visa {
          background-position: -69px -4px;
        }
        &.mc {
          background-position: -209px -4px;
        }
        &.amex {
          background-position: -140px -4px;
        }
      }
      sub { vertical-align: sub; }

      .remove-data {
        font-family: $font-serif;
        text-transform: uppercase;
        font-size: $font-size-small;
        color: $dark-red;
        float: right;
        margin-top: -23px;
        opacity: 0;
        transition-duration: 300ms;
        cursor: pointer;
      }
      &:hover .remove-data { opacity: 1; }
    }
  }
  .ledger {
    padding: 55px;
    padding-bottom: 0;
    display: inline-block;
    width: 520px;
    box-sizing: border-box;

    .scrollme { 
      overflow-y: scroll; 
      height: 530px; 
      width: 420px; 
      padding-right: 10px; 
    }

    h2 {
      font-size: $font-size-large;
      font-family: $font-serif;
      color: rgb(112, 117, 132);
      line-height: 45px;
      width: 100%;
      padding-bottom: 45px;
      border-bottom: 1px solid $shared-gray;
      
      span {
        font-size: $font-size-xlarge;
        font-family: $font-serif;
        color: rgb(68, 71, 81);
        font-weight: bold;
        float: right;
        line-height: 23px;
        sup {
          font-size: $font-size-mid;
          vertical-align: super;
        }
        &.negative-amt span { color: $dark-red; }
      }
    }
    
    .transactions {
      margin-top: 40px;
      width: 100%;
      
      tr { border-bottom: 45px solid transparent; }
      
      .icon div { margin-bottom: -15px; }
      .deduction .icon div{ 
        background: url('http://oi66.tinypic.com/11iobps.jpg') no-repeat -34px -5px;
        width: 20px;
        height: 20px;
      }
      .addition .icon div{ 
        background: url('http://oi66.tinypic.com/11iobps.jpg')  no-repeat -4px -5px;
        width: 20px;
        height: 20px;
      }
      
      .name {
        width: 75%;
        
        .bill {
          font-size: $font-size-mid;
          font-family: $font-serif;
          color: rgb(51, 51, 51);
          margin-bottom: 10px;
          font-weight: 600;
        }
        .invoice-date {
          font-size: $font-size-small;
          font-family: $font-serif;
          color: rgb(153, 153, 153);
        }
      }
      .amount {
        width: 15%;
        text-align: right;
        font-size: $font-size-mid;
        font-family: $font-serif;
        font-weight: 600;
        
        sup {
          vertical-align: super;
          font-size: $font-size-small;
        }
        
        .remove-data {
          font-family: $font-serif;
          text-transform: uppercase;
          font-size: $font-size-small;
          color: $dark-red;
          float: right;
          margin-top: 12px;
          opacity: 0;
          transition-duration: 300ms;
          cursor: pointer;
        }
        &:hover .remove-data { opacity: 1; }
      }
      .deduction .amount { color: rgb(131, 147, 202); }
      .addition .amount { color: #66cc33; }
    }
  }
}


/********************/
// CUSTOM SCROLLBAR
/*******************/
body {
  // internet explorer scrollbar
  scrollbar-base-color: $shared-gray;
  scrollbar-base-color: $shared-gray;
  scrollbar-3dlight-color: $shared-gray;
  scrollbar-highlight-color: $shared-gray;
  scrollbar-track-color: $shared-gray;
  scrollbar-arrow-color: black;
  scrollbar-shadow-color: $shared-gray;
  scrollbar-dark-shadow-color: $shared-gray;
}
@-moz-document url-prefix(http://),url-prefix(https://) {
  scrollbar,
  thumb,
  scrollbarbutton,
  thumb:hover,scrollbarbutton:hover { -moz-appearance: none !important; }

  scrollbar { background: rgb(0,255,0) !important; }

  thumb,
  scrollbarbutton { background-color: rgb(0,0,255) !important; }

  thumb:hover,
  scrollbarbutton:hover { background-color: rgb(255,0,0) !important; }

  scrollbarbutton { display: none !important; }

  scrollbar[orient="vertical"] { min-width: 10px !important; }
}

.scrollbar-container {
  position: absolute;
  top: 0; bottom: 0; left: 0; right: 0;
  margin: 10px;
  border: 2px solid $transparent-black;
  overflow: auto;
  background-color: whiteSmoke;

  .inner {
    height: 2011px;
    width: 1985px;
    padding: .5em;
    background-color: $white;
    font-family: $font-serif;
  }
}

::-webkit-scrollbar { background: transparent; width: 5px; }

::-webkit-scrollbar-thumb,
::-webkit-scrollbar-thumb:hover { background-color: $transparent-black; }

::-webkit-scrollbar-thumb { border: solid whiteSmoke 5px; }


/********************/
// CALENDAR
/*******************/
@mixin calendar-shared {
  border:solid 1px $shared-gray;
  display:flex;
  font-weight:bold;
}

.vanilla-datepicker {
  background:#272727;
  border:solid 1px $shared-gray;
  border-radius:$border-rad;
  color:#DDDDDD;
  font-size: $font-size-small;
  position: absolute;
  width:200px;

  > .title-nav {
    @include calendar-shared;
    align-items:center;
    background:#222;
    border-radius: $border-rad;
    flex-direction:row;
    justify-content:space-between;
    margin:2px;
    width:auto;
  }
  > .title-nav > .month-navigate,
  > .title-nav > .year-navigate {
    @include calendar-shared;
    align-items:center;
    border-radius: $border-rad;
    cursor:pointer;
    flex:0 15px;
    height:15px;
    justify-content:center;
    margin:1px;
    padding:2px;
    text-align: center;
  }
  > .title-nav > .month-navigate:first-child,
  > .title-nav > .year-navigate:first-child { align-self:flex-start; }
  
  > .title-nav > .month-navigate:hover,
  > .title-nav > .year-navigate:hover { border:solid 1px $shared-gray; }

  > .week-header { font-weight: bold; }

  > .week-header,
  > .week {
    display:flex;
    flex-direction:row;
    justify-content:space-between;
  }

  > .week-header > div {
    align-items:flex-start;
    display:flex;
    flex:1;
    justify-content:center;
  }

  > .week > div {
    @include calendar-shared;
    align-items:flex-end;
    cursor:pointer;
    flex:1;
    justify-content:flex-end;
    margin:1px;
    padding:2px;

    &.no-select {
      cursor:auto;
      background:$shared-gray;
      color:$shared-dark-gray;
    }
    &.selected {
      background-color:#415E82;
      font-weight:bold;
    }
    &:not(.no-select):hover { background:$shared-dark-gray; }
  }
}

/********************/
// BREAKPOINTS
/*******************/
@media screen and (max-width: 890px) {
  #ledger-input {
    width: 750px;
    > input.amount { width: 17%; }
  }
  #balance-checker { 
    width: 750px;
    .wallet { 
      padding-left: 20px; 
      padding-right: 20px; 
      .scrollme { width: 260px; }
      .credit-card p.cc-num,
      .credit-card p.cc-exp { font-size: 16px; }
    }
    .ledger {
      width: 460px;
      padding-left: 20px; 
      padding-right: 20px; 
    }
  }
}


#modal {
  position:absolute; 
  width:100%;
  height:250%;
  top:0;
  left:0;
  background:rgba(0,103,138,0.9);
  color:white;
  font-family: $font-serif;
  
  a {
    color:white;
    display:block;
    margin:auto;
    width:30px;
    height:30px;
    line-height:30px;
    text-align:center;
    text-decoration:none;
    font-size:2em;
    padding:5px;
    border:2px solid white;
    border-radius:50%;
    text-shadow: 0 0 5px #333;
    box-shadow:0 0 2px #333;
    font-family: $font-serif;
    
    &:hover {
      color:#333;
      border:2px solid #333;
    }
  }
  h1, h2 {
    text-shadow: 1px 1px 0px #000;
    font-family: $font-serif;
    text-align:center;
    margin:20px auto;
  }
  h1 {
    text-transform:uppercase;
  }
}
#modal_content {
  position:absolute;
  width:550px;
  left:50%;
  top:20%;
  margin:-130px -275px;
  font-family: $font-serif;
}

              
            
!

JS

              
                (function(window, document, $j) {
  var Budgetizer = {},
      UserInteractions = {},
  		currentDatepicker = null;

  Budgetizer.datepicker = function( query, options ) {
    if (!(this instanceof Budgetizer.datepicker)) return new Budgetizer.datepicker( query, options );

    currentDatepicker = self = this;
    self.options = extend({}, Budgetizer.datepicker.defaults, options);
    self.query = query;
    self.__init__();    
  };

  Budgetizer.datepicker.prototype = {
    constructor: Budgetizer.datepicker,

    __init__: function(){
      // Bind display on click
      document.removeEventListener('click', self.bindCalendar, false);
      document.addEventListener('click', self.bindCalendar, false);
    },

    matchesReferers: function( elm ){
      self.referers = document.querySelectorAll( self.query );
      for (var i=0; i< self.referers.length; i++) {
        if (elm === self.referers[i]) return true;
      }
      return false;
    },

    close: function(){
      delete self.current;
      delete self.target;
      if (self.picker) self.picker.remove();
    },

    show: function( target ){
      self.target = typeof target != typeof undefined ? target : self.target;
      if (target || typeof self.current == typeof undefined) {
        var current = new Date();
        if (target) self.selected = null;
        if (target && target.value) {
          var ts = Date.parse( target.value.toLowerCase() );
          current = new Date( ts );
          self.selected = {
            year: current.getFullYear(),
            month: current.getMonth(),
            day: current.getDate() 
          };
        }
        self.current = {
          year: current.getFullYear(),
          month: current.getMonth()
        };
      }
      self.cleanPicker();
      self.drawPicker();
    },

    cleanPicker: function(){
      var picker = document.querySelector('.vanilla-datepicker');
      if (picker) picker.remove();
    },

    drawPicker: function(){
      var position = {
        x:self.target.offsetLeft,
        y:self.target.offsetTop + self.target.offsetHeight
      };
      self.picker = document.createElement('div');
      self.picker.classList.add('vanilla-datepicker');
      self.picker.style.left = position.x + 'px';
      self.picker.style.top = position.y + 'px';
      self.picker.appendChild( self.drawNavigation() );
      self.picker.appendChild( self.drawWeekHeader() );
      var weeks = self.getWeeks();
      for (var i=0; i<weeks.length; i++) {
        self.picker.appendChild( weeks[i] );
      }

      self.target.parentNode.insertBefore( self.picker, self.target.nextSibling );
    },

    drawNavigation: function(){
      var nav = document.createElement('div');
      nav.classList.add('title-nav');

      if (self.options.navigateYear) {
        previousYear = document.createElement('div');
        previousYear.classList.add('year-navigate');
        previousYear.classList.add('previous');
        previousYear.innerHTML = '<<';

        nextYear = document.createElement('div');
        nextYear.classList.add('year-navigate');
        nextYear.classList.add('next');
        nextYear.innerHTML = '>>';
      }
      previousMonth = document.createElement('div');
      previousMonth.classList.add('month-navigate');
      previousMonth.classList.add('previous');
      previousMonth.innerHTML = '<';

      currentMonth = document.createTextNode( 
        self.options.months.long[self.current.month] + ' ' + self.current.year
      );

      nextMonth = document.createElement('div');
      nextMonth.classList.add('month-navigate');
      nextMonth.classList.add('next');
      nextMonth.innerHTML = '>';
      //nextMonth.addEventListener('click', self.getNextMonth, false);

      if (self.options.navigateYear) nav.appendChild( previousYear );
      nav.appendChild( previousMonth );
      nav.appendChild( currentMonth );
      nav.appendChild( nextMonth );
      if (self.options.navigateYear) nav.appendChild( nextYear );

      return nav;
    },

    getPreviousYear: function() {
      var current = new Date( self.current.year -1, self.current.month);
      self.current = {
        year: current.getFullYear(),
        month: current.getMonth()
      };
      self.show();
    },

    getNextYear: function() {
      var current = new Date( self.current.year + 1, self.current.month);
      self.current = {
        year: current.getFullYear(),
        month: current.getMonth()
      };
      self.show();
    },

    getPreviousMonth: function() {
      var current = new Date( self.current.year, self.current.month - 1);
      self.current = {
        year: current.getFullYear(),
        month: current.getMonth()
      };
      self.show();
    },

    getNextMonth: function() {
      var current = new Date( self.current.year, self.current.month + 1);
      self.current = {
        year: current.getFullYear(),
        month: current.getMonth()
      };
      self.show();
    },

    drawWeekHeader: function(){
      var weekdays =  self.options.weekdays.short.slice(self.options.firstDayOfWeek)
                      .concat(self.options.weekdays.short.slice(0, self.options.firstDayOfWeek)),
          weekHeader = document.createElement('div');

      weekHeader.classList.add('week-header');
      for (var i=0; i<7; i++) {
        var dayOfWeek = document.createElement('div');
        dayOfWeek.innerHTML = weekdays[i];
        weekHeader.appendChild( dayOfWeek );
      }
      return weekHeader;
    },

    getWeeks: function(){
      var i;
      // Get week days according to options
      var weekdays =  self.options.weekdays.short.slice(self.options.firstDayOfWeek)
                      .concat(self.options.weekdays.short.slice(0, self.options.firstDayOfWeek)),
          // Get first day of month and update acconding to options
          firstOfMonth = new Date(self.current.year, self.current.month, 1).getDay(),
          daysInPreviousMonth = new Date(self.current.year, self.current.month, 0).getDate(),
          daysInMonth = new Date(self.current.year, self.current.month+1, 0).getDate(),
          days=[], weeks=[], day;

      firstOfMonth = firstOfMonth < self.options.firstDayOfWeek ? 7+(firstOfMonth - self.options.firstDayOfWeek ) : firstOfMonth - self.options.firstDayOfWeek;

      // Define last days of previous month if current month does not start on `firstOfMonth`
      for (i=firstOfMonth-1; i>=0; i--) {
        day = document.createElement('div');
        day.classList.add( 'no-select' );
        day.innerHTML = daysInPreviousMonth - i;
        days.push( day );
      }
      // Define days in current month
      for (i=0; i<daysInMonth; i++) {
        if (i && (firstOfMonth+i)%7 === 0) {
          weeks.push( self.addWeek( days ) );
          days = [];
        }
        day = document.createElement('div');
        day.classList.add('day');
        if (self.selected && self.selected.year == self.current.year && self.selected.month == self.current.month && self.selected.day == i+1) {
          day.classList.add('selected');
        }
        day.innerHTML = i+1;
        days.push( day );
      }
      // Define days of next month if last week is not full
      if (days.length) {
        var len = days.length;
        for (i=0; i<7-len; i++) {
          day = document.createElement('div');
          day.classList.add( 'no-select' );
          day.innerHTML = i+1;
          days.push( day );
        }
        weeks.push( self.addWeek( days ) );
      }
      return weeks;
    },

    addWeek: function( days ) {
      var week = document.createElement('div');
      week.classList.add('week');
      for (var i=0; i<days.length; i++) {
        week.appendChild( days[i] );
      }
      return week;
    },

    setDate: function( day ) {
      var dayOfWeek = new Date(self.current.year, self.current.month, day).getDay(),
          date = self.options.outputFormat
                .replace('%a', self.options.weekdays.short[dayOfWeek] )
                .replace('%A', self.options.weekdays.long[dayOfWeek] )
                .replace('%d', ('0' + day).slice(-2) )
                .replace('%e', day )
                .replace('%b', self.options.months.short[self.current.month] )
                .replace('%B', self.options.months.long[self.current.month] )
                .replace('%m', ('0' + (self.current.month+1)).slice(-2) )
                .replace('%w', dayOfWeek )
                .replace('%Y', self.current.year );
      
      self.target.value = date;
    },

    bindCalendar: function(event) {
      var target = event.target;
      if (target.className == 'month-navigate next') {
        self.getNextMonth();
      } else if (target.className == 'month-navigate previous') {
        self.getPreviousMonth();
      } else if (target.className == 'year-navigate next') {
        self.getNextYear();
      } else if (target.className == 'year-navigate previous') {
        self.getPreviousYear();
      } else if (target.className == 'day') {
        self.setDate( target.innerHTML );
        self.close();
      } else {
        while (target && !self.matchesReferers( target ) && target.className != 'vanilla-datepicker') {
          target = target.parentNode;
        }
        if (target && self.matchesReferers( target )) self.show(target);
        if (!target) self.close();
      }
    }
  };

  Budgetizer.datepicker.defaults = {
    firstDayOfWeek: 0,
    months: {
      short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
      long: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
    },
    navigateYear: true,
    outputFormat:'%Y-%m-%d',
    weekdays: {
      short: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
      long: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
    }
  };

  // utils
  var camelCase = function( string ){
    return  string.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
  };

  var extend = function(out) {
    out = out || {};
    for (var i = 1; i < arguments.length; i++) {
      if (!arguments[i]) continue;

      for (var key in arguments[i]) {
        if (arguments[i].hasOwnProperty(key)) out[key] = arguments[i][key];
      }
    }

    return out;
  };

  var is = function( el, query ) {
    return (el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector).call(el, query);
  };

  /**
   *
   * All methods relative to ledger UI section
   *
  */
  Budgetizer.Ledger = {
    /**
     * Total of all transcations in ledger
    **/
    ledgerTotal: function() {
      var txt, 
          total=0.00,
          ledgeHead = $j(".ledger h2 > span");

      $j(".ledger .transactions .amount").each(function () {
        txt = parseFloat( $j(this).text().replace(/[$a-zA-Z]/g,'') );
        if ( $j(this).closest("tr").hasClass("deduction") ) txt = -Math.abs(txt);
        total+=txt;
      });
      
      (total < 0) ? ledgeHead.removeClass().addClass('negative-amt') : ledgeHead.removeClass();
      total = total.toString().split(".");
      if (total.length === 1) total.push("00"); 
      
      ledgeHead.html( "<span>$"+total[0]+".<sup>"+total[1].substr(0,2)+"</sup></span>" );
    },
    /**
     * Add a new transaction to ledger
    **/
    addTransaction: function () {
      $j("#ledger-add-button").click(function () {
        var amt = $j("#ledger-input .amount").val().split("."),
            co = $j("#ledger-input .company").val(),
            inv = $j("#ledger-input .invoice").val(),
            date;
        
        if (amt.length === 1) amt.push("00");
        
        $j("#balance-checker .transactions tbody").append("<tr class=\""+$j("#ledger-input .act-type").val().toLowerCase()+"\"><td class=\"icon\"><div></div></td><td class=\"name\"><p class=\"bill\">"+co+"</p><p></p><p class=\"invoice-date\">"+inv+"  - "+Budgetizer.UI.dateFormatter()+"</p></td><td class=\"amount\">$"+amt[0]+".<sup>"+amt[1]+"</sup><span class=\"remove-data\">Remove</span></td></tr>");
        $j("#ledger-input input").val("");
        
        Budgetizer.localData.check();
        Budgetizer.Ledger.ledgerTotal();
      });
    }
  },
  /**
   *
   * All methods relative to credit card UI section
   *
  */
  Budgetizer.CCTools = {
    /**
     * Activate dropdown form for credit card
     **/
    ccForm: function () {
      $j("#add-credit-card").click(function () {
        ( $j(this).hasClass("enabled") ) ? $j(this).removeClass("enabled") : $j(this).addClass("enabled");
        ( $j("#balance-checker .scrollme").hasClass("enabled") ) ? $j("#balance-checker .scrollme").removeClass("enabled") : $j("#balance-checker .scrollme").addClass("enabled");
        ( $j("#add-cc-form").hasClass("hidden") ) ? $j("#add-cc-form").removeClass("hidden") : $j("#add-cc-form").addClass("hidden");
      });
    },
    /**
     * Add a new credit card
    **/
    addCard: function () {
      $j("#cc-add-button").click(function () {
        var cleanDate = $j("#add-cc-form .cc-exp-month").val(),
            ccClass;
        cleanDate+= "/"+$j("#add-cc-form .cc-exp-year").val();
        
        if ( $j("#cc-type").hasClass("visa") ) {
          ccClass = "visa";
        } else if ( $j("#cc-type").hasClass("mc") ) {
          ccClass = "mc";
        } else if ( $j("#cc-type").hasClass("discover") ) {
          ccClass = "discover";
        } else if ( $j("#cc-type").hasClass("amex") ) {
          ccClass = "amex";
        }
          
        $j(".wallet .scrollme").append("<div class=\"credit-card\"><div id=\"cc-card-logo\" class=\""+ccClass+"\"></div><p class=\"cc-num\"><sub>**** **** ****</sub>"+$j("#cc-number-input").val().substr(14)+"</p><p class=\"cc-exp\">Valid Thru: "+cleanDate+"</p><span class=\"remove-data\">Remove</span></div>");
        
        // Clear all values
        $j('#cc-number-input').val('');
        $j(".wallet .cc-exp-month").val("01");
        $j(".wallet .cc-exp-year").val("17");
        $j("#add-cc-form").addClass("hidden");
        $j("#balance-checker .scrollme").removeClass("enabled");
        $j("#cc-type").removeClass().addClass("nothing");
        
        Budgetizer.localData.check();
      });
    },
    /**
     * Card type evaluator
    **/
    getCardType: function (number) {
      var re = new RegExp("^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)");
      
      // visa
      if (number.match(/^4/) !== null) {
        $j("#cc-type").removeClass().addClass("visa");
      }
      // Mastercard
      else if (number.match(/^5[1-5]/) !== null) {
        $j("#cc-type").removeClass().addClass("mc");
      }
      // Discover
      else if (number.match(re) !== null) {
        $j("#cc-type").removeClass().addClass("discover");
      }
      // Visa Electron
      else if (number.match(re) !== null) {
        re = new RegExp("^(4026|417500|4508|4844|491(3|7))");
        $j("#cc-type").removeClass().addClass("visa");
      }
      // Amex
      else if (number.match(/^(34|37)/) !== null) {
        $j("#cc-type").removeClass().addClass("amex");
      }
      // Card does not match criteria
      else if (number.length > 4) { 
        $j("#cc-type").removeClass().addClass("nothing"); 
      }
    },
    /**
     * Card type input observer
    **/
    ccObserver: function () {
      $j("#cc-number-input").on("keyup", function() {  
        Budgetizer.CCTools.getCardType( $j(this).val() );
        $j(this).val( Budgetizer.UI.ccFormatter( $j(this).val() ) );
      });
    }
  },
  /**
   *
   * All methods relative to general UI
   *
  */
  Budgetizer.UI = {
    /**
     * Remove data methods for their respective sections
    **/
    remove: function () {
      $j(document).on("click", ".transactions .remove-data", function () {  
        $j(this).closest("tr").remove(); 
        Budgetizer.Ledger.ledgerTotal();
        Budgetizer.localData.check(); 
      });
      $j(document).on("click", ".wallet .remove-data", function () {  
        $j(this).closest(".credit-card").remove(); 
        Budgetizer.Ledger.ledgerTotal();
        Budgetizer.localData.check(); 
      });
    },
    /**
     * Format the date for the ledger section
    **/
    dateFormatter: function () {
      var dates = $j("#ledger-input .datepicker").val().split("-"),
          month = {
            "01" :"January", "02" :"February",
            "03" :"March", "04" :"April",
            "05" :"May", "06" :"June",
            "07" :"July", "08" :"August",
            "09" :"September", "10" :"October",
            "11" :"November", "12" :"December"
          };
      return dates[2]+" "+month[dates[1]]+", "+dates[0];
    },
    /**
     * Format the credit card number upon input
    **/
    ccFormatter: function (value) {
      var v = value.replace(/\s+/g, '').replace(/[^0-9]/gi, ''),
          matches = v.match(/\d{4,16}/g),
          match = matches && matches[0] || '',
          parts = [];
      
      for (i=0, len=match.length; i<len; i+=4) {
        parts.push(match.substring(i, i+4));
      }
      return (parts.length) ? parts.join(' ') : value;
    }
  };

  Budgetizer.localData = { 
    check: function () {
      localStorage.clear();
      localStorage.setItem('BudgetizerCards', $j("#balance-checker .wallet .scrollme").html() );
      localStorage.setItem('BudgetizerTransactions', $j("#balance-checker .ledger .scrollme").html() );
    },
    /**
     * Local Storage On Load Method
    **/
    onLoad: function () {
      if(localStorage && localStorage.getItem('BudgetizerCards')){
        $j("#balance-checker .wallet .scrollme").html(
          localStorage.getItem('BudgetizerCards')
        );
      }
      if(localStorage && localStorage.getItem('BudgetizerTransactions')){
        $j("#balance-checker .ledger .scrollme").html(
          localStorage.getItem('BudgetizerTransactions')
        );
      }
    }
  }
  
  
  /**
   * USER INTERACTIONS AND BEHAVIORS
  **/
  UserInteractions.init = function() {
    $('div#modal').on('click','a',function(event){
      event.preventDefault();
      $('div#modal').fadeOut('slow');
      $('h1,h2,p').removeClass('blured_text');  
    });
  }
  
  /**
   * LOAD ALL OBSERVERS AND METHODS NEEDED
  **/
  jQuery(document).ready(function () {
    Budgetizer.localData.onLoad();
    Budgetizer.datepicker( '.datepicker', { firstDayOfWeek: 1 } );
    Budgetizer.Ledger.ledgerTotal();
    Budgetizer.Ledger.addTransaction();
    Budgetizer.CCTools.ccForm();
    Budgetizer.CCTools.addCard();
    Budgetizer.CCTools.ccObserver();
    Budgetizer.UI.remove();
    
    UserInteractions.init();
  });
}) (window, document, jQuery);

              
            
!
999px

Console