justforeverus asked: HI, I'm a web developer and the co-founder of Essence Labs Creative Agency. I just wanted to give you a little idea that popped into my head when reading the post about the tumblr api. You should try making a static page that automatically fetches posts using ajax and the v1 tumblr api, and then have that be placed in a random order. That might work better than the cron job so this way each user gets a different page. Don't know if it will work too well, but its worth a shot! What do you think?
The issue with AJAX and the Tumblr API is the cross-site domain restrictions in browsers. The main page is at “foo.tumblr.com” and the information is at “api.tumblr.com”. Firefox and Chrome won’t allow cross-subdomain AJAX calls like this.
You *can* use JSONP as a workaround for the cross-site scripting issue, but I find it inelegant and ugly.
But more to the point, when you need to load possibly hundreds of posts, the Tumblr API server is just too slow to get the results on the page in a reasonable amount of time.
Experiments from my webserver (which has a super duper fast pipe) shows an average of over 2.0 seconds to load 250 posts from the Tumblr API. This slows to over 3.5 seconds on my personal computer and home internet line. This is just too slow.
On the other hand, I can pre-emptively download the information from the API, extract what I need, cache the result in a “static” JavaScript file on my webserver and deliver it to the end client in just 100’s of milliseconds. And so this is how I plan to solve this problem, using the Tumblr static “Pages” to load a specially generated JavaScript file (or JSON or whatever) with the required “shuffled post information” and display it with a tiny amount of JavaScript.
This offers a better end experience to users.
Thoughts?
So, in writing my theme, I wanted a way to put a “Reblog” and “Like” link on each post on the main page of the blog without users having to “click-through” to the “/post” page, and use Tumblr’s silly <iframe> in the upper right corner.
Interesting. I discovered a similar thing, but at the end, ended up including the iframe for each single post, setting opacity: 0, and aligning/scaling it so that it matches my button positions. Does the desired effect, only until I realized I cannot highlight my heart button when the post is liked, because I don’t and can’t know if the post is liked. After some research, I found out that there IS a way to do it, only I don’t know how.
Edit: no, there seems to be no way. At least nobody has done it.
Right. The “reblog” is easy. The “Like” button is tricky — not to “make it work” but to show whether or not the Post is already “Liked” or not.
Reading the contents of Tumblr’s own iframe to determine, say, which image they are using couldgive the result, but most browsers today prohibit inspecting the embedded iframe’s HTML with JavaScript for security reasons. Similarly, you cannot load the iframe’s content with AJAX because of security restrictions. Perhaps with JSONP? I don’t know, haven’t tried to hack it out further. And then yes, any “solution” would still be an ugly hack, likely to break whenever Tumblr’s whimsy programmers decided to mix things up a bit.
What really needs to happen is to just incorporate these functions into the Tumblr Theme Engine. It would probably be like, a few hours work for some Tumblr employee to implement this.
I also thought about scanning the notes of every post to check if you have liked it. Terribly inefficient, but it should happen fast enough for posts with 0-20 notes. It would have to be disabled for posts with more than 100 notes (or at least scan only the first 100 ones). Also, it would put a lot of queries on the Tumblr servers.
Yes, this is not a very robust technique. And Tumblr doesn’t look kindly on “page scraping” in general. Nor is there a way in the Tumblr API to fetch more than the most recent 50 notes for a post — at all!
But who cares, if they don’t want this they better improve their support - I have never heard a story of a theme designer who got in touch with the tumblr programmers.
Oh — well I have at least tried to get in touch with the Tumblr folks, on several occaisons.
And at least on the Tumblr API Google Group, there is one Tumblr Employee (John Bunting) who monitors the discussion in the group and is able to provide some feedback. However, he seems fairly powerless in the overall Tumblr structure to get any *real* changes made, although he has been helpful in fixing some bugs, etc. (The Tumblr Theme Google Group seems to be completely unmoderated by any Tumblr employees).
I’ve also sent emails to the Tumblr staff a several times about bugs in the API and Theme engine, and requests for features, etc. I usually get what looks to be a “real response from a real human” back — but nobody ever follows through to fix any of the problems I mention.
On the whole, Tumblr seriously needs to improve their support for developers. This is means listening to feedback, answering questions, fixing bugs and problems quickly and promptly.
For now - it’s really a giant headache.
On Tuesday Night, my house caught fire. Everyone in my family is OK but a lot of our stuff is totally ruined. As you can imagine, this is very stressful. We’re staying with my uncle & aunt for now, but I have very limited internet access here. I will update everyone as soon as I can.
I added a few new updates / features to my Basic Tumblr Tag Cloud:
-
Added the ability to change the “case” of your tags to Lower-case, Upper-case, and Title-case for display purposes.
-
Improved the default “Alphabetical” sorting code to better handle non-English Latin-script languages.
-
Added “language” option to specify a language “locale”, which can improve Alphabetical sorting and Case transforming on Tags for many languages, including non-Latin-script languages.
These additions (and some other new neato new things) will also be added to the “Pretty” Tag Cloud in the next few days.
Also, I can always use more feedback from people. Please?
Fantastic to see this job up, I really wish I had the skills because I can’t imagine a more engaging job right now!
Yep! We’re looking for someone to help us hack on the API! Check it out! It’s gonna be fun ;)
I’d apply if I wasn’t 17 lol :P