Donmai

[Userscript] Twitter Image Searches and Stuff (UNSUPPORTED)

Posted under General

Twitter Image Searches and Stuff (TISAS) searches Danbooru database for tweet IDs, adds image search links, and highlights images based on Tweet favorites.

It is based off the idea of the popular userscript Pixiv Image Searches and Stuff (PISAS, About:Userscripts).

Installation

Project page
Main script

https://raw.githubusercontent.com/BrokenEagle/JavaScripts/stable/Twitter_Image_Searches_and_Stuff.user.js

Updates

This script was transferred from the Beta release published on Discord.

https://gist.github.com/BrokenEagle/dd9445d7e83d136716bb742228e50259

@fredgido helped Beta it and provided multiple suggestions and feedback.

NOTE: The database scheme was altered from the beta to the production, and is now stored in a different location. To transfer the database, export the database using the beta (1.0-1.13), and then import it using the production (2.0+).

Screenshots
Usage notes
Show
Side menu

There is a side menu available on most pages which has various status information and controls.

  • Database version: Will contain the database version #, or a link to Upgrade/Install the database.
  • Current records: How far behind the database records are from what is on Danbooru.
    • Clicking the link will manually update the database until it is current.
  • Total records: The current number of records.
  • Artist highlights: Disables Tweet fading/hiding when Tweet highlighting is used (see Artist highlights below).
    • The setting only affects the current Twitter account.
  • Autoclick IQDB: Enables auto-clicking in applicable views (see Autoclick IQDB below).
    • The setting only affects the current Twitter account.
  • Tweet indicators: Hides Tweet indicator controls.
    • This setting is global across Twitter.
Installation

When first installed, the script will make a network query getting the latest database information, and then refresh the page. At this point, there should be a link in the side menu "Install Database". Clicking this will download and install the database. This can take several minutes, and moving the focus away from the page will halt the process.

Settings

All available configurable settings are present in the settings menu. The settings menu can be opened by clicking the Settings button in the side menu. Settings can either be saved or reset by clicking one of the two buttons at the bottom of the menu.

There are also controls in the settings menu which allow the exporting and importing of TISAS information. This allows for the information setup in one browser/computer to be transferred to another browser/computer.

Hotkeys
  • Alt+M: Open settings menu
  • Alt+C: Close settings menu
  • Alt+S: Save menu settings
  • Alt+R: Reset menu settings
  • Alt+H: Enable/Disable Tweet fading/hiding
  • Alt+I: Show/Hide Tweet indicator controls
  • Alt+Q: Enable/Disable Auto IQDB clicking
  • Alt+-: Decrease fade level
  • Alt+=: Increase fade level
  • Alt+[: Decrease hide level
  • Alt+]: Increase hide level
Tweet image controls

Depending on whether the Tweet is found in the database or not, TISAS will present various different links.

  • no source - Nothing was found in the database.
    • Left clicking will allow manual adding of Danbooru post IDs.
  • post # - One post was found matching in the Tweet Database for that Tweet.
    • Left clicking will allow the database information for that Tweet to be deleted.
    • Right clicking will open the post show page for the found post.
  • # sources - More than one post was found matching in the Tweet Database for that Tweet.
    • Left clicking will allow the database information for that Tweet to be deleted.
    • Right clicking will open the post list page showing all found posts.
  • Check URL - Left click to query Danbooru for that Tweet's URL.
    • Matches are automatically added to the Tweet Database.
  • Check IQDB - Left click to query Danbooru's IQDB with that Tweet's images.
    • Matches are not automatically added to the Tweet Database, and must be confirmed by the user.
    • Links are colored according to their IQDB score.
      • 95-100: Green
      • 90-95: Blue
      • 85-90: Orange
      • 80-85: Red
    • Advanced tooltips are available to show the differences between Twitter and Danbooru side-by-side to help make the above determination.
    • A green border will be added to a Danbooru thumbnail if it is a filesize match to the image on Twitter.
Artist highlights

Tweets are compared against other nearby Tweets based on their favorite count. A quartile system is used to assign tweets to various categories. Tweets are given a colored border based upon the category.

  • Excellent - red border. ((Q3 + Max) / 2) -> Max
  • Good - orange border. Q3 -> ((Q3 + Max) / 2)
  • Above average - green border. Q2 -> Q3
  • Fair - blue border. Q1 -> Q2
  • Below average - purple border. ((Q1 + Min) / 2) -> Q1
  • Poor - black border. Min -> ((Q1 + Min) / 2)

Additionally, categories can either be faded or hidden. The factory settings are below average and poor are faded, and poor is hidden. The fade/hide level can also be dynamically increased/decreased by clicking the links in the side menu or using the provided hotkeys.

Artist highlights are enabled by default. They are only visible from the Media timeline or from the Search timeline when the from: and filter:images metatags are used.

Download original

When enabled, all images from a Tweet can be downloaded with the original size and using a customizable filename format. Each link is numbered according to the order on Twitter, i.e. top -> bottom, left -> right. If there is more than one image, an "All images" download link will be presented.

Autoclick IQDB

This setting must be enabled in the main settings menu, and also in the side menu for each desired artist. It currently functions only in the Tweet view, the Media timeline for an artist, and the Search timeline when the from: and filter:images metatags are used.

Tweet indicators

Individual Tweets or all Tweets from an artist can be permanently or temporarily marked, and will continue to display even if the controls are hidden

  • Mark
    • Will permanently mark tweets/artist.
  • Count
    • Will temporarily mark tweets/artist.
    • Has a counter showing how many of each have been counted.
    • All page transitions reset the counter, except for to/from a Tweet.

Tweet indicators are disabled by default. They are visible from every page.

Tweet statistics

Shown beneath the side menu. Displays the average number of replies, retweets, and favorites for every timeline. Clicking one of the headers in the first two rows will narrow the search results by those categories. Clicking "Total" will reset it back to showing all.

Final

Any suggestions or feedback is appreciated.

Latest edits

  • (2020-06-21)
    • Script is no longer being supported
    • Because Twitter is lo longer supporting the old layout at all

Versions

Show
  • (2019-03-05)
    • Version 2 - Initial production release
  • (2019-03-13)
    • Version 3
      • Added auto-IQDB function
      • Added ability to manually catch up the database
  • (2019-03-20)
    • Added more screenshots
    • Version 4
      • Advanced tooltips on regular postlinks
      • Dynamic changes to fade/hide levels for artist highlights
  • (2019-04-19)
    • Added another screenshot
    • Version 5
      • Broadcast changes on one tab to other tabs
      • Rerender page elements after settings change
      • Calculate and display average Tweet/Retweet data
      • Side menu layout change
      • Several function additions
  • (2019-05-05)
    • Version 6
      • Added support for videos
  • (2019-08-29)
    • Version 7
      • Confirmation dialog on IQDB search
      • User setting for tweet stats display
      • Hide controls for disabled settings
      • Renamed "Database settings" to "Query settings"
      • Optimized display of Twitter thumbnails

Updated

Minor versions
  • (2019-03-05)
    • 2.1
      • Fixed post info not loading onto tooltips in some cases
  • (2019-03-06)
    • 2.2
      • Fixed fade/hide stylings not being removed correctly sometimes
  • (2019-03-07)
    • 2.3
      • Fixed Tweet menu from being rendered on videos
    • 2.4
      • Added help links to Tweet menu
      • Rerenders the Tweet menu on match/deletion
      • Consistent left click behaviors
      • Don't render advanced tooltips when autosave IQDB is enabled

Updated

Pushed Version 3 which adds an auto-click function to "Check IQDB" and also a function to manually catch the database up to current.

Since the auto-click can be network intensive, it has been restricted in several ways:

  • Must be enabled in the settings menu
  • Must be enabled in the side menu (for each artist)
    • This was done because some artists upload a lot of garbage
  • Only available in certain views
    • Individual tweet view
    • Artist media timeline
    • Search timeline when the from: and filter:images metatags are used
  • IQDB misses are stored for a day
    • Misses can be manually reset

The function to manually have the database caught up can be accessed by clicking the "Current records" link in the side menu. If it is "Up to date", then clicking will do nothing.

Minor versions
  • (2019-03-15)
    • 3.1
      • Added age to post tooltips
  • (2019-03-16)
    • 3.2
      • Added Upload link to Danbooru on image popups
  • (2019-03-17)
    • 3.3
      • Started migration from using account names to user IDs
        • This is because the account name can change, but the user ID cannot
      • Optimized several UI controls so there's little delay in changing the display
  • (2019-03-18)
    • 3.4
      • Fixed bug with media navigation link
      • Added a more aggressive transition to user IDs

