Просмотр исходного кода

Only process relative links on RTD

Marcel Stör 5 лет назад
Родитель
Сommit
f0a240aa46
1 измененных файлов с 8 добавлено и 6 удалено
  1. 8 6
      docs/js/extra.js

+ 8 - 6
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));
+      });
+    }
   }
 
   /**