// ==UserScript== // @name Cart - Flip // @namespace scriptomatika // @author mouse-karaganda // @description Опции для корзины // @license MIT // @include https://*flip.kz/cart* // @require https://greasyfork.org/scripts/379902-include-tools/code/Include%20Tools.js // @version 1.1 // @grant none // @downloadURL none // ==/UserScript== (function() { const $ = window.jQuery; const $$ = window.__krokodil; $$.renderStyle( '.disabled_frame { position: fixed; bottom: 0; right: 0; padding: 5px 0 5px 5px; border-radius: 10px 0 0 0; background-color: rgba(10, 121, 213, 0.9); }', '.product_frame { display: inline-block; }', '.product_frame > div { display: inline-block; }', '.product_frame img { width: 32px; border-radius: 5px; }', '.product_frame span { margin-left: 10px; color: white; font-size: 12px; }' ); let disabledList, productFrame, comingList = []; let pproductFrame = { setImg: function() { } }; let findInComingList = function(productId) { let comingPage = 0; }; let disabledFrame = $('
').appendTo(document.body); let div = $('
').appendTo(disabledFrame); $('').appendTo(div).text('К недоступному') .click(function(event) { let listExists = (disabledList && disabledList.length > 0); let viewRow = (listExists) ? disabledList[0].row : $('#module-cart .row').last(); viewRow.get(0).scrollIntoView(); }); $('').appendTo(div).text('Открыть 3') .click(function(event) { let period = 1500; setTimeout(function() { window.open('', 'manual_postpone0', 'width=450,height=300,left=0,top=0'); }, 1); setTimeout(function() { window.open('', 'manual_postpone1', 'width=450,height=300,left=455,top=0'); }, period); setTimeout(function() { window.open('', 'manual_postpone2', 'width=450,height=300,left=910,top=0'); }, period * 2); }); let currentIndex, maxIndex; let currentPage, maxPage; let requestPostponedItem = function() { currentIndex++; if (currentIndex >= maxIndex) return; productFrame.empty(); productFrame.removeAttr('title'); productFrame.addClass('m-r-10'); currentPage = 1; maxPage = 1; let product = disabledList[currentIndex].product; let div = $('
').appendTo(productFrame); $('').appendTo(div).attr('src', product.img); div = $('
').appendTo(productFrame); $('').appendTo(div).text(product.name.substring(0, 5)); $('
').appendTo(div); $('').appendTo(div).text(`товар ${currentIndex + 1} / ${maxIndex}`); $('
').appendTo(div); $('').appendTo(div).text(`стр ${currentPage} / ${maxPage}`); productFrame.attr('title', product.name); $.get('/user?personalis=coming&page=' + currentPage, function(data) { let rowList = $('.table.goods .row', data); console.log('AJAX rowList == ', rowList); }); }; $('
').appendTo(div).text('Проверить') .click(function(event) { let listExists = (disabledList && disabledList.length > 0); if (!listExists) { alert('Недоступных нет'); return; } maxIndex = disabledList.length; currentIndex = -1; // Получить список ожидаемых постранично до тех пор, пока не найдем нужный товар requestPostponedItem(); }); productFrame = $('