Browse Source

Merge pull request #355 from miguelfreitas/blaster

sync with blaster
master
miguelfreitas 9 years ago
parent
commit
7010e6d290
  1. 6
      home.html
  2. 28
      js/interface_common.js
  3. 13
      js/interface_localization.js
  4. 6
      js/twister_directmsg.js
  5. 13
      js/twister_formatpost.js
  6. 8
      network.html
  7. 4
      options.html
  8. 6
      tmobile.html

6
home.html

@ -391,11 +391,11 @@ @@ -391,11 +391,11 @@
<!-- template for user links in message (open profile modal) -->
<a id="msg-user-link-template" class="open-profile-modal"></a>
<!-- template for user links in message (open profile modal) -->
<a id="external-page-link-template" rel="nofollow" target="_blank"></a>
<a id="external-page-link-template" rel="nofollow noreferrer" target="_blank"></a>
<!-- template for user links in message (open profile modal) -->
<a id="hashtag-link-template" class="open-hashtag-modal"></a>
<div id="template-link-shortened">
<a class="link-shortened" rel="nofollow" target="_blank"></a>
<a class="link-shortened" rel="nofollow noreferrer" target="_blank"></a>
</div>
<!-- template para ir dentro de avatar-row -->
@ -632,7 +632,7 @@ @@ -632,7 +632,7 @@
<h2 class="profile-screen-name">@<b></b></h2>
<div>
<span class="profile-location"></span>
<a class="profile-url" rel="nofollow" target="_blank"></a>
<a class="profile-url" rel="nofollow noreferrer" target="_blank"></a>
</div>
<div class="profile-bio"></div>
<div id="msngrswr">

28
js/interface_common.js

