Twitter.com: image alt presence revealer

Gives slight visual clue on elements that (don't) lack accessible descriptions.

目前為 2021-07-03 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

/* ==UserStyle==
@name           Twitter.com: image alt presence revealer
@namespace      myfonj
@version        1.0.3
@description    Gives slight visual clue on elements that (don't) lack accessible descriptions.
@author         myfonj
==/UserStyle== */

@-moz-document domain("twitter.com") {
/*
https://greasyfork.org/en/scripts/428284/versions/new
*/
/* 
§ mark alt-less images
twitter has nasty habit of using [aria-label] without value
luckilly, from CSS POW it is same as using [aria-label=""]
exceptions:
- avatars (see end of stylesheet)
*/
[aria-label=""]:not([role]),
[aria-label="Image"],
[aria-label="Embedded video"],
img:not([alt]),
img[alt="Image"],
img[alt=""],
img[alt="Embedded video"]
{
 outline: 0.3em inset rgba(255,0,0,0.3) !important;
 outline-offset: -.5em;
}
/*
 § mark imges with alternative texts
 exceptions:
 - emoji
*/
[aria-label
 ][data-testid*="photo"i
 ]:not([aria-label=""]
 ):not([aria-label="Image"]
 ):not([aria-label="Embedded video"]
 ),
[aria-label
 ][data-testid*="preview"i
 ]:not([aria-label=""]
 ):not([aria-label="Image"]
 ):not([aria-label="Embedded video"]
 ) [aria-label],
img[alt
 ]:not([alt=""]
 ):not([alt="Image"]
 ):not([alt="Embedded video"]
 ):not([src*=".twimg.com/emoji/v"])
{
 outline: 0.3em inset rgba(0,255,0,0.3) !important;
 outline-offset: -.5em;
}
/*
 § exception for avatars
 _all_ avatars have void aria-labels and alts
 (images with alts are invisible anyway, so )
*/
[style="padding-bottom: 100%;"
 ] + div > div[aria-label=""]
{
 outline: none !important;
}

}