]> git.proxmox.com Git - pve-docs.git/blobdiff - api-viewer/PVEAPI.js
apiviewer: add api endpoint deeplink ability
[pve-docs.git] / api-viewer / PVEAPI.js
index d0da407d324238d9c748abca97175c9896642ac8..dd36fff5792a1f44bb9cbda663c8b9b6e5d14037 100644 (file)
@@ -368,6 +368,7 @@ Ext.onReady(function() {
                    return;
                var rec = selections[0];
                render_docu(rec.data);
+               location.hash = '#' + rec.data.path;
            }
        }
     });
@@ -389,4 +390,18 @@ Ext.onReady(function() {
        ]
     });
 
+    var deepLink = function() {
+       var path = window.location.hash.substring(1);
+       var endpoint = store.findNode('path', path);
+
+       if (endpoint) {
+           tree.getSelectionModel().select(endpoint);
+           tree.expandPath(endpoint.getPath());
+           render_docu(endpoint.data);
+       }
+    }
+    window.onhashchange = deepLink;
+
+    deepLink();
+
 });