Skip to content

Instantly share code, notes, and snippets.

@asonas
Last active December 7, 2023 01:46
Show Gist options
  • Save asonas/8723e141532b1113f6cc08c90e0789fa to your computer and use it in GitHub Desktop.
Save asonas/8723e141532b1113f6cc08c90e0789fa to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name DocBase Fixed Title
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Fix the title at the top of the page on DocBase articles
// @author asonas
// @match https://*.docbase.io/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var delay = 1000;
var maxRetries = 10;
var retryCount = 0;
function retry() {
setTimeout(function() {
var headerElement = document.querySelector('.memo_header__Root-sc-nopch2-0.GKAny');
var parentDivElement = headerElement ? headerElement.parentElement : null;
if (parentDivElement) {
parentDivElement.style.position = 'sticky';
parentDivElement.style.top = '0';
parentDivElement.style.backgroundColor = '#fff';
parentDivElement.style.zIndex = '1000';
} else {
retryCount++;
if (retryCount < maxRetries) {
retry();
}
}
}, delay);
}
retry();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment