Nerd Mode Documentation

Overview

The nerd mode toggle allows visitors to switch between two viewing modes:

How It Works

Toggle Location

User Experience

  1. First Visit: Shows a helpful tooltip explaining the feature
  2. Preference Persistence: Uses cookies to remember user’s choice for 1 year
  3. Instant Toggle: Immediate visual feedback when switching modes

What Changes in Non-Nerd Mode

Hidden Elements:

Preserved Elements:

Visual Changes:

Technical Implementation

CSS Classes

Terminal Command Lines

<p class="terminal-command">
    <span class="hostname">graydot.ai</span>:~$ 
    <span class="command">ls <span class="command-output">Portfolio</span></span>
</p>

Non-Nerd Mode Targeting

body.non-nerd-mode .terminal-command {
    display: block;
}

body.non-nerd-mode .terminal-command > * {
    display: none;
}

body.non-nerd-mode .command-output {
    display: block !important;
    color: #007acc;
    font-weight: bold;
    font-size: 18px;
}

body.non-nerd-mode .terminal-box {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
}

JavaScript Functionality

Toggle Function

function toggleNerdMode() {
    const isNerdMode = !document.body.classList.contains('non-nerd-mode');
    setNerdMode(!isNerdMode);
    setCookie('nerdMode', (!isNerdMode).toString(), 365);
}

File Structure

_layouts/
β”œβ”€β”€ default.html          # Contains nerd mode toggle implementation
β”œβ”€β”€ blog.html             # Inherits nerd mode from default.html

index.html                # Uses terminal-command classes
about.html                # Uses terminal-command classes
_posts/                   # Blog posts inherit nerd mode functionality

Customization

Adding Nerd Mode to New Content

  1. Command Lines: Add terminal-command class to command prompts:
    <p class="terminal-command">
        <span class="hostname">graydot.ai</span>:~$ 
        <span class="command">your-command</span>
    </p>
    
  2. Terminal Elements: Use existing classes:
    • .hostname - The terminal hostname
    • .command - The command text
    • .command-output - Command output/parameters
    • .menu-bar - Terminal window controls

Styling Customization

Toggle Button

.nerd-toggle {
    /* Modify position, colors, size */
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #007acc;
}

Non-Nerd Mode Overrides

body.non-nerd-mode .your-element {
    /* Custom styling for non-nerd mode */
}

Mobile Responsiveness

Includes responsive design for mobile devices:

@media (max-width: 768px) {
    .nerd-toggle {
        top: 10px;
        right: 10px;
        font-size: 11px;
        z-index: 1002;
    }
    
    .mobile-sidebar-toggle {
        display: block;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1001;
    }
    
    .sidebar {
        position: fixed;
        left: -100%;
        width: 280px;
        transition: left 0.3s ease;
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
}

Mobile Features:

Accessibility

Browser Compatibility

Testing

Manual Testing

  1. Visit site for first time β†’ Should show tooltip
  2. Toggle nerd mode β†’ Should hide terminal elements
  3. Refresh page β†’ Should remember preference
  4. Clear cookies β†’ Should reset to default (nerd mode on)

Elements to Verify

Future Enhancements

Potential improvements:

Troubleshooting

Common Issues

  1. Toggle not working: Check browser console for JavaScript errors
  2. Styling issues: Verify CSS class names match implementation
  3. Persistence problems: Check if cookies are enabled
  4. Mobile layout: Test responsive design on various screen sizes

Debug Mode

Add to browser console:

// Check current mode
console.log('Nerd mode:', !document.body.classList.contains('non-nerd-mode'));

// Check cookies
console.log('Cookies:', document.cookie);