(function () { 'use strict'; function hideCouponEntry() { var menuItems = document.querySelectorAll('.menu-main .menu-item'); Array.prototype.forEach.call(menuItems, function (item) { if ((item.textContent || '').replace(/\s+/g, '') === '领优惠券') { item.style.display = 'none'; item.setAttribute('data-qqsc-coupon-hidden', 'true'); } }); } function addAgentPayEntry() { if (location.pathname !== '/payment' || document.querySelector('.agent-pay-option')) return; var payType = document.querySelector('.payment .payType'); var payButton = payType && payType.querySelector('.goPay'); if (!payType || !payButton) return; var orderId = new URLSearchParams(location.search).get('result'); if (!orderId) return; var entry = document.createElement('div'); entry.className = 'agent-pay-option acea-row row-between-wrapper'; entry.innerHTML = '
好友代付
暂不付款,生成链接请好友帮您支付
'; entry.querySelector('button').addEventListener('click', function () { location.href = '/order_agent_pay?order_id=' + encodeURIComponent(orderId); }); payType.insertBefore(entry, payButton); } function boot() { hideCouponEntry(); addAgentPayEntry(); new MutationObserver(function () { hideCouponEntry(); addAgentPayEntry(); }).observe(document.body, { childList: true, subtree: true }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', boot, { once: true }); } else { boot(); } }());