☰

AOF DoubleList Enhancer — Suite

Listing enhancer + filter options for doublelist.com city pages. Free drops: t.me/aofmainhub · Packs & VIP: t.me/aof_chat_farm_bot?start=c1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         AOF DoubleList Enhancer — Suite
// @namespace    https://t.me/aofmainhub
// @version      1.0.2
// @license      MIT
// @author       AOF Network
// @description  Listing enhancer + filter options for doublelist.com city pages. Free drops: t.me/aofmainhub · Packs & VIP: t.me/aof_chat_farm_bot?start=c1
// @homepageURL  https://powercore.app
// @supportURL   https://t.me/aof_chat_farm_bot
// @match        *://doublelist.com/city/*
// @match        *://doublelist.com/city/*/*
// @match        *://www.doublelist.com/city/*
// @match        *://www.doublelist.com/city/*/*
// @grant        GM.getValue
// @grant        GM.setValue
// @grant        GM_getValue
// @grant        GM_setValue
// @run-at       document-idle
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js
// ==/UserScript==
(function (root) {
  'use strict';

  const STORAGE_PREFIX = 'tbccAofPromoDismissed:';
  const STYLE_ID = 'tbcc-aof-promo-chip-css';
  const THEME_STYLE_ID = 'tbcc-aof-ui-theme-css';

  /** Single CTA table — Packs & VIP locked to farm1 ?start=c1 */
  const DEFAULT_LINKS = [
    { href: 'https://t.me/aofmainhub', label: 't.me/aofmainhub' },
    { href: 'https://t.me/aof_chat_farm_bot?start=c1', label: 'Packs & VIP' },
    { href: 'https://t.me/aof_lootgod_bot?start=loot_free', label: 'Free loot roll' },
  ];

  const AOF_UI_CSS = `
:root, .aof-ui, [data-aof-ui] {
  --aof-bg: #0a0a0b;
  --aof-bg-elevated: #121214;
  --aof-bg-overlay: #1a1a1e;
  --aof-chrome: #2a2a30;
  --aof-fg: #f4f4f5;
  --aof-fg-muted: #a1a1aa;
  --aof-accent: #fb7185;
  --aof-accent-link: #fda4af;
  --aof-radius: 8px;
  --aof-font-ui: Inter, "DM Sans", Roboto, system-ui, sans-serif;
  --aof-font-size: 12px;
  --aof-shadow: 0 4px 20px rgba(0,0,0,.45);
  --pc-bg: var(--aof-bg);
  --pc-bg-elevated: var(--aof-bg-elevated);
  --pc-bg-overlay: var(--aof-bg-overlay);
  --pc-chrome: var(--aof-chrome);
  --pc-fg: var(--aof-fg);
  --pc-fg-muted: var(--aof-fg-muted);
  --pc-accent-focus: var(--aof-accent);
  --pc-radius: var(--aof-radius);
  --pc-font-ui: var(--aof-font-ui);
  --pc-font-size-sm: var(--aof-font-size);
}
.aof-ui, [data-aof-ui] {
  font-family: var(--aof-font-ui);
  font-size: var(--aof-font-size);
  color: var(--aof-fg);
  box-sizing: border-box;
}
.aof-ui button, [data-aof-ui] button,
.aof-ui a.aof-ui-btn, [data-aof-ui] a.aof-ui-btn {
  font-family: inherit;
  font-size: var(--aof-font-size);
  color: var(--aof-fg);
  background: var(--aof-bg-overlay);
  border: 1px solid var(--aof-chrome);
  border-radius: var(--aof-radius);
  padding: 6px 10px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.25;
}
.aof-ui button:hover, [data-aof-ui] button:hover,
.aof-ui a.aof-ui-btn:hover, [data-aof-ui] a.aof-ui-btn:hover {
  border-color: var(--aof-accent);
  color: var(--aof-accent);
}
.aof-ui a, [data-aof-ui] a {
  color: var(--aof-accent-link);
  text-decoration: none;
}
.aof-ui a:hover, [data-aof-ui] a:hover { text-decoration: underline; }
[data-aof-ui="panel"] {
  background: var(--aof-bg-elevated);
  border: 1px solid var(--aof-chrome);
  border-radius: var(--aof-radius);
  box-shadow: var(--aof-shadow);
  color: var(--aof-fg);
  font-family: var(--aof-font-ui);
}
`;

  const CHIP_CSS = `
#tbcc-aof-promo-chip-root{
  position:fixed;inset:0;z-index:2147483638;pointer-events:none;
}
#tbcc-aof-promo-chip-root .tbcc-aof-promo-chip{
  position:fixed;bottom:12px;left:50%;transform:translateX(-50%);z-index:2147483639;
  max-width:min(96vw,520px);padding:8px 14px;border-radius:var(--aof-radius,8px);
  background:rgba(10,10,12,.94);color:var(--aof-fg,#f4f4f5);
  font:var(--aof-font-size,12px)/1.45 var(--aof-font-ui,Inter,"DM Sans",Roboto,system-ui,sans-serif);
  box-shadow:var(--aof-shadow,0 4px 20px rgba(0,0,0,.45));text-align:center;pointer-events:auto;
  border:1px solid var(--aof-chrome,#2a2a30);
}
#tbcc-aof-promo-chip-root .tbcc-aof-promo-chip a{
  color:var(--aof-accent-link,#fda4af);text-decoration:none;pointer-events:auto;cursor:pointer;
}
#tbcc-aof-promo-chip-root .tbcc-aof-promo-chip a:hover{text-decoration:underline;color:var(--aof-accent,#fb7185)}
#tbcc-aof-promo-chip-root .tbcc-aof-promo-chip button{
  margin-left:8px;background:transparent;border:0;color:inherit;cursor:pointer;opacity:.7;font-size:14px;line-height:1;
}
#tbcc-aof-promo-chip-root .tbcc-aof-promo-chip button:hover{opacity:1}
`;

  function ensureTheme() {
    if (typeof document === 'undefined') return false;
    if (root.TBCCThemeChrome && typeof root.TBCCThemeChrome.ensureStyles === 'function') {
      try {
        root.TBCCThemeChrome.ensureStyles();
      } catch (_) {}
    }
    if (!document.getElementById(THEME_STYLE_ID)) {
      const s = document.createElement('style');
      s.id = THEME_STYLE_ID;
      s.textContent = AOF_UI_CSS;
      (document.head || document.documentElement).appendChild(s);
    }
    return true;
  }

  /** Panel roots only — never host-page chrome. */
  const PANEL_SELECTOR = [
    '[data-aof-ui="panel"]',
    '.tbcc-pc-chrome',
    '.tbcc-os-root',
    '.tbcc-pc-quick-search',
    '.tbcc-pc-sponsor',
    '[id^="tbcc-"][id$="-panel"]',
    '[id^="tbcc-"][id$="-modal"]',
    '[id^="tbcc-"][id$="-overlay"]',
    '[id^="tbcc-"][id$="-rail"]',
    '[id^="tbcc-"][id$="-dock"]',
    '[id^="tbcc-"][id$="-toolbar"]',
    '[id^="tbcc-"][id$="-settings"]',
    '[id="tbcc-bunkr-index-sort"]',
    '[id="tbcc-bunkr-promo"]',
    '[id="tbcc-xv-friend-log"]',
    '[id="tbcc-rg-dl-dock"]',
    '[id="tbcc-x-fab"]',
    '[class*="tbcc-"][class*="panel"]',
    '[class*="tbcc-"][class*="modal"]',
    '[class*="tbcc-"][class*="overlay"]',
    '[class*="tbcc-"][class*="rail"]',
    '[class*="tbcc-"][class*="dock"]',
    '[class*="tbcc-"][class*="toolbar"]',
    '[class*="tbcc-"][class*="settings"]',
    '[class*="tbcc-suite-"]',
  ].join(',');

  let paintObserver = null;

  function applyUi(el, kind) {
    ensureTheme();
    if (!el || !el.classList) return el;
    const role = kind || el.getAttribute('data-aof-ui') || 'panel';
    el.classList.add('aof-ui');
    el.setAttribute('data-aof-ui', role);
    return el;
  }

  function isPaintablePanel(el) {
    if (!el || el.nodeType !== 1) return false;
    if (el.matches?.('style,script,link,meta,br,svg,path,img,video,source')) return false;
    if (el.id === 'tbcc-aof-promo-chip-root') return false;
    if (el.getAttribute('data-aof-ui') === 'promo-chip') return false;
    try {
      return el.matches(PANEL_SELECTOR);
    } catch (_) {
      return false;
    }
  }

  function paintNode(el) {
    if (!isPaintablePanel(el)) return null;
    if (el.getAttribute('data-aof-ui') === 'panel') return el;
    return applyUi(el, 'panel');
  }

  function paintAll(root) {
    ensureTheme();
    const scope = root && root.querySelectorAll ? root : document;
    let n = 0;
    try {
      scope.querySelectorAll(PANEL_SELECTOR).forEach((el) => {
        if (paintNode(el)) n += 1;
      });
    } catch (_) {}
    if (root && root.nodeType === 1 && isPaintablePanel(root) && paintNode(root)) n += 1;
    return n;
  }

  function watch(root) {
    if (typeof MutationObserver === 'undefined' || typeof document === 'undefined') return null;
    ensureTheme();
    paintAll(root || document);
    if (paintObserver) return paintObserver;
    const target = root && root.nodeType === 1 ? root : document.documentElement;
    paintObserver = new MutationObserver((mutations) => {
      for (const m of mutations) {
        for (const node of m.addedNodes || []) {
          if (node.nodeType !== 1) continue;
          paintNode(node);
          try {
            node.querySelectorAll?.(PANEL_SELECTOR)?.forEach(paintNode);
          } catch (_) {}
        }
      }
    });
    paintObserver.observe(target, { childList: true, subtree: true });
    return paintObserver;
  }

  function ensureStyles() {
    ensureTheme();
    if (document.getElementById(STYLE_ID)) return;
    const s = document.createElement('style');
    s.id = STYLE_ID;
    s.textContent = CHIP_CSS;
    (document.head || document.documentElement).appendChild(s);
  }

  function normalizeSiteId(raw) {
    return String(raw || 'default')
      .trim()
      .toLowerCase()
      .replace(/[^\w-]+/g, '-')
      .slice(0, 32) || 'default';
  }

  function isDismissed(siteId) {
    try {
      return localStorage.getItem(STORAGE_PREFIX + siteId) === '1';
    } catch (_) {
      return false;
    }
  }

  function dismiss(siteId) {
    try {
      localStorage.setItem(STORAGE_PREFIX + siteId, '1');
    } catch (_) {}
  }

  function openDirect(href) {
    const url = String(href || '').trim();
    if (!url) return;
    try {
      const opened = window.open(url, '_blank', 'noopener,noreferrer');
      if (!opened) window.location.assign(url);
    } catch (_) {
      try {
        window.location.assign(url);
      } catch (_) {}
    }
  }

  function makeLink(href, label) {
    const a = document.createElement('a');
    a.href = href;
    a.textContent = label;
    a.target = '_blank';
    a.rel = 'noopener noreferrer';
    a.addEventListener('click', (e) => {
      e.preventDefault();
      e.stopPropagation();
      openDirect(href);
    });
    return a;
  }

  function appendText(parent, text) {
    if (text == null || text === '') return;
    parent.appendChild(document.createTextNode(String(text)));
  }

  function mount(opts) {
    if (!document.body) return;
    const siteId = normalizeSiteId(opts && opts.siteId);
    const elId = `tbcc-aof-promo-${siteId}`;
    if (document.getElementById(elId) || isDismissed(siteId)) return;

    ensureStyles();
    let rootEl = document.getElementById('tbcc-aof-promo-chip-root');
    if (!rootEl) {
      rootEl = document.createElement('div');
      rootEl.id = 'tbcc-aof-promo-chip-root';
      document.body.appendChild(rootEl);
    }

    const lead = String((opts && opts.lead) || 'More on AOF').trim();
    let links = Array.isArray(opts && opts.links) ? opts.links.slice() : DEFAULT_LINKS.slice(0, 2);
    const includeLoot = !opts || opts.includeLoot !== false;
    if (includeLoot && links.length <= 2) {
      links = links.concat(DEFAULT_LINKS.slice(2));
    }
    const filtered = links.filter((l) => l && l.href && l.label);

    const el = document.createElement('div');
    el.id = elId;
    el.className = 'tbcc-aof-promo-chip aof-ui';
    el.setAttribute('data-aof-ui', 'promo-chip');

    appendText(el, lead);
    filtered.forEach((l, i) => {
      appendText(el, i === 0 ? ' · ' : ' · ');
      el.appendChild(makeLink(String(l.href), String(l.label)));
    });

    const btn = document.createElement('button');
    btn.type = 'button';
    btn.setAttribute('aria-label', 'Dismiss');
    btn.title = 'Dismiss';
    btn.textContent = '×';
    appendText(el, ' ');
    el.appendChild(btn);
    btn.addEventListener('click', (e) => {
      e.stopPropagation();
      dismiss(siteId);
      el.remove();
      if (rootEl && !rootEl.children.length) rootEl.remove();
    });

    rootEl.appendChild(el);
  }

  function unmount(siteId) {
    const id = normalizeSiteId(siteId);
    document.getElementById(`tbcc-aof-promo-${id}`)?.remove();
    const rootEl = document.getElementById('tbcc-aof-promo-chip-root');
    if (rootEl && !rootEl.children.length) rootEl.remove();
  }

  function unmountAll() {
    document.querySelectorAll('[id^="tbcc-aof-promo-"]').forEach((n) => n.remove());
    document.getElementById('tbcc-aof-promo-chip-root')?.remove();
  }

  root.TBCCAofPromoChip = {
    mount,
    unmount,
    unmountAll,
    makeLink,
    openDirect,
    ensureTheme,
    applyUi,
    paintAll,
    watch,
    DEFAULT_LINKS,
  };
  root.TBCCAofUi = {
    ensureTheme,
    applyUi,
    paintAll,
    paintNode,
    watch,
    PANEL_SELECTOR,
    STYLE_ID: THEME_STYLE_ID,
  };
})(typeof globalThis !== 'undefined' ? globalThis : window);