Updated

Pushed Version 4 which primarily adds advanced tooltips to all postlinks, whereas before it was just IQDB matches. Additionally, the new advanced tooltips for both IQDB and regular postlinks have selectable thumbnails. On IQDB postlinks, selecting a thumbnails removes that post as an IQDB match from consideration. On regular postlinks, selecting a thumbnails sets up that post as a candidate for deletions. Still though, to complete the action, the postlink must be clicked and the postlist it presents must be confirmed.

Besides the tooltips, the fade/hide scheme for artist highlights was revised. Each level is no longer individually selectable. Instead the level selected represents the default cutoff (inclusive) for what levels will be faded/hidden. The "excellent" level is not an option, and the "poor" level is the bare minimum.

The above change allows the current fade/hide levels to be changed dynamically on the page. This can be done by other clicking the supplied links, or using the provided hotkeys. The current level for both stylings are shown in the side menu.

TypeDecreaseIncrease
FadeAlt + -Alt + =
HideAlt + [Alt + ]

Note: Artist highlights are still only available on the media timeline, and on the search timeline when the from: and filter:images metatags are used.

Minor versions
  • (2019-03-20)
    • 4.1
      • Fixed bug where Tweet indicator controls weren't being hidden on the Tweet view when disabled
  • (2019-04-02)
    • 4.2
      • Fixed user ID not being normalized to string
        • Caused the settings to not be saved for no highlights and auto IQDB
      • Prevent duplicate Tweet IDs from being saved
  • (2019-04-16)
    • 4.3
      • Fixed score highlighting not working with low window sizes

Updated

Pushed Version 5 which has several new additions.

  • Inter-tab communication:
    • Changes on one tab get reflected in other tabs.
  • Instant settings changes:
    • Beforehand most changes in the main menu required a page refresh.
  • Increased side-menu functionality:
    • Set record position to latest. This will skip change records.
    • Manually query the current record count.
  • Altered side-menu layout:
    • Items now line up better.
    • Help text has been segregated into "?" hover/click links.
  • Additional hotkeys:
    • Alt+S to save main menu settings.
    • Alt+R for factory reset.
  • Reset control for lists:
    • In the main menu.
    • Factory Reset does not do this.
  • Original image information:
    • Size/dimension on upload links.
  • Tweet statistics:
    • Available on every timeline.
    • Can be filtered by retweet, or tweet type (image, video, text).
  • More feedback messages
Minor versions
  • (2019-04-22)
    • 5.1
      • Added more feedback to help with installation <fredgido: Discord>
      • Removed dependency on fonts with the -/+ icons in the side menu
      • Use page refresh for database install/upgrades instead
      • Fix initialization of current records timestamp and broadcast to other tabs
      • Fixed HTML escaping function
      • Rework purge of bad tweets
  • (2019-04-23)
    • 5.2
      • Updated to latest version of library
      • Reduced code size by ~10%
  • (2019-04-24)
    • 5.3
      • Refactored code to separate text from functions

Updated

Pushed Version 6 that primarily adds support for Twitter videos, which work pretty much the same as image tweets. For the download links (when enabled), it presents an image link for the thumbnail image and the video link for the highest quality video version available.

Minor versions
  • (2019-04-22)
    • 6.1
      • Fixed age string for low intervals
      • Add use of "only" parameter
        • Should on average make network requests faster
    • 6.2 - Fixed bug with re-rendering after settings change
  • (2019-05-14)
    • 6.3 - Fixed upgrade message

Updated

Pushed Version 7 which has a few new additions.

  • Confirmation dialog on IQDB search
    • Activates only on multi-image tweets
    • Does not activate when auto-clicked
    • Can be turned off with a user setting
  • User setting for tweet stats display
    • Disabling it hides that table
  • Hide controls for disabled settings
    • Includes the following settings/controls:
      • "Score highlights enabled" -> "Artist highlight controls"
        • "Artist highlights enabled" -> "Fade level controls"
        • "Artist highlights enabled" -> "Hide level controls"
      • "Autoclick IQDB enabled" -> "Autoclick IQDB controls"
      • "Tweet indicators enabled -> "Tweet indicator controls"
  • Renamed "Database settings" to "Query settings"
  • Optimized display of Twitter thumbnails
1