Telegram Web K with changes to work inside I2P https://web.telegram.i2p/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.3 KiB

4 years ago
let emoji = require('./emoji_pretty.json');
//let countries = require('./countries_pretty.json');
4 years ago
let countries = require('fs').readFileSync('./countries.dat').toString();
console.log(countries);
//console.log(emoji, countries);
4 years ago
let formatted = emoji.filter(e => e.has_img_apple);
/* formatted = formatted.map(e => {
let {unified, name, short_names, category, sheet_x, sheet_y} = e;
4 years ago
return {
unified,
//name,
//short_names,
category,
sheet_x,
sheet_y
};
});
require('fs').writeFileSync('./emoji.json', JSON.stringify(formatted)); */
{
let obj = {};
formatted.forEach(e => {
let {unified, name, short_names, category, sheet_x, sheet_y, sort_order} = e;
4 years ago
let emoji = unified.split('-')
.reduce((prev, curr) => prev + String.fromCodePoint(parseInt(curr, 16)), '');
4 years ago
obj[/* unified */emoji] = {
//unified,
//name,
//short_names,
category,
sheet_x,
sheet_y,
sort_order
};
});
require('fs').writeFileSync('./emoji.json', JSON.stringify(obj));
}
/* {
let obj = {};
formatted.forEach(e => {
let {unified, name, short_names, category, sheet_x, sheet_y} = e;
4 years ago
let categories = ["Smileys & People", "Animals & Nature", "Food & Drink",
"Travel & Places", "Activities", "Objects", "Symbols", "Flags", "Skin Tones"];
4 years ago
let categoryId = categories.findIndex(c => c == category);
if(categoryId === -1) throw new Error(category);
4 years ago
obj[unified] = [
sheet_x,
sheet_y,
categoryId
];
});
require('fs').writeFileSync('./emoji.json', JSON.stringify(obj));
} */
{
4 years ago
let arr = [];
/* countries.forEach(e => {
4 years ago
let {name, code, phoneCode} = e;
4 years ago
arr.push([name, code, phoneCode]);
}); */
const lines = countries.split('\n');
const data2 = [];
lines.forEach(x => {
if(!x.trim()) return;
const split = x.split(';');
const item = {
phoneCode: split[0],
code: split[1],
name: split[2],
pattern: split[3],
//count: Number(split[4]),
emoji: split[5]
};
arr.push(item);
console.log(item);
4 years ago
});
require('fs').writeFileSync('./countries.json', JSON.stringify(arr));
}