Skip to content

Instantly share code, notes, and snippets.

@andybak
Last active March 19, 2024 11:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andybak/ac3b3d8bc1faa1422b4260218a23d444 to your computer and use it in GitHub Desktop.
Save andybak/ac3b3d8bc1faa1422b4260218a23d444 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Gitbook
// @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;
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