-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBookmark.min
1 lines (1 loc) · 1.82 KB
/
Bookmark.min
1
javascript:(async function(){var Redeem="RedeemText";var maxCost="RedeemCostNumber";document.querySelector('[aria-label="Bits and Points Balances"]').click();await new Promise(r=>setTimeout(r,100));if(document.querySelector('[title*="'+Redeem+'"]')!=null){document.querySelector('[title*="'+Redeem+'"]').parentNode.parentNode.getElementsByTagName('button')[0].click();await new Promise(r=>setTimeout(r,100));if(document.querySelector('p[data-test-selector="RewardText"]')==null){document.querySelector('[aria-labelledby="channel-points-reward-center-header"]').querySelector('[aria-label="Close"]').click();msgBox("Not enough points for '"+Redeem+"'");}else{if(typeof(maxCost)!="undefined"&&maxCost!=""){if(document.querySelector('p[data-test-selector="RewardText"]').nextSibling.nextSibling.textContent<=maxCost){document.querySelector('p[data-test-selector="RewardText"]').parentNode.parentNode.parentNode.parentNode.click();}else{document.querySelector('[aria-labelledby="channel-points-reward-center-header"]').querySelector('[aria-label="Close"]').click();msgBox("'"+Redeem+"' is not <= "+maxCost+" anymore ("+document.querySelector('p[data-test-selector="RewardText"]').nextSibling.nextSibling.textContent+")");}}else{document.querySelector('p[data-test-selector="RewardText"]').parentNode.parentNode.parentNode.parentNode.click();msgBox("'"+Redeem+"' not found");}}}})();function msgBox(Text){msgBox=document.createElement("div");msgBox.id="msgBox";msgBox.style="padding-left:1vw;padding-right:1vw;position:absolute;top:0;left:0;right:0;bottom:0;margin:auto;color:#ff0000;background-color:#80808080;z-index:1000;height:fit-content;width:fit-content;font-size:xxx-large;font-weight:bold";msgBox.textContent=Text;document.body.insertBefore(msgBox,document.body.childNodes[0]);setTimeout(()=>{(function(){document.getElementById("msgBox").remove();})()},5000)};