Skip to content

Instantly share code, notes, and snippets.

@ITJesse
Last active May 8, 2019 12:52
Show Gist options
  • Save ITJesse/f13a119e59b5d95f8d9ea8ebe103fef7 to your computer and use it in GitHub Desktop.
Save ITJesse/f13a119e59b5d95f8d9ea8ebe103fef7 to your computer and use it in GitHub Desktop.
Exhentai Preview Image
// ==UserScript==
// @name Exhentai Preview Image
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://exhentai.org/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const items = document.querySelectorAll('tr')
items.forEach(el => {
const div = el.querySelector('.gl3c')
if (!div) {
return
}
const img = el.querySelector('.glthumb img')
const text = el.querySelector('.glthumb').innerHTML
let newImg
if (img) {
newImg = img.cloneNode()
} else {
const src = '/' + text.split('~')[2]
newImg = document.createElement('img')
newImg.src = src
}
if (newImg.src.startsWith('data')) {
newImg.src = newImg.dataset.src
}
div.insertBefore(newImg, div.childNodes[0])
div.style = 'height: auto;'
const link = el.querySelector('.gl3c a')
link.removeAttribute('onmouseover')
link.setAttribute("target", "_blank");
div.removeAttribute('onmouseover')
})
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment