Skip to content

Commit 9abfb95

Browse files
committed
Add download attribute to source links in NBs
1 parent ae02c31 commit 9abfb95

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

docs/_static/linksdl.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
* ~~~~~~~~~~~
44
*
55
* javascript code to enable download links of notebooks and scripts *.py
6+
* https://stackoverflow.com/questions/2304941
67
*
78
*/
89

9-
$(document).ready(function() {
10-
document.getElementsByClassName("last")[0].children[1].setAttribute("download", "")
11-
document.getElementsByClassName("last")[0].children[2].setAttribute("download", "")
12-
});
10+
document.onreadystatechange = function () {
11+
if (document.readyState == "interactive") {
12+
document.getElementsByClassName("line")[2].children[1].setAttribute("download", "")
13+
document.getElementsByClassName("line")[2].children[2].setAttribute("download", "")
14+
}
15+
}

0 commit comments

Comments
 (0)