[ / / / / / / / / / / / / / ] [ dir / b2 / choroy / dempart / fast / games / hikki / ita / orthodox ]

/8code/ - Infinite Code

Discussion about 8chan's codebase.
Winner of the 80rd Attention-Hungry Games
/otter/ - Otter For Your Soul

May 2019 - 8chan Transparency Report
Comment *
Password (Randomized for file and post deletion; you may also set your own.)
* = required field[▶ Show post options & limits]
Confused? See the FAQ.

Allowed file types:jpg, jpeg, gif, png, webm, mp4, pdf
Max filesize is 16 MB.
Max image dimensions are 15000 x 15000.
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)

aa0d60  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:

aa0d60  No.8

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.

aa0d60  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.

aa0d60  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.

aa0d60  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

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.

aa0d60  No.15

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

aa0d60  No.37

aa0d60  No.38

aa0d60  No.39

[Return][Go to top][Catalog][Nerve Center][Cancer][Post a Reply]
Delete Post [ ]
[ / / / / / / / / / / / / / ] [ dir / b2 / choroy / dempart / fast / games / hikki / ita / orthodox ]