Browse Source

Merge pull request #274 from slr/tasty-markdown

option to apply, ignore or clear out posts Markout markup
master
miguelfreitas 9 years ago
parent
commit
c92f2a7119
  1. 49
      js/interface_localization.js
  2. 5
      js/options.js
  3. 54
      js/twister_formatpost.js
  4. 10
      options.html

49
js/interface_localization.js

@ -37,6 +37,7 @@ if(preferredLanguage == "en"){ @@ -37,6 +37,7 @@ if(preferredLanguage == "en"){
"All users publicly followed by": "All users publicly followed by",
"Available": "Available", // username is available
"Appearance": "Appearance",
"Apply": "Apply",
"Block chain information": "Block chain information",
"Block chain is up-to-date, twister is ready to use!": "Block chain is up-to-date, twister is ready to use!",
"Block generation": "Block generation ",
@ -195,6 +196,7 @@ if(preferredLanguage == "en"){ @@ -195,6 +196,7 @@ if(preferredLanguage == "en"){
"Switch to Normal posts": "Switch to Normal posts",
"Use language": "Use language",
"Ignore": "Ignore",
"Ignore and clear out": "Ignore and clear out",
"Theme": "Theme",
"Keys": "Keys",
"Notifications": "Notifications",
@ -208,6 +210,7 @@ if(preferredLanguage == "en"){ @@ -208,6 +210,7 @@ if(preferredLanguage == "en"){
"Inline image preview": "Inline image preview",
"Display": "Display",
"Line feeds": "Line feeds",
"Markout": "Markout markup",
"Supported punctuations:": "Supported punctuations:",
"Supported emotions:": "Supported emotions:",
"Supported signs:": "Supported signs:",
@ -328,6 +331,7 @@ if(preferredLanguage == "es"){ @@ -328,6 +331,7 @@ if(preferredLanguage == "es"){
"All users publicly followed by": "Todos los usuarios seguidos públicamente por",
"Available": "Disponible", // username is available
"Appearance": "Appearance",
"Apply": "Aplicar",
"Block chain information": "Información de la cadena de bloques",
"Block chain is up-to-date, twister is ready to use!": "La cadena de bloques está puesta al día, twister está listo para usar!",
"Block generation": "Generación de bloques ",
@ -486,6 +490,7 @@ if(preferredLanguage == "es"){ @@ -486,6 +490,7 @@ if(preferredLanguage == "es"){
"Switch to Normal posts": "Cambiar a posts Normales",
"Use language": "Utilizar idioma",
"Ignore": "Ignorar",
"Ignore and clear out": "Ignorar y limpiar",
"Theme": "Tema",
"Keys": "Teclas",
"Notifications": "Notificaciones",
@ -494,11 +499,12 @@ if(preferredLanguage == "es"){ @@ -494,11 +499,12 @@ if(preferredLanguage == "es"){
"Volume": "Volumen",
"Test": "Prueba",
"Send key": "Send key",
"Posts display": "Posts display",
"Posts display": "Presentación de mensajes",
"Post editor": "Post editor",
"Inline image preview": "Inline image preview",
"Display": "Display",
"Line feeds": "Line feeds",
"Inline image preview": "Vista previa de imágenes en línea",
"Display": "Mostrar",
"Line feeds": "Avances de línea",
"Markout": "Markout marcado",
"Supported punctuations:": "Supported punctuations:",
"Supported emotions:": "Supported emotions:",
"Supported signs:": "Supported signs:",
@ -514,7 +520,7 @@ if(preferredLanguage == "es"){ @@ -514,7 +520,7 @@ if(preferredLanguage == "es"){
"none": "none",
"Custom": "Custom",
"Mentions": "Menciones",
"Use proxy for image preview only": "Usa proxy para sólo para previsualización de imagen",
"Use proxy for image preview only": "Usa proxy para sólo para previsualización de imagenes",
"Use external links behind a proxy": "Usa enlaces externos detrás de un proxy",
"There aren't any posts with this hashtag.": "No hay posts con este hashtag.",
"Split only new post": "Split only new post",
@ -603,6 +609,7 @@ if(preferredLanguage == "uk"){ @@ -603,6 +609,7 @@ if(preferredLanguage == "uk"){
"All users publicly followed by": "Усі публічні користувачі яких читають",
"Available": "Доступний", // username is available
"Appearance": "Вигляд",
"Apply": "Apply",
"Block chain information": "Інформація про ланцюжок блоків",
"Block chain is up-to-date, twister is ready to use!": "Ланцюг блоків оновлено, twister готовий до використання!",
"Block generation": "Генерація блоку ",
@ -758,6 +765,7 @@ if(preferredLanguage == "uk"){ @@ -758,6 +765,7 @@ if(preferredLanguage == "uk"){
"Switch to Normal posts": "Твісти",
"Use language": "Використати мову",
"Ignore": "Ігнорувати",
"Ignore and clear out": "Ignore and clear out",
"Theme": "Тема",
"Keys": "Гарячі клавіші",
"Notifications": "Оповіщення",
@ -771,6 +779,7 @@ if(preferredLanguage == "uk"){ @@ -771,6 +779,7 @@ if(preferredLanguage == "uk"){
"Inline image preview": "Контекстний перегляд зображення",
"Display": "Відображати",
"Line feeds": "Line feeds",
"Markout": "Markout markup",
"Supported punctuations:": "Supported punctuations:",
"Supported emotions:": "Supported emotions:",
"Supported signs:": "Підтримувані підписи:",
@ -877,6 +886,7 @@ if(preferredLanguage == "zh-CN"){ @@ -877,6 +886,7 @@ if(preferredLanguage == "zh-CN"){
"All users publicly followed by": "公开关注的所有用户,被",
"Available": "可用", // username is available
"Appearance": "外观",
"Apply": "Apply",
"Block chain information": "区块链信息",
"Block chain is up-to-date, twister is ready to use!": "区块链已经更新,Twister 已经可以使用!",
"Block generation": "区块生成器",
@ -1034,6 +1044,7 @@ if(preferredLanguage == "zh-CN"){ @@ -1034,6 +1044,7 @@ if(preferredLanguage == "zh-CN"){
"Switch to Normal posts": "切换到普通发送",
"Use language": "界面语言",
"Ignore": "忽略",
"Ignore and clear out": "Ignore and clear out",
"Theme": "主题",
"Keys": "按键",
"Notifications": "通知",
@ -1047,6 +1058,7 @@ if(preferredLanguage == "zh-CN"){ @@ -1047,6 +1058,7 @@ if(preferredLanguage == "zh-CN"){
"Inline image preview": "内嵌图像预览",
"Display": "显示",
"Line feeds": "Line feeds",
"Markout": "Markout markup",
"Supported punctuations:": "支持的标点符号:",
"Supported emotions:": "支持的表情符号:",
"Supported signs:": "支持的标记符号:",
@ -1168,6 +1180,7 @@ if(preferredLanguage == "nl"){ @@ -1168,6 +1180,7 @@ if(preferredLanguage == "nl"){
"All users publicly followed by": "Alle gebruikers openbaarlijk gevolgd door",
"Available": "Beschikbaar", // username is available
"Appearance": "Appearance",
"Apply": "Apply",
"Block chain information": "Block chain informatie",
"Block chain is up-to-date, twister is ready to use!": "Block chain is up-to-date, twister is klaar voor gebruik!",
"Block generation": "Block productie",
@ -1326,6 +1339,7 @@ if(preferredLanguage == "nl"){ @@ -1326,6 +1339,7 @@ if(preferredLanguage == "nl"){
"Switch to Normal posts": "Switch to Normal posts",
"Use language": "Use language",
"Ignore": "Ignore",
"Ignore and clear out": "Ignore and clear out",
"Theme": "Theme",
"Keys": "Keys",
"Notifications": "Notifications",
@ -1339,6 +1353,7 @@ if(preferredLanguage == "nl"){ @@ -1339,6 +1353,7 @@ if(preferredLanguage == "nl"){
"Inline image preview": "Inline image preview",
"Display": "Display",
"Line feeds": "Line feeds",
"Markout": "Markout markup",
"Supported punctuations:": "Supported punctuations:",
"Supported emotions:": "Supported emotions:",
"Supported signs:": "Supported signs:",
@ -1443,6 +1458,7 @@ if(preferredLanguage == "it"){ @@ -1443,6 +1458,7 @@ if(preferredLanguage == "it"){
"All users publicly followed by": "Utenti seguiti pubblicamente da",
"Available": "Disponibile", // username is available
"Appearance": "Appearance",
"Apply": "Apply",
"Block chain information": "Informazioni sulla catena di blocchi",
"Block chain is up-to-date, twister is ready to use!": "Catena di blocchi aggiornata, Twister è pronto per l'uso!",
"Block generation": "Generatore di blocchi:",
@ -1598,6 +1614,7 @@ if(preferredLanguage == "it"){ @@ -1598,6 +1614,7 @@ if(preferredLanguage == "it"){
"Switch to Normal posts": "Switch to Normal posts",
"Use language": "Use language",
"Ignore": "Ignore",
"Ignore and clear out": "Ignore and clear out",
"Theme": "Theme",
"Keys": "Keys",
"Notifications": "Notifiche",
@ -1611,6 +1628,7 @@ if(preferredLanguage == "it"){ @@ -1611,6 +1628,7 @@ if(preferredLanguage == "it"){
"Inline image preview": "Inline image preview",
"Display": "Display",
"Line feeds": "Line feeds",
"Markout": "Markout markup",
"Supported punctuations:": "Supported punctuations:",
"Supported emotions:": "Supported emotions:",
"Supported signs:": "Supported signs:",
@ -1715,6 +1733,7 @@ if(preferredLanguage == "fr"){ @@ -1715,6 +1733,7 @@ if(preferredLanguage == "fr"){
"All users publicly followed by": "Tous les utilisateurs suivis publiquement par",
"Available": "Disponible", // username is available
"Appearance": "Apparence",
"Apply": "Apply",
"Block chain information": "Informations à propos de la chaîne de blocs",
"Block chain is up-to-date, twister is ready to use!": "La chaîne de blocs est à jour, Twister est maintenant fonctionnel!",
"Block generation": "Production de blocs",
@ -1873,6 +1892,7 @@ if(preferredLanguage == "fr"){ @@ -1873,6 +1892,7 @@ if(preferredLanguage == "fr"){
"Switch to Normal posts": "Switch to Normal posts",
"Use language": "Use language",
"Ignore": "Ignore",
"Ignore and clear out": "Ignore and clear out",
"Theme": "Theme",
"Keys": "Keys",
"Notifications": "Notifications",
@ -1886,6 +1906,7 @@ if(preferredLanguage == "fr"){ @@ -1886,6 +1906,7 @@ if(preferredLanguage == "fr"){
"Inline image preview": "Inline image preview",
"Display": "Display",
"Line feeds": "Line feeds",
"Markout": "Markout markup",
"Supported punctuations:": "Supported punctuations:",
"Supported emotions:": "Supported emotions:",
"Supported signs:": "Supported signs:",
@ -1992,6 +2013,7 @@ if(preferredLanguage == "ru"){ @@ -1992,6 +2013,7 @@ if(preferredLanguage == "ru"){
"All users publicly followed by": "Все публичные пользователи на которых подписан",
"Available": "Доступно",
"Appearance": "Отображение",
"Apply": "Применять",
"Block chain information": "Информация цепочки блоков",
"Block chain is up-to-date, twister is ready to use!": "Цепочка блоков обновлена, twister готов к использованию!",
"Block generation": "Майнинг блоков ",
@ -2150,6 +2172,7 @@ if(preferredLanguage == "ru"){ @@ -2150,6 +2172,7 @@ if(preferredLanguage == "ru"){
"Switch to Normal posts": "Отображать сообщения пользователей",
"Use language": "Язык",
"Ignore": "Игнорировать",
"Ignore and clear out": "Игнорировать и вычищать",
"Theme": "Тема",
"Keys": "Клавиши",
"Notifications": "Уведомления",
@ -2163,6 +2186,7 @@ if(preferredLanguage == "ru"){ @@ -2163,6 +2186,7 @@ if(preferredLanguage == "ru"){
"Inline image preview": "Предпросмотр изображений",
"Display": "Показывать",
"Line feeds": "Переходы на новую строку",
"Markout": "Разметка Markout",
"Supported punctuations:": "Поддерживаемая пунктуация:",
"Supported emotions:": "Поддерживаемые смайлы:",
"Supported signs:": "Поддерживаемые знаки:",
@ -2272,6 +2296,7 @@ if(preferredLanguage == "de"){ @@ -2272,6 +2296,7 @@ if(preferredLanguage == "de"){
"All users publicly followed by": "Alle öffentlich gefolgten Benutzer von",
"Available": "Verfügbar", // username is available
"Appearance": "Aussehen",
"Apply": "Apply",
"Block chain information": "Block-Chain Informationen",
"Block chain is up-to-date, twister is ready to use!": "Block-Chain ist aktuell, twister ist benutzbar!",
"Block generation": "Block-Generierung ",
@ -2431,6 +2456,7 @@ if(preferredLanguage == "de"){ @@ -2431,6 +2456,7 @@ if(preferredLanguage == "de"){
"new_posts": "%{smart_count} neue Nachricht |||| %{smart_count} neue Nachrichten",
"Use language": "Sprache einstellen",
"Ignore": "Ignorieren",
"Ignore and clear out": "Ignore and clear out",
"Theme": "Theme",
"Keys": "Keys",
"Notifications": "Benachrichtigungen",
@ -2444,6 +2470,7 @@ if(preferredLanguage == "de"){ @@ -2444,6 +2470,7 @@ if(preferredLanguage == "de"){
"Inline image preview": "Inline image preview",
"Display": "Display",
"Line feeds": "Line feeds",
"Markout": "Markout markup",
"Supported punctuations:": "Supported punctuations:",
"Supported emotions:": "Supported emotions:",
"Supported signs:": "Supported signs:",
@ -2548,6 +2575,7 @@ if(preferredLanguage == "ja"){ @@ -2548,6 +2575,7 @@ if(preferredLanguage == "ja"){
"All users publicly followed by": "このユーザがフォローを公開している",
"Available": "Available", // username is available
"Appearance": "Appearance",
"Apply": "Apply",
"Block chain information": "ブロックチェイン",
"Block chain is up-to-date, twister is ready to use!": "ブロックチェインは最新の状態です。",
"Block generation": "ブロック生成",
@ -2703,6 +2731,7 @@ if(preferredLanguage == "ja"){ @@ -2703,6 +2731,7 @@ if(preferredLanguage == "ja"){
"Switch to Normal posts": "Switch to Normal posts",
"Use language": "Use language",
"Ignore": "Ignore",
"Ignore and clear out": "Ignore and clear out",
"Theme": "Theme",
"Keys": "Keys",
"Notifications": "Notifications",
@ -2716,6 +2745,7 @@ if(preferredLanguage == "ja"){ @@ -2716,6 +2745,7 @@ if(preferredLanguage == "ja"){
"Inline image preview": "Inline image preview",
"Display": "Display",
"Line feeds": "Line feeds",
"Markout": "Markout markup",
"Supported punctuations:": "Supported punctuations:",
"Supported emotions:": "Supported emotions:",
"Supported signs:": "Supported signs:",
@ -2821,6 +2851,7 @@ if(preferredLanguage == "pt-BR"){ @@ -2821,6 +2851,7 @@ if(preferredLanguage == "pt-BR"){
"All users publicly followed by": "Todos os usuários seguidos publicamente por",
"Available": "Disponível", // username is available
"Appearance": "Appearance",
"Apply": "Apply",
"Block chain information": "Informações da Cadeia de Blocos",
"Block chain is up-to-date, twister is ready to use!": "A Cadeida de Blocos está sincronizada, Twister está pronto para uso!",
"Block generation": "Geração de blocos ",
@ -2981,6 +3012,7 @@ if(preferredLanguage == "pt-BR"){ @@ -2981,6 +3012,7 @@ if(preferredLanguage == "pt-BR"){
"Switch to Normal posts": "Switch to Normal posts",
"Use language": "Use language",
"Ignore": "Ignore",
"Ignore and clear out": "Ignore and clear out",
"Theme": "Theme",
"Keys": "Keys",
"Notifications": "Notificações",
@ -2994,6 +3026,7 @@ if(preferredLanguage == "pt-BR"){ @@ -2994,6 +3026,7 @@ if(preferredLanguage == "pt-BR"){
"Inline image preview": "Inline image preview",
"Display": "Display",
"Line feeds": "Line feeds",
"Markout": "Markout markup",
"Supported punctuations:": "Supported punctuations:",
"Supported emotions:": "Supported emotions:",
"Supported signs:": "Supported signs:",
@ -3098,6 +3131,7 @@ if(preferredLanguage == "tr"){ @@ -3098,6 +3131,7 @@ if(preferredLanguage == "tr"){
"All users publicly followed by": "Açık olarak takip edilen tüm kullanıcılar",
"Available": "Kullanılabilir", // username is available
"Appearance": "Appearance",
"Apply": "Apply",
"Block chain information": "Blok zincir bilgisi",
"Block chain is up-to-date, twister is ready to use!": "Blok zinciri güncel, twister kullanıma hazır!",
"Block generation": "Blok üretimi ",
@ -3246,6 +3280,7 @@ if(preferredLanguage == "tr"){ @@ -3246,6 +3280,7 @@ if(preferredLanguage == "tr"){
"Switch to Normal posts": "Normal Mesajlara Geç",
"Use language": "Dil ayarla",
"Ignore": "Görmezden gel",
"Ignore and clear out": "Ignore and clear out",
"Theme": "Tema",
"Keys": "Tuşlar",
"Notifications": "Uyarılar",
@ -3259,6 +3294,7 @@ if(preferredLanguage == "tr"){ @@ -3259,6 +3294,7 @@ if(preferredLanguage == "tr"){
"Inline image preview": "Dahili resim ön izleme",
"Display": "Göster",
"Line feeds": "Satır sonları",
"Markout": "Markout markup",
"Supported punctuations:": "Desteklenen noktalama işaretleri:",
"Supported emotions:": "Desteklenen duygu simgeleri:",
"Supported signs:": "Desteklenen işaretler:",
@ -3372,6 +3408,7 @@ if(preferredLanguage == "cs"){ @@ -3372,6 +3408,7 @@ if(preferredLanguage == "cs"){
"All users publicly followed by": "Všichni uživatelé, které veřejně sleduje",
"Available": "Je volná", // username is available
"Appearance": "Vzhled",
"Apply": "Apply",
"Block chain information": "Informace o blockchainu",
"Block chain is up-to-date, twister is ready to use!": "Blockchain je aktuální, twister je připraven k použití!",
"Block generation": "Generování bloků ",
@ -3528,6 +3565,7 @@ if(preferredLanguage == "cs"){ @@ -3528,6 +3565,7 @@ if(preferredLanguage == "cs"){
"Switch to Normal posts": "Přepnout na normální příspěvky",
"Use language": "Jazyk",
"Ignore": "Ignorovat",
"Ignore and clear out": "Ignore and clear out",
"Theme": "Styl grafiky",
"Keys": "Klávesy",
"Notifications": "Upozornění",
@ -3541,6 +3579,7 @@ if(preferredLanguage == "cs"){ @@ -3541,6 +3579,7 @@ if(preferredLanguage == "cs"){
"Inline image preview": "Náhled vložených obrázků",
"Display": "Zobrazit",
"Line feeds": "Nové řádky",
"Markout": "Markout markup",
"Supported punctuations:": "Podporovaná znaménka:",
"Supported emotions:": "Podporovaní smajlíci:",
"Supported signs:": "Podporované značky:",

5
js/options.js

@ -136,6 +136,11 @@ function twisterOptions() { @@ -136,6 +136,11 @@ function twisterOptions() {
name: 'displayLineFeeds',
valDefault: 'enable'
});
this.add({
name: 'postsMarkout',
selector: '#optPostsMarkout',
valDefault: 'apply'
});
this.add({
name: 'displayPreview',
valDefault: 'disable'

54
js/twister_formatpost.js

@ -258,6 +258,9 @@ function htmlFormatMsg(msg, mentions) { @@ -258,6 +258,9 @@ function htmlFormatMsg(msg, mentions) {
}
function markout(msg, chr, tag) {
if ($.Options.postsMarkout.val === 'ignore')
return msg;
function isWhiteSpacesBetween(i, j) {
j++;
for (i += 1; i < j; i++) {
@ -375,20 +378,19 @@ function htmlFormatMsg(msg, mentions) { @@ -375,20 +378,19 @@ function htmlFormatMsg(msg, mentions) {
}
// changing the string
if (chr === '`') {
if (chr === '`' && $.Options.postsMarkout.val === 'apply') { // if $.Options.postsMarkout.val === 'clear' then ` does not escapes anythyng so it needs to be handled like other tags
for (i = 0; i < p.length; i++) {
if (p[i].a > -1) {
if (p[i].t === -1 || (p[i].t === 0 && p[i].a > i)) {
if (p[i].k > 1)
t = '<' + tag + '>' + Array(p[i].k).join(chr);
t = Array(p[i].k).join(chr);
else
t = '<' + tag + '>';
t = '';
j = p[i].a;
t = t + msg.str.slice(p[i].i + p[i].k, p[j].i);
if (p[j].k > 1)
t = t + Array(p[i].k).join(chr) + '</' + tag + '>';
else
t = t + '</' + tag + '>';
t = t + Array(p[i].k).join(chr);
t = '<' + tag + '>' + t + '</' + tag + '>';
msg.htmlEntities.push(t.replace(/&(?!lt;|gt;)/g, '&amp;'));
htmlEntityEncoded = '>' + (msg.htmlEntities.length - 1).toString() + '<';
msg.str = msg.str.slice(0, p[i].i) + htmlEntityEncoded + msg.str.slice(p[j].i + p[j].k);
@ -400,18 +402,25 @@ function htmlFormatMsg(msg, mentions) { @@ -400,18 +402,25 @@ function htmlFormatMsg(msg, mentions) {
}
}
} else {
if ($.Options.postsMarkout.val === 'apply') {
t = '</' + tag + '>';
tag = '<' + tag + '>';
} else { // $.Options.postsMarkout.val === 'clear' so we're clearing markup
t = '';
tag = '';
}
for (i = 0; i < p.length; i++) {
if (p[i].a > -1) {
if (p[i].t === -1 || (p[i].t === 0 && p[i].a > i)) {
if (p[i].k > 1)
msg.htmlEntities.push('<' + tag + '>' + Array(p[i].k).join(chr));
msg.htmlEntities.push(tag + Array(p[i].k).join(chr));
else
msg.htmlEntities.push('<' + tag + '>');
msg.htmlEntities.push(tag);
} else if (p[i].t === 1 || (p[i].t === 0 && p[i].a < i)) {
if (p[i].k > 1)
msg.htmlEntities.push(Array(p[i].k).join(chr) + '</' + tag + '>');
msg.htmlEntities.push(Array(p[i].k).join(chr) + t);
else
msg.htmlEntities.push('</' + tag + '>');
msg.htmlEntities.push(t);
}
htmlEntityEncoded = '>' + (msg.htmlEntities.length - 1).toString() + '<';
msg.str = msg.str.slice(0, p[i].i) + htmlEntityEncoded + msg.str.slice(p[i].i + p[i].k);
@ -477,7 +486,7 @@ function htmlFormatMsg(msg, mentions) { @@ -477,7 +486,7 @@ function htmlFormatMsg(msg, mentions) {
// handling links
for (i = 0; i < msg.str.length - 7; i++) {
if (msg.str.slice(i, i + 2) === '](') {
if (msg.str.slice(i, i + 2) === '](' && $.Options.postsMarkout.val !== 'ignore') {
// FIXME there can be text with [] inside [] or links with () we need to handle it too
j = getSubStrStart(msg.str, i - 2, '[', true, '');
if (j < i - 1) {
@ -505,6 +514,7 @@ function htmlFormatMsg(msg, mentions) { @@ -505,6 +514,7 @@ function htmlFormatMsg(msg, mentions) {
} else {
if (getSubStrEnd(msg.str, i + 1, whiteSpacesUrl, false, '') < k) // use only first word as href target, others drop silently
k = getSubStrEnd(msg.str, i + 1, whiteSpacesUrl, false, '');
if ($.Options.postsMarkout.val === 'apply') {
msg = msgAddHtmlEntity(msg, j - 1, getSubStrEnd(msg.str, k + 1, ')', true, '') + 2,
newHtmlEntityLink(_htmlFormatMsgLinkTemplateExternal,
proxyURL(msg.str.slice(i, k + 1)),
@ -519,6 +529,28 @@ function htmlFormatMsg(msg, mentions) { @@ -519,6 +529,28 @@ function htmlFormatMsg(msg, mentions) {
.replace(/&(?!lt;|gt;)/g, '&amp;')
)
);
} else { // $.Options.postsMarkout.val === 'clear' so we're clearing markup
str = msg.str.slice(i, k + 1);
msg = msgAddHtmlEntity(msg, j - 1, getSubStrEnd(msg.str, k + 1, ')', true, '') + 2,
applyHtml( // we're trying to clear markup inside [] of []()
markout(markout(markout(markout(
{str: linkName, htmlEntities: msg.htmlEntities},
'*', 'b'), // bold
'~', 'i'), // italic
'_', 'u'), // underlined
'-', 's') // striketrough
)
.replace(/&(?!lt;|gt;)/g, '&amp;')
);
// here we put link target as plain text to handle it usual way (search http[s]:// and so on)
i = msg.i + 1
msg.str = msg.str.slice(0, i) + ' ' + str + msg.str.slice(i);
/* alternatively we could set up it as link itself but I suppose you don't want it
msg = msgAddHtmlEntity(msg, msg.i + 1, msg.i + 1,
' ' + newHtmlEntityLink(_htmlFormatMsgLinkTemplateExternal,
proxyURL(str), str)
); */
}
}
i = msg.i + 1;
}

10
options.html

@ -274,6 +274,16 @@ @@ -274,6 +274,16 @@
</select>
</form>
</div>
<div class="container">
<form action="">
<p class="label">Markout</p>
<select name="" id="optPostsMarkout" class="container">
<option value="apply">Apply</option>
<option value="ignore">Ignore</option>
<option value="clear">Ignore and clear out</option>
</select>
</form>
</div>
<div class="container">
<form action="" id="showPreviewOpt">
<p class="label">Inline image preview</p>

Loading…
Cancel
Save