Mini Boss Map embed + DFProfiler (Auto GPS tab,Auto disabe Last Cycle, Scroll preserve on page refresh), Open Cell map Ctrl+Click with info while inside the deadfrontier website.
// ==UserScript==
// @name Dead Frontier + DFProfiler Bossmap Enhanced
// @namespace Dead Frontier + DFProfiler Bossmap Enhanced
// @version 1.1
// @description Mini Boss Map embed + DFProfiler (Auto GPS tab,Auto disabe Last Cycle, Scroll preserve on page refresh), Open Cell map Ctrl+Click with info while inside the deadfrontier website.
// @author Zega, Runonstof, Cezinha
// @match https://fairview.deadfrontier.com/onlinezombiemmo/index.php*
// @match https://fairview.deadfrontier.com/onlinezombiemmo/DF3D*
// @match https://*.dfprofiler.com/profile/view/*
// @match https://*.dfprofiler.com/bossmap
// @icon https://www.dfprofiler.com/images/favicon-32x32.png
// @grant unsafeWindow
// @run-at document-idle
// ==/UserScript==
(function () {
'use strict';
const url = location.href.toLowerCase();
/* ============================================================
PART 1 — MINI BOSS MAP CONTAINER (GAME PAGE)
============================================================ */
if (url.includes('deadfrontier.com') && !url.includes('dfprofiler')) {
if (document.getElementById('df-mini-bossmap')) return;
let playerId = localStorage.getItem('dfProfilerPlayerId');
if (!playerId) {
playerId = prompt('Enter DFProfiler Player ID:', '8119603');
if (!playerId || !/^\d+$/.test(playerId)) return;
localStorage.setItem('dfProfilerPlayerId', playerId);
}
const profileUrl = 'https://www.dfprofiler.com/profile/view/' + playerId;
const container = document.createElement('div');
container.id = 'df-mini-bossmap';
Object.assign(container.style, {
position: 'fixed',
top: '1.2vh',
left: '50%',
transform: 'translateX(-50%)',
zIndex: 99999,
background: '#111',
border: '2px solid #444',
borderRadius: '8px',
display: 'flex',
flexDirection: 'column'
});
const btnBar = document.createElement('div');
btnBar.style.padding = '6px';
btnBar.style.textAlign = 'center';
const toggleBtn = document.createElement('button');
const changeIdBtn = document.createElement('button');
toggleBtn.textContent = 'Hide Map';
changeIdBtn.textContent = 'Change ID';
[toggleBtn, changeIdBtn].forEach(b => {
Object.assign(b.style, {
margin: '3px',
background: '#222',
color: '#ffd700',
border: 'none',
padding: '6px',
cursor: 'pointer'
});
});
btnBar.append(toggleBtn, changeIdBtn);
container.appendChild(btnBar);
let iframe = null;
function createIframe() {
iframe = document.createElement('iframe');
iframe.src = profileUrl;
iframe.loading = 'lazy';
Object.assign(iframe.style, {
width: '80vw',
maxWidth: '1400px',
height: 'calc(100vh - 70px)',
border: 'none'
});
container.appendChild(iframe);
}
function destroyIframe() {
if (iframe) {
iframe.src = 'about:blank';
iframe.remove();
iframe = null;
}
}
function setHidden() {
destroyIframe();
toggleBtn.textContent = 'Show Map';
localStorage.setItem('bossMapHidden', 'true');
}
function setVisible() {
if (!iframe) createIframe();
toggleBtn.textContent = 'Hide Map';
localStorage.setItem('bossMapHidden', 'false');
}
toggleBtn.onclick = () =>
iframe ? setHidden() : setVisible();
changeIdBtn.onclick = () => {
const id = prompt('New Player ID:', playerId);
if (!id || !/^\d+$/.test(id)) return;
localStorage.setItem('dfProfilerPlayerId', id);
location.reload();
};
document.body.appendChild(container);
localStorage.getItem('bossMapHidden') === 'true'
? setHidden()
: setVisible();
}
/* ============================================================
PART 2 — DFPROFILER OPTIMIZATIONS (IFRAME ONLY)
============================================================ */
if (url.includes('dfprofiler.com') && window.self !== window.top) {
let paused = false;
window.addEventListener('message', e => {
paused = e.data?.action === 'pause';
});
/* ----- Last Cycle OFF (Idle) ----- */
function disableLastCycle() {
if (paused || document.hidden) return;
const btn = document.getElementById('showLast');
if (btn && btn.textContent.includes('[Yes]')) btn.click();
}
/* ----- GPS Tab Auto (Idle) ----- */
function openGPS() {
if (paused || document.hidden) return;
document.querySelector('[href="#view-gps"]')?.click();
}
requestIdleCallback(disableLastCycle, { timeout: 2000 });
requestIdleCallback(openGPS, { timeout: 2000 });
/* ----- Preserve Scroll ----- */
const KEY = 'df_scroll';
const saved = sessionStorage.getItem(KEY);
if (saved) requestAnimationFrame(() => scrollTo(0, +saved));
let ticking = false;
addEventListener('scroll', () => {
if (!ticking) {
requestAnimationFrame(() => {
sessionStorage.setItem(KEY, scrollY);
ticking = false;
});
ticking = true;
}
});
}
/* ============================================================
PART 3 — CTRL + CLICK CELL MAP
============================================================ */
if (url.includes('dfprofiler.com')) {
const style = document.createElement('style');
style.textContent = `
td.coord:hover { cursor:pointer; opacity:.5 }
#df-cell-popup {
position:fixed; top:8vh; left:50%;
transform:translateX(-50%);
background:#111; border:2px solid #444;
border-radius:8px; padding:10px;
z-index:100000; color:#eee;
max-width:90vw;
}
#df-cell-popup h3 {
margin:0 0 6px; color:#ffd700; text-align:center;
}
#df-cell-popup img { max-width:100%; border-radius:6px }
`;
document.head.appendChild(style);
let popup = null;
function closePopup() {
popup?.remove();
popup = null;
removeEventListener('mousedown', outside, true);
}
function outside(e) {
if (popup && !popup.contains(e.target)) closePopup();
}
unsafeWindow.addEventListener(
'click',
e => {
if (!e.ctrlKey) return;
const cell = e.target.closest('td.coord');
if (!cell) return;
e.preventDefault();
e.stopPropagation();
closePopup();
const x = [...cell.classList].find(c => c.startsWith('x'))?.slice(1);
const y = [...cell.classList].find(c => c.startsWith('y'))?.slice(1);
const bosses = cell.dataset.title
? cell.dataset.title.split(/<br>|,/).map(b => b.trim())
: [];
popup = document.createElement('div');
popup.id = 'df-cell-popup';
popup.innerHTML = `
<h3>Cell X:${x} | Y:${y}</h3>
${bosses.length ? `<ul>${bosses.map(b => `<li>${b}</li>`).join('')}</ul>` : '<div>No bosses reported</div>'}
<img src="https://deadfrontier.info/map/Fairview_${x}x${y}.png">
`;
document.body.appendChild(popup);
addEventListener('mousedown', outside, true);
},
true
);
}
})();