Skip to content

Instantly share code, notes, and snippets.

@taisang1996
Created May 18, 2019 13:22
Show Gist options
  • Save taisang1996/25e74c258fdd56d835dbdaec86ea3a21 to your computer and use it in GitHub Desktop.
Save taisang1996/25e74c258fdd56d835dbdaec86ea3a21 to your computer and use it in GitHub Desktop.
tắt mở trang mới và hiển thị mã giảm giá
// ==UserScript==
// @include http://*
// @include https://*
// @run-at document-end
// ==/UserScript==
if (window.location.host === 'bloggiamgia.vn') {
unsafeWindow.open = function () { }
document.querySelectorAll('.polyxgo_get_coupon').forEach(element => {
if (element.classList.contains('polyxgo_no_coupons')) return
var REGEX = /prompt\('.+?', '(.*?)'\)/;
var TEXT = element.querySelector('.btn-your-voucher-code').getAttribute('onclick');
var COUPON_CODE = TEXT.match(REGEX)[1]
element.querySelector('.coupon-button').textContent = COUPON_CODE
element.querySelector('.code-coupon').remove()
})
}
if (window.location.host === 'mgg.vn') {
unsafeWindow.open = function () { }
document.querySelectorAll('.get-code').forEach(element => {
element.remove()
})
}
if (window.location.host === 'chanhtuoi.com') {
unsafeWindow.open = function () { }
document.querySelectorAll('.cs-btn-coupon').forEach(element => {
element.querySelector('.ec-text').remove()
})
}
if (window.location.host === 'hieuvoz.com') {
unsafeWindow.open = function () { }
document.querySelectorAll('.su-button').forEach(element => {
var TEXT = element.getAttribute('onclick');
if (typeof TEXT != 'string') return
if (TEXT === null) return
if (TEXT === '') return
var REGEX = /prompt\('.+?','(.*?)'\)/;
var match = TEXT.match(REGEX)
if (! match) return;
var COUPON_CODE = match[1]
element.querySelector('span').textContent = COUPON_CODE
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment