您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Twitter replace IMAGE with ORIG, add auto remove non image tweets, Replace Quote Image with ORIG, remove some stuff, working with search image page
当前为
// ==UserScript== // @name Twitter new layout Image ORIG // @description Twitter replace IMAGE with ORIG, add auto remove non image tweets, Replace Quote Image with ORIG, remove some stuff, working with search image page // @match https://twitter.com/*/media // @match https://twitter.com/*/likes // @match https://twitter.com/* // @match https://mobile.twitter.com/*/status/* // @match https://mobile.twitter.com/* // @version 1.16 // @grant none // @require https://code.jquery.com/jquery-3.4.1.min.js // @namespace https://gf.qytechs.cn/users/164357 // ==/UserScript== //Assign Variable console.log("Start"); let href = document.location.href; const sty = `<style> .new-img { border-radius: 10px; } .img-holder{ border: 2px solid black; border-radius: 10px; } div.flex-module-inner:nth-child(1) , div.module:nth-child(2) , .import-prompt , div.permalink-footer:nth-child(4) > div:nth-child(1) > div:nth-child(1) , div.module:nth-child(3) , .has-items > div:nth-child(1) > div:nth-child(1) { display:none; } .searchToolBox { z-index: 999; top: calc(100% - 52%); } .searchToolBox .btn { width:100%; margin: 5px 0px; } .single-img-con{ position: relative; right: calc(100% - 93%); border: 2px solid black; border-radius: 10px; width: 100%; } .single-img-con img {object-fit: cover;;width:100%;max-width: 100%;} .double-img-con{ display:grid; grid-template-columns: repeat(2,50%); grid-gap: 1%; position: relative; right: calc(100% - 89%); width:inherit; height: auto; max-width: 100%; } .double-img-con img{ object-fit: cover; width:100%; max-width: 100%; } .triple-img-con{ display:grid; grid-template-columns: repeat(3,37%); width:inherit; height: auto; max-width: 100%; grid-gap: 1%; position: relative; right: calc(100% - 88%); } .triple-img-con img{ object-fit: cover; width:100%; max-width: 100%; } .quad-img-con{ display:grid; grid-template-columns: repeat(4,27%); width:inherit; height: auto; max-width: 100%; grid-gap: 1%; position: relative; right: calc(100% - 88%); } .quad-img-con img{ object-fit: cover; width:100%; max-width: 100%; } .Gallery.with-tweet .GalleryTweet.enable-fade .content > * { opacity: 1; visibility: visible; display: grid; } .remove-tweet{ padding: 30px 20px; border: 3px solid #000; color: #000; border-radius: 10px; } .grid-img-container{ z-index:999; width:calc(100% - 81%); border: 1px solid black; border-radius: 10px; padding: 4px 4px 0px 4px; margin: 0px 10px; } .grid-img-container img { width: 100%; border-radius: 10px; } </style> ` $("head").append(sty); $('ol#stream-items-id').css({"display": "flex", "flex-wrap": "wrap", "align-items": "center"}); function changeToOrig(link) { const n = link.search(/.jpg|.png/) let newLink = "" if(link.indexOf('jpg')>0){ newLink = link.substring(0,n) + "?format=jpg&name=orig" } else if(link.indexOf('png')>0){ newLink = link.substring(0,n) + "?format=png&name=orig" } return newLink } var img = ""; var fullImg = "";var newImgContainer = "";var tweetTextContainer = "";var AdaptiveMediaV = "";var countImgInTweet = 0; var QMediaV = "";var imageG_count = 0;var image_count = 0; //End Assign Variable //Get started if(href.includes("mobile.")){ document.location.href = href.replace("mobile.","") } //End started //Event Handlers Interval //Tweet Image Original $(document).ready(function(){ setInterval(function(){ $(".tweet").each(function(index,value){ tweetTextContainer = $(this).find(".js-tweet-text-container") newImgContainer = $(this).find(".new-img-container") let anchor3 = $(this).find("span.FullNameGroup") AdaptiveMediaV = $(this).find(".AdaptiveMedia") let anchorQImageCon = $(this).find(".QuoteMedia-photoContainer") if(newImgContainer.length == 0 && (AdaptiveMediaV.length == 1 || anchorQImageCon.length == 1) ){$(tweetTextContainer).after(`<div class="new-img-container"></div>`)} if(newImgContainer.length == 1){ let photoContainer = $(this).find(".AdaptiveMedia-photoContainer") if(photoContainer.length == 1){$(newImgContainer).addClass("single-img-con"); countImgInTweet = 1;} else if(photoContainer.length == 2){$(newImgContainer).addClass("double-img-con"); countImgInTweet = 2;} else if(photoContainer.length == 3){$(newImgContainer).addClass("triple-img-con"); countImgInTweet = 3;} else if(photoContainer.length == 4){$(newImgContainer).addClass("quad-img-con"); countImgInTweet = 4;} $(photoContainer).each(function(index,value){ img = $(this).attr("data-image-url") fullImg = changeToOrig(img) if( countImgInTweet == 1){ $(newImgContainer).append(`<a href="${fullImg}" target="_blank"><img class="new-img" src="${fullImg}"></img></a>`) } else if( countImgInTweet == 2){ $(newImgContainer).append(`<div class="double-item${index+1} img-holder"><a href="${fullImg}" target="_blank"><img class="new-img" src="${fullImg}"></img></a></div>`) } else if( countImgInTweet == 3){ $(newImgContainer).append(`<div class="triple-item${index+1} img-holder"><a href="${fullImg}" target="_blank"><img class="new-img" src="${fullImg}"></img></a></div>`) } else if( countImgInTweet == 4){ $(newImgContainer).append(`<div class="quad-item${index+1} img-holder"><a href="${fullImg}" target="_blank"><img class="new-img" src="${fullImg}"></img></a></div>`) } }) $(this).find(".AdaptiveMediaOuterContainer").remove() } }) }, 3000); if($("div.module:nth-child(1) > div:nth-child(1)").find(".remove-tweet").length < 1){ $("div.module:nth-child(1) > div:nth-child(1)") .prepend(` <button class="btn remove-tweet" style="position: fixed;top: calc(100% - 90%);z-index: 999;width: calc(100% - 80%);"><h1 class="image-count">remove ${image_count}</h1></button> `) } let searchToolBox = ` <div class="searchToolBox"> <button class="btn remove-streamGrid">Remove</button> <button class="btn load-more">Load</button> <div style="display:flex;flex-direction: row;justify-content: center;"><h1 class="imageG-count">0</h1></div> </div> ` if($(".SidebarFilterModule").find(".searchToolBox").length < 1){ $(".SidebarFilterModule").empty(); $(".SidebarFilterModule").prepend(`${searchToolBox}`) $(".SidebarFilterModule.is-collapsed").css({"height": "30%" , "position": "fixed", "z-index": "999", "width": "19%","display": "flex","flex-direction": "column"}) } //Auto Remove non-Image Tweets setInterval(function(){ $(".tweet").each(function(index,value){ // if(href.indexOf("likes") > 0){ AdaptiveMediaV = $(this).find(".AdaptiveMediaOuterContainer") newImgContainer = $(this).find(".new-img-container") QMediaV = $(this).find(".QuoteMedia") let videoT = $(this).find(".AdaptiveMedia-video") // console.log(anchor4); if( (AdaptiveMediaV.length == 0 && QMediaV.length == 0 && newImgContainer.length == 0) || videoT.length == 1 ){ $(this).remove() //console.log(AdaptiveMediaV,QMediaV); } // } }) }, 3000); //Quote Image Original setInterval(function(){ $(".tweet").each(function(index,value){ // if(href.indexOf("likes") > 0){ newImgContainer = $(this).find(".new-img-container") tweetTextContainer = $(this).find(".js-tweet-text-container") if(newImgContainer.length == 0){ $(tweetTextContainer).after(`<div class="new-img-container"></div>`) } if(newImgContainer.length == 1){ let qPhotoContainer = $(this).find(".QuoteMedia-photoContainer") $(qPhotoContainer).each(function(index,value){ img = $(this).attr("data-image-url") fullImg = changeToOrig(img) $(newImgContainer).append(`<div class="img-holder"><a href="${fullImg}" target="_blank"><img class="new-img" src="${fullImg}"></img></a></div>`) if(qPhotoContainer.length == 1){$(newImgContainer).addClass("single-img-con");} else if(qPhotoContainer.length == 2){$(newImgContainer).addClass("double-img-con");} else if(qPhotoContainer.length == 3){$(newImgContainer).addClass("triple-img-con");} else if(qPhotoContainer.length == 4){$(newImgContainer).addClass("quad-img-con");} }) $(this).find(".QuoteTweet").remove() } // } }) }, 3000); //Use in search images page //count image setInterval(function(){ imageG_count = $(".grid-img-container").length $(".imageG-count").text(imageG_count) image_count = $(".new-img-container").length $(".image-count").text(`remove ${image_count}`) }, 500); setInterval(function(){ $("span.AdaptiveStreamGridImage").each(function(index,value){ img = $(this).attr("data-url") fullImg = changeToOrig(img) $(this).before(`<div class="grid-img-container"><a href="${fullImg}" target="_blank"><img src="${fullImg}" /></a></div>`) $(this).remove() }) }, 3000); }) //Event Handlers $("body").on("click",".remove-tweet",function(){ //$(".tweet").first().remove() $(".js-stream-item").first().remove() }) $("body").on("click",".remove-streamGrid",function(){ $(".grid-img-container").each(function(index,value){ $(this).remove() if(index == 3){return false} }) }) $("body").on("click",".load-more",function(){ window.scrollTo(0,document.documentElement.scrollHeight) setTimeout(function(){ window.scrollTo(0,0); }, 100); })
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址