Open Rigel88 opened 9 years ago
The code for this is in js/post-hover.js
and I took a little bit of time to see how easy this would be. Doesn't look like it will be.
It all runs on jQuery but it takes zero advantage of any of jQuery's better utility. It was designed on a lot of assumptions based mainly around the idea that it barely works. There's also hacks I don't even understand, like this:
// at some point around 28/29th of Jan, 2015; all the newly generated thumbnails switched to using jpg
// this is a quick hack to ensure that external preview (mostly) works with old and new posts
// Note: please update if a more accurate timestamp is known
if (data.last_modified > 1422489600) {
this.ext = '.jpg';
} else {
if (this.ext === '.webm' || this.ext === '.mp4' || this.ext === '.jpeg') {
this.ext = '.jpg';
}
}
I think this is worth doing but it'll take a few hours to be done right.
@8n-tech
Haha I wrote that bit. Basically before that date, png files will have png thumbnails, gif with gif thumbnails... etc. Afterwards if was changed so that all thumbnails uses the .jpg
extension. The site's API does not contain the URL of the thumbnail image, so it has to be reconstructed from the post timestamp and the file extension.
The hack was put in place because a lot of the slow boards still have posts from months ago, and this ensures that their thumbnails will load correctly when previewed from another thread.
@marktaiwan Oh wow, this is from 8chan era? I thought it was going to be from years ago.
If you're familiar with the code, do you think this issue would be easy to do?
@8n-tech Eh... I really wouldn't know until it's actually done. I'm afraid I'm not familiar with the post hovering part, I only touched the external post part.
It all runs on jQuery but it takes zero advantage of any of jQuery's better utility. It was designed on a lot of assumptions based mainly around the idea that it barely works.
I don't agree with this. People constantly rip on 8chan's JavaScript because it's all in separate files, some of it is inconsistent due to different authors and they're not used to the build system but most of the scripts are fast and work well.
I'll think about it OP. It doesn't seem very difficult to me and seems like a very useful feature to have.
https://github.com/ctrlcctrlv/infinity/commits/master/js/post-hover.js
the code is actually from march 2012, when there was some opposition to integrating jquery with tinyboard
It's basically a killer feature, once you get a little used to it, it's painful to go back.
It's been done on other tinyboard fork, called fukuro https://github.com/twiforce/fukuro (see post-hover-tree.js) Only it's not directly backwards-compatible with default tinyboard (some things are broken, specifically OP post not loading in floating post), and missing some features (specifically image expansion).
It would be nice to have alternate post-hovering script that would allow hovering posts not to move with cursor and remain on screen as long as cursor is inside the hovering post form (to allow copying text, expanding images, recursively hovering other posts, etc), like it's done on some other imageboard engines (e.g. 2ch.hk/b/).