From f0a240aa46c3b844487a5e184b5cfa88eec11365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20St=C3=B6r?= Date: Mon, 11 Feb 2019 22:52:17 +0100 Subject: [PATCH] Only process relative links on RTD --- docs/js/extra.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/js/extra.js b/docs/js/extra.js index e2fef36d..92f7514c 100644 --- a/docs/js/extra.js +++ b/docs/js/extra.js @@ -44,12 +44,14 @@ var nodemcu = nodemcu || {}; * replaces the relative path with an absolute path based on the selected branch. */ function replaceRelativeLinksWithStaticGitHubUrl() { - var relativePath = isOnRtd() ? "../../.." : "../.."; - var gitHubPath = "https://github.com/nodemcu/nodemcu-firmware/tree/" + determineSelectedBranch(); - var gitHubLinks = $("a[href^='" + relativePath + "']").each(function (index) { - var url = $(this).attr('href'); - $(this).attr('href', url.replace(relativePath, gitHubPath)); - }); + if (isOnRtd()) { + var relativePath = "../../.."; + var gitHubPath = "https://github.com/nodemcu/nodemcu-firmware/tree/" + determineSelectedBranch(); + var gitHubLinks = $("a[href^='" + relativePath + "']").each(function (index) { + var url = $(this).attr('href'); + $(this).attr('href', url.replace(relativePath, gitHubPath)); + }); + } } /**