Changeset View
Changeset View
Standalone View
Standalone View
swh/web/templates/includes/content-display.html
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | See top-level LICENSE file for more information | ||||
</div> | </div> | ||||
<script> | <script> | ||||
{% if "application/pdf" == mimetype %} | {% if "application/pdf" == mimetype %} | ||||
swh.webapp.renderPdf({{ top_right_link.url|jsonify }}); | swh.webapp.renderPdf({{ top_right_link.url|jsonify }}); | ||||
{% elif swh_object_metadata.filename and swh_object_metadata.filename|default:""|slice:"-5:" == "ipynb" %} | {% elif swh_object_metadata.filename and swh_object_metadata.filename|default:""|slice:"-5:" == "ipynb" %} | ||||
swh.webapp.renderNotebook({{ top_right_link.url|jsonify }}, '.swh-ipynb'); | swh.webapp.renderNotebook({{ top_right_link.url|jsonify }}, '.swh-ipynb'); | ||||
{% elif content %} | {% elif content %} | ||||
let codeContainer = $('code'); | |||||
let content = codeContainer.text(); | |||||
swh.webapp.highlightCode(); | |||||
function updateLanguage(language) { | |||||
codeContainer.text(content); | |||||
codeContainer.removeClass(); | |||||
codeContainer.addClass(language); | |||||
swh.webapp.highlightCode(); | swh.webapp.highlightCode(); | ||||
} | |||||
{% endif %} | {% endif %} | ||||
vlorentz: This currently works because there are no other params, but it would be nice to support other… | |||||
Done Inline ActionsI tested it with other params like origin_url, it works. (URLSearchParams stores all params in url) kalpitk: I tested it with other params like origin_url, it works.
I mean for links like "http://127.0.0. | |||||
Not Done Inline ActionsIndeed, my bad vlorentz: Indeed, my bad | |||||
</script> | </script> | ||||
{% endif %} | {% endif %} |
This currently works because there are no other params, but it would be nice to support other parameters in the URL, so we don't get unexpected bugs later.