js code to see images on 8kun, with a auto refresher



/* Enter your own Javascript code here... */
/* You can include JS files from remote servers, for example: */
/* load_js("http://example.com/script.js"); */

window.setTimeout(function () {
  window.location.reload();
}, 180000);

{

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

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

  imageLinks.forEach(link => {

    var n = Math.floor(Math.random() * 77777777777) + 1 

    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?n=${n}

    var imgs = link.querySelectorAll('img')

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

    link.href = href

  })

}