[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]

/8code/ - Infinite Code

Discussion about 8chan's codebase.

Catalog

Email
Comment *
File
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Options
Password (For file and post deletion.)

Allowed file types:jpg, jpeg, gif, png, webm, mp4, pdf
Max filesize is 8 MB.
Max image dimensions are 10000 x 10000.
You may upload 4 per post.


Rules and Info: https://8chan.co/8code/rules.html | Main Repository: https://github.com/ctrlcctrlv/8chan/ | Archive: http://8archive.moe/8code/

File: 1419091836187.webm (1.44 MB, 1680x948, 140:79, GrayLittleCranefly.webm)

d81c13 No.7

This is an issue I submitted to Github a while ago that sadly got ignored. When you are previewing an external thread, it seems all the thumbnails are also being downloaded. As you can imagine, this causes considerable delay when previewing a large thread.

I post here in the hope that someone can suggest a fix.

Link to the issue and relevant code:
https://github.com/ctrlcctrlv/8chan/issues/213
https://github.com/ctrlcctrlv/8chan/blob/master/js/post-hover.js

7ae872 No.8

>>7
Currently what happens is that the script polls the entire thread and caches it inside the DOM as a hidden node. Because it's stored in the DOM instead of a global JS variable, all the images are loaded from the thread.

My solution would be to consolidate each of the scripts to use a unified global JS map variable to store 8chan specific stuff and have all of the scripts just extend that variable as needed. THEN have a sub-map for the post-hover.js that stores cached threads for post hover.

Realistically, just storing in a global cached_threads variable or something would probably work. Would need to do some testing on that though.

d81c13 No.9

I did some tests on Chrome, and it appears that any jQuery operation done on the Ajax response will cause the images to be loaded into the browser.
Even though many parts of the code still baffles me, I think it's suffice to say the solution is to fetch the thread through the json api (e.g. https://8chan.co/8code/res/7.json), and reconstruct the needed post from that.

d81c13 No.10

Okay, I need some help. I can't for the life of me figure out what this "data-thread" link attribute is suppose to do or indicate.

d81c13 No.13

Hey y'all, long time no see. I have finally written the solution to this little problem, and now am in need of feedbacks and bug testing before submitting it as a PR.

To test it, just run the following code
http://pastebin.com/nuvehDT8

For previewing all posts in the current thread, the behavior reminds exactly the same.
For external posts though, due to the limitation of the JSON API, the preview will not contain things like youtube embeds or board flags.

7ae872 No.15

>>13
Did some tests and it seems to be working as intended. Good work m8. Will be using the script till it gets pulled upstream.

Here's an external file for it
load_js("https://dl.dropboxusercontent.com/u/18208651/8chan/post-hover-temp-fix.js");

9b2f3d No.37


9b2f3d No.38


9b2f3d No.39




[Return][Go to top][Catalog][Post a Reply]
Delete Post [ ]
[]
[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]