diff --git a/djangoproject/static/js/djangoproject.js b/djangoproject/static/js/djangoproject.js new file mode 100644 index 000000000..474231d6d --- /dev/null +++ b/djangoproject/static/js/djangoproject.js @@ -0,0 +1,6 @@ +// Toggle persistent display of documentation version and language options +document.querySelectorAll('.doc-switcher li.current').forEach(function (el) { + el.addEventListener('click', function () { + this.parentElement.classList.toggle('open'); + }); +}); diff --git a/djangoproject/static/js/main.js b/djangoproject/static/js/main.js index 983a4918a..8d9dd2797 100644 --- a/djangoproject/static/js/main.js +++ b/djangoproject/static/js/main.js @@ -23,10 +23,6 @@ define(function () { mods.push('mod/version-switcher'); } - if (hasClass('doc-switcher')) { - mods.push('mod/doc-switcher'); - } - if (hasClass('doc-floating-warning')) { mods.push('mod/floating-warning'); } diff --git a/djangoproject/static/js/mod/doc-switcher.js b/djangoproject/static/js/mod/doc-switcher.js deleted file mode 100644 index 081d60664..000000000 --- a/djangoproject/static/js/mod/doc-switcher.js +++ /dev/null @@ -1,24 +0,0 @@ -define([ - 'jquery', //requires jquery -], function ($) { - var DocSwitcher = function (switchers) { - this.switchers = $(switchers); - this.init(); - }; - - DocSwitcher.prototype = { - init: function () { - var self = this; - $(document).ready(function () { - // Make version switcher clickable for touch devices - - self.switchers.find('li.current').on('click', function () { - $(this).closest('ul').toggleClass('open'); - }); - }); - }, - }; - - // Export a single instance of our module: - return new DocSwitcher('.doc-switcher'); -}); diff --git a/djangoproject/templates/base.html b/djangoproject/templates/base.html index d6b0c6071..896483b61 100644 --- a/djangoproject/templates/base.html +++ b/djangoproject/templates/base.html @@ -165,6 +165,7 @@ }; + {% block body_extra %}{% endblock body_extra %}