mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-18 06:15:49 +02:00
Quick semi-temporary fix for removed column.isOfType
This commit is contained in:
parent
a63e210b88
commit
9250f1907c
Resources
@ -9,7 +9,7 @@ Clear columns
|
|||||||
chylex
|
chylex
|
||||||
|
|
||||||
[version]
|
[version]
|
||||||
1.2
|
1.2.1
|
||||||
|
|
||||||
[website]
|
[website]
|
||||||
https://tweetduck.chylex.com
|
https://tweetduck.chylex.com
|
||||||
|
@ -7,17 +7,12 @@ constructor(){
|
|||||||
enabled(){
|
enabled(){
|
||||||
// prepare variables and functions
|
// prepare variables and functions
|
||||||
var clearColumn = (columnName) => {
|
var clearColumn = (columnName) => {
|
||||||
let col = TD.controller.columnManager.get(columnName);
|
TD.controller.columnManager.get(columnName).clear();
|
||||||
return if !col.isClearable();
|
|
||||||
|
|
||||||
col.clear();
|
|
||||||
TD.controller.stats.columnActionClick("clear");
|
TD.controller.stats.columnActionClick("clear");
|
||||||
};
|
};
|
||||||
|
|
||||||
var resetColumn = (columnName) => {
|
var resetColumn = (columnName) => {
|
||||||
let col = TD.controller.columnManager.get(columnName);
|
let col = TD.controller.columnManager.get(columnName);
|
||||||
return if !col.isClearable();
|
|
||||||
|
|
||||||
col.model.setClearedTimestamp(0);
|
col.model.setClearedTimestamp(0);
|
||||||
col.reloadTweets();
|
col.reloadTweets();
|
||||||
};
|
};
|
||||||
|
@ -40,7 +40,7 @@ enabled(){
|
|||||||
columnAccount = "";
|
columnAccount = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{ // TODO isOfType is removed
|
||||||
query = configuration.customSelector(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);
|
||||||
|
@ -25,26 +25,23 @@
|
|||||||
const app = $(document.body).children(".js-app");
|
const app = $(document.body).children(".js-app");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constant: Column types mapped to their titles.
|
// Constant: Column icon classes mapped to their titles.
|
||||||
//
|
//
|
||||||
const columnTypes = {
|
const columnTitles = {
|
||||||
"col_home": "Home",
|
"icon-home": "Home",
|
||||||
"col_timeline" : "Home",
|
"icon-mention": "Mentions",
|
||||||
"col_mentions": "Mentions",
|
"icon-message": "Messages",
|
||||||
"col_me": "Mentions",
|
"icon-notifications": "Notifications",
|
||||||
"col_inbox": "Messages",
|
"icon-follow": "Followers",
|
||||||
"col_messages": "Messages",
|
"icon-activity": "Activity",
|
||||||
"col_interactions": "Notifications",
|
"icon-favorite": "Likes",
|
||||||
"col_followers": "Followers",
|
"icon-user": "User",
|
||||||
"col_activity": "Activity",
|
"icon-search": "Search",
|
||||||
"col_favorites": "Likes",
|
"icon-list": "List",
|
||||||
"col_usertweets": "User",
|
"icon-custom-timeline": "Timeline",
|
||||||
"col_search": "Search",
|
"icon-dataminr": "Dataminr",
|
||||||
"col_list": "List",
|
"icon-play-video": "Live video",
|
||||||
"col_customtimeline": "Timeline",
|
"icon-schedule": "Scheduled"
|
||||||
"col_dataminr": "Dataminr",
|
|
||||||
"col_livevideo": "Live video",
|
|
||||||
"col_scheduled": "Scheduled"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -99,10 +96,20 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Function: Retrieves column name
|
// Function: Attempts to retrieve the column icon class. Returns undefined on failure.
|
||||||
|
//
|
||||||
|
const getColumnIconClass = function(column){
|
||||||
|
if (ensurePropertyExists(column, "ui", "_$chirpContainer")){
|
||||||
|
return column.ui._$chirpContainer.closest(".js-column").attr("data-td-icon");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Function: Retrieves column name and caches it.
|
||||||
|
//
|
||||||
const getColumnName = function(column){
|
const getColumnName = function(column){
|
||||||
let cached = column._tduck_type || (column._tduck_type = Object.keys(columnTypes).find(type => column.isOfType(type)));
|
let cached = column._tduck_icon || (column._tduck_icon = getColumnIconClass(column));
|
||||||
return columnTypes[cached] || "";
|
return columnTitles[cached] || "";
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user