1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-29 20:34:04 +02:00

Update reply-account docs & fix error with temporary columns and advanced selector

This commit is contained in:
chylex 2017-09-29 12:47:13 +02:00
parent be060d0386
commit aee758b559
3 changed files with 20 additions and 12 deletions
Resources/Plugins/reply-account

View File

@ -8,7 +8,7 @@ Custom reply account
chylex chylex
[version] [version]
1.2.2 1.2.3
[website] [website]
https://tweetduck.chylex.com https://tweetduck.chylex.com
@ -20,4 +20,4 @@ configuration.js
configuration.default.js configuration.default.js
[requires] [requires]
1.3.3 1.8

View File

@ -17,7 +17,7 @@ enabled(){
return; return;
} }
var section = data.element.closest("section.column"); var section = data.element.closest("section.js-column");
var column = TD.controller.columnManager.get(section.attr("data-column")); var column = TD.controller.columnManager.get(section.attr("data-column"));
var header = $(".column-title", section); var header = $(".column-title", section);
@ -35,7 +35,7 @@ enabled(){
} }
try{ try{
query = configuration.customSelector(column.getColumnType(), columnTitle, columnAccount, column); query = configuration.customSelector(column.getColumnType(), columnTitle, columnAccount, column, section.hasClass("column-temp"));
}catch(e){ }catch(e){
$TD.alert("warning", "Plugin reply-account has invalid configuration: customSelector threw an error: "+e.message); $TD.alert("warning", "Plugin reply-account has invalid configuration: customSelector threw an error: "+e.message);
return; return;

View File

@ -21,11 +21,14 @@
* This assumes a basic knowledge of JavaScript and jQuery. * This assumes a basic knowledge of JavaScript and jQuery.
* *
* 1. Set value of 'useAdvancedSelector' to true * 1. Set value of 'useAdvancedSelector' to true
* 2. Uncomment the 'customSelector' function, and replace the example code with your desired behavior * 2. Replace the example code in 'customSelector' function with your desired behavior
* *
* The 'customSelector' function should return a string in one of the formats supported by 'defaultAccount'. * The 'customSelector' function should return a string in one of the formats supported by 'defaultAccount'.
* If it returns anything else (for example, false or undefined), it falls back to 'defaultAccount' behavior. * If it returns anything else (for example, false or undefined), it falls back to 'defaultAccount' behavior.
* *
* When writing a custom function, you can install Dev Tools to access the browser console:
* https://tweetduck.chylex.com/guide/#dev-tools
*
* *
* The 'type' parameter is TweetDeck column type. Here is the full list of column types, note that some are * The 'type' parameter is TweetDeck column type. Here is the full list of column types, note that some are
* unused and have misleading names (for example, Home columns are 'col_timeline' instead of 'col_home'): * unused and have misleading names (for example, Home columns are 'col_timeline' instead of 'col_home'):
@ -46,28 +49,33 @@
* contain other text (for example, the Scheduled column contains the string 'All accounts'). * contain other text (for example, the Scheduled column contains the string 'All accounts').
* *
* *
* The 'column' parameter is a TweetDeck column object. If you want to see all properties of the object, * The 'column' parameter is a TweetDeck column object. If you want to see the object structure,
* run the following code in your browser console, which will return an array containing all of your * run the following code in the console for an array containing all of your column objects:
* current column objects in order:
* TD.controller.columnManager.getAllOrdered() * TD.controller.columnManager.getAllOrdered()
* *
*
* The 'isTemporary' parameter is true if the column is not attached to the main column list,
* for example when clicking on a profile and viewing their tweets in a modal dialog.
*
*/ */
useAdvancedSelector: false, useAdvancedSelector: false,
/*customSelector: function(type, title, account, column){ customSelector: function(type, title, account, column, isTemporary){
console.info(arguments); // Prints all arguments into the console
if (type === "col_search" && title === "TweetDuck"){ if (type === "col_search" && title === "TweetDuck"){
// This is a search column that looks for 'TweetDuck' in the tweets, // This is a search column that looks for 'TweetDuck' in the tweets,
// search columns are normally linked to the preferred account // search columns are normally linked to the preferred account
// so this forces the @TryTweetDuck account to be used instead. // so this forces the @TryTweetDuck account to be used instead
return "@TryTweetDuck"; return "@TryTweetDuck";
} }
else if (type === "col_timeline" && account === "@chylexcz"){ else if (type === "col_timeline" && account === "@chylexcz"){
// This is a Home column of my test account @chylexcz, // This is a Home column of my test account @chylexcz,
// but I want to reply to tweets from my official account. // but I want to reply to tweets from my official account
return "@chylexmc"; return "@chylexmc";
} }
// otherwise returns 'undefined' which falls back to 'defaultAccount' behavior // otherwise returns 'undefined' which falls back to 'defaultAccount' behavior
}*/ }
} }