Fixed empty PV issue.

This commit is contained in:
Cotes Chung 2020-07-24 20:45:19 +08:00
parent aa23becd14
commit ad48a9ab06

View file

@ -26,6 +26,7 @@ function countUp(min, max, destId) {
function countPV(path, rows) { function countPV(path, rows) {
var count = 0; var count = 0;
if (rows !== undefined ) {
for (var i = 0; i < rows.length; ++i) { for (var i = 0; i < rows.length; ++i) {
var gaPath = rows[i][0]; var gaPath = rows[i][0];
if (gaPath == path) { /* path format see: site.permalink */ if (gaPath == path) { /* path format see: site.permalink */
@ -33,6 +34,7 @@ function countPV(path, rows) {
break; break;
} }
} }
}
return count; return count;
} }
@ -59,7 +61,7 @@ function displayPageviews(data) {
} }
var hasInit = getInitStatus(); var hasInit = getInitStatus();
var rows = data.rows; var rows = data.rows; /* could be undefined */
if ($("#post-list").length > 0) { /* the Home page */ if ($("#post-list").length > 0) { /* the Home page */
$(".post-preview").each(function() { $(".post-preview").each(function() {