Skip to content

Instantly share code, notes, and snippets.

@notyal
Last active January 13, 2018 14:13
Show Gist options
  • Save notyal/15af5f6bf883267cc407f5aa2adeeedd to your computer and use it in GitHub Desktop.
Save notyal/15af5f6bf883267cc407f5aa2adeeedd to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Fix XDA Sponsored Posts
// @namespace https://gist.github.com/notyal/15af5f6bf883267cc407f5aa2adeeedd
// @version 1.0
// @description Make it easier to skim through the actual XDA blog posts.
// @author Layton Nelson
// @match https://www.xda-developers.com/*
// @grant none
// @downloadUrl https://gist.github.com/notyal/15af5f6bf883267cc407f5aa2adeeedd/raw/fix-xda-sponsored-posts.user.js
// @updateURL https://gist.github.com/notyal/15af5f6bf883267cc407f5aa2adeeedd/raw/fix-xda-sponsored-posts.user.js
// ==/UserScript==
(function() {
'use strict';
for (let metadata of document.body.querySelectorAll("a.article-meta-data")) {
if (metadata.href.endsWith('a-word-from-our-sponsors/')) {
let post = metadata.parentNode.parentNode.parentNode.parentNode;
// dim the post
post.style.opacity = '0.2';
// remove the post
// post.style.display = 'none';
}
}
})();
@flatlined
Copy link

This doesn't remove posts from the XDA Commerce team, which seem to be the current equivalent of the sponsored stuff.
swapping the href a-word-from-our-sponsors to
if (metadata.title.endsWith('Posts by XDA Commerce Team'))
works, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment