// ==UserScript==
// @name noPIC 一键隐藏/显示全页面图片
// @version 3.1
// @description 隐藏图片和标题
// @author fxalll
// @match *://*/*
// @grant none
// @license MIT
// @run-at document-body
// @namespace https://greasyfork.org/users/1043548
// ==/UserScript==
(function () {
let active = false;
let currentX;
let currentY;
let initialX;
let initialY;
let xOffset = 0;
let yOffset = 0;
let startTime = 0
window.imgHidenSet = null;
window.imgShownSet = null;
let yanEmoji = [
"(‐^▽^‐)",
" ٩(๑òωó๑)۶",
" ヾ(≧?≦)〃",
" o(>ω<)o",
" ( ̄▽ ̄)ノ",
" ๑乛◡乛๑ ",
" (^_^)",
" (^▽^) ",
" ↖(ω)↗",
" (=-ω-=)",
" ٩(◕‿◕。)۶ ",
" \(☆o☆)/",
" (.) ",
" (-)",
" ლ(⌒▽⌒ლ)",
" ໒( ◔ ▽ ◔ )७",
" (o⌒.⌒o) ",
" ٩(ᴗ)۶ ",
"o(o)o",
" ︿( ̄︶ ̄)︿ ",
" (๑¯∀¯๑)",
" (~ ̄▽ ̄)~",
" (☆▽☆)",
" (p≧w≦q)",
" (/≧▽≦)/",
" ٩(๑❛ᴗ❛๑)۶",
" Y(o)Y",
" O(∩∩)O ",
" = ̄ω ̄=",
" (●^o^●) ",
"(★>U<★)",
" (★ᴗ★)",
"(;´д`)ゞ",
"(;д;)",
"(;へ:)",
"(╥╯╰╥)",
"╮(╯﹏╰)╭",
"╭(╯╰)╮",
"(╯︵╰)",
"(╯﹏╰)b",
"罒ω罒",
"( Ĭ ^ Ĭ )",
"(T_T)",
"(T▽T)",
"(ㄒoㄒ)",
"╥﹏╥",
"o(╥﹏╥)o",
"〒▽〒",
" (T_T) ",
"T^T",
"/(ㄒoㄒ)/~",
"(T ^ T) ",
"ε(┬┬﹏┬┬)3",
" o(TωT)o ",
"(〒︿〒)",
"T_T",
"┭┮﹏┭┮",
"ε(┬┬﹏┬┬)3 ",
"༼༎ຶᴗ༎ຶ༽",
"⊙︿⊙",
"⊙﹏⊙",
"(ó﹏ò。)",
" ̄へ ̄",
"~~o(>_<)o ~~",
"ɖීීϸ",
" (」゜ロ゜)」",
" (´⊙ω⊙`)!",
" щ(゜ロ゜щ) ",
" ༼∩·́ω·̀∩༽ ",
" ໒( ◑ w ◑ )७",
" ԅ༼ . º ʖ̯ º . ༽ง",
" (⊹◕ʖ̯◕)",
" ⊙▂⊙",
" ⋋⁞ ◔ ﹏ ◔ ⁞⋌ ",
" 乁໒( ͒ ⌂ ͒ )७ㄏ",
" Σ(っ°Д°;)っ",
" ╰(⊹◕◕ )╯",
" ╰[ ⁰﹏⁰ ]╯ ",
" ʕ⊙ᴥ⊙ʔ",
" 〳 ◔ Ĺ̯ ◔ 〵",
" (●´ω`●) ",
" ╰(”◕﹏◕”)つ",
" o͡͡͡╮༼ · ʖ̯ · ༽╭o͡͡͡ ",
"\(0)/",
" ໒( ” ͠° ʖ̫ °͠ ” )७",
" w(@。@;)w",
" (/。\) ",
" ヽ༼ ʘ ∧ ʘ ༽ᓄ",
" w(°o°)w",
" (°д°) ",
"(∩◕(oo)◕∩ ) ",
" (゜ロ゜) ",
" ༼ノ۞⌂۞༽ノ",
"(゜д゜)",
"༼ ಠ ▃ ಠೃ ༽ ",
" ʕ ᓀ ᴥ ᓂ ʔ",
" ⋋╏ ᓀ 〜 ᓂ ╏⋌",
" ╚═| ~ ಠ ₒ ಠ ~ |═╝",
" ╭(๑¯д¯๑)╮",
" ୧( ಠ Д ಠ )୨",
" ᕦ໒( ⊡ 益 ⊡ )७ᕤ",
" (눈눈)",
" <(-︿-)>",
" ╰༼ ⋋ ‸ ⋌ ༽╯",
" (◣◢)",
" ╰| ⁰ ෴ ⁰ |╯ ",
" (o˘д˘)o ",
" (╬·᷅д·᷄╬)",
" (๑‾᷆д‾᷇๑)",
" o(≧o≦)o",
" [ ಠ □ ಠೃ ] ",
" (╯-_-)╯╧╧ ",
" ᕦ໒( ᴼ 益 ᴼ )७ᕤ",
" c༼ ” ͡° ▃ °͡ ” ༽ᕤ",
" ꒰╬·᷅д·᷄╬꒱",
"╰_ ╯",
"(艹皿艹)",
"(▼ヘ▼#)",
"c〳 ݓ ﹏ ݓ 〵੭",
" o(╥﹏╥)o ",
" ╭(ʘ̆◞౪◟ʘ̆)╮",
" ┏། ﹒ _ ﹒ །┓",
" ┌(▀Ĺ̯▀)┐ ",
" ┌༼◉ل͟◉༽┐",
" (▰˘︹˘▰)",
" (ㄒoㄒ) ",
" (iДi)",
" c( ˵ ╥ ͟ʖ ╥ ˵ )੭",
" ┭┮﹏┭┮",
" ┌(▀Ĺ̯ ▀-͠ )┐",
" ┌໒( : ⊘ ⊘ : )७┐",
" ᗜੂͦ﹏ᗜੂͦ ",
"┌〳 ・ o ・ 〵┐",
" ┌[ ◔ ͜ ʖ ◔ ]┐",
" ੧║ ☯ ⌂ ☯ ║┐",
" ┌། ☯ ʖ ☯ །┐",
" ┌〳 ۞ ﹏ ۞ 〵┐ ",
"┌╏ º □ º ╏┐ ",
" ༼ ╥ ل ╥ ༽ ",
"(︶︹︺) ",
" ┏(--)┓",
"┏(--)┛┗(-- )┓",
" ͼ(ݓ_ݓ)ͽ",
" (╯︵╰,) ",
" (⋟﹏⋞)",
"(-^〇^-)",
" (▰˘o˘▰)",
" ヾ(。 ̄□ ̄)ツ ",
" ヾ( ̄□ ̄;)ノ ",
" (*-ω-) ",
" (∪。∪)。。。zzz",
" (ᴗ˳ᴗ)",
" \(o ̄∇ ̄o)/ ",
" (≚ᄌ≚)ƶƵ ",
"\(´O`)/",
" ✾꒡ .̮ ꒡✾",
" ƪ(‾ ̄o ̄”)ʃ ",
" -O-",
" ∑( ̄□ ̄)",
" π_π",
" [(--)]zzz",
" ( ̄o ̄) . z Z",
" (˴́³[▒]꒱⌕˚º꒰…꒱",
"凸( ·̀·́ )凸",
" ᕕ༼ ՞ ͜ʖ ՞ ༽凸",
" ༼凸 ◉◔༽凸",
" ໒( ·̀ ◡ ·́ )७┌∩┐",
" ╭∩╮◕ل͜◕)╭∩╮",
" 凸༼ຈل͜ຈ༽凸",
" ┌∩┐༼ ºل͟º ༽┌∩┐",
" 凸(⊙▂⊙✖ )",
" ╭∩╮ʕ·ᴥ·ʔ╭∩╮",
" 凸( ·̀ 3 ·́ )凸",
" 凸〳 ಥ ڡ ಥ 〵凸",
" ┌∩┐(◕◡◉)┌∩┐",
" t( -_- t )",
" ᕕ╏ ͡ᵔ ‸ ͡ᵔ ╏凸",
" ٩║ ✿ ᴼ ل ᴼ ✿ ║┌∩┐",
" ╭∩╮໒(✪ਊ✪)७╭∩╮",
" ໒( ͡; 益 ͡; )७┌∩┐",
" ᕕ໒( * ◕ ڡ ◕ * )७╭∩╮",
" ╭∩╮( ͡° ل͟ ͡° )╭∩╮",
" ╭∩╮(ಠಠ)╭∩╮",
"░ ∗ ◕ ں ◕ ∗ ░ ",
" (V●ᴥ●V) ",
" ༼ つ ◕◕ ༽つ",
" ༼∩·́ω·̀∩༽ ",
" ʕ ᓀ ᴥ ᓂ ʔ",
" (⊙ᗜ⊙) ",
" ╰། ❛ ڡ ❛ །╯ ",
" ヽ༼ ் ▽ ் ༽╯ ",
" ⋋| ՞ ‸ ՞ |⋌ ",
"ヽ(╯▽╰)ノ ",
" (⊃。·́‿·̀。)⊃",
" ⋋| ՞ ‸ ՞ |⋌",
" ლ ( ◕ ᗜ ◕ ) ლ",
" ʕ⊙ᴥ⊙ʔ",
" (⊹つ··⊹)つ",
" ༼∩·́ω·̀∩༽ ",
" ⋋( ◕ ∧ ◕ )⋌",
" ʕ ⊃・ ◡ ・ ʔ⊃",
" ʕ༼◕ ౪ ◕✿༽ʔ",
" ୧ʕ ⇀ ⌂ ↼ ʔ୨",
" [ ಠ (oo) ಠ ]",
" s( ^ ‿ ^)-b",
" ▓⚗⚗▓",
" ୧། ☉ ౪ ☉ །୨",
" ヽ໒(☯_☯✿)७ノ",
" ╏ ·́ – ·̀ ╏",
" @( ◕ x ◕ )@",
" (°ヮ°)",
" ༼☯﹏☯༽ ",
" ୧| ⁰ ᴥ ⁰ |୨",
"ᕙ། ◕ – ◕ །ᕗ",
" ᕦ[ ◔ (oo) ◔ ]ᕤ ",
" ᕙ( * ·̀ ᗜ ·́ * )ᕗ",
" ᕦʕ ° o ° ʔᕤ ",
" ᕙ༼ຈل͜ຈ༽ᕗ ",
" ᕙ[ ˵ ͡’ ω ͡’ ˵ ]ᕗ ",
" ᕙ( ͡◉ ͜ ʖ ͡◉)ᕗ",
" ᕙ( ͡° ͜ʖ ͡°)ᕗ",
" ᕙʕ ◖ ڡ ◗ ʔᕗ",
" ୧╏ ՞ _ ՞ ╏୨",
" ᕙ༼◕◞౪◟◕༽ᕗ",
" ᕦ╏ ¬ ʖ̯ ¬ ╏ᕤ",
" ᕦ( ̿ ﹏ ̿ )ᕤ",
" ᕦ( ⊙ ∧ ⊙ )ᕤ",
" ᕙ(⇀∏↼)ᕗ",
" ᕙ▐ ° ◯ ° ▐ᕗ",
" ᕦ༼ ~ ·́ ₒ ·̀ ~ ༽ᕤ",
" ᕦ| º ෴ º |ᕤ",
" ᕦ( ⊙ ∧ ⊙ )ᕤ",
" ᕙ▐ ° ◯ ° ▐ᕗ",
" ᕙ༼◕ ᴥ ◕༽ᕗ",
" ᕦ⊙෴⊙ᕤ",
" ᕙ། – ڡ – །ᕗ",
"ヾ(=・ω・=)o",
"( ̄. ̄)",
"( ̄︶ ̄)↗",
" ̄ω ̄=",
"o( ̄▽ ̄)d ",
"( ̄3 ̄)a ",
" ̄▽ ̄",
"╮( ̄▽ ̄)╭",
"b( ̄▽ ̄)d",
"(~o ̄3 ̄)~ ",
"( ̄︶ ̄)/ ",
"∠( °ω°)/ ",
"(灬°ω°灬) ",
"(o°ω°o)",
"┗(·ω·;)┛",
"ヽ(·ω·。)ノ",
"(๑·ω·๑)",
"(๑Ő௰Ő๑)",
"(❦ω❦)",
"ヽ(ω)ノ ",
" (〃ω) ",
"(❁´3`❁)",
"ヾ(ΦωΦ)ツ",
"(๑╹っ╹๑)",
"(.ω.)",
"( :3 )",
"(·ᴗ·)",
"。◕ᴗ◕。",
"ლ(^ω^ლ)",
"ლ(❛◡❛✿)ლ",
"ლ(⁰⊖⁰ლ)",
"ლ(|||⌒εー|||)ლ"
]
let randomNumSet;
let imgHiden = function() {
try {
document.querySelectorAll(".RichContent-cover-inner").forEach((e)=>e.style.visibility="hidden")
} catch {}
try {
document.querySelectorAll(".ZVideoRecommendationItem-thumbnailImage").forEach((e)=>e.style.visibility="hidden")
} catch {}
try {
document.querySelectorAll(".QuestionHeader-title").forEach((e)=>e.style.visibility="hidden")
} catch {}
try {
document.querySelectorAll("iframee").forEach((e)=>e.style.visibility="hidden")
} catch {}
try {
document.querySelectorAll("img").forEach((e)=>e.style.visibility="hidden")
} catch {}
};
let imgShown = function() {
try {
document.querySelectorAll(".RichContent-cover-inner").forEach((e)=>e.style.visibility="visible")
} catch {}
try {
document.querySelectorAll(".ZVideoRecommendationItem-thumbnailImage").forEach((e)=>e.style.visibility="visible")
} catch {}
try {
document.querySelectorAll(".QuestionHeader-title").forEach((e)=>e.style.visibility="visible")
} catch {}
try {
document.querySelectorAll("iframee").forEach((e)=>e.style.visibility="visible")
} catch {}
try {
document.querySelectorAll("img").forEach((e)=>e.style.visibility="visible")
} catch {}
};
let handleButtonClick = function(){
if (window.imgHidenSet === null) {
clearInterval(window.imgShownSet);
window.imgShownSet = null;
imgHiden()
saveStorageList()
window.imgHidenSet = setInterval(function(){
imgHiden();
}, 1000)
} else {
clearInterval(window.imgHidenSet);
window.imgHidenSet = null;
imgShown()
deleteStorageList()
window.imgShownSet = setInterval(function(){
imgShown();
}, 1000)
}
}
let noDetectStorageList = function() {
if (localStorage.getItem('nopicValueList') !== null) {
let valueList = localStorage.getItem('nopicValueList').split(',');
if (valueList.indexOf(location.host) === -1) return true;
} else {
localStorage.setItem('nopicValueList',['fxalll'])
return true;
}
return false;
}
let saveStorageList = function() {
if (noDetectStorageList()) {
let valueList = localStorage.getItem('nopicValueList').split(',');
valueList.push(location.host);
localStorage.setItem('nopicValueList',valueList)
}
}
let deleteStorageList = function() {
if (!noDetectStorageList()) {
let valueList = localStorage.getItem('nopicValueList').split(',');
valueList = valueList.filter(function(value) { return value !== location.host});
localStorage.setItem('nopicValueList',valueList)
}
}
// 自动隐藏图片
if (!noDetectStorageList()) {
imgHiden();
window.imgHidenSet = setInterval(function(){
imgHiden();
}, 300)
}
let button = document.createElement('div')
button.innerText = "◀"
button.setAttribute("id", "myButton");
button.style.color = "#0000007d"
button.style.padding = "10px 15px"
button.style.position = "fixed"
button.style.bottom = "20px"
button.style.right = "3px"
button.style.textAlign = "center"
button.style.alignContent = "center"
button.style.background = "#97979759"
button.style.borderRadius = "15px"
button.style.border = "2px solid #0000007d"
button.style.cursor = "pointer"
button.style.transform = "translate3d(30%,0,0)"
button.style.transition = "0.1s"
button.style.backdropFilter = "saturate(180%) blur(20px)"
button.style.zIndex = "99999999999999999999999999999"
// 添加鼠标悬停效果
button.addEventListener('mouseover', mouseover);
button.addEventListener('mouseout', mouseout);
// 鼠标拖拽
button.addEventListener('mousedown', dragStart, false);
//button.addEventListener('mouseup', dragEnd, false);
//button.addEventListener('mouseout', dragEnd, false);
function mouseover() {
// 当鼠标悬停在元素上时,改变元素的样式
button.style.boxShadow = "0 0 10px rgba(0, 0, 0, 0.5)"; /* 鼠标悬停时的阴影效果 */;
button.style.background = "#0000004a"
button.style.color = "#ffffff"
button.innerText = "图片显隐"
button.style.transform = "translateX(0px)"
button.style.border = "2px solid #ffffff"
setTranslate(0+"%",currentY+"px",button);
}
function mouseout() {
// 当鼠标离开元素时,恢复元素的样式
button.style.boxShadow = '';
button.style.background = "#97979759"
button.style.color = "#0000007d"
button.innerText = "◀"
button.style.transform = "translateX(30%)"
button.style.border = "2px solid #0000007d"
setTranslate(30+"%",currentY+"px",button);
}
function dragStart(e) {
//记录点击事件,防止拖拽触发点击事件
startTime = e.timeStamp
//initialX = e.clientX - xOffset;
initialX = e.clientX;
initialY = e.clientY - yOffset;
//写外面会导致鼠标一快拖拽就失效了,把拖拽事件写到点击里面,事件处理函数添加到 document 上,而非目标元素上,让 mousemove事件在有延迟的情况下仍然可以被响应
document.addEventListener('mousemove', drag);
document.addEventListener('mouseup', dragEnd, false);
// 阻止默认事件
e.preventDefault();
randomNumSet = Math.round(Math.random()*(yanEmoji.length-1))
}
function dragEnd(e) {
if (startTime) {
let diffTime = e.timeStamp - startTime
diffTime < 150 && handleButtonClick() //小于150就执行单击操作
startTime = 0
}
initialX = currentX;
initialY = currentY;
mouseout();
document.removeEventListener('mousemove', drag);
}
function drag(e) {
changeFace(randomNumSet,button);
button.style.color = "#ffffff91"
button.style.border = "4px dashed rgb(255 255 255 / 49%)"
e.preventDefault();
currentX = e.clientX - initialX;
currentY = e.clientY - initialY;
xOffset = currentX;
yOffset = currentY;
setTranslate(currentX+"px", currentY+"px", button);
}
function setTranslate(xPos, yPos, el) {
el.style.transform = "translate3d(" + xPos + ", " + yPos + ", 0)";
//el.style.transform = "translate3d(" + xPos + "px, " + yPos + "px, 0)";
}
function changeFace(randomNum,el) {
el.innerText = yanEmoji[randomNum]
}
document.body.appendChild(button);
})()