MozTW 討論區
https://forum.moztw.org/

請問Adblock plus及Element Hiding Helper for Adblock Plus可否萬用字元
https://forum.moztw.org/viewtopic.php?f=11&t=41093
1 頁 (共 1 頁)

發表人:  rubcandy0208 [ 2014-06-11, 11:11 ]
文章主題 :  請問Adblock plus及Element Hiding Helper for Adblock Plus可否萬用字元

例如我想過濾以下規則:
s.yimg.com###ydcm-579482007410
可以想像的是579482007410是會隨機產生的,光是加上面規則沒什麼用,如果可以用萬用字元,如
s.yimg.com###ydcm-*
應該就可以防止隨機產生的變數,可是目前為止
請問Adblock plus及Element Hiding Helper for Adblock Plus是不能萬用字元表示的,為什麼作者沒想到這個盲點呢?

發表人:  aaaa007cn [ 2014-06-14, 17:29 ]
文章主題 :  Re: 請問Adblock plus及Element Hiding Helper for Adblock Plus可否萬

代碼:
s.yimg.com##*[id^="ydcm-"]


參考 https://adblockplus.org/en/filters#elemhide
引言回覆:
Attribute selectors

Some advertisers don't make it easy for you — their text advertisements have neither an id nor a class attribute. You can use other attributes to hide those, for example ##table[width="80%"] will hide tables with width attribute set to 80%. If you don't want to specify the full value of the attribute, ##div[title*="adv"] will hide all div elements with title attribute containing the string "adv". You can also check the beginning and the end of an attribute, for example ##div[title^="adv"][title$="ert"] will hide div elements with title starting with "adv" and ending with "ert". As you see, you can also use multiple conditions — table[width="80%"][bgcolor="white"] will match tables with width attribute set to 80% and bgcolor attribute set to white.


以及 https://adblockplus.org/en/filter-cheatsheet#elementselection

發表人:  rubcandy0208 [ 2014-06-20, 11:05 ]
文章主題 :  Re: 請問Adblock plus及Element Hiding Helper for Adblock Plus可否萬

謝啦,研究看看,雖然有點難。
請問s.yimg.com##*[id^="ydcm-"]
其中*是什麼意思,我網官網看範例,好像沒有這個

發表人:  aaaa007cn [ 2014-06-20, 22:37 ]
文章主題 :  Re: 請問Adblock plus及Element Hiding Helper for Adblock Plus可否萬

abp的元素隱藏規則本質上是給相關站點插入 user css
給由 css selector 指定的元素設置 display:none!important;
而那個 * 在 css selector 中表示匹配所有元素

可以參考 https://adblockplus.org/en/filters#elemhide 中這段
引言回覆:
The first advertisement above is contained inside a div element with class attribute "textad". The following rule will hide exactly this combination: ##div.textad. Here ## marks an element hiding rule while the rest is a selector identifying the elements that need to be hidden. You can hide elements by their id attribute similarly, ##div#sponsorad will hide the second advertisement. You don't need to specify the element name, the rule ##*#sponsorad will work just as well. And you can hide elements by element name only, e.g. ##textad for the third advertisement.


更進一步的請參考 css selector
比如
http://www.w3schools.com/CSSref/css_selectors.asp
https://developer.mozilla.org/docs/Web/Guide/CSS/Getting_started/Selectors

發表人:  rubcandy0208 [ 2014-06-30, 09:53 ]
文章主題 :  Re: 請問Adblock plus及Element Hiding Helper for Adblock Plus可否萬

很有幫助,謝啦!

1 頁 (共 1 頁) 所有顯示的時間為 UTC + 8 小時
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/