/* ---- feature: enhancer ---- */
(function __tbccFeature_enhancer() {
'use strict';
if (window.__TBCC_FEATURE_enhancer__) return;
window.__TBCC_FEATURE_enhancer__ = true;
try {
(function () {
  'use strict';

  const THROTTLE_MS = 1200;
  const BOOT_DELAY_MS = 1500;

  function enhanceListings() {
    let matchnum = 0;

    $('a.item').each(function () {
      const $a = $(this);
      const url = $a.attr('href');
      if (!url || !/\/posts\//.test(url) || $a.find('.orn').length === 0) {
        return;
      }
      if ($a.data('dl-enhancer-done')) {
        return;
      }
      $a.data('dl-enhancer-done', true);

      $a.parent().css('flex-wrap', 'wrap');

      const slot = matchnum++;
      setTimeout(function () {
        $.ajax({
          url: url,
          cache: true,
          success: function (response) {
            const thumbs = $(response).find('.gallery-thumbs .swiper-slide');
            if (thumbs.length === 0) {
              return;
            }

            const imgdiv = $('<div style="flex-basis:100%;"></div>');
            $a.append(imgdiv);

            thumbs.each(function () {
              const ohtml = $(this).prop('outerHTML');
              if (!ohtml || !/background-image/.test(ohtml)) {
                return;
              }

              const thumb = $(ohtml);
              thumb.css({
                'background-size': 'cover',
                'background-position': 'center',
                height: '60px',
                width: '60px',
                display: 'inline-block',
                margin: '10px',
              });
              imgdiv.append(thumb);
            });
          },
          error: function (xhr) {
            console.warn('[DoubleList Enhancer] ajax failed', url, xhr.status);
          },
        });
      }, THROTTLE_MS * slot);
    });
  }

  setTimeout(enhanceListings, BOOT_DELAY_MS);

  // Re-run if listings load after idle (infinite scroll / SPA-ish updates)
  const obs = new MutationObserver(function () {
    enhanceListings();
  });
  obs.observe(document.body, { childList: true, subtree: true });
})();
} catch (err) {
  try { console.warn('[TBCC] feature enhancer failed', err); } catch (_) {}
}
})();

