pavelk2 / social-feed

JavaScript plugin that shows a user feed from the most popular social networks
http://pavelk2.github.io/social-feed-example/
MIT License
962 stars 304 forks source link

Sorting by Date Posted #169

Open enriqueheyhey opened 8 years ago

enriqueheyhey commented 8 years ago

How would I set this up? Thank you in advance!!!

tmlangley commented 8 years ago

I think I'm having the same issue, but to clarify, it is sorting each social media network separately. For example, if I have three posts from Facebook and Twitter pulling into a feed, it will first display all three Facebook posts in chronological order and then the three Twitter posts. It will not mix them even if the dates are mixed.

enriqueheyhey commented 8 years ago

@tandroid1 I tried your commit and it doesn't render the array for me. I just get a blank screen with no results. I pulled down a fresh copy of Social Feed and replaced the js in jquery.socialfeed.js with your code. Can you confirm that it's working on your end? Thanks for the effort!!!

tmlangley commented 8 years ago

Hey @enriqueheyhey - I just double checked and it is working for me. Do you happen to know if the limit you've specified for one of your feeds is higher than the number of results you're expecting back? I was just informed that there is another issue going related to this that my code does not fix and actually seems to handle a bit less gracefully. In the master version, I assume the callback just doesn't fire, but after my commit, you would get no results. That's one thing I'll look into, but If you're sure that's not the case for you then I can start debugging the rest of the code as well.

enriqueheyhey commented 8 years ago

@tandroid1 seems that this is causing the feed not to render: if (loaded_post_count == posts_to_load_count) {

if i set it to !== it renders, but just a few posts. Got a fix for this?

tmlangley commented 8 years ago

I'm thinking we should take a step back. This isn't broken in the first place in the demo for the site so my reworking of the rendering system is probably overkill. I can try to take another stab at it when I get some time with a hopefully less intrusive approach.

HartLarsson commented 8 years ago

as i explain here: https://github.com/pavelk2/social-feed/issues/161 the problem is how are calculated the total post before rendering. If for example the script want 8 post and from a feed you receive only 7 it will not render. We need a way to get how many post to render MAX and consider if feed send less then MAX render anyway or if is EOF

MaluNoPeleke commented 8 years ago

Another question related to the date is the multiple locale support: For me it seems to be always in English but I use a German OS and I am based in Germany. Shouldn't it support German as well? How does it detect it automatically?

HartLarsson commented 8 years ago

https://github.com/pavelk2/social-feed/issues/61#issuecomment-194340224

check also to have in moment/locale the de.js and de-at.js

MaluNoPeleke commented 8 years ago

Thanks, but I thought it could be automatically displayed by the used system language or something else. Otherwise I will try to use post.dt_create.locale('de');

HartLarsson commented 8 years ago

for me is auto detected, check that in the folder there is your language js file.

MaluNoPeleke commented 8 years ago

All language js files are at the right place but I cannot see a difference even if I use moment-with-locales.js as a test. How does moment.js detect the language or is there a place where the language could be set hardcoded? I use date_format: 'll' in my general settings without success.

HartLarsson commented 8 years ago

there is some confusion, you need to call the moment.js and the optional language in the way is explained in the configuration sample:

<!-- Moment.js for showing "time ago" and/or "date"-->
<script src="bower_components/moment/min/moment.min.js"></script>
<!-- Moment Locale to format the date to your language (eg. italian lang)-->
<script src="bower_components/moment/locale/it.js"></script>

in your case instead of it.js use de.js

MaluNoPeleke commented 8 years ago

I have done that and it works but only for Instagram and RSS while Twitter stays in English: http://peleke.diphda.uberspace.de/bower_components/social-feed/wilkenm.html

HartLarsson commented 8 years ago

hi, search this string in the js under Twitter > unifyPostData:

post.dt_create = moment(element.created_at, 'dd MMM DD HH:mm:ss ZZ YYYY','en');

and substitute with:

post.dt_create = moment(new Date(element.created_at));

i applied a personal mod and ofrgot to reverse back :)

or you can call this to initialize and forging german language in your section:

post.dt_create.locale('de');

UPDATE:

I've published in my github new js fixed.