Changeset View
Changeset View
Standalone View
Standalone View
swh/web/templates/layout.html
Show First 20 Lines • Show All 205 Lines • ▼ Show 20 Lines | <body class="hold-transition sidebar-mini"> | ||||
</div> | </div> | ||||
</body> | </body> | ||||
<script> | <script> | ||||
swh.webapp.setSwhObjectIcons({{ swh_object_icons|jsonify }}); | swh.webapp.setSwhObjectIcons({{ swh_object_icons|jsonify }}); | ||||
swh.webapp.setReCaptchaActivated({{ grecaptcha_activated|jsonify }}); | swh.webapp.setReCaptchaActivated({{ grecaptcha_activated|jsonify }}); | ||||
</script> | </script> | ||||
<script defer> | |||||
window.onscroll = function() { | |||||
if (document.body.scrollTop > 60 || document.documentElement.scrollTop > 60) { | |||||
document.getElementById("back-to-top").style.display = "block"; | |||||
} else { | |||||
document.getElementById("back-to-top").style.display = "none"; | |||||
} | |||||
} | |||||
</script> | |||||
anlambert: Apart script that require input embedded in the Django templates, Javascript code should be… | |||||
</html> | </html> |
Apart script that require input embedded in the Django templates, Javascript code should be handled by webpack.
Thus this implementation should be moved in the file assets/src/bundles/webapp/webapp-utils.js at the end of the $(document).ready() callback starting at line 58.
All JS code handled by webpack can use jQuery and ES6 syntax so I would rather use the following implementation here: