Sleazy Fork is available in English.

NicePT大图

NicePT大图模式

  1. // ==UserScript==
  2. // @name NicePT大图
  3. // @description NicePT大图模式
  4. // @include *://www.nicept.net/*
  5. // @version 0.0.1
  6. // @run-at document-end
  7. // @grant none
  8. // @icon https://www.nicept.net/favicon.ico
  9. // @namespace https://greasyfork.org/users/461433
  10. // ==/UserScript==
  11. (function() {
  12. 'use strict';
  13. //图片宽度
  14. let newWidth = 446;
  15.  
  16. console.log('=== 开始检查 .embedded 元素 ===');
  17.  
  18. // 获取所有 .embedded 元素
  19. let embeddedElements = document.getElementsByClassName('embedded');
  20.  
  21. // 遍历每个 .embedded 元素
  22. Array.from(embeddedElements).forEach((embedded) => {
  23. // 获取 .embedded 元素的宽度
  24. let width = embedded.style.width || window.getComputedStyle(embedded).width;
  25.  
  26. // 如果 .embedded 元素的宽度是 46px
  27. if (width === '46px') {
  28. console.log('=== 找到宽度为 46px 的 .embedded 元素 ===');
  29.  
  30. // 获取第一个子元素(假设它是 img)
  31. let firstChild = embedded.children[0];
  32.  
  33. // 判断子元素是否存在,并且是图片(img)
  34. if (firstChild && firstChild.tagName.toLowerCase() === 'img') {
  35. // 获取图片的原始宽高
  36. let img = firstChild;
  37. // 修改图片的宽度和高度
  38. img.style.width = newWidth + 'px';
  39. //img.style.height = newHeight + 'px';
  40. //取消max
  41. img.style.maxWidth = 'none';
  42. img.style.maxHeight = 'none';
  43.  
  44. console.log('=== 修改了第一个元素(图片)宽度为 346px,并保持比例 ===');
  45. } else {
  46. console.log('=== 第一个子元素不是图片,跳过修改 ===');
  47. }
  48. }
  49. });
  50. })();