From 11e636359d17775529e6fc5469bdb4ce347bb0c5 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Tue, 6 Apr 2021 12:37:26 -0400 Subject: [PATCH] Clean up lang field setting in pad.tmpl This continues work by @cjeller1592 in #435. --- templates/pad.tmpl | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/templates/pad.tmpl b/templates/pad.tmpl index 049ac27..8da063e 100644 --- a/templates/pad.tmpl +++ b/templates/pad.tmpl @@ -186,21 +186,14 @@ var xpostTarg = H.get('crosspostTarget', '[]'); var http = new XMLHttpRequest(); - var lang = navigator.languages ? navigator.languages[0] : (navigator.language || navigator.userLanguage); - lang = lang.substring(0, 2); var post = H.getTitleStrict(content); var params = { body: post.content, title: post.title, - font: font, - {{ if or .Post.Slug .Post.Id }} - }; - {{ else }} - lang: lang - }; - {{ end }} - + font: font + }; + {{ if .Post.Slug }} var url = "/api/collections/{{.EditCollection.Alias}}/posts/{{.Post.Id}}"; {{ else if .Post.Id }} @@ -210,6 +203,10 @@ } params.token = token; {{ else }} + var lang = navigator.languages ? navigator.languages[0] : (navigator.language || navigator.userLanguage); + lang = lang.substring(0, 2); + params.lang = lang; + var url = "/api/posts"; var postTarget = H.get('postTarget', 'anonymous'); if (postTarget != 'anonymous') {