mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-01-13 08:27:51 +00:00
updated franc.js, fixes of filtering, localization for de,fr,ru,zh
This commit is contained in:
parent
8515059eea
commit
fb95e64011
@ -1929,12 +1929,13 @@ ol.toptrends-list {
|
||||
}
|
||||
|
||||
.langFilterSimData {
|
||||
color: rgba( 0, 0, 0, .7 );
|
||||
font: 10px "Open Sans", sans-serif;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.langFilterSimData em {
|
||||
color: rgba( 227, 79, 66, .5 );
|
||||
color: rgba( 227, 79, 66, .7 );
|
||||
}
|
||||
|
||||
/*************************************
|
||||
|
File diff suppressed because one or more lines are too long
@ -236,6 +236,25 @@ if(preferredLanguage == "en"){
|
||||
"hour(s)": "hour(s)",
|
||||
"second(s)": "second(s)",
|
||||
"only numbers are allowed!": "only numbers are allowed!",
|
||||
"Language filtering": "Language filtering",
|
||||
"By blacklist": "By blacklist",
|
||||
"By whitelist": "By whitelist",
|
||||
"Comma separated ISO 639-3 language codes": "Comma separated ISO 639-3 language codes",
|
||||
"Accuracy": "Accuracy",
|
||||
"Simulation mode": "Simulation mode",
|
||||
"This post is treated by language filter": "This post is %{treated} by language filter.",
|
||||
"blocked": "blocked",
|
||||
"passed": "passed",
|
||||
"not analyzed": "not analyzed",
|
||||
"Reason: this": "Reason: %{this}",
|
||||
"this doesnt contain that": "%{this} does not contain %{that}",
|
||||
"blacklist": "blacklist",
|
||||
"whitelist": "whitelist",
|
||||
"language of this": "language of this",
|
||||
"its undefined language": "it is undefined language",
|
||||
"its this, blacklisted": "it is %{this}, blacklisted",
|
||||
"its this, whitelisted": "it is %{this}, whitelisted",
|
||||
"Most possible language: this": "Most possible language: %{this}",
|
||||
"Show with every user name": "Show with every user name",
|
||||
"Show at profile modal only": "Show at profile modal only",
|
||||
"Show if a user follows me": "Show if a user follows me",
|
||||
@ -482,6 +501,25 @@ if(preferredLanguage == "es"){
|
||||
"hour(s)": "hora(s)",
|
||||
"second(s)": "segundo(s)",
|
||||
"only numbers are allowed!": "only numbers are allowed!",
|
||||
"Language filtering": "Language filtering",
|
||||
"By blacklist": "By blacklist",
|
||||
"By whitelist": "By whitelist",
|
||||
"Comma separated ISO 639-3 language codes": "Comma separated ISO 639-3 language codes",
|
||||
"Accuracy": "Accuracy",
|
||||
"Simulation mode": "Simulation mode",
|
||||
"This post is treated by language filter": "This post is %{treated} by language filter.",
|
||||
"blocked": "blocked",
|
||||
"passed": "passed",
|
||||
"not analyzed": "not analyzed",
|
||||
"Reason: this": "Reason: %{this}",
|
||||
"this doesnt contain that": "%{this} does not contain %{that}",
|
||||
"blacklist": "blacklist",
|
||||
"whitelist": "whitelist",
|
||||
"language of this": "language of this",
|
||||
"its undefined language": "it is undefined language",
|
||||
"its this, blacklisted": "it is %{this}, blacklisted",
|
||||
"its this, whitelisted": "it is %{this}, whitelisted",
|
||||
"Most possible language: this": "Most possible language: %{this}",
|
||||
"Show with every user name": "Show with every user name",
|
||||
"Show at profile modal only": "Show at profile modal only",
|
||||
"Show if a user follows me": "Show if a user follows me",
|
||||
@ -725,6 +763,25 @@ if(preferredLanguage == "uk"){
|
||||
"hour(s)": "hour(s)",
|
||||
"second(s)": "second(s)",
|
||||
"only numbers are allowed!": "only numbers are allowed!",
|
||||
"Language filtering": "Language filtering",
|
||||
"By blacklist": "By blacklist",
|
||||
"By whitelist": "By whitelist",
|
||||
"Comma separated ISO 639-3 language codes": "Comma separated ISO 639-3 language codes",
|
||||
"Accuracy": "Accuracy",
|
||||
"Simulation mode": "Simulation mode",
|
||||
"This post is treated by language filter": "This post is %{treated} by language filter.",
|
||||
"blocked": "blocked",
|
||||
"passed": "passed",
|
||||
"not analyzed": "not analyzed",
|
||||
"Reason: this": "Reason: %{this}",
|
||||
"this doesnt contain that": "%{this} does not contain %{that}",
|
||||
"blacklist": "blacklist",
|
||||
"whitelist": "whitelist",
|
||||
"language of this": "language of this",
|
||||
"its undefined language": "it is undefined language",
|
||||
"its this, blacklisted": "it is %{this}, blacklisted",
|
||||
"its this, whitelisted": "it is %{this}, whitelisted",
|
||||
"Most possible language: this": "Most possible language: %{this}",
|
||||
"Show with every user name": "Show with every user name",
|
||||
"Show at profile modal only": "Show at profile modal only",
|
||||
"Show if a user follows me": "Show if a user follows me",
|
||||
@ -966,7 +1023,26 @@ if(preferredLanguage == "zh"){
|
||||
"Show if the original is older than": "Show if the original is older than",
|
||||
"hour(s)": "hour(s)",
|
||||
"second(s)": "second(s)",
|
||||
"only numbers are allowed!": "only numbers are allowed!",
|
||||
"only numbers are allowed!": "只允许数字!",
|
||||
"Language filtering": "语言过滤",
|
||||
"By blacklist": "用黑名单",
|
||||
"By whitelist": "用白名单",
|
||||
"Comma separated ISO 639-3 language codes": "英文逗号分隔的 ISO 639-3 语言代码",
|
||||
"Accuracy": "准确度",
|
||||
"Simulation mode": "模拟模式",
|
||||
"This post is treated by language filter": "这条推文被语言过滤器 %{treated} .",
|
||||
"blocked": "阻止",
|
||||
"passed": "放行",
|
||||
"not analyzed": "未被分析",
|
||||
"Reason: this": "原因: %{this}",
|
||||
"this doesnt contain that": "%{this} 不包含 %{that}",
|
||||
"blacklist": "黑名单",
|
||||
"whitelist": "白名单",
|
||||
"language of this": "语言",
|
||||
"its undefined language": "它是未识别语言",
|
||||
"its this, blacklisted": "它是 %{this}, 被黑名单",
|
||||
"its this, whitelisted": "它是 %{this}, 被白名单",
|
||||
"Most possible language: this": "最可能的语言: %{this}",
|
||||
"Show with every user name": "Show with every user name",
|
||||
"Show at profile modal only": "Show at profile modal only",
|
||||
"Show if a user follows me": "Show if a user follows me",
|
||||
@ -1210,6 +1286,25 @@ if(preferredLanguage == "nl"){
|
||||
"hour(s)": "hour(s)",
|
||||
"second(s)": "seconde(n)",
|
||||
"only numbers are allowed!": "only numbers are allowed!",
|
||||
"Language filtering": "Language filtering",
|
||||
"By blacklist": "By blacklist",
|
||||
"By whitelist": "By whitelist",
|
||||
"Comma separated ISO 639-3 language codes": "Comma separated ISO 639-3 language codes",
|
||||
"Accuracy": "Accuracy",
|
||||
"Simulation mode": "Simulation mode",
|
||||
"This post is treated by language filter": "This post is %{treated} by language filter.",
|
||||
"blocked": "blocked",
|
||||
"passed": "passed",
|
||||
"not analyzed": "not analyzed",
|
||||
"Reason: this": "Reason: %{this}",
|
||||
"this doesnt contain that": "%{this} does not contain %{that}",
|
||||
"blacklist": "blacklist",
|
||||
"whitelist": "whitelist",
|
||||
"language of this": "language of this",
|
||||
"its undefined language": "it is undefined language",
|
||||
"its this, blacklisted": "it is %{this}, blacklisted",
|
||||
"its this, whitelisted": "it is %{this}, whitelisted",
|
||||
"Most possible language: this": "Most possible language: %{this}",
|
||||
"Show with every user name": "Show with every user name",
|
||||
"Show at profile modal only": "Show at profile modal only",
|
||||
"Show if a user follows me": "Show if a user follows me",
|
||||
@ -1450,6 +1545,25 @@ if(preferredLanguage == "it"){
|
||||
"hour(s)": "hour(s)",
|
||||
"second(s)": "secondo(i)",
|
||||
"only numbers are allowed!": "only numbers are allowed!",
|
||||
"Language filtering": "Language filtering",
|
||||
"By blacklist": "By blacklist",
|
||||
"By whitelist": "By whitelist",
|
||||
"Comma separated ISO 639-3 language codes": "Comma separated ISO 639-3 language codes",
|
||||
"Accuracy": "Accuracy",
|
||||
"Simulation mode": "Simulation mode",
|
||||
"This post is treated by language filter": "This post is %{treated} by language filter.",
|
||||
"blocked": "blocked",
|
||||
"passed": "passed",
|
||||
"not analyzed": "not analyzed",
|
||||
"Reason: this": "Reason: %{this}",
|
||||
"this doesnt contain that": "%{this} does not contain %{that}",
|
||||
"blacklist": "blacklist",
|
||||
"whitelist": "whitelist",
|
||||
"language of this": "language of this",
|
||||
"its undefined language": "it is undefined language",
|
||||
"its this, blacklisted": "it is %{this}, blacklisted",
|
||||
"its this, whitelisted": "it is %{this}, whitelisted",
|
||||
"Most possible language: this": "Most possible language: %{this}",
|
||||
"Show with every user name": "Show with every user name",
|
||||
"Show at profile modal only": "Show at profile modal only",
|
||||
"Show if a user follows me": "Show if a user follows me",
|
||||
@ -1693,7 +1807,26 @@ if(preferredLanguage == "fr"){
|
||||
"Show if the original is older than": "Show if the original is older than",
|
||||
"hour(s)": "hour(s)",
|
||||
"second(s)": "seconde(s)",
|
||||
"only numbers are allowed!": "only numbers are allowed!",
|
||||
"only numbers are allowed!": "Seuls les chiffres sont autorisés!",
|
||||
"Language filtering": "Filtre par langue",
|
||||
"By blacklist": "Par blacklist",
|
||||
"By whitelist": "Par liste blanche",
|
||||
"Comma separated ISO 639-3 language codes": "Codes ISO 639-3 séparés par une virgule",
|
||||
"Accuracy": "Précision",
|
||||
"Simulation mode": "Mode simulation",
|
||||
"This post is treated by language filter": "Ce post est %{treated} par le filtre de langue.",
|
||||
"blocked": "bloqué",
|
||||
"passed": "transmis",
|
||||
"not analyzed": "non analysé",
|
||||
"Reason: this": "Raison: %{this}",
|
||||
"this doesnt contain that": "%{this} ne contient pas %{that}",
|
||||
"blacklist": "blacklist",
|
||||
"whitelist": "liste blanche",
|
||||
"language of this": "Langue",
|
||||
"its undefined language": "Langue indéfinie",
|
||||
"its this, blacklisted": "C'est %{this}, sur blacklist",
|
||||
"its this, whitelisted": "C'est %{this}, sur liste blanche",
|
||||
"Most possible language: this": "Langue la plus probable: %{this}",
|
||||
"Show with every user name": "Show with every user name",
|
||||
"Show at profile modal only": "Show at profile modal only",
|
||||
"Show if a user follows me": "Show if a user follows me",
|
||||
@ -1938,7 +2071,26 @@ if(preferredLanguage == "ru"){
|
||||
"Show if the original is older than": "Показывать если исходное сообщение старше",
|
||||
"hour(s)": "час(ов)",
|
||||
"second(s)": "секунд(а,ы)",
|
||||
"only numbers are allowed!": "только числа!",
|
||||
"only numbers are allowed!": "разрешены только числа!",
|
||||
"Language filtering": "Ограничение языковым фильтром",
|
||||
"By blacklist": "с помощью чёрного списка",
|
||||
"By whitelist": "с помощью белого списка",
|
||||
"Comma separated ISO 639-3 language codes": "Соответствующие ISO 639-3 языковые коды, разделённые запятыми",
|
||||
"Accuracy": "Точность",
|
||||
"Simulation mode": "Режим симуляции",
|
||||
"This post is treated by language filter": "Этот пост %{treated} языковым фильтром.",
|
||||
"blocked": "запрещён",
|
||||
"passed": "разрешён",
|
||||
"not analyzed": "не обработан",
|
||||
"Reason: this": "Причина: %{this}",
|
||||
"this doesnt contain that": "%{this} не содержит %{that}",
|
||||
"blacklist": "чёрный список",
|
||||
"whitelist": "белый список",
|
||||
"language of this": "такой язык",
|
||||
"its undefined language": "язык не определён",
|
||||
"its this, blacklisted": "это %{this}, есть в чёрном списке",
|
||||
"its this, whitelisted": "это %{this}, есть в белом списке",
|
||||
"Most possible language: this": "Наиболее вероятный язык: %{this}",
|
||||
"Show with every user name": "Показывать везде около имени пользователя",
|
||||
"Show at profile modal only": "Показывать только в окне профиля",
|
||||
"Show if a user follows me": "Показывать подписан ли пользователь на меня",
|
||||
@ -2187,7 +2339,26 @@ if(preferredLanguage == "de"){
|
||||
"Show if the original is older than": "Show if the original is older than",
|
||||
"hour(s)": "hour(s)",
|
||||
"second(s)": "Sekunde(n)",
|
||||
"only numbers are allowed!": "only numbers are allowed!",
|
||||
"only numbers are allowed!": "nur Zahlen erlaubt!",
|
||||
"Language filtering": "Sprachfilterung",
|
||||
"By blacklist": "Mittels schwarzer Liste",
|
||||
"By whitelist": "Mittels weißer Liste",
|
||||
"Comma separated ISO 639-3 language codes": "Komma getrennte ISO 639-3 Sprachcodes",
|
||||
"Accuracy": "Genauigkeit",
|
||||
"Simulation mode": "Simulationsmodus",
|
||||
"This post is treated by language filter": "Diese Nachricht ist mittels Sprachfilter %{treated}",
|
||||
"blocked": "blockiert",
|
||||
"passed": "weitergeleitet",
|
||||
"not analyzed": "nicht anylysiert",
|
||||
"Reason: this": "Ursache: %{this}",
|
||||
"this doesnt contain that": "%{this} dies enthält %{that} nicht",
|
||||
"blacklist": "schwarze Liste",
|
||||
"whitelist": "weiße Liste",
|
||||
"language of this": "Die Sprache des Folgenden",
|
||||
"its undefined language": "es handelt sich um eine undefinierte Sprache",
|
||||
"its this, blacklisted": "es ist %{this}, aus der schwarzen Liste",
|
||||
"its this, whitelisted": "es ist %{this}, aus der weißen Liste",
|
||||
"Most possible language: this": "Die wahrscheinlichste Sprache: %{this}",
|
||||
"Show with every user name": "Zeige mit jedem Benutzernamen",
|
||||
"Show at profile modal only": "Show at profile modal only",
|
||||
"Show if a user follows me": "Zeige an, wenn mir ein Benutzer folgt",
|
||||
@ -2428,6 +2599,25 @@ if(preferredLanguage == "ja"){
|
||||
"hour(s)": "hour(s)",
|
||||
"second(s)": "second(s)",
|
||||
"only numbers are allowed!": "only numbers are allowed!",
|
||||
"Language filtering": "Language filtering",
|
||||
"By blacklist": "By blacklist",
|
||||
"By whitelist": "By whitelist",
|
||||
"Comma separated ISO 639-3 language codes": "Comma separated ISO 639-3 language codes",
|
||||
"Accuracy": "Accuracy",
|
||||
"Simulation mode": "Simulation mode",
|
||||
"This post is treated by language filter": "This post is %{treated} by language filter.",
|
||||
"blocked": "blocked",
|
||||
"passed": "passed",
|
||||
"not analyzed": "not analyzed",
|
||||
"Reason: this": "Reason: %{this}",
|
||||
"this doesnt contain that": "%{this} does not contain %{that}",
|
||||
"blacklist": "blacklist",
|
||||
"whitelist": "whitelist",
|
||||
"language of this": "language of this",
|
||||
"its undefined language": "it is undefined language",
|
||||
"its this, blacklisted": "it is %{this}, blacklisted",
|
||||
"its this, whitelisted": "it is %{this}, whitelisted",
|
||||
"Most possible language: this": "Most possible language: %{this}",
|
||||
"Show with every user name": "Show with every user name",
|
||||
"Show at profile modal only": "Show at profile modal only",
|
||||
"Show if a user follows me": "Show if a user follows me",
|
||||
@ -2674,6 +2864,25 @@ if(preferredLanguage == "pt-BR"){
|
||||
"hour(s)": "hour(s)",
|
||||
"second(s)": "segundo(s)",
|
||||
"only numbers are allowed!": "only numbers are allowed!",
|
||||
"Language filtering": "Language filtering",
|
||||
"By blacklist": "By blacklist",
|
||||
"By whitelist": "By whitelist",
|
||||
"Comma separated ISO 639-3 language codes": "Comma separated ISO 639-3 language codes",
|
||||
"Accuracy": "Accuracy",
|
||||
"Simulation mode": "Simulation mode",
|
||||
"This post is treated by language filter": "This post is %{treated} by language filter.",
|
||||
"blocked": "blocked",
|
||||
"passed": "passed",
|
||||
"not analyzed": "not analyzed",
|
||||
"Reason: this": "Reason: %{this}",
|
||||
"this doesnt contain that": "%{this} does not contain %{that}",
|
||||
"blacklist": "blacklist",
|
||||
"whitelist": "whitelist",
|
||||
"language of this": "language of this",
|
||||
"its undefined language": "it is undefined language",
|
||||
"its this, blacklisted": "it is %{this}, blacklisted",
|
||||
"its this, whitelisted": "it is %{this}, whitelisted",
|
||||
"Most possible language: this": "Most possible language: %{this}",
|
||||
"Show with every user name": "Show with every user name",
|
||||
"Show at profile modal only": "Show at profile modal only",
|
||||
"Show if a user follows me": "Show if a user follows me",
|
||||
@ -2916,6 +3125,25 @@ if(preferredLanguage == "tr"){
|
||||
"hour(s)": "saat",
|
||||
"second(s)": "saniye",
|
||||
"only numbers are allowed!": "sadece rakam girilebilir!",
|
||||
"Language filtering": "Language filtering",
|
||||
"By blacklist": "By blacklist",
|
||||
"By whitelist": "By whitelist",
|
||||
"Comma separated ISO 639-3 language codes": "Comma separated ISO 639-3 language codes",
|
||||
"Accuracy": "Accuracy",
|
||||
"Simulation mode": "Simulation mode",
|
||||
"This post is treated by language filter": "This post is %{treated} by language filter.",
|
||||
"blocked": "blocked",
|
||||
"passed": "passed",
|
||||
"not analyzed": "not analyzed",
|
||||
"Reason: this": "Reason: %{this}",
|
||||
"this doesnt contain that": "%{this} does not contain %{that}",
|
||||
"blacklist": "blacklist",
|
||||
"whitelist": "whitelist",
|
||||
"language of this": "language of this",
|
||||
"its undefined language": "it is undefined language",
|
||||
"its this, blacklisted": "it is %{this}, blacklisted",
|
||||
"its this, whitelisted": "it is %{this}, whitelisted",
|
||||
"Most possible language: this": "Most possible language: %{this}",
|
||||
"Show with every user name": "Tüm kullanıcı adlarının yanında göster",
|
||||
"Show at profile modal only": "Sadece profilinde göster",
|
||||
"Show if a user follows me": "Bir kullanıcının beni takip edip etmediğini göster",
|
||||
@ -3157,6 +3385,25 @@ if(preferredLanguage == "cs"){
|
||||
"hour(s)": "hodin",
|
||||
"second(s)": "vteřinou(ami)",
|
||||
"only numbers are allowed!": "povolena jsou jen čísla!",
|
||||
"Language filtering": "Language filtering",
|
||||
"By blacklist": "By blacklist",
|
||||
"By whitelist": "By whitelist",
|
||||
"Comma separated ISO 639-3 language codes": "Comma separated ISO 639-3 language codes",
|
||||
"Accuracy": "Accuracy",
|
||||
"Simulation mode": "Simulation mode",
|
||||
"This post is treated by language filter": "This post is %{treated} by language filter.",
|
||||
"blocked": "blocked",
|
||||
"passed": "passed",
|
||||
"not analyzed": "not analyzed",
|
||||
"Reason: this": "Reason: %{this}",
|
||||
"this doesnt contain that": "%{this} does not contain %{that}",
|
||||
"blacklist": "blacklist",
|
||||
"whitelist": "whitelist",
|
||||
"language of this": "language of this",
|
||||
"its undefined language": "it is undefined language",
|
||||
"its this, blacklisted": "it is %{this}, blacklisted",
|
||||
"its this, whitelisted": "it is %{this}, whitelisted",
|
||||
"Most possible language: this": "Most possible language: %{this}",
|
||||
"Show with every user name": "Ukázat u každé přezdívky",
|
||||
"Show at profile modal only": "Ukázat jen v okně profilu",
|
||||
"Show if a user follows me": "Ukazovat, zda mně uživatel sleduje",
|
||||
|
@ -495,32 +495,30 @@ function filterLangPost(post) {
|
||||
var langFilterSubj = '';
|
||||
var langFilterProb = [];
|
||||
var langFilterPass = ($.Options.getFilterLangOpt() === 'whitelist') ? false : true;
|
||||
var langFilterReason = 'language isn\'t in '+$.Options.getFilterLangOpt();
|
||||
var langFilterReason = polyglot.t('this doesnt contain that', {'this': polyglot.t($.Options.getFilterLangOpt()), 'that': polyglot.t('language of this')});
|
||||
|
||||
if (typeof(post['userpost']['rt']) !== 'undefined') {
|
||||
langFilterSubj = post['userpost']['rt']['msg'].replace(/\@\S\w*|https?:\/\/\S*|\#/g, '').replace(/\s+/g, ' ');
|
||||
langFilterSubj = post['userpost']['rt']['msg'];
|
||||
} else {
|
||||
langFilterSubj = post['userpost']['msg'].replace(/\@\S\w*|https?:\/\/\S*|\#/g, '').replace(/\s+/g, ' ');
|
||||
langFilterSubj = post['userpost']['msg'];
|
||||
}
|
||||
langFilterProb = franc.all(langFilterSubj, {'minLength': 5}); // FIXME minLength may be optional sometimes
|
||||
// we cut out any mentions, links and # symbols from hashtags and clear spaces before detection attempts:
|
||||
langFilterSubj = langFilterSubj.replace(/\@\S\w*|https?:\/\/\S*|\#/g, '').replace(/\s+/g, ' ').trim();
|
||||
langFilterProb = franc.all(langFilterSubj, {'minLength': 4}); // FIXME minLength may become configurable option at some time
|
||||
for (var i = 0; i < langFilterProb.length; i++) {
|
||||
if (langFilterProb[i][1] > langFilterAccuracy) {
|
||||
if (langFilterProb[i][0] === 'und') { // FIXME maybe there's should be an option for whitelist mode to allow this
|
||||
if (langFilterProb[i][0] === 'und') { // e.g. digits-only string will be detected as undefined and thereby will be allowed
|
||||
langFilterPass = true;
|
||||
langFilterReason = 'it\'s undefined language';
|
||||
break;
|
||||
} else if (langFilterProb[i][0] === 'cmn') {
|
||||
langFilterPass = true;
|
||||
langFilterReason = 'it\'s common language';
|
||||
langFilterReason = polyglot.t('its undefined language');
|
||||
break;
|
||||
} else if (langFilterList.indexOf(langFilterProb[i][0]) > -1) {
|
||||
if ($.Options.getFilterLangOpt() === 'whitelist') {
|
||||
langFilterPass = true;
|
||||
langFilterReason = 'it\'s '+langFilterProb[i][0]+', whitelisted';
|
||||
langFilterReason = polyglot.t('its this, whitelisted', {'this': '\''+langFilterProb[i][0]+'\''});
|
||||
break;
|
||||
} else {
|
||||
langFilterPass = false;
|
||||
langFilterReason = 'it\'s '+langFilterProb[i][0]+', blacklisted';
|
||||
langFilterReason = polyglot.t('its this, blacklisted', {'this': '\''+langFilterProb[i][0]+'\''});
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -532,6 +530,7 @@ function filterLangPost(post) {
|
||||
post['langFilter']['pass'] = langFilterPass;
|
||||
post['langFilter']['reason'] = langFilterReason;
|
||||
|
||||
//console.log('langFilter | status: '+((langFilterPass === true) ? polyglot.t('passed') : polyglot.t('blocked'))+' | reason: '+langFilterReason+' | subject: \''+langFilterSubj+'\'');
|
||||
return ($.Options.getFilterLangSimulateOpt()) ? true : langFilterPass;
|
||||
}
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ var TwisterOptions = function()
|
||||
}
|
||||
|
||||
this.getFilterLangListOpt = function () {
|
||||
return $.Options.getOption('filterLangList', '').split(/\s*,\s*/);
|
||||
return $.Options.getOption('filterLangList', '').replace(/\s+/g, '').split(/\s*,\s*/);
|
||||
}
|
||||
|
||||
this.setFilterLangListOpt = function () {
|
||||
@ -465,7 +465,7 @@ var TwisterOptions = function()
|
||||
}
|
||||
|
||||
this.getFilterLangAccuracyOpt = function () {
|
||||
return parseFloat($.Options.getOption('filterLangAccuracy', '0.63'));
|
||||
return parseFloat($.Options.getOption('filterLangAccuracy', '0.82'));
|
||||
}
|
||||
|
||||
this.setFilterLangAccuracyOpt = function () {
|
||||
|
@ -238,10 +238,10 @@ function showPosts(req, posts)
|
||||
if ($.Options.getFilterLangSimulateOpt()) {
|
||||
// FIXME it's should be stuff from template actually
|
||||
if (typeof(post['langFilter']) !== 'undefined') {
|
||||
streamPost.append('<div class="langFilterSimData">This post is <em>'+((post['langFilter']['pass'] === true) ? 'passed' : 'blocked')+'</em> by language filter.</div>');
|
||||
streamPost.append('<div class="langFilterSimData">Reason: <em>'+post['langFilter']['reason']+'</em> // Most possible language: <em>'+post['langFilter']['prob'][0].toString()+'</em></div>');
|
||||
streamPost.append('<div class="langFilterSimData">'+polyglot.t('This post is treated by language filter', {'treated': '<em>'+((post['langFilter']['pass'] === true) ? polyglot.t('passed') : polyglot.t('blocked'))+'</em>'})+'</div>');
|
||||
streamPost.append('<div class="langFilterSimData">'+polyglot.t('Reason: this', {'this': '<em>'+post['langFilter']['reason']+'</em>'})+' // '+polyglot.t('Most possible language: this', {'this': '<em>'+post['langFilter']['prob'][0].toString()+'</em>'})+'</div>');
|
||||
} else {
|
||||
streamPost.append('<div class="langFilterSimData">This post is not filtered by language.</div>');
|
||||
streamPost.append('<div class="langFilterSimData">'+polyglot.t('This post is treated by language filter', {'treated': '<em>'+polyglot.t('not analyzed')+'</em>'})+'</div>');
|
||||
}
|
||||
}
|
||||
streamPost.show();
|
||||
@ -367,12 +367,18 @@ function timelineChangedUser()
|
||||
}
|
||||
|
||||
function willBeHidden(post){
|
||||
var msg = post['userpost']['msg'];
|
||||
var hidden = false;
|
||||
|
||||
if (post['userpost']['n'] === defaultScreenName)
|
||||
return false;
|
||||
|
||||
if (typeof(post['userpost']['rt']) !== 'undefined') {
|
||||
if ($.Options.getHideCloseRTsOpt() != 'disable' &&
|
||||
followingUsers.indexOf(post['userpost']['rt']['n']) > -1 &&
|
||||
parseInt(post['userpost']['time']) - parseInt(post['userpost']['rt']['time']) < $.Options.getHideCloseRTsHourOpt() * 3600)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
var msg = post['userpost']['msg'];
|
||||
if ($.Options.getHideRepliesOpt() !== 'disable' &&
|
||||
/^\@/.test(msg) &&
|
||||
!(new RegExp('@' + defaultScreenName + '( |,|;|\\.|:|\\/|\\?|\\!|\\\\|\'|"|\\n|\\t|$)').test(msg)))
|
||||
@ -381,25 +387,16 @@ function willBeHidden(post){
|
||||
($.Options.getHideRepliesOpt() === 'following' &&
|
||||
followingUsers.indexOf(msg.substring(1, msg.search(/ |,|;|\.|:|\/|\?|\!|\\|'|"|\n|\t|$/))) === -1 ))
|
||||
{
|
||||
hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof(post['userpost']['rt']) !== 'undefined' &&
|
||||
$.Options.getHideCloseRTsOpt() != 'disable' &&
|
||||
followingUsers.indexOf(post['userpost']['rt']['n']) > -1 &&
|
||||
parseInt(post['userpost']['time']) - parseInt(post['userpost']['rt']['time']) < $.Options.getHideCloseRTsHourOpt() * 3600)
|
||||
{
|
||||
if (hidden)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (filterLangPost(post) === false) {
|
||||
hidden = true;
|
||||
console.log('post by @'+post['userpost']['n']+' was hidden because it didn\'t passed by language filter');
|
||||
// TODO maybe we need a counter of posts blocked by language filter and even caching of them and button to show?
|
||||
//console.log('post by @'+post['userpost']['n']+' was hidden because it didn\'t passed by language filter:');
|
||||
return true;
|
||||
}
|
||||
|
||||
return hidden;
|
||||
return false;
|
||||
}
|
||||
|
@ -255,7 +255,7 @@
|
||||
<p class="label">Comma separated ISO 639-3 language codes</p>
|
||||
<p><input type="text" id="filterLangList" class="container" /></p>
|
||||
<p class="label">Accuracy</p>
|
||||
<p><input type="range" id="filterLangAccuracy" class="container" min="0" max="1" step="0.01"><span id="filterLangAccuracyVal" class="container"></span></p>
|
||||
<p><input type="range" id="filterLangAccuracy" class="container" min="0" max="1" step="0.005"><span id="filterLangAccuracyVal" class="container"></span></p>
|
||||
<p><span class="label">Simulation mode</span> <input type="checkbox" id="filterLangSimulate" /></p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -2375,6 +2375,7 @@ textarea.splited-post {
|
||||
}
|
||||
|
||||
.langFilterSimData {
|
||||
color: rgba( 0, 0, 0, .7 );
|
||||
font: 10px "Open Sans", sans-serif;
|
||||
text-align: center;
|
||||
}
|
||||
|
@ -1824,6 +1824,7 @@ button.disabled:hover, .mini-profile-actions span.disabled:hover, a.button.disab
|
||||
}
|
||||
|
||||
.langFilterSimData {
|
||||
color: rgba( 0, 0, 0, .7 );
|
||||
font: 10px "Open Sans", sans-serif;
|
||||
text-align: center;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user