User:Omegatron/monobook.js/autolinker.js

Today, User:Omegatron/monobook.js/autolinker.js is a topic that interests a wide spectrum of people. From scholars of the subject to the general public, User:Omegatron/monobook.js/autolinker.js has captured attention and has become an object of debate and reflection. With a significant impact in different areas, User:Omegatron/monobook.js/autolinker.js has generated a wide range of opinions and has sparked interest in exploring its various facets. In this article, we will explore User:Omegatron/monobook.js/autolinker.js and its implications in depth, with the aim of shedding light on this topic that is so relevant today.
/* <pre><nowiki> */

/* Autolink ] and {{templates}} (especially useful for monobook.js and similar pages) */
/* See ] */
/* Shouldn't affect things *inside* HTML tags, either */

addOnloadHook(function () {
    // Get the HTML of just the main body of the page, not including textareas hopefully

    if (document.getElementById('wikiDiff')) {
        targetdiv = document.getElementById('wikiDiff');   // wikiDiff if it's there
    } else {

    if (document.getElementById('wikiPreview')) {
        targetdiv = document.getElementById('wikiPreview');  // wikiPreview if it's there
    } else

    if (document.getElementById('bodyContent')) {
        targetdiv = document.getElementById('bodyContent');  // bodyContent div for most pages
    } else 
        return;
    }
    var content = targetdiv.innerHTML;
    content = content.replace(/()\\|\<\>\n]*)(\<\>\n]*?)?\]{2}(])/g, '$1<a class="autolink" href="https://wikifreehand.com/en/$2">' + ']</a>$4'); // Make wikilink code into links
    content = content.replace(/()\{{2}(subst\:|msg\:)?(*)(*?)?\}{2}()/g, '$1<a class="autolink" href="https://wikifreehand.com/en/Template:$3">{' + '{$2$3$4}' + '}</a>$5'); // Make template code into links
    targetdiv.innerHTML = content; // Write it back
});

/* </nowiki></pre> */