Skip to content

Commit

Permalink
Add script to make all links in response section clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
youzarsiph committed May 18, 2024
1 parent 5c7b0b7 commit a063f76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions drf_material/templates/rest_framework/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -513,4 +513,13 @@ <h3 class="dropdown-header">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/http.min.js"></script>
<script>hljs.highlightAll()</script>
<script>
// Make all links in response section clickable
setTimeout(() =>
document.querySelectorAll('.response-info .language-json .hljs-string .str').forEach(e => {
if (e.innerHTML.startsWith('"http')) {
e.innerHTML = `<a href="${e.innerHTML.slice(1, e.innerHTML.length - 1)}">${e.innerHTML}</a>`
}
}), 100);
</script>
{% endblock %}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "drf-material"
version = "0.3.0"
version = "0.3.1"
description = "Material design for Django REST Framework API"
authors = ["Yousef Abu Shanab <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit a063f76

Please sign in to comment.