diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2016-11-28 14:03:13 -0500 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2016-11-28 14:03:13 -0500 |
| commit | 76ed15b904463247bcd799b0116380ee4a1ddb6d (patch) | |
| tree | b3d82068e6a2dc03447b80c064fa655d5f7df90f /www/js/NewsCtrl.js | |
| parent | 010e28c69d86c48b33715fa67c972a4d4e49bee4 (diff) | |
modifications for picking up feeds from new zmNinja medium blog
Diffstat (limited to 'www/js/NewsCtrl.js')
| -rw-r--r-- | www/js/NewsCtrl.js | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/www/js/NewsCtrl.js b/www/js/NewsCtrl.js index 752a97e2..39782226 100644 --- a/www/js/NewsCtrl.js +++ b/www/js/NewsCtrl.js @@ -51,6 +51,7 @@ angular.module('zmApp.controllers').controller('zmApp.NewsCtrl', ['$scope', '$ro $scope.isUnread = function(itemdate) { var lastDate = NVRDataModel.getLatestBlogPostChecked(); + //console.log ("BLOG DATE="+itemdate+" LAST DATE="+lastDate); //get("latestBlogPostChecked"); if (!lastDate) return true; var mLastDate = moment(lastDate); @@ -99,18 +100,29 @@ angular.module('zmApp.controllers').controller('zmApp.NewsCtrl', ['$scope', '$ro $scope.newsItems = []; - $http.get(zm.blogUrl) - .success(function(data) + + $http.get(zm.blogUrl, + {transformResponse: function(d,h) + { + var trunc = "])}while(1);</x>"; + d = d.substr(trunc.length); + return d; + } + }) + .success(function(datastr) { - //console.log ("Here2"); - // console.log (JSON.stringify(data)); - for (var i = 0; i < data.length; i++) + + + // console.log ("DATA:"+data); + // + var data = JSON.parse(datastr); + for (var i = 0; i < data.payload.posts.length; i++) { $scope.newsItems.push( { - title: data[i].title, - url: data[i].url, - date: data[i].date + title: data.payload.posts[i].title, + url: "https://medium.com/zmninja/"+data.payload.posts[i].uniqueSlug, + date: moment(data.payload.posts[i].createdAt).format("YYYY-MM-DD HH:mm:ss") }); } |
