Disable activity of one of the two buttons
What do you mean by disable activity?
You want them to disappear (be removed)?
When I click on the Visit Store button, I go to the store. I would like to remove this transition, make the button inactive. To prevent the Visit Store button from being pressed.
That's pretty easy to do.
I can do it for you in a few hours, I will post the script here when I finish and when I have time to make the script
// ==UserScript==
// @name Disable Store Links On AliExpress
// @namespace Disable Store Links On AliExpress
// @version 0.1
// @description Disable Store Links On AliExpress.
// @author hacker09
// @match https://campaign.aliexpress.com/*
// @run-at document-end
// @grant none
// ==/UserScript==
(function() {
'use strict';
setTimeout(function(){
var links = document.querySelectorAll("a[href]");
for (var i = 0; i < links.length; i++) {
if (links[i].href.match('https://www.aliexpress.com/store/') !== null)
{
links[i].innerHTML = ''
}
}
}, 3000);
})();
Thanks, but you misunderstood me :(
Please watch this video.
You have removed the link to the store, but you need to deactivate the activity of the button labeled "Visit Store".
Sorry for my English. I am using google translate. I am trying to explain, I hope you understand me.
So when you click on 'get coupon' you just want to get the coupon, and you want to disable the button from opening a website on a new tab?
I got the coupon, and a new tab with a website didn't open.... Just don't double click on the 'get coupon' button, then a new browser tab won't be opened
Yes, I need to disable the opening of the site when pressing the "Visit Store" button. Is it possible to do this through a script?
Yes. But is much better and easier if you don't double click on the 'get coupon' button
Just don't double click on the 'get coupon' button, then a new browser tab won't be opened
Please, if you have a solution to my problem through a script, I will be very grateful.
You can't get more coupons even if you use a script
I don't need to receive more coupons. I need to disable the activity of the "Visit Store" button. This is the only thing I need.
This will block that new tab from opening
https://greasyfork.org/en/scripts/387937-ultra-popup-blocker
Is this good for you?
It's also possible to completely remove the yellow box after you got your coupon
Thanks for the script. It performs a similar task, but does it for all sites globally.
I only wanted one site and only one button. Without a lot of massive code and a popup at the bottom of the browser.
Did I understand correctly that the task to disable only the "Visit Store" button on one site cannot be done?
That script blocks the popup. My task is to make the "Visit Store" button inactive. Disable link and transition.
Just change that script match rule to
// @match https://campaign.aliexpress.com/*
You posted this on the development forum board on greasyfork, so I suppose that you know programming.
You understood wrong, it can be done, it seems that it has everything to do with adventlisteners, you could remove all of them by doing document.queryselector('Visit Store CSS').innerHTML = document.queryselector('Visit Store CSS').innerHTML; //Inject the element html into the element html again to remove every adventlistener of the element
But this would also remove the "get coupoun" button, the button would stop working, is this okay for you?
If you not, then you need to learn what adventlistener is being called is and changing the button to the text "Visit Store" and giving a link to the button, then you would need to 'mimic' the function that the adventlistener is calling,this is usually hard and takes time.
You could also add an adventlistener to the button, that after sometime (seTimeout) would run and hide the button, or would do something like this document.queryselector('Visit Store CSS').innerHTML = document.queryselector('Visit Store CSS').innerHTML; //Inject them element html into the element html again to remove every adventlistener of the element
You can also hide/remove that "popup at the bottom of the browser" on this script https://greasyfork.org/en/scripts/387937-ultra-popup-blocker
This script is pretty simple, isn't massive at all I think, if you know programming you can easily modify that script to work only on aliexpress and to NOT show the "popup at the bottom of the browser".
Can this file help you to find the required "Visit Store" calling function and to deactivate it?
Could this code be responsible for executing the function? - "@ali-gmod-pagebuilder-store-coupon#@#VisitStore","VISIT STORE"
No, that doesn't help, but thanks for sharing that file, but I actually do have an account on that website, so this is needless anyways in this case, even though you unminified the advent listener function, the function still "ciphered". Most websites does this.
So like, in common js let's say we need to use document.querySelectorAll("a[href]")
But a website want's to make the life of developers/hackers trying to read the website codes harder, so instead of using that, they would use something like xa("a[href]")
It's hard to know what 'xa' means on 'non ciphered' js, unless you are really good at js, or have a lot of time and desire to learn what 'xa' means for this website.
It seems that that code just changes the get coupon text to visit store, you need to find the advent listener that has the link,or generates the link to get to the store, but you would also need to know the advent listener function name that is being called, but websites usually make this pretty hard to know too and/or they use anonymous functions.
It's much more faster and easier if you use and modify this
https://greasyfork.org/en/scripts/387937-ultra-popup-blocker
Konf
This is almost what need, but first I have to take the coupon, then the button should be deactivated. It is not necessary to remove it. The "Visit Store" button should not work after taking a coupon.
You can do exactly what I said earlier
Add an adventlistener to the button, that after sometime (setTimeout) after the first click would run and hide/remove the button like this document.queryselector('Visit Store CSS').innerHTML = document.queryselector('Visit Store CSS').innerHTML; //Inject them element html into the element html again to remove every adventlistener of the element
or
document.queryselector('Visit Store CSS').innerHTML = document.queryselector('Visit Store CSS').remove(); //Inject them element html into the element html again to remove every adventlistener of the element
or
document.queryselector('Visit Store CSS').innerHTML = document.queryselector('Visit Store CSS').style.display = 'none'; //Inject them element html into the element html again to remove every adventlistener of the element
I don't know where to find "adventlistener".
You don't need to find anything, you need to create the advent listener.
You know js right?
You posted this on the development board, not on the creation requests board
pro100Hub, wait, you can't take the coupons with my script? Also, I have decided to remove the buttons as a solution of your problem - prevent a forwarding to the store. Why you need the buttons remain untouched?
Konf
Yes, unfortunately the function of getting a coupon when you click on the "Get now" button does not work with your script. There are two buttons, "Get Now" and "Visit Store". The first button should work as before, the second should be disabled. With your script, both buttons are disabled.
The code below doesn't work, but I hope you get the idea
// ==UserScript==
// @name Disable Store Links On AliExpress
// @namespace Disable Store Links On AliExpress
// @version 0.1
// @description Disable Store Links On AliExpress.
// @author hacker09
// @match https://campaign.aliexpress.com/*
// @run-at document-end
// @grant none
// ==/UserScript==
(function() {
'use strict';
setTimeout(function(){
var links = document.querySelectorAll("div.rax-view > span.text");
for (var i = 0; i < links.length; i++) {
if (links[i].innerText === 'GET NOW')
{
links[i].onclick = setTimeout(function(){
links[i].parentElement.parentElement.parentElement.parentElement.innerHTML = ''
}, 200);
}
}
}, 3000);
})();
pro100Hub Ok, I get it. The problem is these two buttons are same one. I will try to fix this later, in few hours I will report back a result
There's no problem of these 2 buttons being the same, you can add a delay to disable the button after the first click,like I did
Well, it is complicated, and this is my conclusion:
While your conditions unclear (how you are going to use the script and what exactly you want it to do) I can't help you. The aliexpress either fights script-bots or it is just a very trash coded website.
Konf, get a coupon when you click the "Get Now" button, make the second "Visit Store" button inactive or disable.
pro100Hub, you just need it for your convenience? Or you are going to use some another clicker in addition, for fast getting the coupons?
For convenience. I use fast mouse clicks, no clicker.
Why don't you just create a script that does the clicks? 1 click per 1 coupon
I don't know how to create them. I do not need other scripts, I only need one that will hide the "Visit Store" button. This will be enough for me.
Why did you add this link? Do you not understand something from my request? Or do you not understand my language when translated via google translate?
// ==UserScript==
// @name Ultra Popup Blocker
// @description Configurable popup blocker that blocks all popup windows by default. You can easily open the blocked popup or whitelist a domain, directly from the page.
// @namespace https://github.com/eskander
// @author eskander
// @version 2.2
// @include https://campaign.aliexpress.com/*
// @license MIT
// @homepage https://github.com/eskander/ultra-popup-blocker
// @supportURL https://github.com/eskander/ultra-popup-blocker/issues
// @compatible firefox Tampermonkey recommended
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @grant GM_listValues
// @grant GM_openInTab
// @grant GM_registerMenuCommand
// ==/UserScript==
(function () {
// ============================== CONFIG =================================
var bDisplayMessageOnPopupBlocked = true;
var bDisplayOpenPopupLink = true;
var bDisplayWhiteListThisDomainLink = true;
var LOG_ID = "ultra_popup_blocker"; // HTML ID in the page
// ============================ FUNCTIONS ================================
var global = unsafeWindow; // reference to page's "window" through GreaseMonkey
// Helper to create a button with inner text @text executing onclick @clickCallback,
// appended as a child of @logDiv
var putButton = function (logDiv, text, clickCallback, inlineStyle) {
var button = document.createElement("button");
button.innerHTML = text;
button.style.cssText = "text-decoration: none;\
color: black;\
cursor: pointer;\
margin: 0 5px;\
padding: 1px 3px;\
background-color: rgb(255, 255, 255);\
border-width: 0px;\
border-radius: 5px;\
color: black;" + inlineStyle;
logDiv.appendChild(button);
button.addEventListener("click", clickCallback);
};
// Helper to create a button (child of @logDiv) which onclick whitelists @domain
// in internal Firefox storage.
var putWhitelistButton = function (logDiv, domain) {
putButton(logDiv, "Whitelist 🗸", function () {
GM_setValue("whitelisted_" + domain, true);
});
};
// Helper to create a text node with @text and append to @logDiv
var putText = function (logDiv, text) {
var node = document.createTextNode(text);
logDiv.appendChild(node);
};
// Return logger div, or create it ad-hoc.
var getLogDiv = function () {
var logDiv = document.getElementById(LOG_ID);
if (!logDiv) {
logDiv = document.createElement("div");
logDiv.setAttribute("id", LOG_ID);
logDiv.style.cssText = "position: fixed;\
bottom: 0;\
left: 0;\
z-index: 99999;\
width: 100%;\
padding: 5px 5px 5px 5px;\
font: status-bar;\
background-color: black;\
color: white;";
document.body.appendChild(logDiv);
}
return logDiv;
};
// Get top domain to whitelist.
var getDomainsArray = function (documentDomain) {
// e.g. domain = www.google.com, topDomain = google.com
var d1 = documentDomain;
var domainsArr = [];
while (d1.split(".").length > 2) {
d1 = d1.substring(d1.indexOf('.') + 1);
}
domainsArr.push(d1);
return domainsArr;
};
// Checks if domain we're currently browsing has been whitelisted by the user
// to display popups.
var isCurrentDomainWhiteListed = function () {
var domains = getDomainsArray(document.domain);
var whitelisted = domains.some(function (d) {
return GM_getValue("whitelisted_" + d);
}); // if any 'd' in 'domains' was whitelisted, we return true
return whitelisted;
};
// "window.open()" returns Window which might be then used by the originator page
// to focus the popup (annoying splash popup) or blur it to retain focus in the original page
// (pay-by-impressions popup, I don't need it to actually see it).
// We need to return the fake window to not encounter JS runtime error when the popup originator
// page wants to call focus() or blur().
var FakeWindow = {
blur: function () {
return false;
},
focus: function () {
return false;
}
};
// Storing a reference to real "window.open" method in case we wanted
// to actually open a blocked popup
var realWindowOpen = global.open;
// This function will be called each time a script wants to open a new window,
// if the blocker is activated.
// We handle the blocking & messaging logic here.
var fakeWindowOpen = function (url) {
if (!bDisplayMessageOnPopupBlocked) {
return FakeWindow;
}
var logDiv = getLogDiv();
logMessage(logDiv, url);
if (bDisplayOpenPopupLink) {
displayOpenPopupLink(logDiv, arguments);
}
if (bDisplayWhiteListThisDomainLink) {
displayWhiteListThisDomainLink(logDiv);
}
displayCloseButton(logDiv);
displayConfigButton(logDiv);
return FakeWindow; // see the doc of FakeWindow
};
var logMessage = function (logDiv, url) {
global.upb_counter = (global.upb_counter || 0);
url = (url[0] == '/') ? document.domain + url : url;
if (global.upb_counter++ == 0) {
var msg = ["[UPB] Blocked 1 popup: ", url, ""].join("");
} else {
var msg = ["[UPB] Blocked ", global.upb_counter, " popups, last: ", url, ""].join("");
}
logDiv.innerHTML = msg;
console.log(msg);
logDiv.style.display = "none";
};
var displayOpenPopupLink = function (logDiv, realArguments) {
putButton(logDiv, "Open ↗", function () {
realWindowOpen.apply(null, realArguments);
});
};
var displayWhiteListThisDomainLink = function (logDiv) {
var domainsArr = getDomainsArray(document.domain);
putWhitelistButton(logDiv, domainsArr[0]);
};
var displayCloseButton = function (logDiv) {
putButton(logDiv, "Close ⨯", function () {
logDiv.style.display = 'none';
}, 'background-color: #a00;\
color: white;\
margin: 0 10px 0 0;\
float: right');
};
var displayConfigButton = function (logDiv) {
putButton(logDiv, "Config ⚙", function () {
GM_openInTab("https://eskander.github.io/ultra-popup-blocker/configure.html", false);
}, 'float:right');
};
// Override browser's "window.open" with our own implementation.
var activateBlocker = function () {
global.open = fakeWindowOpen;
};
// ============================== SETTINGS PAGE =================================
// Add configure link to Tampermonkey's menu
GM_registerMenuCommand('Configure whitelist', function () {
GM_openInTab("https://eskander.github.io/ultra-popup-blocker/configure.html", false);
}, 'r');
// Only run whitelisting mechanism on the appropriate page
if (window.location.href === "https://eskander.github.io/ultra-popup-blocker/configure.html") {
// Add listener to the add button
document.getElementsByClassName("addBtn")[0].addEventListener("click", function () {
newElement();
});
// Create a "close" button and append it to each list item
var Nodelist = document.getElementsByTagName("LI");
for (var i = 0; i < Nodelist.length; i++) {
var span = document.createElement("SPAN");
var txt = document.createTextNode("\u00D7");
span.className = "close";
span.appendChild(txt);
span.onclick = function () {
var div = this.parentElement;
var domain = div.innerText.replace("\n\u00D7", "");
GM_deleteValue("whitelisted_" + domain);
div.style.display = "none";
console.log('[UPB] Domain removed from whitelist: ' + domain);
}
Nodelist[i].appendChild(span);
}
// Create a new list item when clicking on the "Add" button
var newElement = function () {
var inputValue = document.getElementById("Input").value;
if (inputValue === '') {
alert("You must write a domain or subdomain to whitelist.");
} else {
addElement(inputValue);
}
document.getElementById("Input").value = "";
}
var addElement = function (Value) {
var li = document.createElement("li");
var t = document.createTextNode(Value);
li.appendChild(t);
document.getElementById("List").appendChild(li);
GM_setValue("whitelisted_" + Value, true);
console.log('[UPB] Domain added to whitelist: ' + Value);
// Add a close button to the newly created item
var span = document.createElement("SPAN");
var txt = document.createTextNode("\u00D7");
span.className = "close";
span.appendChild(txt);
span.onclick = function () {
var div = this.parentElement;
var domain = div.innerText.replace("\n\u00D7", "");
GM_deleteValue("whitelisted_" + domain);
div.style.display = "none";
console.log('[UPB] Domain removed from whitelist: ' + domain);
}
li.appendChild(span);
}
// Show already stored elements in the list
var storedWhitelist = GM_listValues();
storedWhitelist.forEach(populate);
console.log(storedWhitelist);
function populate(value, index, array) {
addElement(value.replace("whitelisted_", ""));
}
}
// ============================ LET'S RUN IT ================================
var disabled = isCurrentDomainWhiteListed();
if (disabled) {
console.log('[UPB] Current domain was found on a white list. UPB disabled.');
} else {
activateBlocker();
}
})();
hacker09, thanks, but this is absolutely the same script that you suggested to me to use earlier https://greasyfork.org/en/scripts/387937-ultra-popup-blocker
I hope that still someone will find a solution to disable the active link at the "Visit Store" button.
I thank everyone who participates in this topic and offers their solutions.
It's the same, but I did the modifications you wanted, or that you didn't want/know how to do.
I already gave you the other solution that was to add an advent listener to the button and call a function to run after the first click.
Remember that you posted this under the development board, not on the creation requests board.
It's the same, but I did the modifications you wanted, or that you didn't want/know how to do.
You have made changes to the settings, disabled some functions, but this does not change how the script works. How it works is to block pop-ups.
I already gave you the other solution that was to add an advent listener to the button and call a function to run after the first click.
Yes, thank you so much for this one. But since I am unable to find a listener, I hope there is someone who can do it.
Remember that you posted this under the development board, not on the creation requests board.
Please tell how i can move this topic from the Development section to the Discussion section?
This is exactly what you wanted... You wanted to block that link from being opened,only on aliexpress,that's what the modifications I did does...
As I previously said you don't need to find anything,you need to create!
I showed you how to create an advent listener that runs after the first click previously.
I think that you can't move your thread.
I was guessing that you knew js all this time.
You can try to quote or PM the admin,maybe he can move your thread
Hello. Tell please, is it possible to make such a script using Tampermonkey. Make the Visit Store button inactive on the yellow coupons on this page? For Get Now to work and Visit Store is disabled. The Visit Store button appears after clicking on Get Now.