您需要先安装一个扩展,例如 篡改猴、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.12 // @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; } .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% - 75%); } .grid-img-container img { width: 100%; } </style> ` $("head").append(sty); $('ol#stream-items-id').css({"display": "flex", "flex-wrap": "wrap"}); 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; //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($("ul.ProfileNav-list").find(".remove-tweet").length < 1){$("ul.ProfileNav-list").prepend(`<button class="btn remove-tweet">Remove</button>`)} if($("ul.AdaptiveFiltersBar-nav").find(".remove-tweet").length < 1){$("ul.AdaptiveFiltersBar-nav").prepend(`<button class="btn remove-streamGrid">Remove</button>`)} //Auto Remove non-Image Tweets setInterval(function(){ $(".tweet").each(function(index,value){ // if(href.indexOf("likes") > 0){ AdaptiveMediaV = $(this).find(".AdaptiveMedia") newImgContainer = $(this).find(".new-img-container") // console.log(anchor4); if( AdaptiveMediaV.length == 0 && newImgContainer.length == 0){$(this).remove()} // } }) }, 3000); //Quote Image Original setInterval(function(){ $(".tweet").each(function(index,value){ // if(href.indexOf("likes") > 0){ newImgContainer = $(this).find(".new-img-container") 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(`<a href="${fullImg}" target="_blank"><img class="new-img" src="${fullImg}"></img></a>`) 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 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() }) $("body").on("click",".remove-streamGrid",function(){ $(".grid-img-container").each(function(index,value){ $(this).remove() if(index == 3){return false} }) })
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址