Jump to content

User:Ieditrandomarticles/wikiware.js

From Simple English Wikipedia, the free encyclopedia

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
mw.loader.using('mediawiki.util', function () {
    $(function () {
    	let counter = 0;
        const style = `
            .wikiHackWindow {
                position: fixed;
                background: #1f1f1f;
                border: 1px solid #444;
                color: #eee;
                font-family: 'Segoe UI', sans-serif;
                z-index: 99999;
                width: 260px;
                border-radius: 8px;
                box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
                user-select: none;
                transition: box-shadow 0.2s ease;
            }
            .wikiHackWindow:hover {
                box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5);
            }
            .wikiHackHeader {
                background: linear-gradient(90deg, #585858, #3a3a3a);
                color: #fff;
                font-weight: 600;
                padding: 6px 12px;
                cursor: move;
                border-bottom: 1px solid #555;
                border-top-left-radius: 8px;
                border-top-right-radius: 8px;
                text-align: center;
            }
            .wikiHackBody {
                padding: 10px;
                background: #2a2a2a;
                border-bottom-left-radius: 8px;
                border-bottom-right-radius: 8px;
            }
            .menu-item {
                background: #333;
                border: 1px solid #555;
                color: #ddd;
                padding: 6px;
                margin: 5px 0;
                cursor: pointer;
                font-size: 0.9em;
                text-align: center;
                border-radius: 6px;
                transition: background 0.2s, color 0.2s;
            }
            .menu-item:hover {
                background: #888;
                color: #000;
            }
        `;
        $('<style>').text(style).appendTo('head');

        const modules = [
        	
        ];

        const windows = [];

        modules.forEach(mod => {
            const box = $(`
                <div class="wikiHackWindow" style="top: 100px; left: ${counter * 300 + 20}px;">
                    <div class="wikiHackHeader">${mod.title}</div>
                    <div class="wikiHackBody">
                        <div class="menu-item">Example 1</div>
                        <div class="menu-item">Example 2</div>
                        <div class="menu-item">Example 3</div>
                        <div class="menu-item">Example 4</div>
                    </div>
                </div>
            `);
            $('body').append(box);
            windows.push(box);
            counter++;

            const header = box.find('.wikiHackHeader');
            let isDragging = false, offsetX, offsetY;

            header.on('mousedown', function (e) {
                isDragging = true;
                offsetX = e.clientX - box.offset().left;
                offsetY = e.clientY - box.offset().top;
                $('body').on('mousemove.wikiHackDrag', function (e) {
                    if (isDragging) {
                        box.css({
                            left: (e.clientX - offsetX) + 'px',
                            top: (e.clientY - offsetY) + 'px'
                        });
                    }
                }).on('mouseup.wikiHackDrag', function () {
                    isDragging = false;
                    $('body').off('.wikiHackDrag');
                });
            });
        });

        $(document).on('keydown', function (e) {
            if (e.key === '`') {
                windows.forEach(w => w.toggle());
            }
        });

        windows.forEach(w => w.toggle());

        console.log("[COMMON.JS] Loaded WikiWare v0.0.6 with Static Script Lab");
    });
});