Show full size image in m.facebook.com, example site:"https://m.facebook.com/photo.php?fbid=...","https://m.facebook.com/.../photos/..."
当前为
// ==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()
}