Google News Filter

Removes blacklisted articles and news sources from Google News.

目前為 2015-10-03 提交的版本,檢視 最新版本

// ==UserScript==
// @name        Google News Filter
// @namespace   http://www.google-news-filter.com
// @description Removes blacklisted articles and news sources from Google News.
// @include     *//news.google.com/*
// @grant       none
// @version     1.0.2
// @require       http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js
// ==/UserScript==

$(function() {
// add new blacklist terms here (case-insensitive);
// format: single quotes around each term, and a comma after each term except the last one:
var $blacklist = [
  'kardashian',
  'miley cyrus'
];
// end blacklist

// convert blacklist items to lowercase:
$blacklist = $.map( $blacklist, function(n,i) { return n.toLowerCase(); });

// add count div to display statistics:
var $count = 0;
var $matched = '';
$('#main-wrapper').prepend('<div style="position:fixed;top:0;right:0;padding:2px 6px 0 0;z-index:1000;" id="count"></div>');

// search for and remove blacklisted stories:
$('.titletext,.al-attribution-source,.source-pref').each(function() {
  var $titletext = $(this).text().toLowerCase();
  for (var i=0; i < $blacklist.length; i++) {
    if ( $titletext.indexOf( $blacklist[i] ) > -1 ) {
      $(this).parents('.blended-wrapper, .small-story').remove();
      $count = $count + 1;
      $matched += $blacklist[i] +'<br>';
      break
    }
  }
// update statistics and add matched terms:
$('#count').text($count +' stories removed').append('<p style="display:none;background:white;margin:0;padding:0.5em;"><b>Matched terms:</b><br>'+$matched+'</p>');
});

// show/hide matched terms by clicking count div:
$('#count').on('click',function() {
	$(this).find('p').toggle(500);
});

});

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址