您需要先安装一个扩展,例如 篡改猴、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.17 // @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; width:100%; } 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) , .SidebarCommonModules { 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; } .grid-img-container { display: grid; grid-template-columns: repeat(4,25%); grid-gap: 10px 20px; } .grid-img-item { width:100%; border: 2px solid black; border-radius: 15px; padding: 0px 5px; display: flex; flex-direction: column; justify-content: center; align-items: center; } .img-holder{ width:100%; border: 2px solid black; border-radius: 15px; padding: 0px 5px; display: flex; flex-direction: column; justify-content: center; align-items: center; } .grid-img-item img{ width:100%; border-radius: 15px; margin-top: 5px; } .remove-btn-container{ z-index:999; position: fixed; top: calc(100% - 90%); width: calc(100% - 60%); background-color: white; padding: 10px; border: 2px solid black; border-radius: 15px; display: flex; flex-direction: column; align-items: center; } .remove-tweet { z-index:999; width: 100%; padding: 30px 20px; border: 3px solid #000; color: #000; border-radius: 10px; margin-bottom: 5px; } #stream-items-id { display: grid; grid-template-columns: repeat(2,calc(100% - 20%)); } .profile-img-container { display: grid; grid-template-columns: repeat(4,22%); grid-gap: 10px 20px; background-color: #fbfbfb; } </style> ` $("head").append(sty); $("div.Grid-cell.u-size2of3.u-lg-size3of4").prepend(`<div class="grid-img-container"></div>`) $(".u-lg-size2of3").before(`<div class="profile-img-container"> </div>`) 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 if(href.indexOf("status") == -1){ //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") 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) //console.log(fullImg); //if( countImgInTweet == 1){ $(".profile-img-container").append(` <div class="img-holder"> <a href="${fullImg}" target="_blank"> <img class="new-img" src="${fullImg}"></img> </a> </div> `) //$(newImgContainer).append(`<a href="${fullImg}" target="_blank"><img class="new-img" src="${fullImg}"></img></a>`) //} //else if( countImgInTweet == 2){ //$(".grid-img-container").append(`<div class="double-item${index+1} img-holder"><a href="${fullImg}" target="_blank"><img class="new-img" src="${fullImg}"></img></a></div>`) //$(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){ //$(".grid-img-container").append(`<div class="triple-item${index+1} img-holder"><a href="${fullImg}" target="_blank"><img class="new-img" src="${fullImg}"></img></a></div>`) //$(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){ //$(".grid-img-container").append(`<div class="quad-item${index+1} img-holder"><a href="${fullImg}" target="_blank"><img class="new-img" src="${fullImg}"></img></a></div>`) //$(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() $(this).remove() } }) }, 3000); $("body").append(` <div class="remove-btn-container"> <button class="btn remove-tweet"> Remove </button> <h1 class="image-count">${image_count}</h1> </div> `) 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) $(".profile-img-container").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-item").length $(".imageG-count").text(imageG_count) image_count = $(".img-con-1").length $(".image-count").text(`${image_count}`) }, 500); setInterval(function(){ $("span.AdaptiveStreamGridImage").each(function(index,value){ img = $(this).attr("data-url") let w = $(this).attr("data-width") let h = $(this).attr("data-height") fullImg = changeToOrig(img) $(".grid-img-container").append(`<div class="grid-img-item"><a href="${fullImg}" target="_blank"><img src="${fullImg}" /></a><br><h3>${w} x ${h}</h3></div>`) $(this).remove() }) }, 3000); }) }//End IF status check //Event Handlers $("body").on("click",".remove-tweet",function(){ $(".tweet").first().remove() //$(".js-stream-item").first().remove() $(".img-con-1").each(function(index,value){ $(this).remove() if(index == 3){return false} }) }) $("body").on("click",".remove-streamGrid",function(){ $(".grid-img-item").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,70); }, 100); }) if(href.indexOf("status") > 0){ $(document).ready(function(){ setInterval(function(){ $(".tweet").each(function(index,value){ AdaptiveMediaV = $(this).find(".AdaptiveMedia") let anchorQImageCon = $(this).find(".QuoteMedia-photoContainer") let photoContainer = $(this).find(".AdaptiveMedia-photoContainer") $(photoContainer).each(function(index,value){ img = $(this).attr("data-image-url") fullImg = changeToOrig(img) $(".profile-img-container").append(` <div class="img-holder"> <a href="${fullImg}" target="_blank"> <img class="new-img" src="${fullImg}"></img> </a> </div> `) $(this).remove() }) }, 3000); }) }) }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址