userstyles no placeholder ad

hides ad in style entry list

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        userstyles no placeholder ad
// @namespace   budlabs
// @grant       none
// @include     https://userstyles.org/*
// @version     1.0
// @author      budRich
// @description hides ad in style entry list
// @esversion: 6
// ==/UserScript==

/* jshint esversion: 6 */

function hide_ads() {
    let container = document.getElementsByClassName("us-stylecards__container")[0]
  
    if (container){
      let cardclass = (
        container.classList.contains("us-stylecards__container--stylecard-short") ? 
        "us-stylecard--short" : 
        "us-stylecard--long"
      )

      let cards = document.getElementsByClassName(cardclass)

      for (let card of cards) {
        if(card.querySelector(".fallbackDiv"))
        {
            card.style.display = "none"
        }
      }
    
        
    }
}

hide_ads()
// rerun the code each time document change
// for example when toggling between viewmodes
document.addEventListener("DOMNodeInserted", hide_ads)