doc: do not try to patch #edit-on-github if not found
authorKefu Chai <kchai@redhat.com>
Thu, 20 Feb 2020 05:05:45 +0000 (13:05 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 20 Feb 2020 06:44:11 +0000 (14:44 +0800)
we add this element in _templates/page.html, which is only used for the
content pages, not in the "search" page. to avoid the js errors, just
disabled it if it's not found.

Signed-off-by: Kefu Chai <kchai@redhat.com>
doc/_static/js/ceph.js

index e8114f0165d9fd9c09431079a74307e02ad2f111..5374029a0a37a6098b9defc9f867b252b30946e5 100644 (file)
@@ -33,8 +33,10 @@ $(function() {
     if (show_edit(branch, data)) {
       // patch the edit-on-github URL for correct branch
       var url = $("#edit-on-github").attr("href");
-      url = url.replace("master", branch);
-      $("#edit-on-github").attr("href", url);
+      if (url)  {
+        url = url.replace("master", branch);
+        $("#edit-on-github").attr("href", url);
+      }
       $("#docubetter").show();
     }
   });