{"version":3,"file":"js/food_courts/food_court_map-6d14bdd46a09dd54b1c9.js","sources":["webpack:///webpack/bootstrap","webpack:///./app/javascript/packs/food_courts/food_court_map.js"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/packs/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./app/javascript/packs/food_courts/food_court_map.js\");\n","\nconst isSmall = () => {\n return Foundation.MediaQuery._getCurrentSize() === \"small\";\n};\n\nconst isMedium = () => {\n return Foundation.MediaQuery._getCurrentSize() === \"medium\";\n};\n\nconst isLarge = () => {\n return Foundation.MediaQuery._getCurrentSize() === \"large\";\n};\n\nconst isXLarge = () => {\n return Foundation.MediaQuery._getCurrentSize() === \"xlarge\";\n};\n\nconst isXXLarge = () => {\n return Foundation.MediaQuery._getCurrentSize() === \"xxlarge\";\n};\n\nwindow.initMap = () => {\n // Attach your callback function to the `window` object\n // JS API is loaded and available\n console.log('food/index/ initmap'); \n const url = new URL(location.href);\n bounds = new google.maps.LatLngBounds();\n map_id = (isMedium() || isSmall()) ? 'food_court_map_small': 'food_court_map';\n map_food_court = new google.maps.Map(\n document.getElementById(map_id),{\n zoom : 12,\n center : g_centerLatLng,\n mapTypeId : google.maps.MapTypeId.ROADMAP,\n mapTypeControl : false,\n scaleControl: true,\n zoomControlOptions:{\n position: google.maps.ControlPosition.RIGHT_CENTER,\n },\n }\n );\n // change map panning and scrolling behavior of a map when viewed on a mobile device.\n setFoodCourtGestureHandling(map_food_court);\n // draw food courts marker\n drawFoodCourtMarker(map_food_court);\n adjustFoodCourtZoom(map_food_court);\n const listener = google.maps.event.addListenerOnce(map_food_court,'idle', function() {\n adjustFoodCourtZoom(map_food_court);\n google.maps.event.removeListener(listener);\n });\n const before_size = Foundation.MediaQuery._getCurrentSize();\n google.maps.event.addDomListener(window, 'resize', function() {\n if (before_size != Foundation.MediaQuery._getCurrentSize()) {\n food_court_change_map(map_food_court);\n setFoodCourtGestureHandling(map_food_court);\n }\n before_size = Foundation.MediaQuery._getCurrentSize();\n });\n}\n\n/////\nconst food_court_change_map = (map) =>{\n if (document.getElementById('mapDefault')) {\n return false;\n }\n\n const map_dom = document.querySelector('#food_court_map');\n const map_small_dom = document.querySelector('#food_court_map_small');\n\n if (isMedium() || isSmall()) {\n const nodes = map_dom.children;\n for (let i = 0; i < nodes.length; i++) {\n map_small_dom.appendChild(nodes[i]);\n }\n } else {\n const nodes = map_small_dom.children;\n for (let i = 0; i < nodes.length; i++) {\n map_dom.appendChild(nodes[i]);\n }\n }\n}\n\n\nconst setFoodCourtGestureHandling = (map) => {\nif (isMedium() || isSmall()) {\n map.set('gestureHandling', 'auto');\n} else {\n map.set('gestureHandling', 'greedy');\n}\n}\n\n\nconst drawFoodCourtMarker = (map) => {\n for (let i = 0; i < markerData.length; i++) {\n // console.log(i);\n // console.log(markerData[i][0]);\n markerLatLng = new google.maps.LatLng({lat: Number(markerData[i][0]['lat']), lng: Number(markerData[i][0]['lng'])});\n bounds.extend(markerLatLng);\n marker[i] = new google.maps.Marker({\n position: markerLatLng,\n map: map,\n icon: marker_icon(markerData[i][0]),\n });\n\n infoWindow[i] = new google.maps.InfoWindow({\n content: infoFoodCourtWindowContent(markerData[i][0])\n });\n\n markerFoodCourtEvent(i);\n }\n}\n\n\nconst markerFoodCourtEvent = (i) => {\n marker[i].addListener('click', function() {\n infoFoodCourtWindowOpenClose(i);\n });\n}\n\n\nwindow.infoFoodCourtWindowOpenClose = (i) =>{\n infoWindow[i].open(map, marker[i]);\n if (opend != -1 && opend != i ){\n infoWindow[opend].close(map);\n $(`#${opend}`).removeAttr(\"class\");\n }\n opend=i;\n}\n\n\nconst infoFoodCourtWindowContent = (food_court) =>{\n return `
`;\n}\n\n\nconst marker_icon = (food_court) => {\n return {\n url: `https://pubimg.jointhawker.com/assets/images/common/marker_no/${food_court[\"no\"]}.png`,\n scaledSize: new google.maps.Size(28, 30)\n }\n}\n\n\nconst adjustFoodCourtZoom = (map) =>{\n if( markerData.length > 0) {\n map.fitBounds(bounds);\n map.panToBounds(bounds);\n if (map.getZoom() > 16) {\n map.setZoom(16);\n } else if (map.getZoom() <= 12) {\n map.setZoom(12);\n }\n }\n}\n\n\nwindow.scrollToFoodCourtMap = (id) => {\n if(isSmall() || isMedium()){\n scrollByFoodCourtId(id);\n }\n}\n\n\nwindow.scrollByFoodCourtId = (id) => {\n const scroll_food_court = new SmoothScroll();\n const anchor = document.querySelector(id);\n if(document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen){\n scroll_food_court.animateScroll(anchor, null, {speed: 1, speedAsDuration: true});\n } else {\n scroll_food_court.animateScroll(anchor);\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACjFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AADA;AANA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAHA;AAMA;AACA;AADA;AAIA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAFA;AAIA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;;;;A","sourceRoot":""}