• morpe

    (@morpe)


    how do I tell wordpress to make the attachment-filters range in average-modal-content
    like this

    tnx!

    console.log("enqueque on metabox.php - media3.js");
    
    openMedia = {
        data: false,
        v: "v03"
    };
    
    openMedia.Open = function (ts) {
    
        openMedia.data = $(ts).data();
        this.frame = wp.media({
    
            //title: openMedia.data.mediaTitle,
            title: "my upload",
            editing: true,
            multiple: false,
            uploadedTo: null,
            button: {
                text: 'Close',
            },
        }).open();
    
        $(this.frame.el).on("click",function(event){
    
            openMedia.CEV = event;
            if( event.target.className == "thumbnail" )
            {
                openMedia.targetId = $(event.target).parent().parent().data("id");
                openMedia.imgData = openMedia.frame.state().get("selection").first().attributes;
    
                console.log(openMedia);
    
                $(".media-button-select").attr("onclick","openMedia.Close(this)");
    
            }
            else
            {
                console.log("no-thumbnail");
            }
        });
    
    }
    
    //fix old html
    openMedia.open = openMedia.Open;
    
    openMedia.Close = function(ts)
    {
        console.log($(ts).data());
    
        this.hiddenTextId = ".wpid-"+openMedia.data.id;
        this.imgBoxId = ".img-"+openMedia.data.id;
        this.imgTitleId = ".ulT-"+openMedia.data.id;
        this.removeId = ".rm-"+openMedia.data.id;
        this.img = "imgImg-"+openMedia.data.id;
    
        var imgBoxHtml = "<img class='"+this.img+"' src='"+openMedia.imgData.sizes.thumbnail.url+"'>";
    
        $(this.hiddenTextId).val(openMedia.targetId);
        $(this.imgTitleId).html(openMedia.imgData.filename);
        $("."+openMedia.img).attr("title","huauhauhahuahua");
        $(this.imgBoxId).html(imgBoxHtml);
    
        $(this.removeId).show(255);
       // $(this.imgTitleId).html(openMedia.imgData.filename);
    
        this.imgBoxHtml = imgBoxHtml;
    
        $("#mbxul-"+openMedia.data.next).show(500);
    
        console.log("close",ts,openMedia);
    }
    
    openMedia.remove = function(ts)
    {
    
        var rmID = $(ts).data('id');
    
        $(".wpid-"+rmID).val(0);
    
        $(".imgImg-"+rmID).animate({
            opacity: 0.3
        },250);
    
       $(ts).hide(250,function(){
            $(".killBox-"+rmID).fadeIn(250);
        });
    
        console.log(ts);
    }

  • The topic ‘add attachment-filters on custom modal media insert’ is closed to new replies.