Outpost with Mini Boss Map v2

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

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

// ==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');
  });
})();