你正在訪問的內容是外部程式的映像位址,僅用於使用者加速訪問,本站無法保證其可靠性。當前的連結位址(單點即可複製)為 https://greasyfork.org.cn/zh-CN/scripts/540778-torn-blackjack-assist/discussions/309426,源站連結 點此以跳轉

Torn Blackjack Assist

Displays real-time basic strategy advice for Blackjack on both desktop and Torn PDA.

< 脚本 Torn Blackjack Assist 的反馈

评价:好评 - 脚本运行良好

§
发布于:2025-09-24

Fixing Blackjack Overlay Position

Fixing Blackjack Overlay Position


Right now the overlay is made draggable with makeDraggable(),
but if you want it fixed (e.g. always at the top of the screen or directly above
.blackjack-wrap), we can strip out the dragging logic and position it with CSS.

Option 1: Fixed at the top of the screen


Replace your addStyles() with this version (and remove
makeDraggable(overlay) call in createOverlay):

function addStyles() {
    const style = document.createElement('style');
    style.innerHTML = `
        #bj-helper-overlay {
            position: fixed;
            top: 10px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0,0,0,0.85);
            color: white;
            padding: 12px 18px;
            border-radius: 10px;
            border: 2px solid;
            font-family: Arial,"Helvetica Neue",Helvetica,sans-serif;
            text-align: center;
            z-index: 9999;
            box-shadow: 0 4px 8px rgba(0,0,0,0.5);
            min-width: 150px;
            transition: all 0.3s ease;
            user-select: none;
        }
        #bj-helper-advice-text { font-size: 24px; font-weight: bold; text-shadow: 0 0 5px #000; }
        #bj-helper-hand-total { font-size: 14px; opacity: 0.8; margin-top: 4px; }
        .bj-hit   { border-color: #ff9900; background-color: rgba(102,60,0,0.7); }
        .bj-stand, .bj-double { border-color: #4CAF50; background-color: rgba(30,77,32,0.7); }
        .bj-split { border-color: #2196F3; background-color: rgba(13,60,99,0.7); }
        .bj-idle  { border-color: #666; }
    `;
    document.head.appendChild(style);
}

And in createOverlay() remove this line:

makeDraggable(overlay);

This will pin it top-center.

Option 2: Inline just above <div class="blackjack-wrap">


In createOverlay(), instead of appending to document.body,
insert before .blackjack-wrap:

function createOverlay() {
    if (document.getElementById('bj-helper-overlay')) return;
    const overlay = document.createElement('div');
    overlay.id = 'bj-helper-overlay';
    overlay.innerHTML = `
        <div>
            <div id="bj-helper-advice-text">---</div>
            <div id="bj-helper-hand-total">Waiting for hand</div>
        </div>`;
    
    const gameWrap = document.querySelector('.blackjack-wrap');
    if (gameWrap && gameWrap.parentNode) {
        gameWrap.parentNode.insertBefore(overlay, gameWrap);
    } else {
        document.body.appendChild(overlay);
    }
}


And update #bj-helper-overlay style to be position: relative;
with margin-bottom: 8px; so it flows naturally:

#bj-helper-overlay {
    position: relative;
    margin-bottom: 8px;
    background-color: rgba(0,0,0,0.85);
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    border: 2px solid;
    font-family: Arial,"Helvetica Neue",Helvetica,sans-serif;
    text-align: center;
    z-index: 9999;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    min-width: 150px;
    transition: all 0.3s ease;
    user-select: none;
}

§
发布于:2025-09-29

Can confirm, option 1 above worked - thank you!

发布留言

登录以发布留言。