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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>CSUN PLACE GUESSER</title>
    <link rel="stylesheet" href="style.css">
  </head>
  <body>

    <header>
      <h1>CSUN PLACE GUESSER</h1>
    </header>

<div id="container">
    <div id="instructions">
      <p>MAP Quiz. Please double click on the map, the location of: </p>
    </div>
    <div id="map"></div>
</div>


    <footer>Copyright 2020.</footer>
    <script src="Project11.js"></script>
    <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCvdVqAClhO9We98mxXCCu1v_y24kdvbM8&callback=initMap"
    async defer></script>
  </body>
</html>

              
            
!

CSS

              
                
* {
    box-sizing: border-box;
  }

  body {
    font-family: helvetica, arial, sans-serif;
    margin: 25px;
  }

  main {
    display:block;
    height:175px;
  }

  header {
    border-bottom: 1px solid black;
  }

  h1 {
    font-weight: bold;
    color: #000;
  }

  .bold {
    font-weight: bold;
  }

  p {
    max-width: 600px;
  }


  li {
    margin-bottom: 5px;
  }

  footer {
    padding-top: 25px;
    border-top: 1px solid black;
  }

  footer a {
    float:left;
    margin:5px;
  }

  .pet-image {
    height:250px;
  }

  .dashboard div {
    display:block;
  }

  .pet-image-container {
    float:left;
    padding:10px;
  }

  .dashboard {
    float:left;
    padding:20px;
  }

  .button-container {
    margin-top:20px;
  }

  .button-container button {
    width: 100px;
      margin-right: 10px;
      text-align: center;
      display: inline-block;
      float: left;
    font-size:15px;
    background-color: #1e2835;
    border-color: #404853;
    cursor:pointer;
    background-image: linear-gradient(to bottom,rgba(246,246,246,.1)0%,rgba(30,40,53,0)66%);
    color: #fafafa;
  }

  html, body {
          height: 100%;
          margin: 0;
          padding: 0;
        }

        #container {
                height: 100%;
                margin: 0;
                padding: 0;
              }

  #map {
         height: 78%;
         width: 60%;
         float: right;
       }

              
            
!

JS

              
                function initMap(){
  const map = new google.maps.Map(document.getElementById('map'), {
          center: {lat: 34.23833238, lng: -118.523664572},
          zoom: 16,//15.8,
          gestureHandling: "none",
          disableDefaultUI: true,
          clickableIcons: false
        });

    map.addListener("dblclick", e => {
      console.log("I just double clicked!!!", e);
      const geoCoder = new google.maps.Geocoder();

      geoCoder.geocode({latLng: e.latLng}, (results, status) => {
        if (status = google.maps.GeocoderStatus.OK) {
          console.log('results from geocode api: ', results)
        }
      })


        var JacarandaHall = new google.maps.Marker({
                  position: 34.241, 118.528,
                  map: map,
                  title: none
                });

                map.addListener('center_changed', function() {
                  // 3 seconds after the center of the map has changed, pan back to the
                  // marker.
                  window.setTimeout(function() {
                    map.panTo(marker.getPosition());
                  }, 3000);
                });

                marker.addListener('click', function() {

                        var rectangle = new google.maps.Rectangle({
                            strokeColor: '#FF0000',
                            strokeOpacity: 0.8,
                            strokeWeight: 2,
                            fillColor: '#FF0000',
                            fillOpacity: 0.35,
                            map: map,
                            bounds: {
                              north: 34.241,
                              south: 34.242,
                              east: -118.528,
                              west: -118.53
                            }
                          });
                });


    });
    //generate list of possible CSUN locations
    const listOfPlaces = ["Where is Bayramian Hall", "Where is the Student Recreation Center", "Where is Jacaranda Hall", "Where is Juniper Hall", "Where is Redwood Hall", "Where is Matador Bookstore"];
    listOfPlaces.sort(() => 0.5 - Math.random());
    const currentQuestions = listOfPlaces.slice(0, 5);
    const currentQuestionIndex = 0;
    console.log('five selected questions', currentQuestions);
    document.getElementById("instructions").innerHTML += `<p>${currentQuestions[currentQuestionIndex]}</p>`;
}



/*

//generate list of possible CSUN locations
const listOfPlaces = ["Bayramian Hall", "Student Recreation Center", "Jacaranda Hall", "Juniper Hall", "Redwood Hall", "Matador Bookstore"];

//function for wrong answer
function makeRed(userAnswer) {
  console.log("make red");
 });
  //turn the user answer on the map red
}

//function for right answer
function makeGreen(userAnswer){
  console.log("make green");
  //turn the user answer on the map green
}

//function to prompt user
function promptUser(userAnswer){
  console.log("click on an object");
  //ask user to double click on a place
  //userAnswer.addEventListener("click", rightOrWrong(userAnswer);
  const findPlace  = listOfPlaces.find(place => place === userAnswer);
  if(listOfPlaces[userAnswer].ondblclick()){
    rightOrWrong(userAnswer);
  }
}

var rightAnswers=0;
//function that determines if user is right or wrong
function rightOrWrong(userAnswer) {
  if (userAnswer === correctAnswer) {
    document.write(`<p>You got it right!!!<p>`);

    //run jQuery function to make clicked place on google green
    console.log("you got it right!");
    makeRed();
    rightAnswers++;
  } else {
    document.write(`<p>You got it wrong!!!</p>`);
    //run jQuery function to make clicked place on google red
    console.log("you get it wrong!");
    makeGreen();
  }
}

//for each place on the map
for (var i = 0; i < 5; i++){

  //prompt user to click on a location
   promptUser('');

  //generate a correct answer to compare this to
   let correctAnswer = listOfPlaces[(Math.random() * listOfPlaces.length()).floor()];
   document.write(`<p>Click on the location of , ${correctAnswer}</p>`);

  //some sort of event handler to let the user click on a location, then determine whether they were right or right or wrong
  //based on that click
  let userAnswer=document.getElementById("rightAnswer").addEventListener("click", rightOrWrong());

  rightOrWrong(userAnswer);

  document.write(`${rightAnswers}/5`);
  document.log("script runs");
}
*/

              
            
!
999px

Console