mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-29 03:15:51 +02:00
Implement #last in reply-account and fix bugs in its code
This commit is contained in:
parent
6636a2aa9e
commit
e6f199a224
Resources/Plugins/reply-account
@ -3,7 +3,9 @@ enabled(){
|
|||||||
|
|
||||||
window.TDPF_loadConfigurationFile(this, "configuration.js", "configuration.default.js", obj => configuration = obj);
|
window.TDPF_loadConfigurationFile(this, "configuration.js", "configuration.default.js", obj => configuration = obj);
|
||||||
|
|
||||||
this.uiInlineComposeTweetEvent = function(e, data){
|
this.lastSelectedAccount = null;
|
||||||
|
|
||||||
|
this.uiInlineComposeTweetEvent = (e, data) => {
|
||||||
var query;
|
var query;
|
||||||
|
|
||||||
if (configuration.useAdvancedSelector){
|
if (configuration.useAdvancedSelector){
|
||||||
@ -38,7 +40,7 @@ enabled(){
|
|||||||
$TD.alert("warning", "Plugin reply-account has invalid configuration: the requested account is empty");
|
$TD.alert("warning", "Plugin reply-account has invalid configuration: the requested account is empty");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (query[0] !== '@' && query[0] !== '&'){
|
else if (query[0] !== '@' && query[0] !== '#'){
|
||||||
$TD.alert("warning", "Plugin reply-account has invalid configuration: the requested account does not begin with @ or #: "+query);
|
$TD.alert("warning", "Plugin reply-account has invalid configuration: the requested account does not begin with @ or #: "+query);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -51,7 +53,11 @@ enabled(){
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "#last":
|
case "#last":
|
||||||
// TODO
|
if (this.lastSelectedAccount === null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
identifier = this.lastSelectedAccount;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "#default":
|
case "#default":
|
||||||
@ -77,6 +83,11 @@ enabled(){
|
|||||||
|
|
||||||
data.singleFrom = data.from = [ identifier ];
|
data.singleFrom = data.from = [ identifier ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.onSelectedAccountChanged = () => {
|
||||||
|
var selected = $(".js-account-item.is-selected", ".js-account-list");
|
||||||
|
this.lastSelectedAccount = selected.length === 1 ? selected.attr("data-account-key") : null;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ready(){
|
ready(){
|
||||||
@ -95,8 +106,11 @@ ready(){
|
|||||||
else{
|
else{
|
||||||
$(document).on("uiInlineComposeTweet", this.uiInlineComposeTweetEvent);
|
$(document).on("uiInlineComposeTweet", this.uiInlineComposeTweetEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(document).on("click", ".js-account-list .js-account-item", this.onSelectedAccountChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
disabled(){
|
disabled(){
|
||||||
$(document).off("uiInlineComposeTweet", this.uiInlineComposeTweetEvent);
|
$(document).off("uiInlineComposeTweet", this.uiInlineComposeTweetEvent);
|
||||||
|
$(document).off("click", ".js-account-list .js-account-item", this.onSelectedAccountChanged);
|
||||||
}
|
}
|
@ -14,7 +14,7 @@
|
|||||||
* Set value of 'defaultAccount' to one of the following values:
|
* Set value of 'defaultAccount' to one of the following values:
|
||||||
*
|
*
|
||||||
* "#preferred" to use your preferred TweetDeck account (the one used to log into TweetDeck)
|
* "#preferred" to use your preferred TweetDeck account (the one used to log into TweetDeck)
|
||||||
* "#last" to specify the account that was selected last time
|
* "#last" to specify the account that was selected last time (only updates if a single account is selected)
|
||||||
* "#default" to fall back to default TweetDeck behavior; useful for advanced configuration below, otherwise disable the plugin instead
|
* "#default" to fall back to default TweetDeck behavior; useful for advanced configuration below, otherwise disable the plugin instead
|
||||||
* "@myAccount" to specify an account name to use; has to be one of your registered account names
|
* "@myAccount" to specify an account name to use; has to be one of your registered account names
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user