Created
July 16, 2024 11:14
-
-
Save andybak/3a03bac4ed27ab3c1ca3d87cc21fcd9d to your computer and use it in GitHub Desktop.
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 Gitbook | |
// @match https://docs.openblocks.app/* | |
// @match https://docs.openbrush.app/* | |
// @description Adds edit link to gitbook pages on https://docs.openbrush.app/ | |
// @version 0.1 | |
// @match https://www.tampermonkey.net/index.php?version=4.13.6136&ext=fire&updated=true | |
// @icon https://www.google.com/s2/favicons?domain=tampermonkey.net | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let el = document.body.appendChild(document.createElement('a')); | |
el.setAttribute("id", "quickgblink"); | |
el.innerText = "EDIT"; | |
el.href = "#"; | |
el.style.position = "fixed"; | |
el.style.top = "0"; | |
el.style.zIndex = "1000"; | |
el.style.right = "0"; | |
el.style.width = "4em"; | |
el.style.height = "2em"; | |
el.style.border = "1px solid black"; | |
el.style.padding = "3px"; | |
el.style.textAlign = "center"; | |
var updateLink = function() | |
{ | |
var path = document.location.href; | |
if (window.location.href.startsWith("https://docs.openblocks")) { | |
path = path.toString().replace("https://docs.openblocks.app/", ""); | |
el.href="https://app.gitbook.com/o/-Mikdl01-6Jga6QTk0rK/s/phlcCfbsThynLmPdz9hj/" + path; | |
} else { | |
path = path.toString().replace("https://docs.openbrush.app/", ""); | |
el.href="https://app.gitbook.com/o/-Mikdl01-6Jga6QTk0rK/s/-Mikdwm98p33AibfiSqN/" + path; | |
} | |
}; | |
el.onmousemove = updateLink; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment