bypass the content warning on blogspot/blogger sites
当前为
// ==UserScript==
// @name Blogspot Warning Bypass
// @namespace http://blogger.com
// @version 1.21
// @description bypass the content warning on blogspot/blogger sites
// @author elisewindbloom
// @match *://*/*
// @icon https://www.blogger.com/favicon.ico
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
// Function to check if "www.blogger.com" and such are present in the HTML
function isBloggerPage() {
return (document.body.innerHTML.includes('<a href="https://www.blogger.com" target="_blank">Blogger</a>') || document.body.innerHTML.includes('Powered by Blogger')) && document.documentElement.innerHTML.includes("//www.blogger.com");
//return document.documentElement.innerHTML.includes("www.blogger.com");
}
// Function to remove the injected iframe from the page
function blockInjectedIframe() {
var injectedIframe = document.getElementById('injected-iframe');
if (injectedIframe) {
injectedIframe.parentNode.removeChild(injectedIframe);
console.log('Injected iframe with ID "injected-iframe" blocked');
}
}
// Function to delete the body style
function deleteBodyStyle() {
var bodyStyleNode = document.evaluate('/html/body/style', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
if (bodyStyleNode) {
bodyStyleNode.parentNode.removeChild(bodyStyleNode);
console.log('Node with XPath /html/body/style deleted');
}
}
// Check if the page is a Blogger page before executing the blocking and deletion functions
if (isBloggerPage()) {
blockInjectedIframe();
deleteBodyStyle();
console.log('Content Warning bypass complete');
}
})();