Advertisement
Guest User

Steemit ↔ Steemd

a guest
Aug 5th, 2016
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        Steemit ↔ Steemd
  3. // @namespace   Steemit ↔ Steemd
  4. // @description Quickly Switch Between Steemit.com and Steemd.com
  5. // @version     1
  6. // @author      https://steemit.com/@bitcoiner
  7. // @include     https://steemit.com/*
  8. // @include     https://steemd.com/*
  9. // @grant       none
  10. // ==/UserScript==
  11.  
  12. var menu = document.body.appendChild(document.createElement("menu"));
  13. menu.outerHTML = '<menu id="userscript-context-menu" type="context"><menuitem id="userscript-context-menuitem" label="Steemit ↔ Steemd" icon="https://steemit.com/images/favicons/favicon-32x32.png"></menuitem></menu>';
  14.  
  15. var html = document.documentElement;
  16. html.setAttribute("contextmenu", "userscript-context-menu");
  17.  
  18. document.getElementById("userscript-context-menuitem").addEventListener("click", onMenuClick, false);
  19.  
  20. function onMenuClick() {
  21.     location.assign("//" + ((location.hostname == "steemd.com") ? "steemit.com" : "steemd.com") + ((location.pathname.split("/")[1].indexOf("@") == -1) ? location.pathname : ("/" + location.pathname.split("/")[1])));
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement