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

              
                <header>
  <h1>Resume Version Converter</h1>
</header>
<main>
  <form>
    <label>Enter Resume Version ID:&nbsp;
      <input type="text" class="verid" maxlength="5" minlength="5" autofocus value="cezzu">
    </label>
    <button type="button" class="verbutt">Convert</button>
  </form>
  <div class="error-msg"></div>
  <div class="success-msg"></div>

  <p>Given a resume version in the form [cezzz] where:</p>
  <ul>
    <li><b>ce</b> = 2-digit year <small>(a=0, b=1, c=2, ..., j=9; <mark>ce = 24</mark>)</small></li>
    <li>
      <b>zzz</b> = <i>reversed</i> incremental counter<br>
      Conversion algorithm: where <b>z = 26</b>, <b>y = 25</b>, ...
      <ul>
        <li>Array Index: [26 - z, 26 - z, 26 - z] = [000] == index 0 in the <code>resDates</code> array</li>
        <li>Array Index: [26 - z, 26 - z, 26 - y] = [001] == index 1 in the <code>resDates</code> array</li>
        </ul>
      Resume version # 'zzz' (000) is the first resume version (index 0) for each year:<br>
      Example 1: '<b>cd</b>' + (26 - <b>z</b>) = 0, (26 - <b>z</b>) = 0, (26 - <b>z</b>) = 0 == <b>2023 - 000</b><br>
      Example 2: '<b>cd</b>' + (26 - <b>z</b>) = 0, (26 - <b>z</b>) = 0, (26 - <b>y</b>) = 1 == <b>2023 - 001</b><br>
      Example 3: '<b>ce</b>' + (26 - <b>z</b>) = 0, (26 - <b>z</b>) = 0, (26 - <b>z</b>) = 0 == <b>2024 - 000</b><br>
    </li>
  </ul>
</main>
<footer class="center">
<pre><code>2-Digit [Years] // E.g. ce = 24

  // Where: a=0, b=1, c=2, d=3, e=4, f=5, g=6, h=7, i=8, j=9

  // '19 - bj  // '20 - ca  // '21 - cb  // '22 - cc
  // '23 - cd  // '24 - ce  // '25 - cf  // '26 - cg
  // '27 - ch  // '28 - ci  // '29 - cj  // '30 - ck
</code></pre>
</footer>
              
            
!

CSS

              
                html, 
body { 
  height: 98%; 
}
body {
  font-family: arial, verdana, helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  margin: 0;
  padding: 0.5rem 1rem;
  position: relative;
  width: 94%;
}
h1 { 
  color: green;
}
p {
  border-top: 1px solid green;
  padding-top: 1rem;
}
pre {
  border-top: 1px solid green;
  font-size: 0.8em;
  margin: 0;
  padding: 0.5rem;
}
.error-msg,
.success-msg {
  margin-left: 1rem;
}
.error-msg,
.success-msg,
footer {
  margin-top: 1rem;
}
footer {
/*   position: fixed; */
    bottom: 0;
    right: 0;
}
  footer.center {
    left: 0;
  }
.success-msg {
  color: blue;
  font-weight: bold;
}

              
            
!

JS

              
                console.clear();

// The first two characters represent a 2-digit year.

// The last three characters, as denoted on the display screen,
   //   represent a reversed incremental counter
   //   where `z` becomes 0 and `a` become 26.
   // As the 3rd character counts up from `z` to `a`,
   //   when it rolls over from `a` back to `z` (i.e. on the 27th version),
   //   the 2nd character increases from `z` (0) to `y` (1),
   //   and the 3rd character begins its ascent again back at `z`.

const verElem = document.querySelector('.verid'),
      verButt = document.querySelector('.verbutt'),
      errorElem = document.querySelector('.error-msg'),
      successElem = document.querySelector('.success-msg'),
      // baseCnt: A-Z alphabet has a base of 26.
      baseCnt = 26,
      // These dates can be externally referenced via JSON or DB.
      resDates = {
        '2019': ['10-18', '10-19'], // bj
        '2020': ['01-09'], // ca
        '2021': ['04-20', '08-02', '08-09', '08-18', '08-26', '09-13', '10-15'], // cb
        '2023': ['06-07', '10-23', '11-27'], // cd
        '2024': ['01-02', '02-03', '03-10', '05-08', '06-10', '07-01'], // ce
      };
      // Just add to the array when you've updated your resume with the next (latest) verion.
      // The last index should align with the `zzz; zzy; zzx` counter.
      //   cbzzz = '2021': ['04-20'],
      //   cbzzt = '2021': ['10-15'],
      //   cdzzz = '2023': ['06-07'],

let verVal = '';

// verElem.addEventListener('blur', e => {
verButt.addEventListener('click', e => {
  e.preventDefault(); // Shouldn't need, but...
  errorElem.innerText = '';
  successElem.innerText = '';

  // verVal = e.target.value.toLowerCase();
  verVal = verElem.value.toLowerCase();

  if (/[a-z]{5}/.test(verVal)) {
    errorElem.innerText = 'Working with: ' + verVal;
    unMixIt(verVal);
  } else {
    errorElem.innerText = 'D\'oh! Entries should only contain 5 characters such that: [a-z]{5}';
  }
});

function unMixIt(oldVal) {
  let charArr = oldVal.split(''),
      char1L = charArr[0].charCodeAt() - 97 + 1,
      char2L = charArr[1].charCodeAt() - 97 + 1,
      char3L = baseCnt - (charArr[2].charCodeAt() - 97 + 1),
      char4L = baseCnt - (charArr[3].charCodeAt() - 97 + 1),
      char5L = baseCnt - (charArr[4].charCodeAt() - 97 + 1),
      char1Lt = char1L.toString(),
      char2Lt = char2L.toString(),
      char3Lt = char3L.toString(),
      char4Lt = char4L.toString(),
      char5Lt = char5L.toString();

  let charYear = '20' + (char1L - 1).toString() + (char2L - 1).toString();
  
  successElem.innerText = 'Resume Version: ' + runDates(charYear, char3L, char4L, char5L);
}

function runDates(col0, col1, col2, col3) {
  const charIdx =((col1*baseCnt*baseCnt)+(col2*baseCnt)+col3); 
  // I believe there is a math term for this, and I'm certain I had an exam on it recently.

  if (resDates[col0][charIdx]) {
    return col0 + '-' + resDates[col0][charIdx];
  } else {
    return 'That resume version was not found.';
  }
}

document.addEventListener('DOMContentLoaded', function() {
  setTimeout(() => {
    // const dispWin = document.querySelector('#result_div');
    const dispWin = document.querySelector('body');
    if (dispWin.offsetHeight < 425) {
      document.querySelector('footer').classList.remove('center') ;
    }
  }, 500);
}, false);

// console.log('Go!!!!'); // To trigger a forced repaint, make a change!

              
            
!
999px

Console