-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
729 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"less": { | ||
"ignore": true, | ||
"input": "public/assets/less/style.less", | ||
"output": "public/assets/css", | ||
"watch": [ | ||
"public/assets/less/**/*" | ||
] | ||
}, | ||
"js": { | ||
"ignore": false, | ||
"input": "./js/SimpleMapSettings.js", | ||
"output": "../src/resources/SimpleMapSettings.min.js", | ||
"watch": [ | ||
"./js/**/*.js" | ||
] | ||
}, | ||
"browserSync": { | ||
"ignore": true | ||
} | ||
} |
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* globals google */ | ||
|
||
/** | ||
* Load the google API into the dom | ||
* | ||
* @param {string} key - Google Maps API key | ||
* @param {string} locale - The locale | ||
* @param {boolean=} includeDrawing - Include the drawing library | ||
* @static | ||
*/ | ||
export const loadGoogleAPI = function (key, locale, includeDrawing = false) { | ||
window.simpleMapsLoadingGoogle = true; | ||
|
||
const gmjs = document.createElement("script"); | ||
gmjs.type = "text/javascript"; | ||
gmjs.src = "https://www.google.com/jsapi?key=" + key; | ||
gmjs.onreadystatechange = function () { | ||
loadMapsApi(key, locale, includeDrawing); | ||
}; | ||
gmjs.onload = function () { | ||
loadMapsApi(key, locale, includeDrawing); | ||
}; | ||
document.body.appendChild(gmjs); | ||
}; | ||
|
||
/** | ||
* Load the google maps API into the dom | ||
* | ||
* @param {string} key - Google Maps API key | ||
* @param {string} locale - The locale | ||
* @param {boolean=} includeDrawing - Include the drawing library | ||
* @static | ||
*/ | ||
export const loadMapsApi = function (key, locale, includeDrawing = false) { | ||
google.load("maps", "3", { | ||
other_params: [ | ||
"libraries=places" + (includeDrawing ? ",drawing" : ""), | ||
`key=${key}`, | ||
`language=${locale.replace("_", "-")}`, | ||
`region=${locale}`, | ||
].join("&"), | ||
callback: function () { | ||
document.dispatchEvent(new Event("SimpleMapsGAPILoaded")); | ||
} | ||
}); | ||
}; |
Oops, something went wrong.