Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
admin:online-platform-cms:new-script [2022/10/28 08:49] – created edvinas-bazevicius | admin:online-platform-cms:new-script [2022/10/31 11:49] (current) – ignas-bogusis | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | test script | + | ==== USAGE ==== |
+ | |||
+ | **SUB_DOMAIN** | ||
+ | < | ||
+ | Add subdomain name so script | ||
+ | </ | ||
+ | **HIDDEN_CONTENT** | ||
+ | < | ||
+ | Here you can add specific website parts to be hidden. Class / ID has to be unique, otherwise it will hide all content that match written class/id. | ||
+ | </ | ||
+ | **HIDDEN_GAMES** | ||
+ | < | ||
+ | Here you can add games that you want to be hidden in header. If you pass `' | ||
+ | |||
+ | </ | ||
+ | |||
+ | === Available games === | ||
+ | - dogs | ||
+ | - prematch | ||
+ | - betgames-iframe | ||
+ | - betgames-rng-wheel | ||
+ | - live | ||
+ | - lottery | ||
+ | - horses | ||
+ | - keno | ||
+ | - roulette | ||
+ | - greyhounds | ||
+ | - undefined (hides every expandable header menu) | ||
+ | |||
+ | ==== HIDDER SCRIPT ==== | ||
+ | < | ||
+ | const SUB_DOMAIN = ''; | ||
+ | const HIDDEN_CONTENT = [ | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | '# | ||
+ | ' | ||
+ | ]; | ||
+ | const HIDDEN_GAMES = [ | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ] | ||
+ | |||
+ | const getElement = async selector => { | ||
+ | while (document.querySelectorAll(selector).length === 0) { | ||
+ | await new Promise(resolve => requestAnimationFrame(resolve)) | ||
+ | } | ||
+ | |||
+ | return document.querySelectorAll(selector); | ||
+ | } | ||
+ | |||
+ | function hidePageContent() { | ||
+ | HIDDEN_CONTENT.forEach(element => { | ||
+ | getElement(element).then((selector) => { | ||
+ | selector.forEach((elem) => { | ||
+ | elem.style.display = ' | ||
+ | }) | ||
+ | }) | ||
+ | }); | ||
+ | HIDDEN_GAMES.forEach(game => { | ||
+ | getElement(' | ||
+ | selector.forEach((elem) => { | ||
+ | elem.style.display = ' | ||
+ | }) | ||
+ | }) | ||
+ | }) | ||
+ | } | ||
+ | |||
+ | function startHider() { | ||
+ | const host = window.location.host; | ||
+ | const parsedSubDomain = host.split(' | ||
+ | if (parsedSubDomain !== SUB_DOMAIN) return; | ||
+ | |||
+ | console.log(' | ||
+ | hidePageContent(); | ||
+ | window.addEventListener(' | ||
+ | document.addEventListener(' | ||
+ | } | ||
+ | |||
+ | startHider(); | ||
+ | </ |