Skip to content

Instantly share code, notes, and snippets.

@twilight-sparkle-irl
Last active September 1, 2016 19:48
Show Gist options
  • Save twilight-sparkle-irl/674dcbfe108125f9ed2644167177ac43 to your computer and use it in GitHub Desktop.
Save twilight-sparkle-irl/674dcbfe108125f9ed2644167177ac43 to your computer and use it in GitHub Desktop.
Fix Twitter Cards in TweetDeck
// ==UserScript==
// @name Fix Twitter Cards in TweetDeck
// @namespace https://twitter.com/NO_BOOT_DEVICE/status/771432971739930624
// @description Fixes certain embeds for media like youtu.be not appearing
// @include https://tweetdeck.twitter.com/*
// @include http://tweetdeck.twitter.com/*
// ==/UserScript==
TD.services.TwitterMedia.YFROG_RE = /(?:(?:https?\:\/\/)?(?:www\.)?)?yfrog.com\/\w+/
TD.services.TwitterMedia.PLIXI_RE = /(?:(?:https?\:\/\/)?(?:www\.)?)?plixi.com\/p\/[0-9]+/
TD.services.TwitterMedia.LOCKERZ_RE = /(?:(?:https?\:\/\/)?(?:www\.)?)?lockerz.com\/s\/[0-9]+/
TD.services.TwitterMedia.YOUTUBE_LONG_RE = /(?:(?:https?\:\/\/)?(?:www\.)?)?youtube\.com\/watch[a-zA-Z0-9_\-\?\&\=\/]+/
TD.services.TwitterMedia.YOUTUBE_TINY_RE = /(?:(?:https?\:\/\/)?(?:www\.)?)?youtu\.be\/([a-zA-Z0-9_\-\?\&\=\/]+)/
TD.services.TwitterMedia.YOUTUBE_RE = new RegExp(TD.services.TwitterMedia.YOUTUBE_LONG_RE.source + "|" + TD.services.TwitterMedia.YOUTUBE_TINY_RE.source)
TD.services.TwitterMedia.YOUTUBE_STARTTIME = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s?)?$/
TD.services.TwitterMedia.VIMEO_RE = /(?:https?\:\/\/)?(www\.|player\.)?vimeo\.com\/(.+)/i
TD.services.TwitterMedia.VINE_RE = /(?:(?:https?\:\/\/)?(?:www\.)?)?vine\.co\/v\/(.+)/i
TD.services.TwitterMedia.FLICKR_RE = /(?:https?\:\/\/)?(www\.)?(flic.kr|flickr.com\/photos)\/(.+)/i
TD.services.TwitterMedia.IMGUR_RE = /(?:https?\:\/\/)?\/\/([a-z0-9]+\.)?imgur.com\/(.+)/i
TD.services.TwitterMedia.PHOTOZOU_RE = /(?:https?\:\/\/)?\/\/photozou\.jp\/photo\/(show|photo_only)\/(.+)/i
TD.services.TwitterMedia.FILTERABLE_VIDEO_SERVICES = [TD.services.TwitterMedia.VIMEO_RE, TD.services.TwitterMedia.VINE_RE, TD.services.TwitterMedia.YOUTUBE_TINY_RE, TD.services.TwitterMedia.YOUTUBE_RE, TD.services.TwitterMedia.YOUTUBE_LONG_RE]
TD.services.TwitterMedia.FILTERABLE_IMAGE_SERVICES = [TD.services.TwitterMedia.FLICKR_RE, TD.services.TwitterMedia.IMGUR_RE, TD.services.TwitterMedia.PHOTOZOU_RE]
TD.services.TwitterMedia.SERVICES = {
twitpic: TD.services.TwitterMedia.TWITPIC_RE,
yfrog: TD.services.TwitterMedia.YFROG_RE,
lockerz: TD.services.TwitterMedia.LOCKERZ_RE,
youtube: TD.services.TwitterMedia.YOUTUBE_RE,
vine: TD.services.TwitterMedia.VINE_RE
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment