您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Feedly Colorful Listview Mod working with Chrome
当前为
- // ==UserScript==
- // @name Feedly Colorful Listview Mod
- // @id FeedlyColorfulListviewMod
- // @version 0.0.8.20160913
- // @description Feedly Colorful Listview Mod working with Chrome
- // @namespace https://greasyfork.org/pl/users/66016-marcindabrowski
- // @match *://*.feedly.com/*
- // @grant GM_addStyle
- // @run-at document-end
- // ==/UserScript==
- var ColorfulListView = function () {
- this.initialize.apply(this, arguments);
- };
- ColorfulListView.prototype = {
- initialize:function () {
- this.colors = {};
- },
- makeColor:function (str) {
- var h = 0;
- for (var i = 0; i < str.length; i++) {
- h += str.charCodeAt(i);
- }
- return {"h":(h%36+1)*10, "s":30 + (h%5+1)*10};
- },
- color:function (item) {
- var itemid = item.id.replace(/^([^=]+).*$/, "$1");
- item.setAttribute("data-color", itemid);
- if (this.colors[itemid]!==undefined) return null;
- this.colors[itemid] = this.makeColor(itemid);
- GM_addStyle(
- "div[data-color='" + itemid + "'] {background:hsl(" + this.colors[itemid]['h'] + "," + this.colors[itemid]['s'] + "%,80%) !important;}" +
- "div[data-color='" + itemid + "']:hover {background:hsl(" + this.colors[itemid]['h'] + "," + this.colors[itemid]['s'] + "%,70%) !important;}"
- );
- }
- };
- var mo = new MutationObserver(function (mutations) {
- var colorfulListViewObj = new ColorfulListView();
- mutations.forEach(function (mutation) {
- Array.prototype.slice.call(mutation.addedNodes).forEach(function (node) {
- if (node.className===undefined || node.className.indexOf("u0Entry")==-1) return null;
- if (node.getAttribute("data-color")!==null) return null;
- colorfulListViewObj.color(node);
- });
- });
- });
- mo.observe(document.getElementById("box"), {childList:true, subtree:true});