mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-01-13 16:37:52 +00:00
rewrite newRtMsg()
This commit is contained in:
parent
2d1d966203
commit
d0ed95a665
@ -2460,9 +2460,10 @@ function postSubmit(e, oldLastPostId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (btnPostSubmit.hasClass('with-reference')) {
|
if (btnPostSubmit.hasClass('with-reference')) {
|
||||||
var doSubmitPost = function (postText, postData) {
|
var doSubmitPost = function (postText, postDataElem) {
|
||||||
newRtMsg(postData, postText);
|
newRtMsg($.evalJSON(postDataElem.attr('data-content_to_rt')),
|
||||||
}
|
postDataElem.attr('data-content_to_sigrt'), postText);
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
if (splitedPostsCount > 1) {
|
if (splitedPostsCount > 1) {
|
||||||
if (textArea.length < splitedPostsCount) {
|
if (textArea.length < splitedPostsCount) {
|
||||||
@ -2564,8 +2565,11 @@ function retweetSubmit(event) {
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
var prompt = $(event.target).closest('.prompt-wrapper');
|
var prompt = $(event.target).closest('.prompt-wrapper');
|
||||||
|
var postDataElem = prompt.find('.post-data');
|
||||||
|
|
||||||
|
newRtMsg($.evalJSON(postDataElem.attr('data-content_to_rt')),
|
||||||
|
postDataElem.attr('data-content_to_sigrt'));
|
||||||
|
|
||||||
newRtMsg(prompt.find('.post-data'));
|
|
||||||
closePrompt(prompt);
|
closePrompt(prompt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,15 +283,37 @@ function newPostMsg(msg, reply_n, reply_k, cbFunc, cbReq) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function newRtMsg(postData, msg) {
|
function newRtMsg(userpost, sig_userpost, comment, cbFunc, cbReq) {
|
||||||
var userpost = $.evalJSON(postData.attr('data-content_to_rt'));
|
if (typeof lastPostId === 'undefined') {
|
||||||
var sig_userpost;
|
alertPopup({
|
||||||
|
//txtTitle: polyglot.t(''), add some title (not 'error', please) or just KISS
|
||||||
|
txtMessage: 'Can\'t handle the retwisting of a twist —\n'
|
||||||
|
+ polyglot.t('Internal error: lastPostId unknown (following yourself may fix!)')
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (typeof _sendedPostIDs !== 'object') {
|
||||||
|
alertPopup({
|
||||||
|
//txtTitle: polyglot.t(''), add some title (not 'error', please) or just KISS
|
||||||
|
txtMessage: 'Can\'t handle the retwisting of a twist —\n'
|
||||||
|
+ polyglot.t('this is undefined', {'this': '_sendedPostIDs'})
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof userpost !== 'object') {
|
||||||
|
alertPopup({
|
||||||
|
//txtTitle: polyglot.t(''), add some title (not 'error', please) or just KISS
|
||||||
|
txtMessage: 'Can\'t handle the retwisting of a twist —\n'
|
||||||
|
+ polyglot.t('this is undefined', {'this': 'userpost'})
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (userpost.rt) {
|
if (userpost.rt) {
|
||||||
if (parseInt(twisterVersion) <= 93000) {
|
if (parseInt(twisterVersion) <= 93000) {
|
||||||
alertPopup({
|
alertPopup({
|
||||||
//txtTitle: polyglot.t(''), add some title (not 'error', please) or just KISS
|
//txtTitle: polyglot.t(''), add some title (not 'error', please) or just KISS
|
||||||
txtMessage: 'Can\'t handle retwisting of commented retwisted twists —\n'
|
txtMessage: 'Can\'t handle the retwisting of commented retwisted twists —\n'
|
||||||
+ polyglot.t('daemon_is_obsolete', {versionReq: '0.9.3+'})
|
+ polyglot.t('daemon_is_obsolete', {versionReq: '0.9.3+'})
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -302,14 +324,11 @@ function newRtMsg(postData, msg) {
|
|||||||
userpost.rt = undefined;
|
userpost.rt = undefined;
|
||||||
userpost.sig_rt = undefined;
|
userpost.sig_rt = undefined;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
sig_userpost = postData.attr('data-content_to_sigrt');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sig_userpost) {
|
if (!sig_userpost) {
|
||||||
alertPopup({
|
alertPopup({
|
||||||
//txtTitle: polyglot.t(''), add some title (not 'error', please) or just KISS
|
//txtTitle: polyglot.t(''), add some title (not 'error', please) or just KISS
|
||||||
txtMessage: 'Can\'t handle retwisting of a twist —\n'
|
txtMessage: 'Can\'t handle the retwisting of a twist —\n'
|
||||||
+ polyglot.t('this is undefined', {'this': 'sig_userpost'})
|
+ polyglot.t('this is undefined', {'this': 'sig_userpost'})
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@ -317,26 +336,27 @@ function newRtMsg(postData, msg) {
|
|||||||
|
|
||||||
userpost.sig_wort = undefined;
|
userpost.sig_wort = undefined;
|
||||||
|
|
||||||
var rtObj = {sig_userpost: sig_userpost, userpost: userpost};
|
|
||||||
|
|
||||||
if (typeof lastPostId !== 'undefined') {
|
|
||||||
if (typeof _sendedPostIDs !== 'undefined')
|
|
||||||
_sendedPostIDs.push(lastPostId + 1);
|
_sendedPostIDs.push(lastPostId + 1);
|
||||||
|
|
||||||
var params = [defaultScreenName, lastPostId + 1, rtObj];
|
var req = [defaultScreenName, lastPostId + 1,
|
||||||
|
{sig_userpost: sig_userpost, userpost: userpost}];
|
||||||
|
if (typeof comment !== 'undefined')
|
||||||
|
req.push(comment);
|
||||||
|
|
||||||
if (typeof msg !== 'undefined')
|
twisterRpc('newrtmsg', req,
|
||||||
params.push(msg);
|
function(req, ret) {
|
||||||
|
incLastPostId();
|
||||||
twisterRpc('newrtmsg', params,
|
if (typeof req.cbFunc === 'function')
|
||||||
function(arg, ret) {incLastPostId();}, null,
|
req.cbFunc(req.cbReq, ret);
|
||||||
function(arg, ret) {var msg = ('message' in ret) ? ret.message : ret;
|
}, {cbFunc: cbFunc, cbReq: cbReq},
|
||||||
alert(polyglot.t('ajax_error', {error: msg}));
|
function(req, ret) {
|
||||||
}, null
|
alertPopup({
|
||||||
);
|
//txtTitle: polyglot.t(''), add some title (not 'error', please) or just KISS
|
||||||
} else {
|
txtMessage: 'Can\'t handle the retwisting of a twist —\n'
|
||||||
alert(polyglot.t('Internal error: lastPostId unknown (following yourself may fix!)'));
|
+ polyglot.t('ajax_error', {error: (ret.message) ? ret.message : ret})
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function newFavMsg(postData, priv, msg) {
|
function newFavMsg(postData, priv, msg) {
|
||||||
|
Loading…
Reference in New Issue
Block a user