Skip to content

Instantly share code, notes, and snippets.

@moriwaka
Created June 22, 2024 00:29
Show Gist options
  • Save moriwaka/b56387ca212f4cbc467a4120ad1dba69 to your computer and use it in GitHub Desktop.
Save moriwaka/b56387ca212f4cbc467a4120ad1dba69 to your computer and use it in GitHub Desktop.
bookmarklet to fix docs.redhat.com contents width
javascript:(function() {
const layout = document.querySelector('aside#layout');
const focusWrapper = document.querySelector('div#focus-wrapper');
const formatSelector = document.querySelector('.content-format-selector');
const focusModeToggle = document.querySelector('#toggle-focus-mode');
const focusModeLabel = document.querySelector('label[for="toggle-focus-mode"]');
if (layout && focusWrapper) {
while (layout.firstChild) {
focusWrapper.appendChild(layout.firstChild);
}
layout.remove();
}
if (formatSelector && focusWrapper) {
focusWrapper.parentNode.insertBefore(formatSelector, focusWrapper.nextSibling);
}
const contentContainer = document.querySelector('.docs-content-container');
if (contentContainer) {
contentContainer.style.paddingLeft = '1rem';
contentContainer.style.paddingRight = '1rem';
}
const contentElements = document.querySelectorAll('article.content');
contentElements.forEach(element => {
if (element.classList.contains('span-lg-7')) {
element.classList.remove('span-lg-7');
element.classList.add('span-lg-9');
}
});
if (focusModeToggle) {
focusModeToggle.style.display = 'none';
}
if (focusModeLabel) {
focusModeLabel.style.display = 'none';
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment