Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Final: https://gist.github.com/kawiesh/128aa6b330dfb777dd50c2ce6f9df9aa
- // ==UserScript==
- // @name Starnieuws - AdBlock
- // @namespace AdBlocker for Starnieuws
- // @match *://*.starnieuws.com/*
- // @grant none
- // @version 2.0
- // @author K.D.
- // @description Removes ads on Starnieuws!
- // ==/UserScript==
- //SELECTORS FOR ADS
- let a= [];
- a[0]= 'span[style*=BEBEBE]';
- a[1]= '#sidebar';
- a[2]= '.adbox_top';
- a[3]= '#adbox_content';
- a[4]= 'br+.overig_nieuws';
- a[5]= 'img[src*=advertentie]';
- a[6]= 'img[id*=ad_]';
- //FUNCTION TO HIDE THE ADS
- function hideAds(x){
- let b= document.querySelectorAll(x);
- for (let i=0; i<b.length; i++){
- b[i].parentNode.removeChild(b[i]);
- }
- }
- //CALLING THE FUNCTION
- for (let i=0; i<a.length; i++){
- hideAds(a[i]);
- }
- //REMOVING BACKGROUND & DIVIDER
- let c= document.querySelector('#topstory'),
- d= document.querySelectorAll('div[id=overig_nieuws]');
- if (c) {
- c.style.backgroundImage='none';
- c.style.backgroundColor='white';
- }
- if(d) d[0].style.display='none';
- ........older.........
- // ==UserScript==
- // @name Starnieuws - Remove Ads
- // @namespace K.D.
- // @match *://*.starnieuws.com/*
- // @grant none
- // @version 1.0
- // @author K.D.
- // @description Remove advertisements on Starnieuws.com
- // ==/UserScript==
- (function() {
- 'use strict';
- var blockList = [
- "m.starnieuws.com##td:nth-of-type(2)",
- "m.starnieuws.com##.headlines_content > div",
- "m.starnieuws.com##.content > div:nth-of-type(3) > div:nth-of-type(5)",
- "m.starnieuws.com##div:nth-of-type(6)",
- "www.starnieuws.com###sidebar",
- "www.starnieuws.com##.headlines_content > div",
- "www.starnieuws.com###topstory > div:nth-of-type(1)",
- "www.starnieuws.com###topstory > div:nth-of-type(3)",
- "www.starnieuws.com###content_text > div:nth-of-type(3)",
- "www.starnieuws.com###content_text > div:nth-of-type(4)",
- "www.starnieuws.com##div#overig_nieuws:nth-of-type(4)"
- ];
- var windowHostname = window.location.hostname;
- for (var i = 0; i < blockList.length; i++) {
- var entryParts = blockList[i].split('##');
- if (windowHostname === entryParts[0]) {
- var matchedElements = document.querySelectorAll(entryParts[1]);
- for (var j = 0; j < matchedElements.length; j++) {
- var matchedElem = matchedElements[j];
- matchedElem.parentNode.removeChild(matchedElem);
- }
- }
- }
- })();
- ......
- GM_addStyle(`
- #content2{
- background-image:none;
- background-color:white;
- }
- span, div[style*='clear:both'], #adbox_content, .adbox_content,
- #sidebar,img[src*='advertentie']{
- display:none!important;
- }
- `);
- let a= location.href;
- if (a.includes('/nieuwsitem/')) {
- let b= document.querySelector('i'),
- bhr= document.createElement('hr');
- b.parentNode.insertBefore(bhr,b);
- let c= document.querySelector('.headlines_content'),
- chr= document.createElement('hr');
- c.parentNode.insertBefore(chr, c);
- /*let d= document.querySelectorAll('.overig_nieuws');
- d.parentNode.removeChildNode(d);*/
- }
- .....
- // ==UserScript==
- // @name JavaScript AdBlox
- // @namespace AdBlox JS
- // @match *://*.starnieuws.com/*
- // @grant GM_addStyle
- // @version 1.0
- // @author -
- // @description BOOMER
- // ==/UserScript==
- GM_addStyle(`
- #topstory{
- background-image:none;
- background-color:white;
- }`);
- let a= [];
- a[0]= 'span[style*=BEBEBE]';
- a[1]= '#sidebar';
- a[2]= '.adbox_top';
- a[3]= '#adbox_content';
- a[4]= 'br+.overig_nieuws';
- a[5]= 'img[src*=advertentie]';
- a[6]= 'img[id*=ad_]';
-
- function hideAds(x){
- let b= document.querySelectorAll(x);
- for (let i=0; i<b.length; i++){
- b[i].parentNode.removeChild(b[i]);
- }
- }
-
- for (let i=0; i<a.length; i++){
- hideAds(a[i]);
- }
- let d= document.querySelectorAll('div[id=overig_nieuws]');
- d[0].style.display='none';
- .....
- #content2{
- filter: invert(1);
- }
- #content2 iframe,
- #content2 video,
- #content2 img:not([src*='video']){
- filter: invert(1);
- }
- #content_header_section, #content2 a {
- color:fuchsia!important;
- }
- #content2 img:not([src*='video']){
- outline: 1px solid #39FF14
- }
- ......
- (function() {
- 'use strict';
- var blockList = [*PASTE*];
- var windowHostname = window.location.hostname;
- for (var i = 0; i < blockList.length; i++) {
- var entryParts = blockList[i].split('##');
- if (windowHostname === entryParts[0]) {
- var matchedElements = document.querySelectorAll(entryParts[1]);
- for (var j = 0; j < matchedElements.length; j++) {
- var matchedElem = matchedElements[j];
- matchedElem.parentNode.removeChild(matchedElem);
- }
- }
- }
- })();
- -------------
- /*
- Source: Zach Saucier @ Stackoverflow
- Link: https://stackoverflow.com/questions/44368691/how-to-conveniently-hide-elements-selected-using-an-adblocker-via-a-userscript
- */
Add Comment
Please, Sign In to add comment