diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..add9e4f
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,12 @@
+# EditorConfig is awesome: https://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+# trim_trailing_whitespace = false
+# insert_final_newline = false
\ No newline at end of file
diff --git a/Readme.md b/Readme.md
index d584dff..b830a9a 100644
--- a/Readme.md
+++ b/Readme.md
@@ -7,80 +7,97 @@ this will get the 5 reviews, google offers you. if you need more, let me direct
The NPM Package is [here](https://github.com/simonneutert/google-maps-reviews) - Frontend Devs will know how to webpack :) or simply extract the code and adapt it to your needs, dropping jQuery as a dependency.
## Credits
+
Inspired by Steven Monson's magnificent article here:
-https://www.launch2success.com/guide/display-google-reviews-website-2017/ or check out [Steven's github](https://github.com/stevenmonson/googleReviews). Steven's code is based on [peledies jquery plugin repo](https://github.com/peledies/google-places). So, I simply remixed their work into this repo. *Thank you guys!*
+https://www.launch2success.com/guide/display-google-reviews-website-2017/ or check out [Steven's github](https://github.com/stevenmonson/googleReviews). Steven's code is based on [peledies jquery plugin repo](https://github.com/peledies/google-places). So, I simply remixed their work into this repo. _Thank you guys!_
#### Dear beginners and copy-pasters
-:octocat: *For those of you, who are new in programming or can only copy-paste, please make sure, that jQuery, the Google Maps API and the .js-file of this plugin are successfully loaded, before you call this script in your html page.*
+:octocat: _For those of you, who are new in programming or can only copy-paste, please make sure, that jQuery, the Google Maps API and the .js-file of this plugin are successfully loaded, before you call this script in your html page._
-*./demo/index.html is a working demo, the comments will guide you :wink:*
+_./demo/index.html is a working demo, the comments will guide you :wink:_
## Prerequisites
-* You must have jQuery in your project: [jQuery](http://jquery.com)
+- You must have jQuery in your project: [jQuery](http://jquery.com)
-* add the .js and .css of this repo to your project (see ./demo/index.html for inspiration :wink:)
+- add the .js and .css of this repo to your project (see ./demo/index.html for inspiration :wink:)
-* ___if you do not have a working Google Maps API key already:___ create a Google API Key: [https://console.developers.google.com/apis/](https://console.developers.google.com/apis/) **make sure to set a limit to your payments**
+- **_if you do not have a working Google Maps API key already:_** create a Google API Key: [https://console.developers.google.com/apis/](https://console.developers.google.com/apis/) **make sure to set a limit to your payments**
-* add the following line with your Google Maps API key with the key param:
+- add the following line with your Google Maps API key with the key param:
- ``` html
+ ```html
```
-* add an empty ***div*** element in your html template with an unique ID, where the reviews should show up. In this case:
+- add an empty **_div_** element in your html template with an unique ID, where the reviews should show up. In this case:
`
`
-
+
## How to get link to “View All Google Reviews” or "Write a review"
Please see the official Documents for this topic:
https://developers.google.com/my-business/content/review-data#list_all_reviews
-* Step 1. Open a browser, but don’t use Chrome. You can use Firefox, or Edge, or even Internet Explorer but not Google Chrome because it alters the URL and your link will not work correctly.
+- Step 1. Open a browser, but don’t use Chrome. You can use Firefox, or Edge, or even Internet Explorer but not Google Chrome because it alters the URL and your link will not work correctly.
-* Step 2. Go to [Google.com](http://www.google.com) and search for your company’s name.
+- Step 2. Go to [Google.com](http://www.google.com) and search for your company’s name.
-* Step 3. Find the card on the right and click “View All Google Reviews” or "Write a review"
+- Step 3. Find the card on the right and click “View All Google Reviews” or "Write a review"
-* Step 4. Copy the URL in the address bar.
+- Step 4. Copy the URL in the address bar.
-* Step 5. Now paste the URL as a link on `more_reviews_button_url` or `write_review_button_url` param.
+- Step 5. Now paste the URL as a link on `more_reviews_button_url` or `write_review_button_url` param.
## Call the Plugin
-[Grab your place's ID (https://developers.google.com/places/place-id) and call it as ***placeId*** parameter, when calling the plugin. ](https://developers.google.com/places/place-id)
+[Grab your place's ID (https://developers.google.com/places/place-id) and call it as **_placeId_** parameter, when calling the plugin. ](https://developers.google.com/places/place-id)
-``` html
+```html
```
## Are Pull Requests welcome?
+
Yes, of course :octocat:
**You do not need to update the demo folder!** I will do this, when your code was merged.
diff --git a/demo/README.md b/demo/README.md
deleted file mode 100644
index f430e74..0000000
--- a/demo/README.md
+++ /dev/null
@@ -1 +0,0 @@
-`$ npm update`
diff --git a/demo/index.html b/demo/index.html
deleted file mode 100644
index b493668..0000000
--- a/demo/index.html
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
- Google Reviews Demo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/node_modules/jquery-google-reviews/LICENSE b/demo/node_modules/jquery-google-reviews/LICENSE
deleted file mode 100644
index cebfcaf..0000000
--- a/demo/node_modules/jquery-google-reviews/LICENSE
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright (c) 2018, Simon Neutert
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/demo/node_modules/jquery-google-reviews/Readme.md b/demo/node_modules/jquery-google-reviews/Readme.md
deleted file mode 100644
index 181d498..0000000
--- a/demo/node_modules/jquery-google-reviews/Readme.md
+++ /dev/null
@@ -1,79 +0,0 @@
-# jQuery Plugin to display Google Reviews of a Place on Google Maps
-
-## I do not like jQuery!!!1eleven
-
-The NPM Package is [here](https://github.com/simonneutert/google-maps-reviews) - Frontend Devs will know how to webpack :) or simply extract the code and adapt it to your needs, dropping jQuery as a dependency.
-
-## Credits
-Inspired by Steven Monson's magnificent article here:
-https://www.launch2success.com/guide/display-google-reviews-website-2017/ or check out [Steven's github](https://github.com/stevenmonson/googleReviews). Steven's code is based on [peledies jquery plugin repo](https://github.com/peledies/google-places). So, I simply remixed their work into this repo. *Thank you guys!*
-
-#### Dear beginners and copy-pasters
-
-:octocat: *For those of you, who are new in programming or can only copy-paste, please make sure, that jQuery, the Google Maps API and the .js-file of this plugin are successfully loaded, before you call this script in your html page.*
-
-*./demo/index.html is a working demo, the comments will guide you :wink:*
-
-## Prerequisites
-
-* You must have jQuery in your project: [jQuery](http://jquery.com)
-
-* add the .js and .css of this repo to your project (see ./demo/index.html for inspiration :wink:)
-
-* ___if you do not have a working Google Maps API key already:___ create a Google API Key: [https://console.developers.google.com/apis/](https://console.developers.google.com/apis/)
-
-* add the following line with your Google Maps API key with the key param:
-
- ``` html
-
- ```
-
-* add an empty ***div*** element in your html template with an unique ID, where the reviews should show up. In this case:
-
- ``
-
-## How to get link to “View All Google Reviews” or "Write a review"
-
-* Step 1. Open a browser, but don’t use Chrome. You can use Firefox, or Edge, or even Internet Explorer but not Google Chrome because it alters the URL and your link will not work correctly.
-
-* Step 2. Go to [Google.com](http://www.google.com) and search for your company’s name.
-
-* Step 3. Find the card on the right and click “View All Google Reviews” or "Write a review"
-
-* Step 4. Copy the URL in the address bar.
-
-* Step 5. Now paste the URL as a link on `more_reviews_button_url` or `write_review_button_url` param.
-
-## Call the Plugin
-
-[Grab your place's ID (https://developers.google.com/places/place-id) and call it as ***placeId*** parameter, when calling the plugin. ](https://developers.google.com/places/place-id)
-
-``` html
-
-```
-
-## Are Pull Requests welcome?
-Yes, of course :octocat:
diff --git a/demo/node_modules/jquery-google-reviews/jquery-google-reviews.css b/demo/node_modules/jquery-google-reviews/jquery-google-reviews.css
deleted file mode 100644
index 6b3756d..0000000
--- a/demo/node_modules/jquery-google-reviews/jquery-google-reviews.css
+++ /dev/null
@@ -1,148 +0,0 @@
-#google-reviews {
- display: flex;
- flex-wrap: wrap;
- /*display: grid;*/
- /*grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));*/
-}
-
-.review-item {
- border: solid 1px rgba(190, 190, 190, .35);
- margin: 0 auto;
- padding: 1em;
- flex: 1 1 50%;
- display: flex;
- flex-direction: column;
- align-content: stretch;
-}
-
-@media ( max-width:1200px) {
- .review-item {
- flex: 1 1 50%;
- }
-}
-
-@media ( max-width:450px) {
- .review-item {
- flex: 1 1 90%;
- }
-}
-
-.review-item-long {
- border: solid 1px rgba(190, 190, 190, .35);
- margin: 0 auto;
- padding: 1em;
- flex: 1 1 90%;
- display: flex;
- flex-direction: column;
- align-content: stretch;
-}
-
-@media ( max-width:1200px) {
- .review-item-long {
- flex: 1 1 90%;
- }
-}
-
-@media ( max-width:450px) {
- .review-item-long {
- flex: 1 1 90%;
- }
-}
-
-.review-header{
- display: flex;
-}
-
-.review-picture{
- width: 5em;
- height: auto;
- align-self: center;
- margin-right: 1em;
-}
-
-.review-usergrade{
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: flex-start;
-}
-
-.review-meta, .review-stars {
- text-align: center;
- font-size: 115%;
-}
-
-.review-author {
- text-transform: capitalize;
- font-weight: bold;
-}
-
-.review-date {
- opacity: .6;
- display: block;
-}
-
-.review-text {
- line-height: 1.55;
- text-align: left;
- max-width: 100%;
- text-align: justify;
-}
-
-.review-stars ul {
- display: inline-block;
- list-style: none !important;
- margin: 0;
- padding: 0;
-}
-
-.review-stars ul li {
- float: left;
- list-style: none !important;
- margin-right: 1px;
- line-height: 1;
-}
-
-.review-stars ul li i {
- color: #eb6e00;
- /* Google's Star Orange in Nov 2017 */
- font-size: 1.4em;
- font-style: normal;
-}
-
-.review-stars ul li i.inactive {
- color: #c6c6c6;
-}
-
-.star:after {
- content: "\2605";
-}
-
-
-.buttons {
- margin: 20px 0 0 0;
- display: flex;
- justify-content: center;
- align-items: center;
- flex-wrap: wrap;
-}
-
-.more-reviews {
- text-align: center;
-}
-
-.write-review {
- text-align: center;
-}
-
-.more-reviews a,
-.write-review a {
- margin: 5px;
- border: 1px #eb6e00 solid;
- border-radius: 40px;
- padding: 10px;
- background-color: #eb6e00;
- color: #FFF;
- text-decoration: none;
-}
-
diff --git a/demo/node_modules/jquery-google-reviews/jquery-google-reviews.js b/demo/node_modules/jquery-google-reviews/jquery-google-reviews.js
deleted file mode 100644
index 26be808..0000000
--- a/demo/node_modules/jquery-google-reviews/jquery-google-reviews.js
+++ /dev/null
@@ -1,194 +0,0 @@
-/* README
-Inspired by Steven Monson's magnificent article here:
-https://www.launch2success.com/guide/display-google-reviews-website-2017/
-
-Stevens code was based on peledies jquery plugin on github:
-https://github.com/peledies/google-places
-
-made me think and remix their work into the following lines.
-
-Thank you guys!
-*/
-
-(function($) {
-
- $.fn.googlePlaces = function(options) {
- // This is the easiest way to have default options.
- var settings = $.extend({
- // These are the defaults.
- header: "
");
+ targetDivJquery.append(html);
+ };
+
var renderReviews = function (reviews) {
reviews.reverse();
var html = "";
@@ -192,7 +251,7 @@ Thank you guys!
var picture = "";
var review = reviews[i];
var reviewText = sanitizedReviewText(review.text);
- var stars = renderStars(review.rating);
+ var stars = renderStarsReviews(review.rating);
var date = convertTime(review.time);
var name = settings.shortenNames
? shortenName(review.author_name)
@@ -248,6 +307,7 @@ Thank you guys!
var sortedReviews = sortReviewsByDateDesc(filteredReviews);
if (sortedReviews.length > 0) {
renderHeader(settings.header);
+ renderPlaceAverageRatingWithStars(place);
renderReviews(sortedReviews);
renderFooter(settings.footer);
}