Show full size image in m.facebook.com

Show full size image in m.facebook.com, example site:"https://m.facebook.com/photo.php?fbid=...","https://m.facebook.com/.../photos/..."

当前为 2018-02-24 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Show full size image in m.facebook.com
// @namespace		m.facebook.com
// @include     /^https\:\/\/m\.facebook\.com\/(?:[0-9a-zA-Z\.]+\/photos\/[0-9a-zA-Z\.]+\/\d+|photo\.php\?fbid\=\d+)/
// @version     1
// @author      zero0evolution
// @description  Show full size image in m.facebook.com, example site:"https://m.facebook.com/photo.php?fbid=...","https://m.facebook.com/.../photos/..."
// ==/UserScript==

var getFullSizeImgLink = function(){

	for(let linkElem of document.querySelectorAll("a[href]")){

		if(linkElem.textContent.match(/^(?:全尺寸檢視|Full Size View)$/im)){
			console.log("找到fullSizeImgLink:",linkElem.href)
			return(linkElem.href)
		}
	}
	console.log("未找到fullSizeImgLink")
}


var showFullSizeImgFunc = function(){
	var showImgElem = document.querySelector(
		"img[class='img'],img[class='r']")
	if(showImgElem instanceof Element) {
		var fullSizeImgLink = getFullSizeImgLink()
		if(fullSizeImgLink){
			showImgElem.src = fullSizeImgLink
			showImgElem.style.width = "auto"
			showImgElem.style.maxWidth = "100%"
			showImgElem.style.height = "100%"
		}
	}
}

if(document.readyState === "loading"){
	document.addEventListener(
		"DOMContentLoaded",function(){
			showFullSizeImgFunc()
		}
	)
}
else{
	showFullSizeImgFunc()
}