Created
April 21, 2016 14:42
-
-
Save robbiemu/33ef81f92b41a335adc800ca0f3154e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Feedly Tweaks | |
// @namespace http://your.homepage/ | |
// @version 1.0 | |
// @description tweaks for feedly | |
// @author You | |
// @include /https?:\/\/feedly.com/ | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js | |
// @grant none | |
// ==/UserScript== | |
window.jQ=jQuery.noConflict(true); | |
var exclusions = ["dominate", "[Aa]pple.*car", "Hubble", "Big Bang Theory", | |
"[Nn]orth [Kk]orea", "Kim Jong", "[Ss]outh [Cc]hina [Ss]ea", "Netanyahu", | |
"Sponsored post", "Quartz Daily Brief", "charts of the week", "^Quiz", "[Ff]onts"]; | |
var exclude = new RegExp( exclusions.join("|") ); | |
function removeSpam () { | |
jQ('a.title.unread').each(function(){ | |
if(exclude.test( jQ(this).text() )){ //exclude is defined at top of main | |
console.log("[FeedlyTweaks] hiding \"" + jQ(this).text().trim() + "\" with url " + jQ(this).prop("href")); | |
jQ(this).parent().parent().find('span[title="mark as read and remove from list"]').click(); | |
} else { | |
//console.log("'"+ jQ(this).text() + "' did not match /" + exclusions.join("|") + "/"); | |
} | |
}); | |
} | |
function _randomIntFromInterval (min,max) { | |
return Math.floor(Math.random()*(max-min+1)+min); | |
} | |
function _getHSL () { | |
var hue = _randomIntFromInterval(0,360); | |
var sat = _randomIntFromInterval(30,70); | |
var lightness = _randomIntFromInterval(40,100); | |
return {"hue": hue, "sat": sat, "lightness": lightness}; | |
} | |
function colorTextOnlyTiles () { | |
jQ('div.u5Entry.textOnly a.title.unread:not([colored])').each(function(){ | |
var hsl = _getHSL(); | |
jQ(this).attr("colored", "true").attr("hue",hsl.hue).attr("saturation", hsl.sat).attr("lightness", hsl.lightness); | |
}); | |
jQ('div.u5Entry.textOnly a.title.unread[colored]').each(function(){ | |
jQ(this).css("background-color", "hsl("+ jQ(this).attr("hue") + "," + jQ(this).attr("saturation") + "%," + jQ(this).attr("lightness") + "%)"); | |
}); | |
jQ('div.u5Entry a.title.read[colored]').css("background-color", "white"); | |
} | |
var CSS = function (){/* | |
#floatingBar h1, .floatingBar h1 { | |
font-size: 2em !important; | |
} | |
#feedlyTitleBar, #floatingBar h1, .floatingBar h1, a.entryTitle, div.label { | |
font-family: Roboto, "Microsoft YaHei", Arial, sans-serif !important; | |
} | |
.slabserif .entryBody { | |
font-family: "Slab Serif", "Microsoft YaHei", sans-serif !important; | |
} | |
.u5Entry.textOnly .title { | |
font-family: "Source Sans Pro", Roboto, "Microsoft Yahei", Arial, sans-serif; | |
} | |
*/}; | |
CSS = CSS.toString().replace(/^.*?\/\*/, "").replace(/\*\/.*?$/, "").trim(); | |
jQ(document).ready(function(){ | |
jQ('head').append('<style>' + CSS + '</style>'); | |
setInterval(function(){ | |
removeSpam(); | |
colorTextOnlyTiles(); | |
}, 500); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
a userscript I use to beautify my feedly news in the browser.