poots / Aliexpress photo fetcher

// ==UserScript==
// @name         Aliexpress photo fetcher
// @namespace    https://openuserjs.org/scripts/poots/Aliexpress_photo_fetcher
// @version      0.2
// @description  Gather photos of aliexpress products in one page
// @author       poots
// @match        https://feedback.aliexpress.com/display/*
// @grant        none
// @require      https://code.jquery.com/jquery-2.2.4.min.js
// ==/UserScript==

(function() {
    var wnd;
    var pFeedbackUrl = "https://feedback.aliexpress.com/display/productEvaluation.htm"+window.location.search+"&withPictures=true";
    var imgs = [];
    var header = "<!DOCTYPE>"+
        "<html>"+
        "<head>"+
        "<style>.lmt {max-width:300px;max-height:300px;display:inline-block} .xpn {max-width:100%;height:100%;max-height:100%}</style>"+
        "</head>"+
        "<body>";
    $.post(pFeedbackUrl, function(data){
        var pages = $("#simple-pager .ui-label", data).html().toString().split('/')[1];
        var imgs = [];
        $(".pic-view-item img",data).each(function(){
            var src = $(this).attr('src');
            getJanelaHndl().document.body.innerHTML = getJanelaHndl().document.body.innerHTML + "<a href='"+src+"' onClick='javascript:return false;'><img class='lmt' onClick=\"javascript:this.classList.toggle('lmt');this.classList.toggle('xpn');\" src='"+src+"' /></a>";
        });
        if (pages > 1) {
            for (var i = 2; i <= pages;i++) {
                var pUrl = pFeedbackUrl+"&page="+i;
                $.ajax({
                    url: pFeedbackUrl+"&page="+i,
                    success : function(data){
                        $(".pic-view-item img",data).each(function(){
                            var src = $(this).attr('src');
                            getJanelaHndl().document.body.innerHTML = getJanelaHndl().document.body.innerHTML + "<a href='"+src+"' onClick='javascript:return false;'><img class='lmt' onClick=\"javascript:this.classList.toggle('lmt');this.classList.toggle('xpn');\" src='"+src+"' /></a>";
                        });
                    }
                });
            }
        }
    });

    function getJanelaHndl() {
        if (typeof(wnd) === 'undefined') {
            wnd = window.open(null, "_blank");
            wnd.document.body.innerHTML = header;
        }

        return wnd;
    }
})();