Outpost with Mini Boss Map v2

Embeds a mini boss map into the Outpost page’s left margin cell

目前為 2025-04-28 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Outpost with Mini Boss Map v2
// @namespace    Zega
// @version      1.1
// @description  Embeds a mini boss map into the Outpost page’s left margin cell
// @match        https://fairview.deadfrontier.com/onlinezombiemmo/index.php*
// @grant        none
// @run-at       document-idle
// ==/UserScript==

(function() {
  'use strict';

  // Wait for everything to load
  window.addEventListener('load', () => {
    // Find the left-margin <td> by its background image URL
    const allTds = document.querySelectorAll('td.design2010');
    let mapTd = null;
    allTds.forEach(td => {
      const bg = window.getComputedStyle(td).backgroundImage;
      if (bg && bg.includes('left_margin.jpg')) {
        mapTd = td;
      }
    });

    if (!mapTd) {
      console.warn('Mini Boss Map: could not find left-margin <td>');
      return;
    }

    // Make sure children can be absolutely positioned
    mapTd.style.position = 'relative';

    // Create and style the iframe
    const iframe = document.createElement('iframe');
    iframe.src = 'https://www.dfprofiler.com/bossmap';
    Object.assign(iframe.style, {
      position:        'absolute',
      top:             '10px',
      right:           '10px',
      width:           '750px',
      height:          '1050px',
      border:          '2px solid #444',
      borderRadius:    '8px',
      boxShadow:       '0 0 8px rgba(0,0,0,0.5)',
      backgroundColor: '#fff',
      zIndex:          '999'
    });

    mapTd.appendChild(iframe);
    console.log('Mini Boss Map: iframe appended');
  });
})();