";
+ return stars;
+ };
+
+ var addInactiveStar = function (stars, limit, rating) {
+ for (var i = 0; i < limit - rating; i++) {
+ stars += '
';
+ }
+ return stars;
+ };
+
var convertTime = function (UNIX_timestamp) {
var newDate = new Date(UNIX_timestamp * 1000);
var months = settings.months;
@@ -192,7 +224,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)
From 8b3b7d96a9f73e715addce35290219f48068cb20 Mon Sep 17 00:00:00 2001
From: Simon Neutert
Date: Fri, 10 Sep 2021 18:19:53 +0200
Subject: [PATCH 3/6] namespacing
---
Readme.md | 91 +++++++++++++++++++++++-----------------
demo/index.html | 80 ++++++++++++++++++-----------------
jquery-google-reviews.js | 2 +-
3 files changed, 95 insertions(+), 78 deletions(-)
diff --git a/Readme.md b/Readme.md
index d584dff..db918d3 100644
--- a/Readme.md
+++ b/Readme.md
@@ -7,80 +7,95 @@ 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/index.html b/demo/index.html
index b493668..28a5d41 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -1,43 +1,45 @@
-
-
-
- Google Reviews Demo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+