Tutsplus Code

Hide readed article

目前为 2017-06-04 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Tutsplus Code
  3. // @version 1.2001
  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, pageSize = 0;
  22. debugger;
  23. for (var i=0; i<resLength; i++) {
  24. jQuery("a.posts__post-preview").each(function () {
  25. if (pageSize == 12) {
  26. return false;
  27. }
  28. var href = jQuery(this).prop('href');
  29. if (href.indexOf(res[i]) != -1) {
  30. jQuery(this).parents("li").hide();
  31. pageSize = pageSize + 1;
  32. }
  33. });
  34. }
  35. });
  36. });