Twitter new layout Image ORIG

Twitter replace IMAGE with ORIG, add auto remove non image tweets, Replace Quote Image with ORIG, remove some stuff

目前為 2020-01-27 提交的版本,檢視 最新版本

// ==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
// @include     https://twitter.com/*/media
// @include     https://twitter.com/*/likes
// @include     https://twitter.com/*
// @include     https://mobile.twitter.com/*/status/*
// @version  1.08
// @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 {
    width: calc(100% - 20vw);
    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;
}
</style>
`
$("head").append(sty);
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 = "";
//End Assign Variable

//Get started
if(href.includes("mobile.")){
    document.location.href = href.replace("mobile.","")
}
//End started

//Event Handlers Interval
$(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")
                $(photoContainer).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>`)
                })
                $(this).find(".AdaptiveMediaOuterContainer").remove()
                if($(this).find(".remove-tweet").length < 1){$(anchor3).before(`<button class="btn remove-tweet">Remove</button>`)}
            }
        })
}, 3000);
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);
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>`)
                })
                $(this).find(".QuoteTweet").remove()
            }


//        }
    })
}, 3000);
})

//Event Handlers
$("body").on("click",".remove-tweet",function(){
    $(this).closest(".tweet").remove()
})

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址