Image Full Resolution + Stretch
// ==UserScript==
// @name Emp: Image Full Resolution + Stretch
// @namespace http://tampermonkey.net/
// @version 1.5
// @description Image Full Resolution + Stretch
// @author bighype
// @include /^https:\/\/www\.empornium\.(me|sx|is)\/torrents\.php\?id=\d+/
// @grant none
// @license MIT
// ==/UserScript==
(function () {
'use strict';
// Stretch images and containers inside posts
const style = document.createElement('style');
style.textContent = `
.body img.bbcode:not(.icon) {
width: 100% !important;
height: auto !important;
max-width: none !important;
max-height: none !important;
}
/* Stretch tables and bbcode divs */
.main_column table,
.main_column div.bbcode {
width: 100% !important;
max-width: none !important;
}
`;
document.head.appendChild(style);
function fixLayoutContainers() {
document.querySelectorAll('.main_column table, .main_column div.bbcode')
.forEach(el => {
el.removeAttribute('width');
if (el.style.width) {
el.style.width = '100%';
}
});
}
function upgradeImages() {
document.querySelectorAll('img[src*="hamsterimg.net"]').forEach(img => {
let src = img.src;
let full = src
.replace('.md.jpg', '.jpg')
.replace('.th.jpg', '.jpg')
.replace('.md.jpeg', '.jpeg')
.replace('.th.jpeg', '.jpeg')
.replace('.md.png', '.png')
.replace('.th.png', '.png');
if (full !== src) {
img.src = full;
}
});
}
upgradeImages();
fixLayoutContainers();
})();