From 1eea9a4798620620e54411a061c483d226bbab1c Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Wed, 10 Apr 2019 22:18:36 +0000
Subject: [PATCH] When changing language file, keep the version tag

---
 index.js |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/index.js b/index.js
index a3695c9..8339727 100644
--- a/index.js
+++ b/index.js
@@ -315,13 +315,15 @@
 	}
 	language = lang;
 	
+	var old_script = document.getElementById('lang_script');
+	var old_version = old_script.src.match(/\?v[0-9]+/)[0];
 	var script = document.createElement('script');
 	script.type = 'text/javascript';
-	script.src = 'lang_' + lang + '.js';
+	script.src = 'lang_' + lang + '.js' + (old_version ? old_version : '');
 	script.id = 'lang_script';
 	script.onload = translate;
 	
-	document.body.removeChild(document.getElementById('lang_script'));
+	document.body.removeChild(old_script);
 	document.body.appendChild(script);
 	
 	ignore_hashchange = true;

--
Gitblit v1.9.1