Skip to content

Instantly share code, notes, and snippets.

@MWFIAE
Created October 14, 2018 10:46
Show Gist options
  • Save MWFIAE/11d6172938d64c51055cdc36db954e5d to your computer and use it in GitHub Desktop.
Save MWFIAE/11d6172938d64c51055cdc36db954e5d to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name SteemitStem
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Takes you to Steemit and beyond!
// @author MWFIAE
// @match https://www.steemstem.io/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.setInterval(function() {
var links = document.querySelectorAll('.item .content a.header');
for(var i=0; i<links.length; i++){
var link = links[i];
var steemlink = link.href.replace("https://www.steemstem.io/#!", "https://steemit.com/mwfiae");
//console.log(steemlink);
if(link.parentNode.querySelectorAll('.mwlink').length > 0){
continue;
}
var a = document.createElement("a");
a.href = steemlink;
a.target = "_blank";
a.className = "ui mini button teal fluid mwlink";
a.innerText = "View on Steemit";
link.parentNode.insertBefore(a, link.parentNode.children[1]);
link.parentNode.insertBefore(document.createElement("br"), link.parentNode.children[1]);
}
var follow= document.querySelector(".follow");
var b = document.querySelector('.mwlink');
if(!follow || b)
return;
var steemlink = document.location.href.replace("https://www.steemstem.io/#!", "https://steemit.com/mwfiae");
b = document.createElement("a");
b.href = steemlink;
b.target = "_blank";
b.className = "ui mini button teal fluid mwlink";
b.innerText = "View on Steemit";
follow.parentNode.insertBefore(b, follow);
}, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment