Tutsplus Code

Hide readed article

目前为 2017-03-02 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Tutsplus Code
  3. // @version 1
  4. // @description Hide readed article
  5. // @include https://code.tutsplus.com/*
  6. // @include http://code.tutsplus.com/*
  7. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js
  8. // @namespace https://greasyfork.org/users/38384
  9. // ==/UserScript==
  10.  
  11. jQuery(function() {
  12.  
  13. jQuery.ajaxPrefilter( function (options) {
  14. if (options.crossDomain && jQuery.support.cors) {
  15. var http = (window.location.protocol === 'http:' ? 'http:' : 'https:');
  16. options.url = http + '//cors-anywhere.herokuapp.com/' + options.url;
  17. }
  18. });
  19. jQuery.get('http://www.mycodemyway.in/txt/tutsplus_code.txt', function (response) {
  20. var res = response.split(",");
  21. var resLength = res.length;
  22.  
  23. for (var i=0; i<resLength; i++) {
  24. jQuery("a.posts__post-preview").each(function () {
  25. var href = jQuery(this).prop('href');
  26. if (href.indexOf(res[i]) > -1) {
  27. jQuery(this).parents("li").hide();
  28. }
  29. });
  30. }
  31. });
  32. });