The code will not be affected during translation.
Code: Select all
// ==UserScript==
// @name AutoHotkey Docs
// @version 1
// @description Converts pre tags to code tags and updates the associated CSS for AutoHotkey documentation pages.
// @match https://www.autohotkey.com/docs/*
// ==/UserScript==
(function() {
'use strict';
// Get all pre tags on the page
const preTags = document.getElementsByTagName('pre');
// Loop through each pre tag and replace it with a code tag
for (let i = 0; i < preTags.length; i++) {
const preTag = preTags[i];
const codeTag = document.createElement('code');
codeTag.innerHTML = preTag.innerHTML;
preTag.parentNode.replaceChild(codeTag, preTag);
}
// Update the CSS for the code tags
const styleTag = document.createElement('style');
styleTag.innerHTML = 'code { background-color: #f4f4f4; border: 1px solid #ddd; border-radius: 3px; display: block; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 14px; line-height: 1.4; margin-bottom: 1em; padding: 1em; }';
document.head.appendChild(styleTag);
})();