从 JSON 中的下一项检索信息(Twitter API)
我正在尝试构建一个显示用户推文的页面,但是在每条推文之间,我希望可视化代表用户在该时间段内可能输入的内容的空间。
我一直在按照自己想要实现的目标的逻辑兜圈子,却一事无成。我当前的代码在这里:http://jsfiddle.net/k5234/,但这不包括我试图实现代码获取 item'created_at 字段(当前推文的日期/时间)并将其从 next item.created_at 字段中取出的位置。
如果有人能指出我如何让我的代码正常工作的正确方向,我将非常感激。我的工作基础是 3x
s == 1 秒。
需要澄清的是,如果用户在下午 1.05 点发推文,然后在下午 1.07 点再次发推文,则会有 120 秒的空白,即。 120 秒 * 3 个字符 = 2 条推文之间有 360 个空格。希望这一切都有道理。
谢谢, 大卫
添加信息:想象一下有人不断发推文。该页面将充满文字。但实际上,有人只是偶尔发推文。推文后面的空格(直到下一条推文)的大小将代表他们当时可以输入的内容。例如。我输入一条推文,然后 10 分钟内不再发推文。在我的页面上可视化的是最后一条推文,但上一条推文之后将出现 1800 个空格(10 分钟 * 60 秒 * 每秒 3 个字符 = 1800 个空格)。我可以检索的是需要时推文的日期,但我遇到的问题是获取下一条推文的时间以确定以这种方式呈现信息阶段的间隙。我无法比这更清楚地说明这个概念了。
I am trying to build a page that displays user tweets, however in between each tweet I want to visualise the space that represents what the user could have typed in that time period.
I have been going round and round in circles with the logic of what I am trying to achieve and getting nowhere. My current code is here: http://jsfiddle.net/k5234/, but this doesn't include the loop I am trying to achieve where the code takes the item'created_at field (date/time of current tweet) and takes it away from the next item.created_at field.
If anyone can point me in the right direction with how I can get my code working, I would be really grateful. i am working on the basis that 3x
s == 1 second.
To clarify, if a user tweets at 1.05pm and then again at 1.07pm, there would be 120 seconds of empty space ie. 120seconds * 3 characters = 360 blank spaces between the 2 tweets. Hope it all makes sense.
Thanks,
David
ADDED INFO: Imagine someone continuously tweeting. The page will be full of text. However in reality, someone only tweets every so often. The space after the tweet (until their next one) will be of a size which represents what they could have typed in that time. Eg. I type a tweet, and don't tweet again for 10 minutes. Visualised on my page will be this last tweet, but the previous one will appear 1800 blank spaces after that (10 minutes * 60 seconds * 3 characters per second = 1800 blank spaces). What i can retrieve is the date of the tweet at time of need, but what I am having trouble with is getting the time of the next tweet to determine the gap at the stage of presenting the information in this manner. I can't really illustrate the concept any clearer than that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为你的问题很清楚。
看看这个解决方案是否有效:-
希望这会有所帮助。
I think your question is clear.
See if this solution works :-
hope this helps.
也许是这样的:
Maybe something along these lines: