Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 rectangle = new google.maps.Rectangle({
- strokeColor: '#FF0000',
- strokeOpacity: 0.8,
- strokeWeight: 2,
- fillColor: '#FF0000',
- fillOpacity: 0.35,
- map: map,
- bounds: {
- north: 34.2,
- south: 34.9,
- east: -118.2,
- west: -118.9
- }
- });
- });
- //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");
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement