Tutsplus

Hide readed article

Від 04.06.2017. Дивіться остання версія.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name     Tutsplus
// @version	1
// @description Hide readed article
// @include    http://tutsplus.com/tutorials/*
// @include    https://tutsplus.com/tutorials/* 
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js
// @namespace https://greasyfork.org/users/38384
// ==/UserScript==

 jQuery(function() {

    jQuery.ajaxPrefilter( function (options) {
      if (options.crossDomain && jQuery.support.cors) {
        var http = (window.location.protocol === 'http:' ? 'http:' : 'https:');
        options.url = http + '//cors-anywhere.herokuapp.com/' + options.url;
      }
    });
    
    jQuery.get('http://www.mycodemyway.in/txt/tutsplus_code.txt', function (response) {
        var res = response.split(",");
        var resLength = res.length, pageSize = 0;
  debugger;
        for (var i=0; i<resLength; i++) {
            jQuery("a.posts__post-preview").each(function () {
                if (pageSize == 12) {
                   return false;
                }
                var href = jQuery(this).prop('href');
                if (href.indexOf(res[i]) != -1) {
                    jQuery(this).parents("li").hide();
                    pageSize = pageSize + 1; 
                }
            });
       }
    });
});