👁 查看:instablock.js
路径:/home/forge/kingkrunch.com/wp/wp-content/themes/foodstuff/js/megnor/instablock.js
大小:2.04 KB · 修改:2020-09-11 16:13:49 · 权限:0775 · 可写
 var feed = new Instafeed({
      accessToken: '2213716927.3efa215.990bd8a7e4614b7a9fc787cb0ea0fd7b',
      userId:"2213716927",
      limit: 20,
      get:'user',
      target: 'instafeed',
      tagName: 'fashion',
      resolution : 'low_resolution',
      filter: function(image) {
            var date = new Date(image.created_time*1000);
    
            m = date.getMonth();
            d = date.getDate();
            y = date.getFullYear();
    
            var month_names = new Array ();
            month_names[month_names.length] = "Jan";
            month_names[month_names.length] = "Feb";
            month_names[month_names.length] = "Mar";
            month_names[month_names.length] = "Apr";
            month_names[month_names.length] = "May";
            month_names[month_names.length] = "Jun";
            month_names[month_names.length] = "Jul";
            month_names[month_names.length] = "Aug";
            month_names[month_names.length] = "Sep";
            month_names[month_names.length] = "Oct";
            month_names[month_names.length] = "Nov";
            month_names[month_names.length] = "Dec";
    
            var thetime = month_names[m] + ' ' + d + ' , ' + y;
            image.created_time = thetime;
    
            if (image.user && image.user.full_name && image.user.full_name.length > 0) {
              image.full_name_with_fallback = image.user.full_name;
            } else {
              image.full_name_with_fallback = image.user.username;
            }
    
            return true;
        	},
          template: '<div class="item"><a href="{{link}}" target="_blank" class="insta-link"><img src="{{image}}" /><span class="insta-details"><span class="insta-userby">by</span><span class="insta-user">{{model.full_name_with_fallback}}</span><span class="insta-date">{{model.created_time}}</span><span class="insta-caption">{{caption}}</span><span class="likes">{{likes}}</span> <span class="comments">{{comments}}</span></span></a></div>'
            });
          
          feed.run();