Skip to content

Instantly share code, notes, and snippets.

@atwayne
Created June 11, 2020 07:05
Show Gist options
  • Save atwayne/e0ea7cf09ca199185f938dad6d6f1e46 to your computer and use it in GitHub Desktop.
Save atwayne/e0ea7cf09ca199185f938dad6d6f1e46 to your computer and use it in GitHub Desktop.
tampermonkey user script for douban.fm
// ==UserScript==
// @name ad blocker for fm.douban.com
// @namespace http://tampermonkey.net/
// @version 0.1
// @author Wayne
// @match https://fm.douban.com/*
// @match https://douban.fm/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const addGlobalCSSRules = function(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) return;
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
};
const rules = [
"iframe{display:none !important;}",
"a[href='/upgrade']{display:none !important;}"
];
const style = rules.join("");
addGlobalCSSRules(style);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment