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

Fix issues caused by recent TweetDeck update (notifications, column styles, reply account)

Closes 
This commit is contained in:
chylex 2018-04-14 19:40:51 +02:00
parent d1db3aa673
commit 2c2f860f26
5 changed files with 39 additions and 16 deletions
Resources

View File

@ -8,7 +8,7 @@ Custom reply account
chylex chylex
[version] [version]
1.2.4 1.3
[website] [website]
https://tweetduck.chylex.com https://tweetduck.chylex.com

View File

@ -12,10 +12,16 @@ enabled(){
if (configuration.useAdvancedSelector){ if (configuration.useAdvancedSelector){
if (configuration.customSelector){ if (configuration.customSelector){
if (configuration.customSelector.toString().startsWith("function (column){")){ let customSelectorDef = configuration.customSelector.toString();
if (customSelectorDef.startsWith("function (column){")){
$TD.alert("warning", "Plugin reply-account has invalid configuration: customSelector needs to be updated due to TweetDeck changes, please read the default configuration file for the updated guide"); $TD.alert("warning", "Plugin reply-account has invalid configuration: customSelector needs to be updated due to TweetDeck changes, please read the default configuration file for the updated guide");
return; return;
} }
else if (customSelectorDef.startsWith("function (type,")){
$TD.alert("warning", "Plugin reply-account has invalid configuration: the type parameter is no longer present due to TweetDeck changes, please read the default configuration file for the updated guide");
return;
}
var section = data.element.closest("section.js-column"); var section = data.element.closest("section.js-column");
@ -35,7 +41,7 @@ enabled(){
} }
try{ try{
query = configuration.customSelector(column.getColumnType(), columnTitle, columnAccount, column, section.hasClass("column-temp")); query = configuration.customSelector(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

@ -30,14 +30,19 @@
* https://tweetduck.chylex.com/guide/#dev-tools * 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 * In order to check the column type, use the 'column.isOfType' function. It is recommended to always put it
* unused and have misleading names (for example, Home columns are 'col_timeline' instead of 'col_home'): * last in an 'if' statement, because it is much more demanding than checking the title/account.
* col_timeline, col_interactions, col_mentions, col_followers, col_search, col_list, *
* col_customtimeline, col_messages, col_usertweets, col_favorites, col_activity, * Here is the full list of column types, note that some are unused and have misleading names.
* col_dataminr, col_home, col_me, col_inbox, col_scheduled, col_unknown * (for example, Home columns are 'col_timeline' instead of 'col_home')
*
* col_activity, col_customtimeline, col_dataminr, col_favorites, col_followers, col_home,
* col_inbox, col_interactions, col_list, col_livevideo, col_me, col_mentions,
* col_messages, col_scheduled, col_search, col_timeline, col_usertweets, col_unknown
* *
* If you want to see your current column types, run this in your browser console: * If you want to see your current column types, run this in your browser console:
* TD.controller.columnManager.getAllOrdered().map(obj => obj.getColumnType()); *
* (c=>c.columnManager.getAllOrdered().map(o=>Object.keys(c.stats.columnNamespaces).find(t=>o.isOfType(t))).map(t=>t==""+void 0?"col_unknown":t))(TD.controller)
* *
* *
* The 'title' parameter is the column title. Some are fixed (such as 'Home' or 'Notifications'), * The 'title' parameter is the column title. Some are fixed (such as 'Home' or 'Notifications'),
@ -61,16 +66,16 @@
useAdvancedSelector: false, useAdvancedSelector: false,
customSelector: function(type, title, account, column, isTemporary){ customSelector: function(title, account, column, isTemporary){
console.info(arguments); // Prints all arguments into the console console.info(arguments); // Prints all arguments into the console
if (type === "col_search" && title === "TweetDuck"){ if (title === "TweetDuck" && column.isOfType("col_search")){
// 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 (account === "@chylexcz" && column.isOfType("col_timeline")){
// 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";

View File

@ -98,6 +98,13 @@
return value; return value;
}; };
//
// Function: Retrieves column name
const getColumnName = function(column){
let cached = column._tduck_type || (column._tduck_type = Object.keys(columnTypes).find(type => column.isOfType(type)));
return columnTypes[cached] || "";
};
// //
// Function: Event callback for a new tweet. // Function: Event callback for a new tweet.
// //
@ -220,7 +227,7 @@
let tweetUrl = source ? source.getChirpURL() : ""; let tweetUrl = source ? source.getChirpURL() : "";
let quoteUrl = source && source.quotedTweet ? source.quotedTweet.getChirpURL() : ""; let quoteUrl = source && source.quotedTweet ? source.quotedTweet.getChirpURL() : "";
$TD.onTweetPopup(column.model.privateState.apiid, chirpId, columnTypes[column.getColumnType()] || "", html.html(), duration, tweetUrl, quoteUrl); $TD.onTweetPopup(column.model.privateState.apiid, chirpId, getColumnName(column), html.html(), duration, tweetUrl, quoteUrl);
} }
if (column.model.getHasSound()){ if (column.model.getHasSound()){
@ -1310,6 +1317,11 @@
}; };
} }
//
// Block: Fix columns missing any identifiable attributes to allow individual styles.
//
TD.mustaches["column.mustache"] = TD.mustaches["column.mustache"].replace("{{columnclass}}\"", "{{columnclass}}\" data-td-icon=\"{{columniconclass}}\"");
// //
// Block: Remove column mouse wheel handler, which allows smooth scrolling inside columns, and horizontally scrolling column container when holding Shift. // Block: Remove column mouse wheel handler, which allows smooth scrolling inside columns, and horizontally scrolling column container when holding Shift.
// //

View File

@ -361,18 +361,18 @@ html[data-td-font='smallest'] .tweet-detail-wrapper .badge-verified:before {
/* Fix cut off usernames in Messages column */ /* Fix cut off usernames in Messages column */
/********************************************/ /********************************************/
.column-type-message.is-shifted-1 .column-title-container { [data-td-icon="icon-message"].is-shifted-1 .column-title-container {
height: 100%; height: 100%;
border-bottom-color: transparent; border-bottom-color: transparent;
} }
#tduck .column-type-message.is-shifted-1 .column-title-items { #tduck [data-td-icon="icon-message"].is-shifted-1 .column-title-items {
height: 100%; height: 100%;
margin-left: 4px !important; margin-left: 4px !important;
padding-top: 1px; padding-top: 1px;
} }
.column-type-message.is-shifted-1 .username { [data-td-icon="icon-message"].is-shifted-1 .username {
vertical-align: bottom; vertical-align: bottom;
} }