From aee758b5598f2bd787ec271c01ca0dce35c8abc4 Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Fri, 29 Sep 2017 12:47:13 +0200
Subject: [PATCH] Update reply-account docs & fix error with temporary columns
 and advanced selector

---
 Resources/Plugins/reply-account/.meta         |  4 ++--
 Resources/Plugins/reply-account/browser.js    |  4 ++--
 .../reply-account/configuration.default.js    | 24 ++++++++++++-------
 3 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/Resources/Plugins/reply-account/.meta b/Resources/Plugins/reply-account/.meta
index 97d5a9fe..aec8ecfb 100644
--- a/Resources/Plugins/reply-account/.meta
+++ b/Resources/Plugins/reply-account/.meta
@@ -8,7 +8,7 @@ Custom reply account
 chylex
 
 [version]
-1.2.2
+1.2.3
 
 [website]
 https://tweetduck.chylex.com
@@ -20,4 +20,4 @@ configuration.js
 configuration.default.js
 
 [requires]
-1.3.3
\ No newline at end of file
+1.8
\ No newline at end of file
diff --git a/Resources/Plugins/reply-account/browser.js b/Resources/Plugins/reply-account/browser.js
index c0cc77db..009d231a 100644
--- a/Resources/Plugins/reply-account/browser.js
+++ b/Resources/Plugins/reply-account/browser.js
@@ -17,7 +17,7 @@ enabled(){
           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 header = $(".column-title", section);
@@ -35,7 +35,7 @@ enabled(){
         }
         
         try{
-          query = configuration.customSelector(column.getColumnType(), columnTitle, columnAccount, column);
+          query = configuration.customSelector(column.getColumnType(), columnTitle, columnAccount, column, section.hasClass("column-temp"));
         }catch(e){
           $TD.alert("warning", "Plugin reply-account has invalid configuration: customSelector threw an error: "+e.message);
           return;
diff --git a/Resources/Plugins/reply-account/configuration.default.js b/Resources/Plugins/reply-account/configuration.default.js
index 8a6c67d4..44d697f3 100644
--- a/Resources/Plugins/reply-account/configuration.default.js
+++ b/Resources/Plugins/reply-account/configuration.default.js
@@ -21,11 +21,14 @@
    * This assumes a basic knowledge of JavaScript and jQuery.
    *
    * 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'.
    * 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
    * 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').
    *
    *
-   * The 'column' parameter is a TweetDeck column object. If you want to see all properties of the object,
-   * run the following code in your browser console, which will return an array containing all of your
-   * current column objects in order:
+   * The 'column' parameter is a TweetDeck column object. If you want to see the object structure,
+   * run the following code in the console for an array containing all of your column objects:
    *   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,
   
-  /*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"){
       // This is a search column that looks for 'TweetDuck' in the tweets,
       // 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";
     }
     else if (type === "col_timeline" && 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";
     }
     
     // otherwise returns 'undefined' which falls back to 'defaultAccount' behavior
-  }*/
+  }
 }
\ No newline at end of file