Skip to content

Instantly share code, notes, and snippets.

@krikunts
Last active March 7, 2016 09:09
Show Gist options
  • Select an option

  • Save krikunts/2602568bcacb8db6ccf0 to your computer and use it in GitHub Desktop.

Select an option

Save krikunts/2602568bcacb8db6ccf0 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Geektimes exclude authors
// @include https://geektimes.ru/*
// @version 1
// @grant none
// ==/UserScript==
var authors = [
'alizar',
'marks',
'ivansychev',
'ragequit',
'SLY_G'
];
var hubs = [
'mvideo',
'icover',
'gearbest',
'neuronspace'
];
var getName = function() {
return $(this).attr("href").split("/")[4];
};
var block = function() {
var pHubNames = $(this).find('.hub').map(getName).get();
var mpHubNames = $(this).find('.megapost-head__hubs').first()
.find('.profile').map(getName).get();
var hubNames = pHubNames.concat(mpHubNames);
var banned = hubNames.filter(function(value){
return hubs.includes(value);
});
if(banned.length > 0) {
return true;
}
var authorName = $(this).find('.post-author__link').map(getName)[0];
if(authorName && authors.includes(authorName)){
return true;
}
var blogName = $(this).find('.megapost-cover__blog-link').map(getName)[0];
if(blogName && hubs.includes(blogName)) {
return true;
}
return false;
};
$('.post').filter(block).remove();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment