Blogspot Warning Bypass

bypass the content warning on blogspot/blogger sites

  1. // ==UserScript==
  2. // @name Blogspot Warning Bypass
  3. // @namespace http://blogger.com
  4. // @version 1.25
  5. // @description bypass the content warning on blogspot/blogger sites
  6. // @author elisewindbloom
  7. // @match *://*/*
  8. // @icon https://www.blogger.com/favicon.ico
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Check if the webpage is a Blogger/Blogspot site
  17. function isBloggerPage() {
  18. // Check for specific Blogspot attributes or meta tags
  19. const blogspotAttributes = ['data-blogspot-url', 'data-blogspot-url-original'];
  20. const hasBlogspotAttributes = blogspotAttributes.some(attr => document.querySelector(`[${attr}]`));
  21.  
  22. // Check for specific Blogspot meta tags
  23. const hasBlogspotMetaTag = Array.from(document.querySelectorAll('meta[name="generator"]'))
  24. .some(tag => tag.getAttribute('content').toLowerCase().includes('blogger'));
  25.  
  26. // Combine all detection methods
  27. return (
  28. hasBlogspotAttributes ||
  29. hasBlogspotMetaTag
  30. );
  31. }
  32.  
  33. // Function to remove the injected iframe from the page
  34. function blockInjectedIframe() {
  35. var injectedIframe = document.getElementById('injected-iframe');
  36. if (injectedIframe) {
  37. injectedIframe.parentNode.removeChild(injectedIframe);
  38. console.log('Injected iframe with ID "injected-iframe" blocked');
  39. }
  40. }
  41.  
  42. // Function to delete the body style
  43. function deleteBodyStyle() {
  44. var bodyStyleNode = document.evaluate('/html/body/style', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  45. if (bodyStyleNode) {
  46. bodyStyleNode.parentNode.removeChild(bodyStyleNode);
  47. console.log('Node with XPath /html/body/style deleted');
  48. }
  49. }
  50.  
  51. // Check if the page is a Blogger page before executing the blocking and deletion functions
  52. if (isBloggerPage()) {
  53. blockInjectedIframe();
  54. deleteBodyStyle();
  55. console.log('Content Warning bypass complete');
  56. }
  57. })();
  58.