File tree Expand file tree Collapse file tree 2 files changed +40
-3
lines changed
Expand file tree Collapse file tree 2 files changed +40
-3
lines changed Original file line number Diff line number Diff line change 1+ document . addEventListener ( 'DOMContentLoaded' , domContentLoaded )
2+
3+ const observer = new MutationObserver ( mutationObserver )
4+
5+ function domContentLoaded ( ) {
6+ for ( const el of document . querySelectorAll ( 'a' ) ) {
7+ processLink ( el )
8+ }
9+ observer . observe ( document , {
10+ childList : true ,
11+ subtree : true ,
12+ } )
13+ }
14+
15+ function mutationObserver ( mutationList ) {
16+ // console.debug('mutationList:', mutationList)
17+ for ( const mutation of mutationList ) {
18+ // console.debug('mutation:', mutation)
19+ mutation . addedNodes . forEach ( ( el ) => {
20+ // console.debug('el:', el)
21+ if ( el . classList ?. contains ( 'md-container' ) ) {
22+ for ( const el of document . querySelectorAll ( 'a' ) ) {
23+ processLink ( el )
24+ }
25+ }
26+ } )
27+ }
28+ }
29+
30+ function processLink ( el ) {
31+ // console.debug('checking el:', el)
32+ if ( el . host !== window . location . host ) {
33+ // console.debug('updating el:', el)
34+ el . target = '_blank'
35+ el . rel = 'noopener'
36+ }
37+ }
Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ site_url = "https://zensical-action.cssnr.com/"
1212
1313# https://zensical.org/docs/setup/basics/#copyright
1414copyright = """
15- <a href="https://github.com/cssnr/zensical-action-docs" target="_blank" >Zensical Action Docs</a>
15+ <a href="https://github.com/cssnr/zensical-action-docs">Zensical Action Docs</a>
1616<br>
17- Built with <a href="https://github.com/zensical/zensical" target="_blank" >Zensical</a>
17+ Built with <a href="https://github.com/zensical/zensical">Zensical</a>
1818"""
1919
2020# https://zensical.org/docs/setup/navigation/
@@ -29,7 +29,7 @@ nav = [
2929# extra_css = ["assets/stylesheets/extra.css"]
3030
3131# https://zensical.org/docs/customization/#additional-javascript
32- # extra_javascript = ["assets/javascript/extra .js"]
32+ extra_javascript = [" javascripts/external-links .js" ]
3333
3434# ----------------------------------------------------------------------------
3535# Section for configuring theme options
You can’t perform that action at this time.
0 commit comments