Skip to content

Instantly share code, notes, and snippets.

@zhuhuilin
Created November 25, 2025 14:15
Show Gist options
  • Select an option

  • Save zhuhuilin/01656866b3e73a677a434c21183b40d2 to your computer and use it in GitHub Desktop.

Select an option

Save zhuhuilin/01656866b3e73a677a434c21183b40d2 to your computer and use it in GitHub Desktop.
Enable macOS Internet Sharing without an actual internet connection. Three bash scripts using only native macOS commands - no installations required. Perfect for creating local WiFi networks for development, testing, and device-to-device communication.

macOS Internet Sharing Without Internet Connection

Three bash scripts to enable macOS Internet Sharing (Personal Hotspot) without requiring an actual internet connection. Perfect for creating local WiFi networks for development, testing, or device-to-device communication.

✨ Features

  • Zero dependencies - Uses only native macOS commands
  • Smart & safe - Preserves existing configurations
  • Reversible - Easy setup and teardown
  • State tracking - Remembers what was changed
  • Tested on macOS 13+ (Sonoma, Sequoia)

📋 The Scripts

1. setup-adhoc-network.sh

Creates or reuses a network service on the loopback interface and configures it for Internet Sharing.

What it does:

  • Finds your active internet connection and saves it
  • Creates "AdHoc" network service on lo0 (or reuses existing)
  • Assigns IP 10.10.10.1 if needed (preserves existing IPs)
  • Saves state for safe removal

2. remove-adhoc-network.sh

Safely disables Internet Sharing and restores your original configuration.

