|
|
@ -30,7 +30,7 @@ function openModal( modalClass ) |
|
|
|
|
|
|
|
|
|
|
|
//fecha o modal removendo o conteúdo por detach
|
|
|
|
//fecha o modal removendo o conteúdo por detach
|
|
|
|
function closeModal($this) |
|
|
|
function closeModal($this) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var $body = $( "body" ); |
|
|
|
var $body = $( "body" ); |
|
|
|
var $modalWindows = $( "body" ).children( ".modal-blackout" ); |
|
|
|
var $modalWindows = $( "body" ).children( ".modal-blackout" ); |
|
|
|
|
|
|
|
|
|
|
@ -103,7 +103,12 @@ function openProfileModal(e) |
|
|
|
|
|
|
|
|
|
|
|
var $this = $( this ); |
|
|
|
var $this = $( this ); |
|
|
|
var username = $.MAL.urlToUser( $this.attr("href") ); |
|
|
|
var username = $.MAL.urlToUser( $this.attr("href") ); |
|
|
|
|
|
|
|
openProfileModalWithUsername(username); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function openProfileModalWithUsername(username) |
|
|
|
|
|
|
|
{ |
|
|
|
if(!username) |
|
|
|
if(!username) |
|
|
|
{ |
|
|
|
{ |
|
|
|
alert(polyglot.t("You don't have any profile because you are not logged in.")); |
|
|
|
alert(polyglot.t("You don't have any profile because you are not logged in.")); |
|
|
@ -118,16 +123,17 @@ function openProfileModal(e) |
|
|
|
|
|
|
|
|
|
|
|
//título do modal
|
|
|
|
//título do modal
|
|
|
|
$( "."+profileModalClass + " h3" ).text( polyglot.t("users_profile", { username: username }) ); |
|
|
|
$( "."+profileModalClass + " h3" ).text( polyglot.t("users_profile", { username: username }) ); |
|
|
|
|
|
|
|
|
|
|
|
//hed//add dinamic follow button in profile modal window
|
|
|
|
//hed//add dinamic follow button in profile modal window
|
|
|
|
if(followingUsers.indexOf(username) != -1){ |
|
|
|
if(followingUsers.indexOf(username) != -1){ |
|
|
|
$('.profile-card button.followButton').first().removeClass('follow').addClass('profileUnfollow').text(polyglot.t('Unfollow')).on('click', function(){ |
|
|
|
$('.profile-card button.followButton').first().removeClass('follow').addClass('profileUnfollow').text(polyglot.t('Unfollow')).on('click', function(){ |
|
|
|
unfollow(username); |
|
|
|
unfollow(username); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$(".tox-ctc").attr("title", polyglot.t("Copy to clipboard")); |
|
|
|
$(".tox-ctc").attr("title", polyglot.t("Copy to clipboard")); |
|
|
|
$(".bitmessage-ctc").attr("title", polyglot.t("Copy to clipboard")); |
|
|
|
$(".bitmessage-ctc").attr("title", polyglot.t("Copy to clipboard")); |
|
|
|
|
|
|
|
window.location.hash = '#profile?user=' + username; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function newHashtagModal(hashtag) { |
|
|
|
function newHashtagModal(hashtag) { |
|
|
@ -150,16 +156,7 @@ function openHashtagModal(e) |
|
|
|
|
|
|
|
|
|
|
|
var $this = $( this ); |
|
|
|
var $this = $( this ); |
|
|
|
var hashtag = $this.text().substring(1).toLowerCase(); |
|
|
|
var hashtag = $this.text().substring(1).toLowerCase(); |
|
|
|
|
|
|
|
openHashtagModalFromSearch(hashtag); |
|
|
|
var hashtagModalClass = "hashtag-modal"; |
|
|
|
|
|
|
|
openModal( hashtagModalClass ); |
|
|
|
|
|
|
|
$( "."+hashtagModalClass ).attr("data-resource","hashtag"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var hashtagModalContent = newHashtagModal( hashtag ); |
|
|
|
|
|
|
|
hashtagModalContent.appendTo("." +hashtagModalClass + " .modal-content"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//título do modal
|
|
|
|
|
|
|
|
$( "."+hashtagModalClass + " h3" ).text( "#" + hashtag ); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function openHashtagModalFromSearch(hashtag) |
|
|
|
function openHashtagModalFromSearch(hashtag) |
|
|
@ -173,6 +170,7 @@ function openHashtagModalFromSearch(hashtag) |
|
|
|
|
|
|
|
|
|
|
|
//título do modal
|
|
|
|
//título do modal
|
|
|
|
$( "."+hashtagModalClass + " h3" ).text( "#" + hashtag ); |
|
|
|
$( "."+hashtagModalClass + " h3" ).text( "#" + hashtag ); |
|
|
|
|
|
|
|
window.location.hash = '#hashtag?hashtag=' + hashtag; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function updateHashtagModal(postboard,hashtag) { |
|
|
|
function updateHashtagModal(postboard,hashtag) { |
|
|
@ -354,6 +352,42 @@ function openConversationModal(e) |
|
|
|
$( "." + conversationModalClass + " h3" ).text( polyglot.t('conversation_title', {'username': postLi.find('.post-data').attr('data-screen-name')}) ); |
|
|
|
$( "." + conversationModalClass + " h3" ).text( polyglot.t('conversation_title', {'username': postLi.find('.post-data').attr('data-screen-name')}) ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function watchHashChange(e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var hashstring = window.location.hash |
|
|
|
|
|
|
|
hashstring = decodeURIComponent(hashstring); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var hashdata = hashstring.split(':'); |
|
|
|
|
|
|
|
if (hashdata[0] != '#web+twister') { |
|
|
|
|
|
|
|
hashdata = hashstring.match(/(hashtag|profile)\?(?:user|hashtag)=(.+)/); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (hashdata && hashdata[1] != undefined && hashdata[2] != undefined) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(hashdata[1] == 'profile') { |
|
|
|
|
|
|
|
openProfileModalWithUsername(hashdata[2]); |
|
|
|
|
|
|
|
}else if (hashdata[1] == 'hashtag') { |
|
|
|
|
|
|
|
openHashtagModalFromSearch(hashdata[2]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function initHashWatching() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Register custom protocol handler
|
|
|
|
|
|
|
|
if (window.navigator && window.navigator.registerProtocolHandler){ |
|
|
|
|
|
|
|
var local_twister_url = window.location.protocol + '//' + window.location.host + '/home.html#%s'; |
|
|
|
|
|
|
|
window.navigator.registerProtocolHandler('web+twister', local_twister_url, 'Twister'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Register hash spy and launch it once
|
|
|
|
|
|
|
|
window.addEventListener('hashchange', watchHashChange, false); |
|
|
|
|
|
|
|
watchHashChange(null); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Post actions, submit, count characters
|
|
|
|
// Post actions, submit, count characters
|
|
|
|
// --------------------------------------
|
|
|
|
// --------------------------------------
|
|
|
@ -366,7 +400,7 @@ var reTwistPopup = function( e ) |
|
|
|
alert(polyglot.t("You have to log in to retransmit messages.")); |
|
|
|
alert(polyglot.t("You have to log in to retransmit messages.")); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var reTwistClass = "reTwist"; |
|
|
|
var reTwistClass = "reTwist"; |
|
|
|
openModal( reTwistClass ); |
|
|
|
openModal( reTwistClass ); |
|
|
|
|
|
|
|
|
|
|
@ -439,7 +473,7 @@ var postExpandFunction = function( e, postLi ) |
|
|
|
var $postsRelated = postLi.find(".related"); |
|
|
|
var $postsRelated = postLi.find(".related"); |
|
|
|
|
|
|
|
|
|
|
|
var openClass = "open"; |
|
|
|
var openClass = "open"; |
|
|
|
|
|
|
|
|
|
|
|
if( !postLi.hasClass( openClass ) ) { |
|
|
|
if( !postLi.hasClass( openClass ) ) { |
|
|
|
originalPost.detach(); |
|
|
|
originalPost.detach(); |
|
|
|
postLi.empty(); |
|
|
|
postLi.empty(); |
|
|
@ -451,7 +485,7 @@ var postExpandFunction = function( e, postLi ) |
|
|
|
originalLi.append(originalPost); |
|
|
|
originalLi.append(originalPost); |
|
|
|
|
|
|
|
|
|
|
|
$postExpandedContent.slideDown( "fast" ); |
|
|
|
$postExpandedContent.slideDown( "fast" ); |
|
|
|
|
|
|
|
|
|
|
|
if ($.Options.getShowPreviewOpt() == 'enable'){ |
|
|
|
if ($.Options.getShowPreviewOpt() == 'enable'){ |
|
|
|
var previewContainer=$postExpandedContent.find(".preview-container")[0]; |
|
|
|
var previewContainer=$postExpandedContent.find(".preview-container")[0]; |
|
|
|
/* was the preview added before... */ |
|
|
|
/* was the preview added before... */ |
|
|
@ -683,7 +717,7 @@ function replyTextKeypress(e) { |
|
|
|
} |
|
|
|
} |
|
|
|
}else if( !$.Options.keyEnterToSend() ){ |
|
|
|
}else if( !$.Options.keyEnterToSend() ){ |
|
|
|
if (e.keyCode === 13 && (e.metaKey || e.ctrlKey)) { |
|
|
|
if (e.keyCode === 13 && (e.metaKey || e.ctrlKey)) { |
|
|
|
|
|
|
|
|
|
|
|
$this.val($this.val().trim()); |
|
|
|
$this.val($this.val().trim()); |
|
|
|
if( !tweetAction.hasClass("disabled") ) { |
|
|
|
if( !tweetAction.hasClass("disabled") ) { |
|
|
|
tweetAction.click(); |
|
|
|
tweetAction.click(); |
|
|
@ -960,15 +994,15 @@ var unicodeConversionList = { |
|
|
|
function getRangesForUnicodeConversion(msg) |
|
|
|
function getRangesForUnicodeConversion(msg) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(!msg) return; |
|
|
|
if(!msg) return; |
|
|
|
|
|
|
|
|
|
|
|
var tempMsg = msg; |
|
|
|
var tempMsg = msg; |
|
|
|
var results = []; |
|
|
|
var results = []; |
|
|
|
var regexHttpStart = /http[s]?:\/\//; |
|
|
|
var regexHttpStart = /http[s]?:\/\//; |
|
|
|
var regexHttpEnd = /[ \n\t]/; |
|
|
|
var regexHttpEnd = /[ \n\t]/; |
|
|
|
var start=0, end, position, rep = true; |
|
|
|
var start=0, end, position, rep = true; |
|
|
|
|
|
|
|
|
|
|
|
position = tempMsg.search(regexHttpStart); |
|
|
|
position = tempMsg.search(regexHttpStart); |
|
|
|
|
|
|
|
|
|
|
|
while(position!=-1) |
|
|
|
while(position!=-1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
end = start + position; |
|
|
|
end = start + position; |
|
|
@ -979,7 +1013,7 @@ function getRangesForUnicodeConversion(msg) |
|
|
|
rep = !rep; |
|
|
|
rep = !rep; |
|
|
|
start = end; |
|
|
|
start = end; |
|
|
|
tempMsg = tempMsg.substring(position, tempMsg.length); |
|
|
|
tempMsg = tempMsg.substring(position, tempMsg.length); |
|
|
|
|
|
|
|
|
|
|
|
if(rep == true) |
|
|
|
if(rep == true) |
|
|
|
position = tempMsg.search(regexHttpStart); |
|
|
|
position = tempMsg.search(regexHttpStart); |
|
|
|
else |
|
|
|
else |
|
|
@ -988,15 +1022,15 @@ function getRangesForUnicodeConversion(msg) |
|
|
|
end = msg.length; |
|
|
|
end = msg.length; |
|
|
|
if(end > start) |
|
|
|
if(end > start) |
|
|
|
results.push({start: start, end: end, replace: rep}); |
|
|
|
results.push({start: start, end: end, replace: rep}); |
|
|
|
|
|
|
|
|
|
|
|
return results; |
|
|
|
return results; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getUnicodeReplacement(msg, list, ranges, ta) |
|
|
|
function getUnicodeReplacement(msg, list, ranges, ta) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(!msg || !list || !ranges) return; |
|
|
|
if(!msg || !list || !ranges) return; |
|
|
|
if(ranges.length===0) return ""; |
|
|
|
if(ranges.length===0) return ""; |
|
|
|
|
|
|
|
|
|
|
|
var position, substrings = []; |
|
|
|
var position, substrings = []; |
|
|
|
for (var j=0; j<ranges.length; j++) |
|
|
|
for (var j=0; j<ranges.length; j++) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1010,7 +1044,7 @@ function getUnicodeReplacement(msg, list, ranges, ta) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var oldSubstring = substrings[j]; |
|
|
|
var oldSubstring = substrings[j]; |
|
|
|
substrings[j] = substrings[j].replace(list[i].k, list[i].u); |
|
|
|
substrings[j] = substrings[j].replace(list[i].k, list[i].u); |
|
|
|
|
|
|
|
|
|
|
|
var len = oldSubstring.length - substrings[j].length + list[i].u.length; |
|
|
|
var len = oldSubstring.length - substrings[j].length + list[i].u.length; |
|
|
|
ta.data("unicodeConversionStack").unshift({ |
|
|
|
ta.data("unicodeConversionStack").unshift({ |
|
|
|
"k": oldSubstring.substr(position, len), |
|
|
|
"k": oldSubstring.substr(position, len), |
|
|
@ -1036,7 +1070,7 @@ function convert2Unicodes(s, ta) |
|
|
|
if(!ta.data("disabledUnicodeRules")) // A list of conversion rules that are temporarily disabled
|
|
|
|
if(!ta.data("disabledUnicodeRules")) // A list of conversion rules that are temporarily disabled
|
|
|
|
ta.data("disabledUnicodeRules", []); |
|
|
|
ta.data("disabledUnicodeRules", []); |
|
|
|
var ranges = getRangesForUnicodeConversion(s); |
|
|
|
var ranges = getRangesForUnicodeConversion(s); |
|
|
|
var list; |
|
|
|
var list; |
|
|
|
if ($.Options.getUnicodeConversionOpt() === "enable" || $.Options.getConvertPunctuationsOpt()) |
|
|
|
if ($.Options.getUnicodeConversionOpt() === "enable" || $.Options.getConvertPunctuationsOpt()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
list = unicodeConversionList.punctuation; |
|
|
|
list = unicodeConversionList.punctuation; |
|
|
@ -1057,7 +1091,7 @@ function convert2Unicodes(s, ta) |
|
|
|
list = unicodeConversionList.fractions; |
|
|
|
list = unicodeConversionList.fractions; |
|
|
|
s = getUnicodeReplacement(s, list, ranges, ta); |
|
|
|
s = getUnicodeReplacement(s, list, ranges, ta); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (ta.data("unicodeConversionStack").length > 0) |
|
|
|
if (ta.data("unicodeConversionStack").length > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var ub = ta.closest(".post-area-new").find(".undo-unicode"); |
|
|
|
var ub = ta.closest(".post-area-new").find(".undo-unicode"); |
|
|
@ -1083,7 +1117,7 @@ function undoLastUnicode(e) { |
|
|
|
var uc = $ta.data("unicodeConversionStack").shift(); |
|
|
|
var uc = $ta.data("unicodeConversionStack").shift(); |
|
|
|
|
|
|
|
|
|
|
|
var pt = $ta.val(); |
|
|
|
var pt = $ta.val(); |
|
|
|
|
|
|
|
|
|
|
|
// If the text was shifted, and character is no longer at the saved position, this function
|
|
|
|
// If the text was shifted, and character is no longer at the saved position, this function
|
|
|
|
// searches for it to the right. If it is not there, it searches in the oposite direction.
|
|
|
|
// searches for it to the right. If it is not there, it searches in the oposite direction.
|
|
|
|
// if it's not there either, it means it was deleted, so it is skipped.
|
|
|
|
// if it's not there either, it means it was deleted, so it is skipped.
|
|
|
@ -1282,7 +1316,7 @@ function replaceDashboards() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function initInterfaceCommon() { |
|
|
|
function initInterfaceCommon() { |
|
|
|
$( "body" ).on( "click", function(event) { |
|
|
|
$( "body" ).on( "click", function(event) { |
|
|
|
if($(event.target).hasClass('cancel')) closeModal($(this)); |
|
|
|
if($(event.target).hasClass('cancel')) closeModal($(this)); |
|
|
|
}); |
|
|
|
}); |
|
|
|
$(".cancel").on('click', function(event){ |
|
|
|
$(".cancel").on('click', function(event){ |
|
|
|