Anonymous ID: baed39 Sept. 4, 2021, 3:45 a.m. No.88521   🗄️.is 🔗kun   >>8522 >>8523

TADA

JavaScript so that images work without refresh.

I don't fully like it, because it gets triggered too often, but I can't find a batter and working event right now.

 

window.addEventListener("scroll", LoadListener, false);

 

function LoadListener() {

var links = Array.from(document.querySelectorAll('a'))

var imageLinks = links.filter(l =/.media.8kun.top./ig.test(l.href))

imageLinks.forEach(link ={

var pieces = link.href.split('/')

var filename = pieces[pieces.length-1]

var [hash, extension] = filename.split('.')

var href = ${link.href.replace("media.","sys.")}/${hash}.jpg

var imgs = link.querySelectorAll('img')

imgs.forEach(i =i.src = href)

link.href = href

})

}

Anonymous ID: baed39 Sept. 4, 2021, 5:37 a.m. No.88530   🗄️.is 🔗kun   >>8531 >>8532 >>8557 >>8666

video preview works now, playing doesn't, because it still wants to access media.8kun.top

 

You can however click on the left link above the video and open in a new video for it to play.

 

window.addEventListener("scroll", LoadListener, false);

 

function LoadListener() {

var links = Array.from(document.querySelectorAll('a'))

var imageLinks = links.filter(l =/.media.8kun.top./ig.test(l.href))

imageLinks.forEach(link ={

var pieces = link.pathname.split('/')

var filename = pieces[pieces.length-1]

var [hash, extension] = filename.split('.')

switch (extension) {

case "mp3":

case "png":

case "gif":

var href = ${link.href.replace("media.","sys.")}/${hash}.jpg

break;

case 'php':

if (hash == 'player') {

// special handling for video thumbnail

var videoplayer = link.search.match(/media.8kun.top\/file_store\/(\w{64})./i)

if (videoplayer) {

var href = "https://sys.8kun.top/file_store/thumb/"+videoplayer[1]+".jpg";

} else {

var href = link.url;

}

}

break;

default:

var href = ${link.href.replace("media.","sys.")}

break;

}

var imgs = link.querySelectorAll('img')

imgs.forEach(i =i.src = href)

link.href = href

})

}

Anonymous ID: baed39 Sept. 4, 2021, 11:11 a.m. No.88562   🗄️.is 🔗kun   >>8564 >>8566 >>8618

>>88561

this here:

 

window.addEventListener("scroll", LoadListener, false);

 

function LoadListener() {

var links = Array.from(document.querySelectorAll('a'))

var imageLinks = links.filter(l =/.media.8kun.top./ig.test(l.href))

imageLinks.forEach(link ={

var pieces = link.pathname.split('/')

var filename = pieces[pieces.length-1]

var [hash, extension] = filename.split('.')

switch (extension) {

case "mp3":

case "png":

case "gif":

var href = ${link.href.replace("media.","sys.")}/${hash}.jpg

break;

case 'php':

if (hash == 'player') {

// special handling for video thumbnail

var videoplayer = link.search.match(/media.8kun.top\/file_store\/(\w{64})./i)

if (videoplayer) {

var href = "https://sys.8kun.top/file_store/thumb/"+videoplayer[1]+".jpg";

} else {

var href = link.url;

}

}

break;

default:

var href = ${link.href.replace("media.","sys.")}

break;

}

var imgs = link.querySelectorAll('img')

imgs.forEach(i =i.src = href)

link.href = href;

})

}

 

Only applies that weird URL glitch fix for the extensions where it's needed too, as in png, gif and mp3. Can't test mp3, because I can't upload mp3s, i have no idea how other anons do it successfully.

Anonymous ID: baed39 Sept. 4, 2021, 11:25 a.m. No.88565   🗄️.is 🔗kun

>>88561

mine also removes the code that intentionally breaks caching on browsers. I don't know why it's there. It causes every image to get reloaded every time, so if you refresh the page, the browser will reload every single image every single time, which means more server load for sys.8kun.top and more internet traffic for you.

Anonymous ID: baed39 Sept. 4, 2021, 12:04 p.m. No.88575   🗄️.is 🔗kun   >>8577

works now?

the scripts sometimes scroll themselves and then it works fully automatically.

new_post event can't really get used, because that fucks more stuff up.

