X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/1a7b7f5d18931f60f4171b7ac410ea4434828dd1..a7da2a5b3962a28e2cafbd6ae606290a29639a78:/app/assets/javascripts/application.js diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index e9cc08606..29563cb4a 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,6 +1,5 @@ //= require jquery3 //= require jquery_ujs -//= require jquery.timers //= require jquery.throttle-debounce //= require js-cookie/dist/js.cookie //= require popper @@ -16,8 +15,29 @@ //= require matomo //= require richtext //= require qs/dist/qs -//= require bs-custom-file-input -//= require bs-custom-file-input-init + +{ + const application_data = $("head").data(); + + I18n.default_locale = OSM.DEFAULT_LOCALE; + I18n.locale = application_data.locale; + I18n.fallbacks = true; + + OSM.preferred_editor = application_data.preferredEditor; + OSM.preferred_languages = application_data.preferredLanguages; + + if (application_data.user) { + OSM.user = application_data.user; + + if (application_data.userHome) { + OSM.home = application_data.userHome; + } + } + + if (application_data.location) { + OSM.location = application_data.location; + } +} /* * Called as the user scrolls/zooms around to manipulate hrefs of the @@ -108,10 +128,12 @@ $(document).ready(function () { $("body").removeClass("compact-nav"); $("header").removeClass("text-nowrap"); + $("header nav.secondary > ul").removeClass("flex-nowrap"); updateHeader(); $(window).resize(updateHeader); + $(document).on("turbo:render", updateHeader); }, 0); $("#menu-icon").on("click", function (e) { @@ -123,27 +145,6 @@ $(document).ready(function () { $("header").toggleClass("closed"); }); - var application_data = $("head").data(); - - I18n.default_locale = OSM.DEFAULT_LOCALE; - I18n.locale = application_data.locale; - I18n.fallbacks = true; - - OSM.preferred_editor = application_data.preferredEditor; - OSM.preferred_languages = application_data.preferredLanguages; - - if (application_data.user) { - OSM.user = application_data.user; - - if (application_data.userHome) { - OSM.home = application_data.userHome; - } - } - - if (application_data.location) { - OSM.location = application_data.location; - } - $("#edit_tab") .attr("title", I18n.t("javascripts.site.edit_disabled_tooltip")); });