InoReader Colorful ListView

按来源为条目设置不同的背景颜色

目前為 2015-01-26 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name InoReader Colorful ListView
  3. // @namespace inoreadercolorfullistview
  4. // @version 20150127
  5. // @description 按来源为条目设置不同的背景颜色
  6. // @author http://t.qq.com/HeartBlade
  7. // @include http*://www.inoreader.com/*
  8. // @include http*://inoreader.com/*
  9. // @include http*://beta.inoreader.com/*
  10. // @run-at document-end
  11. // ==/UserScript==
  12. (function() {
  13. document.getElementById("reader_pane").addEventListener("DOMNodeInserted",function (){
  14. var article=document.getElementsByClassName("article_header");
  15. for(var i=0;i<article.length;i++){
  16. var hue=article[i].parentNode.attributes["data-suid"].value*10%360;
  17. if (/article_unreaded/.test(article[i].parentNode.className)){
  18. article[i].parentNode.setAttribute("style","background-color:hsl("+hue+",70%,80%);");
  19. article[i].childNodes[3].childNodes[1].setAttribute("style","background-color:hsl("+hue+",70%,80%);");
  20. }else if(/\barticle\b/.test(article[i].parentNode.className)){
  21. article[i].parentNode.style.background="";
  22. article[i].childNodes[3].childNodes[1].setAttribute("style","background-color:#f2f2f2");
  23. }
  24. }
  25. },false);
  26.  
  27. })();