You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2020/05/27 22:41:55 UTC
[pulsar] branch master updated: fixes RESTAPIs and Cli button not
working. (#7038)
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new adf650e fixes RESTAPIs and Cli button not working. (#7038)
adf650e is described below
commit adf650e258703af9246ebe0c0c27c1d600aee585
Author: Jiechuan Chen <65...@qq.com>
AuthorDate: Thu May 28 06:41:38 2020 +0800
fixes RESTAPIs and Cli button not working. (#7038)
Fixes #7002
### Motivation
the `REST APIs` and `Cli` button only work in English ver. website.
### Modifications
Currently, the site retrieve user selected version by `document.querySelector('a[href="/en/versions"]')`. Therefore, when the language changes, this path will no longer exists(it will become `a[href="/zh-CN/versions"]` for Chinese ver. for example).
So I changed another way that achieves the same goal, with the help of `logo` class.
The downside is that this new line of code might be ambiguous. So I added another line to comment it.
### Verifying this change
- [ yes ] Make sure that the change passes the CI checks.
---
site2/website/static/js/custom.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/site2/website/static/js/custom.js b/site2/website/static/js/custom.js
index 9ef83e5..34c3096 100644
--- a/site2/website/static/js/custom.js
+++ b/site2/website/static/js/custom.js
@@ -64,7 +64,8 @@ window.addEventListener('load', function() {
}
});
- const href = document.querySelector('a[href="/en/versions"]');
+ // retrieve current selected version from header
+ const href = document.getElementsByClassName("logo")[0].parentElement.nextSibling;
let version = href.textContent;
if (version === 'next') {