-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnews.min.js
1 lines (1 loc) · 914 Bytes
/
news.min.js
1
function NewsController($scope,$http,$location){$scope.newsitems=[],$scope.didLoad=!1;var ref_date=0,path=$location.path().length>1?$location.path().substr(1):null;path&&(ref_date=new Date(1e3*path).getTime()),$scope.fetchNews=function(){$http.get("./posts.json").then(function(json){if(json&&json.data&&json.data.data&&json.data.data.length>0){items=[];for(var i=0;i<json.data.data.length;i++)if(item=json.data.data[i],!item.is_deleted){if(ref_date>0){var my_date=Date.parse(item.created_at);item.is_new=my_date>ref_date}else item.is_new=!1;if("entities"in item&&"mentions"in item.entities&&item.entities.mentions.length>0){for(var allowed=!0,m=0;m<item.entities.mentions.length;m++){var mention=item.entities.mentions[m];if(0==mention.pos){allowed=!1;break}}allowed&&items.push(item)}else items.push(item)}$scope.newsitems=items}$scope.didLoad=!0})},$scope.fetchNews()}var _main=angular.module("MedCalcNews",[]);