Last active
April 17, 2020 09:54
-
-
Save inertia186/39a62faa835c5fa0b527c59b1af4f2bb to your computer and use it in GitHub Desktop.
Switch between different Hive front-ends.
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 hive-switcher | |
// @namespace https://gist.github.com/inertia186/39a62faa835c5fa0b527c59b1af4f2bb | |
// @updateURL https://gist.githubusercontent.com/inertia186/39a62faa835c5fa0b527c59b1af4f2bb/raw/f7596093365525740d8d68a76dc671e5793046b8/hive-switcher.js | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Switch between different Hive front-ends. | |
// @author inertia | |
// @match http*://hive.blog/* | |
// @match http*://peakd.com/* | |
// @match http*://hiveblocks.com/* | |
// @match http*://hive-db.com/* | |
// @require http://code.jquery.com/jquery-3.4.0.min.js | |
// ==/UserScript== | |
// Note, peakd.com will be a deadend for this script | |
// because of its CSP directives. | |
// | |
// See: https://github.com/Tampermonkey/tampermonkey/issues/593 | |
(function() { | |
'use strict'; | |
var ICON = 'https://i.imgur.com/jdTpB0A.png'; | |
var switcher_markup = ` | |
<script> | |
var switcher_menu = function(e) { | |
var path = location.pathname; | |
switcher_span = $('#switcher_span'); | |
switcher_span.replaceWith('\ | |
<span id="switcher_span" style="background-color: #f0f0f8; border-radius: 10px; box-shadow: inset 0 0 5px black, 0 0 5px black; padding: 10px; display: inline-block; margin: 15px; vertical-align: top; position: absolute; top: 0; left: 0; z-index: 999;">\ | |
<ul>\ | |
<li><a href="https://hive.blog' + path + '">hive.blog</a></li>\ | |
<li><a href="https://peakd.com' + path + '">peakd.com</a></li>\ | |
<li><a href="https://hiveblocks.com' + path + '">hiveblocks.com</a></li>\ | |
<li><a href="https://hive-db.com' + path + '">hive-db.com</a></li>\ | |
</ul>\ | |
</span>'); | |
} | |
</script> | |
<span id="switcher_span" style="position: absolute; top: 128; left: 0; z-index: 999;"> | |
<a href="#" onclick="switcher_menu(this); return false;"> | |
<img src="${ICON}" width="16" height="16" /> | |
</a> | |
</span> | |
`.trim(); | |
$('body').prepend($(switcher_markup)); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment