-/*
- * Forms which have been cached by rails may have the wrong
- * authenticity token, so patch up any forms with the correct
- * token taken from the page header.
- */
-$(document).ready(function () {
- var auth_token = $("meta[name=csrf-token]").attr("content");
- $("form input[name=authenticity_token]").val(auth_token);
+ $("body").addClass("compact-nav");
+
+ $("header").children(":visible").each(function (i, e) {
+ compactWidth = compactWidth + $(e).outerWidth();
+ });
+
+ $("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) {
+ e.preventDefault();
+ $("header").toggleClass("closed");
+ });
+
+ $("nav.primary li a").on("click", 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"));