Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Plugins꞉ 4. Remote functions

Daniel Chýlek edited this page Aug 18, 2018 · 3 revisions

Some additional functionality is exposed by a global $TD object, which is similar to the plugin Bridge object but does not require the plugin's token.

Keep in mind that these are much more prone to change or removal. There are also several undocumented methods which should not be used by plugins.

Methods

None of these methods should throw exceptions unless the required parameters are null.

Signature promise<void> $TD.onTweetPopup(columnId, chirpId, columnName, tweetHtml, characterAmount, tweetUrl, quoteUrl)
Available browser.js notification.js
Since 1.9

Displays a desktop notification containing the provided HTML. If notifications are muted, it will be added to a queue and displayed once unmuted.

Also triggers a tray highlight and notification analytics events, if the user has enabled these.

Parameters

See code.js for an example of obtaining some of the parameters.

  • columnId, chirpId - used to find the chirp when the View detail context menu item is used (when either parameter is empty, the item is hidden)
  • columnName - displayed in the window title if Display Column Name is enabled
  • tweetHtml - the body of the tweet
  • characterAmount - determines how long the notification is displayed for
  • tweetUrl, quoteUrl - used for the Copy tweet/quoted tweet address context menu items (caution: if tweetUrl is empty, then neither items will be shown even if quoteUrl is not empty)

Signature promise<void> $TD.onTweetSound()
Available browser.js notification.js
Since 1.12.2

Triggers tray highlight and sound notification analytics events.

In older versions, this function used to also play the custom notification sound, however it no longer does that. To play the notification sound too, call document.getElementById("update-sound").play() right before or after this function. Note that calling play() will only work if notifications aren't muted.


Signature promise<void> $TD.displayTooltip(text)
Available browser.js notification.js
Since 1.12.1

Displays a tooltip under the cursor in the current window. If you want the tooltip to follow the cursor, call this method in a mousemove event.

Parameters

  • text - sets the text to display, or hides the current tooltip when empty or null

Signature promise<void> $TD.openBrowser(url)
Available browser.js notification.js
Since 0.9.1

Opens the specified URL in the external browser.

Parameters

  • url - only valid HTTP, HTTPS, FTP, and MAILTO URLs are accepted, otherwise the user sees a Blocked URL warning message

Signature promise<int> $TD.getIdleSeconds()
Available browser.js notification.js
Since 1.7.5

Returns the amount of seconds since Windows received the last mouse/keyboard input. If you need to check this periodically, use window.setInterval with a 1 second timer.


Signature promise<void> $TD.alert(type, contents)
Available browser.js notification.js
Since 1.3.3

Displays a message box with an OK button, similar to alert but will not block the browser.

Parameters

  • type - one of error, warning, info, or an empty string for no icon
  • contents - message contents

Signature promise<void> $TD.loadNextNotification()
Available notification.js
Since 1.4.1

Skips the currently displayed tweet in the desktop notification. Hides the window if there are more tweets in the queue.


Signature promise<void> $TD.showTweetDetail()
Available notification.js
Since 1.12.1

Opens the tweet, that is currently displayed in the desktop notification, inside its source column.

Properties

There is also a $TDX object, which has several properties. These should only be read and not written to, as they are automatically updated by the app at runtime. Some of these properties are only available in either the browser or the notification window.

  • $TDX.expandLinksOnHover 1.5.3 Browser & Notification
    • Whether to expand (true) or show tooltip (false) when hovering over links
  • $TDX.openSearchInFirstColumn 1.9.2 Browser
    • Whether to add Search columns before the first column, instead of adding them after the last column
  • $TDX.keepLikeFollowDialogsOpen 1.12.1 Browser
    • Whether the Like/Follow dialogs should stay open instead of automatically closing after taking an action
  • $TDX.muteNotifications 1.5.3 Browser
    • Whether desktop notifications are muted
  • $TDX.notificationMediaPreviews 1.8.4 Browser
    • Whether notifications should include image or video thumbnails
  • $TDX.translationTarget 1.12 Browser
    • Target tweet language for Bing translator
  • $TDX.skipOnLinkClick 1.7.2 Notification
    • Whether to skip current notification when a link inside it is clicked