|
|
@ -139,10 +139,44 @@ function resumeModal(event) { |
|
|
|
// TODO also need reset modal height here maybe and then compute new scroll
|
|
|
|
// TODO also need reset modal height here maybe and then compute new scroll
|
|
|
|
if (modal.scroll) |
|
|
|
if (modal.scroll) |
|
|
|
modal.self.find($(modal.scroll.targetSelector).scrollTop(modal.scroll.top)); |
|
|
|
modal.self.find($(modal.scroll.targetSelector).scrollTop(modal.scroll.top)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (modal.resume && typeof modal.resume.cbFunc === 'function') |
|
|
|
|
|
|
|
modal.resume.cbFunc(modal.resume.cbArg); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function focusModalWithElement(elem, cbFunc, cbArg) { |
|
|
|
|
|
|
|
if (elem.jquery ? elem.is('html *') : $(elem).is('html *')) { |
|
|
|
|
|
|
|
cbFunc(cbArg); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var hash = getHashOfMinimizedModalWithElem(elem); |
|
|
|
|
|
|
|
if (hash) { |
|
|
|
|
|
|
|
_minimizedModals[hash].resume = {cbFunc: cbFunc, cbArg: cbArg}; |
|
|
|
|
|
|
|
_minimizedModals[hash].btnResume.click(); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getHashOfMinimizedModalWithElem(elem) { |
|
|
|
|
|
|
|
for (var i in _minimizedModals) |
|
|
|
|
|
|
|
if (_minimizedModals[i] && _minimizedModals[i].self.find(elem).length) |
|
|
|
|
|
|
|
return i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ''; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isModalWithElemExists(elem) { |
|
|
|
|
|
|
|
if (elem.jquery ? elem.is('html *') : $(elem).is('html *')) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
return getHashOfMinimizedModalWithElem(elem) ? true : false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function confirmPopup(event, req) { |
|
|
|
function confirmPopup(event, req) { |
|
|
|
if (event && event.stopPropagation) { |
|
|
|
if (event && event.stopPropagation) { |
|
|
|
event.stopPropagation(); |
|
|
|
event.stopPropagation(); |
|
|
@ -331,29 +365,37 @@ function openHashtagModalFromSearchHandler(hashtag) { |
|
|
|
title: '#' + hashtag |
|
|
|
title: '#' + hashtag |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
clearHashtagProcessed(); |
|
|
|
setupQueryModalUpdating(modal.content.find('.postboard-posts'), hashtag, 'hashtag'); |
|
|
|
updateHashtagModal(modal.content.find('.postboard-posts'), hashtag, 'hashtag'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function updateHashtagModal(postboard, hashtag, resource, timeoutArgs) { |
|
|
|
function setupQueryModalUpdating(postboard, query, resource) { |
|
|
|
if (postboard.is('html *')) { |
|
|
|
var req = { |
|
|
|
requestHashtag(postboard, hashtag, resource, timeoutArgs); |
|
|
|
postboard: postboard, |
|
|
|
|
|
|
|
query: query, |
|
|
|
|
|
|
|
resource: resource, |
|
|
|
|
|
|
|
id: query + '@' + resource |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if (_hashtagPendingPostsUpdated) { |
|
|
|
postboard.attr('data-request-id', req.id); |
|
|
|
if (resource !== 'mention' && $.Options.showDesktopNotifPostsModal.val === 'enable') { |
|
|
|
|
|
|
|
$.MAL.showDesktopNotif (false, polyglot.t('You got')+' '+polyglot.t('new_posts', _hashtagPendingPostsUpdated)+' '+polyglot.t('in search result')+'.', false,'twister_notification_new_posts_modal', $.Options.showDesktopNotifPostsModalTimer.val, function() { |
|
|
|
requestQuery(req); |
|
|
|
$('.postboard-news').hide(); |
|
|
|
|
|
|
|
displayHashtagPending($('.hashtag-modal .postboard-posts')); |
|
|
|
// use extended timeout parameters on modal refresh (requires twister_core >= 0.9.14).
|
|
|
|
}, false) |
|
|
|
// our first query above should be faster (with default timeoutArgs of twisterd),
|
|
|
|
} |
|
|
|
// then we may possibly collect more posts on our second try by waiting more.
|
|
|
|
_hashtagPendingPostsUpdated = 0; |
|
|
|
req.timeoutArgs = [10000, 2000, 3]; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
postboard.attr('data-request-interval', setInterval(updateQueryModal, 5000, req)); // FIXME
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// use extended timeout parameters on modal refresh (requires twister_core >= 0.9.14).
|
|
|
|
function updateQueryModal(req) { |
|
|
|
// our first query above should be faster (with default timeoutArgs of twisterd),
|
|
|
|
if (!isModalWithElemExists(req.postboard)) { |
|
|
|
// then we may possibly collect more posts on our second try by waiting more.
|
|
|
|
clearInterval(req.postboard.attr('data-request-interval')); |
|
|
|
setTimeout(updateHashtagModal, 5000, postboard, hashtag, resource, [10000,2000,3]); |
|
|
|
clearQueryProcessed(req.id); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requestQuery(req); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function openMentionsModal(e) { |
|
|
|
function openMentionsModal(e) { |
|
|
@ -382,12 +424,16 @@ function openMentionsModalHandler(username) { |
|
|
|
title: polyglot.t('users_mentions', {username: username}) |
|
|
|
title: polyglot.t('users_mentions', {username: username}) |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
clearHashtagProcessed(); |
|
|
|
setupQueryModalUpdating(modal.content.find('.postboard-posts'), username, 'mention'); |
|
|
|
updateHashtagModal(modal.content.find('.postboard-posts'), username, 'mention'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (username === defaultScreenName) { |
|
|
|
if (username === defaultScreenName) { |
|
|
|
// obtain already cached mention posts from twister_newmsgs.js
|
|
|
|
// obtain already cached mention posts from twister_newmsgs.js
|
|
|
|
processHashtag(modal.content.find('.postboard-posts'), defaultScreenName, getMentionsData()); |
|
|
|
processQuery({ |
|
|
|
|
|
|
|
postboard: modal.content.find('.postboard-posts'), |
|
|
|
|
|
|
|
query: defaultScreenName, |
|
|
|
|
|
|
|
resource: 'mention', |
|
|
|
|
|
|
|
posts: getMentionsData() |
|
|
|
|
|
|
|
}); |
|
|
|
resetMentionsCount(); |
|
|
|
resetMentionsCount(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -473,14 +519,9 @@ function newConversationModal(username, resource) { |
|
|
|
var postLi = postboard.children().first() |
|
|
|
var postLi = postboard.children().first() |
|
|
|
.css('display', 'none'); |
|
|
|
.css('display', 'none'); |
|
|
|
getTopPostOfConversation(postLi, null, postboard); |
|
|
|
getTopPostOfConversation(postLi, null, postboard); |
|
|
|
}, {content:content} |
|
|
|
}, {content: content} |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
content.find('.postboard-news').on('click', function () { |
|
|
|
|
|
|
|
$(this).hide(); |
|
|
|
|
|
|
|
displayHashtagPending($('.conversation-modal .postboard-posts')); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return content; |
|
|
|
return content; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -494,7 +535,7 @@ function openConversationClick(e) { |
|
|
|
':post' + postData.attr('data-id'); |
|
|
|
':post' + postData.attr('data-id'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function openConversationModal(username,resource) { |
|
|
|
function openConversationModal(username, resource) { |
|
|
|
openModal({ |
|
|
|
openModal({ |
|
|
|
classAdd: 'conversation-modal', |
|
|
|
classAdd: 'conversation-modal', |
|
|
|
content: newConversationModal(username, resource), |
|
|
|
content: newConversationModal(username, resource), |
|
|
@ -1693,7 +1734,7 @@ function initInterfaceCommon() { |
|
|
|
|
|
|
|
|
|
|
|
$('#hashtag-modal-template .postboard-news').on('click', function () { |
|
|
|
$('#hashtag-modal-template .postboard-news').on('click', function () { |
|
|
|
$(this).hide(); |
|
|
|
$(this).hide(); |
|
|
|
displayHashtagPending($('.hashtag-modal .postboard-posts')); |
|
|
|
displayQueryPending($('.hashtag-modal .postboard-posts')); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
replaceDashboards(); |
|
|
|
replaceDashboards(); |
|
|
|