@ -10,7 +10,7 @@ var twister = { @@ -10,7 +10,7 @@ var twister = {
focus: {}, // focused elements are counted here
html: {
detached: $('<div>'), // here elements go to detach themself
blanka: $('<a target="_blank">') // to open stuff in new tab, see routeOnClick()
blanka: $('<a rel="nofollow noreferrer" target="_blank">') // to open stuff in new tab, see routeOnClick()
},
tmpl: { // templates pointers are stored here
root: $('<div>') // templates should be detached from DOM and attached here; use extractTemplate()
@ -898,16 +898,25 @@ function fetchShortenedURI(req) { @@ -898,16 +898,25 @@ function fetchShortenedURI(req) {
);
}
function applyShortenedURI(short, long) {
function applyShortenedURI(short, uriAndMimetype) {
var long = (uriAndMimetype instanceof Array) ? uriAndMimetype[0] : uriAndMimetype;
var elems = getElem('.link-shortened[href="' + short + '"]')
.attr('href', long)
.removeClass('link-shortened')
.off('click mouseup')
.on('click mouseup', muteEvent)
;
var cropped = (/*$.Options.cropLongURIs &&*/ long.length > 23) ? long.slice(0, 23) + '…' : undefined;
for (var i = 0; i < elems.length; i++)
if (elems[i].text === short) // there may be some other text, possibly formatted, so we check it
elems[i].text = long;
if (cropped)
$(elems[i])
.text(cropped)
.on('mouseover', {uri: long}, function (event) {event.target.text = event.data.uri;})
.on('mouseout', {uri: cropped}, function (event) {event.target.text = event.data.uri;})
;
else
elems[i].text = long;
}
function routeOnClick(event) {
@ -2477,7 +2486,18 @@ $(document).ready(function () { @@ -2477,7 +2486,18 @@ $(document).ready(function () {
if (!textArea.length) textArea = postAreaNew.find('textarea:last');
event.data.cbReq = textArea;
openRequestShortURIForm(event);
if (postAreaNew.closest('.directMessages').length)
confirmPopup({
txtMessage: polyglot.t('shorten_URI_its_public_is_it_ok'),
txtConfirm: polyglot.t('shorten_URI'),
cbConfirm: openRequestShortURIForm,
cbConfirmReq: event
});
else if ($.mobile && postAreaNew.closest('.dm-form').length) {
if (confirm(polyglot.t('shorten_URI_its_public_is_it_ok')))
openRequestShortURIForm(event);
} else
openRequestShortURIForm(event);
}
)
;

13
js/interface_localization.js

@ -174,6 +174,7 @@ if(preferredLanguage == "en"){ @@ -174,6 +174,7 @@ if(preferredLanguage == "en"){
"shorten_URI_enter_link": "Enter the long link.\n"
+ "Note: shortening an URL will produce an 'empty' twist on your behalf containing the full URL.\n"
+ "This special twist is not displayed by twister clients, but your twist counter will increase.",
"shorten_URI_its_public_is_it_ok": "Your link will be public available! Are you OK with that?",
"The File APIs are not fully supported in this browser.": "The File APIs are not fully supported in this browser.",
"time_ago": "%{time} ago", // 5 minutes ago
"Time of the last block:": "Time of the last block: ",
@ -507,6 +508,7 @@ if(preferredLanguage == "es"){ @@ -507,6 +508,7 @@ if(preferredLanguage == "es"){
"shorten_URI_enter_link": "Introducir el enlace largo.\n"
+ "Note: shortening an URL will produce an 'empty' twist on your behalf containing the full URL.\n"
+ "This special twist is not displayed by twister clients, but your twist counter will increase.",
"shorten_URI_its_public_is_it_ok": "Your link will be public available! Are you OK with that?",
"The File APIs are not fully supported in this browser.": "Las API de archivos no son totalmente compatibles con este navegador.",
"time_ago": "hace %{time}", // 5 minutes ago
"Time of the last block:": "Hora del último bloque: ",
@ -825,6 +827,7 @@ if(preferredLanguage == "uk"){ @@ -825,6 +827,7 @@ if(preferredLanguage == "uk"){
"shorten_URI_enter_link": "Enter the long link.\n"
+ "Note: shortening an URL will produce an 'empty' twist on your behalf containing the full URL.\n"
+ "This special twist is not displayed by twister clients, but your twist counter will increase.",
"shorten_URI_its_public_is_it_ok": "Your link will be public available! Are you OK with that?",
"The File APIs are not fully supported in this browser.": "File APIs не повністю підтримується браузером.",
"time_ago": "%{time} тому", // 5 minutes ago
"Time of the last block:": "Час останнього блоку: ",
@ -1140,6 +1143,7 @@ if(preferredLanguage == "zh-CN"){ @@ -1140,6 +1143,7 @@ if(preferredLanguage == "zh-CN"){
"shorten_URI_enter_link": "Enter the long link.\n"
+ "Note: shortening an URL will produce an 'empty' twist on your behalf containing the full URL.\n"
+ "This special twist is not displayed by twister clients, but your twist counter will increase.",
"shorten_URI_its_public_is_it_ok": "Your link will be public available! Are you OK with that?",
"The File APIs are not fully supported in this browser.": "这个浏览器不能完全支持 File API。",
"time_ago": "%{time} 之前", // 5 minutes ago
"Time of the last block:": "最新区块的时间:",
@ -1473,6 +1477,7 @@ if(preferredLanguage == "nl"){ @@ -1473,6 +1477,7 @@ if(preferredLanguage == "nl"){
"shorten_URI_enter_link": "Enter the long link.\n"
+ "Note: shortening an URL will produce an 'empty' twist on your behalf containing the full URL.\n"
+ "This special twist is not displayed by twister clients, but your twist counter will increase.",
"shorten_URI_its_public_is_it_ok": "Your link will be public available! Are you OK with that?",
"The File APIs are not fully supported in this browser.": "The File APIs are not fully supported in this browser.",
"time_ago": "%{time} geleden", // 5 minutes ago
"Time of the last block:": "Tijd van de laatste block: ",
@ -1790,6 +1795,7 @@ if(preferredLanguage == "it"){ @@ -1790,6 +1795,7 @@ if(preferredLanguage == "it"){
"shorten_URI_enter_link": "Enter the long link.\n"
+ "Note: shortening an URL will produce an 'empty' twist on your behalf containing the full URL.\n"
+ "This special twist is not displayed by twister clients, but your twist counter will increase.",
"shorten_URI_its_public_is_it_ok": "Your link will be public available! Are you OK with that?",
"The File APIs are not fully supported in this browser.": "Le API File non sono interamente supportate da questo browser.",
"time_ago": "%{time} fa", // 5 minutes ago
"Time of the last block:": "Orario del blocco più recente: ",
@ -2105,6 +2111,7 @@ if(preferredLanguage == "fr"){ @@ -2105,6 +2111,7 @@ if(preferredLanguage == "fr"){
"shorten_URI_enter_link": "Enter the long link.\n"
+ "Note: shortening an URL will produce an 'empty' twist on your behalf containing the full URL.\n"
+ "This special twist is not displayed by twister clients, but your twist counter will increase.",
"shorten_URI_its_public_is_it_ok": "Your link will be public available! Are you OK with that?",
"The File APIs are not fully supported in this browser.": "L'API de fichier n'est pas entièrement pris en charge dans votre navigateur.",
"time_ago": "Il y a %{time}", // 5 minutes ago
"Time of the last block:": "Heure du dernier bloc: ",
@ -2424,6 +2431,7 @@ if(preferredLanguage == "ru"){ @@ -2424,6 +2431,7 @@ if(preferredLanguage == "ru"){
"shorten_URI_enter_link": "Введи длинную ссылку.\n"
+ "Примечание: в результате сокращения URL получается 'пустой' твист, содержащий эту URL.\n"
+ "Этот особый твист не отображается клиентами твистера, но учитывается в числе твоих твистов.",
"shorten_URI_its_public_is_it_ok": "Ссылка будет общедоступной! Это приемлимо для тебя?",
"The File APIs are not fully supported in this browser.": "File APIs не полностью поддерживается этим браузером.",
"time_ago": "%{time} назад", // 5 minutes ago
"Time of the last block:": "Время последнего блока: ",
@ -2746,6 +2754,7 @@ if(preferredLanguage == "de"){ @@ -2746,6 +2754,7 @@ if(preferredLanguage == "de"){
"shorten_URI_enter_link": "Enter the long link.\n"
+ "Note: shortening an URL will produce an 'empty' twist on your behalf containing the full URL.\n"
+ "This special twist is not displayed by twister clients, but your twist counter will increase.",
"shorten_URI_its_public_is_it_ok": "Your link will be public available! Are you OK with that?",
"The File APIs are not fully supported in this browser.": "Die File-API's werden von diesem Browser nicht vollständig unterstützt.",
"time_ago": "vor %{time}", // 5 minutes ago
"Time of the last block:": "Zeit des letzten Blocks: ",
@ -3064,6 +3073,7 @@ if(preferredLanguage == "ja"){ @@ -3064,6 +3073,7 @@ if(preferredLanguage == "ja"){
"shorten_URI_enter_link": "Enter the long link.\n"
+ "Note: shortening an URL will produce an 'empty' twist on your behalf containing the full URL.\n"
+ "This special twist is not displayed by twister clients, but your twist counter will increase.",
"shorten_URI_its_public_is_it_ok": "Your link will be public available! Are you OK with that?",
"The File APIs are not fully supported in this browser.": "ご使用のブラウザーは完全にファイルAPIに対応していません。",
"time_ago": "%{time}前", // 5 minutes ago
"Time of the last block:": "最新ブロックの生成日時: ",
@ -3380,6 +3390,7 @@ if(preferredLanguage == "pt-BR"){ @@ -3380,6 +3390,7 @@ if(preferredLanguage == "pt-BR"){
"shorten_URI_enter_link": "Enter the long link.\n"
+ "Note: shortening an URL will produce an 'empty' twist on your behalf containing the full URL.\n"
+ "This special twist is not displayed by twister clients, but your twist counter will increase.",
"shorten_URI_its_public_is_it_ok": "Your link will be public available! Are you OK with that?",
"The File APIs are not fully supported in this browser.": "O gerenciamento de arquivos não é completamente suportado neste navegador.",
"time_ago": "%{time} atrás", // 5 minutes ago
"Time of the last block:": "Horário do último bloco: ",
@ -3698,6 +3709,7 @@ if(preferredLanguage == "tr"){ @@ -3698,6 +3709,7 @@ if(preferredLanguage == "tr"){
"shorten_URI_enter_link": "Enter the long link.\n"
+ "Note: shortening an URL will produce an 'empty' twist on your behalf containing the full URL.\n"
+ "This special twist is not displayed by twister clients, but your twist counter will increase.",
"shorten_URI_its_public_is_it_ok": "Your link will be public available! Are you OK with that?",
"The File APIs are not fully supported in this browser.": "Dosya API'si tarayıcınızda tam olarak desteklenmiyor.",
"time_ago": "%{time} önce", // 5 minutes ago
"Time of the last block:": "Son blok saati: ",
@ -4015,6 +4027,7 @@ if(preferredLanguage == "cs"){ @@ -4015,6 +4027,7 @@ if(preferredLanguage == "cs"){
"shorten_URI_enter_link": "Enter the long link.\n"
+ "Note: shortening an URL will produce an 'empty' twist on your behalf containing the full URL.\n"
+ "This special twist is not displayed by twister clients, but your twist counter will increase.",
"shorten_URI_its_public_is_it_ok": "Your link will be public available! Are you OK with that?",
"The File APIs are not fully supported in this browser.": "Upozornění: váš webový prohlížeč nepodporuje File API.",
"time_ago": "před %{time}", // 5 minutes ago
"Time of the last block:": "Čas posledního bloku: ",

6
js/twister_directmsg.js

@ -212,7 +212,8 @@ function openDmWithUserModal(peerAlias) { @@ -212,7 +212,8 @@ function openDmWithUserModal(peerAlias) {
requestDmConversationModal(modal.self.find('.direct-messages-thread').empty(), peerAlias);
$('.dm-form-template').children().clone(true)
.addClass('open').appendTo(modal.content).fadeIn('fast');
.addClass('open').appendTo(modal.content).fadeIn('fast')
.find('textarea').focus();
}
function openGroupMessagesModal(groupAlias) {
@ -267,7 +268,8 @@ function openGroupMessagesModal(groupAlias) { @@ -267,7 +268,8 @@ function openGroupMessagesModal(groupAlias) {
);
$('.dm-form-template').children().clone(true)
.addClass('open').appendTo(req.modal.content).fadeIn('fast');
.addClass('open').appendTo(req.modal.content).fadeIn('fast')
.find('textarea').focus();
}
}, {groupAlias: groupAlias, modal: modal}
);

13
js/twister_formatpost.js

@ -66,14 +66,14 @@ function postToElem(post, kind, promoted) { @@ -66,14 +66,14 @@ function postToElem(post, kind, promoted) {
username = userpost.n;
k = userpost.k;
time = userpost.time;
msg = userpost.msg;
msg = userpost.msg + (userpost.msg2 || '');
content_to_rt = $.toJSON(userpost);
content_to_sigrt = post.sig_userpost;
} else {
username = rt.n;
k = rt.k;
time = rt.time;
msg = rt.msg;
msg = rt.msg + (rt.msg2 || '');
content_to_rt = $.toJSON(rt);
content_to_sigrt = userpost.sig_rt;
}
@ -82,7 +82,7 @@ function postToElem(post, kind, promoted) { @@ -82,7 +82,7 @@ function postToElem(post, kind, promoted) {
username = userpost.n;
k = userpost.k;
time = userpost.time;
msg = userpost.msg;
msg = userpost.msg + (userpost.msg2 || '');
content_to_rt = $.toJSON(userpost);
content_to_sigrt = post.sig_userpost;
}
@ -257,7 +257,7 @@ function setPostInfoSent(n, k, item) { @@ -257,7 +257,7 @@ function setPostInfoSent(n, k, item) {
function postToElemDM(dmData, localUser, remoteUser) {
var senderAlias = (dmData.from && dmData.from.length && dmData.from.charCodeAt(0))
? dmData.from : (dmData.fromMe ? localUser : remoteUser);
var elem = $('#dm-chat-template').clone(true)
var elem = $('#dm-chat-template').clone(true).appendTo(twister.html.detached)
.removeAttr('id')
.addClass(dmData.fromMe ? 'sent' : 'received')
;
@ -593,6 +593,7 @@ function htmlFormatMsg(msg, opt) { @@ -593,6 +593,7 @@ function htmlFormatMsg(msg, opt) {
var stopCharsRight = '>' + whiteSpaces;
var stopCharsRightHashtags = '>/\\.,:;?!%\'"[](){}^|«»…\u201C\u201D\u2026\u2014\u4E00\u3002\uFF0C\uFF1A\uFF1F\uFF01\u3010\u3011\u2047\u2048\u2049' // same as stopCharsTrailing but without '*~_-`' plus '>'
+ whiteSpaces;
var stopCharsRightHashtagsBase64 = stopCharsRightHashtags.replace('/','').replace('+','') // exclude valid base64 chars used in shortened urls
var stopCharsMarkout = '/\\*~_-`.,:;?!%+=&\'"[](){}^|«»…\u201C\u201D\u2026\u2014\u4E00\u3002\uFF0C\uFF1A\uFF1F\uFF01\u3010\u3011\u2047\u2048\u2049';
var i, j, k, str;
var mentions = [];
@ -642,7 +643,7 @@ function htmlFormatMsg(msg, opt) { @@ -642,7 +643,7 @@ function htmlFormatMsg(msg, opt) {
.replace(/&(?!lt;|gt;)/g, '&amp;');
if (markoutOpt === 'apply') {
if (msg.str.slice(i, i + 6).toLowerCase() === 'twist:' && msg.str[i + 17] === '='
&& getSubStrStart(msg.str, i + 16, stopCharsRightHashtags, false, '') === i + 6)
&& getSubStrStart(msg.str, i + 16, stopCharsRightHashtagsBase64, false, '') === i + 6)
msg = msgAddHtmlEntity(msg, j - 1, getSubStrEnd(msg.str, k + 1, ')', true, '') + 2,
newHtmlEntityLink(twister.tmpl.linkShortened,
msg.str.slice(i, i + 18), linkName)
@ -693,7 +694,7 @@ function htmlFormatMsg(msg, opt) { @@ -693,7 +694,7 @@ function htmlFormatMsg(msg, opt) {
}
}
} else if (msg.str.slice(i, i + 6).toLowerCase() === 'twist:' && msg.str[i + 17] === '='
&& getSubStrStart(msg.str, i + 16, stopCharsRightHashtags, false, '') === i + 6) {
&& getSubStrStart(msg.str, i + 16, stopCharsRightHashtagsBase64, false, '') === i + 6) {
str = msg.str.slice(i, i + 18);
msg = msgAddHtmlEntity(msg, i, i + str.length,
newHtmlEntityLink(twister.tmpl.linkShortened, str, str));

8
network.html

@ -97,14 +97,14 @@ @@ -97,14 +97,14 @@
<li class="not-using-proxy" style="display:none;">
<label>External Port 1 (TCP): </label>
<span class="ext-port1"></span>
<a class="test-ext-port1" target="_blank">
<a class="test-ext-port1" rel="nofollow noreferrer" target="_blank">
<button>Test open port (external site)</button>
</a>
</li>
<li class="not-using-proxy" style="display:none;">
<label>External Port 2 (TCP+UDP): </label>
<span class="ext-port2"></span>
<a class="test-ext-port2" target="_blank">
<a class="test-ext-port2" rel="nofollow noreferrer" target="_blank">
<button>Test open port (external site)</button>
</a>
</li>
@ -262,11 +262,11 @@ @@ -262,11 +262,11 @@
<!-- template for user links in message (open profile modal) -->
<a id="msg-user-link-template" class="open-profile-modal"></a>
<!-- template for user links in message (open profile modal) -->
<a id="external-page-link-template" rel="nofollow" target="_blank"></a>
<a id="external-page-link-template" rel="nofollow noreferrer" target="_blank"></a>
<!-- template for user links in message (open profile modal) -->
<a id="hashtag-link-template" class="open-hashtag-modal"></a>
<div id="template-link-shortened">
<a class="link-shortened" rel="nofollow" target="_blank"></a>
<a class="link-shortened" rel="nofollow noreferrer" target="_blank"></a>
</div>
<div class="prompt-wrapper">

4
options.html

@ -458,11 +458,11 @@ @@ -458,11 +458,11 @@
<!-- template for user links in message (open profile modal) -->
<a id="msg-user-link-template" class="open-profile-modal"></a>
<!-- template for user links in message (open profile modal) -->
<a id="external-page-link-template" rel="nofollow" target="_blank"></a>
<a id="external-page-link-template" rel="nofollow noreferrer" target="_blank"></a>
<!-- template for user links in message (open profile modal) -->
<a id="hashtag-link-template" class="open-hashtag-modal"></a>
<div id="template-link-shortened">
<a class="link-shortened" rel="nofollow" target="_blank"></a>
<a class="link-shortened" rel="nofollow noreferrer" target="_blank"></a>
</div>
</div>

6
tmobile.html

@ -413,7 +413,7 @@ @@ -413,7 +413,7 @@
<h2 class="profile-screen-name">@<b></b></h2>
<div>
<span class="profile-location"></span>
<a class="profile-url" rel="nofollow" target="_blank"></a>
<a class="profile-url" rel="nofollow noreferrer" target="_blank"></a>
</div>
<div class="profile-bio">
</div>
@ -832,11 +832,11 @@ @@ -832,11 +832,11 @@
<!-- template for user links in message (open profile modal) -->
<a id="msg-user-link-template" class="open-profile-modal"></a>
<!-- template for user links in message (open profile modal) -->
<a id="external-page-link-template" rel="nofollow" target="_blank"></a>
<a id="external-page-link-template" rel="nofollow noreferrer" target="_blank"></a>
<!-- template for user links in message (open profile modal) -->
<a id="hashtag-link-template" class="open-hashtag-modal"></a>
<div id="template-link-shortened">
<a class="link-shortened" rel="nofollow" target="_blank"></a>
<a class="link-shortened" rel="nofollow noreferrer" target="_blank"></a>
</div>
<!-- template para ir dentro de avatar-row -->

Loading…
Cancel
Save