css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

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.

            
              <div class="panel">

  <div style="display:flex;align-items:center;justify-content:space-around">
    <div class="title">
      Tryptamine redosing calculator
    </div>
    <div class="units-switch">
      <div id="lyserg" class="units-btn active"> LSD </div>
      <div id="mushy" class="units-btn"> Mushrooms </div>
      <div class="sub-text"> (including analogs) </div>
    </div>
  </div>
  <br>

  <div class="calculator">
    <form name="dosage_form" id="dosage_form" oninput="calculate()">
      Last dose :
      <input id="dose" type="number" min="0" step="5" name="dose"> <span class="units">μg</span>
      <br><br>
      Days since consumption:
      <input id="days" type="number" min="1" max="14" value="1" name="days">
    </form>

    <div class="result">
      You will need a dose of
      <div id="value"> <output id="result"></output> <span class="units">μg</span> </div>
      to feel the same effects as your last dose.
    </div>
  </div>

  <br>

  <div class="notes">
    Please note that this calculator only works for tryptamines like LSD and Magic Mushrooms, do not use this calculator for a chemcial that isn't a tryptamine. 
    <br> As all bodies and brains are different, results may vary.
    <br> For the best experience, let 2 weeks pass between each trip, tolerance should be back to normal after 14 days.
    <br><br> Happy tripping ! &#x2764;
  </div>
</div>

<div class="footer">
  Made thanks to: &nbsp
  <a href="https://psychedeliccalc.herokuapp.com" target="_blank"> awesome javascript </a>&nbsp | &nbsp
  <a href="https://www.reddit.com/r/LSD/comments/3w9ms0/psychedelic_tolerance_calculator_and_formula/" target="_blank"> amazing idea </a>&nbsp | &nbsp
  <a href="http://alexgrey.com/" target="_blank"> wonderful artwork ("Net of beings" by Alex Grey) </a>
</div>
            
          
!
            
              html, body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-image: url(http://theghostdiaries.com/wp-content/uploads/2014/10/Net-of-Being-2012-web-rez.jpg);
  background-position: center;
}

.panel {
  position: relative;
  background: #f3f3f3;
  border-radius: 2px;
  box-shadow: 0 1px 3px 1px rgba(0,0,0,0.5);

  padding: 30px;
  max-width: 601px;
  
  text-align: center;
  color: #222;
  line-height: 1.4;
  font-size: 15px;
}

.title {
  font-weight: bold;
  font-size: 26px;
  width: 70%;
}

.calculator {
  display: flex;
  justify-content: space-between;
  width: 100%;
  height: 80px;
  margin-bottom: 20px;
}

.result {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background-color: #fbfbfb;
  padding: 10px;
  border: 1px solid #a4a4a4;
  height: 100%;
}

#value {
  font-size: 18px;
  font-weight: bold;
}


input {
  outline: none !important;
  border: 1px solid #70c2bf;
  border-radius: 1px;
  width: 60px;
  text-align: center;
  transition: 0.3s;
}
input:focus,
input:hover {
  border-radius: 5px;
}

form {
  text-align: left;
  background-color: #fbfbfb;
  padding: 10px;
  border: 1px solid #a4a4a4;
  height: 100%;
}

.notes {
  position: relative;
  text-align: left;
  line-height: 1.8;
  font-size: 14px;
  background-color: #eee;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #999;
  box-shadow: inset 0 0 3px 1px rgba(0,0,0,0.2);
}

.footer {
  box-sizing: border-box;
  display: flex;
  justify-content: flex-end;
  position: fixed;
  width: 100%;
  bottom: 0;
  left: 0;
  background-color: rgba(0,0,0,0.7);
  color: #eee;
  padding: 10px;
  font-size: 14px;
}

a,
a:visited {
  color: #70c2bf;
}

.units-switch {
  position: relative;
  width: 30%;
  align-self: flex-end;
  padding: 0;
  margin: 0;
  font-size: 0;
}

.units-btn {
  margin: 0;
  display: inline-block;
  position: relative;
  border: none;
  background: #e1e1e1;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  border: 1px solid #a4a4a4;
}
.units-btn.active {
  border: 1px solid #70c2bf;
  background-color: #c5e6e5;
  box-shadow: inset 0 0 5px rgba(0,0,0,0.9);
}

.units-btn:nth-child(1) {
  border-top-left-radius: 18px;
  border-bottom-left-radius: 18px;
  box-shadow: inset 1px 1px 2px rgba(255,255,255, 1);
}
.units-btn:nth-child(1).active {
  border-right: 1px solid #a4a4a4;
  box-shadow: inset 0 0 3px rgba(0,0,0,0.2);
}

.units-btn:nth-child(2) {
  border-top-right-radius: 18px;
  border-bottom-right-radius: 18px;
  border-left: none;
  box-shadow: inset -1px 1px 2px rgba(255,255,255, 1);
}

.units-btn:nth-child(2).active {
  box-shadow: inset 0 0 3px rgba(0,0,0,0.2);
}

.sub-text {
  font-size: 11px;
  position: absolute;
  left: 50%;
  margin-top: 2px;
  transform: translate(-50%,0%);
  width: 100%;
  color: rgba(0,0,0,0.75);
}

@media screen and (max-width: 800px) {
  .panel {
    height: auto;
    width:100%;
    box-sizing: border-box;
    border-radius: 1px;
    max-width: none;
  }
  .calculator {
    height: 30%;
    flex-direction: column;
    margin-bottom: 0px;
  }
  form {
    border-bottom: none;
  }
  .footer {
    position: relative;
    background-color: #222;
    height: 60px;
    font-size: 12px;
  }
  html, body {
    height: auto;
  }
}
            
          
!
            
              $(document).ready(function() {
  $(".units-btn").on("click", function() {
    $(this).parent().find(".active").toggleClass("active");
    $(this).toggleClass("active");

    if ($("#lyserg").hasClass("active")) {
      $(".units").text("μg");
      $("#dose").attr("step", "5");
    } else if ($("#mushy").hasClass("active")) {
      $(".units").text("g");
      $("#dose").attr("step", "1");
    }

  });

});

// JS BELOW ENTIERLY TAKEN FROM https://psychedeliccalc.herokuapp.com

function calculate() {
  var x = document.getElementById("dose").value;
  var n = document.getElementById("days").value;

  var estimatedDosage = (x / 100) * 280.059565 * (Math.pow(n, -0.412565956));
  // the ternary is because this equation will potentially return a value lower than the last value if the days since is long enough.
  var newAmount = ((estimatedDosage < x) ? x : estimatedDosage);
  document.getElementById("result").value = Math.round(newAmount * 10) / 10; //added rounding
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console