And I'm confused on the video playing code, somehow there is a variable url still pointing to media.8kun.top, although I changed every element to sys.8kun.top, and I can't figure out where it's set. This is so weird.

 

If only silly JavaScript had an event for element creation, like video creation. I could hook in and boom done, but nope.

Anonymous ID: baed39 Sept. 4, 2021, 12:27 p.m. No.88582   🗄️.is 🔗kun

It seems DOMContentLoaded event isn't triggered, although it should, well events in regards of dynamic page updates are not really defined.

If I had a better event for this, it seems there is a videosSetup function called via onready(function(){ and that seems to trigger immediately.

Anonymous ID: baed39 Sept. 4, 2021, 12:32 p.m. No.88585   🗄️.is 🔗kun   >>8587

>>88577

try this:

 

document.addEventListener("scroll", LoadListener, false);

 

function LoadListener() {

var links = Array.from(document.querySelectorAll('a'))

var imageLinks = links.filter(l =/.media.8kun.top./ig.test(l.href))

imageLinks.forEach(link ={

var pieces = link.pathname.split('/')

var filename = pieces[pieces.length-1]

var [hash, extension] = filename.split('.')

switch (extension) {

case "mp3":

case "png":

case "gif":

var href = ${link.href.replace("media.","sys.")}/${hash}.jpg

break;

case 'php':

if (hash == 'player') {

// special handling for video thumbnail

var videoplayer = link.search.match(/media.8kun.top\/file_store\/(\w{64})./i)

if (videoplayer) {

var href = "https://sys.8kun.top/file_store/thumb/"+videoplayer[1]+".jpg";

} else {

var href = link.url;

}

}

break;

default:

var href = ${link.href.replace("media.","sys.")}

break;

}

var imgs = link.querySelectorAll('img')

imgs.forEach(i =i.src = href)

link.href = href;

})

}

Anonymous ID: baed39 Sept. 4, 2021, 1:12 p.m. No.88599   🗄️.is 🔗kun   >>8602 >>8616

>>88595

please try this:

 

{

 

var loadListener = function() {

var links = Array.from(document.querySelectorAll('a'))

var imageLinks = links.filter(l =/.media.8kun.top./ig.test(l.href))

imageLinks.forEach(link ={

var pieces = link.pathname.split('/')

var filename = pieces[pieces.length-1]

var [hash, extension] = filename.split('.')

switch (extension) {

case "mp3":

case "png":

case "gif":

var href = ${link.href.replace("media.","sys.")}/${hash}.jpg

break;

case 'php':

if (hash == 'player') {

// special handling for video thumbnail

var videoplayer = link.search.match(/media.8kun.top\/file_store\/(\w{64})./i)

if (videoplayer) {

var href = "https://sys.8kun.top/file_store/thumb/"+videoplayer[1]+".jpg";

} else {

var href = link.url;

}

}

break;

default:

var href = ${link.href.replace("media.","sys.")}

break;

}

var imgs = link.querySelectorAll('img')

imgs.forEach(i =i.src = href)

link.href = href;

})

}

 

$(window).on('scroll', function (e, post) {

loadListener();

});

}

Anonymous ID: baed39 Sept. 4, 2021, 1:24 p.m. No.88605   🗄️.is 🔗kun   >>8606 >>8612

>>88604

>played before JS change

before mine? For me the click didn't even work anymore, instead the thumbnail was opened in a new window, aka completely broken

 

With my JS, the thumbnail works, video plays when using the upper left link. not when just clicking.

Anonymous ID: baed39 Sept. 4, 2021, 2:23 p.m. No.88614   🗄️.is 🔗kun

>>88612

yes, I would like to fix video playback completely.

 

At least I now see what's going on.

It was written in a way that a click-handler (handles clicking on a video) remembers the URL that was set back when the handler was established, so me changing the links afterwards doesn't change the events anymore.

 

So this is either impossible to fix, or gets really tricks. Maybe I can sneak myself in, we will see.

 

If only there was some custom video handler for this.

Anonymous ID: baed39 Sept. 4, 2021, 3:20 p.m. No.88622   🗄️.is 🔗kun   >>8625

>>88618

You have to click on upper left link, the player itself doesn't work, but it doesn't work with any modification atm.

The preview image works with the latest code, but doesn't work with that other code.