What it does:

  • Turns off Internet Sharing completely
  • Re-enables your original internet connection
  • Removes IP configuration (only if added by setup)
  • Preserves the network service (doesn't delete it)

3. restore-loopback-native.sh

Completely resets the loopback interface to macOS defaults (optional cleanup).

What it does:

  • Removes ALL network services from lo0
  • Cleans all IP addresses except 127.0.0.1
  • Restores pristine macOS state

🚀 Quick Start

Installation

# Download the scripts
curl -O https://gist.github.com/[your-username]/[gist-id]/raw/setup-adhoc-network.sh
curl -O https://gist.github.com/[your-username]/[gist-id]/raw/remove-adhoc-network.sh
curl -O https://gist.github.com/[your-username]/[gist-id]/raw/restore-loopback-native.sh

# Make executable
chmod +x setup-adhoc-network.sh remove-adhoc-network.sh restore-loopback-native.sh

Usage

Enable Internet Sharing

./setup-adhoc-network.sh

Then manually enable in System Settings:

  1. Go to System Settings > General > Sharing > Internet Sharing
  2. Share connection from: AdHoc (or the service name shown)
  3. To computers using: Wi-Fi
  4. Enable the toggle ✓

Your Mac will now broadcast a WiFi network without requiring internet!

Disable Internet Sharing

./remove-adhoc-network.sh

This will:

  • ✓ Turn off Internet Sharing
  • ✓ Re-enable your original internet service
  • ✓ Clean up IP configuration (only what was added)
  • ✓ Preserve the network service for future use

Complete Reset (Optional)

./restore-loopback-native.sh

Use this to completely remove all custom network services from lo0 and restore to factory defaults.

🔍 How It Works

macOS requires an active network service with an IP address before allowing Internet Sharing. The trick:

  1. Creates a network service on the loopback interface (lo0)
  2. Assigns a static IP (10.10.10.1) to simulate an active connection
  3. macOS is tricked into thinking there's internet available
  4. Internet Sharing becomes enabled without requiring real internet

The scripts intelligently handle existing configurations, track changes, and provide safe cleanup.

🛠️ Technical Details

All commands are native to macOS:

  • networksetup - Network configuration
  • ifconfig - Interface configuration
  • /usr/libexec/PlistBuddy - Property list editing
  • plutil - Property list conversion
  • launchctl - Service management
  • route - Routing table
  • Standard Unix tools: grep, awk, sed, cut, killall

No installations required:

  • ✗ No Homebrew
  • ✗ No Xcode Command Line Tools
  • ✗ No Python or other languages
  • ✓ Works on fresh macOS installation

📝 Requirements

  • macOS 13+ (tested on Sonoma & Sequoia)
  • Administrator (sudo) privileges
  • Works on Intel and Apple Silicon Macs

⚠️ Important Notes

  • The network service will remain visible in System Settings (this is normal and harmless)
  • Internet Sharing will broadcast WiFi but won't provide actual internet access (as intended)
  • Scripts require sudo password when run
  • The lo0 interface is only used for the trick - your actual network adapters are not affected

🎯 Use Cases

Perfect for:

  • Local development - Test networked applications without internet
  • IoT device setup - Connect devices that need WiFi configuration
  • Device-to-device communication - Create ad-hoc networks
  • Testing - Simulate network environments
  • Offline demos - Present without relying on venue WiFi

🐛 Troubleshooting

Internet Sharing won't enable

  • Run ./remove-adhoc-network.sh first to clean up
  • Run ./setup-adhoc-network.sh again
  • Check System Settings to ensure the AdHoc service is selected

Service not showing in Internet Sharing

  • The service might be disabled - check System Settings > Network
  • Run setup script again to recreate it

Want to start completely fresh

  • Run ./restore-loopback-native.sh to reset everything
  • Then run ./setup-adhoc-network.sh to set up again

📖 Related Resources

📄 License

These scripts are provided as-is for educational and development purposes. Use at your own risk.

🙏 Credits

Created to solve the frustrating limitation of macOS Internet Sharing requiring an actual internet connection.

💬 Feedback

Questions, issues, or improvements? Leave a comment on the Reddit thread or create an issue on this Gist!


Last Updated: November 2025 Tested On: macOS Sonoma 14.x, macOS Sequoia 15.x, Mac Studio M4 Max

#!/bin/bash
#
# Remove Ad Hoc Network Service
# This script stops the hotspot, re-enables the original internet connection,
# and conditionally removes IP configuration based on saved state
#
set -e # Exit on any error
# File to store the active network service
STATE_FILE="$HOME/.adhoc-network-state"
echo "🗑️ Removing Ad Hoc network configuration..."
# Stop Internet Sharing / Hotspot
echo " → Disabling Internet Sharing..."
# First, disable via System Preferences (works for macOS 13+)
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict Enabled -int 0
# Also disable the AirPort/WiFi sharing component
sudo /usr/libexec/PlistBuddy -c 'Set :NAT:Enabled 0' \
/Library/Preferences/SystemConfiguration/com.apple.nat.plist 2>/dev/null || true
sudo /usr/libexec/PlistBuddy -c 'Set :NAT:AirPort:Enabled 0' \
/Library/Preferences/SystemConfiguration/com.apple.nat.plist 2>/dev/null || true
# Stop the Internet Sharing service
sudo launchctl stop com.apple.InternetSharing 2>/dev/null || true
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist 2>/dev/null || true
# Ensure bootpd (part of Internet Sharing) is also stopped
sudo launchctl stop com.apple.bootpd 2>/dev/null || true
# Kill any remaining Internet Sharing processes
sudo killall -TERM InternetSharing 2>/dev/null || true
# Give the system time to process the changes
sleep 1
echo " ✓ Internet Sharing disabled"
# Read state from file
if [ -f "$STATE_FILE" ]; then
STATE_DATA=$(cat "$STATE_FILE")
ORIGINAL_SERVICE=$(echo "$STATE_DATA" | cut -d'|' -f1)
LOOPBACK_SERVICE=$(echo "$STATE_DATA" | cut -d'|' -f2)
NO_DELETION=$(echo "$STATE_DATA" | cut -d'|' -f3)
echo " ✓ Read state:"
echo " - Original service: $ORIGINAL_SERVICE"
echo " - Loopback service: $LOOPBACK_SERVICE"
echo " - IP preservation mode: $NO_DELETION"
else
echo " ⚠️ State file not found ($STATE_FILE)"
echo " Cannot determine configuration details"
NO_DELETION="yes" # Default to safe mode - don't delete anything
fi
# Re-enable the original network service
if [ -n "$ORIGINAL_SERVICE" ]; then
echo " → Re-enabling original service: $ORIGINAL_SERVICE"
# Check if service is disabled (has asterisk)
if networksetup -listallnetworkservices | grep -q "^\*$ORIGINAL_SERVICE$"; then
sudo networksetup -setnetworkserviceenabled "$ORIGINAL_SERVICE" on
echo " ✓ Service re-enabled"
else
echo " ℹ️ Service is already enabled"
fi
fi
# Handle IP address based on NO_DELETION flag
if [ -n "$LOOPBACK_SERVICE" ]; then
if [ "$NO_DELETION" = "yes" ]; then
echo " ℹ️ Preserving existing IP configuration on $LOOPBACK_SERVICE"
echo " (IP was already configured before setup)"
else
echo " → Removing IP configuration from $LOOPBACK_SERVICE..."
# Set to DHCP to clear manual IP configuration
sudo networksetup -setdhcp "$LOOPBACK_SERVICE" 2>/dev/null || \
echo " ⚠️ Could not set DHCP (service may not support it)"
echo " ✓ IP configuration cleared"
fi
echo " ℹ️ Network service '$LOOPBACK_SERVICE' preserved (not removed)"
fi
# Restore NAT configuration to default
echo " → Restoring NAT configuration..."
sudo /usr/libexec/PlistBuddy -c 'Set :NAT:PrimaryInterface:Device lo0' \
/Library/Preferences/SystemConfiguration/com.apple.nat.plist 2>/dev/null || true
# Clean up state file
if [ -f "$STATE_FILE" ]; then
rm "$STATE_FILE"
echo " ✓ State file cleaned up"
fi
echo ""
echo "✅ Ad Hoc configuration removed successfully!"
echo ""
if [ -n "$ORIGINAL_SERVICE" ]; then
echo "Original service '$ORIGINAL_SERVICE' has been re-enabled."
fi
if [ -n "$LOOPBACK_SERVICE" ]; then
echo "Loopback service '$LOOPBACK_SERVICE' has been preserved."
fi
echo ""
echo "Verifying Internet Sharing status..."
IS_ENABLED=$(sudo defaults read /Library/Preferences/SystemConfiguration/com.apple.nat NAT 2>/dev/null | grep "Enabled" | head -1 | grep -o "[01]" || echo "0")
if [ "$IS_ENABLED" = "0" ]; then
echo " ✓ Internet Sharing is DISABLED in System Settings"
else
echo " ⚠️ Internet Sharing may still be enabled - please check System Settings"
fi
echo ""
#!/bin/bash
#
# Restore Loopback to Native macOS State
# This script removes all network services on lo0 and restores
# the loopback interface to its default configuration
# Uses only native macOS commands - no installations required
#
set -e # Exit on any error
echo "🔄 Restoring loopback interface to native macOS state..."
# Step 1: Find all network services on lo0
echo " → Finding network services on lo0..."
LOOPBACK_SERVICES=()
for service in $(networksetup -listallnetworkservices | grep -v "^An asterisk" | grep -v "^\*"); do
# Check if this service is on lo0
if networksetup -listnetworkserviceorder | grep -A1 "^([0-9]*) $service$" | grep -q "Device: lo0"; then
LOOPBACK_SERVICES+=("$service")
echo " ✓ Found service on lo0: $service"
fi
done
# Also check for disabled services
for service in $(networksetup -listallnetworkservices | grep "^\*" | sed 's/^\*//'); do
# Check if this service is on lo0
if networksetup -listnetworkserviceorder | grep -A1 "^([\*0-9]*) $service$" | grep -q "Device: lo0"; then
LOOPBACK_SERVICES+=("$service")
echo " ✓ Found disabled service on lo0: $service"
fi
done
# Step 2: Remove all network services from lo0
if [ ${#LOOPBACK_SERVICES[@]} -eq 0 ]; then
echo " ℹ️ No network services found on lo0"
else
echo " → Removing network services from lo0..."
# Get the count and last index
total_count=${#LOOPBACK_SERVICES[@]}
last_index=$((total_count - 1))
# Remove all but the last service
for ((i=0; i<last_index; i++)); do
service="${LOOPBACK_SERVICES[$i]}"
echo " - Removing: $service"
sudo networksetup -removenetworkservice "$service"
done
# For the last service, we need to directly edit the preferences.plist
# because macOS won't let us remove the last service on lo0
last_service="${LOOPBACK_SERVICES[$last_index]}"
echo " - Removing final service: $last_service"
# Convert plist to XML, find the UUID, then remove it
PLIST_FILE="/Library/Preferences/SystemConfiguration/preferences.plist"
# Create a temporary XML version
TEMP_XML="/tmp/preferences_temp_$$.xml"
sudo plutil -convert xml1 "$PLIST_FILE" -o "$TEMP_XML"
# Find the UUID for the service - look for the service name in XML
# The structure is: <key>UUID</key> followed by <dict> containing <key>UserDefinedName</key><string>ServiceName</string>
SERVICE_UUID=$(sudo awk -v service="$last_service" '
/<key>[A-F0-9-]+<\/key>/ {uuid=$0; gsub(/.*<key>|<\/key>.*/, "", uuid)}
/<key>UserDefinedName<\/key>/ {getline; if ($0 ~ service) print uuid}
' "$TEMP_XML" | head -1)
sudo rm -f "$TEMP_XML"
if [ -n "$SERVICE_UUID" ]; then
echo " ✓ Found service UUID: $SERVICE_UUID"
# Remove from NetworkServices
sudo /usr/libexec/PlistBuddy -c "Delete :NetworkServices:$SERVICE_UUID" \
"$PLIST_FILE" 2>/dev/null || true
# Find all Sets and remove from ServiceOrder
SET_COUNT=$(sudo /usr/libexec/PlistBuddy -c "Print :Sets" "$PLIST_FILE" 2>/dev/null | grep "Dict {" | wc -l)
for ((set_idx=0; set_idx<SET_COUNT; set_idx++)); do
# Get the set key name
SET_KEY=$(sudo /usr/libexec/PlistBuddy -c "Print :Sets" "$PLIST_FILE" 2>/dev/null | \
grep -E "^ [A-F0-9-]+ = Dict" | sed -n "$((set_idx+1))p" | awk '{print $1}')
if [ -n "$SET_KEY" ]; then
# Count service orders in this set
ORDER_COUNT=$(sudo /usr/libexec/PlistBuddy -c "Print :Sets:$SET_KEY:Network:Global:IPv4:ServiceOrder" "$PLIST_FILE" 2>/dev/null | grep " " | wc -l)
# Find and remove the UUID from ServiceOrder
for ((order_idx=0; order_idx<ORDER_COUNT; order_idx++)); do
ORDER_UUID=$(sudo /usr/libexec/PlistBuddy -c "Print :Sets:$SET_KEY:Network:Global:IPv4:ServiceOrder:$order_idx" "$PLIST_FILE" 2>/dev/null || echo "")
if [ "$ORDER_UUID" = "$SERVICE_UUID" ]; then
sudo /usr/libexec/PlistBuddy -c "Delete :Sets:$SET_KEY:Network:Global:IPv4:ServiceOrder:$order_idx" \
"$PLIST_FILE" 2>/dev/null || true
break
fi
done
fi
done
echo " ✓ Removed $last_service"
else
echo " ⚠️ Could not find UUID for $last_service"
fi
fi
# Step 3: Remove any additional IP addresses from lo0 (keep only 127.0.0.1)
echo " → Cleaning IP addresses on lo0..."
CURRENT_IPS=$(ifconfig lo0 | grep "inet " | awk '{print $2}')
for ip in $CURRENT_IPS; do
if [ "$ip" != "127.0.0.1" ]; then
echo " - Removing IP: $ip"
sudo ifconfig lo0 -alias "$ip"
fi
done
echo " ✓ Only 127.0.0.1 remains on lo0"
# Step 4: Reload network configuration
echo " → Reloading network configuration..."
sudo killall -HUP configd 2>/dev/null || true
sleep 2
echo ""
echo "✅ Loopback interface restored to native macOS state!"
echo ""
echo "Current lo0 configuration:"
ifconfig lo0 | grep -E "flags|inet "
echo ""
echo "Network services:"
networksetup -listallnetworkservices
echo ""
#!/bin/bash
#
# Setup Ad Hoc Network Service
# This script finds the active internet connection, saves it,
# and intelligently manages the loopback network service
#
set -e # Exit on any error
# File to store the active network service and state
STATE_FILE="$HOME/.adhoc-network-state"
echo "🔧 Setting up Ad Hoc network service..."
# Find the network service that currently has internet connection
echo " → Finding active internet connection..."
ACTIVE_SERVICE=$(networksetup -listnetworkserviceorder | grep -B1 "$(route -n get default 2>/dev/null | grep 'interface:' | awk '{print $2}')" | grep '([0-9])' | sed 's/^([0-9]*) //' | head -1)
if [ -z "$ACTIVE_SERVICE" ]; then
echo " ⚠️ No active internet connection found. Checking all services..."
# Try to find first enabled service with IP
for service in $(networksetup -listallnetworkservices | grep -v "^An asterisk" | grep -v "^\*"); do
if networksetup -getinfo "$service" 2>/dev/null | grep -q "IP address:"; then
ACTIVE_SERVICE="$service"
break
fi
done
fi
if [ -z "$ACTIVE_SERVICE" ]; then
echo " ❌ Could not find any active network service"
exit 1
fi
echo " ✓ Found active service: $ACTIVE_SERVICE"
# Step 1: Check if there's already a network service on lo0
echo " → Checking for existing service on lo0..."
LOOPBACK_SERVICE=""
# Get all services and check which one is on lo0
for service in $(networksetup -listallnetworkservices | grep -v "^An asterisk" | grep -v "^\*"); do
# Check if this service is on lo0
if networksetup -listnetworkserviceorder | grep -A1 "^([0-9]*) $service$" | grep -q "Device: lo0"; then
LOOPBACK_SERVICE="$service"
echo " ✓ Found existing service on lo0: $LOOPBACK_SERVICE"
break
fi
done
# If no service exists on lo0, create AdHoc
if [ -z "$LOOPBACK_SERVICE" ]; then
echo " → Creating AdHoc network service on lo0..."
sudo networksetup -createnetworkservice "AdHoc" lo0 2>/dev/null || {
echo " ⚠️ Failed to create service, checking if it exists..."
LOOPBACK_SERVICE="AdHoc"
}
LOOPBACK_SERVICE="AdHoc"
echo " ✓ Created service: $LOOPBACK_SERVICE"
fi
# Step 2: Check if there's any IP address other than 127.0.0.1 on that service
echo " → Checking IP addresses on $LOOPBACK_SERVICE..."
SERVICE_INFO=$(sudo networksetup -getinfo "$LOOPBACK_SERVICE" 2>/dev/null || echo "")
CURRENT_IP=$(echo "$SERVICE_INFO" | grep "IP address:" | awk '{print $3}')
NO_DELETION="no"
if [ -n "$CURRENT_IP" ] && [ "$CURRENT_IP" != "127.0.0.1" ]; then
echo " ✓ Service already has IP: $CURRENT_IP"
echo " ℹ️ Will not modify existing IP configuration"
NO_DELETION="yes"
else
echo " → Configuring $LOOPBACK_SERVICE with IP 10.10.10.1..."
sudo networksetup -setmanual "$LOOPBACK_SERVICE" 10.10.10.1 255.255.255.255
echo " ✓ IP configured"
NO_DELETION="no"
fi
# Save state to file: ACTIVE_SERVICE|LOOPBACK_SERVICE|NO_DELETION
echo "$ACTIVE_SERVICE|$LOOPBACK_SERVICE|$NO_DELETION" > "$STATE_FILE"
echo " ✓ Saved state to: $STATE_FILE"
echo ""
echo "✅ Ad Hoc network service setup complete!"
echo ""
echo "Active internet service: $ACTIVE_SERVICE"
echo "Loopback service name: $LOOPBACK_SERVICE"
echo "IP preservation mode: $NO_DELETION"
echo ""
echo "📝 Next steps:"
echo " 1. Go to System Settings > General > Sharing > Internet Sharing"
echo " 2. Share connection from: $LOOPBACK_SERVICE"
echo " 3. To computers using: Wi-Fi"
echo " 4. Enable Internet Sharing"
echo ""
@safiasumsung119-maker

Copy link
Copy Markdown
<title>WASH KATBGHINI? ❤️</title> <style> :root { --pink-light: #ffdde1; --pink-dark: #ee9ca7; --accent-pink: #ff4d6d; }
    body {
        margin: 0;
        padding: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        background: linear-gradient(135deg, var(--pink-light), var(--pink-dark));
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        overflow: hidden;
        text-align: center;
    }

    .heart {
        position: absolute;
        color: rgba(255, 255, 255, 0.6);
        font-size: 20px;
        animation: float 6s linear infinite;
        z-index: 0;
    }

    @keyframes float {
        0% { transform: translateY(100vh) rotate(0deg); opacity: 1; }
        100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; }
    }

    .container {
        background: rgba(255, 255, 255, 0.85);
        padding: 2rem;
        border-radius: 30px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
        z-index: 10;
        max-width: 90%;
        width: 450px;
        backdrop-filter: blur(8px);
        position: relative;
    }

    /* Notification sghira */
    #note {
        background: var(--accent-pink);
        color: white;
        padding: 5px 15px;
        border-radius: 20px;
        font-size: 0.9rem;
        position: absolute;
        top: -15px;
        left: 50%;
        transform: translateX(-50%);
        display: none;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        white-space: nowrap;
    }

    .teddy-bear {
        font-size: 80px;
        margin-bottom: 10px;
        display: block;
        transition: transform 0.3s ease;
    }

    h1 {
        color: #d81b60;
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    .btn-group {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 15px;
        min-height: 200px;
        justify-content: center;
    }

    button {
        font-weight: bold;
        border: none;
        border-radius: 50px;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }

    #btn-ah {
        background: linear-gradient(to right, #ff4d6d, #ff758c);
        color: white;
        padding: 15px 40px;
        font-size: 1.2rem;
        z-index: 20;
    }

    #btn-la {
        background: white;
        color: #ff4d6d;
        border: 2px solid #ff4d6d;
        padding: 8px 25px;
        font-size: 1rem;
    }

    #success-screen {
        display: none;
    }

    .celebration-text {
        color: #ff4d6d;
        font-size: 1.8rem;
        font-weight: bold;
        margin-top: 15px;
        line-height: 1.4;
    }

    .hearts-burst {
        font-size: 40px;
        margin-top: 10px;
    }
</style>
<div id="hearts-container"></div>

<div class="container">
    <div id="note">3afaaaak 🥺</div>
    
    <div id="main-content">
        <span class="teddy-bear" id="teddy">🧸</span>
        <h1 id="question">WASH KATBGHINI?</h1>
        
        <div class="btn-group">
            <button id="btn-ah" onclick="sayYes()">AH</button>
            <button id="btn-la" onclick="handleNo()">LA</button>
        </div>
    </div>

    <div id="success-screen">
        <span class="teddy-bear">💖🧸💖</span>
        <div class="celebration-text">
            Yeeeeey ik u love me 😍😍<br>
            <span style="font-size: 1.2rem;">ANA TANBGHIK BZZEF! ❤️✨</span>
        </div>
        <div class="hearts-burst">🥰🌹💎🍭</div>
    </div>
</div>

<script>
    let clickCount = 0;
    const notes = [
        "3afaaaak 🥺",
        "Don’t break my heart 💔",
        "Think again... 🧐",
        "Pleaseee 🎀",
        "Ik u love me 😏",
        "Ghir zid fker! 🌸",
        "Will u really say no? 😢"
    ];

    function createHearts() {
        const container = document.getElementById('hearts-container');
        for (let i = 0; i < 15; i++) {
            const heart = document.createElement('div');
            heart.className = 'heart';
            heart.innerHTML = ['❤️', '💖', '✨', '🌸'][Math.floor(Math.random() * 4)];
            heart.style.left = Math.random() * 100 + 'vw';
            heart.style.animationDuration = (Math.random() * 3 + 3) + 's';
            container.appendChild(heart);
            setTimeout(() => heart.remove(), 6000);
        }
    }
    setInterval(createHearts, 2000);

    function handleNo() {
        clickCount++;
        
        // 1. Kabbel bouton AH
        const btnAh = document.getElementById('btn-ah');
        const newSize = 1.2 + (clickCount * 0.3); // Kulla mra t-zid 0.3
        const newPadding = 15 + (clickCount * 10);
        
        btnAh.style.transform = `scale(${newSize})`;
        
        // 2. Tle3 notification
        const note = document.getElementById('note');
        note.style.display = 'block';
        note.innerText = notes[clickCount % notes.length];
        
        // 3. Ze3ze3 teddy chwiya
        const teddy = document.getElementById('teddy');
        teddy.style.transform = 'scale(1.2) rotate(10deg)';
        setTimeout(() => teddy.style.transform = 'scale(1) rotate(0deg)', 200);
    }

    function sayYes() {
        document.getElementById('main-content').style.display = 'none';
        document.getElementById('note').style.display = 'none';
        document.getElementById('success-screen').style.display = 'block';
        
        // Inflate hearts explosion
        for(let i=0; i<50; i++) {
            setTimeout(createHearts, i * 50);
        }
    }
</script>

@safiasumsung119-maker

Copy link
Copy Markdown

<title>WASH KATBGHINI? ❤️</title> <style> :root { --pink-light: #ffdde1; --pink-dark: #ee9ca7; --accent-pink: #ff4d6d; }
    body {
        margin: 0;
        padding: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        background: linear-gradient(135deg, var(--pink-light), var(--pink-dark));
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        overflow: hidden;
        text-align: center;
    }

    .heart {
        position: absolute;
        color: rgba(255, 255, 255, 0.6);
        font-size: 20px;
        animation: float 6s linear infinite;
        z-index: 0;
    }

    @keyframes float {
        0% { transform: translateY(100vh) rotate(0deg); opacity: 1; }
        100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; }
    }

    .container {
        background: rgba(255, 255, 255, 0.85);
        padding: 2rem;
        border-radius: 30px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
        z-index: 10;
        max-width: 90%;
        width: 450px;
        backdrop-filter: blur(8px);
        position: relative;
    }

    /* Notification sghira */
    #note {
        background: var(--accent-pink);
        color: white;
        padding: 5px 15px;
        border-radius: 20px;
        font-size: 0.9rem;
        position: absolute;
        top: -15px;
        left: 50%;
        transform: translateX(-50%);
        display: none;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        white-space: nowrap;
    }

    .teddy-bear {
        font-size: 80px;
        margin-bottom: 10px;
        display: block;
        transition: transform 0.3s ease;
    }

    h1 {
        color: #d81b60;
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    .btn-group {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 15px;
        min-height: 200px;
        justify-content: center;
    }

    button {
        font-weight: bold;
        border: none;
        border-radius: 50px;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }

    #btn-ah {
        background: linear-gradient(to right, #ff4d6d, #ff758c);
        color: white;
        padding: 15px 40px;
        font-size: 1.2rem;
        z-index: 20;
    }

    #btn-la {
        background: white;
        color: #ff4d6d;
        border: 2px solid #ff4d6d;
        padding: 8px 25px;
        font-size: 1rem;
    }

    #success-screen {
        display: none;
    }

    .celebration-text {
        color: #ff4d6d;
        font-size: 1.8rem;
        font-weight: bold;
        margin-top: 15px;
        line-height: 1.4;
    }

    .hearts-burst {
        font-size: 40px;
        margin-top: 10px;
    }
</style>
<div id="hearts-container"></div>

<div class="container">
    <div id="note">3afaaaak 🥺</div>
    
    <div id="main-content">
        <span class="teddy-bear" id="teddy">🧸</span>
        <h1 id="question">WASH KATBGHINI?</h1>
        
        <div class="btn-group">
            <button id="btn-ah" onclick="sayYes()">AH</button>
            <button id="btn-la" onclick="handleNo()">LA</button>
        </div>
    </div>

    <div id="success-screen">
        <span class="teddy-bear">💖🧸💖</span>
        <div class="celebration-text">
            Yeeeeey ik u love me 😍😍<br>
            <span style="font-size: 1.2rem;">ANA TANBGHIK BZZEF! ❤️✨</span>
        </div>
        <div class="hearts-burst">🥰🌹💎🍭</div>
    </div>
</div>

<script>
    let clickCount = 0;
    const notes = [
        "3afaaaak 🥺",
        "Don’t break my heart 💔",
        "Think again... 🧐",
        "Pleaseee 🎀",
        "Ik u love me 😏",
        "Ghir zid fker! 🌸",
        "Will u really say no? 😢"
    ];

    function createHearts() {
        const container = document.getElementById('hearts-container');
        for (let i = 0; i < 15; i++) {
            const heart = document.createElement('div');
            heart.className = 'heart';
            heart.innerHTML = ['❤️', '💖', '✨', '🌸'][Math.floor(Math.random() * 4)];
            heart.style.left = Math.random() * 100 + 'vw';
            heart.style.animationDuration = (Math.random() * 3 + 3) + 's';
            container.appendChild(heart);
            setTimeout(() => heart.remove(), 6000);
        }
    }
    setInterval(createHearts, 2000);

    function handleNo() {
        clickCount++;
        
        // 1. Kabbel bouton AH
        const btnAh = document.getElementById('btn-ah');
        const newSize = 1.2 + (clickCount * 0.3); // Kulla mra t-zid 0.3
        const newPadding = 15 + (clickCount * 10);
        
        btnAh.style.transform = `scale(${newSize})`;
        
        // 2. Tle3 notification
        const note = document.getElementById('note');
        note.style.display = 'block';
        note.innerText = notes[clickCount % notes.length];
        
        // 3. Ze3ze3 teddy chwiya
        const teddy = document.getElementById('teddy');
        teddy.style.transform = 'scale(1.2) rotate(10deg)';
        setTimeout(() => teddy.style.transform = 'scale(1) rotate(0deg)', 200);
    }

    function sayYes() {
        document.getElementById('main-content').style.display = 'none';
        document.getElementById('note').style.display = 'none';
        document.getElementById('success-screen').style.display = 'block';
        
        // Inflate hearts explosion
        for(let i=0; i<50; i++) {
            setTimeout(createHearts, i * 50);
        }
    }
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment