Last active
November 13, 2016 00:03
-
-
Save fisknils/1ce030dee1bb259a42c2 to your computer and use it in GitHub Desktop.
This userscript removes any listing marked as "Freemium" and "Free*", on alternativeto.net when the site's filter is set to free.
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 Alternativeto.net ~Free != Free | |
// @namespace https://gist.github.com/fisknils | |
// @version 0.1 | |
// @description This script removes any listing marked as "Freemium" and "Free*", when the site's filter is set to free. | |
// @author Fisknils | |
// @match *://alternativeto.net/*?license=free* | |
// @grant none | |
// ==/UserScript== | |
// This is the configurable part | |
var removeFreemium = true; // remove items listed as Freemium | |
var removeFreeish = true; // remove items listed as Free* | |
// counter | |
var xDel = 0; | |
// all listed items on the page | |
var items = document.getElementsByClassName('item-wrapper'); | |
// loop through | |
for(var i in items) { | |
try { | |
// I'm lazy... | |
item = items[i]; | |
ihtml = item.innerHTML; | |
// if it's innerHTML contains Freemium or Free*, remove this element, and increment the counter | |
if((ihtml.indexOf('Freemium') > 0 && removeFreemium) || (ihtml.indexOf('Free*') > 0 && removeFreeish)) { | |
item.parentNode.removeChild(item); | |
xDel++; | |
} | |
} catch(err) { | |
//console.log(err.message); | |
} | |
} | |
console.log('removed ' + xDel + ' listings due to being "Freemium" or "Free*", while looking for Free'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment