zFrontier帖子显示大图

zFrontier帖子图片替换为大图

目前为 2020-12-26 提交的版本。查看 最新版本

// ==UserScript==
// @name         zFrontier帖子显示大图
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  zFrontier帖子图片替换为大图
// @author       mlch911
// @match        https://www.zfrontier.com/app/flow/*
// @grant        GM_registerMenuCommand
// @grant        GM_getValue
// @grant        GM_setValue
// ==/UserScript==

(function () {
	'use strict';
	let max_width_key = 'max-width'

	function switchImg() {
		var max_width = GM_getValue(max_width_key)
		if (max_width == null) {
			max_width = '150%'
			GM_setValue(max_width_key, max_width)
		}

		var pic = $('.gallery-pic img')
		if (pic.length > 0) {
			pic.each(function () {
				var large_img = $(this).attr("large")
				if (large_img.length > 0 && large_img != $(this)) {
					if ($(this).attr("lazy") != 'loaded') {
						setTimeout(function () {
							switchImg()
						}, 100)
						return
					} else {
						if ($(this).attr('src') != large_img) {
							$(this).attr('src', large_img)
							$(this).css('max-width', max_width)
							$(this).parent().css('overflow', 'inherit')
						}
					}
				}
			})
		}
	}

	$('.left-side').ready(function () {
		setTimeout(function () {
			switchImg()
		}, 500)
	})

	function AddCustomStyle() {

	}

	AddCustomStyle();
	try {
		GM_registerMenuCommand('脚本设置', function () {
			document.querySelector("#sp-ac-content").style.display = 'block';
		});
	} catch (e) {}
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址