@@ -97,7 +97,7 @@ <h2 class="author">Read by {% if reader %}<a href="{{ reader.url }}">{{ reader.t
9797 </ i > </ p >
9898
9999 {% if site.show_bibtex %}
100- < details class ="details-reset bibtex " ontoggle =" deetstoggler(); " >
100+ < details class ="details-reset bibtex ">
101101 < summary class ="btn "> Bibtex Data < span class ="dropdown-caret "> </ span > </ summary >
102102 < div >
103103{% capture bibtex %}{% include content.bibtex.liquid content=page %}{% endcapture %}
@@ -113,11 +113,32 @@ <h2 class="author">Read by {% if reader %}<a href="{{ reader.url }}">{{ reader.t
113113function clearTooltip ( ) { this . setAttribute ( 'class' , 'btn copybutton' ) ; this . removeAttribute ( 'aria-label' ) ; }
114114function showTooltip ( elem , msg ) { elem . setAttribute ( 'class' , 'btn copybutton tooltipped tooltipped-n' ) ; elem . setAttribute ( 'aria-label' , msg ) ; setTimeout ( clearTooltip . bind ( elem ) , 4000 ) ; }
115115 </ script >
116- < table class ="metadata "> < tbody > {% if site.show_timestamps %}
117- < tr > < td > Added</ td > < td > < span style =" font-family: system-ui, sans; " > {{ page.date | date_to_rfc822 }}</ span > </ td > </ tr >
118- {% if page.last_modified_at > page.date %}< tr > < td > Updated</ td > < td > < span style =" font-family: system-ui, sans; " > {{ page.last_modified_at | date_to_rfc822 }}</ span > </ td > </ tr > {% endif %}{% endif %}
119- < tr > < td > Sorting Value</ td > < td > < span style =" font-family: system-ui, sans; " > {{ page.expected_value }}</ span > </ td > </ tr >
116+ < table id ="metadata "> < tbody > {% if site.show_timestamps %}
117+ < tr > < td > Added</ td > < td > < span > {{ page.date | date_to_rfc822 }}</ span > </ td > </ tr >
118+ {% if page.last_modified_at > page.date %}< tr > < td > Updated</ td > < td > < span > {{ page.last_modified_at | date_to_rfc822 }}</ span > </ td > </ tr > {% endif %}{% endif %}
119+ < tr > < td > Sorting Value</ td > < td > < span > {{ page.expected_value }}</ span > </ td > </ tr >
120120 </ tbody > </ table >
121+ < script type ="module ">
122+ function addDownloadCountRow ( download_count ) {
123+ const table = document . getElementById ( "metadata" ) ;
124+ const dcRow = table . insertRow ( ) ;
125+ const labelCell = dcRow . insertCell ( 0 ) ;
126+ labelCell . appendChild ( document . createTextNode ( "Download Count" ) ) ;
127+ const valueCell = dcRow . insertCell ( 1 ) ;
128+ const value = document . createTextNode ( download_count . toString ( ) ) ;
129+ const valueSpan = document . createElement ( 'span' ) ;
130+ valueSpan . appendChild ( value ) ;
131+ valueCell . appendChild ( valueSpan ) ;
132+ }
133+ const download_count_resp = await fetch ( "https://buddhistuniversity.net/analytics/content/{{ page.content_path }}.download_count" ) ;
134+ var download_count = 0 ;
135+ if ( download_count_resp . ok ) {
136+ download_count = await download_count_resp . text ( ) ;
137+ download_count = Number . parseInt ( download_count ) ;
138+ }
139+ download_count ++ ;
140+ addDownloadCountRow ( download_count ) ;
141+ </ script >
121142 < span > < a href ="https://github.com/{{ site.github_repo }}/blob/{{ site.github_branch }}/{{ page.path }} "> View this entry's source code on GitHub</ a > </ span >
122143 </ div >
123144 </ details > {% endif %}
0 commit comments