Move DIVs and rename Message class combined

by dledle2

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Barcode & QR Scanner with QuaggaJS</title>
    <style>
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
        }
        
        body {
            background-color: #f5f5f7;
            color: #333;
            line-height: 1.6;
            padding: 20px;
            max-width: 1200px;
            margin: 0 auto;
        }
        
        header {
            text-align: center;
            margin-bottom: 30px;
            padding: 20px;
            background: linear-gradient(135deg, #6e48aa, #9d50bb);
            color: white;
            border-radius: 12px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        
        h1 {
            font-size: 2.5rem;
            margin-bottom: 10px;
        }
        
        .subtitle {
            font-size: 1.2rem;
            opacity: 0.9;
        }
        
        .container {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
        }
        
        @media (max-width: 768px) {
            .container {
                grid-template-columns: 1fr;
            }
        }
        
        .panel {
            background: white;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        
        .panel h2 {
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 2px solid #f0f0f0;
            color: #6e48aa;
        }
        
        #camera-container {
            position: relative;
            width: 100%;
            height:...

JavaScript

try { const appRoot = document.getElementById("appRoot"); if (!appRoot) throw new Error('Element with id "appRoot" not found.'); document.querySelectorAll('div[class*="_Text"][class*="_readOnlyText"]').forEach(div => { try { appRoot.appendChild(div); } catch (innerError) { console.error("Error moving div:", innerError); } }); } catch (error) { console.error("Error in script execution:", error); } document.querySelectorAll('div[class*="Message"]').forEach(div => { try { div.className = div.className.replace(/Message/g, 'Message2'); } catch (e) { console.error(e); } });