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 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

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

              
                <section id="locationMarkdown">
  <h1>e.g. Room Title Here</h1>
  <p>Description here, etc.</p>
</section>
<section id="alerts">
</section>
<section id="actions">
  Action Buttons Will Go Here
</section>
<section class="inventory">
  <h3>Inventory:</h3>
  <div id="inventory">
    You don't have anything yet...
  </div>
</section>
              
            
!

CSS

              
                .hidden {
  display: none;
}

#alerts {
  color: red;
}

@media print{*,:after,:before{background:0 0!important;color:#000!important;box-shadow:none!important;text-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="#"]:after,a[href^="javascript:"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}}@media screen and (min-width:32rem) and (max-width:48rem){html{font-size:15px}}@media screen and (min-width:48rem){html{font-size:16px}}body{line-height:1.85}.splendor-p,p{font-size:1rem;margin-bottom:1.3rem}.splendor-h1,.splendor-h2,.splendor-h3,.splendor-h4,h1,h2,h3,h4{margin:1.414rem 0 .5rem;font-weight:inherit;line-height:1.42}.splendor-h1,h1{margin-top:0;font-size:3.998rem}.splendor-h2,h2{font-size:2.827rem}.splendor-h3,h3{font-size:1.999rem}.splendor-h4,h4{font-size:1.414rem}.splendor-h5,h5{font-size:1.121rem}.splendor-h6,h6{font-size:.88rem}.splendor-small,small{font-size:.707em}canvas,iframe,img,select,svg,textarea,video{max-width:100%}@import url(http://fonts.googleapis.com/css?family=Merriweather:300italic,300);html{font-size:18px;max-width:100%}body{color:#444;font-family:Merriweather,Georgia,serif;margin:0;max-width:100%}:not(div):not(img):not(body):not(html):not(li):not(blockquote):not(p),p{margin:1rem auto;max-width:36rem;padding:.25rem}div,div img{width:100%}blockquote p{font-size:1.5rem;font-style:italic;margin:1rem auto;max-width:48rem}li{margin-left:2rem}h1{padding:4rem 0!important}p{color:#555;height:auto;line-height:1.45}code,pre{font-family:Menlo,Monaco,"Courier New",monospace}pre{background-color:#fafafa;font-size:.8rem;overflow-x:scroll;padding:1.125em}a,a:visited{color:#3498db}a:active,a:focus,a:hover{color:#2980b9}
              
            
!

JS

              
                let inventory = [];

let youWin = function(){
  $("#alerts").html(`You win congrats! <button id="replay">Replay?</button>`);
  $("#replay").on("click", function(){
    inventory = [];
    loadLocation("startLocation");
  });
}

let addToInventory = function(anItem){
  $("#alerts").html(`You got ${anItem}`);
  inventory.push(anItem);
  $("#inventory").html("");
  let i = 0;
  for (i = 0; i < inventory.length; i++){
    $("#inventory").append(`<div class="inventoryItem">${inventory[i]}</div>`);
  }
}

let isInInventory = function(anItem){
  return inventory.indexOf(anItem) > -1;
}

let displayMarkdown = function(locationMarkdown){
  $("#alerts").html("");
  showdown.setFlavor('github');
  var converter = new showdown.Converter();
  $("#locationMarkdown").html(converter.makeHtml(locationMarkdown));
};

let showButtons = function(buttonArray){
  $(".action").off("click");
  $("#actions").html("");
  let i = 0;
  for (i = 0; i < buttonArray.length; i++){
    let nextButton = buttonArray[i];
    $("#actions").append(
`
<button 
  class="action" 
  data-next-location="${nextButton.takesYouToLocation}"
>
  ${nextButton.buttonText}
</button>
`);
  }
  $(".action").on("click", function(clickEvent){
    let buttonYouClicked = clickEvent.currentTarget;
    let nextLocation = $(buttonYouClicked).attr("data-next-location");
    loadLocation(nextLocation);
  });
}


let loadLocation = function(locationName){
  switch (locationName){
    //COPY FROM HERE the start location code begins here
    case "startLocation"://change this to the "id" of your location
      displayMarkdown(
`
### University Admissions

You have arrived at the hallowed halls.

![filler image](http://abha.com/images/made/images/remote/http_abhacom.nextmp.net/images/uploads/portfolio/p-academic-higher-education/ud-memorial-hall/proj_ud-memorial-hall02_766_513.jpg)

Because you were part of the Summer of Cyber you know just what to do...

`
      );
      showButtons(
        [
          {buttonText:"Click here to major in ECE", 
           takesYouToLocation:"evansHall"},
          {buttonText:"Click here to major in CISC", 
           takesYouToLocation:"smithHall"}, 
        ]
      );
      break;
      //and it ends here END COPY HERE (paste just below)
    //the evans Hall code begins here
    case "evansHall":
      displayMarkdown(
`
### Evans Hall

This is where the action is.  Pizza and CTF hackers going nuts.

![iSuites](https://www.udel.edu/content/dam/udelImages/udaily/2019/April/50-ka-6-people-pizza-slice-novocin-ethical-hacking-032219-50-800x533.jpg)

You're hungry, have some pizza.

`
      );
      addToInventory("A Slice Of Pizza");
      showButtons(
        [
          {buttonText:"Click here to learn Cyber", 
           takesYouToLocation:"cyberScholars"
          }
        ]
      );
      break;
    //and it ends here
    //the smith Hall code begins here
    case "smithHall":
      displayMarkdown(
`
### Smith Hall

This is also where some action is.  The SPARC lab is pretty lit.

![SPARC](https://www.udel.edu/content/dam/udelImages/udaily/2016/november/galleries/cyberisuite/Novocin_Cyber_Security_Club-111816-65.jpg)

`
      );
      showButtons([]);
      youWin();
      break;
      //and it ends here   
    //the cyber Scholars code begins here
    case "cyberScholars":
      displayMarkdown(
`
### You Join Cyber Scholars

You learn how to build a whole new world.

![Cyberscholars](http://udel.vip/images/cyber.png)

`
      );
      youWin();   
      showButtons([]);
      break;
      //and it ends here       
  }
}

loadLocation("startLocation");
              
            
!
999px

Console