Greasy Fork is available in English.

Habrahabr topics highlighter

Выделяет заголовки топиков жёлтым цветом определённых авторов

// ==UserScript==
// @author         Lightwave
// @name           Habrahabr topics highlighter
// @description    Выделяет заголовки топиков жёлтым цветом определённых авторов
// @version        2.6.5
// @include        http://habrahabr.ru/*
// @include        https://habrahabr.ru/*
// @include        http://geektimes.ru/*
// @include        https://geektimes.ru/*
// @include        http://megamozg.ru/*
// @include        https://megamozg.ru/*
// @namespace      https://greasyfork.org/users/9366
// @license        MIT License
// @run-at         document-end
// @grant          none
// @icon           data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAASMUlEQVRYw0V5SZNmyVXlHdz9Td8QY2ZG5VCjUAFCQi1ohCGsl73iX7Jl04YZxgaTqREtCkqUpKJkVIrMrIzIjIz5m97gw723F1EYy7fy436On3OPP3z97h0iIiIAgCIAIBAipiJmlkohImRnZsgEKmygJRsoEZEpERVTMZViwIRIRKQCpRQCFUMgLmLsEAAYARFFBBHFgJkVWM3MsJiqGRG5mPUeDACgAgAgIiKrqgJM0+Sc8xWklADIey4CZoYGIAXBUhoBIMbovAdmIjIzMGJmAwPAlBKSMwMzY6ZSChGllMh5VUVARAQ0B6CEROh2Q0EyAgQANP0vQIiIMSfnXJYyrScfGIz6NBVwwzDcXl3dXF+WFE0kx+n6+to5VzXt0dHRcrmcL5eLxSKEEEIwMy0lp0JEBQ0ADKSuaxUFRYMCQIRYTMHMEF0/JiQjA7xHS8ZIhmBmAKrFCBAIVRVApym+Ojv/8st//+bFizQOoCVNIxvUdS0iRSWEUFTJ8eHh4eOn73/88cdPnjxDpntkMU51XTPzOI4ITER4zzGzRzAwIsKf/vI5IhIYkiEiEZKBERKR9ywiwZHkQkTjsPvss88++9d/Wd+tNCUHVnm3nM+xqPc+SRmGSRCKmIIBE7FbLBbPnn3wP3/84+PjY+ecC76UUtd1zlkl3+uEiIjonhlmxv/3m1NEA1Bi+G9xg5kZIjpi1YJm09D/2+e//Mef/XQad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g==
// ==/UserScript==
(function () {
  var posts = document.querySelectorAll('div.post');
  var dailyPosts = document.querySelectorAll('#broadcast_posts_now > .content-list > .content-list__item');
  var authors = [
    'alizar',
    'marks',
    'SLY_G',
    'ragequit', // keepcalm 
    'ivansychev',
    'jeston',
    'FakeFactFelis',
    'atomlib',
    'andorro', // out of order
    'ilya42', // out of order
    'itNews',
    'semen_grinshtein',
    'Shapelez', // out of order
    'jasiejames' // out of order   
  ];
  for (var i = 0; i < posts.length; i++) {
    var author = posts[i].querySelector('.post-author__link');
    var authorName = '';
    if (author !== null) {
      authorName = author.innerHTML;
      authorName = authorName.slice(authorName.indexOf('@') + 1, authorName.length).trim();
    } else {
      var authorNickname = posts[i].querySelector('.author-info__nickname');
      if (authorNickname !== null) { // у постов с новым дезигном вообще нигде автор не пишется, например geektimes.ru/article/262244/
        authorName = authorNickname.innerHTML
        authorName = authorName.replace('@', '').trim();
      }
    }
    if (authors.indexOf(authorName) != - 1) {
      var postName = posts[i].querySelector('.post_title').textContent;
      posts[i].querySelector('.post_title').textContent = '(' + authorName + ') ' + postName;
      posts[i].querySelector('.post_title').style.backgroundColor = '#ff0';
    }
  }
  function UpdateDailyPost(request, index) {
    return function () {
      if (request.readyState != 4) return;
      if (request.status != 200) return;
      var dummy = document.createElement('div');
      dummy.innerHTML = request.responseText;
      var dailyPost = dailyPosts[index].querySelector('.content-list__item-link');
      var dailyPostName = dailyPost.textContent;
      var dailyPostAuthorName = dummy.querySelector('.author-info__nickname').innerHTML;
      dailyPostAuthorName = dailyPostAuthorName.replace('@', '').trim();
      if (authors.indexOf(dailyPostAuthorName) != - 1) {
        dailyPost.textContent = '(' + dailyPostAuthorName + ') ' + dailyPostName;
        dailyPost.style.backgroundColor = '#ff0';
      }
      request = null;
    };
  }
  var xhr = new Array(dailyPosts.length);
  for (var j = 0; j < dailyPosts.length; j++) {
    var baseUri = dailyPosts[j].querySelector('a').baseURI;
    var dpUrl = dailyPosts[j].querySelector('a').href;
    if (baseUri.indexOf('https') != - 1) {
      dpUrl = dpUrl.indexOf('https') == - 1 ? dpUrl.replace('http', 'https')  : dpUrl;
    }
    xhr[j] = new XMLHttpRequest();
    xhr[j].onreadystatechange = UpdateDailyPost(xhr[j], j);
    xhr[j].open('GET', dpUrl, true);
    xhr[j].send(null);
  }
}) ();