File tree Expand file tree Collapse file tree 4 files changed +38
-6
lines changed Expand file tree Collapse file tree 4 files changed +38
-6
lines changed Original file line number Diff line number Diff line change @@ -77,9 +77,9 @@ <h5 class="card-title">Ask Pyarmor</h5>
7777
7878 < script src ="/pyarmor/assets/bootstrap-5.3.3/bootstrap.bundle.min.js "> </ script >
7979 < script >
80- window . addEventListener ( ' DOMContentLoaded' , ( ) => {
81- document . querySelector ( ' button.zh' ) . addEventListener ( "click" , ( e ) => {
82- window . location . replace ( window . location . href . replace ( ' /en/' , ` /zh/` ) )
80+ window . addEventListener ( " DOMContentLoaded" , ( ) => {
81+ document . querySelector ( " button.zh" ) . addEventListener ( "click" , ( e ) => {
82+ window . location . replace ( window . location . href . replace ( " /en/" , " /zh/" ) )
8383 } )
8484 } )
8585 </ script >
Original file line number Diff line number Diff line change @@ -76,9 +76,9 @@ <h5 class="card-title">Pyarmor 解惑</h5>
7676
7777 < script src ="/pyarmor/assets/bootstrap-5.3.3/bootstrap.bundle.min.js "> </ script >
7878 < script >
79- window . addEventListener ( ' DOMContentLoaded' , ( ) => {
80- document . querySelector ( ' button.en' ) . addEventListener ( "click" , ( e ) => {
81- window . location . replace ( window . location . href . replace ( ' /zh/' , ` /en/` ) )
79+ window . addEventListener ( " DOMContentLoaded" , ( ) => {
80+ document . querySelector ( " button.en" ) . addEventListener ( "click" , ( e ) => {
81+ window . location . replace ( window . location . href . replace ( " /zh/" , " /en/" ) )
8282 } )
8383 } )
8484 </ script >
Original file line number Diff line number Diff line change 7070# order to make the URL links work properly, an appropriate target
7171# attribute must be set, such as "_top" and "_blank".
7272graphviz_output_format = 'svg'
73+
74+ # Change language by modify `view page source`
75+ js_switch_lang = '''
76+ window.addEventListener("DOMContentLoaded", () => {
77+ // View page source
78+ const elment = document.querySelector("ul.wy-breadcrumbs > li.wy-breadcrumbs-aside > a")
79+ element.innerHTML = "中文"
80+ element.addEventListener("click", (e) => {
81+ e.preventDefault()
82+ window.location.replace(window.location.href.replace("/en/", "/zh/"))
83+ })
84+ '''
85+
86+ html_js_files = [
87+ (None , {'body' : js_switch_lang }),
88+ ]
Original file line number Diff line number Diff line change 7070# order to make the URL links work properly, an appropriate target
7171# attribute must be set, such as "_top" and "_blank".
7272graphviz_output_format = 'svg'
73+
74+ # Change language by modify `view page source`
75+ js_switch_lang = '''
76+ window.addEventListener("DOMContentLoaded", () => {
77+ // View page source
78+ const elment = document.querySelector("ul.wy-breadcrumbs > li.wy-breadcrumbs-aside > a")
79+ element.innerHTML = "English"
80+ element.addEventListener("click", (e) => {
81+ e.preventDefault()
82+ window.location.replace(window.location.href.replace("/zh/", "/en/"))
83+ })
84+ '''
85+
86+ html_js_files = [
87+ (None , {'body' : js_switch_lang }),
88+ ]
You can’t perform that action at this time.
0 commit comments