MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 3: | Line 3: | ||
* Shows game-specific banners OR generic banner on all wiki pages | * Shows game-specific banners OR generic banner on all wiki pages | ||
* Includes affiliate tracking: trckaff=3881, trckit=WIKI<PageName> | * Includes affiliate tracking: trckaff=3881, trckit=WIKI<PageName> | ||
*/ | */ | ||
(function() { | (function() { | ||
'use strict'; | 'use strict'; | ||
var TRACK_AFF_ID = '3881'; | var TRACK_AFF_ID = '3881'; | ||
var MAX_TRCKIT_LENGTH = 41; | |||
var gameConfig = { | var gameConfig = { | ||
'valheim': { name: 'Valheim', slug: 'valheim | 'valheim': { name: 'Valheim', slug: 'valheim' }, | ||
'ark': { name: 'ARK: Survival Evolved', slug: 'ark | 'ark': { name: 'ARK: Survival Evolved', slug: 'ark' }, | ||
'arksurvivalascended': { name: 'ARK: Survival Ascended', slug: 'arksurvivalascended | 'arksurvivalascended': { name: 'ARK: Survival Ascended', slug: 'arksurvivalascended' }, | ||
'asa': { name: 'ARK: Survival Ascended', slug: 'arksurvivalascended | 'asa': { name: 'ARK: Survival Ascended', slug: 'arksurvivalascended' }, | ||
'rust': { name: 'Rust', slug: 'rust | 'rust': { name: 'Rust', slug: 'rust' }, | ||
'minecraft': { name: 'Minecraft', slug: 'minecraft | 'minecraft': { name: 'Minecraft', slug: 'minecraft' }, | ||
'palworld': { name: 'Palworld', slug: 'palworld', | 'palworld': { name: 'Palworld', slug: 'palworld' }, | ||
'dayz': { name: 'DayZ', slug: 'dayz | 'dayz': { name: 'DayZ', slug: 'dayz' }, | ||
'conan': { name: 'Conan Exiles', slug: 'conanexiles | 'conan': { name: 'Conan Exiles', slug: 'conanexiles' }, | ||
'7daystodie': { name: '7 Days to Die', slug: '7daystodie | '7daystodie': { name: '7 Days to Die', slug: '7daystodie' }, | ||
'7days': { name: '7 Days to Die', slug: '7daystodie | '7days': { name: '7 Days to Die', slug: '7daystodie' }, | ||
'theforest': { name: 'The Forest', slug: 'theforest | 'theforest': { name: 'The Forest', slug: 'theforest' }, | ||
'forest': { name: 'The Forest', slug: 'theforest | 'forest': { name: 'The Forest', slug: 'theforest' }, | ||
'sonsoftheforest': { name: 'Sons of the Forest', slug: 'sonsoftheforest | 'sonsoftheforest': { name: 'Sons of the Forest', slug: 'sonsoftheforest' }, | ||
'sons of the forest': { name: 'Sons of the Forest', slug: 'sonsoftheforest | 'sons of the forest': { name: 'Sons of the Forest', slug: 'sonsoftheforest' }, | ||
'terraria': { name: 'Terraria', slug: 'terraria | 'terraria': { name: 'Terraria', slug: 'terraria' }, | ||
'projectzomboid': { name: 'Project Zomboid', slug: 'projectzomboid | 'projectzomboid': { name: 'Project Zomboid', slug: 'projectzomboid' }, | ||
'zomboid': { name: 'Project Zomboid', slug: 'projectzomboid | 'zomboid': { name: 'Project Zomboid', slug: 'projectzomboid' }, | ||
'enshrouded': { name: 'Enshrouded', slug: 'enshrouded', | 'enshrouded': { name: 'Enshrouded', slug: 'enshrouded' }, | ||
'satisfactory': { name: 'Satisfactory', slug: 'satisfactory | 'satisfactory': { name: 'Satisfactory', slug: 'satisfactory' }, | ||
'v rising': { name: 'V Rising', slug: 'vrising | 'v rising': { name: 'V Rising', slug: 'vrising' }, | ||
'vrising': { name: 'V Rising', slug: 'vrising | 'vrising': { name: 'V Rising', slug: 'vrising' }, | ||
'aska': { name: 'ASKA', slug: 'aska | 'aska': { name: 'ASKA', slug: 'aska' }, | ||
'unturned': { name: 'Unturned', slug: 'unturned | 'unturned': { name: 'Unturned', slug: 'unturned' }, | ||
'factorio': { name: 'Factorio', slug: 'factorio | 'factorio': { name: 'Factorio', slug: 'factorio' }, | ||
'csgo': { name: 'CS2', slug: 'csgo | 'csgo': { name: 'CS2', slug: 'csgo' }, | ||
'cs2': { name: 'CS2', slug: 'csgo | 'cs2': { name: 'CS2', slug: 'csgo' }, | ||
'counterstrike': { name: 'CS2', slug: 'csgo | 'counterstrike': { name: 'CS2', slug: 'csgo' }, | ||
' | 'theisle': { name: 'The Isle', slug: 'theisle' }, | ||
' | 'isle': { name: 'The Isle', slug: 'theisle' }, | ||
' | 'squad': { name: 'Squad', slug: 'squad' }, | ||
' | 'arma': { name: 'Arma 3', slug: 'arma3' }, | ||
' | 'starbound': { name: 'Starbound', slug: 'starbound' }, | ||
' | 'empyrion': { name: 'Empyrion', slug: 'empyrion' }, | ||
' | 'pixark': { name: 'PixARK', slug: 'pixark' }, | ||
' | 'dontstarve': { name: "Don't Starve Together", slug: 'dontstarve' }, | ||
' | "don't starve": { name: "Don't Starve Together", slug: 'dontstarve' }, | ||
'scum': { name: 'SCUM', slug: 'scum' }, | |||
'barotrauma': { name: 'Barotrauma', slug: 'barotrauma' }, | |||
'corekeeper': { name: 'Core Keeper', slug: 'corekeeper' }, | |||
'barotrauma': { name: 'Barotrauma', slug: 'barotrauma | 'core keeper': { name: 'Core Keeper', slug: 'corekeeper' }, | ||
'corekeeper': { name: 'Core Keeper', slug: 'corekeeper | 'stationeers': { name: 'Stationeers', slug: 'stationeers' }, | ||
'core keeper': { name: 'Core Keeper', slug: 'corekeeper | 'icarus': { name: 'Icarus', slug: 'icarus' }, | ||
'stationeers': { name: 'Stationeers', slug: 'stationeers | 'avorion': { name: 'Avorion', slug: 'avorion' }, | ||
'icarus': { name: 'Icarus', slug: 'icarus | 'spaceengineers': { name: 'Space Engineers', slug: 'spaceengineers' }, | ||
'avorion': { name: 'Avorion', slug: 'avorion | 'space engineers': { name: 'Space Engineers', slug: 'spaceengineers' }, | ||
'spaceengineers': { name: 'Space Engineers', slug: 'spaceengineers | 'mordhau': { name: 'Mordhau', slug: 'mordhau' }, | ||
'space engineers': { name: 'Space Engineers', slug: 'spaceengineers | 'hurtworld': { name: 'Hurtworld', slug: 'hurtworld' }, | ||
'mordhau': { name: 'Mordhau', slug: 'mordhau | 'miscreated': { name: 'Miscreated', slug: 'miscreated' }, | ||
'hurtworld': { name: 'Hurtworld', slug: 'hurtworld | 'fivem': { name: 'FiveM', slug: 'fivem' }, | ||
'miscreated': { name: 'Miscreated', slug: 'miscreated | 'redm': { name: 'RedM', slug: 'redm' }, | ||
'fivem': { name: 'FiveM', slug: 'fivem | 'assettocorsa': { name: 'Assetto Corsa', slug: 'assettocorsa' }, | ||
'redm': { name: 'RedM', slug: 'redm | 'assetto': { name: 'Assetto Corsa', slug: 'assettocorsa' }, | ||
'assettocorsa': { name: 'Assetto Corsa', slug: 'assettocorsa | 'renown': { name: 'Renown', slug: 'renown' }, | ||
'brickadia': { name: 'Brickadia', slug: 'brickadia' }, | |||
'assetto': { name: 'Assetto Corsa', slug: 'assettocorsa | 'holdfast': { name: 'Holdfast: Nations At War', slug: 'holdfast' }, | ||
'renown': { name: 'Renown', slug: 'renown | 'left4dead': { name: 'Left 4 Dead 2', slug: 'left4dead2' }, | ||
'brickadia': { name: 'Brickadia', slug: 'brickadia | 'l4d2': { name: 'Left 4 Dead 2', slug: 'left4dead2' }, | ||
'holdfast': { name: 'Holdfast: Nations At War', slug: 'holdfast | 'deadmatter': { name: 'Dead Matter', slug: 'deadmatter' }, | ||
'soulmask': { name: 'Soulmask', slug: 'soulmask' }, | |||
' | 'nightingale': { name: 'Nightingale', slug: 'nightingale' } | ||
'l4d2': { name: 'Left 4 Dead 2', slug: 'left4dead2 | |||
'deadmatter': { name: 'Dead Matter', slug: 'deadmatter | |||
'soulmask': { name: 'Soulmask', slug: 'soulmask | |||
'nightingale': { name: 'Nightingale', slug: 'nightingale | |||
}; | }; | ||
function getPageName() { | function getPageName() { | ||
var urlParams = new URLSearchParams(window.location.search); | var urlParams = new URLSearchParams(window.location.search); | ||
var title = urlParams.get('title'); | var title = urlParams.get('title'); | ||
if (!title) { | if (!title) { | ||
var path = window.location.pathname; | var path = window.location.pathname; | ||
var match = path.match(/\/wiki\/(.+)$/); | var match = path.match(/\/wiki\/(.+)$/); | ||
if (match) | if (match) title = decodeURIComponent(match[1]); | ||
} | } | ||
if (!title) { | if (!title) { | ||
var heading = document.getElementById('firstHeading'); | var heading = document.getElementById('firstHeading'); | ||
if (heading) | if (heading) title = heading.textContent; | ||
} | } | ||
if (title) { | if (title) { | ||
title = title.replace(/[^a-zA-Z0-9]/g, '_').replace(/_+/g, '_').substring(0, | title = title.replace(/[^a-zA-Z0-9]/g, '_').replace(/_+/g, '_').substring(0, MAX_TRCKIT_LENGTH); | ||
} | } | ||
return title || 'Unknown'; | return title || 'Unknown'; | ||
} | } | ||
| Line 125: | Line 101: | ||
var bodyContent = document.getElementById('bodyContent'); | var bodyContent = document.getElementById('bodyContent'); | ||
var manualGame = document.querySelector('[data-ss-game]'); | var manualGame = document.querySelector('[data-ss-game]'); | ||
if (manualGame) | if (manualGame) return manualGame.getAttribute('data-ss-game').toLowerCase(); | ||
var content = bodyContent ? bodyContent.innerHTML : ''; | var content = bodyContent ? bodyContent.innerHTML : ''; | ||
var markerMatch = content.match(/<!--\s*SSGAME:\s*(\w+)\s*-->/i); | var markerMatch = content.match(/<!--\s*SSGAME:\s*(\w+)\s*-->/i); | ||
if (markerMatch) | if (markerMatch) return markerMatch[1].toLowerCase(); | ||
var keywords = Object.keys(gameConfig).sort(function(a, b) { return b.length - a.length; }); | |||
for (var i = 0; i < keywords.length; i++) { | for (var i = 0; i < keywords.length; i++) { | ||
if (pageTitle.indexOf(keywords[i]) !== -1) | if (pageTitle.indexOf(keywords[i]) !== -1) return keywords[i]; | ||
} | } | ||
return null; | return null; | ||
} | } | ||
| Line 155: | Line 118: | ||
var game = gameConfig[gameKey]; | var game = gameConfig[gameKey]; | ||
if (!game) return null; | if (!game) return null; | ||
var trackingUrl = buildTrackingUrl('https://www.survivalservers.com/services/game_servers/' + game.slug + '/', pageName); | var trackingUrl = buildTrackingUrl('https://www.survivalservers.com/services/game_servers/' + game.slug + '/', pageName); | ||
var banner = document.createElement('div'); | var banner = document.createElement('div'); | ||
banner.id = 'ss-game-banner'; | banner.id = 'ss-game-banner'; | ||
banner.style | banner.innerHTML = '\ | ||
<div style="background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); border-radius: 8px; padding: 0; margin: 0 0 20px 0; box-shadow: 0 4px 15px rgba(0,0,0,0.4); overflow: hidden; border: 1px solid #2a2a4a;">\ | |||
<div style="background: linear-gradient(90deg, #ff6b35 0%, #f7931e 100%); padding: 8px 20px; display: flex; align-items: center; gap: 10px;">\ | |||
<span style="color: white; font-weight: 700; font-size: 14px; letter-spacing: 0.5px;">SURVIVAL<span style="color: #1a1a2e;">●</span>SERVERS</span>\ | |||
<span style="color: rgba(255,255,255,0.9); font-size: 12px;">— Trusted Game Server Hosting Since 2012</span>\ | |||
</div>\ | |||
<div style="padding: 20px 25px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px;">\ | |||
<div style="flex: 1; min-width: 300px;">\ | |||
<div style="color: #ff6b35; font-size: 12px; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 6px; font-weight: 600;">Deploy Your ' + game.name + ' Server</div>\ | |||
<div style="color: white; font-size: 24px; font-weight: 700; margin-bottom: 10px;">' + game.name + ' Game Server Hosting</div>\ | |||
<div style="display: flex; flex-wrap: wrap; gap: 15px; color: rgba(255,255,255,0.85); font-size: 13px;">\ | |||
<span>✓ Instant Deployment</span>\ | |||
<span>✓ Custom Control Panel</span>\ | |||
<span>✓ Mod Support</span>\ | |||
<span>✓ DDoS Protection</span>\ | |||
</div>\ | |||
<div style="margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px;">\ | |||
<span style="background: rgba(255,107,53,0.2); color: #ff6b35; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;">9 Global Locations</span>\ | |||
<span style="background: rgba(46,204,113,0.2); color: #2ecc71; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;">24/7 Support</span>\ | |||
<span style="background: rgba(52,152,219,0.2); color: #3498db; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;">700+ Reviews</span>\ | |||
</div>\ | |||
</div>\ | |||
<div style="display: flex; flex-direction: column; gap: 10px; align-items: flex-end;">\ | |||
<a href="' + trackingUrl + '" style="background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%); color: white; padding: 14px 35px; border-radius: 6px; text-decoration: none; font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; gap: 10px; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(255,107,53,0.4);" onmouseover="this.style.transform=\'translateY(-2px)\';this.style.boxShadow=\'0 6px 20px rgba(255,107,53,0.5)\';" onmouseout="this.style.transform=\'translateY(0)\';this.style.boxShadow=\'0 4px 15px rgba(255,107,53,0.4)\';">\ | |||
Order Now\ | |||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M5 12h14M12 5l7 7-7 7"/></svg>\ | |||
</a>\ | |||
<span style="color: rgba(255,255,255,0.5); font-size: 11px;">Starting at $9.98/mo</span>\ | |||
</div>\ | |||
</div>\ | |||
</div>'; | |||
return banner; | return banner; | ||
} | } | ||
| Line 186: | Line 161: | ||
var banner = document.createElement('div'); | var banner = document.createElement('div'); | ||
banner.id = 'ss-game-banner'; | banner.id = 'ss-game-banner'; | ||
banner.style | banner.innerHTML = '\ | ||
<div style="background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); border-radius: 8px; padding: 0; margin: 0 0 20px 0; box-shadow: 0 4px 15px rgba(0,0,0,0.4); overflow: hidden; border: 1px solid #2a2a4a;">\ | |||
<div style="background: linear-gradient(90deg, #ff6b35 0%, #f7931e 100%); padding: 8px 20px; display: flex; align-items: center; gap: 10px;">\ | |||
<span style="color: white; font-weight: 700; font-size: 14px; letter-spacing: 0.5px;">SURVIVAL<span style="color: #1a1a2e;">●</span>SERVERS</span>\ | |||
<span style="color: rgba(255,255,255,0.9); font-size: 12px;">— Trusted Game Server Hosting Since 2012</span>\ | |||
</div>\ | |||
<div style="padding: 20px 25px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px;">\ | |||
<div style="flex: 1; min-width: 300px;">\ | |||
<div style="color: #ff6b35; font-size: 12px; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 6px; font-weight: 600;">Premium Game Server Hosting</div>\ | |||
<div style="color: white; font-size: 24px; font-weight: 700; margin-bottom: 10px;">100+ Games • Instant Setup • Global Network</div>\ | |||
<div style="display: flex; flex-wrap: wrap; gap: 15px; color: rgba(255,255,255,0.85); font-size: 13px;">\ | |||
<span>✓ Custom Control Panel</span>\ | |||
<span>✓ Full FTP Access</span>\ | |||
<span>✓ Mod Support</span>\ | |||
<span>✓ DDoS Protection</span>\ | |||
</div>\ | |||
<div style="margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px;">\ | |||
<span style="background: rgba(255,107,53,0.2); color: #ff6b35; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;">9 Global Locations</span>\ | |||
<span style="background: rgba(46,204,113,0.2); color: #2ecc71; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;">24/7 Support</span>\ | |||
<span style="background: rgba(52,152,219,0.2); color: #3498db; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;">700+ Reviews</span>\ | |||
</div>\ | |||
</div>\ | |||
<div style="display: flex; flex-direction: column; gap: 10px; align-items: flex-end;">\ | |||
<a href="' + trackingUrl + '" style="background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%); color: white; padding: 14px 35px; border-radius: 6px; text-decoration: none; font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; gap: 10px; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(255,107,53,0.4);" onmouseover="this.style.transform=\'translateY(-2px)\';this.style.boxShadow=\'0 6px 20px rgba(255,107,53,0.5)\';" onmouseout="this.style.transform=\'translateY(0)\';this.style.boxShadow=\'0 4px 15px rgba(255,107,53,0.4)\';">\ | |||
Browse Games\ | |||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M5 12h14M12 5l7 7-7 7"/></svg>\ | |||
</a>\ | |||
<span style="color: rgba(255,255,255,0.5); font-size: 11px;">Starting at $5.98/mo</span>\ | |||
</div>\ | |||
</div>\ | |||
</div>'; | |||
return banner; | return banner; | ||
} | } | ||
function init() { | function init() { | ||
var pageTitle = document.title; | var pageTitle = document.title; | ||
if (pageTitle.indexOf('Main Page') !== -1) | if (pageTitle.indexOf('Main Page') !== -1) return; | ||
if (window.location.href.indexOf('Special:') !== -1) return; | |||
if (window.location.href.indexOf('Special:') !== -1) | |||
var pageName = getPageName(); | var pageName = getPageName(); | ||
var gameKey = detectGame(); | var gameKey = detectGame(); | ||
var banner | var banner = (gameKey && gameConfig[gameKey]) ? createGameBanner(gameKey, pageName) : createGenericBanner(pageName); | ||
if (!banner) return; | if (!banner) return; | ||
var contentDiv = document.getElementById('bodyContent'); | var contentDiv = document.getElementById('bodyContent'); | ||
if (contentDiv) | if (contentDiv) contentDiv.insertBefore(banner, contentDiv.firstChild); | ||
} | } | ||
if (document.readyState === 'loading') { | if (document.readyState === 'loading') { | ||
document.addEventListener('DOMContentLoaded', init); | document.addEventListener('DOMContentLoaded', init); | ||
Revision as of 15:15, 8 December 2025
/**
* SurvivalServers Wiki - Game Server Banner System
* Shows game-specific banners OR generic banner on all wiki pages
* Includes affiliate tracking: trckaff=3881, trckit=WIKI<PageName>
*/
(function() {
'use strict';
var TRACK_AFF_ID = '3881';
var MAX_TRCKIT_LENGTH = 41;
var gameConfig = {
'valheim': { name: 'Valheim', slug: 'valheim' },
'ark': { name: 'ARK: Survival Evolved', slug: 'ark' },
'arksurvivalascended': { name: 'ARK: Survival Ascended', slug: 'arksurvivalascended' },
'asa': { name: 'ARK: Survival Ascended', slug: 'arksurvivalascended' },
'rust': { name: 'Rust', slug: 'rust' },
'minecraft': { name: 'Minecraft', slug: 'minecraft' },
'palworld': { name: 'Palworld', slug: 'palworld' },
'dayz': { name: 'DayZ', slug: 'dayz' },
'conan': { name: 'Conan Exiles', slug: 'conanexiles' },
'7daystodie': { name: '7 Days to Die', slug: '7daystodie' },
'7days': { name: '7 Days to Die', slug: '7daystodie' },
'theforest': { name: 'The Forest', slug: 'theforest' },
'forest': { name: 'The Forest', slug: 'theforest' },
'sonsoftheforest': { name: 'Sons of the Forest', slug: 'sonsoftheforest' },
'sons of the forest': { name: 'Sons of the Forest', slug: 'sonsoftheforest' },
'terraria': { name: 'Terraria', slug: 'terraria' },
'projectzomboid': { name: 'Project Zomboid', slug: 'projectzomboid' },
'zomboid': { name: 'Project Zomboid', slug: 'projectzomboid' },
'enshrouded': { name: 'Enshrouded', slug: 'enshrouded' },
'satisfactory': { name: 'Satisfactory', slug: 'satisfactory' },
'v rising': { name: 'V Rising', slug: 'vrising' },
'vrising': { name: 'V Rising', slug: 'vrising' },
'aska': { name: 'ASKA', slug: 'aska' },
'unturned': { name: 'Unturned', slug: 'unturned' },
'factorio': { name: 'Factorio', slug: 'factorio' },
'csgo': { name: 'CS2', slug: 'csgo' },
'cs2': { name: 'CS2', slug: 'csgo' },
'counterstrike': { name: 'CS2', slug: 'csgo' },
'theisle': { name: 'The Isle', slug: 'theisle' },
'isle': { name: 'The Isle', slug: 'theisle' },
'squad': { name: 'Squad', slug: 'squad' },
'arma': { name: 'Arma 3', slug: 'arma3' },
'starbound': { name: 'Starbound', slug: 'starbound' },
'empyrion': { name: 'Empyrion', slug: 'empyrion' },
'pixark': { name: 'PixARK', slug: 'pixark' },
'dontstarve': { name: "Don't Starve Together", slug: 'dontstarve' },
"don't starve": { name: "Don't Starve Together", slug: 'dontstarve' },
'scum': { name: 'SCUM', slug: 'scum' },
'barotrauma': { name: 'Barotrauma', slug: 'barotrauma' },
'corekeeper': { name: 'Core Keeper', slug: 'corekeeper' },
'core keeper': { name: 'Core Keeper', slug: 'corekeeper' },
'stationeers': { name: 'Stationeers', slug: 'stationeers' },
'icarus': { name: 'Icarus', slug: 'icarus' },
'avorion': { name: 'Avorion', slug: 'avorion' },
'spaceengineers': { name: 'Space Engineers', slug: 'spaceengineers' },
'space engineers': { name: 'Space Engineers', slug: 'spaceengineers' },
'mordhau': { name: 'Mordhau', slug: 'mordhau' },
'hurtworld': { name: 'Hurtworld', slug: 'hurtworld' },
'miscreated': { name: 'Miscreated', slug: 'miscreated' },
'fivem': { name: 'FiveM', slug: 'fivem' },
'redm': { name: 'RedM', slug: 'redm' },
'assettocorsa': { name: 'Assetto Corsa', slug: 'assettocorsa' },
'assetto': { name: 'Assetto Corsa', slug: 'assettocorsa' },
'renown': { name: 'Renown', slug: 'renown' },
'brickadia': { name: 'Brickadia', slug: 'brickadia' },
'holdfast': { name: 'Holdfast: Nations At War', slug: 'holdfast' },
'left4dead': { name: 'Left 4 Dead 2', slug: 'left4dead2' },
'l4d2': { name: 'Left 4 Dead 2', slug: 'left4dead2' },
'deadmatter': { name: 'Dead Matter', slug: 'deadmatter' },
'soulmask': { name: 'Soulmask', slug: 'soulmask' },
'nightingale': { name: 'Nightingale', slug: 'nightingale' }
};
function getPageName() {
var urlParams = new URLSearchParams(window.location.search);
var title = urlParams.get('title');
if (!title) {
var path = window.location.pathname;
var match = path.match(/\/wiki\/(.+)$/);
if (match) title = decodeURIComponent(match[1]);
}
if (!title) {
var heading = document.getElementById('firstHeading');
if (heading) title = heading.textContent;
}
if (title) {
title = title.replace(/[^a-zA-Z0-9]/g, '_').replace(/_+/g, '_').substring(0, MAX_TRCKIT_LENGTH);
}
return title || 'Unknown';
}
function buildTrackingUrl(baseUrl, pageName) {
var separator = baseUrl.indexOf('?') === -1 ? '?' : '&';
return baseUrl + separator + 'trckaff=' + TRACK_AFF_ID + '&trckit=WIKI' + pageName;
}
function detectGame() {
var pageTitle = document.title.toLowerCase();
var bodyContent = document.getElementById('bodyContent');
var manualGame = document.querySelector('[data-ss-game]');
if (manualGame) return manualGame.getAttribute('data-ss-game').toLowerCase();
var content = bodyContent ? bodyContent.innerHTML : '';
var markerMatch = content.match(/<!--\s*SSGAME:\s*(\w+)\s*-->/i);
if (markerMatch) return markerMatch[1].toLowerCase();
var keywords = Object.keys(gameConfig).sort(function(a, b) { return b.length - a.length; });
for (var i = 0; i < keywords.length; i++) {
if (pageTitle.indexOf(keywords[i]) !== -1) return keywords[i];
}
return null;
}
function createGameBanner(gameKey, pageName) {
var game = gameConfig[gameKey];
if (!game) return null;
var trackingUrl = buildTrackingUrl('https://www.survivalservers.com/services/game_servers/' + game.slug + '/', pageName);
var banner = document.createElement('div');
banner.id = 'ss-game-banner';
banner.innerHTML = '\
<div style="background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); border-radius: 8px; padding: 0; margin: 0 0 20px 0; box-shadow: 0 4px 15px rgba(0,0,0,0.4); overflow: hidden; border: 1px solid #2a2a4a;">\
<div style="background: linear-gradient(90deg, #ff6b35 0%, #f7931e 100%); padding: 8px 20px; display: flex; align-items: center; gap: 10px;">\
<span style="color: white; font-weight: 700; font-size: 14px; letter-spacing: 0.5px;">SURVIVAL<span style="color: #1a1a2e;">●</span>SERVERS</span>\
<span style="color: rgba(255,255,255,0.9); font-size: 12px;">— Trusted Game Server Hosting Since 2012</span>\
</div>\
<div style="padding: 20px 25px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px;">\
<div style="flex: 1; min-width: 300px;">\
<div style="color: #ff6b35; font-size: 12px; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 6px; font-weight: 600;">Deploy Your ' + game.name + ' Server</div>\
<div style="color: white; font-size: 24px; font-weight: 700; margin-bottom: 10px;">' + game.name + ' Game Server Hosting</div>\
<div style="display: flex; flex-wrap: wrap; gap: 15px; color: rgba(255,255,255,0.85); font-size: 13px;">\
<span>✓ Instant Deployment</span>\
<span>✓ Custom Control Panel</span>\
<span>✓ Mod Support</span>\
<span>✓ DDoS Protection</span>\
</div>\
<div style="margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px;">\
<span style="background: rgba(255,107,53,0.2); color: #ff6b35; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;">9 Global Locations</span>\
<span style="background: rgba(46,204,113,0.2); color: #2ecc71; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;">24/7 Support</span>\
<span style="background: rgba(52,152,219,0.2); color: #3498db; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;">700+ Reviews</span>\
</div>\
</div>\
<div style="display: flex; flex-direction: column; gap: 10px; align-items: flex-end;">\
<a href="' + trackingUrl + '" style="background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%); color: white; padding: 14px 35px; border-radius: 6px; text-decoration: none; font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; gap: 10px; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(255,107,53,0.4);" onmouseover="this.style.transform=\'translateY(-2px)\';this.style.boxShadow=\'0 6px 20px rgba(255,107,53,0.5)\';" onmouseout="this.style.transform=\'translateY(0)\';this.style.boxShadow=\'0 4px 15px rgba(255,107,53,0.4)\';">\
Order Now\
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M5 12h14M12 5l7 7-7 7"/></svg>\
</a>\
<span style="color: rgba(255,255,255,0.5); font-size: 11px;">Starting at $9.98/mo</span>\
</div>\
</div>\
</div>';
return banner;
}
function createGenericBanner(pageName) {
var trackingUrl = buildTrackingUrl('https://www.survivalservers.com/', pageName);
var banner = document.createElement('div');
banner.id = 'ss-game-banner';
banner.innerHTML = '\
<div style="background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); border-radius: 8px; padding: 0; margin: 0 0 20px 0; box-shadow: 0 4px 15px rgba(0,0,0,0.4); overflow: hidden; border: 1px solid #2a2a4a;">\
<div style="background: linear-gradient(90deg, #ff6b35 0%, #f7931e 100%); padding: 8px 20px; display: flex; align-items: center; gap: 10px;">\
<span style="color: white; font-weight: 700; font-size: 14px; letter-spacing: 0.5px;">SURVIVAL<span style="color: #1a1a2e;">●</span>SERVERS</span>\
<span style="color: rgba(255,255,255,0.9); font-size: 12px;">— Trusted Game Server Hosting Since 2012</span>\
</div>\
<div style="padding: 20px 25px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px;">\
<div style="flex: 1; min-width: 300px;">\
<div style="color: #ff6b35; font-size: 12px; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 6px; font-weight: 600;">Premium Game Server Hosting</div>\
<div style="color: white; font-size: 24px; font-weight: 700; margin-bottom: 10px;">100+ Games • Instant Setup • Global Network</div>\
<div style="display: flex; flex-wrap: wrap; gap: 15px; color: rgba(255,255,255,0.85); font-size: 13px;">\
<span>✓ Custom Control Panel</span>\
<span>✓ Full FTP Access</span>\
<span>✓ Mod Support</span>\
<span>✓ DDoS Protection</span>\
</div>\
<div style="margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px;">\
<span style="background: rgba(255,107,53,0.2); color: #ff6b35; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;">9 Global Locations</span>\
<span style="background: rgba(46,204,113,0.2); color: #2ecc71; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;">24/7 Support</span>\
<span style="background: rgba(52,152,219,0.2); color: #3498db; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;">700+ Reviews</span>\
</div>\
</div>\
<div style="display: flex; flex-direction: column; gap: 10px; align-items: flex-end;">\
<a href="' + trackingUrl + '" style="background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%); color: white; padding: 14px 35px; border-radius: 6px; text-decoration: none; font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; gap: 10px; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(255,107,53,0.4);" onmouseover="this.style.transform=\'translateY(-2px)\';this.style.boxShadow=\'0 6px 20px rgba(255,107,53,0.5)\';" onmouseout="this.style.transform=\'translateY(0)\';this.style.boxShadow=\'0 4px 15px rgba(255,107,53,0.4)\';">\
Browse Games\
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M5 12h14M12 5l7 7-7 7"/></svg>\
</a>\
<span style="color: rgba(255,255,255,0.5); font-size: 11px;">Starting at $5.98/mo</span>\
</div>\
</div>\
</div>';
return banner;
}
function init() {
var pageTitle = document.title;
if (pageTitle.indexOf('Main Page') !== -1) return;
if (window.location.href.indexOf('Special:') !== -1) return;
var pageName = getPageName();
var gameKey = detectGame();
var banner = (gameKey && gameConfig[gameKey]) ? createGameBanner(gameKey, pageName) : createGenericBanner(pageName);
if (!banner) return;
var contentDiv = document.getElementById('bodyContent');
if (contentDiv) contentDiv.insertBefore(banner, contentDiv.firstChild);
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();