You are viewing a single comment's thread from:

RE: Links, Kinks, and the Big Three

in TheTerminal3 years ago

javascript:(function(){location.assign("http://" + ((location.hostname == "www.hive.blog") ? "ecency.com" : "www.peakd.com") + ((location.pathname.split("/")[1].indexOf("@") == -1) ? location.pathname : ("/" + location.pathname.split("/")[1])))})();

How would I add a fourth option to this, so that it changes all three urls to become a stemgeeks.net url instead? I tried to just move your : "www.peakd.com"to the other side of the colon and add another question mark, then follow the colon with "stemgeeks.net" instead, but that didn't work. This is what I have at present...
javascript:(function(){location.assign("http://" + ((location.hostname == "www.hive.blog") ? "ecency.com" ? "www.peakd.com" : "stemgeeks.net" ) + ((location.pathname.split("/")[1].indexOf("@") == -1) ? location.pathname : ("/" + location.pathname.split("/")[1])))})();

I guess the "or" here it isn't that simple to implement, but I'm no Javascript master. I really want to have a scriptlet like this which can convert all three common urls to the stemgeeks.net url.

Sort:  

This will do it — even though you don't see "ecency.com" listed there, it will still work:

javascript:(function(){location.assign("http://" + ((location.hostname == "www.hive.blog") ? "peakd.com" : "stemgeeks.net") + ((location.pathname.split("/")[1].indexOf("@") == -1) ? location.pathname : ("/" + location.pathname.split("/")[1])))})();

NOTE: This script will not work for all Tribes, as some Tribes filter posts from the Hive blockchain instead of showing all posts from Hive. For instance, LeoFinance will not show any post that does not have the #leofinance hashtag, so such a script would fail on that Tribe. Fortunately, STEMgeeks does not filter in that same way, so be glad that you chose a Tribe where this will work!

That is awesome! Thank you so much for your help with this.