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.

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 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 class="container">
<h1>CLICKERMANIA</h1>
  <h3>By h2o55yt</h3>
    <button id="click" type="button" class="btn btn-primary btn-lg btn-block">CLICK TO GENERATE CLICKS</button>
    <hr>
    <p>
    Clicks: <span id="total_clicks">0</span><br />
    Clicks per <small id="time_period">1.00</small> second: <span id="clicks_per_second">0</span>
    </p>
    <h3>SHOP</h3>
  <p>Buy cool upgrades in the shop!</p>
    <table class="table">
        <tr>
          <td>Basic Autoclicker<br>Gives +1 click per second!</td> 
          <p></p>
          <td><span id="autoclicker_level">lvl 0</span></td>
          <td><button id="buy_click" type="button" class="btn btn-success">Buy for 1</button></td>
        </tr>
        <tr>
          <td>Speed Upgrade<br>Get clicks %10 faster!</td>
          <td><span id="speed_level">lvl 0</span></td>
          <td><button id="upgrade_speed" type="button" class="btn btn-success">Buy for 100</button></td>
        </tr>
        <tr>
          <td>??UNKNOWN??<br>Does something...</td>
          <td></td>
          <td><button id="increase_clicks" type="button" class="btn btn-success">Buy for  ??unknown?? </button></td>
        </tr>
    </table>
</div>

<body style="background-color:PINK;">
  <P>VERSION: BETA 1.51.0.3                   |  Under Development</p>



</body>

              
            
!

CSS

              
                body  {
    color: black
    ;
    font-family: verdana;
    font-size: 100%;
}

.container {
  padding:5px 30px 30px 30px;
  margin:30px;
  border:solid white 1px;
  border-radius:5px;
  /*background-color:#e6e6e6;*/
  text-align:center;
}

.btn-success, .btn-danger {
  width:200px;
}

p  {
    color: black
    ;
    font-family: verdana;
    font-size: 160%;
}
              
            
!

JS

              
                //variables
var clicks = 0; //increment this by one every click
var auto_clicks = 0; //automatically click once per second
var cost = 1; //the cost of this should increase exponentially
var upgrade_speed = 0; //the level of the speed up upgrade
var click_rate = 1000; //ms between each autoclick
var interval_auto; //storing our interval here so we can update it
var click_increment = 1; //how many clicks per click
//functions

function update_total_clicks() {
  //updates the number of clicks
  var e = document.getElementById("total_clicks");
  e.innerHTML = clicks;
}

function buy_something(c, button) {
  if (clicks < c) {
    button.className = "btn btn-danger";
    setTimeout(function() {
      var e = document.getElementsByClassName("btn-danger")[0];
      e.className = "btn btn-success";
    }, 1000);
    return false;
  }
  clicks -= c;
  return true;
}

function update_workers() {
  var e2 = document.getElementById("time_period");
  e2.innerHTML = parseFloat(click_rate / 1000.0).toFixed(2);
  clearInterval(interval_auto);
  interval_auto = setInterval(function() {
    clicks += auto_clicks;
    update_total_clicks();
  }, click_rate);
}
//click events
document.getElementById("click").onclick = function() {
  clicks = parseFloat(clicks) + parseFloat(click_increment);
  update_total_clicks(); //updates the text
};
document.getElementById("buy_click").onclick = function() {
  if (!buy_something(cost, this)) return;
  auto_clicks++;
  cost = Math.pow(2, auto_clicks); //new cost
  update_total_clicks();
  var e = document.getElementById("clicks_per_second");
  e.innerHTML = auto_clicks;
  var e2 = document.getElementById("buy_click");
  e2.innerHTML = "Buy for " + cost;
  var e2 = document.getElementById("autoclicker_level");
  e2.innerHTML = "lvl  " + auto_clicks;
};
document.getElementById("upgrade_speed").onclick = function() {
  var upgrade_cost = Math.pow(3, upgrade_speed) * 100;
  if (!buy_something(upgrade_cost, this)) return;
  upgrade_speed++;
  click_rate = click_rate * 0.9;
  update_workers();
  var e2 = document.getElementById("upgrade_speed");
  e2.innerHTML = "Buy for " + Math.pow(3, upgrade_speed) * 100;
  var e2 = document.getElementById("speed_level");
  e2.innerHTML = "lvl  " + upgrade_speed;
};

//Increase Click Increment
document.getElementById("increase_clicks").onclick = function() {
  var upgrade_cost = Math.pow(3, click_increment) * 1;
  if (!buy_something(upgrade_cost, this)) return;
  click_increment++;
  update_workers();
  var e2 = document.getElementById("click_increment");
  e2.innerHTML = "Buy for " + Math.pow(3, click_increment) * 100;
};

//Start Autoclickers
update_workers();

function set_cookie(cookie_name, value) {
  expiry = new Date();
  expiry.setTime(new Date().getTime() + 10 * 60 * 1000);
  var c_value =
    escape(btoa(JSON.stringify(value))) + "; expires=" + expiry.toUTCString();
  document.cookie = cookie_name + "=" + c_value;
}

function get_cookie(cookie_name) {
  var c_value = document.cookie;
  var c_start = c_value.indexOf(" " + cookie_name + "=");
  if (c_start == -1) {
    c_start = c_value.indexOf(cookie_name + "=");
  }
  if (c_start == -1) return false;
  c_start = c_value.indexOf("=", c_start) + 1;
  var c_end = c_value.indexOf(";", c_start);
  if (c_end == -1) {
    c_end = c_value.length;
  }
  c_value = atob(unescape(c_value.substring(c_start, c_end)));
  return JSON.parse(c_value);
}

              
            
!
999px

Console