Greasy Fork

kbin-unsquash

unsquash inline images in comments

目前为 2023-06-18 提交的版本。查看 最新版本

// ==UserScript==
// @name          kbin-unsquash
// @namespace     https://github.com/aclist/
// @description   unsquash inline images in comments
// @author        aclist
// @version       0.0.2
// @include       https://kbin.social/m/*
// @license       GNU-V3.0
// ==/UserScript==

const itemsSelector = 'figure a.thumb img';

function swapImg(item) {
  var p = item.parentElement.href;
  item.src = p;
  item.style.cssText += 'max-width: 50%; max-height: 50%';
}

function checkItems(selector) {
  const items = document.querySelectorAll(selector);
  items.forEach((item) => {
         swapImg(item);
  });
}

checkItems(itemsSelector);