Movatterモバイル変換


[0]ホーム

URL:


Skip to content
Search Gists
Sign in Sign up

Instantly share code, notes, and snippets.

@NSExceptional
Last activeDecember 21, 2020 22:02
    • Star(1)You must be signed in to star a gist
    • Fork(0)You must be signed in to fork a gist
    Save NSExceptional/2f95a63decc175315eaaf3454396458c to your computer and use it in GitHub Desktop.
    A user script to make product images on BrickLink use a larger image file
    // ==UserScript==
    //@name BrickLink high res images
    //@version 0.1
    //@description Make product images on BrickLink use a larger image file
    //@author Tanner Bennett / @NSExceptional / u/ThePantsThief
    //@match https://bricklink.com/*
    //@match https://*.bricklink.com/*
    //@match https://store.bricklink.com/*
    //@grant none
    // ==/UserScript==
    functionobserve(selector,imgSelector){
    // Call initially just to be safe;
    // The catalog for example loads instantly
    resizeProductRows(imgSelector);
    constobserver=newMutationObserver(function(mutationsList,observer){
    for(varmutationofmutationsList){
    if(mutation.type=='childList'&&mutation.target.lastElementChild.className!='blLILThumbImageOverlay'){
    resizeProductRows(imgSelector);
    break;
    }
    }
    });
    constelement=$(selector).get(0);
    if(element){
    observer.observe(element,{
    attributes:false,childList:true,subtree:true
    });
    }
    }
    functionresizeProductRows(selector){
    $(selector).each(function(){
    const$img=$(this);
    letorig=$img.attr('src');
    letnewURL=orig
    .replace(/\/([A-Z])T\//,'/$1N/')
    .replace('/Thumb/','/')
    .replace(/\.t\d\./,'.');
    $img.attr('src',newURL);
    });
    }
    $(document).ready(function(){
    observe('.store-content','.item .image img');
    observe('#ItemEditForm table','.blCatalogImagePopup img');
    });
    Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

    [8]ページ先頭

    ©2009-2025 Movatter.jp