File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed
Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change 11< script >
2+ function zulipEncodeTopic ( topic ) {
3+ return Array . from ( topic ) . map ( ch => {
4+ const code = ch . charCodeAt ( 0 ) ;
5+ if (
6+ ( code >= 48 && code <= 57 ) || // 0-9
7+ ( code >= 65 && code <= 90 ) || // A-Z
8+ ( code >= 97 && code <= 122 ) // a-z
9+ ) {
10+ return ch ;
11+ } else {
12+ return "." + code . toString ( 16 ) . toUpperCase ( ) . padStart ( 2 , "0" ) ;
13+ }
14+ } ) . join ( "" ) ;
15+ }
16+
217document . addEventListener ( 'DOMContentLoaded' , ( event ) => {
318 const zulipOrg = "clojurians.zulipchat.com" ;
4- const zulipChannel = "clojurecivitas" ;
5- const title =
6- document . querySelector ( '#title-block-header h1.title' ) ?. textContent . trim ( ) ;
19+ const zulipChannel = "528764-clojurecivitas" ;
20+ const title = document . querySelector ( '#title-block-header h1.title' ) ?. textContent . trim ( ) ;
721
822 if ( title ) {
9- const encodedTitle = encodeURIComponent ( title ) ;
10- const zulipURL = `https://${ zulipOrg } /#narrow/stream /${ zulipChannel } /topic/${ encodedTitle } ` ;
23+ const encodedTitle = zulipEncodeTopic ( title ) ;
24+ const zulipURL = `https://${ zulipOrg } /#narrow/channel /${ zulipChannel } /topic/${ encodedTitle } ` ;
1125 const linkHTML = `<p><a href="${ zulipURL } ">Discuss ${ title } on Zulip</a></p>` ;
1226 document . getElementById ( 'quarto-content' ) . insertAdjacentHTML ( 'beforeend' , linkHTML ) ;
1327 }
You can’t perform that action at this time.
0 commit comments