get rid of flag cdn

This commit is contained in:
HB9HIL
2024-07-25 15:54:09 +02:00
parent 1a03e8e156
commit f3638c58aa
4 changed files with 23 additions and 2 deletions

View File

@@ -1,6 +1,11 @@
/*!
* No overrides for the default theme as it aligns with general.css
*/
body {
font-family: "Twemoji Country Flags", "Helvetica", "Comic Sans", serif;
}
:root {
--cl-border-btn-pwd: var(--bs-body-bg);
}

View File

@@ -77,6 +77,17 @@ function verify_log() {
}
}
function country2flag($code) {
$code = strtoupper($code);
$offset = 0x1F1E6;
$code_p1 = $offset + ord($code[0]) - ord('A');
$code_p2 = $offset + ord($code[1]) - ord('A');
$flag = mb_chr($code_p1, 'UTF-8') . mb_chr($code_p2, 'UTF-8');
return $flag;
}
// Function to read the debug logfile
function read_logfile() {
if (verify_log()) {

View File

@@ -32,6 +32,12 @@
location.reload();
});
</script>
<script type="module" defer>
import {
polyfillCountryFlagEmojis
} from "<?php echo base_url(); ?>../assets/js/country-flag-emoji-polyfill.js";
polyfillCountryFlagEmojis();
</script>
<?php
/**
* Hidden field to be able to translate the language names

View File

@@ -77,8 +77,7 @@ if (!file_exists('.lock')) {
<ul style="list-style-type: none;">
<?php foreach ($languages as $lang) { ?>
<li>
<img src="https://flagcdn.com/w20/<?php echo ($lang['code'] == 'en') ? 'gb' : $lang['flag']; ?>.png">
<a href="?lang=<?php echo $lang['gettext']; ?>"><?php echo $lang['name_en']; ?></a>
<?php echo country2flag($lang['flag']); ?> <a href="?lang=<?php echo $lang['gettext']; ?>"><?php echo $lang['name_en']; ?></a>
</li>
<?php } ?>
</ul>