google-maps-reviews
Advanced tools
Comparing version 0.0.22 to 0.0.23
@@ -48,3 +48,3 @@ // Copyright (c) 2018, Simon Neutert | ||
var renderHeader = function(header) { | ||
var renderHeader = function (header) { | ||
var html = ""; | ||
@@ -55,3 +55,3 @@ html += header + "<br>"; | ||
var renderFooter = function(footer) { | ||
var renderFooter = function (footer) { | ||
var html = ""; | ||
@@ -62,32 +62,21 @@ html += "<br>" + footer + "<br>"; | ||
var shorten_name = function(name) { | ||
var shortenName = function (name) { | ||
if (name.split(" ").length > 1) { | ||
var xname = ""; | ||
xname = name.split(" "); | ||
return xname[0] + " " + xname[1][0] + "."; | ||
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 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) { | ||
var renderStars = function (rating) { | ||
var stars = '<div class="review-stars"><ul>'; | ||
@@ -108,3 +97,3 @@ // fill in gold stars | ||
var convertTime = function(UNIX_timestamp) { | ||
var convertTime = function (UNIX_timestamp) { | ||
var a = new Date(UNIX_timestamp * 1000); | ||
@@ -116,3 +105,3 @@ var months = settings.months; | ||
var filterReviewsByMinRating = function(reviews) { | ||
var filterReviewsByMinRating = function (reviews) { | ||
if (reviews === void 0) { | ||
@@ -130,5 +119,7 @@ return []; | ||
var sortReviewsByDateDesc = function(reviews) { | ||
var sortReviewsByDateDesc = function (reviews) { | ||
if (typeof reviews != "undefined" && reviews != null && reviews.length != null && reviews.length > 0) { | ||
return reviews.sort(function(a,b) {return (a.time > b.time) ? 1 : ((b.time > a.time) ? -1 : 0);} ).reverse(); | ||
return reviews.sort(function (a, b) { | ||
return (a.time > b.time) ? 1 : ((b.time > a.time) ? -1 : 0); | ||
}).reverse(); | ||
} else { | ||
@@ -139,3 +130,3 @@ return [] | ||
var renderReviews = function(reviews) { | ||
var renderReviews = function (reviews) { | ||
reviews.reverse(); | ||
@@ -162,13 +153,12 @@ var html = ""; | ||
var rescueAnonymousReviews = function(review, name) { | ||
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 != "") { | ||
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 { | ||
} else { | ||
return name; | ||
@@ -188,3 +178,3 @@ } | ||
// the callback is what initiates the rendering if Status returns OK | ||
var callback = function(place, status) { | ||
var callback = function (place, status) { | ||
if (status == google.maps.places.PlacesServiceStatus.OK) { | ||
@@ -206,2 +196,2 @@ var filtered_reviews = filterReviewsByMinRating(place.reviews); | ||
return service.getDetails(request, callback); | ||
} | ||
} |
{ | ||
"name": "google-maps-reviews", | ||
"version": "0.0.22", | ||
"version": "0.0.23", | ||
"description": "Display Google Reviews of a Place on Google Maps on your website", | ||
@@ -5,0 +5,0 @@ "main": "google-maps-reviews.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12363
248