Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

google-maps-reviews

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-maps-reviews - npm Package Compare versions

Comparing version 0.0.21 to 0.0.22

65

google-maps-reviews.js

@@ -35,3 +35,3 @@ // Copyright (c) 2018, Simon Neutert

min_rating: 4,
months: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"],
months: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
text_break_length: "90",

@@ -43,2 +43,3 @@ shorten_names: true,

show_date: false,
show_profile_picture: false,
placeId: ""

@@ -69,2 +70,23 @@ };

var shortenName = function(name) {
if (name.split(" ").length > 1) {
var split_name = name.split(" ");
var first_name = split_name[0];
var last_name_first_letter = split_name[1][0];
if (last_name_first_letter == ".") {
return first_name;
} else {
return first_name + " " + last_name_first_letter + ".";
}
}
else if (name != undefined) {
return name;
}
else {
return settings.anonymous_name;
}
};
var renderStars = function(rating) {

@@ -121,18 +143,13 @@ var stars = '<div class="review-stars"><ul>';

for (var i = row_count; i >= 0; i--) {
var stars = renderStars(reviews[i].rating);
var date = convertTime(reviews[i].time);
var name = settings.shorten_names ? shorten_name(reviews[i].author_name) : reviews[i].author_name;
var style = (reviews[i].text.length > parseInt(settings.text_break_length)) ? "review-item-long" : "review-item";
var review = reviews[i].text
var review = reviews[i];
var stars = renderStars(review.rating);
var date = convertTime(review.time);
var name = settings.shorten_names ? shortenName(review.author_name) : review.author_name;
var style = (review.text.length > parseInt(settings.text_break_length)) ? "review-item-long" : "review-item";
var review_text = review.text
if (settings.show_date == true) {
review = "<span class='review-date'>"+date+"</span> " + review;
review_text = "<span class='review-date'>" + date + "</span> " + review_text;
}
if (settings.replace_anonymous == true &&
settings.anonymous_name != "" &&
reviews[i].author_name.toLowerCase() == settings.anonymous_name.toLowerCase() &&
settings.anonymous_name_replacement != "") {
name = settings.anonymous_name_replacement;
}
html = html + "<div class=" + style + "><div class='review-meta'><span class='review-author'>" + name + "</span><span class='review-sep'></span>" + "</div>" + stars + "<p class='review-text'>" + review + "</p></div>";
name = rescueAnonymousReviews(review, name);
html = html + "<div class=" + style + "><div class='review-meta'><span class='review-author'>" + name + "</span><span class='review-sep'></span>" + "</div>" + stars + "<p class='review-text'>" + review_text + "</p></div>";
}

@@ -142,2 +159,17 @@ target_div.innerHTML += html;

var rescueAnonymousReviews = function(review, name) {
if (settings.replace_anonymous == true &&
settings.anonymous_name != "" &&
(
review.author_name.toLowerCase() == settings.anonymous_name.toLowerCase() ||
review.author_name == undefined
) &&
settings.anonymous_name_replacement != "") {
return settings.anonymous_name_replacement;
}
else {
return name;
}
}
// GOOGLE PLACES API CALL STARTS HERE

@@ -171,4 +203,1 @@

}
// var googlePlaces = function(elem, options) {
// };
{
"name": "google-maps-reviews",
"version": "0.0.21",
"version": "0.0.22",
"description": "Display Google Reviews of a Place on Google Maps on your website",

@@ -5,0 +5,0 @@ "main": "google-maps-reviews.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc