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,11 +26,13 @@ function countUp(min, max, destId) {
function countPV(path, rows) { function countPV(path, rows) {
var count = 0; var count = 0;
for (var i = 0; i < rows.length; ++i) { if (rows !== undefined ) {
var gaPath = rows[i][0]; for (var i = 0; i < rows.length; ++i) {
if (gaPath == path) { /* path format see: site.permalink */ var gaPath = rows[i][0];
count += parseInt(rows[i][1]); if (gaPath == path) { /* path format see: site.permalink */
break; count += parseInt(rows[i][1]);
break;
}
} }
} }
@ -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() {