/* ---- feature: filter-options ---- */
(function __tbccFeature_filter_options() {
'use strict';
if (window.__TBCC_FEATURE_filter_options__) return;
window.__TBCC_FEATURE_filter_options__ = true;
try {
(async () => {
  'use strict';

  const mainContainer = $('.container')[0];
  if (!mainContainer) {
    console.warn('[Doublelist Filter Options] .container not found');
    return;
  }

  const filterHTML =
    '<div class="container" id="filteroptions"><h2>Filters:</h2><br/>' +
    '<div><input name="pics" type="checkbox" id="pics" />&nbsp;<label for="pics">Require Picture</label></div>' +
    '<div><input name="minage" type="number" value="18" id="minage" />&nbsp;<label for="minage">Min Age</label></div>' +
    '<div><input name="maxage" type="number" value="99" id="maxage" />&nbsp;<label for="maxage">Max Age</label></div>' +
    '<div><input name="blocklist" type="text" value="" id="blocklist" />&nbsp;<label for="blocklist">Blocked terms (in title)</label></div>' +
    '<div><input name="blocklist2" type="text" value="" id="blocklist2" />&nbsp;<label for="blocklist2">Blocked terms (in location)</label></div>' +
    '</div>';

  mainContainer.insertAdjacentHTML('afterbegin', filterHTML);

  const parseTerms = (raw) =>
    String(raw || '')
      .split(/[\s,;]+/)
      .map((t) => t.trim())
      .filter(Boolean);

  const updatematches = () => {
    $('.list').hide();

    if ($('#filteroptions #pics').is(':checked')) {
      $('.list:has(.orn)').show();
    } else {
      $('.list').show();
    }

    const minage = Math.max(18, parseInt($('#filteroptions #minage').val(), 10) || 18);
    const maxage = Math.max(minage, parseInt($('#filteroptions #maxage').val(), 10) || 99);
    const blocklist = parseTerms($('#filteroptions #blocklist').val());
    const blocklist2 = parseTerms($('#filteroptions #blocklist2').val());

    $('.list').each(function () {
      const $post = $(this);
      const spans = $post.children('a').children('span');
      let age = -1;

      if (spans.length > 2) {
        age = parseInt(spans[2].innerText, 10);
        if (Number.isNaN(age)) age = -1;
      }

      if (age < minage || age > maxage) {
        $post.hide();
        return;
      }

      const title = spans[0] ? spans[0].innerText.toLowerCase() : '';
      const location = spans[1] ? spans[1].innerText.toLowerCase() : '';

      if (blocklist.some((block) => title.includes(block.toLowerCase()))) {
        $post.hide();
        return;
      }

      if (blocklist2.some((block) => location.includes(block.toLowerCase()))) {
        $post.hide();
      }
    });

    void GM.setValue('minage', minage);
    void GM.setValue('maxage', maxage);
    void GM.setValue('pics', $('#filteroptions #pics').is(':checked'));
    void GM.setValue('blocklist', $('#filteroptions #blocklist').val());
    void GM.setValue('blocklist2', $('#filteroptions #blocklist2').val());
  };

  $('#filteroptions #pics').prop('checked', await GM.getValue('pics', false));
  $('#filteroptions #minage').val(await GM.getValue('minage', 18));
  $('#filteroptions #maxage').val(await GM.getValue('maxage', 99));
  $('#filteroptions #blocklist').val(await GM.getValue('blocklist', ''));
  $('#filteroptions #blocklist2').val(await GM.getValue('blocklist2', ''));

  $('#filteroptions #pics').on('change', updatematches);
  $('#filteroptions #minage').on('change input', updatematches);
  $('#filteroptions #maxage').on('change input', updatematches);
  $('#filteroptions #blocklist').on('change input', updatematches);
  $('#filteroptions #blocklist2').on('change input', updatematches);

  updatematches();
})();
} catch (err) {
  try { console.warn('[TBCC] feature filter_options failed', err); } catch (_) {}
}
})();

/* TBCC doublelist_enhancer — boot */
(function () {
  'use strict';
  function mountPromo() {
    try {
      globalThis.TBCCAofUi?.ensureTheme?.();
      globalThis.TBCCAofPromoChip?.mount?.({ siteId: 'doublelist', lead: 'Explore AOF' });
      globalThis.TBCCAofUi?.paintAll?.();
      globalThis.TBCCAofUi?.watch?.();
    } catch (_) {}
  }
  if (document.body) mountPromo();
  else document.addEventListener('DOMContentLoaded', mountPromo, { once: true });
})();