// ==UserScript== // @name Tweetdeck media zoom // @namespace http://tampermonkey.net/ // @version 0.1.1 // @description タブレット専用に選択した画像を広げて表示 // @author y_kahou // @match https://tweetdeck.twitter.com/ // @grant none // @noframes // @require http://code.jquery.com/jquery-3.5.1.min.js // @downloadURL none // ==/UserScript== var $ = window.jQuery; function __css__() {/* .med-origlink { display: none; } .med-flaglink { display: none; } .med-embeditem { top: 0; bottom: 0; } .med-tweet { background: rgb(0, 0, 0, 0.8); right: 0; left: 0px; transition: 0.5s; opacity: 0; pointer-events: none; } .view { opacity: 1; pointer-events: auto; } */} function addStyle() { var css = (__css__).toString() .match(/[^]*\/\*([^]*)\*\/\}$/)[1] .replace(/\{\*/g, '/*') .replace(/\*\}/g, '*/'); $('head').append(``) } (function() { 'use strict'; addStyle(); var tapCount = 0; var tapCount2 = 0; var controll = function(modal) { $(modal).on('touchstart', 'a.js-media-image-link', function(e) { if (!tapCount) { e.preventDefault(); ++tapCount; setTimeout(() => tapCount = 0, 350); } else { // ダブルタップ判定 e.stopPropagation(); tapCount = 0 ; } }) $(modal).on('touchstart', '.js-modal-panel', function(e) { if (!tapCount2) { $('.med-tweet').toggleClass('view') ++tapCount2; setTimeout(() => tapCount2 = 0, 350); } else { // ダブルタップ判定 e.preventDefault(); $(modal).empty().hide(); tapCount2 = 0 ; } }) } var iv = setInterval(function() { var modal = $('#open-modal')[0]; if (modal) { clearInterval(iv); controll(modal); } }, 500) })();