Change eq by RegEx (#1576)

This commit is contained in:
Christophe Maudoux 2018-12-10 21:14:30 +01:00
parent 3e6534a55a
commit b359476709
3 changed files with 14 additions and 5 deletions

View File

@ -303,7 +303,11 @@ $(document).ready ->
for al in window.availableLanguages
langdiv += "<img class=\"langicon\" src=\"#{window.staticPrefix}common/#{al}.png\" title=\"#{al}\" alt=\"[#{al}]\"> "
for nl in nlangs
if al == nl
console.log 'Navigator lang', nl
console.log 'Available lang', al
re = new RegExp('^'+al+'-?')
if nl.match re
console.log 'Matching lang', al
langs.push al
else if al.substring(0, 1) == nl.substring(0, 1)
langs2.push al
@ -312,6 +316,7 @@ $(document).ready ->
lang = window.availableLanguages[0]
else if lang not in window.availableLanguages
lang = window.availableLanguages[0]
console.log 'Selected lang', lang
setCookie 'llnglanguage', lang
translatePage(lang)

View File

@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.12.8
// Generated by CoffeeScript 1.12.7
/*
LemonLDAP::NG Portal jQuery scripts
@ -217,7 +217,7 @@ LemonLDAP::NG Portal jQuery scripts
datas = {};
$(document).ready(function() {
var action, al, authMenuTabs, back_url, i, l, lang, langdiv, langs, langs2, len, len1, len2, link, m, menuIndex, menuTabs, method, nl, nlangs, ref, ref1;
var action, al, authMenuTabs, back_url, i, l, lang, langdiv, langs, langs2, len, len1, len2, link, m, menuIndex, menuTabs, method, nl, nlangs, re, ref, ref1;
datas = getValues();
window.datas = datas;
if (datas['antiframe'] && top !== self) {
@ -288,7 +288,11 @@ LemonLDAP::NG Portal jQuery scripts
langdiv += "<img class=\"langicon\" src=\"" + window.staticPrefix + "common/" + al + ".png\" title=\"" + al + "\" alt=\"[" + al + "]\"> ";
for (l = 0, len1 = nlangs.length; l < len1; l++) {
nl = nlangs[l];
if (al === nl) {
console.log('Navigator lang', nl);
console.log('Available lang', al);
re = new RegExp('^' + al + '-?');
if (nl.match(re)) {
console.log('Matching lang', al);
langs.push(al);
} else if (al.substring(0, 1) === nl.substring(0, 1)) {
langs2.push(al);

File diff suppressed because one or more lines are too long