# HG changeset patch # User nanaya # Date 1673793824 -32400 # Node ID 7774174022af0e5a7e3f00476379b7a2de1eeaf6 # Parent 817b62848b272656784a2060828d8109fd878e40 Backed out changeset b9b84779a672 diff -r 817b62848b27 -r 7774174022af tweetdeck-column-fix.user.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tweetdeck-column-fix.user.js Sun Jan 15 23:43:44 2023 +0900 @@ -0,0 +1,27 @@ +// ==UserScript== +// @name Tweetdeck column fix +// @namespace https://nanaya.net +// @version 1.1.0 +// @description No weird column alignment and color for scrollbar +// @author nanaya +// @match https://tweetdeck.twitter.com/* +// @grant GM_addStyle +// @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/tweetdeck-column-fix.user.js +// ==/UserScript== + +'use strict'; + +/* global GM_addStyle */ +GM_addStyle(` + .app-columns { + display: flex; + } + .column { + top: 0; + flex: none; + } + .app-columns-container.app-columns-container.app-columns-container.app-columns-container { + bottom: 0; + background-color: #555; + } +`); diff -r 817b62848b27 -r 7774174022af tweetdeck-fixes.user.js --- a/tweetdeck-fixes.user.js Sun Jan 15 23:43:40 2023 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -// ==UserScript== -// @name Tweetdeck large image -// @namespace https://nanaya.net -// @version 2.0.9 -// @description Fixes for TweetDeck -// @author nanaya -// @match https://tweetdeck.twitter.com/* -// @grant none -// @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/tweetdeck-fixes.user.js -// ==/UserScript== - -'use strict'; - -/* global GM_addStyle */ -// No weird column alignment and color for scrollbar -function fixColumn () { - GM_addStyle(` - .app-columns { - display: flex; - } - .column { - top: 0; - flex: none; - } - .app-columns-container.app-columns-container.app-columns-container.app-columns-container { - bottom: 0; - background-color: #555; - } - `); -} - -// No more stupid link for images in tweetdeck -function origLink () { - const fix = function (link) { - // basic sanity check - if (!link.classList.contains('js-media-image-link')) { - return; - } - - // don't run again if already run on passed link - if (link._ecUserscript) { - return; - } - link._ecUserscript = true; - - const image = link.querySelector('.media-img'); - let url; - - // sometimes the image is just background image of the link. - // strip all query strings and original :size suffix - if (image == null) { - url = window.getComputedStyle(link).backgroundImage.replace(/^url\(('|")?(.+?)\1\)$/, '$2'); - } else { - url = image.src; - } - - const parsedUrl = new URL(url); - - if (parsedUrl.searchParams.get('name') == null) { - url = url.replace(/(\..+:).+/, '$1orig'); - } else { - if (parsedUrl.pathname.match(/\.[^.]+$/) !== null) { - parsedUrl.searchParams.delete('format'); - } - parsedUrl.searchParams.set('name', 'orig'); - url = parsedUrl.href; - } - - link.setAttribute('href', url); - }; - - // loop through passed nodes (or body if called without arguments) - const run = function (nodes) { - if (nodes == null) { - nodes = [document.body]; - } - - for (let i = 0; i < nodes.length; i++) { - // first try fixing itself - fix(nodes[i]); - - // and then find all the links inside - const links = nodes[i].querySelectorAll('.js-media-image-link'); - - for (let j = 0; j < links.length; j++) { - fix(links[j]); - } - } - }; - - const onMutate = function (mutations) { - for (const mutation in mutations) { - run(mutation.addedNodes); - } - }; - - // the observer - const observer = new window.MutationObserver(onMutate); - - // start the observer - observer.observe(document, { childList: true, subtree: true }); - // initial run on existing document - run(); -} - -fixColumn(); -origLink(); diff -r 817b62848b27 -r 7774174022af tweetdeck-large-image.user.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tweetdeck-large-image.user.js Sun Jan 15 23:43:44 2023 +0900 @@ -0,0 +1,87 @@ +// ==UserScript== +// @name Tweetdeck large image +// @namespace https://nanaya.net +// @version 2.0.9 +// @description No more stupid link for images in tweetdeck +// @author nanaya +// @match https://tweetdeck.twitter.com/* +// @grant none +// @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/tweetdeck-large-image.user.js +// ==/UserScript== + +'use strict'; + +function origLink () { + const fix = function (link) { + // basic sanity check + if (!link.classList.contains('js-media-image-link')) { + return; + } + + // don't run again if already run on passed link + if (link._ecUserscript) { + return; + } + link._ecUserscript = true; + + const image = link.querySelector('.media-img'); + let url; + + // sometimes the image is just background image of the link. + // strip all query strings and original :size suffix + if (image == null) { + url = window.getComputedStyle(link).backgroundImage.replace(/^url\(('|")?(.+?)\1\)$/, '$2'); + } else { + url = image.src; + } + + const parsedUrl = new URL(url); + + if (parsedUrl.searchParams.get('name') == null) { + url = url.replace(/(\..+:).+/, '$1orig'); + } else { + if (parsedUrl.pathname.match(/\.[^.]+$/) !== null) { + parsedUrl.searchParams.delete('format'); + } + parsedUrl.searchParams.set('name', 'orig'); + url = parsedUrl.href; + } + + link.setAttribute('href', url); + }; + + // loop through passed nodes (or body if called without arguments) + const run = function (nodes) { + if (nodes == null) { + nodes = [document.body]; + } + + for (let i = 0; i < nodes.length; i++) { + // first try fixing itself + fix(nodes[i]); + + // and then find all the links inside + const links = nodes[i].querySelectorAll('.js-media-image-link'); + + for (let j = 0; j < links.length; j++) { + fix(links[j]); + } + } + }; + + const onMutate = function (mutations) { + for (const mutation in mutations) { + run(mutation.addedNodes); + } + }; + + // the observer + const observer = new window.MutationObserver(onMutate); + + // start the observer + observer.observe(document, { childList: true, subtree: true }); + // initial run on existing document + run(); +} + +origLink();