Toranoana: no reload

Do not redirect after action.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Toranoana: no reload
// @namespace    http://darkfader.net/
// @version      0.3
// @description  Do not redirect after action.
// @author       Rafael Vuijk
// @match        https://ec.toranoana.shop/ec/app/mypage/favorite_list/*
// @match        https://ec.toranoana.shop/ec/app/cart/cart/*
// @grant        unsafeWindow
// ==/UserScript==

HTMLElement.prototype.remove = function() { this.parentNode.removeChild(this); return this; }

function onReady() {
    const _controlAjaxSuccess = unsafeWindow.controlAjaxSuccess;
    unsafeWindow.controlAjaxSuccess = function(data, successFunction, messageType, messageAdd, formId) {
        if (formId !== undefined && formId != null) {
            console.log("controlAjaxSuccess", data, successFunction, messageType, messageAdd, formId);
            let action = document.getElementById(formId).querySelector("input[name='actionId']").value;
            console.log(data, action);
            if (action == "delete") {
                data.nextUrl = null; // don't go anywhere (and parse transactiontoken from result)
            }
            _controlAjaxSuccess(data, successFunction, messageType, messageAdd, formId);
            if (action == "delete") {
                document.getElementById(formId).remove();
            }
        } else {
            _controlAjaxSuccess(data, successFunction, messageType, messageAdd, formId);
        }
    }
}

// start the onReady...
if (document.readyState !== "loading") {
    setTimeout(onReady, 0);
} else {
    document.addEventListener("DOMContentLoaded", onReady);
}